KiCad PCB EDA Suite
C3D_RENDER_OGL_LEGACY Class Reference

The C3D_RENDER_OGL_LEGACY class render the board using openGL legacy mode. More...

#include <c3d_render_ogl_legacy.h>

Inheritance diagram for C3D_RENDER_OGL_LEGACY:
C3D_RENDER_BASE

Public Member Functions

 C3D_RENDER_OGL_LEGACY (BOARD_ADAPTER &aAdapter, CCAMERA &aCamera)
 
 ~C3D_RENDER_OGL_LEGACY ()
 
void SetCurWindowSize (const wxSize &aSize) override
 SetCurWindowSize - Before each render, the canvas will tell the render what is the size of its windows, so render can take actions if it changed. More...
 
bool Redraw (bool aIsMoving, REPORTER *aStatusReporter, REPORTER *aWarningReporter) override
 Redraw - Ask to redraw the view. More...
 
int GetWaitForEditingTimeOut () override
 GetWaitForEditingTimeOut - Give the interface the time (in ms) that it should wait for editing or movements before (this works for display preview mode) More...
 
void ReloadRequest ()
 ReloadRequest - !TODO: this must be reviewed to add flags to improve specific render. More...
 
bool IsReloadRequestPending () const
 IsReloadRequestPending - Query if there is a pending reload request. More...
 
void SetBusyIndicatorFactory (BUSY_INDICATOR::FACTORY aNewFactory)
 Set a new busy indicator factory. More...
 

Protected Member Functions

std::unique_ptr< BUSY_INDICATORCreateBusyIndicator () const
 Return a created busy indicator, if a factory has been set, else a null pointer. More...
 

Protected Attributes

BOARD_ADAPTERm_boardAdapter
 settings refrence in use for this render More...
 
CCAMERAm_camera
 
bool m_is_opengl_initialized
 flag if the opengl specific for this render was already initialized More...
 
bool m_reloadRequested
 !TODO: this must be reviewed in order to flag change types More...
 
wxSize m_windowSize
 The window size that this camera is working. More...
 

Static Protected Attributes

static const wxChar * m_logTrace = wxT( "KI_TRACE_3D_RENDER" )
 Trace mask used to enable or disable the trace output of this class. More...
 

Private Member Functions

bool initializeOpenGL ()
 
void reload (REPORTER *aStatusReporter, REPORTER *aWarningReporter)
 
void ogl_set_arrow_material ()
 
void ogl_free_all_display_lists ()
 
CLAYERS_OGL_DISP_LISTSgenerate_holes_display_list (const LIST_OBJECT2D &aListHolesObject2d, const SHAPE_POLY_SET &aPoly, float aZtop, float aZbot, bool aInvertFaces)
 
void add_triangle_top_bot (CLAYER_TRIANGLES *aDst, const SFVEC2F &v0, const SFVEC2F &v1, const SFVEC2F &v2, float top, float bot)
 
void add_object_to_triangle_layer (const CRING2D *aRing, CLAYER_TRIANGLES *aDstLayer, float aZtop, float aZbot)
 
void add_object_to_triangle_layer (const CPOLYGON4PTS2D *aPoly, CLAYER_TRIANGLES *aDstLayer, float aZtop, float aZbot)
 
void add_object_to_triangle_layer (const CFILLEDCIRCLE2D *aFilledCircle, CLAYER_TRIANGLES *aDstLayer, float aZtop, float aZbot)
 
void add_object_to_triangle_layer (const CTRIANGLE2D *aTri, CLAYER_TRIANGLES *aDstLayer, float aZtop, float aZbot)
 
void add_object_to_triangle_layer (const CROUNDSEGMENT2D *aSeg, CLAYER_TRIANGLES *aDstLayer, float aZtop, float aZbot)
 
void render_solder_mask_layer (PCB_LAYER_ID aLayerID, float aZPosition, bool aDrawMiddleSegments, bool aSkipRenderHoles)
 
void get_layer_z_pos (PCB_LAYER_ID aLayerID, float &aOutZtop, float &aOutZbot) const
 
void generate_ring_contour (const SFVEC2F &aCenter, float aInnerRadius, float aOuterRadius, unsigned int aNr_sides_per_circle, std::vector< SFVEC2F > &aInnerContourResult, std::vector< SFVEC2F > &aOuterContourResult, bool aInvertOrder)
 
void generate_cylinder (const SFVEC2F &aCenter, float aInnerRadius, float aOuterRadius, float aZtop, float aZbot, unsigned int aNr_sides_per_circle, CLAYER_TRIANGLES *aDstLayer)
 
void generate_3D_Vias_and_Pads ()
 
void load_3D_models (REPORTER *aStatusReporter)
 
void render_3D_models (bool aRenderTopOrBot, bool aRenderTransparentOnly)
 render_3D_models More...
 
void render_3D_module (const MODULE *module, bool aRenderTransparentOnly)
 
void setLight_Front (bool enabled)
 
void setLight_Top (bool enabled)
 
void setLight_Bottom (bool enabled)
 
void render_3D_arrows ()
 
void generate_new_3DGrid (GRID3D_TYPE aGridType)
 
void setupMaterials ()
 
void set_layer_material (PCB_LAYER_ID aLayerID)
 
SFVEC3F get_layer_color (PCB_LAYER_ID aLayerID)
 

Private Attributes

MAP_OGL_DISP_LISTS m_ogl_disp_lists_layers
 
MAP_OGL_DISP_LISTS m_ogl_disp_lists_layers_holes_outer
 
MAP_OGL_DISP_LISTS m_ogl_disp_lists_layers_holes_inner
 
CLAYERS_OGL_DISP_LISTSm_ogl_disp_list_board
 
CLAYERS_OGL_DISP_LISTSm_ogl_disp_list_through_holes_outer
 
CLAYERS_OGL_DISP_LISTSm_ogl_disp_list_through_holes_outer_with_npth
 
CLAYERS_OGL_DISP_LISTSm_ogl_disp_list_through_holes_vias_outer
 
CLAYERS_OGL_DISP_LISTSm_ogl_disp_list_through_holes_vias_outer_ring
 
CLAYERS_OGL_DISP_LISTSm_ogl_disp_list_vias_and_pad_holes_outer_contourn_and_caps
 
MAP_TRIANGLES m_triangles
 
GLuint m_ogl_circle_texture
 
GLuint m_ogl_disp_list_grid
 oGL list that stores current grid More...
 
GRID3D_TYPE m_last_grid_type
 Stores the last grid computed. More...
 
CLAYERS_OGL_DISP_LISTSm_ogl_disp_list_via
 
CLAYERS_OGL_DISP_LISTSm_ogl_disp_list_pads_holes
 
MAP_3DMODEL m_3dmodel_map
 
struct {
   SMATERIAL   m_Paste
 
   SMATERIAL   m_SilkSBot
 
   SMATERIAL   m_SilkSTop
 
   SMATERIAL   m_SolderMaskBot
 
   SMATERIAL   m_SolderMaskTop
 
   SMATERIAL   m_EpoxyBoard
 
   SMATERIAL   m_Copper
 
   SMATERIAL   m_Plastic
 
   SMATERIAL   m_GrayMaterial
 
m_materials
 

Detailed Description

The C3D_RENDER_OGL_LEGACY class render the board using openGL legacy mode.

Definition at line 59 of file c3d_render_ogl_legacy.h.

Constructor & Destructor Documentation

◆ C3D_RENDER_OGL_LEGACY()

C3D_RENDER_OGL_LEGACY::C3D_RENDER_OGL_LEGACY ( BOARD_ADAPTER aAdapter,
CCAMERA aCamera 
)
explicit

Definition at line 52 of file c3d_render_ogl_legacy.cpp.

52  :
53  C3D_RENDER_BASE( aAdapter, aCamera )
54 {
55  wxLogTrace( m_logTrace, wxT( "C3D_RENDER_OGL_LEGACY::C3D_RENDER_OGL_LEGACY" ) );
56 
60  m_triangles.clear();
62 
67  //m_ogl_disp_list_through_holes_vias_inner = NULL;
71 
75 
76  m_3dmodel_map.clear();
77 }
MAP_OGL_DISP_LISTS m_ogl_disp_lists_layers
CLAYERS_OGL_DISP_LISTS * m_ogl_disp_list_through_holes_vias_outer_ring
MAP_OGL_DISP_LISTS m_ogl_disp_lists_layers_holes_outer
GRID3D_TYPE m_last_grid_type
Stores the last grid computed.
CLAYERS_OGL_DISP_LISTS * m_ogl_disp_list_through_holes_outer
#define NULL
C3D_RENDER_BASE(BOARD_ADAPTER &aBoardAdapter, CCAMERA &aCamera)
CLAYERS_OGL_DISP_LISTS * m_ogl_disp_list_through_holes_vias_outer
CLAYERS_OGL_DISP_LISTS * m_ogl_disp_list_via
GLuint m_ogl_disp_list_grid
oGL list that stores current grid
MAP_OGL_DISP_LISTS m_ogl_disp_lists_layers_holes_inner
CLAYERS_OGL_DISP_LISTS * m_ogl_disp_list_through_holes_outer_with_npth
CLAYERS_OGL_DISP_LISTS * m_ogl_disp_list_board
CLAYERS_OGL_DISP_LISTS * m_ogl_disp_list_vias_and_pad_holes_outer_contourn_and_caps
CLAYERS_OGL_DISP_LISTS * m_ogl_disp_list_pads_holes
static const wxChar * m_logTrace
Trace mask used to enable or disable the trace output of this class.

References m_3dmodel_map, m_last_grid_type, C3D_RENDER_BASE::m_logTrace, m_ogl_circle_texture, m_ogl_disp_list_board, m_ogl_disp_list_grid, m_ogl_disp_list_pads_holes, m_ogl_disp_list_through_holes_outer, m_ogl_disp_list_through_holes_outer_with_npth, m_ogl_disp_list_through_holes_vias_outer, m_ogl_disp_list_through_holes_vias_outer_ring, m_ogl_disp_list_via, m_ogl_disp_list_vias_and_pad_holes_outer_contourn_and_caps, m_ogl_disp_lists_layers, m_ogl_disp_lists_layers_holes_inner, m_ogl_disp_lists_layers_holes_outer, m_triangles, NONE, and NULL.

◆ ~C3D_RENDER_OGL_LEGACY()

C3D_RENDER_OGL_LEGACY::~C3D_RENDER_OGL_LEGACY ( )

Definition at line 80 of file c3d_render_ogl_legacy.cpp.

81 {
82  wxLogTrace( m_logTrace, wxT( "C3D_RENDER_OGL_LEGACY::~C3D_RENDER_OGL_LEGACY" ) );
83 
85 
86  glDeleteTextures( 1, &m_ogl_circle_texture );
87 }
static const wxChar * m_logTrace
Trace mask used to enable or disable the trace output of this class.

References C3D_RENDER_BASE::m_logTrace, m_ogl_circle_texture, and ogl_free_all_display_lists().

Member Function Documentation

◆ add_object_to_triangle_layer() [1/5]

void C3D_RENDER_OGL_LEGACY::add_object_to_triangle_layer ( const CRING2D aRing,
CLAYER_TRIANGLES aDstLayer,
float  aZtop,
float  aZbot 
)
private

Definition at line 129 of file c3d_render_createscene_ogl_legacy.cpp.

133 {
134  const SFVEC2F &center = aRing->GetCenter();
135  const float inner = aRing->GetInnerRadius();
136  const float outer = aRing->GetOuterRadius();
137 
138  std::vector< SFVEC2F > innerContour;
139  std::vector< SFVEC2F > outerContour;
140 
141  generate_ring_contour( center,
142  inner,
143  outer,
144  m_boardAdapter.GetNrSegmentsCircle( outer * 2.0f ),
145  innerContour,
146  outerContour,
147  false );
148 
149  // This will add the top and bot quads that will form the approximated ring
150 
151  for( unsigned int i = 0; i < ( innerContour.size() - 1 ); ++i )
152  {
153  const SFVEC2F &vi0 = innerContour[i + 0];
154  const SFVEC2F &vi1 = innerContour[i + 1];
155  const SFVEC2F &vo0 = outerContour[i + 0];
156  const SFVEC2F &vo1 = outerContour[i + 1];
157 
158  aDstLayer->m_layer_top_triangles->AddQuad( SFVEC3F( vi1.x, vi1.y, aZtop ),
159  SFVEC3F( vi0.x, vi0.y, aZtop ),
160  SFVEC3F( vo0.x, vo0.y, aZtop ),
161  SFVEC3F( vo1.x, vo1.y, aZtop ) );
162 
163  aDstLayer->m_layer_bot_triangles->AddQuad( SFVEC3F( vi1.x, vi1.y, aZbot ),
164  SFVEC3F( vo1.x, vo1.y, aZbot ),
165  SFVEC3F( vo0.x, vo0.y, aZbot ),
166  SFVEC3F( vi0.x, vi0.y, aZbot ) );
167  }
168 }
void generate_ring_contour(const SFVEC2F &aCenter, float aInnerRadius, float aOuterRadius, unsigned int aNr_sides_per_circle, std::vector< SFVEC2F > &aInnerContourResult, std::vector< SFVEC2F > &aOuterContourResult, bool aInvertOrder)
float GetOuterRadius() const
Definition: cring2d.h:40
float GetInnerRadius() const
Definition: cring2d.h:39
unsigned int GetNrSegmentsCircle(float aDiameter3DU) const
GetNrSegmentsCircle.
glm::vec2 SFVEC2F
Definition: xv3d_types.h:45
const SFVEC2F & GetCenter() const
Definition: cring2d.h:38
CLAYER_TRIANGLE_CONTAINER * m_layer_top_triangles
BOARD_ADAPTER & m_boardAdapter
settings refrence in use for this render
CLAYER_TRIANGLE_CONTAINER * m_layer_bot_triangles
glm::vec3 SFVEC3F
Definition: xv3d_types.h:47
void AddQuad(const SFVEC3F &aV1, const SFVEC3F &aV2, const SFVEC3F &aV3, const SFVEC3F &aV4)
AddQuad.

References CLAYER_TRIANGLE_CONTAINER::AddQuad(), generate_ring_contour(), CRING2D::GetCenter(), CRING2D::GetInnerRadius(), BOARD_ADAPTER::GetNrSegmentsCircle(), CRING2D::GetOuterRadius(), C3D_RENDER_BASE::m_boardAdapter, CLAYER_TRIANGLES::m_layer_bot_triangles, and CLAYER_TRIANGLES::m_layer_top_triangles.

Referenced by generate_holes_display_list(), and reload().

◆ add_object_to_triangle_layer() [2/5]

void C3D_RENDER_OGL_LEGACY::add_object_to_triangle_layer ( const CPOLYGON4PTS2D aPoly,
CLAYER_TRIANGLES aDstLayer,
float  aZtop,
float  aZbot 
)
private

Definition at line 78 of file c3d_render_createscene_ogl_legacy.cpp.

82 {
83  const SFVEC2F &v0 = aPoly->GetV0();
84  const SFVEC2F &v1 = aPoly->GetV1();
85  const SFVEC2F &v2 = aPoly->GetV2();
86  const SFVEC2F &v3 = aPoly->GetV3();
87 
88  add_triangle_top_bot( aDstLayer, v0, v2, v1, aZtop, aZbot );
89  add_triangle_top_bot( aDstLayer, v2, v0, v3, aZtop, aZbot );
90 }
const SFVEC2F & GetV0() const
const SFVEC2F & GetV3() const
const SFVEC2F & GetV2() const
glm::vec2 SFVEC2F
Definition: xv3d_types.h:45
const SFVEC2F & GetV1() const
void add_triangle_top_bot(CLAYER_TRIANGLES *aDst, const SFVEC2F &v0, const SFVEC2F &v1, const SFVEC2F &v2, float top, float bot)

References add_triangle_top_bot(), CPOLYGON4PTS2D::GetV0(), CPOLYGON4PTS2D::GetV1(), CPOLYGON4PTS2D::GetV2(), and CPOLYGON4PTS2D::GetV3().

◆ add_object_to_triangle_layer() [3/5]

void C3D_RENDER_OGL_LEGACY::add_object_to_triangle_layer ( const CFILLEDCIRCLE2D aFilledCircle,
CLAYER_TRIANGLES aDstLayer,
float  aZtop,
float  aZbot 
)
private

Definition at line 41 of file c3d_render_createscene_ogl_legacy.cpp.

45 {
46  const SFVEC2F &center = aFilledCircle->GetCenter();
47  const float radius = aFilledCircle->GetRadius() *
48  2.0f; // Double because the render triangle
49 
50  // This is a small adjustment to the circle texture
51  const float texture_factor = (8.0f / (float)SIZE_OF_CIRCLE_TEXTURE) + 1.0f;
52  const float f = (sqrtf(2.0f) / 2.0f) * radius * texture_factor;
53 
54  // Top and Bot segments ends are just triangle semi-circles, so need to add
55  // it in duplicated
56  aDstLayer->m_layer_top_segment_ends->AddTriangle( SFVEC3F( center.x + f, center.y, aZtop ),
57  SFVEC3F( center.x - f, center.y, aZtop ),
58  SFVEC3F( center.x,
59  center.y - f, aZtop ) );
60 
61  aDstLayer->m_layer_top_segment_ends->AddTriangle( SFVEC3F( center.x - f, center.y, aZtop ),
62  SFVEC3F( center.x + f, center.y, aZtop ),
63  SFVEC3F( center.x,
64  center.y + f, aZtop ) );
65 
66  aDstLayer->m_layer_bot_segment_ends->AddTriangle( SFVEC3F( center.x - f, center.y, aZbot ),
67  SFVEC3F( center.x + f, center.y, aZbot ),
68  SFVEC3F( center.x,
69  center.y - f, aZbot ) );
70 
71  aDstLayer->m_layer_bot_segment_ends->AddTriangle( SFVEC3F( center.x + f, center.y, aZbot ),
72  SFVEC3F( center.x - f, center.y, aZbot ),
73  SFVEC3F( center.x,
74  center.y + f, aZbot ) );
75 }
glm::vec2 SFVEC2F
Definition: xv3d_types.h:45
void AddTriangle(const SFVEC3F &aV1, const SFVEC3F &aV2, const SFVEC3F &aV3)
AddTriangle.
const SFVEC2F & GetCenter() const
#define SIZE_OF_CIRCLE_TEXTURE
CLAYER_TRIANGLE_CONTAINER * m_layer_bot_segment_ends
glm::vec3 SFVEC3F
Definition: xv3d_types.h:47
float GetRadius() const
CLAYER_TRIANGLE_CONTAINER * m_layer_top_segment_ends

References CLAYER_TRIANGLE_CONTAINER::AddTriangle(), CFILLEDCIRCLE2D::GetCenter(), CFILLEDCIRCLE2D::GetRadius(), CLAYER_TRIANGLES::m_layer_bot_segment_ends, CLAYER_TRIANGLES::m_layer_top_segment_ends, and SIZE_OF_CIRCLE_TEXTURE.

◆ add_object_to_triangle_layer() [4/5]

void C3D_RENDER_OGL_LEGACY::add_object_to_triangle_layer ( const CTRIANGLE2D aTri,
CLAYER_TRIANGLES aDstLayer,
float  aZtop,
float  aZbot 
)
private

Definition at line 171 of file c3d_render_createscene_ogl_legacy.cpp.

175 {
176  const SFVEC2F &v1 = aTri->GetP1();
177  const SFVEC2F &v2 = aTri->GetP2();
178  const SFVEC2F &v3 = aTri->GetP3();
179 
180  add_triangle_top_bot( aDstLayer, v1, v2, v3, aZtop, aZbot );
181 }
const SFVEC2F & GetP2() const
Definition: ctriangle2d.h:59
glm::vec2 SFVEC2F
Definition: xv3d_types.h:45
const SFVEC2F & GetP1() const
Definition: ctriangle2d.h:58
const SFVEC2F & GetP3() const
Definition: ctriangle2d.h:60
void add_triangle_top_bot(CLAYER_TRIANGLES *aDst, const SFVEC2F &v0, const SFVEC2F &v1, const SFVEC2F &v2, float top, float bot)

References add_triangle_top_bot(), CTRIANGLE2D::GetP1(), CTRIANGLE2D::GetP2(), and CTRIANGLE2D::GetP3().

◆ add_object_to_triangle_layer() [5/5]

void C3D_RENDER_OGL_LEGACY::add_object_to_triangle_layer ( const CROUNDSEGMENT2D aSeg,
CLAYER_TRIANGLES aDstLayer,
float  aZtop,
float  aZbot 
)
private

Definition at line 184 of file c3d_render_createscene_ogl_legacy.cpp.

188 {
189  const SFVEC2F& leftStart = aSeg->GetLeftStar();
190  const SFVEC2F& leftEnd = aSeg->GetLeftEnd();
191  const SFVEC2F& leftDir = aSeg->GetLeftDir();
192 
193  const SFVEC2F& rightStart = aSeg->GetRightStar();
194  const SFVEC2F& rightEnd = aSeg->GetRightEnd();
195  const SFVEC2F& rightDir = aSeg->GetRightDir();
196  const float radius = aSeg->GetRadius();
197 
198  const SFVEC2F& start = aSeg->GetStart();
199  const SFVEC2F& end = aSeg->GetEnd();
200 
201  const float texture_factor = (12.0f / (float)SIZE_OF_CIRCLE_TEXTURE) + 1.0f;
202  const float texture_factorF= ( 6.0f / (float)SIZE_OF_CIRCLE_TEXTURE) + 1.0f;
203 
204  const float radius_of_the_square = sqrtf( aSeg->GetRadiusSquared() * 2.0f );
205  const float radius_triangle_factor = (radius_of_the_square - radius) / radius;
206 
207  const SFVEC2F factorS = SFVEC2F( -rightDir.y * radius * radius_triangle_factor,
208  rightDir.x * radius * radius_triangle_factor );
209 
210  const SFVEC2F factorE = SFVEC2F( -leftDir.y * radius * radius_triangle_factor,
211  leftDir.x * radius * radius_triangle_factor );
212 
213  // Top end segment triangles (semi-circles)
215  SFVEC3F( rightEnd.x + texture_factor * factorS.x,
216  rightEnd.y + texture_factor * factorS.y,
217  aZtop ),
218  SFVEC3F( leftStart.x + texture_factor * factorE.x,
219  leftStart.y + texture_factor * factorE.y,
220  aZtop ),
221  SFVEC3F( start.x - texture_factorF * leftDir.x * radius * sqrtf( 2.0f ),
222  start.y - texture_factorF * leftDir.y * radius * sqrtf( 2.0f ),
223  aZtop ) );
224 
226  SFVEC3F( leftEnd.x + texture_factor * factorE.x,
227  leftEnd.y + texture_factor * factorE.y, aZtop ),
228  SFVEC3F( rightStart.x + texture_factor * factorS.x,
229  rightStart.y + texture_factor * factorS.y, aZtop ),
230  SFVEC3F( end.x - texture_factorF * rightDir.x * radius * sqrtf( 2.0f ),
231  end.y - texture_factorF * rightDir.y * radius * sqrtf( 2.0f ),
232  aZtop ) );
233 
234  // Bot end segment triangles (semi-circles)
236  SFVEC3F( leftStart.x + texture_factor * factorE.x,
237  leftStart.y + texture_factor * factorE.y,
238  aZbot ),
239  SFVEC3F( rightEnd.x + texture_factor * factorS.x,
240  rightEnd.y + texture_factor * factorS.y,
241  aZbot ),
242  SFVEC3F( start.x - texture_factorF * leftDir.x * radius * sqrtf( 2.0f ),
243  start.y - texture_factorF * leftDir.y * radius * sqrtf( 2.0f ),
244  aZbot ) );
245 
247  SFVEC3F( rightStart.x + texture_factor * factorS.x,
248  rightStart.y + texture_factor * factorS.y, aZbot ),
249  SFVEC3F( leftEnd.x + texture_factor * factorE.x,
250  leftEnd.y + texture_factor * factorE.y, aZbot ),
251  SFVEC3F( end.x - texture_factorF * rightDir.x * radius * sqrtf( 2.0f ),
252  end.y - texture_factorF * rightDir.y * radius * sqrtf( 2.0f ),
253  aZbot ) );
254 
255  // Segment top and bot planes
256  aDstLayer->m_layer_top_triangles->AddQuad(
257  SFVEC3F( rightEnd.x, rightEnd.y, aZtop ),
258  SFVEC3F( rightStart.x, rightStart.y, aZtop ),
259  SFVEC3F( leftEnd.x, leftEnd.y, aZtop ),
260  SFVEC3F( leftStart.x, leftStart.y, aZtop ) );
261 
262  aDstLayer->m_layer_bot_triangles->AddQuad(
263  SFVEC3F( rightEnd.x, rightEnd.y, aZbot ),
264  SFVEC3F( leftStart.x, leftStart.y, aZbot ),
265  SFVEC3F( leftEnd.x, leftEnd.y, aZbot ),
266  SFVEC3F( rightStart.x, rightStart.y, aZbot ) );
267 }
const SFVEC2F & GetRightEnd() const
const SFVEC2F & GetStart() const
const SFVEC2F & GetLeftStar() const
float GetRadius() const
const SFVEC2F & GetRightStar() const
const SFVEC2F & GetLeftEnd() const
const SFVEC2F & GetEnd() const
glm::vec2 SFVEC2F
Definition: xv3d_types.h:45
CLAYER_TRIANGLE_CONTAINER * m_layer_top_triangles
void AddTriangle(const SFVEC3F &aV1, const SFVEC3F &aV2, const SFVEC3F &aV3)
AddTriangle.
float GetRadiusSquared() const
const SFVEC2F & GetRightDir() const
const SFVEC2F & GetLeftDir() const
#define SIZE_OF_CIRCLE_TEXTURE
CLAYER_TRIANGLE_CONTAINER * m_layer_bot_segment_ends
CLAYER_TRIANGLE_CONTAINER * m_layer_bot_triangles
glm::vec3 SFVEC3F
Definition: xv3d_types.h:47
CLAYER_TRIANGLE_CONTAINER * m_layer_top_segment_ends
void AddQuad(const SFVEC3F &aV1, const SFVEC3F &aV2, const SFVEC3F &aV3, const SFVEC3F &aV4)
AddQuad.

References CLAYER_TRIANGLE_CONTAINER::AddQuad(), CLAYER_TRIANGLE_CONTAINER::AddTriangle(), CROUNDSEGMENT2D::GetEnd(), CROUNDSEGMENT2D::GetLeftDir(), CROUNDSEGMENT2D::GetLeftEnd(), CROUNDSEGMENT2D::GetLeftStar(), CROUNDSEGMENT2D::GetRadius(), CROUNDSEGMENT2D::GetRadiusSquared(), CROUNDSEGMENT2D::GetRightDir(), CROUNDSEGMENT2D::GetRightEnd(), CROUNDSEGMENT2D::GetRightStar(), CROUNDSEGMENT2D::GetStart(), CLAYER_TRIANGLES::m_layer_bot_segment_ends, CLAYER_TRIANGLES::m_layer_bot_triangles, CLAYER_TRIANGLES::m_layer_top_segment_ends, CLAYER_TRIANGLES::m_layer_top_triangles, and SIZE_OF_CIRCLE_TEXTURE.

◆ add_triangle_top_bot()

void C3D_RENDER_OGL_LEGACY::add_triangle_top_bot ( CLAYER_TRIANGLES aDst,
const SFVEC2F v0,
const SFVEC2F v1,
const SFVEC2F v2,
float  top,
float  bot 
)
private

Definition at line 658 of file c3d_render_createscene_ogl_legacy.cpp.

664 {
665  aDst->m_layer_bot_triangles->AddTriangle( SFVEC3F( v0.x, v0.y, bot ),
666  SFVEC3F( v1.x, v1.y, bot ),
667  SFVEC3F( v2.x, v2.y, bot ) );
668 
669  aDst->m_layer_top_triangles->AddTriangle( SFVEC3F( v2.x, v2.y, top ),
670  SFVEC3F( v1.x, v1.y, top ),
671  SFVEC3F( v0.x, v0.y, top ) );
672 }
CLAYER_TRIANGLE_CONTAINER * m_layer_top_triangles
void AddTriangle(const SFVEC3F &aV1, const SFVEC3F &aV2, const SFVEC3F &aV3)
AddTriangle.
CLAYER_TRIANGLE_CONTAINER * m_layer_bot_triangles
glm::vec3 SFVEC3F
Definition: xv3d_types.h:47

References CLAYER_TRIANGLE_CONTAINER::AddTriangle(), CLAYER_TRIANGLES::m_layer_bot_triangles, and CLAYER_TRIANGLES::m_layer_top_triangles.

Referenced by add_object_to_triangle_layer(), generate_3D_Vias_and_Pads(), and reload().

◆ CreateBusyIndicator()

std::unique_ptr< BUSY_INDICATOR > C3D_RENDER_BASE::CreateBusyIndicator ( ) const
protectedinherited

Return a created busy indicator, if a factory has been set, else a null pointer.

Definition at line 65 of file c3d_render_base.cpp.

66 {
67  std::unique_ptr<BUSY_INDICATOR> busy;
68 
70  busy = m_busyIndicatorFactory();
71 
72  return busy;
73 }
BUSY_INDICATOR::FACTORY m_busyIndicatorFactory
Factory that returns a suitable busy indicator for the context.

References C3D_RENDER_BASE::m_busyIndicatorFactory.

Referenced by Redraw(), and C3D_RENDER_RAYTRACING::Redraw().

◆ generate_3D_Vias_and_Pads()

void C3D_RENDER_OGL_LEGACY::generate_3D_Vias_and_Pads ( )
private

Definition at line 733 of file c3d_render_createscene_ogl_legacy.cpp.

734 {
736  {
737  const unsigned int reserve_nr_triangles_estimation =
739  8 *
741 
742  CLAYER_TRIANGLES *layerTriangleVIA = new CLAYER_TRIANGLES( reserve_nr_triangles_estimation );
743 
744  // Insert plated vertical holes inside the board
745  // /////////////////////////////////////////////////////////////////////////
746 
747  // Insert vias holes (vertical cylinders)
748  for( auto track : m_boardAdapter.GetBoard()->Tracks() )
749  {
750  if( track->Type() == PCB_VIA_T )
751  {
752  const VIA *via = static_cast<const VIA*>(track);
753 
754  const float holediameter = via->GetDrillValue() * m_boardAdapter.BiuTo3Dunits();
755  const float thickness = m_boardAdapter.GetCopperThickness3DU();
756  const int nrSegments = m_boardAdapter.GetNrSegmentsCircle( via->GetDrillValue() );
757  const double correctionFactor = m_boardAdapter.GetCircleCorrectionFactor( nrSegments );
758  const float hole_inner_radius = ( holediameter / 2.0f ) * correctionFactor;
759 
760  const SFVEC2F via_center( via->GetStart().x * m_boardAdapter.BiuTo3Dunits(),
761  -via->GetStart().y * m_boardAdapter.BiuTo3Dunits() );
762 
763  PCB_LAYER_ID top_layer, bottom_layer;
764  via->LayerPair( &top_layer, &bottom_layer );
765 
766  float ztop, zbot, dummy;
767 
768  get_layer_z_pos( top_layer, ztop, dummy );
769  get_layer_z_pos( bottom_layer, dummy, zbot );
770 
771  wxASSERT( zbot < ztop );
772 
773  generate_cylinder( via_center,
774  hole_inner_radius,
775  hole_inner_radius + thickness,
776  ztop,
777  zbot,
778  nrSegments,
779  layerTriangleVIA );
780  }
781  }
782 
783  m_ogl_disp_list_via = new CLAYERS_OGL_DISP_LISTS( *layerTriangleVIA,
784  0,
785  0.0f,
786  0.0f );
787 
788  delete layerTriangleVIA;
789  }
790 
791 
793  {
794  SHAPE_POLY_SET tht_outer_holes_poly; // Stores the outer poly of the copper holes (the pad)
795  SHAPE_POLY_SET tht_inner_holes_poly; // Stores the inner poly of the copper holes (the hole)
796 
797  tht_outer_holes_poly.RemoveAllContours();
798  tht_inner_holes_poly.RemoveAllContours();
799 
800  // Insert pads holes (vertical cylinders)
801  for( const auto module : m_boardAdapter.GetBoard()->Modules() )
802  {
803  for( auto pad : module->Pads() )
804  {
805  if( pad->GetAttribute() != PAD_ATTRIB_HOLE_NOT_PLATED )
806  {
807  const wxSize drillsize = pad->GetDrillSize();
808  const bool hasHole = drillsize.x && drillsize.y;
809 
810  if( !hasHole )
811  continue;
812 
813  // we use the hole diameter to calculate the seg count.
814  // for round holes, drillsize.x == drillsize.y
815  // for slots, the diameter is the smaller of (drillsize.x, drillsize.y)
816  int copperThickness = m_boardAdapter.GetCopperThicknessBIU();
817  int radius = std::min( drillsize.x, drillsize.y ) / 2 + copperThickness;
818  int nrSegments = m_boardAdapter.GetNrSegmentsCircle( radius * 2 );
819  double correctionFactor = m_boardAdapter.GetCircleCorrectionFactor( nrSegments );
820  int correction = radius * ( correctionFactor - 1 );
821 
822  pad->TransformHoleWithClearanceToPolygon( tht_outer_holes_poly,
823  copperThickness + correction );
824 
825  pad->TransformHoleWithClearanceToPolygon( tht_inner_holes_poly, correction );
826  }
827  }
828  }
829 
830  // Subtract the holes
831  tht_outer_holes_poly.BooleanSubtract( tht_inner_holes_poly, SHAPE_POLY_SET::PM_FAST );
832 
833 
834  CCONTAINER2D holesContainer;
835 
836  Convert_shape_line_polygon_to_triangles( tht_outer_holes_poly,
837  holesContainer,
839  (const BOARD_ITEM &)*m_boardAdapter.GetBoard() );
840 
841  const LIST_OBJECT2D &listHolesObject2d = holesContainer.GetList();
842 
843  if( listHolesObject2d.size() > 0 )
844  {
845  float layer_z_top, layer_z_bot, dummy;
846 
847  get_layer_z_pos( F_Cu, layer_z_top, dummy );
848  get_layer_z_pos( B_Cu, dummy, layer_z_bot );
849 
850  CLAYER_TRIANGLES *layerTriangles = new CLAYER_TRIANGLES( listHolesObject2d.size() );
851 
852  // Convert the list of objects(triangles) to triangle layer structure
853  for( LIST_OBJECT2D::const_iterator itemOnLayer = listHolesObject2d.begin();
854  itemOnLayer != listHolesObject2d.end();
855  ++itemOnLayer )
856  {
857  const COBJECT2D *object2d_A = static_cast<const COBJECT2D *>(*itemOnLayer);
858 
859  wxASSERT( object2d_A->GetObjectType() == OBJECT2D_TYPE::TRIANGLE );
860 
861  const CTRIANGLE2D *tri = (const CTRIANGLE2D *)object2d_A;
862 
863  const SFVEC2F &v1 = tri->GetP1();
864  const SFVEC2F &v2 = tri->GetP2();
865  const SFVEC2F &v3 = tri->GetP3();
866 
867  add_triangle_top_bot( layerTriangles, v1, v2, v3,
868  layer_z_top, layer_z_bot );
869  }
870 
871  wxASSERT( tht_outer_holes_poly.OutlineCount() > 0 );
872 
873  if( tht_outer_holes_poly.OutlineCount() > 0 )
874  {
875  layerTriangles->AddToMiddleContourns( tht_outer_holes_poly,
876  layer_z_bot, layer_z_top,
878  false );
879 
881  *layerTriangles,
882  m_ogl_circle_texture, // not need
883  layer_z_top, layer_z_top );
884  }
885 
886  delete layerTriangles;
887  }
888  }
889 }
double BiuTo3Dunits() const noexcept
BiuTo3Dunits - Board integer units To 3D units.
void LayerPair(PCB_LAYER_ID *top_layer, PCB_LAYER_ID *bottom_layer) const
Function LayerPair Return the 2 layers used by the via (the via actually uses all layers between thes...
int OutlineCount() const
Returns the number of outlines in the set
The CLAYER_TRIANGLES class stores arrays of triangles to be used to create display lists.
OBJECT2D_TYPE GetObjectType() const
Definition: cobject2d.h:125
like PAD_STANDARD, but not plated mechanical use only, no connection allowed
Definition: pad_shapes.h:85
BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class,...
const wxPoint & GetStart() const
Definition: class_track.h:118
float GetCopperThickness3DU() const noexcept
GetCopperThickness3DU - Get the current copper layer thickness.
double GetCircleCorrectionFactor(int aNrSides) const
GetCircleCorrectionFactor - computes a angle correction factor used when creating circles.
void get_layer_z_pos(PCB_LAYER_ID aLayerID, float &aOutZtop, float &aOutZbot) const
PCB_LAYER_ID
A quick note on layer IDs:
unsigned int GetNrSegmentsCircle(float aDiameter3DU) const
GetNrSegmentsCircle.
glm::vec2 SFVEC2F
Definition: xv3d_types.h:45
int GetDrillValue() const
Function GetDrillValue "calculates" the drill value for vias (m-Drill if > 0, or default drill value ...
MODULES & Modules()
Definition: class_board.h:266
int GetCopperThicknessBIU() const noexcept
GetCopperThicknessBIU - Get the current copper layer thickness.
SHAPE_POLY_SET.
const BOARD * GetBoard() const noexcept
GetBoard - Get current board to be rendered.
void AddToMiddleContourns(const SHAPE_LINE_CHAIN &outlinePath, float zBot, float zTop, double aBiuTo3Du, bool aInvertFaceDirection)
CLAYERS_OGL_DISP_LISTS * m_ogl_disp_list_via
BOARD_ADAPTER & m_boardAdapter
settings refrence in use for this render
The CLAYERS_OGL_DISP_LISTS class stores the openGL display lists to related with a layer.
static LIB_PART * dummy()
Used to draw a dummy shape when a LIB_PART is not found in library.
std::list< COBJECT2D * > LIST_OBJECT2D
Definition: ccontainer2d.h:37
const SFVEC2F & GetP1() const
Definition: ctriangle2d.h:58
unsigned int GetStats_Nr_Holes() const noexcept
GetStats_Nr_Holes - Get statistics of the nr of holes.
void RemoveAllContours()
Removes all outlines & holes (clears) the polygon set.
unsigned int GetStats_Nr_Vias() const noexcept
GetStats_Nr_Vias - Get statistics of the nr of vias.
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:97
float GetStats_Med_Via_Hole_Diameter3DU() const noexcept
GetStats_Med_Via_Hole_Diameter3DU - Average diameter of the via holes.
void BooleanSubtract(const SHAPE_POLY_SET &b, POLYGON_MODE aFastMode)
Performs boolean polyset difference For aFastMode meaning, see function booleanOp
void add_triangle_top_bot(CLAYER_TRIANGLES *aDst, const SFVEC2F &v0, const SFVEC2F &v1, const SFVEC2F &v2, float top, float bot)
CLAYERS_OGL_DISP_LISTS * m_ogl_disp_list_pads_holes
const LIST_OBJECT2D & GetList() const
Definition: ccontainer2d.h:64
TRACKS & Tracks()
Definition: class_board.h:257
void Convert_shape_line_polygon_to_triangles(SHAPE_POLY_SET &aPolyList, CGENERICCONTAINER2D &aDstContainer, float aBiuTo3DunitsScale, const BOARD_ITEM &aBoardItem)
void generate_cylinder(const SFVEC2F &aCenter, float aInnerRadius, float aOuterRadius, float aZtop, float aZbot, unsigned int aNr_sides_per_circle, CLAYER_TRIANGLES *aDstLayer)

References add_triangle_top_bot(), CLAYER_TRIANGLES::AddToMiddleContourns(), B_Cu, BOARD_ADAPTER::BiuTo3Dunits(), SHAPE_POLY_SET::BooleanSubtract(), Convert_shape_line_polygon_to_triangles(), dummy(), F_Cu, generate_cylinder(), get_layer_z_pos(), BOARD_ADAPTER::GetBoard(), BOARD_ADAPTER::GetCircleCorrectionFactor(), BOARD_ADAPTER::GetCopperThickness3DU(), BOARD_ADAPTER::GetCopperThicknessBIU(), VIA::GetDrillValue(), CGENERICCONTAINER2D::GetList(), BOARD_ADAPTER::GetNrSegmentsCircle(), COBJECT2D::GetObjectType(), TRACK::GetStart(), BOARD_ADAPTER::GetStats_Med_Via_Hole_Diameter3DU(), BOARD_ADAPTER::GetStats_Nr_Holes(), BOARD_ADAPTER::GetStats_Nr_Vias(), VIA::LayerPair(), C3D_RENDER_BASE::m_boardAdapter, m_ogl_circle_texture, m_ogl_disp_list_pads_holes, m_ogl_disp_list_via, BOARD::Modules(), SHAPE_POLY_SET::OutlineCount(), PAD_ATTRIB_HOLE_NOT_PLATED, PCB_VIA_T, SHAPE_POLY_SET::PM_FAST, SHAPE_POLY_SET::RemoveAllContours(), BOARD::Tracks(), TRIANGLE, wxPoint::x, and wxPoint::y.

Referenced by reload().

◆ generate_cylinder()

void C3D_RENDER_OGL_LEGACY::generate_cylinder ( const SFVEC2F aCenter,
float  aInnerRadius,
float  aOuterRadius,
float  aZtop,
float  aZbot,
unsigned int  aNr_sides_per_circle,
CLAYER_TRIANGLES aDstLayer 
)
private

Definition at line 691 of file c3d_render_createscene_ogl_legacy.cpp.

698 {
699  std::vector< SFVEC2F > innerContour;
700  std::vector< SFVEC2F > outerContour;
701 
702  generate_ring_contour( aCenter,
703  aInnerRadius,
704  aOuterRadius,
705  aNr_sides_per_circle,
706  innerContour,
707  outerContour,
708  false );
709 
710  for( unsigned int i = 0; i < ( innerContour.size() - 1 ); ++i )
711  {
712  const SFVEC2F &vi0 = innerContour[i + 0];
713  const SFVEC2F &vi1 = innerContour[i + 1];
714  const SFVEC2F &vo0 = outerContour[i + 0];
715  const SFVEC2F &vo1 = outerContour[i + 1];
716 
717  aDstLayer->m_layer_top_triangles->AddQuad( SFVEC3F( vi1.x, vi1.y, aZtop ),
718  SFVEC3F( vi0.x, vi0.y, aZtop ),
719  SFVEC3F( vo0.x, vo0.y, aZtop ),
720  SFVEC3F( vo1.x, vo1.y, aZtop ) );
721 
722  aDstLayer->m_layer_bot_triangles->AddQuad( SFVEC3F( vi1.x, vi1.y, aZbot ),
723  SFVEC3F( vo1.x, vo1.y, aZbot ),
724  SFVEC3F( vo0.x, vo0.y, aZbot ),
725  SFVEC3F( vi0.x, vi0.y, aZbot ) );
726  }
727 
728  aDstLayer->AddToMiddleContourns( outerContour, aZbot, aZtop, true );
729  aDstLayer->AddToMiddleContourns( innerContour, aZbot, aZtop, false );
730 }
void generate_ring_contour(const SFVEC2F &aCenter, float aInnerRadius, float aOuterRadius, unsigned int aNr_sides_per_circle, std::vector< SFVEC2F > &aInnerContourResult, std::vector< SFVEC2F > &aOuterContourResult, bool aInvertOrder)
glm::vec2 SFVEC2F
Definition: xv3d_types.h:45
CLAYER_TRIANGLE_CONTAINER * m_layer_top_triangles
void AddToMiddleContourns(const SHAPE_LINE_CHAIN &outlinePath, float zBot, float zTop, double aBiuTo3Du, bool aInvertFaceDirection)
CLAYER_TRIANGLE_CONTAINER * m_layer_bot_triangles
glm::vec3 SFVEC3F
Definition: xv3d_types.h:47
void AddQuad(const SFVEC3F &aV1, const SFVEC3F &aV2, const SFVEC3F &aV3, const SFVEC3F &aV4)
AddQuad.

References CLAYER_TRIANGLE_CONTAINER::AddQuad(), CLAYER_TRIANGLES::AddToMiddleContourns(), generate_ring_contour(), CLAYER_TRIANGLES::m_layer_bot_triangles, and CLAYER_TRIANGLES::m_layer_top_triangles.

Referenced by generate_3D_Vias_and_Pads().

◆ generate_holes_display_list()

CLAYERS_OGL_DISP_LISTS * C3D_RENDER_OGL_LEGACY::generate_holes_display_list ( const LIST_OBJECT2D aListHolesObject2d,
const SHAPE_POLY_SET aPoly,
float  aZtop,
float  aZbot,
bool  aInvertFaces 
)
private

Definition at line 270 of file c3d_render_createscene_ogl_legacy.cpp.

276 {
278 
279  if( aListHolesObject2d.size() > 0 )
280  {
281  CLAYER_TRIANGLES *layerTriangles = new CLAYER_TRIANGLES( aListHolesObject2d.size() * 2 );
282 
283  // Convert the list of objects(filled circles) to triangle layer structure
284  for( LIST_OBJECT2D::const_iterator itemOnLayer = aListHolesObject2d.begin();
285  itemOnLayer != aListHolesObject2d.end();
286  ++itemOnLayer )
287  {
288  const COBJECT2D* object2d_A = static_cast<const COBJECT2D*>( *itemOnLayer );
289 
290  wxASSERT( ( object2d_A->GetObjectType() == OBJECT2D_TYPE::FILLED_CIRCLE )
291  || ( object2d_A->GetObjectType() == OBJECT2D_TYPE::ROUNDSEG ) );
292 
293  switch( object2d_A->GetObjectType() )
294  {
296  add_object_to_triangle_layer( static_cast<const CFILLEDCIRCLE2D*>( object2d_A ),
297  layerTriangles, aZtop, aZbot );
298  break;
299 
301  add_object_to_triangle_layer( static_cast<const CROUNDSEGMENT2D*>( object2d_A ),
302  layerTriangles, aZtop, aZbot );
303  break;
304 
305  default:
306  wxFAIL_MSG(
307  "C3D_RENDER_OGL_LEGACY::generate_holes_display_list: Object type is not implemented" );
308  break;
309  }
310  }
311 
312  // Note: he can have a aListHolesObject2d whith holes but without countours
313  // eg: when there are only NPTH on the list and the contours were not
314  // added
315 
316  if( aPoly.OutlineCount() > 0 )
317  {
318  layerTriangles->AddToMiddleContourns( aPoly,
319  aZbot,
320  aZtop,
322  aInvertFaces );
323  }
324 
325  ret = new CLAYERS_OGL_DISP_LISTS( *layerTriangles,
327  aZbot,
328  aZtop );
329 
330  delete layerTriangles;
331  }
332 
333  return ret;
334 }
double BiuTo3Dunits() const noexcept
BiuTo3Dunits - Board integer units To 3D units.
void add_object_to_triangle_layer(const CRING2D *aRing, CLAYER_TRIANGLES *aDstLayer, float aZtop, float aZbot)
int OutlineCount() const
Returns the number of outlines in the set
The CLAYER_TRIANGLES class stores arrays of triangles to be used to create display lists.
OBJECT2D_TYPE GetObjectType() const
Definition: cobject2d.h:125
#define NULL
void AddToMiddleContourns(const SHAPE_LINE_CHAIN &outlinePath, float zBot, float zTop, double aBiuTo3Du, bool aInvertFaceDirection)
BOARD_ADAPTER & m_boardAdapter
settings refrence in use for this render
The CLAYERS_OGL_DISP_LISTS class stores the openGL display lists to related with a layer.

References add_object_to_triangle_layer(), CLAYER_TRIANGLES::AddToMiddleContourns(), BOARD_ADAPTER::BiuTo3Dunits(), FILLED_CIRCLE, COBJECT2D::GetObjectType(), C3D_RENDER_BASE::m_boardAdapter, m_ogl_circle_texture, NULL, SHAPE_POLY_SET::OutlineCount(), and ROUNDSEG.

Referenced by reload().

◆ generate_new_3DGrid()

void C3D_RENDER_OGL_LEGACY::generate_new_3DGrid ( GRID3D_TYPE  aGridType)
private

Definition at line 1283 of file c3d_render_ogl_legacy.cpp.

1284 {
1285  if( glIsList( m_ogl_disp_list_grid ) )
1286  glDeleteLists( m_ogl_disp_list_grid, 1 );
1287 
1289 
1290  if( aGridType == GRID3D_TYPE::NONE )
1291  return;
1292 
1293  m_ogl_disp_list_grid = glGenLists( 1 );
1294 
1295  if( !glIsList( m_ogl_disp_list_grid ) )
1296  return;
1297 
1298  glNewList( m_ogl_disp_list_grid, GL_COMPILE );
1299 
1300  glEnable( GL_BLEND );
1301  glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
1302 
1303  const double zpos = 0.0;
1304 
1305  // Color of grid lines
1306  const SFVEC3F gridColor = m_boardAdapter.GetColor( DARKGRAY );
1307 
1308  // Color of grid lines every 5 lines
1309  const SFVEC3F gridColor_marker = m_boardAdapter.GetColor( LIGHTGRAY );
1310  const double scale = m_boardAdapter.BiuTo3Dunits();
1311  const double transparency = 0.35;
1312 
1313  double griSizeMM = 0.0;
1314 
1315  switch( aGridType )
1316  {
1317  default:
1318  case GRID3D_TYPE::NONE:
1319  return;
1320  case GRID3D_TYPE::GRID_1MM:
1321  griSizeMM = 1.0;
1322  break;
1324  griSizeMM = 2.5;
1325  break;
1326  case GRID3D_TYPE::GRID_5MM:
1327  griSizeMM = 5.0;
1328  break;
1330  griSizeMM = 10.0;
1331  break;
1332  }
1333 
1334  glNormal3f( 0.0, 0.0, 1.0 );
1335 
1336  const wxSize brd_size = m_boardAdapter.GetBoardSizeBIU();
1337  wxPoint brd_center_pos = m_boardAdapter.GetBoardPosBIU();
1338 
1339  brd_center_pos.y = -brd_center_pos.y;
1340 
1341  const int xsize = std::max( brd_size.x, Millimeter2iu( 100 ) ) * 1.2;
1342  const int ysize = std::max( brd_size.y, Millimeter2iu( 100 ) ) * 1.2;
1343 
1344  // Grid limits, in 3D units
1345  double xmin = (brd_center_pos.x - xsize / 2) * scale;
1346  double xmax = (brd_center_pos.x + xsize / 2) * scale;
1347  double ymin = (brd_center_pos.y - ysize / 2) * scale;
1348  double ymax = (brd_center_pos.y + ysize / 2) * scale;
1349  double zmin = Millimeter2iu( -50 ) * scale;
1350  double zmax = Millimeter2iu( 100 ) * scale;
1351 
1352  // Draw horizontal grid centered on 3D origin (center of the board)
1353  for( int ii = 0; ; ii++ )
1354  {
1355  if( (ii % 5) )
1356  glColor4f( gridColor.r, gridColor.g, gridColor.b, transparency );
1357  else
1358  glColor4f( gridColor_marker.r,
1359  gridColor_marker.g,
1360  gridColor_marker.b,
1361  transparency );
1362 
1363  const int delta = KiROUND( ii * griSizeMM * IU_PER_MM );
1364 
1365  if( delta <= xsize / 2 ) // Draw grid lines parallel to X axis
1366  {
1367  glBegin( GL_LINES );
1368  glVertex3f( (brd_center_pos.x + delta) * scale, -ymin, zpos );
1369  glVertex3f( (brd_center_pos.x + delta) * scale, -ymax, zpos );
1370  glEnd();
1371 
1372  if( ii != 0 )
1373  {
1374  glBegin( GL_LINES );
1375  glVertex3f( (brd_center_pos.x - delta) * scale, -ymin, zpos );
1376  glVertex3f( (brd_center_pos.x - delta) * scale, -ymax, zpos );
1377  glEnd();
1378  }
1379  }
1380 
1381  if( delta <= ysize / 2 ) // Draw grid lines parallel to Y axis
1382  {
1383  glBegin( GL_LINES );
1384  glVertex3f( xmin, -(brd_center_pos.y + delta) * scale, zpos );
1385  glVertex3f( xmax, -(brd_center_pos.y + delta) * scale, zpos );
1386  glEnd();
1387 
1388  if( ii != 0 )
1389  {
1390  glBegin( GL_LINES );
1391  glVertex3f( xmin, -(brd_center_pos.y - delta) * scale, zpos );
1392  glVertex3f( xmax, -(brd_center_pos.y - delta) * scale, zpos );
1393  glEnd();
1394  }
1395  }
1396 
1397  if( ( delta > ysize / 2 ) && ( delta > xsize / 2 ) )
1398  break;
1399  }
1400 
1401  // Draw vertical grid on Z axis
1402  glNormal3f( 0.0, -1.0, 0.0 );
1403 
1404  // Draw vertical grid lines (parallel to Z axis)
1405  double posy = -brd_center_pos.y * scale;
1406 
1407  for( int ii = 0; ; ii++ )
1408  {
1409  if( (ii % 5) )
1410  glColor4f( gridColor.r, gridColor.g, gridColor.b, transparency );
1411  else
1412  glColor4f( gridColor_marker.r,
1413  gridColor_marker.g,
1414  gridColor_marker.b,
1415  transparency );
1416 
1417  const double delta = ii * griSizeMM * IU_PER_MM;
1418 
1419  glBegin( GL_LINES );
1420  xmax = (brd_center_pos.x + delta) * scale;
1421 
1422  glVertex3f( xmax, posy, zmin );
1423  glVertex3f( xmax, posy, zmax );
1424  glEnd();
1425 
1426  if( ii != 0 )
1427  {
1428  glBegin( GL_LINES );
1429  xmin = (brd_center_pos.x - delta) * scale;
1430  glVertex3f( xmin, posy, zmin );
1431  glVertex3f( xmin, posy, zmax );
1432  glEnd();
1433  }
1434 
1435  if( delta > xsize / 2.0f )
1436  break;
1437  }
1438 
1439  // Draw horizontal grid lines on Z axis (parallel to X axis)
1440  for( int ii = 0; ; ii++ )
1441  {
1442  if( (ii % 5) )
1443  glColor4f( gridColor.r, gridColor.g, gridColor.b, transparency );
1444  else
1445  glColor4f( gridColor_marker.r,
1446  gridColor_marker.g,
1447  gridColor_marker.b,
1448  transparency );
1449 
1450  const double delta = ii * griSizeMM * IU_PER_MM * scale;
1451 
1452  if( delta <= zmax )
1453  {
1454  // Draw grid lines on Z axis (positive Z axis coordinates)
1455  glBegin( GL_LINES );
1456  glVertex3f( xmin, posy, delta );
1457  glVertex3f( xmax, posy, delta );
1458  glEnd();
1459  }
1460 
1461  if( delta <= -zmin && ( ii != 0 ) )
1462  {
1463  // Draw grid lines on Z axis (negative Z axis coordinates)
1464  glBegin( GL_LINES );
1465  glVertex3f( xmin, posy, -delta );
1466  glVertex3f( xmax, posy, -delta );
1467  glEnd();
1468  }
1469 
1470  if( ( delta > zmax ) && ( delta > -zmin ) )
1471  break;
1472  }
1473 
1474  glDisable( GL_BLEND );
1475 
1476  glEndList();
1477 }
double BiuTo3Dunits() const noexcept
BiuTo3Dunits - Board integer units To 3D units.
static constexpr double IU_PER_MM
Mock up a conversion function.
wxSize GetBoardSizeBIU() const noexcept
GetBoardSizeBIU - Get the board size.
BOARD_ADAPTER & m_boardAdapter
settings refrence in use for this render
GLuint m_ogl_disp_list_grid
oGL list that stores current grid
const int scale
glm::vec3 SFVEC3F
Definition: xv3d_types.h:47
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: util.h:68
wxPoint GetBoardPosBIU() const noexcept
GetBoardPosBIU - Get the board size.
SFVEC3F GetColor(COLOR4D aColor) const
GetColor.
static constexpr int Millimeter2iu(double mm)

References BOARD_ADAPTER::BiuTo3Dunits(), DARKGRAY, BOARD_ADAPTER::GetBoardPosBIU(), BOARD_ADAPTER::GetBoardSizeBIU(), BOARD_ADAPTER::GetColor(), GRID_10MM, GRID_1MM, GRID_2P5MM, GRID_5MM, IU_PER_MM, KiROUND(), LIGHTGRAY, C3D_RENDER_BASE::m_boardAdapter, m_ogl_disp_list_grid, Millimeter2iu(), NONE, scale, wxPoint::x, and wxPoint::y.

Referenced by Redraw().

◆ generate_ring_contour()

void C3D_RENDER_OGL_LEGACY::generate_ring_contour ( const SFVEC2F aCenter,
float  aInnerRadius,
float  aOuterRadius,
unsigned int  aNr_sides_per_circle,
std::vector< SFVEC2F > &  aInnerContourResult,
std::vector< SFVEC2F > &  aOuterContourResult,
bool  aInvertOrder 
)
private

Definition at line 93 of file c3d_render_createscene_ogl_legacy.cpp.

100 {
101  aInnerContourResult.clear();
102  aInnerContourResult.reserve( aNr_sides_per_circle + 2 );
103 
104  aOuterContourResult.clear();
105  aOuterContourResult.reserve( aNr_sides_per_circle + 2 );
106 
107  const int delta = 3600 / aNr_sides_per_circle;
108 
109  for( int ii = 0; ii < 3600; ii += delta )
110  {
111  float angle = (float)( aInvertOrder ? ( 3600 - ii ) : ii )
112  * 2.0f * glm::pi<float>() / 3600.0f;
113  const SFVEC2F rotatedDir = SFVEC2F( cos( angle ), sin( angle ) );
114 
115  aInnerContourResult.emplace_back( aCenter.x + rotatedDir.x * aInnerRadius,
116  aCenter.y + rotatedDir.y * aInnerRadius );
117 
118  aOuterContourResult.emplace_back( aCenter.x + rotatedDir.x * aOuterRadius,
119  aCenter.y + rotatedDir.y * aOuterRadius );
120  }
121 
122  aInnerContourResult.push_back( aInnerContourResult[0] );
123  aOuterContourResult.push_back( aOuterContourResult[0] );
124 
125  wxASSERT( aInnerContourResult.size() == aOuterContourResult.size() );
126 }
glm::vec2 SFVEC2F
Definition: xv3d_types.h:45
static DIRECTION_45::AngleType angle(const VECTOR2I &a, const VECTOR2I &b)

References PNS::angle().

Referenced by add_object_to_triangle_layer(), and generate_cylinder().

◆ get_layer_color()

SFVEC3F C3D_RENDER_OGL_LEGACY::get_layer_color ( PCB_LAYER_ID  aLayerID)
private

Definition at line 424 of file c3d_render_ogl_legacy.cpp.

425 {
426  SFVEC3F layerColor = m_boardAdapter.GetLayerColor( aLayerID );
427 
429  {
430  switch( aLayerID )
431  {
432  case B_Adhes:
433  case F_Adhes:
434  break;
435 
436  case B_Mask:
438  break;
439  case F_Mask:
441  break;
442 
443  case B_Paste:
444  case F_Paste:
445  layerColor = m_boardAdapter.m_SolderPasteColor;
446  break;
447 
448  case B_SilkS:
450  break;
451  case F_SilkS:
453  break;
454 
455  case Dwgs_User:
456  case Cmts_User:
457  case Eco1_User:
458  case Eco2_User:
459  case Edge_Cuts:
460  case Margin:
461  break;
462 
463  case B_CrtYd:
464  case F_CrtYd:
465  break;
466 
467  case B_Fab:
468  case F_Fab:
469  break;
470 
471  default:
472  layerColor = m_boardAdapter.m_CopperColor;
473  break;
474  }
475  }
476 
477  return layerColor;
478 }
bool GetFlag(DISPLAY3D_FLG aFlag) const
GetFlag - get a configuration status of a flag.
SFVEC3D m_SolderPasteColor
in realistic mode: solder paste color
SFVEC3D m_SolderMaskColorBot
in realistic mode: solder mask color ( bot )
SFVEC3D m_SilkScreenColorBot
in realistic mode: SilkScreen color ( bot )
SFVEC3F GetLayerColor(PCB_LAYER_ID aLayerId) const
GetLayerColor - get the technical color of a layer.
BOARD_ADAPTER & m_boardAdapter
settings refrence in use for this render
SFVEC3D m_SolderMaskColorTop
in realistic mode: solder mask color ( top )
SFVEC3D m_SilkScreenColorTop
in realistic mode: SilkScreen color ( top )
glm::vec3 SFVEC3F
Definition: xv3d_types.h:47
SFVEC3D m_CopperColor
in realistic mode: copper color

References B_Adhes, B_CrtYd, B_Fab, B_Mask, B_Paste, B_SilkS, Cmts_User, Dwgs_User, Eco1_User, Eco2_User, Edge_Cuts, F_Adhes, F_CrtYd, F_Fab, F_Mask, F_Paste, F_SilkS, FL_USE_REALISTIC_MODE, BOARD_ADAPTER::GetFlag(), BOARD_ADAPTER::GetLayerColor(), C3D_RENDER_BASE::m_boardAdapter, BOARD_ADAPTER::m_CopperColor, BOARD_ADAPTER::m_SilkScreenColorBot, BOARD_ADAPTER::m_SilkScreenColorTop, BOARD_ADAPTER::m_SolderMaskColorBot, BOARD_ADAPTER::m_SolderMaskColorTop, BOARD_ADAPTER::m_SolderPasteColor, and Margin.

Referenced by set_layer_material().

◆ get_layer_z_pos()

void C3D_RENDER_OGL_LEGACY::get_layer_z_pos ( PCB_LAYER_ID  aLayerID,
float &  aOutZtop,
float &  aOutZbot 
) const
private

Definition at line 675 of file c3d_render_createscene_ogl_legacy.cpp.

678 {
679  aOutZbot = m_boardAdapter.GetLayerBottomZpos3DU( aLayerID );
680  aOutZtop = m_boardAdapter.GetLayerTopZpos3DU( aLayerID );
681 
682  if( aOutZtop < aOutZbot )
683  {
684  float tmpFloat = aOutZbot;
685  aOutZbot = aOutZtop;
686  aOutZtop = tmpFloat;
687  }
688 }
float GetLayerTopZpos3DU(PCB_LAYER_ID aLayerId) const noexcept
GetLayerTopZpos3DU - Get the top z position.
float GetLayerBottomZpos3DU(PCB_LAYER_ID aLayerId) const noexcept
GetLayerBottomZpos3DU - Get the bottom z position.
BOARD_ADAPTER & m_boardAdapter
settings refrence in use for this render

References BOARD_ADAPTER::GetLayerBottomZpos3DU(), BOARD_ADAPTER::GetLayerTopZpos3DU(), and C3D_RENDER_BASE::m_boardAdapter.

Referenced by generate_3D_Vias_and_Pads(), and reload().

◆ GetWaitForEditingTimeOut()

int C3D_RENDER_OGL_LEGACY::GetWaitForEditingTimeOut ( )
overridevirtual

GetWaitForEditingTimeOut - Give the interface the time (in ms) that it should wait for editing or movements before (this works for display preview mode)

Returns
a value in miliseconds

Implements C3D_RENDER_BASE.

Definition at line 90 of file c3d_render_ogl_legacy.cpp.

91 {
92  return 50; // ms
93 }

◆ initializeOpenGL()

bool C3D_RENDER_OGL_LEGACY::initializeOpenGL ( )
private

Definition at line 938 of file c3d_render_ogl_legacy.cpp.

939 {
940  glEnable( GL_LINE_SMOOTH );
941  glShadeModel( GL_SMOOTH );
942 
943  // 4-byte pixel alignment
944  glPixelStorei( GL_UNPACK_ALIGNMENT, 4 );
945 
946  // Initialize the open GL texture to draw the filled semi-circle of the segments
948 
949  if( !circleImage )
950  return false;
951 
952  circleImage->CircleFilled( (SIZE_OF_CIRCLE_TEXTURE / 2) - 0,
953  (SIZE_OF_CIRCLE_TEXTURE / 2) - 0,
954  (SIZE_OF_CIRCLE_TEXTURE / 2) - 4,
955  0xFF );
956 
957  //circleImage->CircleFilled( (SIZE_OF_CIRCLE_TEXTURE / 4)*1.5f - 1,
958  // (SIZE_OF_CIRCLE_TEXTURE / 4)*1.5f - 1,
959  // (SIZE_OF_CIRCLE_TEXTURE / 4)*1.5f - 2, 0xFF );
960 
961  CIMAGE *circleImage_Copy = new CIMAGE( *circleImage );
962 
963  circleImage->EfxFilter( circleImage_Copy, IMAGE_FILTER::BLUR_3X3 );
964 
965  m_ogl_circle_texture = OGL_LoadTexture( *circleImage );
966 
967  //circleImage_Copy->SaveAsPNG("circleImage.png");
968  delete circleImage_Copy;
969  circleImage_Copy = 0;
970 
971  //circleImage->SaveAsPNG("circleImage_blured.png");
972  delete circleImage;
973  circleImage = 0;
974 
975  init_lights();
976 
977  // Use this mode if you want see the triangle lines (debug proposes)
978  //glPolygonMode( GL_FRONT_AND_BACK, GL_LINE );
979 
981 
982  return true;
983 }
void init_lights(void)
void CircleFilled(int aCx, int aCy, int aRadius, unsigned char aValue)
CircleFilled.
Definition: cimage.cpp:173
GLuint OGL_LoadTexture(const CIMAGE &aImage)
OGL_LoadTexture - generate a new OpenGL texture.
Definition: ogl_utils.cpp:81
bool m_is_opengl_initialized
flag if the opengl specific for this render was already initialized
#define SIZE_OF_CIRCLE_TEXTURE
CIMAGE manages a 8-bit channel image.
Definition: cimage.h:89
void EfxFilter(CIMAGE *aInImg, IMAGE_FILTER aFilterType)
Function EfxFilter apply a filter to the input image and stores it in the image class this <- FilterT...
Definition: cimage.cpp:472

References BLUR_3X3, CIMAGE::CircleFilled(), CIMAGE::EfxFilter(), init_lights(), C3D_RENDER_BASE::m_is_opengl_initialized, m_ogl_circle_texture, OGL_LoadTexture(), and SIZE_OF_CIRCLE_TEXTURE.

Referenced by Redraw().

◆ IsReloadRequestPending()

bool C3D_RENDER_BASE::IsReloadRequestPending ( ) const
inlineinherited

IsReloadRequestPending - Query if there is a pending reload request.

Returns
true if it wants to reload, false if there is no reload pending

Definition at line 82 of file c3d_render_base.h.

82 { return m_reloadRequested; }
bool m_reloadRequested
!TODO: this must be reviewed in order to flag change types

References C3D_RENDER_BASE::m_reloadRequested.

Referenced by EDA_3D_CANVAS::IsReloadRequestPending().

◆ load_3D_models()

void C3D_RENDER_OGL_LEGACY::load_3D_models ( REPORTER aStatusReporter)
private

Definition at line 898 of file c3d_render_createscene_ogl_legacy.cpp.

899 {
903  return;
904 
905  // Go for all modules
906  for( auto module : m_boardAdapter.GetBoard()->Modules() )
907  {
908  if( !module->Models().empty() )
909  {
910  // Get the list of model files for this model
911  auto sM = module->Models().begin();
912  auto eM = module->Models().end();
913 
914  while( sM != eM )
915  {
916  if( sM->m_Show && !sM->m_Filename.empty() )
917  {
918  if( aStatusReporter )
919  {
920  // Display the short filename of the 3D model loaded:
921  // (the full name is usually too long to be displayed)
922  wxFileName fn( sM->m_Filename );
923  wxString msg;
924  msg.Printf( _( "Loading %s" ), fn.GetFullName() );
925  aStatusReporter->Report( msg );
926  }
927 
928  // Check if the model is not present in our cache map
929  // (Not already loaded in memory)
930  if( m_3dmodel_map.find( sM->m_Filename ) == m_3dmodel_map.end() )
931  {
932  // It is not present, try get it from cache
933  const S3DMODEL *modelPtr =
934  m_boardAdapter.Get3DCacheManager()->GetModel( sM->m_Filename );
935 
936  // only add it if the return is not NULL
937  if( modelPtr )
938  {
939  C_OGL_3DMODEL* ogl_model =
940  new C_OGL_3DMODEL( *modelPtr,
942 
943  if( ogl_model )
944  m_3dmodel_map[ sM->m_Filename ] = ogl_model;
945  }
946  }
947  }
948 
949  ++sM;
950  }
951  }
952  }
953 }
bool GetFlag(DISPLAY3D_FLG aFlag) const
GetFlag - get a configuration status of a flag.
virtual REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED)=0
Function Report is a pure virtual function to override in the derived object.
S3DMODEL * GetModel(const wxString &aModelFileName)
Function GetModel attempts to load the scene data for a model and to translate it into an S3D_MODEL s...
Definition: 3d_cache.cpp:654
MODULES & Modules()
Definition: class_board.h:266
S3D_CACHE * Get3DCacheManager() const noexcept
Get3DCacheManager - Return the 3d cache manager pointer.
Definition: board_adapter.h:89
const BOARD * GetBoard() const noexcept
GetBoard - Get current board to be rendered.
BOARD_ADAPTER & m_boardAdapter
settings refrence in use for this render
#define _(s)
Definition: 3d_actions.cpp:33
Store the a model based on meshes and materials.
Definition: c3dmodel.h:90
MATERIAL_MODE MaterialModeGet() const noexcept
MaterialModeGet.

References _, FL_MODULE_ATTRIBUTES_NORMAL, FL_MODULE_ATTRIBUTES_NORMAL_INSERT, FL_MODULE_ATTRIBUTES_VIRTUAL, BOARD_ADAPTER::Get3DCacheManager(), BOARD_ADAPTER::GetBoard(), BOARD_ADAPTER::GetFlag(), S3D_CACHE::GetModel(), m_3dmodel_map, C3D_RENDER_BASE::m_boardAdapter, BOARD_ADAPTER::MaterialModeGet(), BOARD::Modules(), and REPORTER::Report().

Referenced by reload().

◆ ogl_free_all_display_lists()

void C3D_RENDER_OGL_LEGACY::ogl_free_all_display_lists ( )
private

Definition at line 1005 of file c3d_render_ogl_legacy.cpp.

1006 {
1007  if( glIsList( m_ogl_disp_list_grid ) )
1008  glDeleteLists( m_ogl_disp_list_grid, 1 );
1009 
1011 
1012  for( MAP_OGL_DISP_LISTS::const_iterator ii = m_ogl_disp_lists_layers.begin();
1013  ii != m_ogl_disp_lists_layers.end();
1014  ++ii )
1015  {
1016  CLAYERS_OGL_DISP_LISTS *pLayerDispList = static_cast<CLAYERS_OGL_DISP_LISTS*>(ii->second);
1017  delete pLayerDispList;
1018  }
1019 
1020  m_ogl_disp_lists_layers.clear();
1021 
1022 
1023  for( MAP_OGL_DISP_LISTS::const_iterator ii = m_ogl_disp_lists_layers_holes_outer.begin();
1025  ++ii )
1026  {
1027  CLAYERS_OGL_DISP_LISTS *pLayerDispList = static_cast<CLAYERS_OGL_DISP_LISTS*>(ii->second);
1028  delete pLayerDispList;
1029  }
1030 
1032 
1033 
1034  for( MAP_OGL_DISP_LISTS::const_iterator ii = m_ogl_disp_lists_layers_holes_inner.begin();
1036  ++ii )
1037  {
1038  CLAYERS_OGL_DISP_LISTS *pLayerDispList = static_cast<CLAYERS_OGL_DISP_LISTS*>(ii->second);
1039  delete pLayerDispList;
1040  }
1041 
1043 
1044  for( MAP_TRIANGLES::const_iterator ii = m_triangles.begin();
1045  ii != m_triangles.end();
1046  ++ii )
1047  {
1048  CLAYER_TRIANGLES *pointer = static_cast<CLAYER_TRIANGLES*>(ii->second);
1049  delete pointer;
1050  }
1051 
1052  m_triangles.clear();
1053 
1054 
1055  for( MAP_3DMODEL::const_iterator ii = m_3dmodel_map.begin();
1056  ii != m_3dmodel_map.end();
1057  ++ii )
1058  {
1059  C_OGL_3DMODEL *pointer = static_cast<C_OGL_3DMODEL*>(ii->second);
1060  delete pointer;
1061  }
1062 
1063  m_3dmodel_map.clear();
1064 
1065 
1066  delete m_ogl_disp_list_board;
1068 
1071 
1074 
1077 
1080 
1081  delete m_ogl_disp_list_via;
1082  m_ogl_disp_list_via = 0;
1083 
1086 
1089 }
MAP_OGL_DISP_LISTS m_ogl_disp_lists_layers
CLAYERS_OGL_DISP_LISTS * m_ogl_disp_list_through_holes_vias_outer_ring
The CLAYER_TRIANGLES class stores arrays of triangles to be used to create display lists.
MAP_OGL_DISP_LISTS m_ogl_disp_lists_layers_holes_outer
CLAYERS_OGL_DISP_LISTS * m_ogl_disp_list_through_holes_outer
CLAYERS_OGL_DISP_LISTS * m_ogl_disp_list_through_holes_vias_outer
CLAYERS_OGL_DISP_LISTS * m_ogl_disp_list_via
GLuint m_ogl_disp_list_grid
oGL list that stores current grid
MAP_OGL_DISP_LISTS m_ogl_disp_lists_layers_holes_inner
The CLAYERS_OGL_DISP_LISTS class stores the openGL display lists to related with a layer.
CLAYERS_OGL_DISP_LISTS * m_ogl_disp_list_through_holes_outer_with_npth
CLAYERS_OGL_DISP_LISTS * m_ogl_disp_list_board
CLAYERS_OGL_DISP_LISTS * m_ogl_disp_list_vias_and_pad_holes_outer_contourn_and_caps
CLAYERS_OGL_DISP_LISTS * m_ogl_disp_list_pads_holes

References m_3dmodel_map, m_ogl_disp_list_board, m_ogl_disp_list_grid, m_ogl_disp_list_pads_holes, m_ogl_disp_list_through_holes_outer, m_ogl_disp_list_through_holes_outer_with_npth, m_ogl_disp_list_through_holes_vias_outer, m_ogl_disp_list_through_holes_vias_outer_ring, m_ogl_disp_list_via, m_ogl_disp_list_vias_and_pad_holes_outer_contourn_and_caps, m_ogl_disp_lists_layers, m_ogl_disp_lists_layers_holes_inner, m_ogl_disp_lists_layers_holes_outer, and m_triangles.

Referenced by reload(), and ~C3D_RENDER_OGL_LEGACY().

◆ ogl_set_arrow_material()

void C3D_RENDER_OGL_LEGACY::ogl_set_arrow_material ( )
private

Definition at line 986 of file c3d_render_ogl_legacy.cpp.

987 {
988  glEnable( GL_COLOR_MATERIAL );
989  glColorMaterial( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE );
990 
991  const SFVEC4F ambient = SFVEC4F( 0.0f, 0.0f, 0.0f, 1.0f );
992  const SFVEC4F diffuse = SFVEC4F( 0.0f, 0.0f, 0.0f, 1.0f );
993  const SFVEC4F emissive = SFVEC4F( 0.0f, 0.0f, 0.0f, 1.0f );
994  const SFVEC4F specular = SFVEC4F( 0.1f, 0.1f, 0.1f, 1.0f );
995 
996  glMaterialfv( GL_FRONT_AND_BACK, GL_SPECULAR, &specular.r );
997  glMaterialf( GL_FRONT_AND_BACK, GL_SHININESS, 96.0f );
998 
999  glMaterialfv( GL_FRONT_AND_BACK, GL_AMBIENT, &ambient.r );
1000  glMaterialfv( GL_FRONT_AND_BACK, GL_DIFFUSE, &diffuse.r );
1001  glMaterialfv( GL_FRONT_AND_BACK, GL_EMISSION, &emissive.r );
1002 }
glm::vec4 SFVEC4F
Definition: xv3d_types.h:49

Referenced by render_3D_arrows().

◆ Redraw()

bool C3D_RENDER_OGL_LEGACY::Redraw ( bool  aIsMoving,
REPORTER aStatusReporter,
REPORTER aWarningReporter 
)
overridevirtual

Redraw - Ask to redraw the view.

Parameters
aIsMovingif the user is moving the scene, it should be render in preview mode
aStatusReportera pointer to the status progress reporter
Returns
it will return true if the render would like to redraw again

Implements C3D_RENDER_BASE.

Definition at line 529 of file c3d_render_ogl_legacy.cpp.

531 {
532  // Initialize openGL
534  {
535  if( !initializeOpenGL() )
536  return false;
537  }
538 
539  if( m_reloadRequested )
540  {
541  std::unique_ptr<BUSY_INDICATOR> busy = CreateBusyIndicator();
542 
543  if( aStatusReporter )
544  aStatusReporter->Report( _( "Loading..." ) );
545 
546  reload( aStatusReporter, aWarningReporter );
547  setupMaterials();
548 
549  // generate a new 3D grid as the size of the board may had changed
552  }
553  else
554  {
555  // Check if grid was changed
557  {
558  // and generate a new one
561  }
562  }
563 
564  // Initial setup
565  // /////////////////////////////////////////////////////////////////////////
566  glDepthFunc( GL_LESS );
567  glEnable( GL_CULL_FACE );
568  glFrontFace( GL_CCW ); // This is the openGL default
569  glEnable( GL_NORMALIZE ); // This allow openGL to normalize the normals after transformations
570 
571  glViewport( 0, 0, m_windowSize.x, m_windowSize.y );
572 
574  {
575  if( !aIsMoving )
576  {
577  glEnable( GL_MULTISAMPLE );
578  }
579  else
580  {
581  glDisable( GL_MULTISAMPLE );
582  }
583  }
584 
585  // clear color and depth buffers
586  // /////////////////////////////////////////////////////////////////////////
587  glClearColor( 0.0f, 0.0f, 0.0f, 1.0f );
588  glClearDepth( 1.0f );
589  glClearStencil( 0x00 );
590  glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT );
591 
593 
594  // Draw the background ( rectangle with color gradient)
595  // /////////////////////////////////////////////////////////////////////////
598 
599  glEnable( GL_DEPTH_TEST );
600 
601 
602  // Set projection and modelview matrixes
603  // /////////////////////////////////////////////////////////////////////////
604  glMatrixMode( GL_PROJECTION );
605  glLoadMatrixf( glm::value_ptr( m_camera.GetProjectionMatrix() ) );
606 
607  glMatrixMode( GL_MODELVIEW );
608  glLoadIdentity();
609  glLoadMatrixf( glm::value_ptr( m_camera.GetViewMatrix() ) );
610 
611 
612  // Position the headlight
613  // /////////////////////////////////////////////////////////////////////////
614 
615  setLight_Front( true );
616  setLight_Top( true );
617  setLight_Bottom( true );
618 
619  glEnable( GL_LIGHTING );
620 
621  {
622  const SFVEC3F &cameraPos = m_camera.GetPos();
623 
624  // Place the light at a minimun Z so the diffuse factor will not drop
625  // and the board will still look with good light.
626  float zpos;
627 
628  if( cameraPos.z > 0.0f )
629  {
630  zpos = glm::max( cameraPos.z, 0.5f ) + cameraPos.z * cameraPos.z;
631  }
632  else
633  {
634  zpos = glm::min( cameraPos.z,-0.5f ) - cameraPos.z * cameraPos.z;
635  }
636 
637  const GLfloat headlight_pos[] = { cameraPos.x,
638  cameraPos.y,
639  zpos,
640  1.0f }; // This is a point light
641 
642  glLightfv( GL_LIGHT0, GL_POSITION, headlight_pos );
643  }
644 
645  const bool drawMiddleSegments = !( aIsMoving &&
647 
648  const bool skipRenderHoles = aIsMoving &&
650 
651  const bool skipRenderVias = aIsMoving &&
653 
654  // Display board body
655  // /////////////////////////////////////////////////////////////////////////
657  {
659  {
662 
663  OGL_SetMaterial( m_materials.m_EpoxyBoard, 1.0f );
664 
666 
667  if( (m_ogl_disp_list_through_holes_outer_with_npth) && (!skipRenderHoles) )
668  {
672 
675  NULL );
676  }
677  else
678  {
680  }
681  }
682  }
683 
684 
686  {
687  // Draw vias and pad holes with copper material
689  }
690  else
691  {
692  OGL_SetMaterial( m_materials.m_GrayMaterial, 1.0f );
693  }
694 
695  if( (!( skipRenderVias || skipRenderHoles ) ) && m_ogl_disp_list_via )
696  {
698  }
699 
700  if( ( !skipRenderHoles ) && m_ogl_disp_list_pads_holes )
701  {
703  }
704 
705 
706  // Display copper and tech layers
707  // /////////////////////////////////////////////////////////////////////////
708  for( MAP_OGL_DISP_LISTS::const_iterator ii = m_ogl_disp_lists_layers.begin();
709  ii != m_ogl_disp_lists_layers.end();
710  ++ii )
711  {
712 
713  const PCB_LAYER_ID layer_id = (PCB_LAYER_ID)(ii->first);
714 
715  // Mask kayers are not processed here because they are a special case
716  if( (layer_id == B_Mask) || (layer_id == F_Mask) )
717  continue;
718 
719  // Do not show inner layers when it is displaying the board
721  {
722  if( (layer_id > F_Cu) && (layer_id < B_Cu) )
723  continue;
724  }
725 
726  glPushMatrix();
727 
728  // !TODO: if we want to increase the separation between layers
729  //glScalef( 1.0f, 1.0f, 3.0f );
730 
731 
732  CLAYERS_OGL_DISP_LISTS *pLayerDispList = static_cast<CLAYERS_OGL_DISP_LISTS*>(ii->second);
733  set_layer_material( layer_id );
734 
735  if( (layer_id >= F_Cu) && (layer_id <= B_Cu) )
736  {
737  if( skipRenderHoles )
738  {
739  pLayerDispList->DrawAllCameraCulled( m_camera.GetPos().z, drawMiddleSegments );
740  }
741  else
742  {
745  pLayerDispList->GetZBot(),
746  pLayerDispList->GetZTop() - pLayerDispList->GetZBot() );
747 
748  if( m_ogl_disp_lists_layers_holes_outer.find( layer_id ) !=
750  {
751  const CLAYERS_OGL_DISP_LISTS* viasHolesLayer =
753 
754  wxASSERT( viasHolesLayer != NULL );
755 
756  if( viasHolesLayer != NULL )
757  {
758  pLayerDispList->DrawAllCameraCulledSubtractLayer(
760  viasHolesLayer,
761  drawMiddleSegments );
762  }
763  }
764  else
765  {
766  pLayerDispList->DrawAllCameraCulledSubtractLayer(
768  NULL,
769  drawMiddleSegments );
770  }
771  }
772  }
773  else
774  {
775  CLAYERS_OGL_DISP_LISTS* dispListThoughHolesOuter =
777  && ( ( layer_id == B_SilkS ) || ( layer_id == F_SilkS ) ) ) ?
780 
781  if( dispListThoughHolesOuter )
782  dispListThoughHolesOuter->ApplyScalePosition( pLayerDispList->GetZBot(),
783  pLayerDispList->GetZTop() - pLayerDispList->GetZBot() );
784 
785  if( (!skipRenderHoles) &&
787  ( ( ( layer_id == B_SilkS ) &&
788  ( m_ogl_disp_lists_layers.find( B_Mask ) != m_ogl_disp_lists_layers.end() ) ) ||
789  ( ( layer_id == F_SilkS ) &&
790  ( m_ogl_disp_lists_layers.find( F_Mask ) != m_ogl_disp_lists_layers.end() ) ) ) )
791  {
792  const PCB_LAYER_ID layerMask_id = (layer_id == B_SilkS)?B_Mask:F_Mask;
793 
794  const CLAYERS_OGL_DISP_LISTS *pLayerDispListMask = m_ogl_disp_lists_layers.at( layerMask_id );
795 
796  pLayerDispList->DrawAllCameraCulledSubtractLayer(
797  pLayerDispListMask,
798  dispListThoughHolesOuter,
799  drawMiddleSegments );
800  }
801  else
802  {
803  if( (!skipRenderHoles) &&
804  dispListThoughHolesOuter &&
805  ( ( layer_id == B_SilkS ) || ( layer_id == F_SilkS )
806  // Remove vias on SolderPaste can be added as an option in future
807  // ( layer_id == B_Paste ) || ( layer_id == F_Paste ) )
808  ) )
809  {
810  pLayerDispList->DrawAllCameraCulledSubtractLayer(
811  NULL,
812  dispListThoughHolesOuter,
813  drawMiddleSegments );
814  }
815  else
816  {
817  // Do not render Paste layers when skipRenderHoles is enabled
818  // otherwise it will cause z-fight issues
819  if( !( skipRenderHoles &&
820  ( ( layer_id == B_Paste ) || ( layer_id == F_Paste ) ) ) )
821  {
822  pLayerDispList->DrawAllCameraCulled( m_camera.GetPos().z, drawMiddleSegments );
823  }
824  }
825  }
826  }
827 
828  glPopMatrix();
829  }
830 
831 
832  // Render 3D Models (Non-transparent)
833  // /////////////////////////////////////////////////////////////////////////
834  render_3D_models( false, false );
835  render_3D_models( true, false );
836 
837 
838  // Display transparent mask layers
839  // /////////////////////////////////////////////////////////////////////////
841  {
842  //setLight_Top( true );
843  //setLight_Bottom( true );
844 
845  // add a depth buffer offset, it will help to hide some artifacts
846  // on silkscreen where the SolderMask is removed
847  glEnable( GL_POLYGON_OFFSET_FILL );
848  glPolygonOffset( 0.0f, -1.0f );
849 
850  if( m_camera.GetPos().z > 0 )
851  {
853  drawMiddleSegments, skipRenderHoles );
854 
856  drawMiddleSegments, skipRenderHoles );
857  }
858  else
859  {
861  drawMiddleSegments, skipRenderHoles );
862 
864  drawMiddleSegments, skipRenderHoles );
865  }
866 
867  glDisable( GL_POLYGON_OFFSET_FILL );
868  glPolygonOffset( 0.0f, 0.0f );
869  }
870 
871 
872  // Render 3D Models (Transparent)
873  // /////////////////////////////////////////////////////////////////////////
874  // !TODO: this can be optimized. If there are no transparent models (or no opacity),
875  // then there is no need to make this function call.
876 
877  glDepthMask( GL_FALSE );
878 
879  glEnable( GL_BLEND );
880  glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
881 
882  // Enables Texture Env so it can combine model transparency with
883  // each module opacity setting
884  glEnable( GL_TEXTURE_2D );
885  glActiveTexture( GL_TEXTURE0 );
886 
887  glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE );
888  glTexEnvf( GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_INTERPOLATE );
889  glTexEnvf( GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_MODULATE );
890 
891  glTexEnvi( GL_TEXTURE_ENV, GL_SRC0_RGB, GL_PRIMARY_COLOR );
892  glTexEnvi( GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR );
893 
894  glTexEnvi( GL_TEXTURE_ENV, GL_SRC1_RGB, GL_PREVIOUS );
895  glTexEnvi( GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR );
896 
897  glTexEnvi( GL_TEXTURE_ENV, GL_SRC0_ALPHA, GL_PRIMARY_COLOR );
898  glTexEnvi( GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, GL_SRC_ALPHA );
899  glTexEnvi( GL_TEXTURE_ENV, GL_SRC1_ALPHA, GL_CONSTANT );
900  glTexEnvi( GL_TEXTURE_ENV, GL_OPERAND1_ALPHA, GL_CONSTANT );
901 
902  render_3D_models( false, true );
903  render_3D_models( true, true );
904 
905  glDisable( GL_BLEND );
907 
908  glDepthMask( GL_TRUE );
909 
910  // Render Grid
911  // /////////////////////////////////////////////////////////////////////////
912 
914  {
915  glDisable( GL_LIGHTING );
916 
917  if( glIsList( m_ogl_disp_list_grid ) )
918  glCallList( m_ogl_disp_list_grid );
919 
920  glEnable( GL_LIGHTING );
921  }
922 
923 
924  // Render 3D arrows
925  // /////////////////////////////////////////////////////////////////////////
928 
929  // Return back to the original viewport (this is important if we want
930  // to take a screenshot after the render)
931  // /////////////////////////////////////////////////////////////////////////
932  glViewport( 0, 0, m_windowSize.x, m_windowSize.y );
933 
934  return false;
935 }
bool GetFlag(DISPLAY3D_FLG aFlag) const
GetFlag - get a configuration status of a flag.
MAP_OGL_DISP_LISTS m_ogl_disp_lists_layers
CLAYERS_OGL_DISP_LISTS * m_ogl_disp_list_through_holes_vias_outer_ring
void DrawAllCameraCulledSubtractLayer(const CLAYERS_OGL_DISP_LISTS *aLayerToSubtractA, const CLAYERS_OGL_DISP_LISTS *aLayerToSubtractB, bool aDrawMiddle=true) const
void generate_new_3DGrid(GRID3D_TYPE aGridType)
MAP_OGL_DISP_LISTS m_ogl_disp_lists_layers_holes_outer
void render_3D_models(bool aRenderTopOrBot, bool aRenderTransparentOnly)
render_3D_models
float GetLayerTopZpos3DU(PCB_LAYER_ID aLayerId) const noexcept
GetLayerTopZpos3DU - Get the top z position.
const SFVEC3F & GetPos() const
Definition: ccamera.h:113
virtual REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED)=0
Function Report is a pure virtual function to override in the derived object.
void ApplyScalePosition(float aZposition, float aZscale)
void setLight_Top(bool enabled)
GRID3D_TYPE m_last_grid_type
Stores the last grid computed.
void render_solder_mask_layer(PCB_LAYER_ID aLayerID, float aZPosition, bool aDrawMiddleSegments, bool aSkipRenderHoles)
SFVEC3D m_BgColorTop
background top color
void OGL_DrawBackground(const SFVEC3F &aTopColor, const SFVEC3F &aBotColor)
OGL_DrawBackground.
Definition: ogl_utils.cpp:184
CLAYERS_OGL_DISP_LISTS * m_ogl_disp_list_through_holes_outer
PCB_LAYER_ID
A quick note on layer IDs:
void setLight_Front(bool enabled)
float GetLayerBottomZpos3DU(PCB_LAYER_ID aLayerId) const noexcept
GetLayerBottomZpos3DU - Get the bottom z position.
#define NULL
void setLight_Bottom(bool enabled)
bool m_is_opengl_initialized
flag if the opengl specific for this render was already initialized
void OGL_ResetTextureStateDefaults()
OGL_ResetTextureStateDefaults - resets to default state the texture settings.
Definition: ogl_utils.cpp:213
wxSize m_windowSize
The window size that this camera is working.
CLAYERS_OGL_DISP_LISTS * m_ogl_disp_list_through_holes_vias_outer
void DrawAllCameraCulled(float zCameraPos, bool aDrawMiddle=true) const
DrawAllCameraCulled - Draw all layers if they are visible by the camera.
struct C3D_RENDER_OGL_LEGACY::@0 m_materials
std::unique_ptr< BUSY_INDICATOR > CreateBusyIndicator() const
Return a created busy indicator, if a factory has been set, else a null pointer.
SFVEC3D m_BgColorBot
background bottom color
void reload(REPORTER *aStatusReporter, REPORTER *aWarningReporter)
void OGL_SetMaterial(const SMATERIAL &aMaterial, float aOpacity)
OGL_SetMaterial - Set OpenGL materials.
Definition: ogl_utils.cpp:145
CLAYERS_OGL_DISP_LISTS * m_ogl_disp_list_via
BOARD_ADAPTER & m_boardAdapter
settings refrence in use for this render
GLuint m_ogl_disp_list_grid
oGL list that stores current grid
void DrawAll(bool aDrawMiddle=true) const
DrawAll - This function calls all the display lists.
The CLAYERS_OGL_DISP_LISTS class stores the openGL display lists to related with a layer.
CLAYERS_OGL_DISP_LISTS * m_ogl_disp_list_through_holes_outer_with_npth
const glm::mat4 & GetViewMatrix() const
Definition: ccamera.cpp:419
bool m_reloadRequested
!TODO: this must be reviewed in order to flag change types
#define _(s)
Definition: 3d_actions.cpp:33
glm::vec3 SFVEC3F
Definition: xv3d_types.h:47
void SetItIsTransparent(bool aSetTransparent)
CLAYERS_OGL_DISP_LISTS * m_ogl_disp_list_board
const glm::mat4 & GetProjectionMatrix() const
Definition: ccamera.cpp:389
float GetEpoxyThickness3DU() const noexcept
GetEpoxyThickness3DU - Get the current epoxy thickness.
void set_layer_material(PCB_LAYER_ID aLayerID)
CLAYERS_OGL_DISP_LISTS * m_ogl_disp_list_pads_holes
GRID3D_TYPE GridGet() const noexcept
GridGet - get the current grid.

References _, CLAYERS_OGL_DISP_LISTS::ApplyScalePosition(), B_Cu, B_Mask, B_Paste, B_SilkS, C3D_RENDER_BASE::CreateBusyIndicator(), CLAYERS_OGL_DISP_LISTS::DrawAll(), CLAYERS_OGL_DISP_LISTS::DrawAllCameraCulled(), CLAYERS_OGL_DISP_LISTS::DrawAllCameraCulledSubtractLayer(), F_Cu, F_Mask, F_Paste, F_SilkS, FL_AXIS, FL_CLIP_SILK_ON_VIA_ANNULUS, FL_RENDER_OPENGL_AA_DISABLE_ON_MOVE, FL_RENDER_OPENGL_HOLES_DISABLE_ON_MOVE, FL_RENDER_OPENGL_THICKNESS_DISABLE_ON_MOVE, FL_RENDER_OPENGL_VIAS_DISABLE_ON_MOVE, FL_SHOW_BOARD_BODY, FL_SOLDERMASK, FL_SUBTRACT_MASK_FROM_SILK, FL_USE_REALISTIC_MODE, generate_new_3DGrid(), BOARD_ADAPTER::GetEpoxyThickness3DU(), BOARD_ADAPTER::GetFlag(), BOARD_ADAPTER::GetLayerBottomZpos3DU(), BOARD_ADAPTER::GetLayerTopZpos3DU(), CCAMERA::GetPos(), CCAMERA::GetProjectionMatrix(), CCAMERA::GetViewMatrix(), CLAYERS_OGL_DISP_LISTS::GetZBot(), CLAYERS_OGL_DISP_LISTS::GetZTop(), BOARD_ADAPTER::GridGet(), initializeOpenGL(), BOARD_ADAPTER::m_BgColorBot, BOARD_ADAPTER::m_BgColorTop, C3D_RENDER_BASE::m_boardAdapter, C3D_RENDER_BASE::m_camera, C3D_RENDER_BASE::m_is_opengl_initialized, m_last_grid_type, m_materials, m_ogl_disp_list_board, m_ogl_disp_list_grid, m_ogl_disp_list_pads_holes, m_ogl_disp_list_through_holes_outer, m_ogl_disp_list_through_holes_outer_with_npth, m_ogl_disp_list_through_holes_vias_outer, m_ogl_disp_list_through_holes_vias_outer_ring, m_ogl_disp_list_via, m_ogl_disp_lists_layers, m_ogl_disp_lists_layers_holes_outer, C3D_RENDER_BASE::m_reloadRequested, C3D_RENDER_BASE::m_windowSize, NONE, NULL, OGL_DrawBackground(), OGL_ResetTextureStateDefaults(), OGL_SetMaterial(), reload(), render_3D_arrows(), render_3D_models(), render_solder_mask_layer(), REPORTER::Report(), set_layer_material(), CLAYERS_OGL_DISP_LISTS::SetItIsTransparent(), setLight_Bottom(), setLight_Front(), setLight_Top(), and setupMaterials().

◆ reload()

void C3D_RENDER_OGL_LEGACY::reload ( REPORTER aStatusReporter,
REPORTER aWarningReporter 
)
private

Definition at line 337 of file c3d_render_createscene_ogl_legacy.cpp.

338 {
339  m_reloadRequested = false;
340 
342 
344 
345 #ifdef PRINT_STATISTICS_3D_VIEWER
346  printf("InitSettings...\n");
347 #endif
348 
349  unsigned stats_startReloadTime = GetRunningMicroSecs();
350 
351  m_boardAdapter.InitSettings( aStatusReporter, aWarningReporter );
352 
353 #ifdef PRINT_STATISTICS_3D_VIEWER
354  unsigned stats_endReloadTime = GetRunningMicroSecs();
355 #endif
356 
358  m_camera.SetBoardLookAtPos( camera_pos );
359 
360 #ifdef PRINT_STATISTICS_3D_VIEWER
361  unsigned stats_start_OpenGL_Load_Time = GetRunningMicroSecs();
362 #endif
363 
364  if( aStatusReporter )
365  aStatusReporter->Report( _( "Load OpenGL: board" ) );
366 
367  // Create Board
368  // /////////////////////////////////////////////////////////////////////////
369 
370  CCONTAINER2D boardContainer;
373  boardContainer,
375  (const BOARD_ITEM &)*m_boardAdapter.GetBoard() );
376 
377  const LIST_OBJECT2D &listBoardObject2d = boardContainer.GetList();
378 
379  if( listBoardObject2d.size() > 0 )
380  {
381  // We will set a unitary Z so it will in future used with transformations
382  // since the board poly will be used not only to draw itself but also the
383  // solder mask layers.
384  const float layer_z_top = 1.0f;
385  const float layer_z_bot = 0.0f;
386 
387  CLAYER_TRIANGLES *layerTriangles = new CLAYER_TRIANGLES( listBoardObject2d.size() );
388 
389  // Convert the list of objects(triangles) to triangle layer structure
390  for( LIST_OBJECT2D::const_iterator itemOnLayer = listBoardObject2d.begin();
391  itemOnLayer != listBoardObject2d.end();
392  ++itemOnLayer )
393  {
394  const COBJECT2D *object2d_A = static_cast<const COBJECT2D *>(*itemOnLayer);
395 
396  wxASSERT( object2d_A->GetObjectType() == OBJECT2D_TYPE::TRIANGLE );
397 
398  const CTRIANGLE2D *tri = (const CTRIANGLE2D *)object2d_A;
399 
400  const SFVEC2F &v1 = tri->GetP1();
401  const SFVEC2F &v2 = tri->GetP2();
402  const SFVEC2F &v3 = tri->GetP3();
403 
404  add_triangle_top_bot( layerTriangles,
405  v1,
406  v2,
407  v3,
408  layer_z_top,
409  layer_z_bot );
410  }
411 
412  const SHAPE_POLY_SET &boardPoly = m_boardAdapter.GetBoardPoly();
413 
414  wxASSERT( boardPoly.OutlineCount() > 0 );
415 
416  if( boardPoly.OutlineCount() > 0 )
417  {
418  layerTriangles->AddToMiddleContourns( boardPoly,
419  layer_z_bot,
420  layer_z_top,
422  false );
423 
424  m_ogl_disp_list_board = new CLAYERS_OGL_DISP_LISTS( *layerTriangles,
426  layer_z_top,
427  layer_z_top );
428  }
429 
430  delete layerTriangles;
431  }
432 
433  // Create Through Holes and vias
434  // /////////////////////////////////////////////////////////////////////////
435 
436  if( aStatusReporter )
437  aStatusReporter->Report( _( "Load OpenGL: holes and vias" ) );
438 
442  1.0f,
443  0.0f,
444  false );
445 
447 
450 
453  bodyHoles,
454  1.0f,
455  0.0f,
456  false );
457 
461  1.0f,
462  0.0f,
463  false );
464 
466  {
470  1.0f,
471  0.0f,
472  false );
473  }
474 
475  // Not in use
476  //m_ogl_disp_list_through_holes_vias_inner = generate_holes_display_list(
477  // m_boardAdapter.GetThroughHole_Vias_Inner().GetList(),
478  // m_boardAdapter.GetThroughHole_Vias_Inner_poly(),
479  // 1.0f, 0.0f,
480  // false );
481 
482  const MAP_POLY & innerMapHoles = m_boardAdapter.GetPolyMapHoles_Inner();
483  const MAP_POLY & outerMapHoles = m_boardAdapter.GetPolyMapHoles_Outer();
484 
485  wxASSERT( innerMapHoles.size() == outerMapHoles.size() );
486 
488 
489  if( outerMapHoles.size() > 0 )
490  {
491  float layer_z_bot = 0.0f;
492  float layer_z_top = 0.0f;
493 
494  for( MAP_POLY::const_iterator ii = outerMapHoles.begin();
495  ii != outerMapHoles.end();
496  ++ii )
497  {
498  PCB_LAYER_ID layer_id = static_cast<PCB_LAYER_ID>(ii->first);
499  const SHAPE_POLY_SET *poly = static_cast<const SHAPE_POLY_SET *>(ii->second);
500  const CBVHCONTAINER2D *container = map_holes.at( layer_id );
501 
502  get_layer_z_pos( layer_id, layer_z_top, layer_z_bot );
503 
505  container->GetList(), *poly, layer_z_top, layer_z_bot, false );
506  }
507 
508  for( MAP_POLY::const_iterator ii = innerMapHoles.begin();
509  ii != innerMapHoles.end();
510  ++ii )
511  {
512  PCB_LAYER_ID layer_id = static_cast<PCB_LAYER_ID>(ii->first);
513  const SHAPE_POLY_SET *poly = static_cast<const SHAPE_POLY_SET *>(ii->second);
514  const CBVHCONTAINER2D *container = map_holes.at( layer_id );
515 
516  get_layer_z_pos( layer_id, layer_z_top, layer_z_bot );
517 
519  container->GetList(), *poly, layer_z_top, layer_z_bot, false );
520  }
521  }
522 
523  // Generate vertical cylinders of vias and pads (copper)
525 
526  // Add layers maps
527 
528  if( aStatusReporter )
529  aStatusReporter->Report( _( "Load OpenGL: layers" ) );
530 
531  for( MAP_CONTAINER_2D::const_iterator ii = m_boardAdapter.GetMapLayers().begin();
532  ii != m_boardAdapter.GetMapLayers().end();
533  ++ii )
534  {
535  PCB_LAYER_ID layer_id = static_cast<PCB_LAYER_ID>(ii->first);
536 
537  if( !m_boardAdapter.Is3DLayerEnabled( layer_id ) )
538  continue;
539 
540  const CBVHCONTAINER2D *container2d = static_cast<const CBVHCONTAINER2D *>(ii->second);
541  const LIST_OBJECT2D &listObject2d = container2d->GetList();
542 
543  if( listObject2d.size() == 0 )
544  continue;
545 
546  float layer_z_bot = 0.0f;
547  float layer_z_top = 0.0f;
548 
549  get_layer_z_pos( layer_id, layer_z_top, layer_z_bot );
550 
551  // Calculate an estimation for the nr of triangles based on the nr of objects
552  unsigned int nrTrianglesEstimation = listObject2d.size() * 8;
553 
554  CLAYER_TRIANGLES *layerTriangles = new CLAYER_TRIANGLES( nrTrianglesEstimation );
555 
556  m_triangles[layer_id] = layerTriangles;
557 
558  // Load the 2D (X,Y axis) component of shapes
559  for( LIST_OBJECT2D::const_iterator itemOnLayer = listObject2d.begin();
560  itemOnLayer != listObject2d.end();
561  ++itemOnLayer )
562  {
563  const COBJECT2D *object2d_A = static_cast<const COBJECT2D *>(*itemOnLayer);
564 
565  switch( object2d_A->GetObjectType() )
566  {
568  add_object_to_triangle_layer( (const CFILLEDCIRCLE2D *)object2d_A,
569  layerTriangles, layer_z_top, layer_z_bot );
570  break;
571 
573  add_object_to_triangle_layer( (const CPOLYGON4PTS2D *)object2d_A,
574  layerTriangles, layer_z_top, layer_z_bot );
575  break;
576 
577  case OBJECT2D_TYPE::RING:
578  add_object_to_triangle_layer( (const CRING2D *)object2d_A,
579  layerTriangles, layer_z_top, layer_z_bot );
580  break;
581 
583  add_object_to_triangle_layer( (const CTRIANGLE2D *)object2d_A,
584  layerTriangles, layer_z_top, layer_z_bot );
585  break;
586 
588  add_object_to_triangle_layer( (const CROUNDSEGMENT2D *) object2d_A,
589  layerTriangles, layer_z_top, layer_z_bot );
590  break;
591 
592  default:
593  wxFAIL_MSG("C3D_RENDER_OGL_LEGACY: Object type is not implemented");
594  break;
595  }
596  }
597 
598  const MAP_POLY &map_poly = m_boardAdapter.GetPolyMap();
599 
600  // Load the vertical (Z axis) component of shapes
601  if( map_poly.find( layer_id ) != map_poly.end() )
602  {
603  const SHAPE_POLY_SET *polyList = map_poly.at( layer_id );
604 
605  if( polyList->OutlineCount() > 0 )
606  layerTriangles->AddToMiddleContourns( *polyList, layer_z_bot, layer_z_top,
607  m_boardAdapter.BiuTo3Dunits(), false );
608  }
609 
610  // Create display list
611  // /////////////////////////////////////////////////////////////////////
612  m_ogl_disp_lists_layers[layer_id] = new CLAYERS_OGL_DISP_LISTS( *layerTriangles,
614  layer_z_bot,
615  layer_z_top );
616  }// for each layer on map
617 
618 #ifdef PRINT_STATISTICS_3D_VIEWER
619  unsigned stats_end_OpenGL_Load_Time = GetRunningMicroSecs();
620 #endif
621 
622  // Load 3D models
623  // /////////////////////////////////////////////////////////////////////////
624 #ifdef PRINT_STATISTICS_3D_VIEWER
625  unsigned stats_start_models_Load_Time = GetRunningMicroSecs();
626 #endif
627 
628  if( aStatusReporter )
629  aStatusReporter->Report( _( "Loading 3D models" ) );
630 
631  load_3D_models( aStatusReporter );
632 
633 #ifdef PRINT_STATISTICS_3D_VIEWER
634  unsigned stats_end_models_Load_Time = GetRunningMicroSecs();
635 
636 
637  printf( "C3D_RENDER_OGL_LEGACY::reload times:\n" );
638  printf( " Reload board: %.3f ms\n",
639  (float)( stats_endReloadTime - stats_startReloadTime ) / 1000.0f );
640  printf( " Loading to openGL: %.3f ms\n",
641  (float)( stats_end_OpenGL_Load_Time - stats_start_OpenGL_Load_Time ) / 1000.0f );
642  printf( " Loading 3D models: %.3f ms\n",
643  (float)( stats_end_models_Load_Time - stats_start_models_Load_Time ) / 1000.0f );
645 #endif
646 
647  if( aStatusReporter )
648  {
649  // Calculation time in seconds
650  const double calculation_time = (double)( GetRunningMicroSecs() -
651  stats_startReloadTime) / 1e6;
652 
653  aStatusReporter->Report( wxString::Format( _( "Reload time %.3f s" ), calculation_time ) );
654  }
655 }
double BiuTo3Dunits() const noexcept
BiuTo3Dunits - Board integer units To 3D units.
bool GetFlag(DISPLAY3D_FLG aFlag) const
GetFlag - get a configuration status of a flag.
MAP_OGL_DISP_LISTS m_ogl_disp_lists_layers
CLAYERS_OGL_DISP_LISTS * m_ogl_disp_list_through_holes_vias_outer_ring
void add_object_to_triangle_layer(const CRING2D *aRing, CLAYER_TRIANGLES *aDstLayer, float aZtop, float aZbot)
std::map< PCB_LAYER_ID, CBVHCONTAINER2D * > MAP_CONTAINER_2D
A type that stores a container of 2d objects for each layer id.
Definition: board_adapter.h:50
int OutlineCount() const
Returns the number of outlines in the set
The CLAYER_TRIANGLES class stores arrays of triangles to be used to create display lists.
OBJECT2D_TYPE GetObjectType() const
Definition: cobject2d.h:125
void BooleanAdd(const SHAPE_POLY_SET &b, POLYGON_MODE aFastMode)
Performs boolean polyset union For aFastMode meaning, see function booleanOp
void PrintStats()
Definition: cobject2d.cpp:65
BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class,...
std::map< PCB_LAYER_ID, SHAPE_POLY_SET * > MAP_POLY
A type that stores polysets for each layer id.
Definition: board_adapter.h:56
MAP_OGL_DISP_LISTS m_ogl_disp_lists_layers_holes_outer
const MAP_CONTAINER_2D & GetMapLayersHoles() const noexcept
GetMapLayersHoles -Get the map of container that have the holes per layer.
void InitSettings(REPORTER *aStatusReporter, REPORTER *aWarningReporter)
InitSettings - Function to be called by the render when it need to reload the settings for the board.
const MAP_POLY & GetPolyMapHoles_Outer() const noexcept
const CBVHCONTAINER2D & GetThroughHole_Vias_Outer() const noexcept
GetThroughHole_Vias_Outer -.
virtual REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED)=0
Function Report is a pure virtual function to override in the derived object.
const MAP_CONTAINER_2D & GetMapLayers() const noexcept
GetMapLayers - Get the map of container that have the objects per layer.
const SHAPE_POLY_SET & GetThroughHole_Outer_poly_NPTH() const noexcept
GetThroughHole_Outer_poly_NPTH -.
CLAYERS_OGL_DISP_LISTS * m_ogl_disp_list_through_holes_outer
void get_layer_z_pos(PCB_LAYER_ID aLayerID, float &aOutZtop, float &aOutZbot) const
PCB_LAYER_ID
A quick note on layer IDs:
const CBVHCONTAINER2D & GetThroughHole_Outer() const noexcept
GetThroughHole_Outer - Get the inflated ThroughHole container.
glm::vec2 SFVEC2F
Definition: xv3d_types.h:45
const MAP_POLY & GetPolyMapHoles_Inner() const noexcept
SHAPE_POLY_SET.
const BOARD * GetBoard() const noexcept
GetBoard - Get current board to be rendered.
bool Is3DLayerEnabled(PCB_LAYER_ID aLayer) const
Is3DLayerEnabled - Check if a layer is enabled.
void load_3D_models(REPORTER *aStatusReporter)
CLAYERS_OGL_DISP_LISTS * m_ogl_disp_list_through_holes_vias_outer
const SHAPE_POLY_SET & GetBoardPoly() const noexcept
GetBoardPoly - Get the current polygon of the epoxy board.
void AddToMiddleContourns(const SHAPE_LINE_CHAIN &outlinePath, float zBot, float zTop, double aBiuTo3Du, bool aInvertFaceDirection)
static COBJECT2D_STATS & Instance()
Definition: cobject2d.h:152
BOARD_ADAPTER & m_boardAdapter
settings refrence in use for this render
const MAP_POLY & GetPolyMap() const noexcept
GetPolyMap - Get maps of polygons's layers.
MAP_OGL_DISP_LISTS m_ogl_disp_lists_layers_holes_inner
The CLAYERS_OGL_DISP_LISTS class stores the openGL display lists to related with a layer.
CLAYERS_OGL_DISP_LISTS * generate_holes_display_list(const LIST_OBJECT2D &aListHolesObject2d, const SHAPE_POLY_SET &aPoly, float aZtop, float aZbot, bool aInvertFaces)
const SHAPE_POLY_SET & GetThroughHole_Outer_poly() const noexcept
GetThroughHole_Outer_poly -.
CLAYERS_OGL_DISP_LISTS * m_ogl_disp_list_through_holes_outer_with_npth
This handles simple polygons with 4 points.
const CBVHCONTAINER2D & GetThroughHole_Vias_Outer_Ring() const noexcept
GetThroughHole_Vias_Outer_Ring -.
const SFVEC3F & GetBoardCenter3DU() const noexcept
GetBoardCenter - the board center position in 3d units.
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
bool m_reloadRequested
!TODO: this must be reviewed in order to flag change types
std::list< COBJECT2D * > LIST_OBJECT2D
Definition: ccontainer2d.h:37
const SFVEC2F & GetP1() const
Definition: ctriangle2d.h:58
#define _(s)
Definition: 3d_actions.cpp:33
unsigned GetRunningMicroSecs()
Function GetRunningMicroSecs An alternate way to calculate an elapset time (in microsecondes) to clas...
glm::vec3 SFVEC3F
Definition: xv3d_types.h:47
const SHAPE_POLY_SET & GetThroughHole_Vias_Outer_Ring_poly() const noexcept
GetThroughHole_Vias_Outer_Ring_poly -.
void SetBoardLookAtPos(const SFVEC3F &aBoardPos)
Definition: ccamera.h:118
void ResetStats()
Definition: cobject2d.h:135
CLAYERS_OGL_DISP_LISTS * m_ogl_disp_list_board
const SHAPE_POLY_SET & GetThroughHole_Vias_Outer_poly() const noexcept
GetThroughHole_Vias_Outer_poly -.
void add_triangle_top_bot(CLAYER_TRIANGLES *aDst, const SFVEC2F &v0, const SFVEC2F &v1, const SFVEC2F &v2, float top, float bot)
const LIST_OBJECT2D & GetList() const
Definition: ccontainer2d.h:64
void Convert_shape_line_polygon_to_triangles(SHAPE_POLY_SET &aPolyList, CGENERICCONTAINER2D &aDstContainer, float aBiuTo3DunitsScale, const BOARD_ITEM &aBoardItem)

References _, add_object_to_triangle_layer(), add_triangle_top_bot(), CLAYER_TRIANGLES::AddToMiddleContourns(), BOARD_ADAPTER::BiuTo3Dunits(), SHAPE_POLY_SET::BooleanAdd(), Convert_shape_line_polygon_to_triangles(), FILLED_CIRCLE, FL_CLIP_SILK_ON_VIA_ANNULUS, Format(), generate_3D_Vias_and_Pads(), generate_holes_display_list(), get_layer_z_pos(), BOARD_ADAPTER::GetBoard(), BOARD_ADAPTER::GetBoardCenter3DU(), BOARD_ADAPTER::GetBoardPoly(), BOARD_ADAPTER::GetFlag(), CGENERICCONTAINER2D::GetList(), BOARD_ADAPTER::GetMapLayers(), BOARD_ADAPTER::GetMapLayersHoles(), COBJECT2D::GetObjectType(), BOARD_ADAPTER::GetPolyMap(), BOARD_ADAPTER::GetPolyMapHoles_Inner(), BOARD_ADAPTER::GetPolyMapHoles_Outer(), GetRunningMicroSecs(), BOARD_ADAPTER::GetThroughHole_Outer(), BOARD_ADAPTER::GetThroughHole_Outer_poly(), BOARD_ADAPTER::GetThroughHole_Outer_poly_NPTH(), BOARD_ADAPTER::GetThroughHole_Vias_Outer(), BOARD_ADAPTER::GetThroughHole_Vias_Outer_poly(), BOARD_ADAPTER::GetThroughHole_Vias_Outer_Ring(), BOARD_ADAPTER::GetThroughHole_Vias_Outer_Ring_poly(), BOARD_ADAPTER::InitSettings(), COBJECT2D_STATS::Instance(), BOARD_ADAPTER::Is3DLayerEnabled(), load_3D_models(), C3D_RENDER_BASE::m_boardAdapter, C3D_RENDER_BASE::m_camera, m_ogl_circle_texture, m_ogl_disp_list_board, m_ogl_disp_list_through_holes_outer, m_ogl_disp_list_through_holes_outer_with_npth, m_ogl_disp_list_through_holes_vias_outer, m_ogl_disp_list_through_holes_vias_outer_ring, m_ogl_disp_lists_layers, m_ogl_disp_lists_layers_holes_inner, m_ogl_disp_lists_layers_holes_outer, C3D_RENDER_BASE::m_reloadRequested, m_triangles, ogl_free_all_display_lists(), SHAPE_POLY_SET::OutlineCount(), SHAPE_POLY_SET::PM_FAST, POLYGON4PT, COBJECT2D_STATS::PrintStats(), REPORTER::Report(), COBJECT2D_STATS::ResetStats(), RING, ROUNDSEG, CCAMERA::SetBoardLookAtPos(), and TRIANGLE.

Referenced by Redraw().

◆ ReloadRequest()

void C3D_RENDER_BASE::ReloadRequest ( )
inlineinherited

ReloadRequest - !TODO: this must be reviewed to add flags to improve specific render.

Definition at line 76 of file c3d_render_base.h.

76 { m_reloadRequested = true; }
bool m_reloadRequested
!TODO: this must be reviewed in order to flag change types

References C3D_RENDER_BASE::m_reloadRequested.

Referenced by EDA_3D_CANVAS::ReloadRequest(), EDA_3D_CANVAS::RenderEngineChanged(), and EDA_3D_CANVAS::RenderRaytracingRequest().

◆ render_3D_arrows()

void C3D_RENDER_OGL_LEGACY::render_3D_arrows ( )
private

Definition at line 135 of file c3d_render_ogl_legacy.cpp.

136 {
137  const float arrow_size = RANGE_SCALE_3D * 0.30f;
138 
139  glDisable( GL_CULL_FACE );
140 
141  // YxY squared view port, this is on propose
142  glViewport( 4, 4, m_windowSize.y / 8 , m_windowSize.y / 8 );
143  glClear( GL_DEPTH_BUFFER_BIT );
144 
145  glMatrixMode( GL_PROJECTION );
146  glLoadIdentity();
147  gluPerspective( 45.0f, 1.0f, 0.001f, RANGE_SCALE_3D );
148 
149  glMatrixMode( GL_MODELVIEW );
150  glLoadIdentity();
151 
152  const glm::mat4 TranslationMatrix = glm::translate(
153  glm::mat4(1.0f),
154  SFVEC3F( 0.0f, 0.0f, -(arrow_size * 2.75f) ) );
155 
156  const glm::mat4 ViewMatrix = TranslationMatrix * m_camera.GetRotationMatrix();
157 
158  glLoadMatrixf( glm::value_ptr( ViewMatrix ) );
159 
161 
162  glColor3f( 0.9f, 0.0f, 0.0f );
163  OGL_draw_arrow( SFVEC3F( 0.0f, 0.0f, 0.0f ),
164  SFVEC3F( arrow_size, 0.0f, 0.0f ),
165  0.275f );
166 
167  glColor3f( 0.0f, 0.9f, 0.0f );
168  OGL_draw_arrow( SFVEC3F( 0.0f, 0.0f, 0.0f ),
169  SFVEC3F( 0.0f, arrow_size, 0.0f ),
170  0.275f );
171 
172  glColor3f( 0.0f, 0.0f, 0.9f );
173  OGL_draw_arrow( SFVEC3F( 0.0f, 0.0f, 0.0f ),
174  SFVEC3F( 0.0f, 0.0f, arrow_size ),
175  0.275f );
176 
177  glEnable( GL_CULL_FACE );
178 }
const glm::mat4 GetRotationMatrix() const
Function GetRotationMatrix Get the rotation matrix to be applied in a transformation camera.
Definition: ccamera.cpp:158
wxSize m_windowSize
The window size that this camera is working.
glm::vec3 SFVEC3F
Definition: xv3d_types.h:47
#define RANGE_SCALE_3D
This defines the range that all coord will have to be rendered.
Definition: board_adapter.h:61
void OGL_draw_arrow(SFVEC3F aPosition, SFVEC3F aTargetPos, float aSize)
OGL_draw_arrow - draw a round arrow.

References CCAMERA::GetRotationMatrix(), C3D_RENDER_BASE::m_camera, C3D_RENDER_BASE::m_windowSize, OGL_draw_arrow(), ogl_set_arrow_material(), and RANGE_SCALE_3D.

Referenced by Redraw().

◆ render_3D_models()

void C3D_RENDER_OGL_LEGACY::render_3D_models ( bool  aRenderTopOrBot,
bool  aRenderTransparentOnly 
)
private

render_3D_models

Parameters
aRenderTopOrBot- true will render Top, false will render bottom
aRenderTransparentOnly- true will render only the transparent objects, false will render opaque

Definition at line 1166 of file c3d_render_ogl_legacy.cpp.

1168 {
1170 
1171  // Go for all modules
1172  for( auto module : m_boardAdapter.GetBoard()->Modules() )
1173  {
1174  if( !module->Models().empty() )
1175  if( m_boardAdapter.ShouldModuleBeDisplayed((MODULE_ATTR_T) module->GetAttributes() ) )
1176  if( ( aRenderTopOrBot && !module->IsFlipped() )
1177  || ( !aRenderTopOrBot && module->IsFlipped() ) )
1178  render_3D_module( module, aRenderTransparentOnly );
1179  }
1180 
1182 }
static void EndDrawMulti()
EndDrawMulti - cleanup render states after drawing multiple models.
MODULES & Modules()
Definition: class_board.h:266
void render_3D_module(const MODULE *module, bool aRenderTransparentOnly)
const BOARD * GetBoard() const noexcept
GetBoard - Get current board to be rendered.
static void BeginDrawMulti()
BeginDrawMulti - set some basic render states before drawing multiple models.
MODULE_ATTR_T
Enum MODULE_ATTR_T is the set of attributes allowed within a MODULE, using MODULE::SetAttributes() an...
Definition: class_module.h:65
BOARD_ADAPTER & m_boardAdapter
settings refrence in use for this render
bool ShouldModuleBeDisplayed(MODULE_ATTR_T aModuleAttributs) const
ShouldModuleBeDisplayed - Test if module should be displayed in relation to attributs and the flags.

References C_OGL_3DMODEL::BeginDrawMulti(), C_OGL_3DMODEL::EndDrawMulti(), BOARD_ADAPTER::GetBoard(), C3D_RENDER_BASE::m_boardAdapter, BOARD::Modules(), render_3D_module(), and BOARD_ADAPTER::ShouldModuleBeDisplayed().

Referenced by Redraw().

◆ render_3D_module()

void C3D_RENDER_OGL_LEGACY::render_3D_module ( const MODULE module,
bool  aRenderTransparentOnly 
)
private

Definition at line 1185 of file c3d_render_ogl_legacy.cpp.

1187 {
1188  if( !module->Models().empty() )
1189  {
1190  const double zpos = m_boardAdapter.GetModulesZcoord3DIU( module->IsFlipped() );
1191 
1192  glPushMatrix();
1193 
1194  wxPoint pos = module->GetPosition();
1195 
1196  glTranslatef( pos.x * m_boardAdapter.BiuTo3Dunits(),
1197  -pos.y * m_boardAdapter.BiuTo3Dunits(),
1198  zpos );
1199 
1200  if( module->GetOrientation() )
1201  glRotated( (double) module->GetOrientation() / 10.0, 0.0, 0.0, 1.0 );
1202 
1203  if( module->IsFlipped() )
1204  {
1205  glRotatef( 180.0f, 0.0f, 1.0f, 0.0f );
1206  glRotatef( 180.0f, 0.0f, 0.0f, 1.0f );
1207  }
1208 
1209  double modelunit_to_3d_units_factor = m_boardAdapter.BiuTo3Dunits() * UNITS3D_TO_UNITSPCB;
1210 
1211  glScaled( modelunit_to_3d_units_factor,
1212  modelunit_to_3d_units_factor,
1213  modelunit_to_3d_units_factor );
1214 
1215  // Get the list of model files for this model
1216  for( auto& sM : module->Models () )
1217  {
1218  if( sM.m_Filename.empty() )
1219  continue;
1220 
1221  // Check if the model is present in our cache map
1222  auto cache_i = m_3dmodel_map.find( sM.m_Filename );
1223 
1224  if( cache_i == m_3dmodel_map.end() )
1225  continue;
1226 
1227  if( const C_OGL_3DMODEL *modelPtr = cache_i->second )
1228  {
1229  bool opaque = sM.m_Opacity >= 1.0;
1230 
1231  if( ( !aRenderTransparentOnly && modelPtr->Have_opaque() && opaque ) ||
1232  ( aRenderTransparentOnly && ( modelPtr->Have_transparent() || !opaque ) ) )
1233  {
1234  glPushMatrix();
1235 
1236  // FIXME: don't do this over and over again unless the
1237  // values have changed. cache the matrix somewhere.
1238  glm::mat4 mtx( 1 );
1239  mtx = glm::translate( mtx, { sM.m_Offset.x, sM.m_Offset.y, sM.m_Offset.z } );
1240  mtx = glm::rotate(
1241  mtx, glm::radians( (float) -sM.m_Rotation.z ), { 0.0f, 0.0f, 1.0f } );
1242  mtx = glm::rotate(
1243  mtx, glm::radians( (float) -sM.m_Rotation.y ), { 0.0f, 1.0f, 0.0f } );
1244  mtx = glm::rotate(
1245  mtx, glm::radians( (float) -sM.m_Rotation.x ), { 1.0f, 0.0f, 0.0f } );
1246  mtx = glm::scale( mtx, { sM.m_Scale.x, sM.m_Scale.y, sM.m_Scale.z } );
1247  glMultMatrixf( glm::value_ptr( mtx ) );
1248 
1249  if( aRenderTransparentOnly )
1250  modelPtr->Draw_transparent( sM.m_Opacity );
1251  else
1252  modelPtr->Draw_opaque();
1253 
1255  {
1256  glEnable( GL_BLEND );
1257  glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
1258 
1259  glDisable( GL_LIGHTING );
1260 
1261  glLineWidth( 1 );
1262  modelPtr->Draw_bboxes();
1263 
1264  glLineWidth( 4 );
1265  modelPtr->Draw_bbox();
1266 
1267  glEnable( GL_LIGHTING );
1268  glDisable( GL_BLEND );
1269  }
1270 
1271  glPopMatrix();
1272  }
1273  }
1274  }
1275 
1276  glPopMatrix();
1277  }
1278 }
double BiuTo3Dunits() const noexcept
BiuTo3Dunits - Board integer units To 3D units.
bool GetFlag(DISPLAY3D_FLG aFlag) const
GetFlag - get a configuration status of a flag.
double GetOrientation() const
Definition: class_module.h:221
bool IsFlipped() const
function IsFlipped
Definition: class_module.h:299
#define UNITS3D_TO_UNITSPCB
Scale convertion from 3d model units to pcb units.
BOARD_ADAPTER & m_boardAdapter
settings refrence in use for this render
std::list< MODULE_3D_SETTINGS > & Models()
Definition: class_module.h:211
const int scale
float GetModulesZcoord3DIU(bool aIsFlipped) const
GetModulesZcoord3DIU - Get the position of the module in 3d integer units considering if it is flippe...
wxPoint GetPosition() const override
Definition: class_module.h:216

References BOARD_ADAPTER::BiuTo3Dunits(), FL_RENDER_OPENGL_SHOW_MODEL_BBOX, BOARD_ADAPTER::GetFlag(), BOARD_ADAPTER::GetModulesZcoord3DIU(), MODULE::GetOrientation(), MODULE::GetPosition(), MODULE::IsFlipped(), m_3dmodel_map, C3D_RENDER_BASE::m_boardAdapter, MODULE::Models(), scale, UNITS3D_TO_UNITSPCB, wxPoint::x, and wxPoint::y.

Referenced by render_3D_models().

◆ render_solder_mask_layer()

void C3D_RENDER_OGL_LEGACY::render_solder_mask_layer ( PCB_LAYER_ID  aLayerID,
float  aZPosition,
bool  aDrawMiddleSegments,
bool  aSkipRenderHoles 
)
private

Definition at line 1092 of file c3d_render_ogl_legacy.cpp.

1096 {
1097  wxASSERT( (aLayerID == B_Mask) || (aLayerID == F_Mask) );
1098 
1099  if( m_ogl_disp_list_board )
1100  {
1101  if( m_ogl_disp_lists_layers.find( aLayerID ) !=
1102  m_ogl_disp_lists_layers.end() )
1103  {
1104  CLAYERS_OGL_DISP_LISTS *pLayerDispListMask = m_ogl_disp_lists_layers.at( aLayerID );
1105 
1108  aZPosition,
1110 
1112  aZPosition,
1114 
1115  set_layer_material( aLayerID );
1116 
1118 
1119  if( aSkipRenderHoles )
1120  {
1122  aDrawMiddleSegments );
1123  }
1124  else
1125  {
1127  pLayerDispListMask,
1129  aDrawMiddleSegments );
1130  }
1131  }
1132  else
1133  {
1134  // This case there is no layer with mask, so we will render the full board as mask
1135 
1138  aZPosition,
1140 
1142  aZPosition,
1144 
1145  set_layer_material( aLayerID );
1146 
1148 
1149  if( aSkipRenderHoles )
1150  {
1152  aDrawMiddleSegments );
1153  }
1154  else
1155  {
1157  NULL,
1159  aDrawMiddleSegments );
1160  }
1161  }
1162  }
1163 }
MAP_OGL_DISP_LISTS m_ogl_disp_lists_layers
void DrawAllCameraCulledSubtractLayer(const CLAYERS_OGL_DISP_LISTS *aLayerToSubtractA, const CLAYERS_OGL_DISP_LISTS *aLayerToSubtractB, bool aDrawMiddle=true) const
const SFVEC3F & GetPos() const
Definition: ccamera.h:113
void ApplyScalePosition(float aZposition, float aZscale)
#define NULL
CLAYERS_OGL_DISP_LISTS * m_ogl_disp_list_through_holes_vias_outer
void DrawAllCameraCulled(float zCameraPos, bool aDrawMiddle=true) const
DrawAllCameraCulled - Draw all layers if they are visible by the camera.
BOARD_ADAPTER & m_boardAdapter
settings refrence in use for this render
The CLAYERS_OGL_DISP_LISTS class stores the openGL display lists to related with a layer.
void SetItIsTransparent(bool aSetTransparent)
float GetNonCopperLayerThickness3DU() const noexcept
GetNonCopperLayerThickness3DU - Get the current non copper layers thickness.
CLAYERS_OGL_DISP_LISTS * m_ogl_disp_list_board
void set_layer_material(PCB_LAYER_ID aLayerID)

References CLAYERS_OGL_DISP_LISTS::ApplyScalePosition(), B_Mask, CLAYERS_OGL_DISP_LISTS::DrawAllCameraCulled(), CLAYERS_OGL_DISP_LISTS::DrawAllCameraCulledSubtractLayer(), F_Mask, BOARD_ADAPTER::GetNonCopperLayerThickness3DU(), CCAMERA::GetPos(), C3D_RENDER_BASE::m_boardAdapter, C3D_RENDER_BASE::m_camera, m_ogl_disp_list_board, m_ogl_disp_list_through_holes_vias_outer, m_ogl_disp_lists_layers, NULL, set_layer_material(), and CLAYERS_OGL_DISP_LISTS::SetItIsTransparent().

Referenced by Redraw().

◆ set_layer_material()

void C3D_RENDER_OGL_LEGACY::set_layer_material ( PCB_LAYER_ID  aLayerID)
private

Definition at line 358 of file c3d_render_ogl_legacy.cpp.

359 {
360  switch( aLayerID )
361  {
362  case B_Mask:
363  m_materials.m_SolderMaskBot.m_Diffuse = get_layer_color( aLayerID );
364  OGL_SetMaterial( m_materials.m_SolderMaskBot, 1.0f );
365  break;
366  case F_Mask:
367  m_materials.m_SolderMaskTop.m_Diffuse = get_layer_color( aLayerID );
368  OGL_SetMaterial( m_materials.m_SolderMaskTop, 1.0f );
369  break;
370 
371  case B_Paste:
372  case F_Paste:
373  m_materials.m_Paste.m_Diffuse = get_layer_color( aLayerID );
374  OGL_SetMaterial( m_materials.m_Paste, 1.0f );
375  break;
376 
377  case B_SilkS:
378  m_materials.m_SilkSBot.m_Diffuse = get_layer_color( aLayerID );
379  OGL_SetMaterial( m_materials.m_SilkSBot, 1.0f );
380  break;
381 
382  case F_SilkS:
383  m_materials.m_SilkSTop.m_Diffuse = get_layer_color( aLayerID );
384  OGL_SetMaterial( m_materials.m_SilkSTop, 1.0f );
385  break;
386 
387  case B_Adhes:
388  case F_Adhes:
389  case Dwgs_User:
390  case Cmts_User:
391  case Eco1_User:
392  case Eco2_User:
393  case Edge_Cuts:
394  case Margin:
395  case B_CrtYd:
396  case F_CrtYd:
397  case B_Fab:
398  case F_Fab:
399  m_materials.m_Plastic.m_Diffuse = get_layer_color( aLayerID );
400  m_materials.m_Plastic.m_Ambient = SFVEC3F(
401  m_materials.m_Plastic.m_Diffuse.r * 0.05f,
402  m_materials.m_Plastic.m_Diffuse.g * 0.05f,
403  m_materials.m_Plastic.m_Diffuse.b * 0.05f );
404 
405  m_materials.m_Plastic.m_Specular = SFVEC3F(
406  m_materials.m_Plastic.m_Diffuse.r * 0.7f,
407  m_materials.m_Plastic.m_Diffuse.g * 0.7f,
408  m_materials.m_Plastic.m_Diffuse.b * 0.7f );
409 
410  m_materials.m_Plastic.m_Shininess = 0.078125f * 128.0f;
411  m_materials.m_Plastic.m_Emissive = SFVEC3F( 0.0f, 0.0f, 0.0f );
412  OGL_SetMaterial( m_materials.m_Plastic, 1.0f );
413  break;
414 
415  default:
416  m_materials.m_Copper.m_Diffuse = get_layer_color( aLayerID );
417  OGL_SetMaterial( m_materials.m_Copper, 1.0f );
418 
419  break;
420  }
421 }
struct C3D_RENDER_OGL_LEGACY::@0 m_materials
void OGL_SetMaterial(const SMATERIAL &aMaterial, float aOpacity)
OGL_SetMaterial - Set OpenGL materials.
Definition: ogl_utils.cpp:145
glm::vec3 SFVEC3F
Definition: xv3d_types.h:47
SFVEC3F get_layer_color(PCB_LAYER_ID aLayerID)

References B_Adhes, B_CrtYd, B_Fab, B_Mask, B_Paste, B_SilkS, Cmts_User, Dwgs_User, Eco1_User, Eco2_User, Edge_Cuts, F_Adhes, F_CrtYd, F_Fab, F_Mask, F_Paste, F_SilkS, get_layer_color(), m_materials, Margin, and OGL_SetMaterial().

Referenced by Redraw(), and render_solder_mask_layer().

◆ SetBusyIndicatorFactory()

void C3D_RENDER_BASE::SetBusyIndicatorFactory ( BUSY_INDICATOR::FACTORY  aNewFactory)
inherited

Set a new busy indicator factory.

When set, this factory will be used to generate busy indicators when suitable. If not set, no busy indicator will be used.

Definition at line 59 of file c3d_render_base.cpp.

60 {
61  m_busyIndicatorFactory = aNewFactory;
62 }
BUSY_INDICATOR::FACTORY m_busyIndicatorFactory
Factory that returns a suitable busy indicator for the context.

References C3D_RENDER_BASE::m_busyIndicatorFactory.

◆ SetCurWindowSize()

void C3D_RENDER_OGL_LEGACY::SetCurWindowSize ( const wxSize &  aSize)
overridevirtual

SetCurWindowSize - Before each render, the canvas will tell the render what is the size of its windows, so render can take actions if it changed.

Parameters
aSizethe current size of the render window

Implements C3D_RENDER_BASE.

Definition at line 96 of file c3d_render_ogl_legacy.cpp.

97 {
98  if( m_windowSize != aSize )
99  {
100  m_windowSize = aSize;
101  glViewport( 0, 0, m_windowSize.x, m_windowSize.y );
102 
103  // Initialize here any screen dependent data here
104  }
105 }
wxSize m_windowSize
The window size that this camera is working.

References C3D_RENDER_BASE::m_windowSize.

◆ setLight_Bottom()

void C3D_RENDER_OGL_LEGACY::setLight_Bottom ( bool  enabled)
private

Definition at line 126 of file c3d_render_ogl_legacy.cpp.

127 {
128  if( enabled )
129  glEnable( GL_LIGHT2 );
130  else
131  glDisable( GL_LIGHT2 );
132 }

Referenced by Redraw().

◆ setLight_Front()

void C3D_RENDER_OGL_LEGACY::setLight_Front ( bool  enabled)
private

Definition at line 108 of file c3d_render_ogl_legacy.cpp.

109 {
110  if( enabled )
111  glEnable( GL_LIGHT0 );
112  else
113  glDisable( GL_LIGHT0 );
114 }

Referenced by Redraw().

◆ setLight_Top()

void C3D_RENDER_OGL_LEGACY::setLight_Top ( bool  enabled)
private

Definition at line 117 of file c3d_render_ogl_legacy.cpp.

118 {
119  if( enabled )
120  glEnable( GL_LIGHT1 );
121  else
122  glDisable( GL_LIGHT1 );
123 }

Referenced by Redraw().

◆ setupMaterials()

void C3D_RENDER_OGL_LEGACY::setupMaterials ( )
private

Definition at line 181 of file c3d_render_ogl_legacy.cpp.

182 {
183  m_materials = {};
184 
186  {
187  // http://devernay.free.fr/cours/opengl/materials.html
188 
189  // Copper material mixed with the copper color
190  m_materials.m_Copper.m_Ambient = SFVEC3F( m_boardAdapter.m_CopperColor.r * 0.1f,
191  m_boardAdapter.m_CopperColor.g * 0.1f,
192  m_boardAdapter.m_CopperColor.b * 0.1f);
193 
194  m_materials.m_Copper.m_Specular = SFVEC3F( m_boardAdapter.m_CopperColor.r * 0.75f + 0.25f,
195  m_boardAdapter.m_CopperColor.g * 0.75f + 0.25f,
196  m_boardAdapter.m_CopperColor.b * 0.75f + 0.25f );
197 
198  // This guess the material type(ex: copper vs gold) to determine the
199  // shininess factor between 0.1 and 0.4
200  float shininessfactor = 0.40f - mapf( fabs( m_boardAdapter.m_CopperColor.r -
202  0.15f, 1.00f,
203  0.00f, 0.30f );
204 
205  m_materials.m_Copper.m_Shininess = shininessfactor * 128.0f;
206  m_materials.m_Copper.m_Emissive = SFVEC3F( 0.0f, 0.0f, 0.0f );
207 
208 
209  // Paste material mixed with paste color
210  m_materials.m_Paste.m_Ambient = SFVEC3F( m_boardAdapter.m_SolderPasteColor.r,
213 
214  m_materials.m_Paste.m_Specular = SFVEC3F( m_boardAdapter.m_SolderPasteColor.r *
220 
221  m_materials.m_Paste.m_Shininess = 0.1f * 128.0f;
222  m_materials.m_Paste.m_Emissive = SFVEC3F( 0.0f, 0.0f, 0.0f );
223 
224 
225  // Silk screen material mixed with silk screen color
226  m_materials.m_SilkSTop.m_Ambient = SFVEC3F( m_boardAdapter.m_SilkScreenColorTop.r,
229 
230  m_materials.m_SilkSTop.m_Specular = SFVEC3F(
234 
235  m_materials.m_SilkSTop.m_Shininess = 0.078125f * 128.0f;
236  m_materials.m_SilkSTop.m_Emissive = SFVEC3F( 0.0f, 0.0f, 0.0f );
237 
238  // Silk screen material mixed with silk screen color
239  m_materials.m_SilkSBot.m_Ambient = SFVEC3F( m_boardAdapter.m_SilkScreenColorBot.r,
242 
243  m_materials.m_SilkSBot.m_Specular = SFVEC3F(
247 
248  m_materials.m_SilkSBot.m_Shininess = 0.078125f * 128.0f;
249  m_materials.m_SilkSBot.m_Emissive = SFVEC3F( 0.0f, 0.0f, 0.0f );
250 
251 
252  // Solder mask material mixed with solder mask color
253  m_materials.m_SolderMaskTop.m_Ambient = SFVEC3F(
257 
258  m_materials.m_SolderMaskTop.m_Specular = SFVEC3F(
262 
263  m_materials.m_SolderMaskTop.m_Shininess = 0.8f * 128.0f;
264  m_materials.m_SolderMaskTop.m_Transparency = 0.17f;
265  m_materials.m_SolderMaskTop.m_Emissive = SFVEC3F( 0.0f, 0.0f, 0.0f );
266 
267  // Solder mask material mixed with solder mask color
268  m_materials.m_SolderMaskBot.m_Ambient = SFVEC3F(
272 
273  m_materials.m_SolderMaskBot.m_Specular = SFVEC3F(
277 
278  m_materials.m_SolderMaskBot.m_Shininess = 0.8f * 128.0f;
279  m_materials.m_SolderMaskBot.m_Transparency = 0.17f;
280  m_materials.m_SolderMaskBot.m_Emissive = SFVEC3F( 0.0f, 0.0f, 0.0f );
281 
282 
283  // Epoxy material
284  m_materials.m_EpoxyBoard.m_Ambient = SFVEC3F( 117.0f / 255.0f,
285  97.0f / 255.0f,
286  47.0f / 255.0f );
287 
288  m_materials.m_EpoxyBoard.m_Diffuse = m_boardAdapter.m_BoardBodyColor;
289 
290  m_materials.m_EpoxyBoard.m_Specular = SFVEC3F( 18.0f / 255.0f,
291  3.0f / 255.0f,
292  20.0f / 255.0f );
293 
294  m_materials.m_EpoxyBoard.m_Shininess = 0.1f * 128.0f;
295  m_materials.m_EpoxyBoard.m_Emissive = SFVEC3F( 0.0f, 0.0f, 0.0f );
296  }
297  else // Technical Mode
298  {
299  const SFVEC3F matAmbientColor = SFVEC3F( 0.10f );
300  const SFVEC3F matSpecularColor = SFVEC3F( 0.10f );
301  const float matShininess = 0.1f * 128.0f;
302 
303  // Copper material
304  m_materials.m_Copper.m_Ambient = matAmbientColor;
305  m_materials.m_Copper.m_Specular = matSpecularColor;
306  m_materials.m_Copper.m_Shininess = matShininess;
307  m_materials.m_Copper.m_Emissive = SFVEC3F( 0.0f, 0.0f, 0.0f );
308 
309  // Paste material
310  m_materials.m_Paste.m_Ambient = matAmbientColor;
311  m_materials.m_Paste.m_Specular = matSpecularColor;
312  m_materials.m_Paste.m_Shininess = matShininess;
313  m_materials.m_Paste.m_Emissive = SFVEC3F( 0.0f, 0.0f, 0.0f );
314 
315  // Silk screen material
316  m_materials.m_SilkSTop.m_Ambient = matAmbientColor;
317  m_materials.m_SilkSTop.m_Specular = matSpecularColor;
318  m_materials.m_SilkSTop.m_Shininess = matShininess;
319  m_materials.m_SilkSTop.m_Emissive = SFVEC3F( 0.0f, 0.0f, 0.0f );
320 
321  // Silk screen material
322  m_materials.m_SilkSBot.m_Ambient = matAmbientColor;
323  m_materials.m_SilkSBot.m_Specular = matSpecularColor;
324  m_materials.m_SilkSBot.m_Shininess = matShininess;
325  m_materials.m_SilkSBot.m_Emissive = SFVEC3F( 0.0f, 0.0f, 0.0f );
326 
327  // Solder mask material
328  m_materials.m_SolderMaskTop.m_Ambient = matAmbientColor;
329  m_materials.m_SolderMaskTop.m_Specular = matSpecularColor;
330  m_materials.m_SolderMaskTop.m_Shininess = matShininess;
331  m_materials.m_SolderMaskTop.m_Transparency = 0.17f;
332  m_materials.m_SolderMaskTop.m_Emissive = SFVEC3F( 0.0f, 0.0f, 0.0f );
333 
334  // Solder mask material
335  m_materials.m_SolderMaskBot.m_Ambient = matAmbientColor;
336  m_materials.m_SolderMaskBot.m_Specular = matSpecularColor;
337  m_materials.m_SolderMaskBot.m_Shininess = matShininess;
338  m_materials.m_SolderMaskBot.m_Transparency = 0.17f;
339  m_materials.m_SolderMaskBot.m_Emissive = SFVEC3F( 0.0f, 0.0f, 0.0f );
340 
341  // Epoxy material
342  m_materials.m_EpoxyBoard.m_Ambient = matAmbientColor;
343  m_materials.m_EpoxyBoard.m_Diffuse = m_boardAdapter.m_BoardBodyColor;
344  m_materials.m_EpoxyBoard.m_Specular = matSpecularColor;
345  m_materials.m_EpoxyBoard.m_Shininess = matShininess;
346  m_materials.m_EpoxyBoard.m_Emissive = SFVEC3F( 0.0f, 0.0f, 0.0f );
347 
348  // Gray material (used for example in technical vias and pad holes)
349  m_materials.m_GrayMaterial.m_Ambient = SFVEC3F( 0.8f, 0.8f, 0.8f );
350  m_materials.m_GrayMaterial.m_Diffuse = SFVEC3F( 0.3f, 0.3f, 0.3f );
351  m_materials.m_GrayMaterial.m_Specular = SFVEC3F( 0.4f, 0.4f, 0.4f );
352  m_materials.m_GrayMaterial.m_Shininess = 0.01f * 128.0f;
353  m_materials.m_GrayMaterial.m_Emissive = SFVEC3F( 0.0f, 0.0f, 0.0f );
354  }
355 }
bool GetFlag(DISPLAY3D_FLG aFlag) const
GetFlag - get a configuration status of a flag.
SFVEC3D m_SolderPasteColor
in realistic mode: solder paste color
SFVEC3D m_SolderMaskColorBot
in realistic mode: solder mask color ( bot )
float mapf(float x, float in_min, float in_max, float out_min, float out_max)
Definition: 3d_math.h:136
SFVEC3D m_SilkScreenColorBot
in realistic mode: SilkScreen color ( bot )
struct C3D_RENDER_OGL_LEGACY::@0 m_materials
BOARD_ADAPTER & m_boardAdapter
settings refrence in use for this render
SFVEC3D m_SolderMaskColorTop
in realistic mode: solder mask color ( top )
SFVEC3D m_SilkScreenColorTop
in realistic mode: SilkScreen color ( top )
glm::vec3 SFVEC3F
Definition: xv3d_types.h:47
SFVEC3D m_BoardBodyColor
in realistic mode: FR4 board color
SFVEC3D m_CopperColor
in realistic mode: copper color

References FL_USE_REALISTIC_MODE, BOARD_ADAPTER::GetFlag(), C3D_RENDER_BASE::m_boardAdapter, BOARD_ADAPTER::m_BoardBodyColor, BOARD_ADAPTER::m_CopperColor, m_materials, BOARD_ADAPTER::m_SilkScreenColorBot, BOARD_ADAPTER::m_SilkScreenColorTop, BOARD_ADAPTER::m_SolderMaskColorBot, BOARD_ADAPTER::m_SolderMaskColorTop, BOARD_ADAPTER::m_SolderPasteColor, and mapf().

Referenced by Redraw().

Member Data Documentation

◆ m_3dmodel_map

MAP_3DMODEL C3D_RENDER_OGL_LEGACY::m_3dmodel_map
private

◆ m_boardAdapter

◆ m_camera

◆ m_Copper

SMATERIAL C3D_RENDER_OGL_LEGACY::m_Copper

Definition at line 206 of file c3d_render_ogl_legacy.h.

◆ m_EpoxyBoard

SMATERIAL C3D_RENDER_OGL_LEGACY::m_EpoxyBoard

Definition at line 205 of file c3d_render_ogl_legacy.h.

◆ m_GrayMaterial

SMATERIAL C3D_RENDER_OGL_LEGACY::m_GrayMaterial

Definition at line 208 of file c3d_render_ogl_legacy.h.

◆ m_is_opengl_initialized

bool C3D_RENDER_BASE::m_is_opengl_initialized
protectedinherited

flag if the opengl specific for this render was already initialized

Definition at line 115 of file c3d_render_base.h.

Referenced by C3D_RENDER_BASE::C3D_RENDER_BASE(), C3D_RENDER_RAYTRACING::initializeOpenGL(), initializeOpenGL(), C3D_RENDER_RAYTRACING::Redraw(), and Redraw().

◆ m_last_grid_type

GRID3D_TYPE C3D_RENDER_OGL_LEGACY::m_last_grid_type
private

Stores the last grid computed.

Definition at line 102 of file c3d_render_ogl_legacy.h.

Referenced by C3D_RENDER_OGL_LEGACY(), and Redraw().

◆ m_logTrace

const wxChar * C3D_RENDER_BASE::m_logTrace = wxT( "KI_TRACE_3D_RENDER" )
staticprotectedinherited

Trace mask used to enable or disable the trace output of this class.

The debug output can be turned on by setting the WXTRACE environment variable to "KI_TRACE_3D_RENDER". See the wxWidgets documentation on wxLogTrace for more information.

Definition at line 129 of file c3d_render_base.h.

Referenced by C3D_RENDER_BASE::C3D_RENDER_BASE(), C3D_RENDER_OGL_LEGACY(), C3D_RENDER_RAYTRACING::C3D_RENDER_RAYTRACING(), C3D_RENDER_RAYTRACING::opengl_init_pbo(), ~C3D_RENDER_OGL_LEGACY(), and C3D_RENDER_RAYTRACING::~C3D_RENDER_RAYTRACING().

◆ m_materials

struct { ... } C3D_RENDER_OGL_LEGACY::m_materials

◆ m_ogl_circle_texture

GLuint C3D_RENDER_OGL_LEGACY::m_ogl_circle_texture
private

◆ m_ogl_disp_list_board

CLAYERS_OGL_DISP_LISTS* C3D_RENDER_OGL_LEGACY::m_ogl_disp_list_board
private

◆ m_ogl_disp_list_grid

GLuint C3D_RENDER_OGL_LEGACY::m_ogl_disp_list_grid
private

oGL list that stores current grid

Definition at line 100 of file c3d_render_ogl_legacy.h.

Referenced by C3D_RENDER_OGL_LEGACY(), generate_new_3DGrid(), ogl_free_all_display_lists(), and Redraw().

◆ m_ogl_disp_list_pads_holes

CLAYERS_OGL_DISP_LISTS* C3D_RENDER_OGL_LEGACY::m_ogl_disp_list_pads_holes
private

◆ m_ogl_disp_list_through_holes_outer

CLAYERS_OGL_DISP_LISTS* C3D_RENDER_OGL_LEGACY::m_ogl_disp_list_through_holes_outer
private

◆ m_ogl_disp_list_through_holes_outer_with_npth

CLAYERS_OGL_DISP_LISTS* C3D_RENDER_OGL_LEGACY::m_ogl_disp_list_through_holes_outer_with_npth
private

◆ m_ogl_disp_list_through_holes_vias_outer

CLAYERS_OGL_DISP_LISTS* C3D_RENDER_OGL_LEGACY::m_ogl_disp_list_through_holes_vias_outer
private

◆ m_ogl_disp_list_through_holes_vias_outer_ring

CLAYERS_OGL_DISP_LISTS* C3D_RENDER_OGL_LEGACY::m_ogl_disp_list_through_holes_vias_outer_ring
private

◆ m_ogl_disp_list_via

CLAYERS_OGL_DISP_LISTS* C3D_RENDER_OGL_LEGACY::m_ogl_disp_list_via
private

◆ m_ogl_disp_list_vias_and_pad_holes_outer_contourn_and_caps

CLAYERS_OGL_DISP_LISTS* C3D_RENDER_OGL_LEGACY::m_ogl_disp_list_vias_and_pad_holes_outer_contourn_and_caps
private

Definition at line 94 of file c3d_render_ogl_legacy.h.

Referenced by C3D_RENDER_OGL_LEGACY(), and ogl_free_all_display_lists().

◆ m_ogl_disp_lists_layers

MAP_OGL_DISP_LISTS C3D_RENDER_OGL_LEGACY::m_ogl_disp_lists_layers
private

◆ m_ogl_disp_lists_layers_holes_inner

MAP_OGL_DISP_LISTS C3D_RENDER_OGL_LEGACY::m_ogl_disp_lists_layers_holes_inner
private

◆ m_ogl_disp_lists_layers_holes_outer

MAP_OGL_DISP_LISTS C3D_RENDER_OGL_LEGACY::m_ogl_disp_lists_layers_holes_outer
private

◆ m_Paste

SMATERIAL C3D_RENDER_OGL_LEGACY::m_Paste

Definition at line 200 of file c3d_render_ogl_legacy.h.

◆ m_Plastic

SMATERIAL C3D_RENDER_OGL_LEGACY::m_Plastic

Definition at line 207 of file c3d_render_ogl_legacy.h.

◆ m_reloadRequested

bool C3D_RENDER_BASE::m_reloadRequested
protectedinherited

◆ m_SilkSBot

SMATERIAL C3D_RENDER_OGL_LEGACY::m_SilkSBot

Definition at line 201 of file c3d_render_ogl_legacy.h.

◆ m_SilkSTop

SMATERIAL C3D_RENDER_OGL_LEGACY::m_SilkSTop

Definition at line 202 of file c3d_render_ogl_legacy.h.

◆ m_SolderMaskBot

SMATERIAL C3D_RENDER_OGL_LEGACY::m_SolderMaskBot

Definition at line 203 of file c3d_render_ogl_legacy.h.

◆ m_SolderMaskTop

SMATERIAL C3D_RENDER_OGL_LEGACY::m_SolderMaskTop

Definition at line 204 of file c3d_render_ogl_legacy.h.

◆ m_triangles

MAP_TRIANGLES C3D_RENDER_OGL_LEGACY::m_triangles
private

◆ m_windowSize


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