diff --git a/changes.txt b/changes.txt index 91007b75..166e34a5 100644 --- a/changes.txt +++ b/changes.txt @@ -1,5 +1,6 @@ -------------------------- Changes in 1.9 (not yet released) +- Add IMeshBuffer::getType to allow finding out which class type a meshbuffer has (similar to ISceneNode::getType). - Add IGUIImage::flip to flip/mirror images - IBillboardSceneNode got functions to access meshbuffers. So uv-coordinates can now be modified directly (previously only possible via texture matrix). - vector3d scalar operator/ and operator/= no longer multiply by the inverse but use the expected division. diff --git a/include/CDynamicMeshBuffer.h b/include/CDynamicMeshBuffer.h index cb776d2f..c0ee356f 100644 --- a/include/CDynamicMeshBuffer.h +++ b/include/CDynamicMeshBuffer.h @@ -114,6 +114,12 @@ namespace scene return PrimitiveType; } + //! Returns type of the class implementing the IMeshBuffer + virtual EMESH_BUFFER_TYPE getType() const IRR_OVERRIDE + { + return EMBT_DYNAMIC; + } + video::SMaterial Material; core::aabbox3d BoundingBox; //! Primitive type used for rendering (triangles, lines, ...) diff --git a/include/CMeshBuffer.h b/include/CMeshBuffer.h index 9f7e2154..22b1c9e1 100644 --- a/include/CMeshBuffer.h +++ b/include/CMeshBuffer.h @@ -286,6 +286,17 @@ namespace scene /** This shouldn't be used for anything outside the VideoDriver. */ virtual u32 getChangedID_Index() const IRR_OVERRIDE {return ChangedID_Index;} + //! Returns type of the class implementing the IMeshBuffer + virtual EMESH_BUFFER_TYPE getType() const IRR_OVERRIDE + { + return getTypeT(); + } + + //! Returns type of the class implementing the IMeshBuffer for template specialization + // Minor note: Some compilers (VS) allow directly specializating the virtual function, + // but this will fail on other compilers (GCC). + EMESH_BUFFER_TYPE getTypeT() const; + u32 ChangedID_Vertex; u32 ChangedID_Index; @@ -311,6 +322,25 @@ namespace scene typedef CMeshBuffer SMeshBufferLightMap; //! Meshbuffer with vertices having tangents stored, e.g. for normal mapping typedef CMeshBuffer SMeshBufferTangents; + + //! partial specialization to return types + template <> + inline EMESH_BUFFER_TYPE CMeshBuffer::getTypeT() const + { + return EMBT_STANDARD; + } + template <> + inline EMESH_BUFFER_TYPE CMeshBuffer::getTypeT() const + { + return EMBT_LIGHTMAP; + } + template <> + inline EMESH_BUFFER_TYPE CMeshBuffer::getTypeT() const + { + return EMBT_TANGENTS; + } + + } // end namespace scene } // end namespace irr diff --git a/include/EMeshBufferTypes.h b/include/EMeshBufferTypes.h new file mode 100644 index 00000000..c9d5fc3f --- /dev/null +++ b/include/EMeshBufferTypes.h @@ -0,0 +1,44 @@ +// This file is part of the "Irrlicht Engine". +// For conditions of distribution and use, see copyright notice in irrlicht.h + +#ifndef IRR_E_MESH_BUFFER_TYPES_H_INCLUDED +#define IRR_E_MESH_BUFFER_TYPES_H_INCLUDED + +#include "irrTypes.h" + +namespace irr +{ +namespace scene +{ + + //! An enumeration for all types of built-in mesh buffers + /** Types are represented by a four character code instead + of simple numbers (easier to add external classes). */ + enum EMESH_BUFFER_TYPE + { + //! SMeshBuffer + EMBT_STANDARD = MAKE_IRR_ID('s','t','a','n'), + + //! SMeshBufferLightMap + EMBT_LIGHTMAP = MAKE_IRR_ID('l','i','g','h'), + + //! SMeshBufferTangents + EMBT_TANGENTS = MAKE_IRR_ID('t','a','n','g'), + + //! CDynamicMeshBuffer + EMBT_DYNAMIC = MAKE_IRR_ID('d','y','n','a'), + + // SSharedMeshBuffer + EMBT_SHARED = MAKE_IRR_ID('s','h','a','r'), + + // SSkinMeshBuffer + EMBT_SKIN = MAKE_IRR_ID('s','k','i','n'), + + //! Unknown class type + EMBT_UNKNOWN = MAKE_IRR_ID('u','n','k','n') + }; + +} // end namespace scene +} // end namespace irr + +#endif diff --git a/include/IMeshBuffer.h b/include/IMeshBuffer.h index 8b14177a..5b43ffce 100644 --- a/include/IMeshBuffer.h +++ b/include/IMeshBuffer.h @@ -12,6 +12,7 @@ #include "SVertexIndex.h" #include "EHardwareBufferFlags.h" #include "EPrimitiveTypes.h" +#include "EMeshBufferTypes.h" namespace irr { @@ -176,6 +177,14 @@ namespace scene return 0; } + //! Returns type of the class implementing the IMeshBuffer + /** \return The class type of this meshbuffer. */ + virtual EMESH_BUFFER_TYPE getType() const + { + return EMBT_UNKNOWN; + } + + }; } // end namespace scene diff --git a/include/SSharedMeshBuffer.h b/include/SSharedMeshBuffer.h index 0a171be6..b9d82e6f 100644 --- a/include/SSharedMeshBuffer.h +++ b/include/SSharedMeshBuffer.h @@ -226,6 +226,12 @@ namespace scene /** This shouldn't be used for anything outside the VideoDriver. */ virtual u32 getChangedID_Index() const IRR_OVERRIDE {return ChangedID_Index;} + //! Returns type of the class implementing the IMeshBuffer + virtual EMESH_BUFFER_TYPE getType() const IRR_OVERRIDE + { + return EMBT_SHARED; + } + //! Material of this meshBuffer video::SMaterial Material; diff --git a/include/SSkinMeshBuffer.h b/include/SSkinMeshBuffer.h index 726deffe..1e298893 100644 --- a/include/SSkinMeshBuffer.h +++ b/include/SSkinMeshBuffer.h @@ -383,6 +383,12 @@ struct SSkinMeshBuffer : public IMeshBuffer virtual u32 getChangedID_Index() const IRR_OVERRIDE {return ChangedID_Index;} + //! Returns type of the class implementing the IMeshBuffer + virtual EMESH_BUFFER_TYPE getType() const IRR_OVERRIDE + { + return EMBT_SKIN; + } + //! Call this after changing the positions of any vertex. void boundingBoxNeedsRecalculated(void) { BoundingBoxNeedsRecalculated = true; } diff --git a/source/Irrlicht/Irrlicht-gcc.cbp b/source/Irrlicht/Irrlicht-gcc.cbp index 2905dd02..08b38e85 100644 --- a/source/Irrlicht/Irrlicht-gcc.cbp +++ b/source/Irrlicht/Irrlicht-gcc.cbp @@ -8,8 +8,8 @@ @@ -397,199 +397,200 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1019,23 +1020,23 @@ - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + @@ -1044,277 +1045,277 @@ - + - + - + - - - + + + - + - + - + - - + + - + - + - + - + - + - + - + - - + + - + - + - + - + - - + + - + - + - + - + - + - + - + - + - + - + - - + + - + - - + + - + - + - + - + - + - + - + - + - - + + - + - + - + - + - + - - + + - + - - - - - + + + + + - + - + - + - + - - - + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - + - + - + - - + + - - + + - - - + + + - + - - + + - - + + - - - + + + - + diff --git a/source/Irrlicht/Irrlicht10.0.vcxproj b/source/Irrlicht/Irrlicht10.0.vcxproj index c713a79a..8de8ceba 100644 --- a/source/Irrlicht/Irrlicht10.0.vcxproj +++ b/source/Irrlicht/Irrlicht10.0.vcxproj @@ -844,6 +844,7 @@ + @@ -859,8 +860,8 @@ - - + + @@ -869,7 +870,7 @@ - + @@ -1035,7 +1036,7 @@ - + @@ -1194,7 +1195,7 @@ - + @@ -1461,7 +1462,7 @@ - + diff --git a/source/Irrlicht/Irrlicht10.0.vcxproj.filters b/source/Irrlicht/Irrlicht10.0.vcxproj.filters index b3f10684..a6adc9d6 100644 --- a/source/Irrlicht/Irrlicht10.0.vcxproj.filters +++ b/source/Irrlicht/Irrlicht10.0.vcxproj.filters @@ -131,13 +131,13 @@ include - + include include - + include @@ -1371,7 +1371,7 @@ Irrlicht\video\Null - + include\core @@ -1438,6 +1438,9 @@ include + + include\scene +