simplescenes_trimesh.h

来自「使用stl技术,(还没看,是听说的)」· C头文件 代码 · 共 51 行

H
51
字号
/*
SimpleScenes_TriMesh.h
---------------------
A reimplementation of the ODE triangle mesh collision
demo using Ogre and the OgreOde wrapper.
*/
#ifndef _SIMPLESCENES_TRIMESH_H_
#define _SIMPLESCENES_TRIMESH_H_

/*
The box stacking test extends the box stacking demo, but adds a trimesh!
*/
class SimpleScenes_TriMesh:public SimpleScenes_BoxStack
{
public:
	// Standard constructor, but create a triangle mesh
	SimpleScenes_TriMesh()
	{
		// Create the visual entity and scene node
		Entity* entity = _mgr->createEntity("Landscape","landscape.mesh");
		entity->setNormaliseNormals(true);
		entity->setCastShadows(false);

		SceneNode* node = _mgr->getRootSceneNode()->createChildSceneNode(entity->getName());
		node->attachObject(entity);
		node->setScale(Vector3(0.4,0.3,0.4));
		node->setPosition(Vector3(0,3,0));
		node->setOrientation(Quaternion(Degree(30),Vector3::UNIT_Y));
		
		// Turn it into a triangle mesh static geometry
		_geoms.push_back(OgreOde::MeshInformer::createStaticTriangleMesh(node,_space));
	}

	// Destructor, manually destroy the entity and node, since they're 
	// not associated with a body they won't get deleted automatically
	virtual ~SimpleScenes_TriMesh()
	{
		_mgr->destroySceneNode("Landscape");
		_mgr->removeEntity("Landscape");
	}

	// Return our name for the test application to display
	virtual const String& getName()
	{
		static String name = "Test Triangle Mesh";
		return name;
	}
};

#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?