// As multiple scene nodes may be sharing the same skinned mesh, we have to\r
// re-animate it every frame to ensure that this node gets the mesh that it needs.\r
\r
- CSkinnedMesh* skinnedMesh = reinterpret_cast<CSkinnedMesh*>(Mesh);\r
+ CSkinnedMesh* skinnedMesh = static_cast<CSkinnedMesh*>(Mesh);\r
\r
if (JointMode == EJUOR_CONTROL)//write to mesh\r
skinnedMesh->transferJointsToMesh(JointChildSceneNodes);\r
\r
// set CurrentFrameNr\r
buildFrameNr(timeMs-LastTimeMs);\r
-\r
- // update bbox\r
- if (Mesh)\r
- {\r
- scene::IMesh * mesh = getMeshForCurrentFrame();\r
-\r
- if (mesh)\r
- Box = mesh->getBoundingBox();\r
- }\r
LastTimeMs = timeMs;\r
\r
IAnimatedMeshSceneNode::OnAnimate(timeMs);\r
#ifdef _DEBUG\r
os::Printer::log("Animated Mesh returned no mesh to render.", Mesh->getDebugName(), ELL_WARNING);\r
#endif\r
+ return;\r
}\r
\r
driver->setTransform(video::ETS_WORLD, AbsoluteTransformation);\r
// show normals\r
if (DebugDataVisible & scene::EDS_NORMALS)\r
{\r
- const f32 debugNormalLength = SceneManager->getParameters()->getAttributeAsFloat(DEBUG_NORMAL_LENGTH);\r
- const video::SColor debugNormalColor = SceneManager->getParameters()->getAttributeAsColor(DEBUG_NORMAL_COLOR);\r
+ const f32 debugNormalLength = 1.f;\r
+ const video::SColor debugNormalColor = video::SColor(255, 34, 221, 221);\r
const u32 count = m->getMeshBufferCount();\r
\r
// draw normals\r
}\r
\r
\r
-//! Writes attributes of the scene node.\r
-void CAnimatedMeshSceneNode::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const\r
-{\r
- IAnimatedMeshSceneNode::serializeAttributes(out, options);\r
-\r
- if (options && (options->Flags&io::EARWF_USE_RELATIVE_PATHS) && options->Filename)\r
- {\r
- const io::path path = SceneManager->getFileSystem()->getRelativeFilename(\r
- SceneManager->getFileSystem()->getAbsolutePath(SceneManager->getMeshCache()->getMeshName(Mesh).getPath()),\r
- options->Filename);\r
- out->addString("Mesh", path.c_str());\r
- }\r
- else\r
- out->addString("Mesh", SceneManager->getMeshCache()->getMeshName(Mesh).getPath().c_str());\r
- out->addBool("Looping", Looping);\r
- out->addBool("ReadOnlyMaterials", ReadOnlyMaterials);\r
- out->addFloat("FramesPerSecond", FramesPerSecond);\r
- out->addInt("StartFrame", StartFrame);\r
- out->addInt("EndFrame", EndFrame);\r
-}\r
-\r
-\r
-//! Reads attributes of the scene node.\r
-void CAnimatedMeshSceneNode::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options)\r
-{\r
- IAnimatedMeshSceneNode::deserializeAttributes(in, options);\r
-\r
- io::path oldMeshStr = SceneManager->getMeshCache()->getMeshName(Mesh);\r
- io::path newMeshStr = in->getAttributeAsString("Mesh");\r
-\r
- Looping = in->getAttributeAsBool("Looping");\r
- ReadOnlyMaterials = in->getAttributeAsBool("ReadOnlyMaterials");\r
- FramesPerSecond = in->getAttributeAsFloat("FramesPerSecond");\r
- StartFrame = in->getAttributeAsInt("StartFrame");\r
- EndFrame = in->getAttributeAsInt("EndFrame");\r
-\r
- if (newMeshStr != "" && oldMeshStr != newMeshStr)\r
- {\r
- IAnimatedMesh* newAnimatedMesh = SceneManager->getMesh(newMeshStr.c_str());\r
-\r
- if (newAnimatedMesh)\r
- setMesh(newAnimatedMesh);\r
- }\r
-\r
- // TODO: read animation names instead of frame begin and ends\r
-}\r
-\r
-\r
//! Sets a new mesh\r
void CAnimatedMeshSceneNode::setMesh(IAnimatedMesh* mesh)\r
{\r
checkJoints();\r
const f32 frame = getFrameNr(); //old?\r
\r
- CSkinnedMesh* skinnedMesh=reinterpret_cast<CSkinnedMesh*>(Mesh);\r
+ CSkinnedMesh* skinnedMesh=static_cast<CSkinnedMesh*>(Mesh);\r
\r
skinnedMesh->transferOnlyJointsHintsToMesh( JointChildSceneNodes );\r
skinnedMesh->animateMesh(frame, 1.0f);\r