]> git.lizzy.rs Git - irrlicht.git/blobdiff - source/Irrlicht/CMeshSceneNode.cpp
Merge pull request #154 from lhofhansl/skinned
[irrlicht.git] / source / Irrlicht / CMeshSceneNode.cpp
index 59d1c1cdbd06b5f3eaef5a75db2722413695ab25..1331ddae7f1873ed70c361754fe2271ecca7c318 100644 (file)
 #include "IAnimatedMesh.h"\r
 #include "IMaterialRenderer.h"\r
 #include "IFileSystem.h"\r
-#ifdef _IRR_COMPILE_WITH_SHADOW_VOLUME_SCENENODE_\r
-#include "CShadowVolumeSceneNode.h"\r
-#else\r
-#include "IShadowVolumeSceneNode.h"\r
-#endif // _IRR_COMPILE_WITH_SHADOW_VOLUME_SCENENODE_\r
 \r
 namespace irr\r
 {\r
@@ -28,7 +23,7 @@ namespace scene
 CMeshSceneNode::CMeshSceneNode(IMesh* mesh, ISceneNode* parent, ISceneManager* mgr, s32 id,\r
                        const core::vector3df& position, const core::vector3df& rotation,\r
                        const core::vector3df& scale)\r
-: IMeshSceneNode(parent, mgr, id, position, rotation, scale), Mesh(0), Shadow(0),\r
+: IMeshSceneNode(parent, mgr, id, position, rotation, scale), Mesh(0),\r
        PassCount(0), ReadOnlyMaterials(false)\r
 {\r
        #ifdef _DEBUG\r
@@ -42,8 +37,6 @@ CMeshSceneNode::CMeshSceneNode(IMesh* mesh, ISceneNode* parent, ISceneManager* m
 //! destructor\r
 CMeshSceneNode::~CMeshSceneNode()\r
 {\r
-       if (Shadow)\r
-               Shadow->drop();\r
        if (Mesh)\r
                Mesh->drop();\r
 }\r
@@ -109,9 +102,6 @@ void CMeshSceneNode::render()
        driver->setTransform(video::ETS_WORLD, AbsoluteTransformation);\r
        Box = Mesh->getBoundingBox();\r
 \r
-       if (Shadow && PassCount==1)\r
-               Shadow->updateShadowVolumes();\r
-\r
        // for debug purposes only:\r
 \r
        bool renderMeshes = true;\r
@@ -180,8 +170,8 @@ void CMeshSceneNode::render()
                if (DebugDataVisible & scene::EDS_NORMALS)\r
                {\r
                        // draw normals\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 = Mesh->getMeshBufferCount();\r
 \r
                        for (u32 i=0; i != count; ++i)\r
@@ -210,12 +200,6 @@ void CMeshSceneNode::render()
 //! or to remove attached childs.\r
 bool CMeshSceneNode::removeChild(ISceneNode* child)\r
 {\r
-       if (child && Shadow == child)\r
-       {\r
-               Shadow->drop();\r
-               Shadow = 0;\r
-       }\r
-\r
        return ISceneNode::removeChild(child);\r
 }\r
 \r
@@ -272,29 +256,6 @@ void CMeshSceneNode::setMesh(IMesh* mesh)
 }\r
 \r
 \r
-//! Creates shadow volume scene node as child of this node\r
-//! and returns a pointer to it.\r
-IShadowVolumeSceneNode* CMeshSceneNode::addShadowVolumeSceneNode(\r
-               const IMesh* shadowMesh, s32 id, bool zfailmethod, f32 infinity)\r
-{\r
-#ifdef _IRR_COMPILE_WITH_SHADOW_VOLUME_SCENENODE_\r
-       if (!SceneManager->getVideoDriver()->queryFeature(video::EVDF_STENCIL_BUFFER))\r
-               return 0;\r
-\r
-       if (!shadowMesh)\r
-               shadowMesh = Mesh; // if null is given, use the mesh of node\r
-\r
-       if (Shadow)\r
-               Shadow->drop();\r
-\r
-       Shadow = new CShadowVolumeSceneNode(shadowMesh, this, SceneManager, id,  zfailmethod, infinity);\r
-       return Shadow;\r
-#else\r
-       return 0;\r
-#endif\r
-}\r
-\r
-\r
 void CMeshSceneNode::copyMaterials()\r
 {\r
        Materials.clear();\r
@@ -315,75 +276,6 @@ void CMeshSceneNode::copyMaterials()
 }\r
 \r
 \r
-//! Writes attributes of the scene node.\r
-void CMeshSceneNode::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const\r
-{\r
-       IMeshSceneNode::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("ReadOnlyMaterials", ReadOnlyMaterials);\r
-}\r
-\r
-\r
-//! Reads attributes of the scene node.\r
-void CMeshSceneNode::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options)\r
-{\r
-       io::path oldMeshStr = SceneManager->getMeshCache()->getMeshName(Mesh);\r
-       io::path newMeshStr = in->getAttributeAsString("Mesh");\r
-       ReadOnlyMaterials = in->getAttributeAsBool("ReadOnlyMaterials");\r
-\r
-       if (newMeshStr != "" && oldMeshStr != newMeshStr)\r
-       {\r
-               IMesh* newMesh = 0;\r
-               IAnimatedMesh* newAnimatedMesh = SceneManager->getMesh(newMeshStr.c_str());\r
-\r
-               if (newAnimatedMesh)\r
-                       newMesh = newAnimatedMesh->getMesh(0);\r
-\r
-               if (newMesh)\r
-                       setMesh(newMesh);\r
-       }\r
-\r
-       // optional attribute to assign the hint to the whole mesh\r
-       if (in->existsAttribute("HardwareMappingHint") &&\r
-               in->existsAttribute("HardwareMappingBufferType"))\r
-       {\r
-               scene::E_HARDWARE_MAPPING mapping = scene::EHM_NEVER;\r
-               scene::E_BUFFER_TYPE bufferType = scene::EBT_NONE;\r
-\r
-               core::stringc smapping = in->getAttributeAsString("HardwareMappingHint");\r
-               if (smapping.equals_ignore_case("static"))\r
-                       mapping = scene::EHM_STATIC;\r
-               else if (smapping.equals_ignore_case("dynamic"))\r
-                       mapping = scene::EHM_DYNAMIC;\r
-               else if (smapping.equals_ignore_case("stream"))\r
-                       mapping = scene::EHM_STREAM;\r
-\r
-               core::stringc sbufferType = in->getAttributeAsString("HardwareMappingBufferType");\r
-               if (sbufferType.equals_ignore_case("vertex"))\r
-                       bufferType = scene::EBT_VERTEX;\r
-               else if (sbufferType.equals_ignore_case("index"))\r
-                       bufferType = scene::EBT_INDEX;\r
-               else if (sbufferType.equals_ignore_case("vertexindex"))\r
-                       bufferType = scene::EBT_VERTEX_AND_INDEX;\r
-\r
-               IMesh* mesh = getMesh();\r
-               if (mesh)\r
-                       mesh->setHardwareMappingHint(mapping, bufferType);\r
-       }\r
-\r
-       IMeshSceneNode::deserializeAttributes(in, options);\r
-}\r
-\r
-\r
 //! Sets if the scene node should not copy the materials of the mesh but use them in a read only style.\r
 /* In this way it is possible to change the materials a mesh causing all mesh scene nodes\r
 referencing this mesh to change too. */\r
@@ -414,9 +306,6 @@ ISceneNode* CMeshSceneNode::clone(ISceneNode* newParent, ISceneManager* newManag
        nb->cloneMembers(this, newManager);\r
        nb->ReadOnlyMaterials = ReadOnlyMaterials;\r
        nb->Materials = Materials;\r
-       nb->Shadow = Shadow;\r
-       if ( nb->Shadow )\r
-               nb->Shadow->grab();\r
 \r
        if (newParent)\r
                nb->drop();\r