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


C++ mat4::Identity方法代码示例

本文整理汇总了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);
开发者ID:xzrunner,项目名称:t3d,代码行数:66,代码来源:Game.cpp


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