36#include <glm/geometric.hpp>
48#define UNITS3D_TO_UNITSPCB ( pcbIUScale.IU_PER_MM )
55 wxLogTrace(
m_logTrace, wxT(
"RENDER_3D_OPENGL::RENDER_3D_OPENGL" ) );
87 wxLogTrace(
m_logTrace, wxT(
"RENDER_3D_OPENGL::RENDER_3D_OPENGL" ) );
116 glEnable( GL_LIGHT0 );
118 glDisable( GL_LIGHT0 );
125 glEnable( GL_LIGHT1 );
127 glDisable( GL_LIGHT1 );
134 glEnable( GL_LIGHT2 );
136 glDisable( GL_LIGHT2 );
144 glDisable( GL_CULL_FACE );
148 glClear( GL_DEPTH_BUFFER_BIT );
150 glMatrixMode( GL_PROJECTION );
154 glMatrixMode( GL_MODELVIEW );
157 const glm::mat4 TranslationMatrix =
158 glm::translate( glm::mat4( 1.0f ),
SFVEC3F( 0.0f, 0.0f, -( arrow_size * 2.75f ) ) );
162 glLoadMatrixf( glm::value_ptr( ViewMatrix ) );
166 glColor3f( 0.9f, 0.0f, 0.0f );
169 glColor3f( 0.0f, 0.9f, 0.0f );
172 glColor3f( 0.0f, 0.0f, 0.9f );
175 glEnable( GL_CULL_FACE );
202 m_materials.m_Copper.m_Shininess = shininessfactor * 128.0f;
211 m_materials.m_NonPlatedCopper.m_Shininess = 0.1f * 128.0f;
239 m_materials.m_SilkSTop.m_Shininess = 0.078125f * 128.0f;
252 m_materials.m_SilkSBot.m_Shininess = 0.078125f * 128.0f;
255 m_materials.m_SolderMask.m_Shininess = 0.8f * 128.0f;
265 m_materials.m_EpoxyBoard.m_Shininess = 0.1f * 128.0f;
283 m_materials.m_SolderMask.m_Transparency = 1.0f - layerColor.a;
343 m_materials.m_Plastic.m_Shininess = 0.078125f * 128.0f;
360 const GLfloat ambient[] = { 0.084f, 0.084f, 0.084f, 1.0f };
361 const GLfloat diffuse0[] = { 0.3f, 0.3f, 0.3f, 1.0f };
362 const GLfloat specular0[] = { 0.5f, 0.5f, 0.5f, 1.0f };
364 glLightfv( GL_LIGHT0, GL_AMBIENT, ambient );
365 glLightfv( GL_LIGHT0, GL_DIFFUSE, diffuse0 );
366 glLightfv( GL_LIGHT0, GL_SPECULAR, specular0 );
368 const GLfloat diffuse12[] = { 0.7f, 0.7f, 0.7f, 1.0f };
369 const GLfloat specular12[] = { 0.7f, 0.7f, 0.7f, 1.0f };
372 GLfloat position[4] = { 0.0f, 0.0f, 1.0f, 0.0f };
376 glm::pi<float>() * 0.25f );
378 position[0] = vectorLight.x;
379 position[1] = vectorLight.y;
380 position[2] = vectorLight.z;
382 glLightfv( GL_LIGHT1, GL_AMBIENT, ambient );
383 glLightfv( GL_LIGHT1, GL_DIFFUSE, diffuse12 );
384 glLightfv( GL_LIGHT1, GL_SPECULAR, specular12 );
385 glLightfv( GL_LIGHT1, GL_POSITION, position );
388 position[2] = -position[2];
390 glLightfv( GL_LIGHT2, GL_AMBIENT, ambient );
391 glLightfv( GL_LIGHT2, GL_DIFFUSE, diffuse12 );
392 glLightfv( GL_LIGHT2, GL_SPECULAR, specular12 );
393 glLightfv( GL_LIGHT2, GL_POSITION, position );
395 const GLfloat lmodel_ambient[] = { 0.0f, 0.0f, 0.0f, 1.0f };
397 glLightModelfv( GL_LIGHT_MODEL_AMBIENT, lmodel_ambient );
399 glLightModeli( GL_LIGHT_MODEL_TWO_SIDE, GL_FALSE );
411 glEnable( GL_POLYGON_OFFSET_FILL );
412 glPolygonOffset( -0.1f, -2.0f );
419 glDisable( GL_POLYGON_OFFSET_FILL );
434 if( aSkipRenderHoles )
452 return SFVEC4F( aInput.r * aInput.a, aInput.g * aInput.a, aInput.b * aInput.a, aInput.a );
472 if( aStatusReporter )
473 aStatusReporter->
Report(
_(
"Loading..." ) );
475 reload( aStatusReporter, aWarningReporter );
495 glDepthFunc( GL_LESS );
496 glEnable( GL_CULL_FACE );
497 glFrontFace( GL_CCW );
498 glEnable( GL_NORMALIZE );
502 glDisable( GL_MULTISAMPLE );
504 glEnable( GL_MULTISAMPLE );
507 glClearColor( 0.0f, 0.0f, 0.0f, 0.0f );
508 glClearDepth( 1.0f );
509 glClearStencil( 0x00 );
510 glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT );
518 glEnable( GL_DEPTH_TEST );
521 glMatrixMode( GL_PROJECTION );
523 glMatrixMode( GL_MODELVIEW );
532 glEnable( GL_LIGHTING );
541 if( cameraPos.z > 0.0f )
542 zpos = glm::max( cameraPos.z, 0.5f ) + cameraPos.z * cameraPos.z;
544 zpos = glm::min( cameraPos.z,-0.5f ) - cameraPos.z * cameraPos.z;
547 const GLfloat headlight_pos[] = { cameraPos.x, cameraPos.y, zpos, 1.0f };
549 glLightfv( GL_LIGHT0, GL_POSITION, headlight_pos );
555 bool showThickness = !skipThickness;
561 if( !( skipRenderVias || skipRenderHoles ) &&
m_vias )
568 for( MAP_OGL_DISP_LISTS::const_iterator ii =
m_layers.begin(); ii !=
m_layers.end(); ++ii )
574 bool isCopperLayer = layer >=
F_Cu && layer <=
B_Cu;
583 const double opacity_min = 0.8;
605 if( !skipRenderHoles )
643 else if( isPasteLayer && skipRenderHoles )
661 anti_board =
nullptr;
668 if( throughHolesOuter )
677 pLayerDispList->
DrawCulled( showThickness, solder_mask, throughHolesOuter, anti_board );
683 glm::mat4 cameraViewMatrix;
685 glGetFloatv( GL_MODELVIEW_MATRIX, glm::value_ptr( cameraViewMatrix ) );
699 glEnable( GL_POLYGON_OFFSET_FILL );
700 glPolygonOffset( 0.0f, -2.0f );
707 showThickness, skipRenderHoles );
713 showThickness, skipRenderHoles );
721 showThickness, skipRenderHoles );
727 showThickness, skipRenderHoles );
731 glDisable( GL_POLYGON_OFFSET_FILL );
732 glPolygonOffset( 0.0f, 0.0f );
738 glDepthMask( GL_FALSE );
739 glEnable( GL_BLEND );
740 glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
743 glEnable( GL_TEXTURE_2D );
744 glActiveTexture( GL_TEXTURE0 );
747 glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE );
748 glTexEnvf( GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_INTERPOLATE );
749 glTexEnvf( GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_MODULATE );
751 glTexEnvi( GL_TEXTURE_ENV, GL_SRC0_RGB, GL_PRIMARY_COLOR );
752 glTexEnvi( GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR );
754 glTexEnvi( GL_TEXTURE_ENV, GL_SRC1_RGB, GL_PREVIOUS );
755 glTexEnvi( GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR );
757 glTexEnvi( GL_TEXTURE_ENV, GL_SRC0_ALPHA, GL_PRIMARY_COLOR );
758 glTexEnvi( GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, GL_SRC_ALPHA );
759 glTexEnvi( GL_TEXTURE_ENV, GL_SRC1_ALPHA, GL_CONSTANT );
760 glTexEnvi( GL_TEXTURE_ENV, GL_OPERAND1_ALPHA, GL_SRC_ALPHA );
764 glDisable( GL_BLEND );
767 glDepthMask( GL_TRUE );
772 glDisable( GL_LIGHTING );
777 glEnable( GL_LIGHTING );
794 glEnable( GL_LINE_SMOOTH );
795 glShadeModel( GL_SMOOTH );
798 glPixelStorei( GL_UNPACK_ALIGNMENT, 4 );
815 circleImageBlured->
EfxFilter_SkipCenter( circleImage, IMAGE_FILTER::GAUSSIAN_BLUR, circleRadius - 8 );
819 delete circleImageBlured;
820 circleImageBlured =
nullptr;
823 circleImage =
nullptr;
837 glEnable( GL_COLOR_MATERIAL );
838 glColorMaterial( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE );
845 glMaterialfv( GL_FRONT_AND_BACK, GL_SPECULAR, &specular.r );
846 glMaterialf( GL_FRONT_AND_BACK, GL_SHININESS, 96.0f );
848 glMaterialfv( GL_FRONT_AND_BACK, GL_AMBIENT, &ambient.r );
849 glMaterialfv( GL_FRONT_AND_BACK, GL_DIFFUSE, &diffuse.r );
850 glMaterialfv( GL_FRONT_AND_BACK, GL_EMISSION, &emissive.r );
856#define DELETE_AND_FREE( ptr ) \
862#define DELETE_AND_FREE_MAP( map ) \
864 for( auto& [ layer, ptr ] : map ) \
871 glDeleteLists(
m_grid, 1 );
908 bool aShowThickness,
bool aSkipRenderHoles )
910 wxASSERT( (aLayerID ==
B_Mask) || (aLayerID ==
F_Mask) );
930 bool aGetBot,
bool aRenderTransparentOnly,
931 bool aRenderSelectedOnly )
933 wxASSERT( ( aGetTop ==
true ) || ( aGetBot ==
true ) );
943 bool highlight =
false;
947 if( fp->IsSelected() )
953 if( aRenderSelectedOnly != highlight )
957 if( !fp->Models().empty() )
961 const bool isFlipped = fp->IsFlipped();
963 if( aGetTop == !isFlipped || aGetBot == isFlipped )
973 bool aRenderTransparentOnly,
bool aIsSelected )
975 if( !aFootprint->
Models().empty() )
981 glm::mat4 fpMatrix( 1.0f );
995 fpMatrix = glm::rotate( fpMatrix, glm::pi<float>(),
SFVEC3F( 0.0f, 1.0f, 0.0f ) );
996 fpMatrix = glm::rotate( fpMatrix, glm::pi<float>(),
SFVEC3F( 0.0f, 0.0f, 1.0f ) );
1001 fpMatrix = glm::scale( fpMatrix,
SFVEC3F( modelunit_to_3d_units_factor ) );
1006 if( !sM.m_Show || sM.m_Filename.empty() )
1015 if(
const MODEL_3D* modelPtr = cache_i->second )
1017 bool opaque = sM.m_Opacity >= 1.0;
1019 if( ( !aRenderTransparentOnly && modelPtr->HasOpaqueMeshes() && opaque ) ||
1020 ( aRenderTransparentOnly && ( modelPtr->HasTransparentMeshes() || !opaque ) ) )
1022 glm::mat4 modelworldMatrix = fpMatrix;
1024 const SFVEC3F offset =
SFVEC3F( sM.m_Offset.x, sM.m_Offset.y, sM.m_Offset.z );
1025 const SFVEC3F rotation =
SFVEC3F( sM.m_Rotation.x, sM.m_Rotation.y, sM.m_Rotation.z );
1028 std::vector<float> key = { offset.x, offset.y, offset.z,
1029 rotation.x, rotation.y, rotation.z,
1036 modelworldMatrix *= it->second;
1040 glm::mat4 mtx( 1.0f );
1041 mtx = glm::translate( mtx, offset );
1042 mtx = glm::rotate( mtx, glm::radians( -rotation.z ), { 0.0f, 0.0f, 1.0f } );
1043 mtx = glm::rotate( mtx, glm::radians( -rotation.y ), { 0.0f, 1.0f, 0.0f } );
1044 mtx = glm::rotate( mtx, glm::radians( -rotation.x ), { 1.0f, 0.0f, 0.0f } );
1045 mtx = glm::scale( mtx,
scale );
1048 modelworldMatrix *= mtx;
1051 aDstRenderList.emplace_back( modelworldMatrix, modelPtr,
1052 aRenderTransparentOnly ? sM.m_Opacity : 1.0f,
1053 aRenderTransparentOnly,
1070 std::list<MODELTORENDER> renderList;
1078 if( !renderList.empty() )
1083 renderModel( aCameraViewMatrix, mtr, selColor,
nullptr );
1092 if( !renderList.empty() )
1097 renderModel( aCameraViewMatrix, mtr, selColor,
nullptr );
1112 std::list<MODELTORENDER> renderListModels;
1123 if( renderListModels.empty() )
1126 std::vector<std::pair<const MODELTORENDER *, float>> transparentModelList;
1128 transparentModelList.reserve( renderListModels.size() );
1135 const BBOX_3D& bBox = mtr.m_model->GetBBox();
1137 const SFVEC3F bBoxWorld = mtr.m_modelWorldMat * glm::vec4( bBoxCenter, 1.0f );
1139 const float distanceToCamera = glm::length( cameraPos - bBoxWorld );
1141 transparentModelList.emplace_back( &mtr, distanceToCamera );
1145 std::sort( transparentModelList.begin(), transparentModelList.end(),
1146 [&]( std::pair<const MODELTORENDER *, float>& a,
1147 std::pair<const MODELTORENDER *, float>& b )
1149 if( a.second != b.second )
1150 return a.second > b.second;
1152 return a.first > b.first;
1158 bool isUsingColorInformation = !( transparentModelList.begin()->first->m_isSelected &&
1163 for(
const std::pair<const MODELTORENDER *, float>& mtr : transparentModelList )
1168 if( !isUsingColorInformation && !mtr.first->m_isSelected )
1170 isUsingColorInformation =
true;
1172 glEnableClientState( GL_COLOR_ARRAY );
1173 glEnableClientState( GL_TEXTURE_COORD_ARRAY );
1174 glEnable( GL_COLOR_MATERIAL );
1176 else if( isUsingColorInformation && mtr.first->m_isSelected )
1178 isUsingColorInformation =
false;
1180 glDisableClientState( GL_COLOR_ARRAY );
1181 glDisableClientState( GL_TEXTURE_COORD_ARRAY );
1182 glDisable( GL_COLOR_MATERIAL );
1188 renderModel( aCameraViewMatrix, *mtr.first, selColor, &cameraPos );
1203 const glm::mat4 modelviewMatrix = aCameraViewMatrix * aModelToRender.
m_modelWorldMat;
1205 glLoadMatrixf( glm::value_ptr( modelviewMatrix ) );
1213 const bool wasBlendEnabled = glIsEnabled( GL_BLEND );
1215 if( !wasBlendEnabled )
1217 glEnable( GL_BLEND );
1218 glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
1221 glDisable( GL_LIGHTING );
1229 glEnable( GL_LIGHTING );
1231 if( !wasBlendEnabled )
1232 glDisable( GL_BLEND );
1240 glDeleteLists(
m_grid, 1 );
1244 if( aGridType == GRID3D_TYPE::NONE )
1247 m_grid = glGenLists( 1 );
1249 if( !glIsList(
m_grid ) )
1252 glNewList(
m_grid, GL_COMPILE );
1254 glEnable( GL_BLEND );
1255 glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
1257 const double zpos = 0.0;
1265 const GLfloat transparency = 0.35f;
1267 double griSizeMM = 0.0;
1271 case GRID3D_TYPE::GRID_1MM: griSizeMM = 1.0;
break;
1272 case GRID3D_TYPE::GRID_2P5MM: griSizeMM = 2.5;
break;
1273 case GRID3D_TYPE::GRID_5MM: griSizeMM = 5.0;
break;
1274 case GRID3D_TYPE::GRID_10MM: griSizeMM = 10.0;
break;
1277 case GRID3D_TYPE::NONE:
return;
1280 glNormal3f( 0.0, 0.0, 1.0 );
1285 brd_center_pos.
y = -brd_center_pos.
y;
1291 double xmin = ( brd_center_pos.
x - xsize / 2 ) *
scale;
1292 double xmax = ( brd_center_pos.
x + xsize / 2 ) *
scale;
1293 double ymin = ( brd_center_pos.
y - ysize / 2 ) *
scale;
1294 double ymax = ( brd_center_pos.
y + ysize / 2 ) *
scale;
1302 for(
int ii = 0; ; ii++ )
1305 glColor4f( gridColor.r, gridColor.g, gridColor.b, transparency );
1307 glColor4f( gridColor_marker.r, gridColor_marker.g, gridColor_marker.b,
1312 if(
delta <= xsize / 2 )
1314 glBegin( GL_LINES );
1315 glVertex3f( (brd_center_pos.
x +
delta) *
scale, -ymin, zpos );
1316 glVertex3f( (brd_center_pos.
x +
delta) *
scale, -ymax, zpos );
1321 glBegin( GL_LINES );
1322 glVertex3f( (brd_center_pos.
x -
delta) *
scale, -ymin, zpos );
1323 glVertex3f( (brd_center_pos.
x -
delta) *
scale, -ymax, zpos );
1328 if(
delta <= ysize / 2 )
1330 glBegin( GL_LINES );
1331 glVertex3f( xmin, -( brd_center_pos.
y +
delta ) *
scale, zpos );
1332 glVertex3f( xmax, -( brd_center_pos.
y +
delta ) *
scale, zpos );
1337 glBegin( GL_LINES );
1338 glVertex3f( xmin, -( brd_center_pos.
y -
delta ) *
scale, zpos );
1339 glVertex3f( xmax, -( brd_center_pos.
y -
delta ) *
scale, zpos );
1344 if( (
delta > ysize / 2 ) && (
delta > xsize / 2 ) )
1349 glNormal3f( 0.0, -1.0, 0.0 );
1352 double posy = -brd_center_pos.
y *
scale;
1354 for(
int ii = 0; ; ii++ )
1357 glColor4f( gridColor.r, gridColor.g, gridColor.b, transparency );
1359 glColor4f( gridColor_marker.r, gridColor_marker.g, gridColor_marker.b,
1364 glBegin( GL_LINES );
1367 glVertex3f( xmax, posy, zmin );
1368 glVertex3f( xmax, posy, zmax );
1373 glBegin( GL_LINES );
1375 glVertex3f( xmin, posy, zmin );
1376 glVertex3f( xmin, posy, zmax );
1380 if(
delta > xsize / 2.0f )
1385 for(
int ii = 0; ; ii++ )
1388 glColor4f( gridColor.r, gridColor.g, gridColor.b, transparency );
1390 glColor4f( gridColor_marker.r, gridColor_marker.g, gridColor_marker.b, transparency );
1397 glBegin( GL_LINES );
1398 glVertex3f( xmin, posy,
delta );
1399 glVertex3f( xmax, posy,
delta );
1403 if(
delta <= -zmin && ( ii != 0 ) )
1406 glBegin( GL_LINES );
1407 glVertex3f( xmin, posy, -
delta );
1408 glVertex3f( xmax, posy, -
delta );
1416 glDisable( GL_BLEND );
Defines math related functions.
float mapf(float x, float in_min, float in_max, float out_min, float out_max)
SFVEC3F SphericalToCartesian(float aInclination, float aAzimuth)
https://en.wikipedia.org/wiki/Spherical_coordinate_system
constexpr EDA_IU_SCALE pcbIUScale
#define RANGE_SCALE_3D
This defines the range that all coord will have to be rendered.
Helper class to handle information needed to display 3D board.
double BiuTo3dUnits() const noexcept
Board integer units To 3D units.
SFVEC4F m_BgColorTop
background top color
SFVEC4F m_SolderPasteColor
in realistic mode: solder paste color
bool IsFootprintShown(FOOTPRINT_ATTR_T aFPAttributes) const
Test if footprint should be displayed in relation to attributes and the flags.
VECTOR2I GetBoardSize() const noexcept
Get the board size.
std::bitset< LAYER_3D_END > GetVisibleLayers() const
SFVEC4F m_SolderMaskColorBot
in realistic mode: solder mask color ( bot )
VECTOR2I GetBoardPos() const noexcept
Get the board center.
float GetLayerBottomZPos(PCB_LAYER_ID aLayerId) const noexcept
Get the bottom z position.
SFVEC4F m_SolderMaskColorTop
in realistic mode: solder mask color ( top )
SFVEC4F GetColor(const COLOR4D &aColor) const
SFVEC4F m_CopperColor
in realistic mode: copper color
const BOARD * GetBoard() const noexcept
float GetFootprintZPos(bool aIsFlipped) const
Get the position of the footprint in 3d integer units considering if it is flipped or not.
float GetNonCopperLayerThickness() const noexcept
Get the non copper layers thickness (in 3D units).
float GetLayerTopZPos(PCB_LAYER_ID aLayerId) const noexcept
Get the top z position.
EDA_3D_VIEWER_SETTINGS * m_Cfg
SFVEC4F m_SilkScreenColorTop
in realistic mode: SilkScreen color ( top )
SFVEC4F m_SilkScreenColorBot
in realistic mode: SilkScreen color ( bot )
float GetBoardBodyThickness() const noexcept
Get the board body thickness, including internal copper layers (in 3D units).
SFVEC4F m_BoardBodyColor
in realistic mode: FR4 board color
SFVEC4F m_UserCommentsColor
SFVEC4F GetLayerColor(PCB_LAYER_ID aLayerId) const
Get the technical color of a layer.
SFVEC4F m_UserDrawingsColor
SFVEC4F m_BgColorBot
background bottom color
const FOOTPRINTS & Footprints() const
A class used to derive camera objects from.
glm::mat4 GetRotationMatrix() const
Get the rotation matrix to be applied in a transformation camera.
const glm::mat4 & GetProjectionMatrix() const
const SFVEC3F & GetPos() const
const glm::mat4 & GetViewMatrix() const
Implement a canvas based on a wxGLCanvas.
Manage an 8-bit channel image.
void CircleFilled(int aCx, int aCy, int aRadius, unsigned char aValue)
void EfxFilter_SkipCenter(IMAGE *aInImg, IMAGE_FILTER aFilterType, unsigned int aRadius)
Apply a filter to the input image and store it in the image class.
unsigned int GetHeight() const
unsigned int GetWidth() const
static LSET PhysicalLayersMask()
Return a mask holding all layers which are physically realized.
void DrawBbox() const
Draw main bounding box of the model.
static void EndDrawMulti()
Cleanup render states after drawing multiple models.
void Draw(bool aTransparent, float aOpacity, bool aUseSelectedMaterial, const SFVEC3F &aSelectionColor, const glm::mat4 *aModelWorldMatrix, const SFVEC3F *aCameraWorldPos) const
Render the model into the current context.
static void BeginDrawMulti(bool aUseColorInformation)
Set some basic render states before drawing multiple models.
void DrawBboxes() const
Draw individual bounding boxes of each mesh.
Store the OpenGL display lists to related with a layer.
void ApplyScalePosition(float aZposition, float aZscale)
void SetItIsTransparent(bool aSetTransparent)
void DrawCulled(bool aDrawMiddle, const OPENGL_RENDER_LIST *aSubtractList=nullptr, const OPENGL_RENDER_LIST *bSubtractList=nullptr, const OPENGL_RENDER_LIST *cSubtractList=nullptr, const OPENGL_RENDER_LIST *dSubtractList=nullptr) const
Draw all layers if they are visible by the camera if camera position is above the layer.
void DrawAll(bool aDrawMiddle=true) const
Call to draw all the display lists.
This is a base class to hold data and functions for render targets.
CAMERA & m_camera
Flag if the canvas specific for this render was already initialized.
std::unique_ptr< BUSY_INDICATOR > CreateBusyIndicator() const
Return a created busy indicator, if a factory has been set, else a null pointer.
bool m_reloadRequested
The window size that this camera is working.
BOARD_ADAPTER & m_boardAdapter
OPENGL_RENDER_LIST * m_board
OPENGL_RENDER_LIST * m_vias
OPENGL_RENDER_LIST * m_outerThroughHoleRings
OPENGL_RENDER_LIST * m_offboardPadsFront
GRID3D_TYPE m_lastGridType
Stores the last grid type.
void renderOpaqueModels(const glm::mat4 &aCameraViewMatrix)
void generate3dGrid(GRID3D_TYPE aGridType)
Create a 3D grid to an OpenGL display list.
void setLightFront(bool enabled)
bool Redraw(bool aIsMoving, REPORTER *aStatusReporter, REPORTER *aWarningReporter) override
Redraw the view.
MAP_OGL_DISP_LISTS m_layers
MAP_OGL_DISP_LISTS m_innerLayerHoles
OPENGL_RENDER_LIST * m_boardWithHoles
RENDER_3D_OPENGL(EDA_3D_CANVAS *aCanvas, BOARD_ADAPTER &aAdapter, CAMERA &aCamera)
MAP_OGL_DISP_LISTS m_outerLayerHoles
OPENGL_RENDER_LIST * m_offboardPadsBack
BOARD_ITEM * m_currentRollOverItem
void renderBoardBody(bool aSkipRenderHoles)
std::map< std::vector< float >, glm::mat4 > m_3dModelMatrixMap
std::map< wxString, MODEL_3D * > m_3dModelMap
LIST_TRIANGLES m_triangles
store pointers so can be deleted latter
OPENGL_RENDER_LIST * m_outerViaThroughHoles
OPENGL_RENDER_LIST * m_outerThroughHoles
void setLayerMaterial(PCB_LAYER_ID aLayerID)
OPENGL_RENDER_LIST * m_platedPadsFront
void renderModel(const glm::mat4 &aCameraViewMatrix, const MODELTORENDER &aModelToRender, const SFVEC3F &aSelColor, const SFVEC3F *aCameraWorldPos)
int GetWaitForEditingTimeOut() override
Give the interface the time (in ms) that it should wait for editing or movements before (this works f...
void renderSolderMaskLayer(PCB_LAYER_ID aLayerID, float aZPos, bool aShowThickness, bool aSkipRenderHoles)
void renderTransparentModels(const glm::mat4 &aCameraViewMatrix)
void get3dModelsSelected(std::list< MODELTORENDER > &aDstRenderList, bool aGetTop, bool aGetBot, bool aRenderTransparentOnly, bool aRenderSelectedOnly)
void setPlatedCopperAndDepthOffset(PCB_LAYER_ID aLayer_id)
OPENGL_RENDER_LIST * m_antiBoard
void SetCurWindowSize(const wxSize &aSize) override
Before each render, the canvas will tell the render what is the size of its windows,...
OPENGL_RENDER_LIST * m_padHoles
GLuint m_grid
oGL list that stores current grid
OPENGL_RENDER_LIST * m_platedPadsBack
void get3dModelsFromFootprint(std::list< MODELTORENDER > &aDstRenderList, const FOOTPRINT *aFootprint, bool aRenderTransparentOnly, bool aIsSelected)
struct RENDER_3D_OPENGL::@2 m_materials
void setLightBottom(bool enabled)
void setLightTop(bool enabled)
A pure virtual class used to derive REPORTER objects from.
virtual REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED)=0
Report a string with a given severity.
Store arrays of triangles to be used to create display lists.
#define DELETE_AND_FREE_MAP(map)
#define DELETE_AND_FREE(ptr)
#define UNITS3D_TO_UNITSPCB
Implements a model viewer canvas.
static const wxChar * m_logTrace
Trace mask used to enable or disable the trace output of this class.
@ LAYER_3D_SOLDERMASK_TOP
@ LAYER_3D_SOLDERMASK_BOTTOM
PCB_LAYER_ID
A quick note on layer IDs:
void OglResetTextureState()
Reset to default state the texture settings.
void OglSetMaterial(const SMATERIAL &aMaterial, float aOpacity, bool aUseSelectedMaterial, SFVEC3F aSelectionColor)
Set OpenGL materials.
GLuint OglLoadTexture(const IMAGE &aImage)
Generate a new OpenGL texture.
void OglDrawBackground(const SFVEC4F &aTopColor, const SFVEC4F &aBotColor)
Define generic OpenGL functions that are common to any OpenGL target.
void DrawRoundArrow(SFVEC3F aPosition, SFVEC3F aTargetPos, float aSize)
Draw a round arrow.
static SFVEC4F premultiplyAlpha(const SFVEC4F &aInput)
#define SIZE_OF_CIRCLE_TEXTURE
Manage a bounding box defined by two SFVEC3F min max points.
SFVEC3F GetCenter() const
Return the center point of the bounding box.
bool opengl_thickness_disableOnMove
KIGFX::COLOR4D opengl_selection_color
bool clip_silk_on_via_annuli
bool differentiate_plated_copper
bool subtract_mask_from_silk
bool highlight_on_rollover
bool opengl_holes_disableOnMove
bool opengl_AA_disableOnMove
bool opengl_vias_disableOnMove
constexpr int mmToIU(double mm) const
glm::mat4 m_modelWorldMat
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".