bool Framework::frameRenderingQueued(const Ogre::FrameEvent& evt) { mTrayMgr->frameRenderingQueued(evt); if (!mTrayMgr->isDialogVisible()) { mCameraMan->frameRenderingQueued(evt); // if dialog isn't up, then update the camera if (mDetailsPanel->isVisible()) // if details panel is visible, then update its contents { mDetailsPanel->setParamValue(0, Ogre::StringConverter::toString(mCamera->getDerivedPosition().x)); mDetailsPanel->setParamValue(1, Ogre::StringConverter::toString(mCamera->getDerivedPosition().y)); mDetailsPanel->setParamValue(2, Ogre::StringConverter::toString(mCamera->getDerivedPosition().z)); mDetailsPanel->setParamValue(4, Ogre::StringConverter::toString(mCamera->getDerivedOrientation().w)); mDetailsPanel->setParamValue(5, Ogre::StringConverter::toString(mCamera->getDerivedOrientation().x)); mDetailsPanel->setParamValue(6, Ogre::StringConverter::toString(mCamera->getDerivedOrientation().y)); mDetailsPanel->setParamValue(7, Ogre::StringConverter::toString(mCamera->getDerivedOrientation().z)); #ifdef USE_RTSHADER_SYSTEM mDetailsPanel->setParamValue(14, Ogre::StringConverter::toString(mShaderGenerator->getVertexShaderCount())); mDetailsPanel->setParamValue(15, Ogre::StringConverter::toString(mShaderGenerator->getFragmentShaderCount())); #endif Ogre::Quaternion q = mCamera->getDerivedOrientation(); mDetailsPanel->setParamValue(16, Ogre::StringConverter::toString(q.xAxis() ) ); mDetailsPanel->setParamValue(17, Ogre::StringConverter::toString(q.yAxis() )); mDetailsPanel->setParamValue(18, Ogre::StringConverter::toString(q.zAxis() )); } } return true; }
//------------------------------------------------------------------------------------- void AxisLines::initAxis(Ogre::String boneName, Ogre::Entity* entity, Ogre::SceneManager* mSceneManager) { if(isXVisible) /* red */ { xLine = new DynamicLines(Ogre::RenderOperation::OT_LINE_LIST); entity->attachObjectToBone(boneName, xLine); xLine->setMaterial(color1); } if(isYVisible) /* green */ { yLine = new DynamicLines(Ogre::RenderOperation::OT_LINE_LIST); entity->attachObjectToBone(boneName, yLine); yLine->setMaterial(color2); } if(isZVisible) /* blue */ { zLine = new DynamicLines(Ogre::RenderOperation::OT_LINE_LIST); entity->attachObjectToBone(boneName, zLine); zLine->setMaterial(color3); } Ogre::Bone* bone = entity->getSkeleton()->getBone(boneName); Ogre::Quaternion q = bone->getOrientation(); this->updateLines(q.xAxis(), q.yAxis(), q.zAxis()); }
//------------------------------------------------------------------------------------- void ControllableCharacter::transformBone(Ogre::String boneName, NuiManager::NuiJointIndex jointIdx) { int state = 0; state = (int)controller->getJointStatus(jointIdx); if(state == 2) { Ogre::Bone* bone = skeleton->getBone(boneName); Ogre::Quaternion qI = bone->getInitialOrientation(); Ogre::Quaternion newQ = jointCalc->getSkeletonJointOrientation(jointIdx); bone->resetOrientation(); newQ = bone->convertWorldToLocalOrientation(newQ); bone->setOrientation(newQ * qI); Ogre::Quaternion resQ = bone->getOrientation(); if(showBoneOrientationAxes) axisLines[jointIdx]->updateLines(resQ.xAxis(), resQ.yAxis(), resQ.zAxis()); // debug } }