本文整理汇总了C++中ogre::ManualObject::tangent方法的典型用法代码示例。如果您正苦于以下问题:C++ ManualObject::tangent方法的具体用法?C++ ManualObject::tangent怎么用?C++ ManualObject::tangent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ogre::ManualObject
的用法示例。
在下文中一共展示了ManualObject::tangent方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateWall
void OgreApplication::CreateWall(Ogre::String material_name){
try {
/* Create two rectangles */
/* Retrieve scene manager and root scene node */
Ogre::SceneManager* scene_manager = ogre_root_->getSceneManager("MySceneManager");
Ogre::SceneNode* root_scene_node = scene_manager->getRootSceneNode();
/* Create the 3D object */
Ogre::ManualObject* object = NULL;
Ogre::String object_name = "Wall";
object = scene_manager->createManualObject(object_name);
object->setDynamic(false);
/* Create triangle list for the object */
object->begin(material_name, Ogre::RenderOperation::OT_TRIANGLE_LIST);
/* Add vertices */
/* One side of the "wall" */
object->position(-1.0,-1.0,0.0);
object->normal(0.0, 0.0, -1.0);
object->tangent(-1.0, 0.0, 0.0);
object->textureCoord(1.0, 0.0);
object->position(-1.0,1.0,0.0);
object->normal(0.0, 0.0, -1.0);
object->tangent(-1.0, 0.0, 0.0);
object->textureCoord(1.0, 1.0);
object->position(1.0,1.0,0.0);
object->normal(0.0, 0.0, -1.0);
object->tangent(-1.0, 0.0, 0.0);
object->textureCoord(0.0, 1.0);
object->position(1.0,-1.0,0.0);
object->normal(0.0, 0.0, -1.0);
object->tangent(-1.0, 0.0, 0.0);
object->textureCoord(0.0, 0.0);
/* The other side of the "wall" */
object->position(-1.0,-1.0,0.0);
object->normal(0.0, 0.0, 1.0);
object->tangent(1.0, 0.0, 0.0);
object->textureCoord(0.0, 0.0);
object->position(-1.0,1.0,0.0);
object->normal(0.0, 0.0, 1.0);
object->tangent(1.0, 0.0, 0.0);
object->textureCoord(0.0, 1.0);
object->position(1.0,1.0,0.0);
object->normal(0.0, 0.0, 1.0);
object->tangent(1.0, 0.0, 0.0);
object->textureCoord(1.0, 1.0);
object->position(1.0,-1.0,0.0);
object->normal(0.0, 0.0, 1.0);
object->tangent(1.0, 0.0, 0.0);
object->textureCoord(1.0, 0.0);
/* Add triangles */
/* One side */
object->triangle(0, 1, 2);
object->triangle(0, 2, 3);
/* The other side */
object->triangle(4, 7, 6);
object->triangle(4, 6, 5);
/* We finished the object */
object->end();
/* Convert triangle list to a mesh */
Ogre::String mesh_name = "Wall";
object->convertToMesh(mesh_name);
/* Create one instance of the sphere (one entity) */
/* The same object can have multiple instances or entities */
Ogre::Entity* entity = scene_manager->createEntity(mesh_name);
/* Apply a material to the entity to give it color */
/* We already did that above, so we comment it out here */
/* entity->setMaterialName(material_name); */
/* But, this call is useful if we have multiple entities with different materials */
/* Create a scene node for the entity */
/* The scene node keeps track of the entity's position */
Ogre::SceneNode* scene_node = root_scene_node->createChildSceneNode(mesh_name);
scene_node->attachObject(entity);
/* Position and rotate the entity with the scene node */
//scene_node->rotate(Ogre::Vector3(0, 1, 0), Ogre::Degree(60));
//scene_node->rotate(Ogre::Vector3(1, 0, 0), Ogre::Degree(30));
//scene_node->rotate(Ogre::Vector3(1, 0, 0), Ogre::Degree(-90));
//scene_node->translate(0.0, 0.0, 0.0);
scene_node->scale(0.5, 0.5, 0.5);
}
catch (Ogre::Exception &e){
throw(OgreAppException(std::string("Ogre::Exception: ") + std::string(e.what())));
//.........这里部分代码省略.........