5#ifndef NIRT_I_MESH_MANIPULATOR_HPP_INCLUDED
6#define NIRT_I_MESH_MANIPULATOR_HPP_INCLUDED
8#include <nirtcpp/core/engine/IReferenceCounted.hpp>
9#include <nirtcpp/core/engine/vector3d.hpp>
10#include <nirtcpp/core/engine/aabbox3d.hpp>
11#include <nirtcpp/core/engine/matrix4.hpp>
12#include <nirtcpp/core/engine/IAnimatedMesh.hpp>
13#include <nirtcpp/core/engine/IMeshBuffer.hpp>
14#include <nirtcpp/core/engine/SVertexManipulator.hpp>
76 bool angleWeighted =
false)
const=0;
83 bool smooth =
false,
bool angleWeighted =
false)
const=0;
93 bool angleWeighted=
false)
const=0;
103 bool angleWeighted=
false)
const=0;
162 if ( normalsUpdate == 1 )
171 if ( normalizeNormals )
190 if ( normalsUpdate == 1 )
199 if ( normalizeNormals )
234 f32 resolutionS,
f32 resolutionT,
246 f32 resolutionS,
f32 resolutionT,
376 template <
typename Functor>
379 return apply_(func, buffer, boundingBoxUpdate, func);
388 template <
typename Functor>
389 bool apply(
const Functor& func,
IMesh* mesh,
bool boundingBoxUpdate=
false)
const
398 if (boundingBoxUpdate)
406 if (boundingBoxUpdate)
418 template <
typename Functor>
448 if (boundingBoxUpdate)
456 if (boundingBoxUpdate)
Base class of most objects of the Nirtcpp Engine.
Definition IReferenceCounted.hpp:46
4x4 matrix. Mostly used as transformation matrix for 3d calculations.
Definition matrix4.hpp:49
CMatrix4< T > getTransposed() const
Gets transposed matrix.
Definition matrix4.hpp:2036
bool getInverse(CMatrix4< T > &out) const
Gets the inverse matrix of this one.
Definition matrix4.hpp:1404
void addInternalPoint(const vector3d< T > &p)
Adds a point to the bounding box.
Definition aabbox3d.hpp:74
void addInternalBox(const aabbox3d< T > &b)
Adds another bounding box.
Definition aabbox3d.hpp:82
void reset(T x, T y, T z)
Resets the bounding box to a one-point box.
Definition aabbox3d.hpp:50
Interface for an animated mesh.
Definition IAnimatedMesh.hpp:21
Class for holding a mesh with a single material.
Definition IMeshBuffer.hpp:41
virtual u32 getVertexCount() const =0
Get amount of vertices in meshbuffer.
virtual void setBoundingBox(const core::aabbox3df &box)=0
Set axis aligned bounding box.
virtual const core::vector3df & getPosition(u32 i) const =0
returns position of vertex i
virtual const core::aabbox3df & getBoundingBox() const =0
Get the axis aligned bounding box of this meshbuffer.
virtual video::E_VERTEX_TYPE getVertexType() const =0
Get type of vertex data which is stored in this meshbuffer.
virtual const void * getVertices() const =0
Get access to vertex data. The data is an array of vertices.
An interface for easy manipulation of meshes.
Definition IMeshManipulator.hpp:30
void setVertexColorAlpha(IMeshBuffer *buffer, s32 alpha) const
Sets the alpha vertex color value of the whole mesh to a new value.
Definition IMeshManipulator.hpp:50
bool apply_(const Functor &func, IMeshBuffer *buffer, bool boundingBoxUpdate, const IVertexManipulator &typeTest) const
Apply a manipulator based on the type of the functor.
Definition IMeshManipulator.hpp:419
virtual s32 getPolyCount(IAnimatedMesh *mesh) const =0
Get amount of polygons in mesh.
void scale(IMeshBuffer *buffer, const core::vector3df &factor) const
Scales the actual meshbuffer, not a scene node.
Definition IMeshManipulator.hpp:120
virtual IMesh * createMeshWith2TCoords(IMesh *mesh) const =0
Creates a copy of the mesh, which will only consist of S3DVertex2TCoord vertices.
virtual IMesh * createMeshUniquePrimitives(IMesh *mesh) const =0
Creates a copy of a mesh with all vertices unwelded.
void transform(IMesh *mesh, const core::matrix4 &m, u32 normalsUpdate=0, bool normalizeNormals=false) const
Applies a transformation to a mesh.
Definition IMeshManipulator.hpp:158
bool apply(const Functor &func, IMeshBuffer *buffer, bool boundingBoxUpdate=false) const
Apply a manipulator on the Meshbuffer.
Definition IMeshManipulator.hpp:377
virtual void recalculateTangents(IMesh *mesh, bool recalculateNormals=false, bool smooth=false, bool angleWeighted=false) const =0
Recalculates tangents, requires a tangent mesh.
NIRT_DEPRECATED void scaleMesh(IMesh *mesh, const core::vector3df &factor) const
Scales the actual mesh, not a scene node.
Definition IMeshManipulator.hpp:129
void setVertexColors(IMesh *mesh, video::SColor color) const
Sets the colors of all vertices to one color.
Definition IMeshManipulator.hpp:58
virtual void heightmapOptimizeMesh(IMesh *const mesh, const f32 tolerance=core::ROUNDING_ERROR_f32) const =0
Optimize the mesh with an algorithm tuned for heightmaps.
void scaleTCoords(scene::IMesh *mesh, const core::vector2df &factor, u32 level=1) const
Scale the texture coords of a mesh.
Definition IMeshManipulator.hpp:135
virtual IMesh * createMeshWelded(IMesh *mesh, f32 tolerance=core::ROUNDING_ERROR_f32) const =0
Creates a copy of a mesh with vertices welded.
virtual SMesh * createMeshCopy(IMesh *mesh) const =0
Clones a static IMesh into a modifiable SMesh.
virtual IMesh * createForsythOptimizedMesh(const IMesh *mesh) const =0
Vertex cache optimization according to the Forsyth paper.
virtual void makePlanarTextureMapping(scene::IMesh *mesh, f32 resolutionS, f32 resolutionT, u8 axis, const core::vector3df &offset) const =0
Creates a planar texture mapping on the buffer.
virtual void recalculateTangents(IMeshBuffer *buffer, bool recalculateNormals=false, bool smooth=false, bool angleWeighted=false) const =0
Recalculates tangents, requires a tangent mesh buffer.
void setVertexColorAlpha(IMesh *mesh, s32 alpha) const
Sets the alpha vertex color value of the whole mesh to a new value.
Definition IMeshManipulator.hpp:42
virtual void makePlanarTextureMapping(scene::IMeshBuffer *meshbuffer, f32 resolution=0.001f) const =0
Creates a planar texture mapping on the meshbuffer.
void scaleTCoords(scene::IMeshBuffer *buffer, const core::vector2df &factor, u32 level=1) const
Scale the texture coords of a meshbuffer.
Definition IMeshManipulator.hpp:144
virtual NIRT_DEPRECATED void transformMesh(IMesh *mesh, const core::matrix4 &m) const
Applies a transformation to a mesh.
Definition IMeshManipulator.hpp:209
void setVertexColors(IMeshBuffer *buffer, video::SColor color) const
Sets the colors of all vertices to one color.
Definition IMeshManipulator.hpp:66
virtual void recalculateNormals(IMesh *mesh, bool smooth=false, bool angleWeighted=false) const =0
Recalculates all normals of the mesh.
virtual void flipSurfaces(IMesh *mesh) const =0
Flips the direction of surfaces.
virtual void makePlanarTextureMapping(scene::IMeshBuffer *buffer, f32 resolutionS, f32 resolutionT, u8 axis, const core::vector3df &offset) const =0
Creates a planar texture mapping on the meshbuffer.
virtual IMesh * createMeshWithTangents(IMesh *mesh, bool recalculateNormals=false, bool smooth=false, bool angleWeighted=false, bool recalculateTangents=true) const =0
Creates a copy of the mesh, which will only consist of S3DVertexTangents vertices.
virtual s32 getPolyCount(IMesh *mesh) const =0
Get amount of polygons in mesh.
virtual void recalculateNormals(IMeshBuffer *buffer, bool smooth=false, bool angleWeighted=false) const =0
Recalculates all normals of the mesh buffer.
bool apply(const Functor &func, IMesh *mesh, bool boundingBoxUpdate=false) const
Apply a manipulator on the Mesh.
Definition IMeshManipulator.hpp:389
void transform(IMeshBuffer *buffer, const core::matrix4 &m, u32 normalsUpdate=0, bool normalizeNormals=false) const
Applies a transformation to a meshbuffer.
Definition IMeshManipulator.hpp:186
void scale(IMesh *mesh, const core::vector3df &factor) const
Scales the actual mesh, not a scene node.
Definition IMeshManipulator.hpp:110
virtual IAnimatedMesh * createAnimatedMesh(IMesh *mesh, scene::E_ANIMATED_MESH_TYPE type=scene::EAMT_UNKNOWN) const =0
Create a new AnimatedMesh and adds the mesh to it.
virtual void heightmapOptimizeMesh(IMeshBuffer *const mb, const f32 tolerance=core::ROUNDING_ERROR_f32) const =0
Optimize the meshbuffer with an algorithm tuned for heightmaps.
virtual void makePlanarTextureMapping(IMesh *mesh, f32 resolution=0.001f) const =0
Creates a planar texture mapping on the mesh.
virtual IMesh * createMeshWith1TCoords(IMesh *mesh) const =0
Creates a copy of the mesh, which will only consist of S3DVertex vertices.
Class which holds the geometry of an object.
Definition IMesh.hpp:72
virtual void setBoundingBox(const core::aabbox3df &box)=0
Set user-defined axis aligned bounding box.
virtual u32 getMeshBufferCount() const =0
Get the amount of mesh buffers.
virtual IMeshBuffer * getMeshBuffer(u32 nr) const =0
Get pointer to a mesh buffer.
Interface for vertex manipulators.
Definition SVertexManipulator.hpp:25
Simple implementation of the IMesh interface.
Definition SMesh.hpp:19
Vertex manipulator to set the alpha value of the vertex color to a fixed value.
Definition SVertexManipulator.hpp:41
Vertex manipulator to set color to a fixed color for all vertices.
Definition SVertexManipulator.hpp:29
Vertex manipulator which transforms the normal of the vertex with the rotate/scale part of the given ...
Definition SVertexManipulator.hpp:282
Vertex manipulator which normalizes the normal of the vertex.
Definition SVertexManipulator.hpp:296
Vertex manipulator which scales the position of the vertex.
Definition SVertexManipulator.hpp:223
Vertex manipulator which scales the TCoords of the vertex.
Definition SVertexManipulator.hpp:308
Vertex with two texture coordinates.
Definition S3DVertex.hpp:116
Vertex with a tangent and binormal vector.
Definition S3DVertex.hpp:199
standard vertex used by the Nirtcpp engine.
Definition S3DVertex.hpp:45
Class representing a 32 bit ARGB color.
Definition SColor.hpp:317
E_ANIMATED_MESH_TYPE
Possible types of meshes.
Definition IMesh.hpp:20
@ EAMT_UNKNOWN
Unknown animated mesh type.
Definition IMesh.hpp:22
@ EVT_2TCOORDS
Vertex with two texture coordinates, video::S3DVertex2TCoords.
Definition S3DVertex.hpp:25
@ EVT_STANDARD
Standard vertex type used by the Nirtcpp engine, video::S3DVertex.
Definition S3DVertex.hpp:21
@ EVT_TANGENTS
Vertex with a tangent and binormal vector, video::S3DVertexTangents.
Definition S3DVertex.hpp:31
As of Nirtcpp 1.6, position2d is a synonym for vector2d.
Definition vector3d.hpp:11
signed int s32
32 bit signed variable.
Definition irrTypes.hpp:72
unsigned char u8
8 bit unsigned variable.
Definition irrTypes.hpp:24
unsigned int u32
32 bit unsigned variable.
Definition irrTypes.hpp:64
float f32
32 bit floating point variable.
Definition irrTypes.hpp:110