本文整理汇总了C++中ogre::Entity::setDisplaySkeleton方法的典型用法代码示例。如果您正苦于以下问题:C++ Entity::setDisplaySkeleton方法的具体用法?C++ Entity::setDisplaySkeleton怎么用?C++ Entity::setDisplaySkeleton使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ogre::Entity
的用法示例。
在下文中一共展示了Entity::setDisplaySkeleton方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: EngineSetup
//.........这里部分代码省略.........
ManualObject->position(1, 1, 1);
ManualObject->triangle(18, 19, 20);
ManualObject->position(1, 0, 0);
ManualObject->position(1, 1, 1);
ManualObject->position(1, 0, 1);
ManualObject->triangle(21, 22, 23);
//face 5
ManualObject->position(0, 1, 0);
ManualObject->position(1, 1, 0);
ManualObject->position(0, 1, 1);
ManualObject->triangle(24, 25, 26);
ManualObject->position(1, 1, 0);
ManualObject->position(1, 1, 1);
ManualObject->position(0, 1, 1);
ManualObject->triangle(27, 28, 29);
//face 6
ManualObject->position(0, 0, 0);
ManualObject->position(0, 1, 1);
ManualObject->position(0, 0, 1);
ManualObject->triangle(30, 31, 32);
ManualObject->position(0, 0, 0);
ManualObject->position(0, 1, 0);
ManualObject->position(0, 1, 1);
ManualObject->triangle(33, 34, 35);
ManualObject->end();
Ogre::MeshPtr MeshPtr = ManualObject->convertToMesh("Animation");
Ogre::SubMesh* sub = MeshPtr->getSubMesh(0);
Ogre::SkeletonPtr Skeleton = Ogre::SkeletonManager::getSingleton().create("Skeleton", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
MeshPtr.getPointer()->_notifySkeleton(Skeleton);
Ogre::Bone *Root1 = NULL;
Ogre::Bone *Child1 = NULL;
Ogre::Bone *Child2 = NULL;
Root1 = Skeleton.getPointer()->createBone("Root");
Root1->setPosition(Ogre::Vector3(0.0, 0.0, 0.0));
Root1->setOrientation(Ogre::Quaternion::IDENTITY);
Child1 = Root1->createChild(1);
Child1->setPosition(Ogre::Vector3(4.0, 0.0, 0.0));
Child1->setOrientation(Ogre::Quaternion::IDENTITY);
Child2 = Root1->createChild(2);
Child2->setPosition(Ogre::Vector3(5.0, 0.0, 0.0));
Child2->setOrientation(Ogre::Quaternion::IDENTITY);
Ogre::VertexBoneAssignment Assignment;
Assignment.boneIndex = 0;
Assignment.vertexIndex = 0;
Assignment.weight = 1.0;
Skeleton->setBindingPose();
sub->addBoneAssignment(Assignment);
Assignment.vertexIndex = 1;
sub->addBoneAssignment(Assignment);
Assignment.vertexIndex = 2;
sub->addBoneAssignment(Assignment);
Ogre::Animation *Animation = MeshPtr->createAnimation("HandAnimation", 100.0);
Ogre::NodeAnimationTrack *Track = Animation->createNodeTrack(0, Root1);
Ogre::TransformKeyFrame *KeyFrame = NULL;
for (float FrameTime = 0.0; FrameTime < 100.0; FrameTime += 0.1)
{
KeyFrame = Track->createNodeKeyFrame(FrameTime);
KeyFrame->setTranslate(Ogre::Vector3(10.0, 0.0, 0.0));
}
Root1->setManuallyControlled(true);
Child1->setManuallyControlled(true);
Child2->setManuallyControlled(true);
MeshPtr->load();
MeshPtr.getPointer()->_notifySkeleton(Skeleton);
// Ogre::SkeletonSerializer skeletonSerializer;
// skeletonSerializer.exportSkeleton(Skeleton.get(), "C:\\Users\\Ilya\\Documents\\Visual Studio 2010\\Projects\\Recipes\\media\\models\\testskeleton.skeleton");
// Ogre::MeshSerializer ser;
// ser.exportMesh(MeshPtr.get(), "C:\\Users\\Ilya\\Documents\\Visual Studio 2010\\Projects\\Recipes\\media\\models\\testskeleton.mesh");
Ogre::Entity *Entity = SceneManager->createEntity("Animation", "Animation"/*"testskeleton.mesh"*/);
Ogre::SceneNode *SceneNode = SceneManager->getRootSceneNode()->createChildSceneNode();
SceneNode->attachObject(Entity);
Entity->setDisplaySkeleton(true);
m_AnimationState = Entity->getAnimationState("HandAnimation");
m_AnimationState->setEnabled(true);
m_AnimationState->setLoop(true);
m_Camera->setPolygonMode(Ogre::PolygonMode::PM_WIREFRAME);
Root->renderOneFrame();
}
开发者ID:southerlies,项目名称:OGRE-3D-1.7-Application-Development-Cookbook-Code,代码行数:101,代码来源:SceletalAnimationView.cpp
示例2: EngineSetup
void CBlendingAnimationsView::EngineSetup(void)
{
Ogre::Root *Root = ((CBlendingAnimationsApp*)AfxGetApp())->m_Engine->GetRoot();
Ogre::SceneManager *SceneManager = NULL;
SceneManager = Root->createSceneManager(Ogre::ST_GENERIC, "Walking");
//
// Create a render window
// This window should be the current ChildView window using the externalWindowHandle
// value pair option.
//
Ogre::NameValuePairList parms;
parms["externalWindowHandle"] = Ogre::StringConverter::toString((long)m_hWnd);
parms["vsync"] = "true";
CRect rect;
GetClientRect(&rect);
Ogre::RenderTarget *RenderWindow = Root->getRenderTarget("Mouse Input");
if (RenderWindow == NULL)
{
try
{
m_RenderWindow = Root->createRenderWindow("Mouse Input", rect.Width(), rect.Height(), false, &parms);
}
catch(...)
{
MessageBox("Cannot initialize\nCheck that graphic-card driver is up-to-date", "Initialize Render System", MB_OK | MB_ICONSTOP);
exit(EXIT_SUCCESS);
}
}
// Load resources
Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
// Create the camera
m_Camera = SceneManager->createCamera("Camera");
m_Camera->setNearClipDistance(0.5);
m_Camera->setFarClipDistance(5000);
m_Camera->setCastShadows(false);
m_Camera->setUseRenderingDistance(true);
m_Camera->setPosition(Ogre::Vector3(/*20*/0.0, /*5*/0.0, 100.0));
Ogre::SceneNode *CameraNode = NULL;
CameraNode = SceneManager->getRootSceneNode()->createChildSceneNode("CameraNode");
Ogre::Viewport* Viewport = NULL;
if (0 == m_RenderWindow->getNumViewports())
{
Viewport = m_RenderWindow->addViewport(m_Camera);
Viewport->setBackgroundColour(Ogre::ColourValue(0.8f, 0.8f, 0.8f));
}
// Alter the camera aspect ratio to match the viewport
m_Camera->setAspectRatio(Ogre::Real(rect.Width()) / Ogre::Real(rect.Height()));
Ogre::SceneNode *RobotNode = SceneManager->getRootSceneNode()->createChildSceneNode("Robot", Ogre::Vector3(50,0,0));
Ogre::Entity *RobotEntity = SceneManager->createEntity("Robot", "robot.mesh");
Ogre::MeshPtr Mesh = RobotEntity->getMesh();
RobotNode->attachObject(RobotEntity);
RobotEntity->getParentNode()->scale(0.2,0.2,0.2);
m_Camera->lookAt(Ogre::Vector3(0.0, 0.0, 0.0));
RobotEntity->setDisplaySkeleton(true);
m_Camera->setPolygonMode(Ogre::PolygonMode::PM_WIREFRAME);
m_WalkAnimation = RobotEntity->getAnimationState("Walk");
m_WalkAnimation->setEnabled(true);
m_SlumpAnimation = RobotEntity->getAnimationState("Slump");
m_SlumpAnimation->setEnabled(true);
if (m_WeightDlg == NULL)
{
m_WeightDlg = new CWeightDlg();
m_WeightDlg->Create(IDD_WEIGHT_CONTROL);
}
m_WeightDlg->ShowWindow(SW_SHOW);
Root->renderOneFrame();
}
开发者ID:southerlies,项目名称:OGRE-3D-1.7-Application-Development-Cookbook-Code,代码行数:84,代码来源:BlendingAnimationsView.cpp