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 46 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 35 of file clayer_triangles.cpp.

References m_normals, and m_vertexs.

37 {
38  wxASSERT( aNrReservedTriangles > 0 );
39 
40  m_vertexs.clear();
41  m_normals.clear();
42 
43  m_vertexs.reserve( aNrReservedTriangles * 3 );
44 
45  if( aReserveNormals )
46  m_normals.reserve( aNrReservedTriangles * 3 );
47 }
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 85 of file clayer_triangles.cpp.

References m_normals.

Referenced by CLAYER_TRIANGLES::AddToMiddleContourns().

88 {
89  m_normals.push_back( aN1 );
90  m_normals.push_back( aN2 );
91  m_normals.push_back( aN3 );
92 }
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 94 of file clayer_triangles.cpp.

References m_normals.

98 {
99  m_normals.push_back( aN1 );
100  m_normals.push_back( aN2 );
101  m_normals.push_back( aN3 );
102 
103  m_normals.push_back( aN3 );
104  m_normals.push_back( aN4 );
105  m_normals.push_back( aN1 );
106 }
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 60 of file clayer_triangles.cpp.

References m_vertexs.

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

64 {
65  m_vertexs.push_back( aV1 );
66  m_vertexs.push_back( aV2 );
67  m_vertexs.push_back( aV3 );
68 
69  m_vertexs.push_back( aV3 );
70  m_vertexs.push_back( aV4 );
71  m_vertexs.push_back( aV1 );
72 }
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 75 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().

78 {
79  m_vertexs.push_back( aV1 );
80  m_vertexs.push_back( aV2 );
81  m_vertexs.push_back( aV3 );
82 }
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 114 of file clayer_triangles.h.

References m_normals.

Referenced by CLAYERS_OGL_DISP_LISTS::generate_middle_triangles().

114 { 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 126 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().

126 { 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 108 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().

108 { 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 50 of file clayer_triangles.cpp.

References m_normals, and m_vertexs.

Referenced by CLAYER_TRIANGLES::AddToMiddleContourns().

52 {
53  m_vertexs.reserve( m_vertexs.size() + aNrReservedTriangles * 3 );
54 
55  if( aReserveNormals )
56  m_normals.reserve( m_normals.size() + aNrReservedTriangles * 3 );
57 }
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 130 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: