]> git.lizzy.rs Git - irrlicht.git/blobdiff - include/CMeshBuffer.h
Bump revision
[irrlicht.git] / include / CMeshBuffer.h
index 05b8acdf0b26d58a7bef6cce5311ea20bdda3962..e8fb5066cf90e45e85e027ea450ac4c06d4ff766 100644 (file)
@@ -21,6 +21,7 @@ namespace scene
                CMeshBuffer()\r
                        : ChangedID_Vertex(1), ChangedID_Index(1)\r
                        , MappingHint_Vertex(EHM_NEVER), MappingHint_Index(EHM_NEVER)\r
+                       , HWBuffer(NULL)\r
                        , PrimitiveType(EPT_TRIANGLES)\r
                {\r
                        #ifdef _DEBUG\r
@@ -31,7 +32,7 @@ namespace scene
 \r
                //! Get material of this meshbuffer\r
                /** \return Material of this buffer */\r
-               virtual const video::SMaterial& getMaterial() const _IRR_OVERRIDE_\r
+               const video::SMaterial& getMaterial() const override\r
                {\r
                        return Material;\r
                }\r
@@ -39,7 +40,7 @@ namespace scene
 \r
                //! Get material of this meshbuffer\r
                /** \return Material of this buffer */\r
-               virtual video::SMaterial& getMaterial() _IRR_OVERRIDE_\r
+               video::SMaterial& getMaterial() override\r
                {\r
                        return Material;\r
                }\r
@@ -47,7 +48,7 @@ namespace scene
 \r
                //! Get pointer to vertices\r
                /** \return Pointer to vertices. */\r
-               virtual const void* getVertices() const _IRR_OVERRIDE_\r
+               const void* getVertices() const override\r
                {\r
                        return Vertices.const_pointer();\r
                }\r
@@ -55,7 +56,7 @@ namespace scene
 \r
                //! Get pointer to vertices\r
                /** \return Pointer to vertices. */\r
-               virtual void* getVertices() _IRR_OVERRIDE_\r
+               void* getVertices() override\r
                {\r
                        return Vertices.pointer();\r
                }\r
@@ -63,21 +64,21 @@ namespace scene
 \r
                //! Get number of vertices\r
                /** \return Number of vertices. */\r
-               virtual u32 getVertexCount() const _IRR_OVERRIDE_\r
+               u32 getVertexCount() const override\r
                {\r
                        return Vertices.size();\r
                }\r
 \r
                //! Get type of index data which is stored in this meshbuffer.\r
                /** \return Index type of this buffer. */\r
-               virtual video::E_INDEX_TYPE getIndexType() const _IRR_OVERRIDE_\r
+               video::E_INDEX_TYPE getIndexType() const override\r
                {\r
                        return video::EIT_16BIT;\r
                }\r
 \r
                //! Get pointer to indices\r
                /** \return Pointer to indices. */\r
-               virtual const u16* getIndices() const _IRR_OVERRIDE_\r
+               const u16* getIndices() const override\r
                {\r
                        return Indices.const_pointer();\r
                }\r
@@ -85,7 +86,7 @@ namespace scene
 \r
                //! Get pointer to indices\r
                /** \return Pointer to indices. */\r
-               virtual u16* getIndices() _IRR_OVERRIDE_\r
+               u16* getIndices() override\r
                {\r
                        return Indices.pointer();\r
                }\r
@@ -93,7 +94,7 @@ namespace scene
 \r
                //! Get number of indices\r
                /** \return Number of indices. */\r
-               virtual u32 getIndexCount() const _IRR_OVERRIDE_\r
+               u32 getIndexCount() const override\r
                {\r
                        return Indices.size();\r
                }\r
@@ -101,7 +102,7 @@ namespace scene
 \r
                //! Get the axis aligned bounding box\r
                /** \return Axis aligned bounding box of this buffer. */\r
-               virtual const core::aabbox3d<f32>& getBoundingBox() const _IRR_OVERRIDE_\r
+               const core::aabbox3d<f32>& getBoundingBox() const override\r
                {\r
                        return BoundingBox;\r
                }\r
@@ -110,7 +111,7 @@ namespace scene
                //! Set the axis aligned bounding box\r
                /** \param box New axis aligned bounding box for this buffer. */\r
                //! set user axis aligned bounding box\r
-               virtual void setBoundingBox(const core::aabbox3df& box) _IRR_OVERRIDE_\r
+               void setBoundingBox(const core::aabbox3df& box) override\r
                {\r
                        BoundingBox = box;\r
                }\r
@@ -118,7 +119,7 @@ namespace scene
 \r
                //! Recalculate the bounding box.\r
                /** should be called if the mesh changed. */\r
-               virtual void recalculateBoundingBox() _IRR_OVERRIDE_\r
+               void recalculateBoundingBox() override\r
                {\r
                        if (!Vertices.empty())\r
                        {\r
@@ -135,43 +136,43 @@ namespace scene
 \r
                //! Get type of vertex data stored in this buffer.\r
                /** \return Type of vertex data. */\r
-               virtual video::E_VERTEX_TYPE getVertexType() const _IRR_OVERRIDE_\r
+               video::E_VERTEX_TYPE getVertexType() const override\r
                {\r
                        return T::getType();\r
                }\r
 \r
                //! returns position of vertex i\r
-               virtual const core::vector3df& getPosition(u32 i) const _IRR_OVERRIDE_\r
+               const core::vector3df& getPosition(u32 i) const override\r
                {\r
                        return Vertices[i].Pos;\r
                }\r
 \r
                //! returns position of vertex i\r
-               virtual core::vector3df& getPosition(u32 i) _IRR_OVERRIDE_\r
+               core::vector3df& getPosition(u32 i) override\r
                {\r
                        return Vertices[i].Pos;\r
                }\r
 \r
                //! returns normal of vertex i\r
-               virtual const core::vector3df& getNormal(u32 i) const _IRR_OVERRIDE_\r
+               const core::vector3df& getNormal(u32 i) const override\r
                {\r
                        return Vertices[i].Normal;\r
                }\r
 \r
                //! returns normal of vertex i\r
-               virtual core::vector3df& getNormal(u32 i) _IRR_OVERRIDE_\r
+               core::vector3df& getNormal(u32 i) override\r
                {\r
                        return Vertices[i].Normal;\r
                }\r
 \r
                //! returns texture coord of vertex i\r
-               virtual const core::vector2df& getTCoords(u32 i) const _IRR_OVERRIDE_\r
+               const core::vector2df& getTCoords(u32 i) const override\r
                {\r
                        return Vertices[i].TCoords;\r
                }\r
 \r
                //! returns texture coord of vertex i\r
-               virtual core::vector2df& getTCoords(u32 i) _IRR_OVERRIDE_\r
+               core::vector2df& getTCoords(u32 i) override\r
                {\r
                        return Vertices[i].TCoords;\r
                }\r
@@ -182,7 +183,7 @@ namespace scene
                or the main buffer is of standard type. Otherwise, behavior is\r
                undefined.\r
                */\r
-               virtual void append(const void* const vertices, u32 numVertices, const u16* const indices, u32 numIndices) _IRR_OVERRIDE_\r
+               void append(const void* const vertices, u32 numVertices, const u16* const indices, u32 numIndices) override\r
                {\r
                        if (vertices == getVertices())\r
                                return;\r
@@ -193,8 +194,8 @@ namespace scene
                        Vertices.reallocate(vertexCount+numVertices);\r
                        for (i=0; i<numVertices; ++i)\r
                        {\r
-                               Vertices.push_back(reinterpret_cast<const T*>(vertices)[i]);\r
-                               BoundingBox.addInternalPoint(reinterpret_cast<const T*>(vertices)[i].Pos);\r
+                               Vertices.push_back(static_cast<const T*>(vertices)[i]);\r
+                               BoundingBox.addInternalPoint(static_cast<const T*>(vertices)[i].Pos);\r
                        }\r
 \r
                        Indices.reallocate(getIndexCount()+numIndices);\r
@@ -211,7 +212,7 @@ namespace scene
                undefined.\r
                \param other Meshbuffer to be appended to this one.\r
                */\r
-               virtual void append(const IMeshBuffer* const other) _IRR_OVERRIDE_\r
+               void append(const IMeshBuffer* const other) override\r
                {\r
                        /*\r
                        if (this==other)\r
@@ -237,19 +238,19 @@ namespace scene
 \r
 \r
                //! get the current hardware mapping hint\r
-               virtual E_HARDWARE_MAPPING getHardwareMappingHint_Vertex() const _IRR_OVERRIDE_\r
+               E_HARDWARE_MAPPING getHardwareMappingHint_Vertex() const override\r
                {\r
                        return MappingHint_Vertex;\r
                }\r
 \r
                //! get the current hardware mapping hint\r
-               virtual E_HARDWARE_MAPPING getHardwareMappingHint_Index() const _IRR_OVERRIDE_\r
+               E_HARDWARE_MAPPING getHardwareMappingHint_Index() const override\r
                {\r
                        return MappingHint_Index;\r
                }\r
 \r
                //! set the hardware mapping hint, for driver\r
-               virtual void setHardwareMappingHint( E_HARDWARE_MAPPING NewMappingHint, E_BUFFER_TYPE Buffer=EBT_VERTEX_AND_INDEX ) _IRR_OVERRIDE_\r
+               void setHardwareMappingHint( E_HARDWARE_MAPPING NewMappingHint, E_BUFFER_TYPE Buffer=EBT_VERTEX_AND_INDEX ) override\r
                {\r
                        if (Buffer==EBT_VERTEX_AND_INDEX || Buffer==EBT_VERTEX)\r
                                MappingHint_Vertex=NewMappingHint;\r
@@ -258,19 +259,19 @@ namespace scene
                }\r
 \r
                //! Describe what kind of primitive geometry is used by the meshbuffer\r
-               virtual void setPrimitiveType(E_PRIMITIVE_TYPE type) _IRR_OVERRIDE_\r
+               void setPrimitiveType(E_PRIMITIVE_TYPE type) override\r
                {\r
                        PrimitiveType = type;\r
                }\r
 \r
                //! Get the kind of primitive geometry which is used by the meshbuffer\r
-               virtual E_PRIMITIVE_TYPE getPrimitiveType() const _IRR_OVERRIDE_\r
+               E_PRIMITIVE_TYPE getPrimitiveType() const override\r
                {\r
                        return PrimitiveType;\r
                }\r
 \r
                //! flags the mesh as changed, reloads hardware buffers\r
-               virtual void setDirty(E_BUFFER_TYPE Buffer=EBT_VERTEX_AND_INDEX) _IRR_OVERRIDE_\r
+               void setDirty(E_BUFFER_TYPE Buffer=EBT_VERTEX_AND_INDEX) override\r
                {\r
                        if (Buffer==EBT_VERTEX_AND_INDEX ||Buffer==EBT_VERTEX)\r
                                ++ChangedID_Vertex;\r
@@ -280,11 +281,20 @@ namespace scene
 \r
                //! Get the currently used ID for identification of changes.\r
                /** This shouldn't be used for anything outside the VideoDriver. */\r
-               virtual u32 getChangedID_Vertex() const _IRR_OVERRIDE_ {return ChangedID_Vertex;}\r
+               u32 getChangedID_Vertex() const override {return ChangedID_Vertex;}\r
 \r
                //! Get the currently used ID for identification of changes.\r
                /** This shouldn't be used for anything outside the VideoDriver. */\r
-               virtual u32 getChangedID_Index() const _IRR_OVERRIDE_ {return ChangedID_Index;}\r
+               u32 getChangedID_Index() const override {return ChangedID_Index;}\r
+\r
+               void setHWBuffer(void *ptr) const override {\r
+                       HWBuffer = ptr;\r
+               }\r
+\r
+               void *getHWBuffer() const override {\r
+                       return HWBuffer;\r
+               }\r
+\r
 \r
                u32 ChangedID_Vertex;\r
                u32 ChangedID_Index;\r
@@ -292,6 +302,7 @@ namespace scene
                //! hardware mapping hint\r
                E_HARDWARE_MAPPING MappingHint_Vertex;\r
                E_HARDWARE_MAPPING MappingHint_Index;\r
+               mutable void *HWBuffer;\r
 \r
                //! Material for this meshbuffer.\r
                video::SMaterial Material;\r