Historique des modifications - Message

Message #1249

Sujet: Ode C#


Type Date Auteur Contenu
Création du message 24-01-2007 17:49:25 N10
Dsl d'avoir mi autant de temps mais j'aivais des exams als pour faire cour voila mon programme si tu peut y voir plus claire et m'aider smile merci d'avance.

using System;
using System.Collections.Generic;
using System.Windows.Forms;
using Irrlicht;
using Irrlicht.Video;
using Irrlicht.Core;
using Irrlicht.Scene;
using Irrlicht.GUI;
using Irrlicht.IO;
using System.ComponentModel;
using System.Data;
using System.Threading;
using System.Drawing;
using ODE;
using ODE.Geoms;
using ODE.NoMDX;
using _d_real;
using IrrCP_Ode;



namespace real
{
class Program
{
// start up the engine
private Physique maPhysique;
private Thread monThreadDeRenduPhysique;


// Point d'entrée principal de l'application.
[STAThread]
static void Main(string[] args)
{
Program prog = new Program();
prog.run();
}

public void run()
{
//device
IrrlichtDevice device = new IrrlichtDevice(Irrlicht.Video.DriverType.DIRECT3D9, new Dimension2D(1024, 768), 32, false, true, true);


//scene et driver en place
ISceneManager smgr = device.SceneManager;
IVideoDriver driver = device.VideoDriver;

//load map
IAnimatedMesh levelmesh = smgr.GetMesh("media/zone 01/01.dmf");
IAnimatedMesh ball = smgr.GetMesh("media/ball/ball.dmf");

//envoi collision type OctTree
ISceneNode levelnode = null;
if (levelmesh != null)
levelnode = smgr.AddOctTreeSceneNode(levelmesh.GetMesh(0), null, 0);
levelnode.Scale = new Vector3D(1, 1, 1);

//ball

float z = 35;
float y = 160;
float x = 0;
ISceneNode ballnode = null;
if (ball != null)
ballnode = smgr.AddOctTreeSceneNode(ball.GetMesh(0), null, 0);

ITriangleSelector sb = null;
if (ballnode != null)
{
ballnode.Position = new Vector3D(x,y,z);
ballnode.Scale = new Vector3D(1, 1, 1);
sb = smgr.CreateOctTreeTriangleSelector(ball.GetMesh(0), ballnode, 128);
}

//reponse de collision ball
ISceneNodeAnimator collision = smgr.CreateCollisionResponseAnimator(sb, levelnode, new Vector3D(10, 50, 10),
new Vector3D(0, 0, 0), new Vector3D(0, 10, 0), 0);
levelnode.AddAnimator(collision);


//physik initialisation ball
maPhysique = new Physique();
monThreadDeRenduPhysique = new Thread(new ThreadStart(maPhysique.PhysiqueRenderLoop));
monThreadDeRenduPhysique.IsBackground = true;
monThreadDeRenduPhysique.Start();

//add font
IGUIFont font = device.GUIEnvironment.GetFont("media/font/fontcourier.bmp");
Rect imp1 = new Rect(349, 15, 385, 78);

//camera
ICameraSceneNode cam = smgr.AddCameraSceneNode(null, new Vector3D(-600, 700, z), new Vector3D(0, x, z), 0);

//Add a light
smgr.AddLightSceneNode(null, new Vector3D(0, 1000, 0),
new Colorf(1.0f, 1.0f, 1.0f, 1.0f), 5000, 500);

//add skybox
device.SceneManager.AddSkyBoxSceneNode(
device.VideoDriver.GetTexture("media/sky/_up.jpg"),
device.VideoDriver.GetTexture("media/sky/_dn.jpg"),
device.VideoDriver.GetTexture("media/sky/_lf.jpg"),
device.VideoDriver.GetTexture("media/sky/_rt.jpg"),
device.VideoDriver.GetTexture("media/sky/_ft.jpg"),
device.VideoDriver.GetTexture("media/sky/_bk.jpg"),
null, -1);

//retirer le cursor
device.CursorControl.Visible = false;

int fps = 0;

while (device.Run())
{
if (device.WindowActive)
{
device.VideoDriver.BeginScene(true, true, new Irrlicht.Video.Color(100, 100, 100, 100));
device.SceneManager.DrawAll();

if (font != null)
{
font.Draw("x ->" + ballnode.Position.X.ToString(), new Rect(10, 10, 10, 10), new Irrlicht.Video.Color(255, 200, 0, 0), false, false);
font.Draw("y ->" + ballnode.Position.Y.ToString(), new Rect(10, 20, 10, 10), new Irrlicht.Video.Color(255, 200, 0, 0), false, false);
font.Draw("z ->" + ballnode.Position.Z.ToString(), new Rect(10, 30, 10, 10), new Irrlicht.Video.Color(255, 200, 0, 0), false, false);
}

device.VideoDriver.EndScene();
// display frames per second value
if (fps != device.VideoDriver.FPS)
{
fps = device.VideoDriver.FPS;
device.WindowCaption = "Moteur - irrlicht [" + device.VideoDriver.Name + "] fps:" + fps;
}

}

}
}

}

}

Retour

Options Liens officiels Caractéristiques Statistiques Communauté
Préférences cookies
Corrections
irrlicht
irrklang
irredit
irrxml
Propulsé par Django
xhtml 1.0
css 2.1
884 membres
1440 sujets
11337 messages
Dernier membre inscrit: Saidov17
118 invités en ligne
membre en ligne: -
RSS Feed