mirror of
https://github.com/minetest/irrlicht.git
synced 2025-07-04 09:10:27 +02:00
IMeshManipulator::transform can now also normalize normals
Also only update normals now using inner 3x3 matrix (same result usually as last column is 0,0,0 but faster) And adding some comments. git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6419 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
@ -277,6 +277,32 @@ namespace scene
|
||||
core::matrix4 Transformation;
|
||||
};
|
||||
|
||||
//! Vertex manipulator which transforms the normal of the vertex with the rotate/scale part of the given matrix (inner 3x3)
|
||||
class SVertexNormalRotateScaleManipulator : public IVertexManipulator
|
||||
{
|
||||
public:
|
||||
SVertexNormalRotateScaleManipulator(const core::matrix4& m) : Transformation(m) {}
|
||||
template <typename VType>
|
||||
void operator()(VType& vertex) const
|
||||
{
|
||||
Transformation.rotateVect(vertex.Normal);
|
||||
}
|
||||
private:
|
||||
core::matrix4 Transformation;
|
||||
};
|
||||
|
||||
//! Vertex manipulator which normalizes the normal of the vertex
|
||||
class SVertexNormalizeNormalManipulator : public IVertexManipulator
|
||||
{
|
||||
public:
|
||||
SVertexNormalizeNormalManipulator() {}
|
||||
template <typename VType>
|
||||
void operator()(VType& vertex) const
|
||||
{
|
||||
vertex.Normal.normalize();
|
||||
}
|
||||
};
|
||||
|
||||
//! Vertex manipulator which scales the TCoords of the vertex
|
||||
class SVertexTCoordsScaleManipulator : public IVertexManipulator
|
||||
{
|
||||
|
Reference in New Issue
Block a user