本文整理汇总了C++中mat4::Identity方法的典型用法代码示例。如果您正苦于以下问题:C++ mat4::Identity方法的具体用法?C++ mat4::Identity怎么用?C++ mat4::Identity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mat4
的用法示例。
在下文中一共展示了mat4::Identity方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Step
//.........这里部分代码省略.........
// set position of tower
obj_scene->SetWorldPos(scene_objects[index].x,
scene_objects[index].y,
scene_objects[index].z);
// move objects
scene_objects[index].x+=scene_objects_vel[index].x;
scene_objects[index].y+=scene_objects_vel[index].y;
scene_objects[index].z+=scene_objects_vel[index].z;
// test for out of bounds
if (scene_objects[index].x >= UNIVERSE_RADIUS || scene_objects[index].x <= -UNIVERSE_RADIUS)
{
scene_objects_vel[index].x=-scene_objects_vel[index].x;
scene_objects[index].x+=scene_objects_vel[index].x;
} // end if
if (scene_objects[index].y >= (UNIVERSE_RADIUS/2) || scene_objects[index].y <= -(UNIVERSE_RADIUS/2))
{
scene_objects_vel[index].y=-scene_objects_vel[index].y;
scene_objects[index].y+=scene_objects_vel[index].y;
} // end if
if (scene_objects[index].z >= UNIVERSE_RADIUS || scene_objects[index].z <= -UNIVERSE_RADIUS)
{
scene_objects_vel[index].z=-scene_objects_vel[index].z;
scene_objects[index].z+=scene_objects_vel[index].z;
} // end if
// attempt to cull object
if (!obj_scene->Cull(*_cam, CULL_OBJECT_XYZ_PLANES))
{
mrot = mrot.Identity();
// rotate the local coords of the object
obj_scene->Transform(mrot, TRANSFORM_LOCAL_TO_TRANS,1);
// perform world transform
obj_scene->ModelToWorld(TRANSFORM_TRANS_ONLY);
// insert the object into render list
_list->Insert(*obj_scene, false);
} // end if
} // end for
//////////////////////////////////////////////////////////////////////////
// constant shaded water
// reset the object (this only matters for backface and object removal)
obj_work->Reset();
// generate rotation matrix around y axis
mrot = mat4::RotateX(-15) * mat4::RotateY(_cam->Dir().y + turning);
// rotate the local coords of the object
obj_work->Transform(mrot, TRANSFORM_LOCAL_TO_TRANS,true);
// perform world transform
obj_work->ModelToWorld(TRANSFORM_TRANS_ONLY);
// insert the object into render list
_list->Insert(*obj_work, false);