Пример #1
0
//! creates/loads an animated mesh from the file.
//! \return Pointer to the created mesh. Returns 0 if loading failed.
//! If you no longer need the mesh, you should call IAnimatedMesh::drop().
//! See IReferenceCounted::drop() for more information.
IAnimatedMesh* CBSPMeshFileLoader::createMesh(io::IReadFile* file)
{
	// load quake 3 bsp
	if (strstr(file->getFileName(), ".bsp"))
	{
		CQ3LevelMesh* q = new CQ3LevelMesh(FileSystem, Driver, SceneManager);

		q->getShader ( "scripts/models.shader", 1 );
		q->getShader ( "scripts/liquid.shader", 1 );
		//q->getShader ( "scripts/sky.shader", 1 );

		if ( q->loadFile(file) )
			return q;

		q->drop();
	}

	// load quake 3 shader container
	if (strstr(file->getFileName(), ".shader"))
	{
		CQ3LevelMesh* q = new CQ3LevelMesh(FileSystem, Driver, SceneManager);
		q->getShader ( file->getFileName(), 1 );
		return q;
	}

	return 0;
}
Пример #2
0
//! creates/loads an animated mesh from the file.
//! \return Pointer to the created mesh. Returns 0 if loading failed.
//! If you no longer need the mesh, you should call IAnimatedMesh::drop().
//! See IReferenceCounted::drop() for more information.
IAnimatedMesh* CBSPMeshFileLoader::createMesh(io::IReadFile* file)
{
	s32 type = core::isFileExtension ( file->getFileName(), "bsp", "shader", "cfg" );
	CQ3LevelMesh* q = 0;

	switch ( type )
	{
		case 1:
			q = new CQ3LevelMesh(FileSystem, SceneManager, LoadParam);

			// determine real shaders in LoadParam
			if ( 0 == LoadParam.loadAllShaders )
			{
				q->getShader("scripts/common.shader");
				q->getShader("scripts/sfx.shader");
				q->getShader("scripts/gfx.shader");
				q->getShader("scripts/liquid.shader");
				q->getShader("scripts/models.shader");
				q->getShader("scripts/walls.shader");
				//q->getShader("scripts/sky.shader");
			}

			if ( q->loadFile(file) )
				return q;

			q->drop();
			break;

		case 2:
			q = new CQ3LevelMesh(FileSystem, SceneManager,LoadParam);
			q->getShader( file );
			return q;
			break;

		case 3:
			// load quake 3 loading parameter
			if ( file->getFileName() == "levelparameter.cfg" )
			{
				file->read ( &LoadParam, sizeof ( LoadParam ) );
			}
			else
			{
				q = new CQ3LevelMesh(FileSystem, SceneManager,LoadParam);
				q->getConfiguration( file );
				return q;
			}
			break;
	}

	return 0;
}