diff --git a/changes.txt b/changes.txt index 47da246..b9b3b27 100644 --- a/changes.txt +++ b/changes.txt @@ -1,5 +1,6 @@ -------------------------- Changes in 1.9 (not yet released) +- 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. Costs some speed, but fixes floating point troubles caused by this optimization (like x/x no longer being 1.0). - Bugfix: XML reader dropped last character in strings if there was a special character replacement for the second-last character. diff --git a/include/IBillboardSceneNode.h b/include/IBillboardSceneNode.h index ee7a332..0d6fcc9 100644 --- a/include/IBillboardSceneNode.h +++ b/include/IBillboardSceneNode.h @@ -12,6 +12,7 @@ namespace irr namespace scene { class ICameraSceneNode; + class IMeshBuffer; //! A billboard scene node. /** A billboard is like a 3d sprite: A 2d element, @@ -74,6 +75,17 @@ public: That is why the usual getBoundingBox will return a "safe" boundingbox which is guaranteed to contain the billboard. While this function can return the real one. */ virtual const core::aabbox3d& getTransformedBillboardBoundingBox(const irr::scene::ICameraSceneNode* camera) = 0; + + //! Get the amount of mesh buffers. + /** \return Amount of mesh buffers (IMeshBuffer) in this mesh. */ + virtual u32 getMeshBufferCount() const = 0; + + //! Get pointer to a mesh buffer. + /** NOTE: Positions and normals of this meshbuffers are re-calculated before rendering. + So this is mainly useful to access/modify the uv-coordinates. + \param nr: Zero based index of the mesh buffer. + \return Pointer to the mesh buffer or 0 if there is no such mesh buffer. */ + virtual IMeshBuffer* getMeshBuffer(u32 nr) const = 0; }; } // end namespace scene diff --git a/source/Irrlicht/CBillboardSceneNode.h b/source/Irrlicht/CBillboardSceneNode.h index 2bb6cbe..0e3a74d 100644 --- a/source/Irrlicht/CBillboardSceneNode.h +++ b/source/Irrlicht/CBillboardSceneNode.h @@ -72,6 +72,20 @@ public: //! Get the real boundingbox used by the billboard (which depends on the active camera) virtual const core::aabbox3d& getTransformedBillboardBoundingBox(const irr::scene::ICameraSceneNode* camera) IRR_OVERRIDE; + //! Get the amount of mesh buffers. + virtual u32 getMeshBufferCount() const + { + return Buffer ? 1 : 0; + } + + //! Get pointer to the mesh buffer. + virtual IMeshBuffer* getMeshBuffer(u32 nr) const + { + if ( nr == 0 ) + return Buffer; + return 0; + } + //! Writes attributes of the scene node. virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const IRR_OVERRIDE; diff --git a/source/Irrlicht/CTextSceneNode.h b/source/Irrlicht/CTextSceneNode.h index 2d2c71e..d8af787 100644 --- a/source/Irrlicht/CTextSceneNode.h +++ b/source/Irrlicht/CTextSceneNode.h @@ -145,6 +145,18 @@ namespace scene virtual const core::aabbox3d& getTransformedBillboardBoundingBox(const irr::scene::ICameraSceneNode* camera) IRR_OVERRIDE; + //! Get the amount of mesh buffers. + virtual u32 getMeshBufferCount() const + { + return Mesh ? Mesh->getMeshBufferCount() : 0; + } + + //! Get pointer to the mesh buffer. + virtual IMeshBuffer* getMeshBuffer(u32 nr) const + { + return Mesh ? Mesh->getMeshBuffer(nr) : 0; + } + protected: void updateMesh(const irr::scene::ICameraSceneNode* camera);