mirror of
https://github.com/minetest/irrlicht.git
synced 2024-11-18 16:20:31 +01:00
Add IMeshBuffer::getType
Allows to find out which class a meshbuffer has. I used the same kind of style as ISceneNode::getType. So using four CC codes and virtual functions (instead of type variable). git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6330 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
parent
64fc9113fc
commit
71e9798d2a
@ -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.
|
||||
|
@ -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<f32> BoundingBox;
|
||||
//! Primitive type used for rendering (triangles, lines, ...)
|
||||
|
@ -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<video::S3DVertex2TCoords> SMeshBufferLightMap;
|
||||
//! Meshbuffer with vertices having tangents stored, e.g. for normal mapping
|
||||
typedef CMeshBuffer<video::S3DVertexTangents> SMeshBufferTangents;
|
||||
|
||||
//! partial specialization to return types
|
||||
template <>
|
||||
inline EMESH_BUFFER_TYPE CMeshBuffer<video::S3DVertex>::getTypeT() const
|
||||
{
|
||||
return EMBT_STANDARD;
|
||||
}
|
||||
template <>
|
||||
inline EMESH_BUFFER_TYPE CMeshBuffer<video::S3DVertex2TCoords>::getTypeT() const
|
||||
{
|
||||
return EMBT_LIGHTMAP;
|
||||
}
|
||||
template <>
|
||||
inline EMESH_BUFFER_TYPE CMeshBuffer<video::S3DVertexTangents>::getTypeT() const
|
||||
{
|
||||
return EMBT_TANGENTS;
|
||||
}
|
||||
|
||||
|
||||
} // end namespace scene
|
||||
} // end namespace irr
|
||||
|
||||
|
44
include/EMeshBufferTypes.h
Normal file
44
include/EMeshBufferTypes.h
Normal file
@ -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
|
@ -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
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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; }
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -844,6 +844,7 @@
|
||||
<ClInclude Include="..\..\include\EHardwareBufferFlags.h" />
|
||||
<ClInclude Include="..\..\include\EMaterialFlags.h" />
|
||||
<ClInclude Include="..\..\include\EMaterialTypes.h" />
|
||||
<ClInclude Include="..\..\include\EMeshBufferTypes.h" />
|
||||
<ClInclude Include="..\..\include\EReadFileType.h" />
|
||||
<ClInclude Include="..\..\include\EShaderTypes.h" />
|
||||
<ClInclude Include="..\..\include\fast_atof.h" />
|
||||
|
@ -1438,6 +1438,9 @@
|
||||
<ClInclude Include="..\..\include\EDeviceTypes.h">
|
||||
<Filter>include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\include\EMeshBufferTypes.h">
|
||||
<Filter>include\scene</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\..\changes.txt">
|
||||
|
Loading…
Reference in New Issue
Block a user