From 7028cbe09c688437910a25623098762bf0fa592d Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Mon, 28 Mar 2016 22:28:34 +1000 Subject: Move Irrlicht to src/others. --- .../examples/15.LoadIrrFile/tutorial.html | 129 +++++++++++++++++++++ 1 file changed, 129 insertions(+) create mode 100644 src/others/irrlicht-1.8.1/examples/15.LoadIrrFile/tutorial.html (limited to 'src/others/irrlicht-1.8.1/examples/15.LoadIrrFile/tutorial.html') diff --git a/src/others/irrlicht-1.8.1/examples/15.LoadIrrFile/tutorial.html b/src/others/irrlicht-1.8.1/examples/15.LoadIrrFile/tutorial.html new file mode 100644 index 0000000..e3e4a6b --- /dev/null +++ b/src/others/irrlicht-1.8.1/examples/15.LoadIrrFile/tutorial.html @@ -0,0 +1,129 @@ + + +Irrlicht Engine Tutorial + + + + +
+ + + + + + + + +
+ Tutorial 15. Load .irr File
+

Since version 1.1, Irrlicht is able to save and load the full scene + graph into an .irr file, an xml based format. There is also an editor + available to edit those files, named irrEdit on http://www.ambiera.com/irredit, + which can also be used as world and particle editor. This tutorial shows + how to use .irr files.

+


+

+
+
+ + + + + + + +
+ Lets start!
+

Lets start: Create an Irrlicht device and setup the window.

+ + + + +
#include 
+#include 
+using namespace irr;
+
+#pragma comment(lib, "Irrlicht.lib")
+
+int main()
+{
+	// ask user for driver
+
+	video::E_DRIVER_TYPE driverType;
+
+	printf("Please select the driver you want for this example:\n"\
+		" (a) Direct3D 9.0c\n (b) Direct3D 8.1\n (c) OpenGL 1.5\n"\
+		" (d) Software Renderer\n (e) Apfelbaum Software Renderer\n"\
+		" (f) NullDevice\n (otherKey) exit\n\n");
+
+	char i;
+	std::cin >> i;
+
+	switch(i)
+	{
+		case 'a': driverType = video::EDT_DIRECT3D9;break;
+		case 'b': driverType = video::EDT_DIRECT3D8;break;
+		case 'c': driverType = video::EDT_OPENGL;   break;
+		case 'd': driverType = video::EDT_SOFTWARE; break;
+		case 'e': driverType = video::EDT_BURNINGSVIDEO;break;
+		case 'f': driverType = video::EDT_NULL;     break;
+		default: return 1;
+	}	
+
+	// create device and exit if creation failed
+
+	IrrlichtDevice* device =
+		createDevice(driverType, core::dimension2d(640, 480));
+
+	if (device == 0)
+		return 1; // could not create selected driver.
+
+	device->setWindowCaption(L"Load .irr file example");
+
+	video::IVideoDriver* driver = device->getVideoDriver();
+	scene::ISceneManager* smgr = device->getSceneManager();
+
+

Now load our .irr file. .irr files can store the whole scene graph + including animators, materials and particle systems. And there is also + the possibility to store arbitrary user data for every scene node in + that file. To keep this example simple, we are simply loading the scene + here. See the documentation at ISceneManager::loadScene and ISceneManager::saveScene + for more information. So to load and display a complicated huge scene, + we only need a single call to loadScene().

+ + + + +
// load the scene
smgr->loadScene("../../media/example.irr");
+

That was it already. Now add a camera and draw the scene.

+ + + + +
	// add a user controlled camera
+
+	smgr->addCameraSceneNodeFPS();
+
+	// and draw everything.
+	
+	while(device->run())
+	if (device->isWindowActive())
+	{
+		driver->beginScene(true, true, video::SColor(0,200,200,200));
+		smgr->drawAll();
+		driver->endScene();
+	}
+
+	device->drop();
+	
+	return 0;
+}
+
+ +
+

 

+
+

 

+

 

+ + -- cgit v1.1