From 53c8df673379803f9a079a231548f988d5d2a554 Mon Sep 17 00:00:00 2001 From: Vincent Lejeune Date: Sat, 10 Jan 2015 21:03:44 +0100 Subject: [PATCH] Remove remaining MD3 support --- lib/irrlicht/CMakeLists.txt | 1 - lib/irrlicht/include/IAnimatedMeshMD3.h | 304 ------------------ lib/irrlicht/include/IAnimatedMeshSceneNode.h | 4 - lib/irrlicht/include/irrlicht.h | 1 - .../Irrlicht/CAnimatedMeshSceneNode.cpp | 83 +---- .../source/Irrlicht/CAnimatedMeshSceneNode.h | 19 -- .../CParticleAnimatedMeshSceneNodeEmitter.cpp | 1 + src/physics/physical_object.cpp | 1 + 8 files changed, 4 insertions(+), 410 deletions(-) delete mode 100644 lib/irrlicht/include/IAnimatedMeshMD3.h diff --git a/lib/irrlicht/CMakeLists.txt b/lib/irrlicht/CMakeLists.txt index ac6c5fbf7..9d8b3d0a6 100644 --- a/lib/irrlicht/CMakeLists.txt +++ b/lib/irrlicht/CMakeLists.txt @@ -456,7 +456,6 @@ include/ITriangleSelector.h include/coreutil.h include/SMeshBufferTangents.h include/ILightSceneNode.h -include/IAnimatedMeshMD3.h include/dimension2d.h include/ISceneCollisionManager.h include/heapsort.h diff --git a/lib/irrlicht/include/IAnimatedMeshMD3.h b/lib/irrlicht/include/IAnimatedMeshMD3.h deleted file mode 100644 index 35c1c9719..000000000 --- a/lib/irrlicht/include/IAnimatedMeshMD3.h +++ /dev/null @@ -1,304 +0,0 @@ -// Copyright (C) 2007-2012 Nikolaus Gebhardt / Thomas Alten -// This file is part of the "Irrlicht Engine". -// For conditions of distribution and use, see copyright notice in irrlicht.h - -#ifndef __I_ANIMATED_MESH_MD3_H_INCLUDED__ -#define __I_ANIMATED_MESH_MD3_H_INCLUDED__ - -#include "IAnimatedMesh.h" -#include "IQ3Shader.h" -#include "quaternion.h" - -namespace irr -{ -namespace scene -{ - - enum eMD3Models - { - EMD3_HEAD = 0, - EMD3_UPPER, - EMD3_LOWER, - EMD3_WEAPON, - EMD3_NUMMODELS - }; - - //! Animation list - enum EMD3_ANIMATION_TYPE - { - // Animations for both lower and upper parts of the player - EMD3_BOTH_DEATH_1 = 0, - EMD3_BOTH_DEAD_1, - EMD3_BOTH_DEATH_2, - EMD3_BOTH_DEAD_2, - EMD3_BOTH_DEATH_3, - EMD3_BOTH_DEAD_3, - - // Animations for the upper part - EMD3_TORSO_GESTURE, - EMD3_TORSO_ATTACK_1, - EMD3_TORSO_ATTACK_2, - EMD3_TORSO_DROP, - EMD3_TORSO_RAISE, - EMD3_TORSO_STAND_1, - EMD3_TORSO_STAND_2, - - // Animations for the lower part - EMD3_LEGS_WALK_CROUCH, - EMD3_LEGS_WALK, - EMD3_LEGS_RUN, - EMD3_LEGS_BACK, - EMD3_LEGS_SWIM, - EMD3_LEGS_JUMP_1, - EMD3_LEGS_LAND_1, - EMD3_LEGS_JUMP_2, - EMD3_LEGS_LAND_2, - EMD3_LEGS_IDLE, - EMD3_LEGS_IDLE_CROUCH, - EMD3_LEGS_TURN, - - //! Not an animation, but amount of animation types. - EMD3_ANIMATION_COUNT - }; - - struct SMD3AnimationInfo - { - //! First frame - s32 first; - //! Last frame - s32 num; - //! Looping frames - s32 looping; - //! Frames per second - s32 fps; - }; - - -// byte-align structures -#include "irrpack.h" - - //! this holds the header info of the MD3 file - struct SMD3Header - { - c8 headerID[4]; //id of file, always "IDP3" - s32 Version; //this is a version number, always 15 - s8 fileName[68]; //sometimes left Blank... 65 chars, 32bit aligned == 68 chars - s32 numFrames; //number of KeyFrames - s32 numTags; //number of 'tags' per frame - s32 numMeshes; //number of meshes/skins - s32 numMaxSkins; //maximum number of unique skins used in md3 file. artefact md2 - s32 frameStart; //starting position of frame-structur - s32 tagStart; //starting position of tag-structures - s32 tagEnd; //ending position of tag-structures/starting position of mesh-structures - s32 fileSize; - } PACK_STRUCT; - - //! this holds the header info of an MD3 mesh section - struct SMD3MeshHeader - { - c8 meshID[4]; //id, must be IDP3 - c8 meshName[68]; //name of mesh 65 chars, 32 bit aligned == 68 chars - - s32 numFrames; //number of meshframes in mesh - s32 numShader; //number of skins in mesh - s32 numVertices; //number of vertices - s32 numTriangles; //number of Triangles - - s32 offset_triangles; //starting position of Triangle data, relative to start of Mesh_Header - s32 offset_shaders; //size of header - s32 offset_st; //starting position of texvector data, relative to start of Mesh_Header - s32 vertexStart; //starting position of vertex data,relative to start of Mesh_Header - s32 offset_end; - } PACK_STRUCT; - - - //! Compressed Vertex Data - struct SMD3Vertex - { - s16 position[3]; - u8 normal[2]; - } PACK_STRUCT; - - //! Texture Coordinate - struct SMD3TexCoord - { - f32 u; - f32 v; - } PACK_STRUCT; - - //! Triangle Index - struct SMD3Face - { - s32 Index[3]; - } PACK_STRUCT; - - -// Default alignment -#include "irrunpack.h" - - //! Holding Frame Data for a Mesh - struct SMD3MeshBuffer : public IReferenceCounted - { - SMD3MeshHeader MeshHeader; - - core::stringc Shader; - core::array < s32 > Indices; - core::array < SMD3Vertex > Vertices; - core::array < SMD3TexCoord > Tex; - }; - - //! hold a tag info for connecting meshes - /** Basically its an alternate way to describe a transformation. */ - struct SMD3QuaternionTag - { - virtual ~SMD3QuaternionTag() - { - position.X = 0.f; - } - - // construct copy constructor - SMD3QuaternionTag( const SMD3QuaternionTag & copyMe ) - { - *this = copyMe; - } - - // construct for searching - SMD3QuaternionTag( const core::stringc& name ) - : Name ( name ) {} - - // construct from a position and euler angles in degrees - SMD3QuaternionTag ( const core::vector3df &pos, const core::vector3df &angle ) - : position(pos), rotation(angle * core::DEGTORAD) {} - - // set to matrix - void setto ( core::matrix4 &m ) - { - rotation.getMatrix ( m, position ); - } - - bool operator == ( const SMD3QuaternionTag &other ) const - { - return Name == other.Name; - } - - SMD3QuaternionTag & operator=( const SMD3QuaternionTag & copyMe ) - { - Name = copyMe.Name; - position = copyMe.position; - rotation = copyMe.rotation; - return *this; - } - - core::stringc Name; - core::vector3df position; - core::quaternion rotation; - }; - - //! holds a associative list of named quaternions - struct SMD3QuaternionTagList - { - SMD3QuaternionTagList() - { - Container.setAllocStrategy(core::ALLOC_STRATEGY_SAFE); - } - - // construct copy constructor - SMD3QuaternionTagList(const SMD3QuaternionTagList& copyMe) - { - *this = copyMe; - } - - virtual ~SMD3QuaternionTagList() {} - - SMD3QuaternionTag* get(const core::stringc& name) - { - SMD3QuaternionTag search ( name ); - s32 index = Container.linear_search ( search ); - if ( index >= 0 ) - return &Container[index]; - return 0; - } - - u32 size () const - { - return Container.size(); - } - - void set_used(u32 new_size) - { - s32 diff = (s32) new_size - (s32) Container.allocated_size(); - if ( diff > 0 ) - { - SMD3QuaternionTag e(""); - for ( s32 i = 0; i < diff; ++i ) - Container.push_back(e); - } - } - - const SMD3QuaternionTag& operator[](u32 index) const - { - return Container[index]; - } - - SMD3QuaternionTag& operator[](u32 index) - { - return Container[index]; - } - - void push_back(const SMD3QuaternionTag& other) - { - Container.push_back(other); - } - - SMD3QuaternionTagList& operator = (const SMD3QuaternionTagList & copyMe) - { - Container = copyMe.Container; - return *this; - } - - private: - core::array < SMD3QuaternionTag > Container; - }; - - - //! Holding Frames Buffers and Tag Infos - struct SMD3Mesh: public IReferenceCounted - { - SMD3Mesh () - { - MD3Header.numFrames = 0; - } - - virtual ~SMD3Mesh() - { - for (u32 i=0; idrop(); - } - - core::stringc Name; - core::array Buffer; - SMD3QuaternionTagList TagList; - SMD3Header MD3Header; - }; - - - //! Interface for using some special functions of MD3 meshes - class IAnimatedMeshMD3 : public IAnimatedMesh - { - public: - - //! tune how many frames you want to render inbetween. - virtual void setInterpolationShift(u32 shift, u32 loopMode) =0; - - //! get the tag list of the mesh. - virtual SMD3QuaternionTagList* getTagList(s32 frame, s32 detailLevel, s32 startFrameLoop, s32 endFrameLoop) =0; - - //! get the original md3 mesh. - virtual SMD3Mesh* getOriginalMesh() =0; - }; - -} // end namespace scene -} // end namespace irr - -#endif - diff --git a/lib/irrlicht/include/IAnimatedMeshSceneNode.h b/lib/irrlicht/include/IAnimatedMeshSceneNode.h index 6cc125cd6..3839d3b41 100644 --- a/lib/irrlicht/include/IAnimatedMeshSceneNode.h +++ b/lib/irrlicht/include/IAnimatedMeshSceneNode.h @@ -8,7 +8,6 @@ #include "ISceneNode.h" #include "IBoneSceneNode.h" #include "IAnimatedMeshMD2.h" -#include "IAnimatedMeshMD3.h" namespace irr { @@ -201,9 +200,6 @@ namespace scene //! Returns the current mesh virtual IAnimatedMesh* getMesh(void) = 0; - //! Get the absolute transformation for a special MD3 Tag if the mesh is a md3 mesh, or the absolutetransformation if it's a normal scenenode - virtual const SMD3QuaternionTag* getMD3TagTransformation( const core::stringc & tagname) = 0; - //! Set how the joints should be updated on render virtual void setJointMode(E_JOINT_UPDATE_ON_RENDER mode)=0; diff --git a/lib/irrlicht/include/irrlicht.h b/lib/irrlicht/include/irrlicht.h index 9fb0bfc02..8db416de5 100644 --- a/lib/irrlicht/include/irrlicht.h +++ b/lib/irrlicht/include/irrlicht.h @@ -55,7 +55,6 @@ #include "heapsort.h" #include "IAnimatedMesh.h" #include "IAnimatedMeshMD2.h" -#include "IAnimatedMeshMD3.h" #include "IAnimatedMeshSceneNode.h" #include "IAttributeExchangingObject.h" #include "IAttributes.h" diff --git a/lib/irrlicht/source/Irrlicht/CAnimatedMeshSceneNode.cpp b/lib/irrlicht/source/Irrlicht/CAnimatedMeshSceneNode.cpp index 05dcacb05..3832315ce 100644 --- a/lib/irrlicht/source/Irrlicht/CAnimatedMeshSceneNode.cpp +++ b/lib/irrlicht/source/Irrlicht/CAnimatedMeshSceneNode.cpp @@ -8,7 +8,6 @@ #include "S3DVertex.h" #include "os.h" #include "CShadowVolumeSceneNode.h" -#include "IAnimatedMeshMD3.h" #include "CSkinnedMesh.h" #include "IDummyTransformationSceneNode.h" #include "IBoneSceneNode.h" @@ -17,6 +16,7 @@ #include "IMeshCache.h" #include "IAnimatedMesh.h" #include "quaternion.h" +#include "IFileSystem.h" namespace irr @@ -37,7 +37,7 @@ CAnimatedMeshSceneNode::CAnimatedMeshSceneNode(IAnimatedMesh* mesh, TransitionTime(0), Transiting(0.f), TransitingBlend(0.f), JointMode(EJUOR_NONE), JointsUsed(false), Looping(true), ReadOnlyMaterials(false), RenderFromIdentity(false), - LoopCallBack(0), PassCount(0), Shadow(0), MD3Special(0) + LoopCallBack(0), PassCount(0), Shadow(0) { #ifdef _DEBUG setDebugName("CAnimatedMeshSceneNode"); @@ -50,9 +50,6 @@ CAnimatedMeshSceneNode::CAnimatedMeshSceneNode(IAnimatedMesh* mesh, //! destructor CAnimatedMeshSceneNode::~CAnimatedMeshSceneNode() { - if (MD3Special) - MD3Special->drop(); - if (Mesh) Mesh->drop(); @@ -407,40 +404,6 @@ void CAnimatedMeshSceneNode::render() } } } - - // show tag for quake3 models - if (Mesh->getMeshType() == EAMT_MD3) - { - IAnimatedMesh * arrow = - SceneManager->addArrowMesh ( - "__tag_show", - 0xFF0000FF, 0xFF000088, - 4, 8, 5.f, 4.f, 0.5f, - 1.f); - if (!arrow) - { - arrow = SceneManager->getMesh ( "__tag_show" ); - } - IMesh *arrowMesh = arrow->getMesh(0); - - core::matrix4 matr; - - SMD3QuaternionTagList *taglist = ((IAnimatedMeshMD3*)Mesh)->getTagList( - (s32)getFrameNr(), 255, - getStartFrame(), getEndFrame()); - if (taglist) - { - for ( u32 ts = 0; ts != taglist->size(); ++ts ) - { - (*taglist)[ts].setto(matr); - - driver->setTransform(video::ETS_WORLD, matr ); - - for ( u32 a = 0; a != arrowMesh->getMeshBufferCount(); ++a ) - driver->drawMeshBuffer(arrowMesh->getMeshBuffer(a)); - } - } - } } // show mesh @@ -883,51 +846,10 @@ void CAnimatedMeshSceneNode::setMesh(IAnimatedMesh* mesh) setFrameLoop(0, Mesh->getFrameCount()); } - -// returns the absolute transformation for a special MD3 Tag if the mesh is a md3 mesh, -// or the absolutetransformation if it's a normal scenenode -const SMD3QuaternionTag* CAnimatedMeshSceneNode::getMD3TagTransformation(const core::stringc& tagname) -{ - return MD3Special ? MD3Special->AbsoluteTagList.get(tagname) : 0; -} - - //! updates the absolute position based on the relative and the parents position void CAnimatedMeshSceneNode::updateAbsolutePosition() { IAnimatedMeshSceneNode::updateAbsolutePosition(); - - if (!Mesh || Mesh->getMeshType() != EAMT_MD3) - return; - - SMD3QuaternionTagList *taglist; - taglist = ( (IAnimatedMeshMD3*) Mesh )->getTagList ( (s32)getFrameNr(),255,getStartFrame (),getEndFrame () ); - if (taglist) - { - if (!MD3Special) - { - MD3Special = new SMD3Special(); - } - - SMD3QuaternionTag parent ( MD3Special->Tagname ); - if (Parent && Parent->getType() == ESNT_ANIMATED_MESH) - { - const SMD3QuaternionTag * p = ((IAnimatedMeshSceneNode*) Parent)->getMD3TagTransformation - ( MD3Special->Tagname ); - - if (p) - parent = *p; - } - - SMD3QuaternionTag relative( RelativeTranslation, RelativeRotation ); - - MD3Special->AbsoluteTagList.set_used ( taglist->size () ); - for ( u32 i=0; i!= taglist->size (); ++i ) - { - MD3Special->AbsoluteTagList[i].position = parent.position + (*taglist)[i].position + relative.position; - MD3Special->AbsoluteTagList[i].rotation = parent.rotation * (*taglist)[i].rotation * relative.rotation; - } - } } //! Set the joint update mode (0-unused, 1-get joints only, 2-set joints only, 3-move and set) @@ -1134,7 +1056,6 @@ ISceneNode* CAnimatedMeshSceneNode::clone(ISceneNode* newParent, ISceneManager* newNode->JointChildSceneNodes = JointChildSceneNodes; newNode->PretransitingSave = PretransitingSave; newNode->RenderFromIdentity = RenderFromIdentity; - newNode->MD3Special = MD3Special; return newNode; } diff --git a/lib/irrlicht/source/Irrlicht/CAnimatedMeshSceneNode.h b/lib/irrlicht/source/Irrlicht/CAnimatedMeshSceneNode.h index 6b1db9c3b..e660a8fb8 100644 --- a/lib/irrlicht/source/Irrlicht/CAnimatedMeshSceneNode.h +++ b/lib/irrlicht/source/Irrlicht/CAnimatedMeshSceneNode.h @@ -146,10 +146,6 @@ namespace scene //! Returns type of the scene node virtual ESCENE_NODE_TYPE getType() const { return ESNT_ANIMATED_MESH; } - // returns the absolute transformation for a special MD3 Tag if the mesh is a md3 mesh, - // or the absolutetransformation if it's a normal scenenode - const SMD3QuaternionTag* getMD3TagTransformation( const core::stringc & tagname); - //! updates the absolute position based on the relative and the parents position virtual void updateAbsolutePosition(); @@ -213,21 +209,6 @@ namespace scene core::array JointChildSceneNodes; core::array PretransitingSave; - - // Quake3 Model - struct SMD3Special : public virtual IReferenceCounted - { - core::stringc Tagname; - SMD3QuaternionTagList AbsoluteTagList; - - SMD3Special & operator = (const SMD3Special & copyMe) - { - Tagname = copyMe.Tagname; - AbsoluteTagList = copyMe.AbsoluteTagList; - return *this; - } - }; - SMD3Special *MD3Special; }; } // end namespace scene diff --git a/lib/irrlicht/source/Irrlicht/CParticleAnimatedMeshSceneNodeEmitter.cpp b/lib/irrlicht/source/Irrlicht/CParticleAnimatedMeshSceneNodeEmitter.cpp index 1f295e7e3..15619691c 100644 --- a/lib/irrlicht/source/Irrlicht/CParticleAnimatedMeshSceneNodeEmitter.cpp +++ b/lib/irrlicht/source/Irrlicht/CParticleAnimatedMeshSceneNodeEmitter.cpp @@ -5,6 +5,7 @@ #include "CParticleAnimatedMeshSceneNodeEmitter.h" #include "IAnimatedMeshSceneNode.h" #include "IMesh.h" +#include "IMeshBuffer.h" #include "os.h" namespace irr diff --git a/src/physics/physical_object.cpp b/src/physics/physical_object.cpp index 5beb0bc48..d3287f877 100644 --- a/src/physics/physical_object.cpp +++ b/src/physics/physical_object.cpp @@ -37,6 +37,7 @@ using namespace irr; #include #include +#include /** Creates a physical Settings object with the given type, radius and mass. */