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


C++ TransformNode::setAnimationTransform方法代码示例

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


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

示例1: animate

void Scenegraph::animate(float time)
{
	
	TransformNode * rideTransform = (TransformNode *) root->getNode("car-transform");
	TransformNode * seatTransform = (TransformNode *) root->getNode("seat-transform");

	if(rideTransform!=NULL)
		rideTransform->setAnimationTransform(glm::translate(glm::mat4(1.0),glm::vec3(sin(time*10)*100,0,0)) );//* glm::rotate(glm::mat4(1.0),time*10,glm::vec3(0,1,0)));
	
	if(seatTransform!=NULL)
		seatTransform->setAnimationTransform(glm::rotate(glm::mat4(1.0),time*10,glm::vec3(0,1,0)));

	if(root->getNode("chair") != NULL){
	TransformNode *ch1 = NULL;
	TransformNode *ch2 = NULL;
	TransformNode *ch3 = NULL;
	TransformNode *ch4 = NULL;
	TransformNode *ride = NULL;
	glm::mat4 temp = glm::mat4(1.0);
	glm::mat4 temp2 = glm::mat4(1.0);
	glm::mat4 temp3 = glm::mat4(1.0);
	glm::mat4 temp4 = glm::mat4(1.0);
	glm::mat4 temp5 = glm::mat4(1.0);

	temp = glm::translate(glm::mat4(1),glm::vec3(0,abs(cos(time*3))*12,0));
	temp2 = glm::translate(glm::mat4(1),glm::vec3(0,0,abs(cos(time*3))*12));
	temp3 = glm::translate(glm::mat4(1),glm::vec3(0,0,-1*abs(cos(time*3))*12));
	temp4 = glm::translate(glm::mat4(1),glm::vec3(0,-1*abs(cos(time*3))*12,0));
	temp5 *= glm::rotate(glm::mat4(1.0),glm::radians(time*50),glm::vec3(0,1,0));
	temp5 *= glm::rotate(glm::mat4(1.0),glm::radians(sin(time*5.0f)*30),glm::vec3(0,0,1));
	temp5 *= glm::rotate(glm::mat4(1.0),glm::radians(cos(time*5.0f)*30),glm::vec3(1,0,0));
	//temp5 *= glm::rotate(glm::mat4(1.0),glm::radians(40.0f),glm::vec3(1,0,0));
	
	temp *= glm::rotate(glm::mat4(1.0),glm::radians(time*500),glm::vec3(1,0,0));
	temp2 *= glm::rotate(glm::mat4(1.0),glm::radians(time*500),glm::vec3(1,0,0));
	temp3 *= glm::rotate(glm::mat4(1.0),glm::radians(time*500),glm::vec3(1,0,0));
	temp4 *= glm::rotate(glm::mat4(1.0),glm::radians(time*500),glm::vec3(1,0,0));
	
	ch1 = static_cast<TransformNode*> (root->getNode("chair"));
	ch2 = static_cast<TransformNode*>(root->getNode("chair2"));
	ch3 = static_cast<TransformNode*>(root->getNode("chair3"));
	ch4 =static_cast<TransformNode*>( root->getNode("chair4"));
	ride = static_cast<TransformNode*>( root->getNode("ride"));
	ch1->setAnimationTransform(temp);
	ch2->setAnimationTransform(temp2);
	ch3->setAnimationTransform(temp3);
	ch4->setAnimationTransform(temp4);
	ride->setAnimationTransform(temp5);
	

	}

}
开发者ID:bmgrayb,项目名称:IT356,代码行数:53,代码来源:Scenegraph.cpp


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