3DCoat  3D-COAT 4.9.xx
3DCoat is the one application that has all the tools you need to take your 3D idea from a block of digital clay all the way to a production ready, fully textured organic or hard surface model.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
comms::cMeshContainer Class Reference

General class for work with mesh. More...

#include <SAMesh.h>

Classes

struct  PlaneArgs
 See GenPlane. More...
 

Public Member Functions

 cMeshContainer ()
 
 cMeshContainer (const figures_t &, float fusionDistance)
 Build a correct mesh by set of figures. More...
 
bool IsValid (const bool ShowWarning=false) const
 
bool IsValidRawSequence () const
 Verify the error (from Blender by import OBJ): "the same vertex of face used multiple times". More...
 
const cVec3GetPosition (int vertex) const
 
int GetVertex (const cVec3 &) const
 
const VecArray & GetNormals () const
 
const cVec3GetNormal (int vertex) const
 
cList< int > GetNeighboursForFace (int beginRawFigure, cVec3 *avgNormal=NULL, cVec3 *avgCenter=NULL) const
 
bool Contains (const cVec3 &) const
 
bool Contains (const cVec3 &a, const cVec3 &b) const
 
bool Contains (const VecArray &figure) const
 
void InvertRaw ()
 
template<bool withErase>
::std::pair< cVec3, cVec3Divide (int a, int b, float tAB, int c, int d, float tCD, int *beginRemovedRawBlock=NULL, int *sizeRemovedRawBlock=NULL,::std::pair< int, int > *changedBeginRawBlock=NULL)
 Divide a figure on two parts with declared line. More...
 
template<bool withErase>
void Divide (int a, int b, const cVec3 &m, int c, int d, const cVec3 &n, int *beginRemovedRawBlock=NULL, int *sizeRemovedRawBlock=NULL,::std::pair< int, int > *changedBeginRawBlock=NULL)
 
void Erase (int beginRawFigure, bool withOptimize=false)
 Remove a point / line / polygon (represent as raw-block) from this mesh. More...
 
void EraseByCount (int n)
 Remove raw-blocks which a count of vertices is equal n. More...
 
void EraseByCount (int a, int b)
 Remove raw-blocks which a count of vertices in the diapason [a; b]. More...
 
void EraseClearConfluent (float tolerance)
 Remove figures which all vertices are confluent to line. More...
 
void EraseClearConfluentByIndexOnly ()
 Verify only indices of vertices. More...
 
void Invert (int beginRawFigure)
 Invert a figure. More...
 
cList< int > Find (const cVec3 &nodeCoord) const
 
cList< int > Find (const edgeI_t &, const edgeI_t &) const
 
int Find (const VecArray &figure) const
 
cList< int > FindClearConfluent (float tolerance) const
 
void CorrectFaces (int beginRawBlockEtalon, uni_hash< bool, int > *fixed=NULL)
 Fixed a direction for every face by neighbours. More...
 
void CorrectRawSequence ()
 Fixed the error (from Blender by import OBJ): "the same vertex of face used multiple times". More...
 
void MergeFaces (float fusionDistance)
 Merge faces of mesh which side by side. More...
 
int Insert (int a, int b, float t, cList< int > *beginRawFigures=NULL, cList< int > *beginRawForRemoved=NULL)
 Insert vertext on the line 'ab' (as verticies). More...
 
int Insert (int a, int b, const cVec3 &m, cList< int > *beginRawFigures=NULL, cList< int > *beginRawForRemoved=NULL)
 
void Insert (const figureI_t &, int *beginRawFigure=NULL)
 Insert a figure (index of verticies) into the mesh. More...
 
figureI_t Insert (int a, int *beginRawFigure=NULL)
 Insert a point. More...
 
figureI_t Insert (int a, int b, int *beginRawFigure=NULL)
 Insert a line. More...
 
figureI_t Insert (int a, int b, int c, int *beginRawFigure=NULL)
 Insert a triangle. More...
 
figureI_t Insert (int a, int b, int c, int d, int *beginRawFigure=NULL)
 Insert a polygon with 4 vertices. More...
 
void Insert (const figures_t &, float fusionDistance=-FLT_MAX)
 Insert a set of figures (positions of verticies) into the mesh. More...
 
void Insert (const figure_t &, figureI_t *=NULL)
 Insert a figure (positions of verticies) into the mesh. More...
 
figure_t Insert (const cVec3 &a, int *ai=NULL)
 Insert a point. More...
 
figure_t Insert (const cVec3 &a, const cVec3 &b, int *ai=NULL, int *bi=NULL)
 Insert a line. More...
 
figure_t Insert (const cVec3 &a, const cVec3 &b, const cVec3 &c, int *ai=NULL, int *bi=NULL, int *ci=NULL)
 Insert a triangle. More...
 
figure_t Insert (const cVec3 &a, const cVec3 &b, const cVec3 &c, const cVec3 &d, int *ai=NULL, int *bi=NULL, int *ci=NULL, int *di=NULL)
 Insert a polygon with 4 vertices. More...
 
void Insert (const cMeshContainer &)
 Insert a mesh to this mesh. More...
 
bool IsClearConfluent (const figure_t &, float tolerance) const
 
bool IsClearConfluentByIndexOnly (int beginRawFigure) const
 Verify only indices of vertices. More...
 
bool IsClockwiseOrder (int beginRawFigure, const cVec3 &observer) const
 
bool PerformBooleanOp (cMeshContainer &src1, cMeshContainer &src2, int operation, cList< ::std::pair< comms::cVec3, comms::cVec3 > > *dividers=NULL)
 Build mesh from 'src1' and 'src2' to 'this'. More...
 
void QuadQuantSubd (const cMat4 &M, float quant, float dotp,::std::function< int(int, int)> *divider=nullptr)
 Try to divide all quads in approx equal sub-quads. More...
 
void TriSubd (int N, SubdSnapEdgeCallback *dive=NULL, SubdSnapMiddlePointCallback *divm=NULL, void *context=NULL)
 Divide triangular mesh on N^2 triangles. More...
 
StaticMesh * CreateStaticMesh ()
 Creation for rendering. More...
 
StaticMesh * CreateStaticMeshMC ()
 Create mesh with smoothed normals and mcubes - like shader. More...
 
StaticMesh * CreateStaticMeshMC_Shell (float In, float Out)
 
StaticMesh * CreateHardsurfaceStaticMesh ()
 Create faceted mesh. Shader mpreview1 used. More...
 
StaticMesh * CreateStaticMeshUV ()
 Create mstatic mesh with UV, skypreview shader used. More...
 
cVec3 GetFaceCoord (int pos) const
 
void DrawDbg (const cMat4 &T, comms::dword Color, comms::dword FillColor=0, comms::dword DetailColor=0)
 
void DbgDrawMeshWithUVGrid ()
 use this function within __thumbnail(...) section to visualuse mesh with UV, seek "__thumbnail(test1)" as example. More...
 
void PatchedDivision (int dstTris, bool uniform, bool Flat=false)
 
void PickObjectEdges (cSeg &Ray, const cMat4 &M, cVec3 &RayPt, cVec3 &ObjPt)
 returns (xyz = nearest_edge_point_pos,w = distance_from_the_ray) More...
 
void DivideMesh (MeshDivider< int > &) const
 Divide the mesh on two meshes (harvest vertices). More...
 
bool FlipEdge (int V1, int V2, int *valence=NULL)
 flip edge, requires fone, requires 2 faces over the edge. More...
 
bool OptimizeTriangularMesh ()
 tries to set valence 6 whenever possible unsing edge-flip More...
 
cVec3 GetFaceNormalByNubmer (int indx)
 Max indx can Get by GetPolyCount() see GetFaceNormal(int pos) More...
 
 cMeshContainer ()
 
 cMeshContainer (const figures_t &, float fusionDistance)
 Build a correct mesh by set of figures. More...
 
bool IsValid (const bool ShowWarning=false) const
 
bool IsValidRawSequence () const
 Verify the error (from Blender by import OBJ): "the same vertex of face used multiple times". More...
 
const cVec3GetPosition (int vertex) const
 
int GetVertex (const cVec3 &) const
 
const VecArray & GetNormals () const
 
const cVec3GetNormal (int vertex) const
 
cList< int > GetNeighboursForFace (int beginRawFigure, cVec3 *avgNormal=NULL, cVec3 *avgCenter=NULL) const
 
bool Contains (const cVec3 &) const
 
bool Contains (const cVec3 &a, const cVec3 &b) const
 
bool Contains (const VecArray &figure) const
 
void InvertRaw ()
 
template<bool withErase>
::std::pair< cVec3, cVec3Divide (int a, int b, float tAB, int c, int d, float tCD, int *beginRemovedRawBlock=NULL, int *sizeRemovedRawBlock=NULL,::std::pair< int, int > *changedBeginRawBlock=NULL)
 Divide a figure on two parts with declared line. More...
 
template<bool withErase>
void Divide (int a, int b, const cVec3 &m, int c, int d, const cVec3 &n, int *beginRemovedRawBlock=NULL, int *sizeRemovedRawBlock=NULL,::std::pair< int, int > *changedBeginRawBlock=NULL)
 
void Erase (int beginRawFigure, bool withOptimize=false)
 Remove a point / line / polygon (represent as raw-block) from this mesh. More...
 
void EraseByCount (int n)
 Remove raw-blocks which a count of vertices is equal n. More...
 
void EraseByCount (int a, int b)
 Remove raw-blocks which a count of vertices in the diapason [a; b]. More...
 
void EraseClearConfluent (float tolerance)
 Remove figures which all vertices are confluent to line. More...
 
void EraseClearConfluentByIndexOnly ()
 Verify only indices of vertices. More...
 
void Invert (int beginRawFigure)
 Invert a figure. More...
 
cList< int > Find (const cVec3 &nodeCoord) const
 
cList< int > Find (const edgeI_t &, const edgeI_t &) const
 
int Find (const VecArray &figure) const
 
cList< int > FindClearConfluent (float tolerance) const
 
void CorrectFaces (int beginRawBlockEtalon, uni_hash< bool, int > *fixed=NULL)
 Fixed a direction for every face by neighbours. More...
 
void CorrectRawSequence ()
 Fixed the error (from Blender by import OBJ): "the same vertex of face used multiple times". More...
 
void MergeFaces (float fusionDistance)
 Merge faces of mesh which side by side. More...
 
int Insert (int a, int b, float t, cList< int > *beginRawFigures=NULL, cList< int > *beginRawForRemoved=NULL)
 Insert vertext on the line 'ab' (as verticies). More...
 
int Insert (int a, int b, const cVec3 &m, cList< int > *beginRawFigures=NULL, cList< int > *beginRawForRemoved=NULL)
 
void Insert (const figureI_t &, int *beginRawFigure=NULL)
 Insert a figure (index of verticies) into the mesh. More...
 
figureI_t Insert (int a, int *beginRawFigure=NULL)
 Insert a point. More...
 
figureI_t Insert (int a, int b, int *beginRawFigure=NULL)
 Insert a line. More...
 
figureI_t Insert (int a, int b, int c, int *beginRawFigure=NULL)
 Insert a triangle. More...
 
figureI_t Insert (int a, int b, int c, int d, int *beginRawFigure=NULL)
 Insert a polygon with 4 vertices. More...
 
void Insert (const figures_t &, float fusionDistance=-FLT_MAX)
 Insert a set of figures (positions of verticies) into the mesh. More...
 
void Insert (const figure_t &, figureI_t *=NULL)
 Insert a figure (positions of verticies) into the mesh. More...
 
figure_t Insert (const cVec3 &a, int *ai=NULL)
 Insert a point. More...
 
figure_t Insert (const cVec3 &a, const cVec3 &b, int *ai=NULL, int *bi=NULL)
 Insert a line. More...
 
figure_t Insert (const cVec3 &a, const cVec3 &b, const cVec3 &c, int *ai=NULL, int *bi=NULL, int *ci=NULL)
 Insert a triangle. More...
 
figure_t Insert (const cVec3 &a, const cVec3 &b, const cVec3 &c, const cVec3 &d, int *ai=NULL, int *bi=NULL, int *ci=NULL, int *di=NULL)
 Insert a polygon with 4 vertices. More...
 
void Insert (const cMeshContainer &)
 Insert a mesh to this mesh. More...
 
bool IsClearConfluent (const figure_t &, float tolerance) const
 
bool IsClearConfluentByIndexOnly (int beginRawFigure) const
 Verify only indices of vertices. More...
 
bool IsClockwiseOrder (int beginRawFigure, const cVec3 &observer) const
 
bool PerformBooleanOp (cMeshContainer &src1, cMeshContainer &src2, int operation, cList< ::std::pair< comms::cVec3, comms::cVec3 > > *dividers=NULL)
 Build mesh from 'src1' and 'src2' to 'this'. More...
 
void QuadQuantSubd (const cMat4 &M, float quant, float dotp,::std::function< int(int, int)> *divider=nullptr)
 Try to divide all quads in approx equal sub-quads. More...
 
void TriSubd (int N, SubdSnapEdgeCallback *dive=NULL, SubdSnapMiddlePointCallback *divm=NULL, void *context=NULL)
 Divide triangular mesh on N^2 triangles. More...
 
StaticMesh * CreateStaticMesh ()
 Creation for rendering. More...
 
StaticMesh * CreateStaticMeshMC ()
 Create mesh with smoothed normals and mcubes - like shader. More...
 
StaticMesh * CreateHardsurfaceStaticMesh ()
 Create faceted mesh. Shader mpreview1 used. More...
 
StaticMesh * CreateStaticMeshUV ()
 Create mstatic mesh with UV, skypreview shader used. More...
 
cVec3 GetFaceCoord (int pos) const
 
void DrawDbg (const cMat4 &T, DWORD Color, DWORD FillColor=0, DWORD DetailColor=0)
 
void DbgDrawMeshWithUVGrid ()
 use this function within __thumbnail(...) section to visualuse mesh with UV, seek "__thumbnail(test1)" as example. More...
 
void PickObjectEdges (cSeg &Ray, const cMat4 &M, cVec3 &RayPt, cVec3 &ObjPt)
 returns (xyz = nearest_edge_point_pos,w = distance_from_the_ray) More...
 
void DivideMesh (MeshDivider< int > &) const
 Divide the mesh on two meshes (harvest vertices). More...
 
bool FlipEdge (int V1, int V2, int *valence=NULL)
 flip edge, requires fone, requires 2 faces over the edge. More...
 
bool OptimizeTriangularMesh ()
 tries to set valence 6 whenever possible unsing edge-flip More...
 
cVec3 GetFaceNormalByNubmer (int indx)
 Max indx can Get by GetPolyCount() see GetFaceNormal(int pos) More...
 

Protected Attributes

cList< cVec< cVec3, 2 > > m_Tangents
 Tangent and BiTangent. More...
 
RawArray m_Raw
 
cList< comms::dword > m_VertexSpecular
 RGB - specular color, A - glossness. More...
 
cList< DWORD > m_VertexSpecular
 RGB - specular color, A - glossness. More...
 

Detailed Description

General class for work with mesh.

Constructor & Destructor Documentation

cMeshContainer::cMeshContainer ( )
Warning
Call CreateDefaultObjMtl() manually for create a defaul object and material.
cMeshContainer::cMeshContainer ( const figures_t figures,
float  fusionDistance 
)

Build a correct mesh by set of figures.

Parameters
fusionDistanceSee MergeFaces() for details.
See Also
Insert( figures_t )Edge

References Insert().

comms::cMeshContainer::cMeshContainer ( )
Warning
Call CreateDefaultObjMtl() manually for create a defaul object and material.
comms::cMeshContainer::cMeshContainer ( const figures_t ,
float  fusionDistance 
)

Build a correct mesh by set of figures.

Parameters
fusionDistanceSee MergeFaces() for details.
See Also
Insert( figures_t )Edge

Member Function Documentation

bool cMeshContainer::Contains ( const cVec3 a) const
Returns
Point has in the mesh.

References Find().

bool comms::cMeshContainer::Contains ( const cVec3 ) const
Returns
Point has in the mesh.
bool cMeshContainer::Contains ( const cVec3 a,
const cVec3 b 
) const
Returns
Edge ab has in the mesh.

References Find().

bool comms::cMeshContainer::Contains ( const cVec3 a,
const cVec3 b 
) const
Returns
Edge ab has in the mesh.
bool cMeshContainer::Contains ( const VecArray &  figure) const
Returns
Figure has in the mesh. Verify by one direction only.

References Find().

bool comms::cMeshContainer::Contains ( const VecArray &  figure) const
Returns
Figure has in the mesh. Verify by one direction only.
void comms::cMeshContainer::CorrectFaces ( int  beginRawBlockEtalon,
uni_hash< bool, int > *  fixed = NULL 
)

Fixed a direction for every face by neighbours.

Returns
True, when any faces was corrected.
Parameters
beginRawBlockEtalonStart of block for faces which was as etalon for "direction of all other face".
fixedList of 'beginRawFigure' when already fixed.
void cMeshContainer::CorrectFaces ( int  beginRawBlockEtalon,
uni_hash< bool, int > *  fixed = NULL 
)

Fixed a direction for every face by neighbours.

Returns
True, when any faces was corrected.
Parameters
beginRawBlockEtalonStart of block for faces which was as etalon for "direction of all other face".
fixedList of 'beginRawFigure' when already fixed.

References Find(), and Invert().

void comms::cMeshContainer::CorrectRawSequence ( )

Fixed the error (from Blender by import OBJ): "the same vertex of face used multiple times".

See Also
cMeshContainerTest::CorrectRawSequence*()
IsValidRawSequence()
void cMeshContainer::CorrectRawSequence ( )

Fixed the error (from Blender by import OBJ): "the same vertex of face used multiple times".

See Also
cMeshContainerTest::CorrectRawSequence*()
IsValidRawSequence()

Referenced by MergeFaces().

StaticMesh * cMeshContainer::CreateHardsurfaceStaticMesh ( )

Create faceted mesh. Shader mpreview1 used.

References GetNormals().

StaticMesh* comms::cMeshContainer::CreateHardsurfaceStaticMesh ( )

Create faceted mesh. Shader mpreview1 used.

StaticMesh * cMeshContainer::CreateStaticMesh ( )

Creation for rendering.

Create mesh with smoothed normals. Shader mpreview1 used.

References GetNormals().

Referenced by ModelPreview::SetModel().

StaticMesh* comms::cMeshContainer::CreateStaticMesh ( )

Creation for rendering.

Create mesh with smoothed normals. Shader mpreview1 used.

StaticMesh * cMeshContainer::CreateStaticMeshMC ( )

Create mesh with smoothed normals and mcubes - like shader.

References GetNormals().

StaticMesh* comms::cMeshContainer::CreateStaticMeshMC ( )

Create mesh with smoothed normals and mcubes - like shader.

StaticMesh * cMeshContainer::CreateStaticMeshMC_Shell ( float  In,
float  Out 
)

edges

References GetNormals().

StaticMesh * cMeshContainer::CreateStaticMeshUV ( )

Create mstatic mesh with UV, skypreview shader used.

References GetNormals().

Referenced by DbgDrawMeshWithUVGrid().

StaticMesh* comms::cMeshContainer::CreateStaticMeshUV ( )

Create mstatic mesh with UV, skypreview shader used.

void cMeshContainer::DbgDrawMeshWithUVGrid ( )

use this function within __thumbnail(...) section to visualuse mesh with UV, seek "__thumbnail(test1)" as example.

References CreateStaticMeshUV().

void comms::cMeshContainer::DbgDrawMeshWithUVGrid ( )

use this function within __thumbnail(...) section to visualuse mesh with UV, seek "__thumbnail(test1)" as example.

template<bool withErase>
::std::pair< cVec3, cVec3 > comms::cMeshContainer::Divide ( int  a,
int  b,
float  tAB,
int  c,
int  d,
float  tCD,
int *  beginRemovedRawBlock = NULL,
int *  sizeRemovedRawBlock = NULL,
::std::pair< int, int > *  changedBeginRawBlock = NULL 
)

Divide a figure on two parts with declared line.

Returns
Coords for found points.
Template Parameters
withEraseTrue, when need delete a figure which divided.
Parameters
a,b,c,dVertices of figure.
tAB,tCDNeppers of new vertices on the edges ab and cd.

When ab, cd are not of part of 1 (one!) figure, exception is throw.

template<bool withErase>
template::std::pair< cVec3, cVec3 > cMeshContainer::Divide< false > ( int  a,
int  b,
float  tAB,
int  c,
int  d,
float  tCD,
int *  beginRemovedRawBlock = NULL,
int *  sizeRemovedRawBlock = NULL,
::std::pair< int, int > *  changedBeginRawBlock = NULL 
)

Divide a figure on two parts with declared line.

Returns
Coords for found points.
Template Parameters
withEraseTrue, when need delete a figure which divided.
Parameters
a,b,c,dVertices of figure.
tAB,tCDNeppers of new vertices on the edges ab and cd.

When ab, cd are not of part of 1 (one!) figure, exception is throw.

template<bool withErase>
template void cMeshContainer::Divide< false > ( int  a,
int  b,
const cVec3 m,
int  c,
int  d,
const cVec3 n,
int *  beginRemovedRawBlock = NULL,
int *  sizeRemovedRawBlock = NULL,
::std::pair< int, int > *  changedBeginRawBlock = NULL 
)
Parameters
mPoint for insert between points ab.
nPoint for insert between points cd.

References Erase(), Find(), GetVertex(), and Insert().

template<bool withErase>
void comms::cMeshContainer::Divide ( int  a,
int  b,
const cVec3 m,
int  c,
int  d,
const cVec3 n,
int *  beginRemovedRawBlock = NULL,
int *  sizeRemovedRawBlock = NULL,
::std::pair< int, int > *  changedBeginRawBlock = NULL 
)
Parameters
mPoint for insert between points ab.
nPoint for insert between points cd.
void cMeshContainer::DivideMesh ( MeshDivider< int > &  divider) const

Divide the mesh on two meshes (harvest vertices).

References GetVertex().

void comms::cMeshContainer::DivideMesh ( MeshDivider< int > &  ) const

Divide the mesh on two meshes (harvest vertices).

void comms::cMeshContainer::DrawDbg ( const cMat4 T,
comms::dword  Color,
comms::dword  FillColor = 0,
comms::dword  DetailColor = 0 
)
Warning
If mesh is not triangulated when DrawDbg() is incorrect.

Referenced by QuadrangulationParams::Quadrangulate().

void cMeshContainer::DrawDbg ( const cMat4 T,
DWORD  Color,
DWORD  FillColor = 0,
DWORD  DetailColor = 0 
)
Warning
If mesh is not triangulated when DrawDbg() is incorrect.

References GetFaceCoord().

void cMeshContainer::Erase ( int  beginRawFigure,
bool  withOptimize = false 
)

Remove a point / line / polygon (represent as raw-block) from this mesh.

Parameters
beginRawFigureStart position of block in the GetRaw().
withOptimizeUnused coords of the mesh removed from the GetPositions().
See Also
Find() For example
Erase( Find( a, b ).GetFirst() );

Referenced by Divide(), EraseClearConfluent(), and EraseClearConfluentByIndexOnly().

void comms::cMeshContainer::Erase ( int  beginRawFigure,
bool  withOptimize = false 
)

Remove a point / line / polygon (represent as raw-block) from this mesh.

Parameters
beginRawFigureStart position of block in the GetRaw().
withOptimizeUnused coords of the mesh removed from the GetPositions().
See Also
Find() For example
Erase( Find( a, b ).GetFirst() );
void comms::cMeshContainer::EraseByCount ( int  n)

Remove raw-blocks which a count of vertices is equal n.

void cMeshContainer::EraseByCount ( int  n)

Remove raw-blocks which a count of vertices is equal n.

Referenced by MergeFaces().

void comms::cMeshContainer::EraseByCount ( int  a,
int  b 
)

Remove raw-blocks which a count of vertices in the diapason [a; b].

void cMeshContainer::EraseByCount ( int  a,
int  b 
)

Remove raw-blocks which a count of vertices in the diapason [a; b].

void comms::cMeshContainer::EraseClearConfluent ( float  tolerance)

Remove figures which all vertices are confluent to line.

See Also
FindClearConfluent()
void cMeshContainer::EraseClearConfluent ( float  tolerance)

Remove figures which all vertices are confluent to line.

See Also
FindClearConfluent()

References Erase(), and IsClearConfluent().

Referenced by MergeFaces().

void comms::cMeshContainer::EraseClearConfluentByIndexOnly ( )

Verify only indices of vertices.

void cMeshContainer::EraseClearConfluentByIndexOnly ( )

Verify only indices of vertices.

References Erase(), and IsClearConfluentByIndexOnly().

cList< int > comms::cMeshContainer::Find ( const cVec3 nodeCoord) const
Returns
Shifts in the GetRaw() of this mesh. This pointer consist of declared node or edge.
If node or edge is not found, when return an empty list.
See Also
GetNeighboursForFace(), Erase()
cList< int > cMeshContainer::Find ( const cVec3 nodeCoord) const
Returns
Shifts in the GetRaw() of this mesh. This pointer consist of declared node or edge.
If node or edge is not found, when return an empty list.
See Also
GetNeighboursForFace(), Erase()

References GetVertex().

Referenced by Contains(), CorrectFaces(), Divide(), Find(), GetNeighboursForFace(), and IsClearConfluent().

cList< int > comms::cMeshContainer::Find ( const edgeI_t ,
const edgeI_t  
) const
Warning
All defined edges must be parts of figure.
cList< int > cMeshContainer::Find ( const edgeI_t ea,
const edgeI_t eb 
) const
Warning
All defined edges must be parts of figure.
int comms::cMeshContainer::Find ( const VecArray &  figure) const
Returns
See cList< int > Find(). If node or edge is not found, when return -1.
int cMeshContainer::Find ( const VecArray &  figure) const
Returns
See cList< int > Find(). If node or edge is not found, when return -1.

References Find(), and GetVertex().

cList< int > comms::cMeshContainer::FindClearConfluent ( float  tolerance) const
Returns
List of raw-blocks which contains all fantom-figures (all vertices are confluent to line).
Parameters
toleranceValue at angle for include a figure.
Warning
All lines and points are confluent figure.
See Also
EraseClearConfluent()
cList< int > cMeshContainer::FindClearConfluent ( float  tolerance) const
Returns
List of raw-blocks which contains all fantom-figures (all vertices are confluent to line).
Parameters
toleranceValue at angle for include a figure.
Warning
All lines and points are confluent figure.
See Also
EraseClearConfluent()

References IsClearConfluent().

bool cMeshContainer::FlipEdge ( int  V1,
int  V2,
int *  valence = NULL 
)

flip edge, requires fone, requires 2 faces over the edge.

Referenced by OptimizeTriangularMesh().

bool comms::cMeshContainer::FlipEdge ( int  V1,
int  V2,
int *  valence = NULL 
)

flip edge, requires fone, requires 2 faces over the edge.

cVec3 cMeshContainer::GetFaceCoord ( int  pos) const
See Also
GetNormal()

Referenced by DrawDbg(), and GetNeighboursForFace().

cVec3 comms::cMeshContainer::GetFaceCoord ( int  pos) const
See Also
GetNormal()
cVec3 cMeshContainer::GetFaceNormalByNubmer ( int  indx)

Max indx can Get by GetPolyCount() see GetFaceNormal(int pos)

cVec3 comms::cMeshContainer::GetFaceNormalByNubmer ( int  indx)

Max indx can Get by GetPolyCount() see GetFaceNormal(int pos)

cList< int > cMeshContainer::GetNeighboursForFace ( int  beginRawFigure,
cVec3 avgNormal = NULL,
cVec3 avgCenter = NULL 
) const
Returns
List of 'begin raw block' which blocks be adjacent to 'beginRawFigure'.
Also returns average normal and coord of center of neighbours of face.
See Also
Find()

References Find(), GetFaceCoord(), and m_Raw.

cList< int > comms::cMeshContainer::GetNeighboursForFace ( int  beginRawFigure,
cVec3 avgNormal = NULL,
cVec3 avgCenter = NULL 
) const
Returns
List of 'begin raw block' which blocks be adjacent to 'beginRawFigure'.
Also returns average normal and coord of center of neighbours of face.
See Also
Find()
const cVec3& comms::cMeshContainer::GetNormal ( int  vertex) const
Returns
Normal by vertex (index of normal).
Warning
Use CalcNormals() for correct result.
See Also
GetFaceNormal(), GetFaceCoord()
const cVec3 & cMeshContainer::GetNormal ( int  vertex) const
Returns
Normal by vertex (index of normal).
Warning
Use CalcNormals() for correct result.
See Also
GetFaceNormal(), GetFaceCoord()
const VecArray& comms::cMeshContainer::GetNormals ( ) const
inline
See Also
GetNormal(), GetFaceNormal(), GetFaceCoord()
const cVec3 & cMeshContainer::GetPosition ( int  vertex) const
Returns
Coord (position) by vertex (index of position).

First vertex of mesh is 0.

See Also
GetVertex()

Referenced by TriPatch::CalculatePatch(), tMiniMesh::frommc(), Insert(), and QuadrangulationParams::Quadrangulate().

const cVec3& comms::cMeshContainer::GetPosition ( int  vertex) const
Returns
Coord (position) by vertex (index of position).

First vertex of mesh is 0.

See Also
GetVertex()
int cMeshContainer::GetVertex ( const cVec3 c) const
Returns
Vertex (index of position) by coord (position).
See Also
GetPosition()

Referenced by Divide(), DivideMesh(), Find(), and Insert().

int comms::cMeshContainer::GetVertex ( const cVec3 ) const
Returns
Vertex (index of position) by coord (position).
See Also
GetPosition()
int comms::cMeshContainer::Insert ( int  a,
int  b,
float  t,
cList< int > *  beginRawFigures = NULL,
cList< int > *  beginRawForRemoved = NULL 
)

Insert vertext on the line 'ab' (as verticies).

Returns
Added vertex.
Parameters
tDistance on the line as a nepper.
[ 0.0 (a) .. 0.5 (half of length 'ab') .. 1.0 (b) ]
beginRawFigureStarts of blocks when point or figure was inserted.
beginRawForRemovedStarts of blocks which clear confluented.
Todo:
fine Change 'int' to 'typedef int vertex_t'.
int cMeshContainer::Insert ( int  a,
int  b,
float  t,
cList< int > *  beginRawFigures = NULL,
cList< int > *  beginRawForRemoved = NULL 
)

Insert vertext on the line 'ab' (as verticies).

Returns
Added vertex.
Parameters
tDistance on the line as a nepper.
[ 0.0 (a) .. 0.5 (half of length 'ab') .. 1.0 (b) ]
beginRawFigureStarts of blocks when point or figure was inserted.
beginRawForRemovedStarts of blocks which clear confluented.
Todo:
fine Change 'int' to 'typedef int vertex_t'.

References GetPosition().

Referenced by cMeshContainer(), Divide(), Insert(), and MergeFaces().

int comms::cMeshContainer::Insert ( int  a,
int  b,
const cVec3 m,
cList< int > *  beginRawFigures = NULL,
cList< int > *  beginRawForRemoved = NULL 
)
Parameters
mPoint for insert between points ab.
int cMeshContainer::Insert ( int  a,
int  b,
const cVec3 m,
cList< int > *  beginRawFigures = NULL,
cList< int > *  beginRawForRemoved = NULL 
)
Parameters
mPoint for insert between points ab.
void comms::cMeshContainer::Insert ( const figureI_t ,
int *  beginRawFigure = NULL 
)

Insert a figure (index of verticies) into the mesh.

void cMeshContainer::Insert ( const figureI_t figure,
int *  beginRawFigure = NULL 
)

Insert a figure (index of verticies) into the mesh.

figureI_t comms::cMeshContainer::Insert ( int  a,
int *  beginRawFigure = NULL 
)

Insert a point.

cMeshContainer::figureI_t cMeshContainer::Insert ( int  a,
int *  beginRawFigure = NULL 
)

Insert a point.

References Insert().

figureI_t comms::cMeshContainer::Insert ( int  a,
int  b,
int *  beginRawFigure = NULL 
)

Insert a line.

cMeshContainer::figureI_t cMeshContainer::Insert ( int  a,
int  b,
int *  beginRawFigure = NULL 
)

Insert a line.

References Insert().

figureI_t comms::cMeshContainer::Insert ( int  a,
int  b,
int  c,
int *  beginRawFigure = NULL 
)

Insert a triangle.

cMeshContainer::figureI_t cMeshContainer::Insert ( int  a,
int  b,
int  c,
int *  beginRawFigure = NULL 
)

Insert a triangle.

References Insert().

cMeshContainer::figureI_t cMeshContainer::Insert ( int  a,
int  b,
int  c,
int  d,
int *  beginRawFigure = NULL 
)

Insert a polygon with 4 vertices.

References Insert().

figureI_t comms::cMeshContainer::Insert ( int  a,
int  b,
int  c,
int  d,
int *  beginRawFigure = NULL 
)

Insert a polygon with 4 vertices.

void comms::cMeshContainer::Insert ( const figures_t ,
float  fusionDistance = -FLT_MAX 
)

Insert a set of figures (positions of verticies) into the mesh.

Parameters
fusionDistanceCall MergeFaces() when this param is positive or zero.
See Also
construct( figures_t )
void cMeshContainer::Insert ( const figures_t figures,
float  fusionDistance = -FLT_MAX 
)

Insert a set of figures (positions of verticies) into the mesh.

Parameters
fusionDistanceCall MergeFaces() when this param is positive or zero.
See Also
construct( figures_t )

References Insert(), and MergeFaces().

void comms::cMeshContainer::Insert ( const figure_t &  ,
figureI_t = NULL 
)

Insert a figure (positions of verticies) into the mesh.

Added coords are not containes dublicates.
Use MergeFaces() for fixed faces after insert positions.

Parameters
figureI_tAccumulte indices of vertices when defined.
ai,bi,...By analogy of 'figureI_t'.
void cMeshContainer::Insert ( const figure_t &  figure,
figureI_t figureI = NULL 
)

Insert a figure (positions of verticies) into the mesh.

Added coords are not containes dublicates.
Use MergeFaces() for fixed faces after insert positions.

Parameters
figureI_tAccumulte indices of vertices when defined.
ai,bi,...By analogy of 'figureI_t'.

References GetVertex(), and Insert().

figure_t comms::cMeshContainer::Insert ( const cVec3 a,
int *  ai = NULL 
)

Insert a point.

cMeshContainer::figure_t cMeshContainer::Insert ( const cVec3 a,
int *  ai = NULL 
)

Insert a point.

References Insert().

figure_t comms::cMeshContainer::Insert ( const cVec3 a,
const cVec3 b,
int *  ai = NULL,
int *  bi = NULL 
)

Insert a line.

cMeshContainer::figure_t cMeshContainer::Insert ( const cVec3 a,
const cVec3 b,
int *  ai = NULL,
int *  bi = NULL 
)

Insert a line.

References Insert().

cMeshContainer::figure_t cMeshContainer::Insert ( const cVec3 a,
const cVec3 b,
const cVec3 c,
int *  ai = NULL,
int *  bi = NULL,
int *  ci = NULL 
)

Insert a triangle.

References Insert().

figure_t comms::cMeshContainer::Insert ( const cVec3 a,
const cVec3 b,
const cVec3 c,
int *  ai = NULL,
int *  bi = NULL,
int *  ci = NULL 
)

Insert a triangle.

figure_t comms::cMeshContainer::Insert ( const cVec3 a,
const cVec3 b,
const cVec3 c,
const cVec3 d,
int *  ai = NULL,
int *  bi = NULL,
int *  ci = NULL,
int *  di = NULL 
)

Insert a polygon with 4 vertices.

cMeshContainer::figure_t cMeshContainer::Insert ( const cVec3 a,
const cVec3 b,
const cVec3 c,
const cVec3 d,
int *  ai = NULL,
int *  bi = NULL,
int *  ci = NULL,
int *  di = NULL 
)

Insert a polygon with 4 vertices.

References Insert().

void comms::cMeshContainer::Insert ( const cMeshContainer )

Insert a mesh to this mesh.

Vertices are not dublicate.

See Also
ConcateWith()
void cMeshContainer::Insert ( const cMeshContainer b)

Insert a mesh to this mesh.

Vertices are not dublicate.

See Also
ConcateWith()

References Insert().

void cMeshContainer::Invert ( int  beginRawFigure)

Invert a figure.

See Also
Find()

Referenced by CorrectFaces().

void comms::cMeshContainer::Invert ( int  beginRawFigure)

Invert a figure.

See Also
Find()
void comms::cMeshContainer::InvertRaw ( )
See Also
Invert()
void cMeshContainer::InvertRaw ( )
See Also
Invert()

References m_Raw.

bool comms::cMeshContainer::IsClearConfluent ( const figure_t &  ,
float  tolerance 
) const
Returns
True when 'beginRawFigure' contains a figure which all vertices are confluent to line.
Parameters
toleranceValue at angle for detect figure as confluent to line.
Warning
All lines and points are confluent figure.
See Also
FindClearConfluent(), EraseClearConfluent()
bool cMeshContainer::IsClearConfluent ( const figure_t &  figure,
float  tolerance 
) const
Returns
True when 'beginRawFigure' contains a figure which all vertices are confluent to line.
Parameters
toleranceValue at angle for detect figure as confluent to line.
Warning
All lines and points are confluent figure.
See Also
FindClearConfluent(), EraseClearConfluent()

References Find().

Referenced by EraseClearConfluent(), and FindClearConfluent().

bool comms::cMeshContainer::IsClearConfluentByIndexOnly ( int  beginRawFigure) const

Verify only indices of vertices.

See Also
IsClearConfluent()
bool cMeshContainer::IsClearConfluentByIndexOnly ( int  beginRawFigure) const

Verify only indices of vertices.

See Also
IsClearConfluent()

Referenced by EraseClearConfluentByIndexOnly().

bool comms::cMeshContainer::IsClockwiseOrder ( int  beginRawFigure,
const cVec3 observer 
) const
Returns
true when line / face is clockwise order.
false when 'beginRawFigure' aim to point.
bool cMeshContainer::IsClockwiseOrder ( int  beginRawFigure,
const cVec3 observer 
) const
Returns
true when line / face is clockwise order.
false when 'beginRawFigure' aim to point.
bool cMeshContainer::IsValid ( const bool  ShowWarning = false) const
Returns
true when mesh is correct.
Todo:
fine Move ShowWarning to configure of project or set always true when a debug-mode.

References GetNormals(), and IsValidRawSequence().

Referenced by RetopoBinOp::PerformBinOp().

bool comms::cMeshContainer::IsValid ( const bool  ShowWarning = false) const
Returns
true when mesh is correct.
Todo:
fine Move ShowWarning to configure of project or set always true when a debug-mode.
bool cMeshContainer::IsValidRawSequence ( ) const

Verify the error (from Blender by import OBJ): "the same vertex of face used multiple times".

See Also
cMeshContainerTest::CorrectRawSequence*()
CorrectRawSequence()

References m_Raw.

Referenced by IsValid().

bool comms::cMeshContainer::IsValidRawSequence ( ) const

Verify the error (from Blender by import OBJ): "the same vertex of face used multiple times".

See Also
cMeshContainerTest::CorrectRawSequence*()
CorrectRawSequence()
void comms::cMeshContainer::MergeFaces ( float  fusionDistance)

Merge faces of mesh which side by side.

Parameters
fusionDistanceDistance between vertex and edge when initiate a merge.
See Also
cMeshContainerTest.jpg, "K" or "H"
void cMeshContainer::MergeFaces ( float  fusionDistance)

Merge faces of mesh which side by side.

Parameters
fusionDistanceDistance between vertex and edge when initiate a merge.
See Also
cMeshContainerTest.jpg, "K" or "H"

References CorrectRawSequence(), EraseByCount(), EraseClearConfluent(), and Insert().

Referenced by Insert().

bool cMeshContainer::OptimizeTriangularMesh ( )

tries to set valence 6 whenever possible unsing edge-flip

References FlipEdge().

Referenced by TriPatch::CalculatePatch().

bool comms::cMeshContainer::OptimizeTriangularMesh ( )

tries to set valence 6 whenever possible unsing edge-flip

void cMeshContainer::PatchedDivision ( int  dstTris,
bool  uniform,
bool  Flat = false 
)

set the divisions count for each edge

References tMiniMesh::Indices, TriPatch::TriangulatePatch(), and tMiniMesh::uvw.

Referenced by QuadrangulationUI::QuadrangulationUI().

bool comms::cMeshContainer::PerformBooleanOp ( cMeshContainer src1,
cMeshContainer src2,
int  operation,
cList< ::std::pair< comms::cVec3, comms::cVec3 > > *  dividers = NULL 
)

Build mesh from 'src1' and 'src2' to 'this'.

Parameters
operationVariants:
  • 0 - add
  • 1 - subtract src1 - src2
  • 2 - intersect src1 & src2
bool cMeshContainer::PerformBooleanOp ( cMeshContainer src1,
cMeshContainer src2,
int  operation,
cList< ::std::pair< comms::cVec3, comms::cVec3 > > *  dividers = NULL 
)

Build mesh from 'src1' and 'src2' to 'this'.

Parameters
operationVariants:
  • 0 - add
  • 1 - subtract src1 - src2
  • 2 - intersect src1 & src2
void cMeshContainer::PickObjectEdges ( cSeg &  Ray,
const cMat4 M,
cVec3 RayPt,
cVec3 ObjPt 
)

returns (xyz = nearest_edge_point_pos,w = distance_from_the_ray)

void comms::cMeshContainer::PickObjectEdges ( cSeg &  Ray,
const cMat4 M,
cVec3 RayPt,
cVec3 ObjPt 
)

returns (xyz = nearest_edge_point_pos,w = distance_from_the_ray)

void cMeshContainer::QuadQuantSubd ( const cMat4 M,
float  quant,
float  dotp,
::std::function< int(int, int)> *  divider = nullptr 
)

Try to divide all quads in approx equal sub-quads.

void comms::cMeshContainer::QuadQuantSubd ( const cMat4 M,
float  quant,
float  dotp,
::std::function< int(int, int)> *  divider = nullptr 
)

Try to divide all quads in approx equal sub-quads.

void cMeshContainer::TriSubd ( int  N,
SubdSnapEdgeCallback *  dive = NULL,
SubdSnapMiddlePointCallback *  divm = NULL,
void *  context = NULL 
)

Divide triangular mesh on N^2 triangles.

void comms::cMeshContainer::TriSubd ( int  N,
SubdSnapEdgeCallback *  dive = NULL,
SubdSnapMiddlePointCallback *  divm = NULL,
void *  context = NULL 
)

Divide triangular mesh on N^2 triangles.

Member Data Documentation

RawArray cMeshContainer::m_Raw
protected

Polygon info or 3 references to the arrays of positions, texture coordinates, and normals with tangents (optional) respectively.

Info0 = { Count0, idMtl, idObj } idMtl =
Indices_0 = { iPosition, iTexCoord, iNormal (iTangent) }
...
Indices_(Count0 - 1)
Info1
...

Referenced by GetNeighboursForFace(), InvertRaw(), and IsValidRawSequence().

cList< cVec< cVec3, 2 > > cMeshContainer::m_Tangents
protected

Tangent and BiTangent.

cList< comms::dword > comms::cMeshContainer::m_VertexSpecular
protected

RGB - specular color, A - glossness.

cList<DWORD> comms::cMeshContainer::m_VertexSpecular
protected

RGB - specular color, A - glossness.


The documentation for this class was generated from the following files: