static void Main() { device = IrrlichtDevice.CreateDevice(DriverType.OpenGL, new Dimension2Di(800, 600)); device.SetWindowCaption("Sphere Camera - Irrlicht Engine"); driver = device.VideoDriver; scene = device.SceneManager; sphere = scene.AddSphereSceneNode(5, 100); sphere.SetMaterialTexture(0, driver.GetTexture("../../media/earth.jpg")); sphere.TriangleSelector = scene.CreateTriangleSelector(sphere.Mesh, sphere); sphere.TriangleSelector.Drop(); scene.AmbientLight = new Colorf(0.2f, 0.2f, 0.2f); LightSceneNode light = scene.AddLightSceneNode(); light.Position = new Vector3Df(-10, 10, -10); camera = new SphereCamera(device, new Vector3Df(0), 8, 20, 10, 0, 0); camera.Inclination = 200; path = new SpherePath(5.4f); GUIFont font = device.GUIEnvironment.BuiltInFont; device.OnEvent += new IrrlichtDevice.EventHandler(device_OnEvent); device.PostEvent(new Event('r', KeyCode.KeyR, true)); // pretend user pressed [R] while (device.Run()) { driver.BeginScene(); scene.DrawAll(); path.Draw(driver); font.Draw("Press [Arrows], [LMB] and [Mouse Scroll] to change view", 10, 10, Color.SolidYellow); font.Draw("Press [RMB] on Earth to place new path point", 10, 20, Color.SolidYellow); font.Draw("Press [R] to reload path data from file", 10, 30, Color.SolidYellow); font.Draw("Press [C] to clean up", 10, 40, Color.SolidYellow); font.Draw(driver.FPS.ToString() + " fps", 10, driver.ScreenSize.Height - 40, Color.SolidYellow); font.Draw(path.PointCount.ToString() + " point(s)", 10, driver.ScreenSize.Height - 30, Color.SolidYellow); font.Draw(camera.ToString(), 10, driver.ScreenSize.Height - 20, Color.SolidYellow); driver.EndScene(); device.Yield(); } path.Drop(); device.Drop(); }
static void Main(string[] args) { device = IrrlichtDevice.CreateDevice(DriverType.OpenGL, new Dimension2Di(800, 600)); device.SetWindowCaption("Sphere Camera - Irrlicht Engine"); driver = device.VideoDriver; scene = device.SceneManager; sphere = scene.AddSphereSceneNode(5, 100); sphere.SetMaterialTexture(0, driver.GetTexture("../../media/earth.jpg")); sphere.TriangleSelector = scene.CreateTriangleSelector(sphere.Mesh, sphere); sphere.TriangleSelector.Drop(); scene.AmbientLight = new Colorf(0.2f, 0.2f, 0.2f); LightSceneNode light = scene.AddLightSceneNode(); light.Position = new Vector3Df(-10, 10, -10); camera = new SphereCamera(device, new Vector3Df(0), 8, 20, 10, 0, 0); camera.Inclination = 200; path = new SpherePath(5.4f); GUIFont font = device.GUIEnvironment.BuiltInFont; device.OnEvent += new IrrlichtDevice.EventHandler(device_OnEvent); device.PostEvent(new Event('r', KeyCode.KeyR, true)); // pretend user pressed [R] while (device.Run()) { driver.BeginScene(); scene.DrawAll(); path.Draw(driver); font.Draw("Press [Arrows], [LMB] and [Mouse Scroll] to change view", 10, 10, Color.OpaqueYellow); font.Draw("Press [RMB] on Earth to place new path point", 10, 20, Color.OpaqueYellow); font.Draw("Press [R] to reload path data from file", 10, 30, Color.OpaqueYellow); font.Draw("Press [C] to clean up", 10, 40, Color.OpaqueYellow); font.Draw(driver.FPS.ToString() + " fps", 10, driver.ScreenSize.Height - 40, Color.OpaqueYellow); font.Draw(path.PointCount.ToString() + " point(s)", 10, driver.ScreenSize.Height - 30, Color.OpaqueYellow); font.Draw(camera.ToString(), 10, driver.ScreenSize.Height - 20, Color.OpaqueYellow); driver.EndScene(); } path.Drop(); device.Drop(); }