26#ifndef BOARD_ADAPTER_H
27#define BOARD_ADAPTER_H
31#include "../3d_rendering/raytracing/accelerators/container_2d.h"
32#include "../3d_rendering/raytracing/accelerators/container_3d.h"
33#include "../3d_rendering/raytracing/shapes3D/bbox_3d.h"
35#include "../3d_enums.h"
36#include "../3d_cache/3d_cache.h"
37#include "../common_ogl/ogl_attr_list.h"
38#include "../3d_viewer/eda_3d_viewer_settings.h"
58typedef std::map<PCB_LAYER_ID, SHAPE_POLY_SET*>
MAP_POLY;
63#define RANGE_SCALE_3D 8.0f
90 const std::bitset<LAYER_3D_END>& aVisibilityFlags )
const;
360 PCB_LAYER_ID aLayerId,
bool aSkipPlatedPads,
bool aSkipNonPlatedPads );
364 const std::bitset<LAYER_3D_END>& aVisibilityFlags );
379 const EDA_ANGLE& aArcAngle,
int aCircleToSegmentsCount,
int aWidth,
std::map< PCB_LAYER_ID, SHAPE_POLY_SET * > MAP_POLY
A type that stores polysets for each layer id.
std::map< PCB_LAYER_ID, BVH_CONTAINER_2D * > MAP_CONTAINER_2D_BASE
A type that stores a container of 2d objects for each layer id.
Define an abstract camera.
Helper class to handle information needed to display 3D board.
MAP_CONTAINER_2D_BASE m_layerHoleMap
Holes for each layer.
double BiuTo3dUnits() const noexcept
Board integer units To 3D units.
BVH_CONTAINER_2D * m_offboardPadsBack
SFVEC4F m_BgColorTop
background top color
void SetVisibleLayers(const std::bitset< LAYER_3D_END > &aLayers)
float m_solderPasteLayerThickness3DU
const MAP_CONTAINER_2D_BASE & GetLayerHoleMap() const noexcept
S3D_CACHE * m_3dModelManager
void createLayers(REPORTER *aStatusReporter)
VECTOR2I m_boardPos
Board center position in board internal units.
float m_backCopperThickness3DU
SHAPE_POLY_SET m_TH_ODPolys
PTH outer diameters.
static KIGFX::COLOR4D g_DefaultComments
SFVEC4F m_SolderPasteColor
in realistic mode: solder paste color
static CUSTOM_COLORS_LIST g_PasteColors
BBOX_3D m_boardBoundingBox
3D bounding box of the board in 3D units.
static CUSTOM_COLORS_LIST g_FinishColors
static KIGFX::COLOR4D g_DefaultBoardBody
const SHAPE_POLY_SET & GetBoardPoly() const noexcept
Get the current polygon of the epoxy board.
const SHAPE_POLY_SET & GetNPTH_ODPolys() const noexcept
const BVH_CONTAINER_2D * GetOffboardPadsFront() const noexcept
COLOR_SETTINGS * m_colors
bool IsFootprintShown(FOOTPRINT_ATTR_T aFPAttributes) const
Test if footprint should be displayed in relation to attributes and the flags.
static KIGFX::COLOR4D g_DefaultSolderMask
std::map< int, COLOR4D > GetLayerColors() const
const SHAPE_POLY_SET & GetViaTH_ODPolys() const noexcept
const MAP_POLY & GetPolyMap() const noexcept
Get map of polygon's layers.
std::array< float, PCB_LAYER_ID_COUNT > m_layerZcoordBottom
Bottom (Start) Z position of each layer in 3D units.
MAP_POLY m_layerHoleOdPolys
Hole outer diameters (per layer)
void addSolidAreasShapes(const ZONE *aZone, CONTAINER_2D_BASE *aDstContainer, PCB_LAYER_ID aLayerId)
VECTOR2I GetBoardSize() const noexcept
Get the board size.
const MAP_POLY & GetHoleOdPolysMap() const noexcept
SHAPE_POLY_SET * m_frontPlatedCopperPolys
MAP_CONTAINER_2D_BASE m_layerMap
2D elements for each layer.
BVH_CONTAINER_2D m_TH_ODs
List of PTH outer diameters.
float GetAverageTrackWidth() const noexcept
unsigned int m_trackCount
const BBOX_3D & GetBBox() const noexcept
Get the board outling bounding box.
float m_averageTrackWidth
SHAPE_POLY_SET m_board_poly
Board outline polygon.
std::bitset< LAYER_3D_END > GetVisibleLayers() const
SFVEC4F m_SolderMaskColorBot
in realistic mode: solder mask color ( bot )
bool m_IsPreviewer
true if we're in a 3D preview panel, false for the standard 3D viewer
void addFootprintShapes(const FOOTPRINT *aFootprint, CONTAINER_2D_BASE *aDstContainer, PCB_LAYER_ID aLayerId, const std::bitset< LAYER_3D_END > &aVisibilityFlags)
void createArcSegments(const VECTOR2I &aCentre, const VECTOR2I &aStart, const EDA_ANGLE &aArcAngle, int aCircleToSegmentsCount, int aWidth, CONTAINER_2D_BASE *aContainer, const BOARD_ITEM &aOwner)
VECTOR2I GetBoardPos() const noexcept
Get the board center.
static CUSTOM_COLORS_LIST g_MaskColors
MAP_POLY m_layerHoleIdPolys
Hole inner diameters (per layer)
int GetHolePlatingThickness() const noexcept
Get the hole plating thickness (NB: in BOARD UNITS!).
void InitSettings(REPORTER *aStatusReporter, REPORTER *aWarningReporter)
Function to be called by the render when it need to reload the settings for the board.
const BVH_CONTAINER_2D & GetViaAnnuli() const noexcept
float GetLayerBottomZPos(PCB_LAYER_ID aLayerId) const noexcept
Get the bottom z position.
static KIGFX::COLOR4D g_DefaultECOs
const BVH_CONTAINER_2D * GetOffboardPadsBack() const noexcept
const BVH_CONTAINER_2D & GetTH_IDs() const noexcept
SFVEC4F m_SolderMaskColorTop
in realistic mode: solder mask color ( top )
SFVEC4F GetColor(const COLOR4D &aColor) const
SHAPE_POLY_SET m_viaAnnuliPolys
Via annular ring outer diameters.
BVH_CONTAINER_2D * m_offboardPadsFront
float m_averageViaHoleDiameter
BVH_CONTAINER_2D m_viaTH_ODs
List of via hole outer diameters.
static KIGFX::COLOR4D g_DefaultBackgroundTop
const BVH_CONTAINER_2D * GetPlatedPadsBack() const noexcept
static CUSTOM_COLORS_LIST g_SilkColors
const MAP_POLY & GetHoleIdPolysMap() const noexcept
float GetBackCopperThickness() const noexcept
float m_averageHoleDiameter
static KIGFX::COLOR4D g_DefaultSurfaceFinish
SFVEC4F m_CopperColor
in realistic mode: copper color
SHAPE_POLY_SET m_viaTH_ODPolys
Via hole outer diameters.
void ReloadColorSettings() noexcept
void createPadWithMargin(const PAD *aPad, CONTAINER_2D_BASE *aDstContainer, PCB_LAYER_ID aLayer, const VECTOR2I &aMargin) const
float GetAverageViaHoleDiameter() const noexcept
void addPads(const FOOTPRINT *aFootprint, CONTAINER_2D_BASE *aDstContainer, PCB_LAYER_ID aLayerId, bool aSkipPlatedPads, bool aSkipNonPlatedPads)
const SHAPE_POLY_SET * GetFrontPlatedPadPolys()
SFVEC2F GetSphericalCoord(int i) const
unsigned int GetViaCount() const noexcept
const BOARD * GetBoard() const noexcept
BVH_CONTAINER_2D * m_platedPadsBack
void createPadWithHole(const PAD *aPad, CONTAINER_2D_BASE *aDstContainer, int aInflateValue)
void SetBoard(BOARD *aBoard) noexcept
Set current board to be rendered.
const SFVEC3F & GetBoardCenter() const noexcept
The board center position in 3D units.
float GetFootprintZPos(bool aIsFlipped) const
Get the position of the footprint in 3d integer units considering if it is flipped or not.
float m_frontCopperThickness3DU
float GetNonCopperLayerThickness() const noexcept
Get the non copper layers thickness (in 3D units).
static KIGFX::COLOR4D g_DefaultSolderPaste
float GetLayerTopZPos(PCB_LAYER_ID aLayerId) const noexcept
Get the top z position.
const BVH_CONTAINER_2D & GetTH_ODs() const noexcept
float m_boardBodyThickness3DU
void buildPadOutlineAsSegments(const PAD *aPad, CONTAINER_2D_BASE *aDstContainer, int aWidth)
const SHAPE_POLY_SET * GetBackPlatedPadPolys()
std::array< float, PCB_LAYER_ID_COUNT > m_layerZcoordTop
Top (End) Z position of each layer in 3D units.
static CUSTOM_COLORS_LIST g_BoardColors
void addShape(const PCB_SHAPE *aShape, CONTAINER_2D_BASE *aContainer, const BOARD_ITEM *aOwner)
void createTrack(const PCB_TRACK *aTrack, CONTAINER_2D_BASE *aDstContainer)
const MAP_CONTAINER_2D_BASE & GetLayerMap() const noexcept
Get the map of containers that have the objects per layer.
MAP_POLY m_layers_poly
Amalgamated polygon contours for various types of items.
VECTOR2I m_boardSize
Board size in board internal units.
SHAPE_POLY_SET * m_backPlatedCopperPolys
void SetLayerColors(const std::map< int, COLOR4D > &aColors)
SHAPE_POLY_SET * m_backPlatedPadPolys
EDA_3D_VIEWER_SETTINGS * m_Cfg
SFVEC4F m_SilkScreenColorTop
in realistic mode: SilkScreen color ( top )
unsigned int GetHoleCount() const noexcept
SFVEC4F m_SilkScreenColorBot
in realistic mode: SilkScreen color ( bot )
SFVEC4F GetItemColor(int aItemId) const
Get the technical color of a layer.
const BVH_CONTAINER_2D * GetPlatedPadsFront() const noexcept
unsigned int GetCircleSegmentCount(float aDiameter3DU) const
float m_nonCopperLayerThickness3DU
float GetFrontCopperThickness() const noexcept
Get the copper layer thicknesses (in 3D units).
const BVH_CONTAINER_2D & GetViaTH_ODs() const noexcept
BVH_CONTAINER_2D m_viaAnnuli
List of via annular rings.
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
bool createBoardPolygon(wxString *aErrorMsg)
Create the board outline polygon.
float GetAverageHoleDiameter() const noexcept
const SHAPE_POLY_SET & GetViaAnnuliPolys() const noexcept
unsigned int m_copperLayersCount
std::map< int, COLOR4D > GetDefaultColors() const
BVH_CONTAINER_2D m_TH_IDs
List of PTH inner diameters.
void createViaWithMargin(const PCB_TRACK *aTrack, CONTAINER_2D_BASE *aDstContainer, int aMargin)
SFVEC4F m_UserCommentsColor
static KIGFX::COLOR4D g_DefaultSilkscreen
BVH_CONTAINER_2D * m_platedPadsFront
void Set3dCacheManager(S3D_CACHE *aCacheMgr) noexcept
Update the cache manager pointer.
SFVEC3F m_boardCenter
3D center position of the board in 3D units.
SHAPE_POLY_SET m_NPTH_ODPolys
NPTH outer diameters.
static KIGFX::COLOR4D g_DefaultBackgroundBot
SFVEC4F GetLayerColor(PCB_LAYER_ID aLayerId) const
Get the technical color of a layer.
bool Is3dLayerEnabled(PCB_LAYER_ID aLayer, const std::bitset< LAYER_3D_END > &aVisibilityFlags) const
Check if a layer is enabled.
SFVEC4F m_UserDrawingsColor
S3D_CACHE * Get3dCacheManager() const noexcept
double m_biuTo3Dunits
Scale factor to convert board internal units to 3D units normalized between -1.0 and 1....
SFVEC4F m_BgColorBot
background bottom color
const SHAPE_POLY_SET & GetTH_ODPolys() const noexcept
Get through hole outside diameter 2D polygons.
SHAPE_POLY_SET * m_frontPlatedPadPolys
void addText(const EDA_TEXT *aText, CONTAINER_2D_BASE *aDstContainer, const BOARD_ITEM *aOwner)
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Information pertinent to a Pcbnew printed circuit board.
A class used to derive camera objects from.
Color settings are a bit different than most of the settings objects in that there can be more than o...
virtual BOARD_ADAPTER & GetAdapter()=0
virtual CAMERA & GetCurrentCamera()=0
virtual ~EDA_3D_BOARD_HOLDER()
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
A color representation with 4 components: red, green, blue, alpha.
A pure virtual class used to derive REPORTER objects from.
Cache for storing the 3D shapes.
Represent a set of closed polygons.
Handle a list of polygons defining a copper zone.
std::vector< CUSTOM_COLOR_ITEM > CUSTOM_COLORS_LIST
static const wxChar * m_logTrace
Trace mask used to enable or disable debug output for this class.
PCB_LAYER_ID
A quick note on layer IDs:
Manage a bounding box defined by two SFVEC3F min max points.