当前位置: 首页>>代码示例>>C++>>正文


C++ IAnimatedMesh::getMeshBuffer方法代码示例

本文整理汇总了C++中IAnimatedMesh::getMeshBuffer方法的典型用法代码示例。如果您正苦于以下问题:C++ IAnimatedMesh::getMeshBuffer方法的具体用法?C++ IAnimatedMesh::getMeshBuffer怎么用?C++ IAnimatedMesh::getMeshBuffer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IAnimatedMesh的用法示例。


在下文中一共展示了IAnimatedMesh::getMeshBuffer方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Mesh3DInitScene

void Mesh3DInitScene()
{
	IAnimatedMesh*				mesh;
	IAnimatedMeshSceneNode*     node;
	scene::ISceneNodeAnimator*  anim;
	scene::ISceneManager*		smgr   = IrrlichtManager::GetIrrlichtManager()->GetScene();
	IrrlichtDevice*				device = IrrlichtManager::GetIrrlichtManager()->GetDevice();
	video::IVideoDriver*		driver = IrrlichtManager::GetIrrlichtManager()->GetDriver();
	
	std::string					load_zip;
	std::string					load_data;
	std::string					reload_path;
	FileSystemZip*				pfilesystem			= NULL;
	io::IReadFile*				memfile				= NULL;
	byte*						apk_buffer			= NULL;
	byte*						buff_extract		= NULL;
	int							size				= 0;
	int							apk_size			= 0;

	if (!IrrlichtManager::GetIrrlichtManager()->GetDevice())
	{
		LogError("Error initializing Irrlicht");
		return;
	}
	
	IrrlichtManager::GetIrrlichtManager()->GetDevice()->getTimer()->setTime(0);
		
    smgr->addLightSceneNode(0, core::vector3df(-100,10,0), video::SColorf(1.0f, 1.0f, 1.0f, 1.0f), 200.0f);
    smgr->addLightSceneNode(0, core::vector3df(+100,10,0), video::SColorf(1.0f, 1.0f, 1.0f, 1.0f), 200.0f);
	
		
//////////////////////////////mesh/////////////////////////////////////////////////
	load_zip	= (GetBaseAppPath() + "game/ninja.zip").c_str();
	load_data	= "ninja.b3d";
	reload_path	= (GetBaseAppPath() + "game/ninja.b3d").c_str();
	
#ifdef ANDROID_NDK
	apk_buffer	= FileManager::GetFileManager()->Get(load_zip.c_str(), &apk_size, false, false);
	
	if( apk_buffer )
	{
		pfilesystem	= new FileSystemZip();
		pfilesystem->Init_unzMemory(apk_buffer, apk_size);
		buff_extract = pfilesystem->Get_unz(load_data, &size);

		delete apk_buffer;
		apk_buffer = NULL;
	}
#else
	pfilesystem = new FileSystemZip();
	pfilesystem->Init_unz(load_zip.c_str());
	buff_extract = pfilesystem->Get_unz(load_data.c_str(), &size);
#endif
	
	memfile = device->getFileSystem()->createMemoryReadFile(buff_extract, size, reload_path.c_str(), true);
	//new buffer copy on file->read(Buffer, size) of CXMeshFileLoader::readFileIntoMemory
	mesh	= smgr->getMesh( memfile );
	node	= smgr->addAnimatedMeshSceneNode( mesh );

	//delete buff_extract in drop() then goto ~CMemoryReadFile
	memfile->drop();
						
	if( pfilesystem )
	{
		delete pfilesystem;
		pfilesystem = NULL;
	}

//////////////////////////////texture/////////////////////////////////////////////////
	node->setMaterialTexture( 0, driver->getTexture((GetBaseAppPath()+"game/nskinbl.jpg").c_str()) );
    node->setMaterialFlag(EMF_LIGHTING, true);
    node->setMaterialFlag(EMF_NORMALIZE_NORMALS, true);
    anim = smgr->createRotationAnimator(core::vector3df(0,0.3f,0));
    node->addAnimator(anim);
    anim->drop();

	u32 alpha_val		= 90;
	u32 MaterialCount	= node->getMaterialCount();
	
	for(u32 i=0; i<MaterialCount; i++)
	{
		video::SMaterial& tex_mat	= node->getMaterial(i);
		tex_mat.MaterialType		= video::EMT_TRANSPARENT_VERTEX_ALPHA;
		//tex_mat.MaterialTypeParam	= 0.1;
		//tex_mat.MaterialTypeParam2= 0.1;
		tex_mat.AmbientColor.setAlpha(alpha_val);
		tex_mat.DiffuseColor.setAlpha(alpha_val);
		tex_mat.SpecularColor.setAlpha(alpha_val);
		tex_mat.EmissiveColor.setAlpha(alpha_val);
	}

#if	defined(_IRR_COMPILE_WITH_OGLES2_)
	for(u32 i=0; i<mesh->getMeshBufferCount(); i++)
	{
		scene::IMeshBuffer* buffer = mesh->getMeshBuffer(i);
		video::S3DVertex* vertex = (video::S3DVertex*)buffer->getVertices();
		
		for(u32 j=0; j<buffer->getVertexCount(); j++)
		{
			vertex[j].Color.setAlpha(alpha_val);
//.........这里部分代码省略.........
开发者ID:andrew889,项目名称:proton_cm_open,代码行数:101,代码来源:Mesh3DMenu.cpp


注:本文中的IAnimatedMesh::getMeshBuffer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。