1
0

Merging r6405 through r6424 from trunk to ogl-es branch

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/branches/ogl-es@6425 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
cutealien
2022-09-22 21:55:03 +00:00
parent ddc14ea87e
commit 07f17647d2
46 changed files with 589 additions and 463 deletions

View File

@@ -103,7 +103,9 @@ namespace scene
bool angleWeighted=false) const=0;
//! Scales the actual mesh, not a scene node.
/** \param mesh Mesh on which the operation is performed.
/** Note: When your scale are not uniform then
prefer the transform function to have correct normals.
\param mesh Mesh on which the operation is performed.
\param factor Scale factor for each axis. */
void scale(IMesh* mesh, const core::vector3df& factor) const
{
@@ -111,7 +113,9 @@ namespace scene
}
//! Scales the actual meshbuffer, not a scene node.
/** \param buffer Meshbuffer on which the operation is performed.
/** Note: When your scale are not uniform then
prefer the transform function to have correct normals.
\param buffer Meshbuffer on which the operation is performed.
\param factor Scale factor for each axis. */
void scale(IMeshBuffer* buffer, const core::vector3df& factor) const
{
@@ -146,9 +150,12 @@ namespace scene
/** \param mesh Mesh on which the operation is performed.
\param m transformation matrix.
\param normalsUpdate When 0 - don't update normals.
When 1 - update normals with inverse transposed of the transformation matrix
When 1 - update normals with inner 3x3 matrix of the inverse transposed of the transformation matrix
should be set when the matrix has rotation or non-uniform scaling
\param normalizeNormals When true it normalizes all normals again.
Recommended to set this when normalsUpdate is 1 and there is any scaling
*/
void transform(IMesh* mesh, const core::matrix4& m, u32 normalsUpdate = 0) const
void transform(IMesh* mesh, const core::matrix4& m, u32 normalsUpdate = 0, bool normalizeNormals=false) const
{
apply(SVertexPositionTransformManipulator(m), mesh, true);
@@ -158,18 +165,25 @@ namespace scene
if ( m.getInverse(invT) )
{
invT = invT.getTransposed();
apply(SVertexNormalTransformManipulator(invT), mesh, false);
apply(SVertexNormalRotateScaleManipulator(invT), mesh, false);
}
}
if ( normalizeNormals )
{
apply(SVertexNormalizeNormalManipulator(), mesh, false);
}
}
//! Applies a transformation to a meshbuffer
/** \param buffer Meshbuffer on which the operation is performed.
\param m transformation matrix.
\param normalsUpdate When 0 - don't update normals.
When 1 - update normals with inverse transposed of the transformation matrix
When 1 - update normals with inner 3x3 matrix of the inverse transposed of the transformation matrix
should be set when the matrix has rotation or non-uniform scaling
\param normalizeNormals When true it normalizes all normals again.
Recommended to set this when normalsUpdate is 1 and there is any scaling
*/
void transform(IMeshBuffer* buffer, const core::matrix4& m, u32 normalsUpdate = 0) const
void transform(IMeshBuffer* buffer, const core::matrix4& m, u32 normalsUpdate = 0, bool normalizeNormals=false) const
{
apply(SVertexPositionTransformManipulator(m), buffer, true);
@@ -179,9 +193,13 @@ namespace scene
if ( m.getInverse(invT) )
{
invT = invT.getTransposed();
apply(SVertexNormalTransformManipulator(invT), buffer, false);
apply(SVertexNormalRotateScaleManipulator(invT), buffer, false);
}
}
if ( normalizeNormals )
{
apply(SVertexNormalizeNormalManipulator(), buffer, false);
}
}
//! Applies a transformation to a mesh
@@ -239,6 +257,7 @@ namespace scene
/** This is useful if you want to draw tangent space normal
mapped geometry because it calculates the tangent and binormal
data which is needed there.
Note: Only 16-bit meshbuffers supported so far
\param mesh Input mesh
\param recalculateNormals The normals are recalculated if set,
otherwise the original ones are kept. Note that keeping the
@@ -257,7 +276,8 @@ namespace scene
bool angleWeighted=false, bool recalculateTangents=true) const=0;
//! Creates a copy of the mesh, which will only consist of S3DVertex2TCoord vertices.
/** \param mesh Input mesh
/** Note: Only 16-bit meshbuffers supported so far
\param mesh Input mesh
\return Mesh consisting only of S3DVertex2TCoord vertices. If
you no longer need the cloned mesh, you should call
IMesh::drop(). See IReferenceCounted::drop() for more
@@ -265,7 +285,8 @@ namespace scene
virtual IMesh* createMeshWith2TCoords(IMesh* mesh) const = 0;
//! Creates a copy of the mesh, which will only consist of S3DVertex vertices.
/** \param mesh Input mesh
/** Note: Only 16-bit meshbuffers supported so far
\param mesh Input mesh
\return Mesh consisting only of S3DVertex vertices. If
you no longer need the cloned mesh, you should call
IMesh::drop(). See IReferenceCounted::drop() for more
@@ -273,15 +294,17 @@ namespace scene
virtual IMesh* createMeshWith1TCoords(IMesh* mesh) const = 0;
//! Creates a copy of a mesh with all vertices unwelded
/** \param mesh Input mesh
/** Note: Only 16-bit meshbuffers supported so far
\param mesh Input mesh
\return Mesh consisting only of unique faces. All vertices
which were previously shared are now duplicated. If you no
longer need the cloned mesh, you should call IMesh::drop(). See
IReferenceCounted::drop() for more information. */
virtual IMesh* createMeshUniquePrimitives(IMesh* mesh) const = 0;
//! Creates a copy of a mesh with vertices welded
/** \param mesh Input mesh
//! Creates a copy of a mesh with vertices welded
/** Note: Only 16-bit meshbuffers supported so far, 32-bit buffer are cloned
\param mesh Input mesh
\param tolerance The threshold for vertex comparisons.
\return Mesh without redundant vertices. If you no longer need
the cloned mesh, you should call IMesh::drop(). See