Loading Collada files

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Joolbox
Posts: 1
Joined: Mon Sep 04, 2006 7:07 pm

Loading Collada files

Post by Joolbox »

Hello,

I just began to look at irrlicht.

I try to find a way to load a complete scene (meshes+lights actually).

Since .irr files don't work with the current irrEdit version I thought Collada format would be the better way to do it. I just download an exporter for 3dsMax.

But When I try to load a collada file nothing is drawn. The window stays gray.

Then I would try to control each mesh of my Collada ifile ndependantly. but Scene Manager->getParameters()->setParameter(scene::COLLADA_CREATE_SCENE_INSTANCES, true);
doesn't seem to be recognized.


My code is from one of the example of the site.

Code: Select all


/*
This Tutorial shows how to load a Quake 3 map into the
engine, create a SceneNode for optimizing the speed of
rendering and how to create a user controlled camera.

Lets start like the HelloWorld example: We include
the irrlicht header files and an additional file to be able
to ask the user for a driver type using the console.
*/
#include <irrlicht.h>
#include <iostream>
#include <stdio.h>


using namespace irr;

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_SOFTWARE2;break;
		case 'f': driverType = video::EDT_NULL;     break;
		default: return 1;
	}	

	// create device and exit if creation failed

	IrrlichtDevice *device = createDevice(driverType, core::dimension2d<s32>(640, 480), 16, false, true);

	if (device == 0)
		return 1; // could not create selected driver.


	video::IVideoDriver* driver = device->getVideoDriver();
	scene::ISceneManager* smgr = device->getSceneManager();
	

	scene::IAnimatedMesh* mesh = smgr->getMesh("testCollada.DAE");	

  //smgr->getParameters()->setParameter(scene::COLLADA_CREATE_SCENE_INSTANCES, true); 
	
	scene::IAnimatedMeshSceneNode* node = 0;

	
	

	smgr->addCameraSceneNodeFPS();

	/*
	The mouse cursor needs not to be visible, so we make it invisible.
	*/

	device->getCursorControl()->setVisible(false);


	int lastFPS = -1;

	while(device->run())
	if (device->isWindowActive())
	{
		driver->beginScene(true, true, video::SColor(0,200,200,200));
		smgr->drawAll();
		driver->endScene();

		int fps = driver->getFPS();

		if (lastFPS != fps)
		{
			core::stringw str = L"Irrlicht Engine - Quake 3 Map example [";
			str += driver->getName();
			str += "] FPS:";
			str += fps;

			device->setWindowCaption(str.c_str());
			lastFPS = fps;
		}
	}

	/*
	In the end, delete the Irrlicht device.
	*/
	device->drop();
	
	return 0;
}




If someone could help me it would be nice. I am lost. :(
scotte
Posts: 3
Joined: Thu Oct 26, 2006 5:56 pm

Post by scotte »

I've had a similar problem, I've tried the following ...
smgr->getParameters()->setAttribute(scene::COLLADA_CREATE_SCENE_INSTANCES, true);

// and then tried to load the mesh

scene::IAnimatedMesh* mesh = smgr->getMesh("testCollada.DAE");

... no improvement ...

I'm wondering if it's a change in the Collada XML schema that is causing the problem. i.e. maybe IRRLICHT was coded up for a earlier version of the Collada schema. I am using Feeling ColladaMax v1.06 with FCollada v1.14 that is generating a Collada File of schema version 1.4.1.[/i]
Post Reply