KiCad PCB EDA Suite
CLAYER_TRIANGLE_CONTAINER Class Reference

The CLAYER_TRIANGLE_CONTAINER class stores an manage vector of triangles. More...

#include <clayer_triangles.h>

Public Member Functions

 CLAYER_TRIANGLE_CONTAINER (unsigned int aNrReservedTriangles, bool aReserveNormals)
 CLAYER_TRIANGLE_CONTAINER. More...
 
void Reserve_More (unsigned int aNrReservedTriangles, bool aReserveNormals)
 Reserve_More - reserve more triangles. More...
 
void AddTriangle (const SFVEC3F &aV1, const SFVEC3F &aV2, const SFVEC3F &aV3)
 AddTriangle. More...
 
void AddQuad (const SFVEC3F &aV1, const SFVEC3F &aV2, const SFVEC3F &aV3, const SFVEC3F &aV4)
 AddQuad. More...
 
void AddNormal (const SFVEC3F &aN1, const SFVEC3F &aN2, const SFVEC3F &aN3)
 AddNormal. More...
 
void AddNormal (const SFVEC3F &aN1, const SFVEC3F &aN2, const SFVEC3F &aN3, const SFVEC3F &aN4)
 AddNormal. More...
 
const float * GetVertexPointer () const
 GetVertexPointer - Get the array of vertexes. More...
 
const float * GetNormalsPointer () const
 GetNormalsPointer - Get the array of normals. More...
 
unsigned int GetVertexSize () const
 GetVertexSize. More...
 
unsigned int GetNormalsSize () const
 GetNormalsSize. More...
 

Private Attributes

SFVEC3F_VECTOR m_vertexs
 vertex array More...
 
SFVEC3F_VECTOR m_normals
 normals array More...
 

Detailed Description

The CLAYER_TRIANGLE_CONTAINER class stores an manage vector of triangles.

Definition at line 47 of file clayer_triangles.h.

Constructor & Destructor Documentation

CLAYER_TRIANGLE_CONTAINER::CLAYER_TRIANGLE_CONTAINER ( unsigned int  aNrReservedTriangles,
bool  aReserveNormals 
)

CLAYER_TRIANGLE_CONTAINER.

Parameters
aNrReservedTrianglesnumber of triangles expected to be used
aReserveNormalsif you will use normals, set it to bool to pre reserve space

Definition at line 38 of file clayer_triangles.cpp.

References m_normals, and m_vertexs.

Referenced by CLAYER_TRIANGLES::CLAYER_TRIANGLES().

40 {
41  wxASSERT( aNrReservedTriangles > 0 );
42 
43  m_vertexs.clear();
44  m_normals.clear();
45 
46  m_vertexs.reserve( aNrReservedTriangles * 3 );
47 
48  if( aReserveNormals )
49  m_normals.reserve( aNrReservedTriangles * 3 );
50 }
SFVEC3F_VECTOR m_vertexs
vertex array
SFVEC3F_VECTOR m_normals
normals array

Member Function Documentation

void CLAYER_TRIANGLE_CONTAINER::AddNormal ( const SFVEC3F aN1,
const SFVEC3F aN2,
const SFVEC3F aN3 
)

AddNormal.

Parameters
aN1
aN2
aN3

Definition at line 88 of file clayer_triangles.cpp.

References m_normals.

91 {
92  m_normals.push_back( aN1 );
93  m_normals.push_back( aN2 );
94  m_normals.push_back( aN3 );
95 }
SFVEC3F_VECTOR m_normals
normals array
void CLAYER_TRIANGLE_CONTAINER::AddNormal ( const SFVEC3F aN1,
const SFVEC3F aN2,
const SFVEC3F aN3,
const SFVEC3F aN4 
)

AddNormal.

Parameters
aN1
aN2
aN3

Definition at line 97 of file clayer_triangles.cpp.

References m_normals.

101 {
102  m_normals.push_back( aN1 );
103  m_normals.push_back( aN2 );
104  m_normals.push_back( aN3 );
105 
106  m_normals.push_back( aN3 );
107  m_normals.push_back( aN4 );
108  m_normals.push_back( aN1 );
109 }
SFVEC3F_VECTOR m_normals
normals array
void CLAYER_TRIANGLE_CONTAINER::AddQuad ( const SFVEC3F aV1,
const SFVEC3F aV2,
const SFVEC3F aV3,
const SFVEC3F aV4 
)

AddQuad.

Parameters
aV1
aV2
aV3
aV4

Definition at line 63 of file clayer_triangles.cpp.

References m_vertexs.

Referenced by C3D_RENDER_OGL_LEGACY::add_object_to_triangle_layer(), and C3D_RENDER_OGL_LEGACY::generate_cylinder().

67 {
68  m_vertexs.push_back( aV1 );
69  m_vertexs.push_back( aV2 );
70  m_vertexs.push_back( aV3 );
71 
72  m_vertexs.push_back( aV3 );
73  m_vertexs.push_back( aV4 );
74  m_vertexs.push_back( aV1 );
75 }
SFVEC3F_VECTOR m_vertexs
vertex array
void CLAYER_TRIANGLE_CONTAINER::AddTriangle ( const SFVEC3F aV1,
const SFVEC3F aV2,
const SFVEC3F aV3 
)

AddTriangle.

Parameters
aV1
aV2
aV3

Definition at line 78 of file clayer_triangles.cpp.

References m_vertexs.

Referenced by C3D_RENDER_OGL_LEGACY::add_object_to_triangle_layer(), and C3D_RENDER_OGL_LEGACY::add_triangle_top_bot().

81 {
82  m_vertexs.push_back( aV1 );
83  m_vertexs.push_back( aV2 );
84  m_vertexs.push_back( aV3 );
85 }
SFVEC3F_VECTOR m_vertexs
vertex array
const float* CLAYER_TRIANGLE_CONTAINER::GetNormalsPointer ( ) const
inline

GetNormalsPointer - Get the array of normals.

Returns
The pointer to start of array of normals

Definition at line 115 of file clayer_triangles.h.

References m_normals.

Referenced by CLAYERS_OGL_DISP_LISTS::generate_middle_triangles().

115 { return (const float *)&m_normals[0].x; }
SFVEC3F_VECTOR m_normals
normals array
unsigned int CLAYER_TRIANGLE_CONTAINER::GetNormalsSize ( ) const
inline

GetNormalsSize.

Returns

Definition at line 127 of file clayer_triangles.h.

References m_normals.

Referenced by CLAYERS_OGL_DISP_LISTS::generate_middle_triangles(), CLAYERS_OGL_DISP_LISTS::generate_top_or_bot_seg_ends(), and CLAYERS_OGL_DISP_LISTS::generate_top_or_bot_triangles().

127 { return (unsigned int)m_normals.size(); }
SFVEC3F_VECTOR m_normals
normals array
const float* CLAYER_TRIANGLE_CONTAINER::GetVertexPointer ( ) const
inline

GetVertexPointer - Get the array of vertexes.

Returns
The pointer to the start of array vertex

Definition at line 109 of file clayer_triangles.h.

References m_vertexs.

Referenced by CLAYERS_OGL_DISP_LISTS::generate_middle_triangles(), CLAYERS_OGL_DISP_LISTS::generate_top_or_bot_seg_ends(), and CLAYERS_OGL_DISP_LISTS::generate_top_or_bot_triangles().

109 { return (const float *)&m_vertexs[0].x; }
SFVEC3F_VECTOR m_vertexs
vertex array
unsigned int CLAYER_TRIANGLE_CONTAINER::GetVertexSize ( ) const
inline
void CLAYER_TRIANGLE_CONTAINER::Reserve_More ( unsigned int  aNrReservedTriangles,
bool  aReserveNormals 
)

Reserve_More - reserve more triangles.

Definition at line 53 of file clayer_triangles.cpp.

References m_normals, and m_vertexs.

55 {
56  m_vertexs.reserve( m_vertexs.size() + aNrReservedTriangles * 3 );
57 
58  if( aReserveNormals )
59  m_normals.reserve( m_normals.size() + aNrReservedTriangles * 3 );
60 }
SFVEC3F_VECTOR m_vertexs
vertex array
SFVEC3F_VECTOR m_normals
normals array

Member Data Documentation

SFVEC3F_VECTOR CLAYER_TRIANGLE_CONTAINER::m_normals
private

normals array

Definition at line 131 of file clayer_triangles.h.

Referenced by AddNormal(), CLAYER_TRIANGLE_CONTAINER(), GetNormalsPointer(), GetNormalsSize(), and Reserve_More().

SFVEC3F_VECTOR CLAYER_TRIANGLE_CONTAINER::m_vertexs
private

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