From ede858d56fd9556af93b3d15013fc0166807588e Mon Sep 17 00:00:00 2001 From: cutealien Date: Sat, 17 Aug 2019 18:09:07 +0000 Subject: [PATCH] Make S3DVertex::getType a static instead of const function. Same for other vertex classes. Hopefully this makes it more obvious that we're not dealing with a virtual function here (like all the other getType() functions in Irrlicht). Should maybe be renamed (classType or classTypeId?). Also vertexbuffers can now use it without having to create an object first. git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@5855 dfc29bdd-3216-0410-991c-e03cc46cb475 --- include/CMeshBuffer.h | 2 +- include/CVertexBuffer.h | 2 +- include/S3DVertex.h | 7 ++++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/include/CMeshBuffer.h b/include/CMeshBuffer.h index f89eb8a2..05b8acdf 100644 --- a/include/CMeshBuffer.h +++ b/include/CMeshBuffer.h @@ -137,7 +137,7 @@ namespace scene /** \return Type of vertex data. */ virtual video::E_VERTEX_TYPE getVertexType() const _IRR_OVERRIDE_ { - return T().getType(); + return T::getType(); } //! returns position of vertex i diff --git a/include/CVertexBuffer.h b/include/CVertexBuffer.h index bb66cac2..4d52779b 100644 --- a/include/CVertexBuffer.h +++ b/include/CVertexBuffer.h @@ -66,7 +66,7 @@ namespace scene virtual video::S3DVertex* pointer() _IRR_OVERRIDE_ {return Vertices.pointer();} - virtual video::E_VERTEX_TYPE getType() const _IRR_OVERRIDE_ {return T().getType();} + virtual video::E_VERTEX_TYPE getType() const _IRR_OVERRIDE_ {return T::getType();} }; public: diff --git a/include/S3DVertex.h b/include/S3DVertex.h index 41563d5e..2040f9d1 100644 --- a/include/S3DVertex.h +++ b/include/S3DVertex.h @@ -87,7 +87,8 @@ struct S3DVertex ((Pos == other.Pos) && (Normal == other.Normal) && (Color == other.Color) && (TCoords < other.TCoords))); } - E_VERTEX_TYPE getType() const + //! Get type of the class + static E_VERTEX_TYPE getType() { return EVT_STANDARD; } @@ -166,7 +167,7 @@ struct S3DVertex2TCoords : public S3DVertex ((static_cast(*this) == other) && (TCoords2 < other.TCoords2))); } - E_VERTEX_TYPE getType() const + static E_VERTEX_TYPE getType() { return EVT_2TCOORDS; } @@ -240,7 +241,7 @@ struct S3DVertexTangents : public S3DVertex ((static_cast(*this) == other) && (Tangent == other.Tangent) && (Binormal < other.Binormal))); } - E_VERTEX_TYPE getType() const + static E_VERTEX_TYPE getType() { return EVT_TANGENTS; }