Beispiel #1
0
	scene::IAnimatedMesh* loadMesh(const io::path &filename)
	{
		io::path extension;
		core::getFileNameExtension(extension, filename);
		extension.make_lower();

		// if a texture is loaded apply it to the current model..
		if (extension == ".jpg" || extension == ".pcx" ||
				extension == ".png" || extension == ".ppm" ||
				extension == ".pgm" || extension == ".pbm" ||
				extension == ".psd" || extension == ".tga" ||
				extension == ".bmp" || extension == ".wal")
		{
			video::ITexture * texture =
				device_->getVideoDriver()->getTexture(filename.c_str());
			if ( texture && node_ )
			{
				// always reload texture
				device_->getVideoDriver()->removeTexture(texture);
				texture = device_->getVideoDriver()->getTexture( filename.c_str() );

				node_->setMaterialTexture(0, texture);
			}
			return 0;
		}
		// if a archive is loaded add it to the FileSystems..
		else if (extension == ".pk3" || extension == ".zip")
		{
			device_->getFileSystem()->addFileArchive(filename);
			return 0;
		}
		else if (extension == ".pak")
		{
			device_->getFileSystem()->addFileArchive(filename);
			return 0;
		}

		// load a model into the engine
		if (node_){
			node_->remove();
			node_ = 0;
		}

		return device_->getSceneManager()->getMesh( filename.c_str() );
	}
Beispiel #2
0
 /** 2-step construction */
 void setNode(scene::ISceneNode* node)
 {
     //assert(m_node == NULL);
     if (m_node != NULL)
     {
         m_node->remove();
     }
     
     m_node = node;
     if (node->getType() == irr::scene::ESNT_LOD_NODE)
     {
         ((LODNode*)node)->setNodesPosition(m_init_xyz);
         ((LODNode*)node)->setNodesRotation(m_init_hpr);
         ((LODNode*)node)->setNodesScale(m_init_scale);
     }
     else
     {
         m_node->setPosition(m_init_xyz);
         m_node->setRotation(m_init_hpr);
         m_node->setScale(m_init_scale);
     }
 }