37#include <glm/geometric.hpp>
50#define UNITS3D_TO_UNITSPCB ( pcbIUScale.IU_PER_MM )
57 wxLogTrace(
m_logTrace, wxT(
"RENDER_3D_OPENGL::RENDER_3D_OPENGL" ) );
91 wxLogTrace(
m_logTrace, wxT(
"RENDER_3D_OPENGL::RENDER_3D_OPENGL" ) );
110 int fbWidth, fbHeight;
111 glGetIntegerv( GL_VIEWPORT, viewport );
124 glEnable( GL_LIGHT0 );
126 glDisable( GL_LIGHT0 );
133 glEnable( GL_LIGHT1 );
135 glDisable( GL_LIGHT1 );
142 glEnable( GL_LIGHT2 );
144 glDisable( GL_LIGHT2 );
201 m_materials.m_Copper.m_Shininess = shininessfactor * 128.0f;
210 m_materials.m_NonPlatedCopper.m_Shininess = 0.1f * 128.0f;
238 m_materials.m_SilkSTop.m_Shininess = 0.078125f * 128.0f;
251 m_materials.m_SilkSBot.m_Shininess = 0.078125f * 128.0f;
254 m_materials.m_SolderMask.m_Shininess = 0.8f * 128.0f;
264 m_materials.m_EpoxyBoard.m_Shininess = 0.1f * 128.0f;
294 m_materials.m_SolderMask.m_Transparency = 1.0f - layerColor.a;
354 m_materials.m_Plastic.m_Shininess = 0.078125f * 128.0f;
377 m_materials.m_Plastic.m_Shininess = 0.078125f * 128.0f;
395 const GLfloat ambient[] = { 0.084f, 0.084f, 0.084f, 1.0f };
396 const GLfloat diffuse0[] = { 0.3f, 0.3f, 0.3f, 1.0f };
397 const GLfloat specular0[] = { 0.5f, 0.5f, 0.5f, 1.0f };
399 glLightfv( GL_LIGHT0, GL_AMBIENT, ambient );
400 glLightfv( GL_LIGHT0, GL_DIFFUSE, diffuse0 );
401 glLightfv( GL_LIGHT0, GL_SPECULAR, specular0 );
403 const GLfloat diffuse12[] = { 0.7f, 0.7f, 0.7f, 1.0f };
404 const GLfloat specular12[] = { 0.7f, 0.7f, 0.7f, 1.0f };
407 GLfloat position[4] = { 0.0f, 0.0f, 1.0f, 0.0f };
411 glm::pi<float>() * 0.25f );
413 position[0] = vectorLight.x;
414 position[1] = vectorLight.y;
415 position[2] = vectorLight.z;
417 glLightfv( GL_LIGHT1, GL_AMBIENT, ambient );
418 glLightfv( GL_LIGHT1, GL_DIFFUSE, diffuse12 );
419 glLightfv( GL_LIGHT1, GL_SPECULAR, specular12 );
420 glLightfv( GL_LIGHT1, GL_POSITION, position );
423 position[2] = -position[2];
425 glLightfv( GL_LIGHT2, GL_AMBIENT, ambient );
426 glLightfv( GL_LIGHT2, GL_DIFFUSE, diffuse12 );
427 glLightfv( GL_LIGHT2, GL_SPECULAR, specular12 );
428 glLightfv( GL_LIGHT2, GL_POSITION, position );
430 const GLfloat lmodel_ambient[] = { 0.0f, 0.0f, 0.0f, 1.0f };
432 glLightModelfv( GL_LIGHT_MODEL_AMBIENT, lmodel_ambient );
434 glLightModeli( GL_LIGHT_MODEL_TWO_SIDE, GL_FALSE );
446 glEnable( GL_POLYGON_OFFSET_FILL );
447 glPolygonOffset( -0.1f, -2.0f );
454 glDisable( GL_POLYGON_OFFSET_FILL );
469 if( aSkipRenderHoles )
487 return SFVEC4F( aInput.r * aInput.a, aInput.g * aInput.a, aInput.b * aInput.a, aInput.a );
507 if( aStatusReporter )
508 aStatusReporter->
Report(
_(
"Loading..." ) );
515 reload( aStatusReporter, aWarningReporter );
536 glDepthFunc( GL_LESS );
537 glEnable( GL_CULL_FACE );
538 glFrontFace( GL_CCW );
539 glEnable( GL_NORMALIZE );
543 glDisable( GL_MULTISAMPLE );
545 glEnable( GL_MULTISAMPLE );
548 glClearColor( 0.0f, 0.0f, 0.0f, 0.0f );
549 glClearDepth( 1.0f );
550 glClearStencil( 0x00 );
551 glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT );
559 glEnable( GL_DEPTH_TEST );
562 glMatrixMode( GL_PROJECTION );
564 glMatrixMode( GL_MODELVIEW );
573 glEnable( GL_LIGHTING );
582 if( cameraPos.z > 0.0f )
583 zpos = glm::max( cameraPos.z, 0.5f ) + cameraPos.z * cameraPos.z;
585 zpos = glm::min( cameraPos.z,-0.5f ) - cameraPos.z * cameraPos.z;
588 const GLfloat headlight_pos[] = { cameraPos.x, cameraPos.y, zpos, 1.0f };
590 glLightfv( GL_LIGHT0, GL_POSITION, headlight_pos );
596 bool showThickness = !skipThickness;
609 for( MAP_OGL_DISP_LISTS::const_iterator ii =
m_layers.begin(); ii !=
m_layers.end(); ++ii )
623 const double opacity_min = 0.8;
648 if( !skipRenderHoles )
694 if( !skipRenderHoles )
703 anti_board =
nullptr;
710 if( throughHolesOuter )
719 pLayerDispList->
DrawCulled( showThickness, solder_mask, throughHolesOuter, anti_board );
725 glm::mat4 cameraViewMatrix;
727 glGetFloatv( GL_MODELVIEW_MATRIX, glm::value_ptr( cameraViewMatrix ) );
742 glEnable( GL_POLYGON_OFFSET_FILL );
743 glPolygonOffset( 0.0f, -2.0f );
750 showThickness, skipRenderHoles );
756 showThickness, skipRenderHoles );
764 showThickness, skipRenderHoles );
770 showThickness, skipRenderHoles );
774 glDisable( GL_POLYGON_OFFSET_FILL );
775 glPolygonOffset( 0.0f, 0.0f );
781 glDepthMask( GL_FALSE );
782 glEnable( GL_BLEND );
783 glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
786 glEnable( GL_TEXTURE_2D );
787 glActiveTexture( GL_TEXTURE0 );
792 glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE );
793 glTexEnvf( GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_INTERPOLATE );
794 glTexEnvf( GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_MODULATE );
796 glTexEnvi( GL_TEXTURE_ENV, GL_SRC0_RGB, GL_PRIMARY_COLOR );
797 glTexEnvi( GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR );
799 glTexEnvi( GL_TEXTURE_ENV, GL_SRC1_RGB, GL_PREVIOUS );
800 glTexEnvi( GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR );
802 glTexEnvi( GL_TEXTURE_ENV, GL_SRC0_ALPHA, GL_PRIMARY_COLOR );
803 glTexEnvi( GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, GL_SRC_ALPHA );
804 glTexEnvi( GL_TEXTURE_ENV, GL_SRC1_ALPHA, GL_CONSTANT );
805 glTexEnvi( GL_TEXTURE_ENV, GL_OPERAND1_ALPHA, GL_SRC_ALPHA );
809 glDisable( GL_BLEND );
812 glDepthMask( GL_TRUE );
817 glDisable( GL_LIGHTING );
822 glEnable( GL_LIGHTING );
839 glEnable( GL_LINE_SMOOTH );
840 glShadeModel( GL_SMOOTH );
843 glPixelStorei( GL_UNPACK_ALIGNMENT, 4 );
860 circleImageBlured->
EfxFilter_SkipCenter( circleImage, IMAGE_FILTER::GAUSSIAN_BLUR, circleRadius - 8 );
864 delete circleImageBlured;
865 circleImageBlured =
nullptr;
868 circleImage =
nullptr;
882 glEnable( GL_COLOR_MATERIAL );
883 glColorMaterial( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE );
890 glMaterialfv( GL_FRONT_AND_BACK, GL_SPECULAR, &specular.r );
891 glMaterialf( GL_FRONT_AND_BACK, GL_SHININESS, 96.0f );
893 glMaterialfv( GL_FRONT_AND_BACK, GL_AMBIENT, &ambient.r );
894 glMaterialfv( GL_FRONT_AND_BACK, GL_DIFFUSE, &diffuse.r );
895 glMaterialfv( GL_FRONT_AND_BACK, GL_EMISSION, &emissive.r );
901#define DELETE_AND_FREE( ptr ) \
907#define DELETE_AND_FREE_MAP( map ) \
909 for( auto& [ layer, ptr ] : map ) \
916 glDeleteLists(
m_grid, 1 );
953 bool aShowThickness,
bool aSkipRenderHoles )
955 wxASSERT( (aLayerID ==
B_Mask) || (aLayerID ==
F_Mask) );
975 bool aGetBot,
bool aRenderTransparentOnly,
976 bool aRenderSelectedOnly )
978 wxASSERT( ( aGetTop ==
true ) || ( aGetBot ==
true ) );
988 bool highlight =
false;
992 if( fp->IsSelected() )
998 if( aRenderSelectedOnly != highlight )
1002 if( !fp->Models().empty() )
1006 const bool isFlipped = fp->IsFlipped();
1008 if( aGetTop == !isFlipped || aGetBot == isFlipped )
1019 bool aRenderTransparentOnly,
bool aIsSelected )
1021 if( !aFootprint->
Models().empty() )
1027 glm::mat4 fpMatrix( 1.0f );
1036 SFVEC3F( 0.0f, 0.0f, 1.0f ) );
1041 fpMatrix = glm::rotate( fpMatrix, glm::pi<float>(),
SFVEC3F( 0.0f, 1.0f, 0.0f ) );
1042 fpMatrix = glm::rotate( fpMatrix, glm::pi<float>(),
SFVEC3F( 0.0f, 0.0f, 1.0f ) );
1047 fpMatrix = glm::scale( fpMatrix,
SFVEC3F( modelunit_to_3d_units_factor ) );
1052 if( !sM.m_Show || sM.m_Filename.empty() )
1061 if(
const MODEL_3D* modelPtr = cache_i->second )
1063 bool opaque = sM.m_Opacity >= 1.0;
1065 if( ( !aRenderTransparentOnly && modelPtr->HasOpaqueMeshes() && opaque ) ||
1066 ( aRenderTransparentOnly && ( modelPtr->HasTransparentMeshes() || !opaque ) ) )
1068 glm::mat4 modelworldMatrix = fpMatrix;
1070 const SFVEC3F offset =
SFVEC3F( sM.m_Offset.x, sM.m_Offset.y, sM.m_Offset.z );
1071 const SFVEC3F rotation =
SFVEC3F( sM.m_Rotation.x, sM.m_Rotation.y,
1075 std::vector<float> key = { offset.x, offset.y, offset.z,
1076 rotation.x, rotation.y, rotation.z,
1083 modelworldMatrix *= it->second;
1087 glm::mat4 mtx( 1.0f );
1088 mtx = glm::translate( mtx, offset );
1089 mtx = glm::rotate( mtx, glm::radians( -rotation.z ), { 0.0f, 0.0f, 1.0f } );
1090 mtx = glm::rotate( mtx, glm::radians( -rotation.y ), { 0.0f, 1.0f, 0.0f } );
1091 mtx = glm::rotate( mtx, glm::radians( -rotation.x ), { 1.0f, 0.0f, 0.0f } );
1092 mtx = glm::scale( mtx,
scale );
1095 modelworldMatrix *= mtx;
1098 aDstRenderList.emplace_back( modelworldMatrix, modelPtr,
1099 aRenderTransparentOnly ? sM.m_Opacity : 1.0f,
1100 aRenderTransparentOnly,
1117 std::list<MODELTORENDER> renderList;
1125 if( !renderList.empty() )
1130 renderModel( aCameraViewMatrix, mtr, selColor,
nullptr );
1139 if( !renderList.empty() )
1144 renderModel( aCameraViewMatrix, mtr, selColor,
nullptr );
1159 std::list<MODELTORENDER> renderListModels;
1170 if( renderListModels.empty() )
1173 std::vector<std::pair<const MODELTORENDER *, float>> transparentModelList;
1175 transparentModelList.reserve( renderListModels.size() );
1182 const BBOX_3D& bBox = mtr.m_model->GetBBox();
1184 const SFVEC3F bBoxWorld = mtr.m_modelWorldMat * glm::vec4( bBoxCenter, 1.0f );
1186 const float distanceToCamera = glm::length( cameraPos - bBoxWorld );
1188 transparentModelList.emplace_back( &mtr, distanceToCamera );
1192 std::sort( transparentModelList.begin(), transparentModelList.end(),
1193 [&]( std::pair<const MODELTORENDER *, float>& a,
1194 std::pair<const MODELTORENDER *, float>& b )
1196 if( a.second != b.second )
1197 return a.second > b.second;
1199 return a.first > b.first;
1205 bool isUsingColorInformation = !( transparentModelList.begin()->first->m_isSelected &&
1210 for(
const std::pair<const MODELTORENDER *, float>& mtr : transparentModelList )
1215 if( !isUsingColorInformation && !mtr.first->m_isSelected )
1217 isUsingColorInformation =
true;
1219 glEnableClientState( GL_COLOR_ARRAY );
1220 glEnableClientState( GL_TEXTURE_COORD_ARRAY );
1221 glEnable( GL_COLOR_MATERIAL );
1223 else if( isUsingColorInformation && mtr.first->m_isSelected )
1225 isUsingColorInformation =
false;
1227 glDisableClientState( GL_COLOR_ARRAY );
1228 glDisableClientState( GL_TEXTURE_COORD_ARRAY );
1229 glDisable( GL_COLOR_MATERIAL );
1235 renderModel( aCameraViewMatrix, *mtr.first, selColor, &cameraPos );
1250 const glm::mat4 modelviewMatrix = aCameraViewMatrix * aModelToRender.
m_modelWorldMat;
1252 glLoadMatrixf( glm::value_ptr( modelviewMatrix ) );
1260 const bool wasBlendEnabled = glIsEnabled( GL_BLEND );
1262 if( !wasBlendEnabled )
1264 glEnable( GL_BLEND );
1265 glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
1268 glDisable( GL_LIGHTING );
1276 glEnable( GL_LIGHTING );
1278 if( !wasBlendEnabled )
1279 glDisable( GL_BLEND );
1287 glDeleteLists(
m_grid, 1 );
1291 if( aGridType == GRID3D_TYPE::NONE )
1294 m_grid = glGenLists( 1 );
1296 if( !glIsList(
m_grid ) )
1299 glNewList(
m_grid, GL_COMPILE );
1301 glEnable( GL_BLEND );
1302 glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
1304 const double zpos = 0.0;
1312 const GLfloat transparency = 0.35f;
1314 double griSizeMM = 0.0;
1318 case GRID3D_TYPE::GRID_1MM: griSizeMM = 1.0;
break;
1319 case GRID3D_TYPE::GRID_2P5MM: griSizeMM = 2.5;
break;
1320 case GRID3D_TYPE::GRID_5MM: griSizeMM = 5.0;
break;
1321 case GRID3D_TYPE::GRID_10MM: griSizeMM = 10.0;
break;
1324 case GRID3D_TYPE::NONE:
return;
1327 glNormal3f( 0.0, 0.0, 1.0 );
1332 brd_center_pos.
y = -brd_center_pos.
y;
1338 double xmin = ( brd_center_pos.
x - xsize / 2 ) *
scale;
1339 double xmax = ( brd_center_pos.
x + xsize / 2 ) *
scale;
1340 double ymin = ( brd_center_pos.
y - ysize / 2 ) *
scale;
1341 double ymax = ( brd_center_pos.
y + ysize / 2 ) *
scale;
1349 for(
int ii = 0; ; ii++ )
1352 glColor4f( gridColor.r, gridColor.g, gridColor.b, transparency );
1354 glColor4f( gridColor_marker.r, gridColor_marker.g, gridColor_marker.b,
1359 if(
delta <= xsize / 2 )
1361 glBegin( GL_LINES );
1362 glVertex3f( (brd_center_pos.
x +
delta) *
scale, -ymin, zpos );
1363 glVertex3f( (brd_center_pos.
x +
delta) *
scale, -ymax, zpos );
1368 glBegin( GL_LINES );
1369 glVertex3f( (brd_center_pos.
x -
delta) *
scale, -ymin, zpos );
1370 glVertex3f( (brd_center_pos.
x -
delta) *
scale, -ymax, zpos );
1375 if(
delta <= ysize / 2 )
1377 glBegin( GL_LINES );
1378 glVertex3f( xmin, -( brd_center_pos.
y +
delta ) *
scale, zpos );
1379 glVertex3f( xmax, -( brd_center_pos.
y +
delta ) *
scale, zpos );
1384 glBegin( GL_LINES );
1385 glVertex3f( xmin, -( brd_center_pos.
y -
delta ) *
scale, zpos );
1386 glVertex3f( xmax, -( brd_center_pos.
y -
delta ) *
scale, zpos );
1391 if( (
delta > ysize / 2 ) && (
delta > xsize / 2 ) )
1396 glNormal3f( 0.0, -1.0, 0.0 );
1399 double posy = -brd_center_pos.
y *
scale;
1401 for(
int ii = 0; ; ii++ )
1404 glColor4f( gridColor.r, gridColor.g, gridColor.b, transparency );
1406 glColor4f( gridColor_marker.r, gridColor_marker.g, gridColor_marker.b,
1411 glBegin( GL_LINES );
1414 glVertex3f( xmax, posy, zmin );
1415 glVertex3f( xmax, posy, zmax );
1420 glBegin( GL_LINES );
1422 glVertex3f( xmin, posy, zmin );
1423 glVertex3f( xmin, posy, zmax );
1427 if(
delta > xsize / 2.0f )
1432 for(
int ii = 0; ; ii++ )
1435 glColor4f( gridColor.r, gridColor.g, gridColor.b, transparency );
1437 glColor4f( gridColor_marker.r, gridColor_marker.g, gridColor_marker.b, transparency );
1444 glBegin( GL_LINES );
1445 glVertex3f( xmin, posy,
delta );
1446 glVertex3f( xmax, posy,
delta );
1450 if(
delta <= -zmin && ( ii != 0 ) )
1453 glBegin( GL_LINES );
1454 glVertex3f( xmin, posy, -
delta );
1455 glVertex3f( xmax, posy, -
delta );
1463 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
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
Helper class to handle information needed to display 3D board.
std::map< int, COLOR4D > m_BoardEditorColors
list of colors used by the board editor
double BiuTo3dUnits() const noexcept
Board integer units To 3D units.
SFVEC4F m_BgColorTop
background top color
SFVEC4F GetLayerColor(int aLayerId) const
Get the technical color of a layer.
bool GetUseBoardEditorCopperLayerColors() const
SFVEC4F m_SolderPasteColor
in realistic mode: solder paste color
SFVEC4F m_UserDefinedLayerColor[45]
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 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.
auto RunWithoutCtxLock(Func &&aFunction, Args &&... args)
Run the given function first releasing the GL context lock, then restoring it.
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
A color representation with 4 components: red, green, blue, alpha.
static const 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.
GL_CONTEXT_MANAGER * GetGLContextManager()
This is a base class to hold data and functions for render targets.
std::unique_ptr< BUSY_INDICATOR > CreateBusyIndicator() const
Return a created busy indicator, if a factory has been set, else a null pointer.
bool m_canvasInitialized
Flag if the canvas specific for this render was already initialized.
wxSize m_windowSize
The window size that this camera is working.
BOARD_ADAPTER & m_boardAdapter
Settings reference in use for this render.
OPENGL_RENDER_LIST * m_board
OPENGL_RENDER_LIST * m_outerThroughHoleRings
OPENGL_RENDER_LIST * m_offboardPadsFront
SPHERES_GIZMO::GizmoSphereSelection getSelectedGizmoSphere() const
GRID3D_TYPE m_lastGridType
Stores the last grid type.
std::tuple< int, int, int, int > getGizmoViewport() const
OPENGL_RENDER_LIST * m_microviaHoles
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 resetSelectedGizmoSphere()
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
SPHERES_GIZMO * m_spheres_gizmo
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 handleGizmoMouseInput(int mouseX, int mouseY)
void setLightBottom(bool enabled)
void setGizmoViewport(int x, int y, int width, int height)
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)
Report a string with a given severity.
Renders a set of colored spheres in 3D space that act as a directional orientation gizmo.
GizmoSphereSelection
Enum to indicate which sphere (direction) is selected.
void handleMouseInput(int aMouseX, int aMouseY)
void render3dSpheresGizmo(glm::mat4 aCameraRotationMatrix)
GizmoSphereSelection getSelectedGizmoSphere() const
std::tuple< int, int, int, int > getViewport() const
void setViewport(int ax, int ay, int aWidth, int aHeight)
void resetSelectedGizmoSphere()
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.
int MapPCBLayerTo3DLayer(PCB_LAYER_ID aLayer)
@ LAYER_3D_SOLDERMASK_TOP
@ LAYER_3D_SOLDERMASK_BOTTOM
bool IsCopperLayer(int aLayerId)
Test whether a layer is a copper layer.
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.
PGM_BASE & Pgm()
The global program "get" accessor.
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 subtract_mask_from_silk
bool opengl_microvias_disableOnMove
bool highlight_on_rollover
bool DifferentiatePlatedCopper()
return true if platted copper aeras and non platted copper areas must be drawn using a different colo...
bool opengl_holes_disableOnMove
bool opengl_AA_disableOnMove
constexpr int mmToIU(double mm) const
glm::mat4 m_modelWorldMat