1 /*
2  * This program source code file is part of KiCad, a free EDA CAD application.
3  *
4  * Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt>
5  * Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, you may find one here:
19  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20  * or you may search the http://www.gnu.org website for the version 2 license,
21  * or you may write to the Free Software Foundation, Inc.,
22  * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
23  */
24 
25 #ifndef BOARD_ADAPTER_H
26 #define BOARD_ADAPTER_H
27 
28 #include <array>
29 #include <vector>
30 #include "../3d_rendering/raytracing/accelerators/container_2d.h"
31 #include "../3d_rendering/raytracing/accelerators/container_3d.h"
32 #include "../3d_rendering/raytracing/shapes3D/bbox_3d.h"
33 #include "../3d_rendering/camera.h"
34 #include "../3d_enums.h"
35 #include "../3d_cache/3d_cache.h"
36 #include "../common_ogl/ogl_attr_list.h"
37 
38 #include <layer_ids.h>
39 #include <pad.h>
40 #include <pcb_track.h>
41 #include <wx/gdicmn.h>
42 #include <pcb_base_frame.h>
43 #include <pcb_text.h>
44 #include <pcb_shape.h>
45 #include <pcb_dimension.h>
46 #include <zone.h>
47 #include <footprint.h>
48 #include <reporter.h>
49 #include <dialogs/dialog_color_picker.h>
50 
51 class COLOR_SETTINGS;
52 
53 /// A type that stores a container of 2d objects for each layer id
54 typedef std::map< PCB_LAYER_ID, BVH_CONTAINER_2D *> MAP_CONTAINER_2D_BASE;
55 
56 /// A type that stores polysets for each layer id
57 typedef std::map< PCB_LAYER_ID, SHAPE_POLY_SET *> MAP_POLY;
58 
59 /// This defines the range that all coord will have to be rendered.
60 /// It will use this value to convert to a normalized value between
61 /// -(RANGE_SCALE_3D/2) .. +(RANGE_SCALE_3D/2)
62 #define RANGE_SCALE_3D 8.0f
63 
64 
65 /**
66  *  Helper class to handle information needed to display 3D board.
67  */
68 class BOARD_ADAPTER
69 {
70 public:
71     BOARD_ADAPTER();
72 
73     ~BOARD_ADAPTER();
74 
75     /**
76      * Update the cache manager pointer.
77      *
78      * @param aCachePointer: the pointer to the 3D cache manager.
79      */
Set3dCacheManager(S3D_CACHE * aCachePointer)80     void Set3dCacheManager( S3D_CACHE* aCachePointer ) noexcept
81     {
82         m_3dModelManager = aCachePointer;
83     }
84 
85     /**
86      * Return the 3D cache manager pointer.
87      */
Get3dCacheManager()88     S3D_CACHE* Get3dCacheManager() const noexcept
89     {
90         return m_3dModelManager;
91     }
92 
93     /**
94      * Get a configuration status of a flag.
95      *
96      * @param aFlag the flag to get the status.
97      * @return true if flag is set, false if not.
98      */
99     bool GetFlag( DISPLAY3D_FLG aFlag ) const ;
100 
101     /**
102      * Set the status of a flag.
103      *
104      * @param aFlag the flag to set the status
105      * @param aState status to set.
106      */
107     void SetFlag( DISPLAY3D_FLG aFlag, bool aState );
108 
109     /**
110      * Check if a layer is enabled.
111      *
112      * @param aLayer layer ID to get status.
113      */
114     bool Is3dLayerEnabled( PCB_LAYER_ID aLayer ) const;
115 
116     /**
117      * Test if footprint should be displayed in relation to attributes and the flags.
118      */
119     bool IsFootprintShown( FOOTPRINT_ATTR_T aFPAttributes ) const;
120 
121     /**
122      * Set current board to be rendered.
123      *
124      * @param aBoard board to process.
125      */
SetBoard(BOARD * aBoard)126     void SetBoard( BOARD* aBoard ) noexcept
127     {
128         m_board = aBoard;
129     }
130 
131     /**
132      * Get current board to be rendered.
133      *
134      * @return BOARD pointer
135      */
GetBoard()136     const BOARD* GetBoard() const noexcept
137     {
138         return m_board;
139     }
140 
SetColorSettings(COLOR_SETTINGS * aSettings)141     void SetColorSettings( COLOR_SETTINGS* aSettings ) noexcept
142     {
143         m_colors = aSettings;
144     }
145 
146     /**
147      * Function to be called by the render when it need to reload the settings for the board.
148      *
149      * @param aStatusReporter the pointer for the status reporter.
150      * @param aWarningReporter pointer for the warning reporter.
151      */
152     void InitSettings( REPORTER* aStatusReporter, REPORTER* aWarningReporter );
153 
154     /**
155      * Board integer units To 3D units.
156      *
157      * @return the conversion factor to transform a position from the board to 3D units.
158      */
BiuTo3dUnits()159     double BiuTo3dUnits() const noexcept
160     {
161         return m_biuTo3Dunits;
162     }
163 
164     /**
165      * Get the board outling bounding box.
166      *
167      * @return the board bounding box in 3D units.
168      */
GetBBox()169     const BBOX_3D& GetBBox() const noexcept
170     {
171         return m_boardBoundingBox;
172     }
173 
174     /**
175      * Get the current epoxy thickness.
176      *
177      * @return epoxy thickness in 3D units.
178      */
GetEpoxyThickness()179     float GetEpoxyThickness() const noexcept
180     {
181         return m_epoxyThickness3DU;
182     }
183 
184     /**
185      * Get the current non copper layers thickness.
186      *
187      * @return thickness in 3D units of non copper layers.
188      */
GetNonCopperLayerThickness()189     float GetNonCopperLayerThickness() const noexcept
190     {
191         return m_nonCopperLayerThickness3DU;
192     }
193 
194     /**
195      * Get the current copper layer thickness.
196      *
197      * @return thickness in 3D units of copper layers.
198      */
GetCopperThickness()199     float GetCopperThickness() const noexcept
200     {
201         return m_copperThickness3DU;
202     }
203 
204     /**
205      * Get the current copper layer thickness.
206      *
207      * @return thickness in board units.
208      */
209     int GetHolePlatingThickness() const noexcept;
210 
211     /**
212      * Get the board size.
213      *
214      * @return size in BIU units.
215      */
GetBoardSize()216     wxSize GetBoardSize() const noexcept
217     {
218         return m_boardSize;
219     }
220 
221     /**
222      * Get the board center.
223      *
224      * @return position in BIU units.
225      */
GetBoardPos()226     wxPoint GetBoardPos() const noexcept
227     {
228         return m_boardPos;
229     }
230 
231     /**
232      * The board center position in 3D units.
233      *
234      * @return board center vector position in 3D units.
235      */
GetBoardCenter()236     const SFVEC3F& GetBoardCenter() const noexcept
237     {
238         return m_boardCenter;
239     }
240 
241     /**
242      * Get the position of the footprint in 3d integer units considering if it is flipped or not.
243      *
244      * @param aIsFlipped true for use in footprints on Front (top) layer, false
245      *                   if footprint is on back (bottom) layer.
246      * @return the Z position of 3D shapes, in 3D integer units.
247      */
248     float GetFootprintZPos( bool aIsFlipped ) const ;
249 
250     /**
251      * Get the current grid.
252      *
253      * @return space type of the grid.
254      */
GetGridType()255     GRID3D_TYPE GetGridType() const noexcept
256     {
257         return m_gridType;
258     }
259 
260     /**
261      * Set the current grid.
262      *
263      * @param aGridType the type space of the grid.
264      */
SetGridType(GRID3D_TYPE aGridType)265     void SetGridType( GRID3D_TYPE aGridType ) noexcept
266     {
267         m_gridType = aGridType;
268     }
269 
270     /**
271      * Get the current antialiasing mode value.
272      *
273      * @return antialiasing mode value
274      */
GetAntiAliasingMode()275     ANTIALIASING_MODE GetAntiAliasingMode() const { return m_antiAliasingMode; }
276 
277     /**
278      * Set the current antialiasing mode value.
279      *
280      * @param aAAmode antialiasing mode value.
281      */
SetAntiAliasingMode(ANTIALIASING_MODE aAAmode)282     void SetAntiAliasingMode( ANTIALIASING_MODE aAAmode ) { m_antiAliasingMode = aAAmode; }
283 
284     /**
285      * @param aRenderEngine the render engine mode selected.
286      */
SetRenderEngine(RENDER_ENGINE aRenderEngine)287     void SetRenderEngine( RENDER_ENGINE aRenderEngine ) noexcept
288     {
289         m_renderEngine = aRenderEngine;
290     }
291 
292     /**
293      * @return render engine on use.
294      */
GetRenderEngine()295     RENDER_ENGINE GetRenderEngine() const noexcept
296     {
297         return m_renderEngine;
298     }
299 
300     /**
301      * @param aMaterialMode the render material mode.
302      */
SetMaterialMode(MATERIAL_MODE aMaterialMode)303     void SetMaterialMode( MATERIAL_MODE aMaterialMode ) noexcept
304     {
305         m_materialMode = aMaterialMode;
306     }
307 
308     /**
309      * @return material rendering mode.
310      */
GetMaterialMode()311     MATERIAL_MODE GetMaterialMode() const noexcept
312     {
313         return m_materialMode;
314     }
315 
316     /**
317      * Get the current polygon of the epoxy board.
318      *
319      * @return the shape polygon
320      */
GetBoardPoly()321     const SHAPE_POLY_SET& GetBoardPoly() const noexcept
322     {
323         return m_board_poly;
324     }
325 
326     /**
327      * Get the technical color of a layer.
328      *
329      * @param aLayerId the layer to get the color information.
330      * @return the color in SFVEC3F format.
331      */
332     SFVEC4F GetLayerColor( PCB_LAYER_ID aLayerId ) const;
333 
334     /**
335      * Get the technical color of a layer.
336      *
337      * @param aItemId the item id to get the color information.
338      * @return the color in SFVEC3F format.
339      */
340     SFVEC4F GetItemColor( int aItemId ) const;
341 
342     /**
343      * @param[in] aColor is the color mapped.
344      * @return the color in SFVEC3F format
345      */
346     SFVEC4F GetColor( const COLOR4D& aColor ) const;
347 
348     /**
349      * Get the top z position.
350      *
351      * @param aLayerId layer id.
352      * @return position in 3D units.
353      */
GetLayerTopZPos(PCB_LAYER_ID aLayerId)354     float GetLayerTopZPos( PCB_LAYER_ID aLayerId ) const noexcept
355     {
356         return m_layerZcoordTop[aLayerId];
357     }
358 
359     /**
360      * Get the bottom z position.
361      *
362      * @param aLayerId layer id.
363      * @return position in 3D units.
364      */
GetLayerBottomZPos(PCB_LAYER_ID aLayerId)365     float GetLayerBottomZPos( PCB_LAYER_ID aLayerId ) const noexcept
366     {
367         return m_layerZcoordBottom[aLayerId];
368     }
369 
370     /**
371      * Get the map of containers that have the objects per layer.
372      *
373      * @return the map containers of this board.
374      */
GetLayerMap()375     const MAP_CONTAINER_2D_BASE& GetLayerMap() const noexcept
376     {
377         return m_layerMap;
378     }
379 
GetPlatedPadsFront()380     const BVH_CONTAINER_2D* GetPlatedPadsFront() const noexcept
381     {
382         return m_platedPadsFront;
383     }
384 
GetPlatedPadsBack()385     const BVH_CONTAINER_2D* GetPlatedPadsBack() const noexcept
386     {
387         return m_platedPadsBack;
388     }
389 
390     /**
391      * Get the map of container that have the holes per layer.
392      *
393      * @return the map containers of holes from this board.
394      */
GetLayerHoleMap()395     const MAP_CONTAINER_2D_BASE& GetLayerHoleMap() const noexcept
396     {
397         return m_layerHoleMap;
398     }
399 
400     /**
401      * Get the inflated through hole outside diameters container.
402      *
403      * @return a container with holes.
404      */
GetThroughHoleOds()405     const BVH_CONTAINER_2D& GetThroughHoleOds() const noexcept
406     {
407         return m_throughHoleOds;
408     }
409 
410     /**
411      * Get the through hole annular rings container.
412      *
413      * @return a container with through hole annular rings.
414      */
GetThroughHoleAnnularRings()415     const BVH_CONTAINER_2D& GetThroughHoleAnnularRings() const noexcept
416     {
417         return m_throughHoleAnnularRings;
418     }
419 
420     /**
421      * Get through hole outside diameter 2D polygons.
422      *
423      * The outside diameter 2D polygon is the hole diameter plus the plating thickness.
424      *
425      * @return a container with through hold outside diameter 2D polygons.
426      */
GetThroughHoleOdPolys()427     const SHAPE_POLY_SET& GetThroughHoleOdPolys() const noexcept
428     {
429         return m_throughHoleOdPolys;
430     }
431 
GetThroughHoleAnnularRingPolys()432     const SHAPE_POLY_SET& GetThroughHoleAnnularRingPolys() const noexcept
433     {
434         return m_throughHoleAnnularRingPolys;
435     }
436 
GetOuterNonPlatedThroughHolePoly()437     const SHAPE_POLY_SET& GetOuterNonPlatedThroughHolePoly() const noexcept
438     {
439         return m_nonPlatedThroughHoleOdPolys;
440     }
441 
442     /**
443      * @return a container with through hole via hole outside diameters.
444      */
GetThroughHoleViaOds()445     const BVH_CONTAINER_2D& GetThroughHoleViaOds() const noexcept
446     {
447         return m_throughHoleViaOds;
448     }
449 
GetThroughHoleViaOdPolys()450     const SHAPE_POLY_SET& GetThroughHoleViaOdPolys() const noexcept
451     {
452         return m_throughHoleViaOdPolys;
453     }
454 
455     /**
456      * Get the through hole inner diameter container.
457      *
458      * @return a container with holes inner diameters.
459      */
GetThroughHoleIds()460     const BVH_CONTAINER_2D& GetThroughHoleIds() const noexcept
461     {
462         return m_throughHoleIds;
463     }
464 
465     /**
466      * Get number of vias in this board.
467      *
468      * @return number of vias.
469      */
GetViaCount()470     unsigned int GetViaCount() const noexcept
471     {
472         return m_viaCount;
473     }
474 
475     /**
476      * Get number of holes in this board.
477      *
478      * @return number of holes.
479      */
GetHoleCount()480     unsigned int GetHoleCount() const noexcept
481     {
482         return m_holeCount;
483     }
484 
485     /**
486      * Thee average diameter of the via holes.
487      *
488      * @return via hole average diameter dimension in 3D units.
489      */
GetAverageViaHoleDiameter()490     float GetAverageViaHoleDiameter() const noexcept
491     {
492         return m_averageViaHoleDiameter;
493     }
494 
495     /**
496      * Average diameter of through holes.
497      *
498      * @return the average diameter of through holes in 3D units.
499      */
GetAverageHoleDiameter()500     float GetAverageHoleDiameter() const noexcept
501     {
502         return m_averageHoleDiameter;
503     }
504 
505     /**
506      * Average width of the tracks.
507      *
508      * @return average track width in 3D units.
509      */
GetAverageTrackWidth()510     float GetAverageTrackWidth() const noexcept
511     {
512         return m_averageTrackWidth;
513     }
514 
515     /**
516      * @param aDiameter3DU diameter in 3DU.
517      * @return number of sides that should be used in a circle with \a aDiameter3DU.
518      */
519     unsigned int GetCircleSegmentCount( float aDiameter3DU ) const;
520 
521     /**
522      * @param aDiameterBIU diameter in board internal units.
523      * @return number of sides that should be used in circle with \a aDiameterBIU.
524      */
525     unsigned int GetCircleSegmentCount( int aDiameterBIU ) const;
526 
527     /**
528      * Get map of polygon's layers.
529      *
530      * @return the map with polygon's layers.
531      */
GetPolyMap()532     const MAP_POLY& GetPolyMap() const noexcept
533     {
534         return m_layers_poly;
535     }
536 
GetFrontPlatedPadPolys()537     const SHAPE_POLY_SET* GetFrontPlatedPadPolys()
538     {
539         return m_frontPlatedPadPolys;
540     }
541 
GetBackPlatedPadPolys()542     const SHAPE_POLY_SET* GetBackPlatedPadPolys()
543     {
544         return m_backPlatedPadPolys;
545     }
546 
GetHoleIdPolysMap()547     const MAP_POLY& GetHoleIdPolysMap() const noexcept
548     {
549         return m_layerHoleIdPolys;
550     }
551 
GetHoleOdPolysMap()552     const MAP_POLY& GetHoleOdPolysMap() const noexcept
553     {
554         return m_layerHoleOdPolys;
555     }
556 
557 private:
558     /**
559      * Create the board outline polygon.
560      *
561      * @return false if the outline could not be created
562      */
563     bool createBoardPolygon( wxString* aErrorMsg );
564     void createLayers( REPORTER* aStatusReporter );
565     void destroyLayers();
566 
567     // Helper functions to create the board
568      void createTrack( const PCB_TRACK* aTrack, CONTAINER_2D_BASE* aDstContainer,
569                        int aClearanceValue );
570 
571     void createPadWithClearance( const PAD *aPad, CONTAINER_2D_BASE* aDstContainer,
572                                  PCB_LAYER_ID aLayer, const wxSize& aClearanceValue ) const;
573 
574     OBJECT_2D* createPadWithDrill( const PAD* aPad, int aInflateValue );
575 
576     void addPadsWithClearance( const FOOTPRINT* aFootprint, CONTAINER_2D_BASE* aDstContainer,
577                                PCB_LAYER_ID aLayerId, int aInflateValue,
578                                bool aSkipNPTHPadsWihNoCopper, bool aSkipPlatedPads,
579                                bool aSkipNonPlatedPads );
580 
581     void addFootprintShapesWithClearance( const FOOTPRINT* aFootprint,
582                                           CONTAINER_2D_BASE* aDstContainer,
583                                           PCB_LAYER_ID aLayerId, int aInflateValue );
584 
585     void addShapeWithClearance( const PCB_TEXT* aText, CONTAINER_2D_BASE* aDstContainer,
586                                 PCB_LAYER_ID aLayerId, int aClearanceValue );
587 
588     void addShapeWithClearance( const PCB_SHAPE* aShape, CONTAINER_2D_BASE* aDstContainer,
589                                 PCB_LAYER_ID aLayerId, int aClearanceValue );
590 
591     void addShapeWithClearance( const PCB_DIMENSION_BASE* aDimension,
592                                 CONTAINER_2D_BASE* aDstContainer, PCB_LAYER_ID aLayerId,
593                                 int aClearanceValue );
594 
595     void addSolidAreasShapes( const ZONE* aZoneContainer, CONTAINER_2D_BASE* aDstContainer,
596                               PCB_LAYER_ID aLayerId );
597 
598     void transformArcToSegments( const wxPoint& aCentre, const wxPoint& aStart, double aArcAngle,
599                                  int aCircleToSegmentsCount, int aWidth,
600                                  CONTAINER_2D_BASE* aDstContainer, const BOARD_ITEM& aBoardItem );
601 
602     void buildPadOutlineAsSegments( const PAD* aPad, CONTAINER_2D_BASE* aDstContainer, int aWidth );
603 
604     // Helper functions to create poly contours
605     void buildPadOutlineAsPolygon( const PAD* aPad, SHAPE_POLY_SET& aCornerBuffer,
606                                    int aWidth) const;
607 
608     void transformFPShapesToPolygon( const FOOTPRINT* aFootprint, PCB_LAYER_ID aLayer,
609                                      SHAPE_POLY_SET& aCornerBuffer ) const;
610 
611 public:
612     static CUSTOM_COLORS_LIST   g_SilkscreenColors;
613     static CUSTOM_COLORS_LIST   g_MaskColors;
614     static CUSTOM_COLORS_LIST   g_PasteColors;
615     static CUSTOM_COLORS_LIST   g_FinishColors;
616     static CUSTOM_COLORS_LIST   g_BoardColors;
617 
618     static KIGFX::COLOR4D       g_DefaultBackgroundTop;
619     static KIGFX::COLOR4D       g_DefaultBackgroundBot;
620     static KIGFX::COLOR4D       g_DefaultSilkscreen;
621     static KIGFX::COLOR4D       g_DefaultSolderMask;
622     static KIGFX::COLOR4D       g_DefaultSolderPaste;
623     static KIGFX::COLOR4D       g_DefaultSurfaceFinish;
624     static KIGFX::COLOR4D       g_DefaultBoardBody;
625 
626 public:
627     SFVEC4F m_BgColorBot;         ///< background bottom color
628     SFVEC4F m_BgColorTop;         ///< background top color
629     SFVEC4F m_BoardBodyColor;     ///< in realistic mode: FR4 board color
630     SFVEC4F m_SolderMaskColorBot; ///< in realistic mode: solder mask color ( bot )
631     SFVEC4F m_SolderMaskColorTop; ///< in realistic mode: solder mask color ( top )
632     SFVEC4F m_SolderPasteColor;   ///< in realistic mode: solder paste color
633     SFVEC4F m_SilkScreenColorBot; ///< in realistic mode: SilkScreen color ( bot )
634     SFVEC4F m_SilkScreenColorTop; ///< in realistic mode: SilkScreen color ( top )
635     SFVEC4F m_CopperColor;        ///< in realistic mode: copper color
636 
637     SFVEC3F m_OpenGlSelectionColor;
638 
639     // Raytracing light colors
640     SFVEC3F m_RtCameraLightColor;
641     SFVEC3F m_RtLightColorTop;
642     SFVEC3F m_RtLightColorBottom;
643 
644     std::vector<SFVEC3F> m_RtLightColor;
645     std::vector<SFVEC2F> m_RtLightSphericalCoords;
646 
647     // Raytracing options
648     int m_RtShadowSampleCount;
649     int m_RtReflectionSampleCount;
650     int m_RtRefractionSampleCount;
651     int m_RtRecursiveReflectionCount;
652     int m_RtRecursiveRefractionCount;
653 
654     float m_RtSpreadShadows;
655     float m_RtSpreadReflections;
656     float m_RtSpreadRefractions;
657 
658 private:
659     BOARD*              m_board;
660     S3D_CACHE*          m_3dModelManager;
661     COLOR_SETTINGS*     m_colors;
662 
663     std::vector< bool > m_drawFlags;
664     GRID3D_TYPE         m_gridType;
665     RENDER_ENGINE       m_renderEngine;
666     MATERIAL_MODE       m_materialMode;
667     ANTIALIASING_MODE   m_antiAliasingMode;
668 
669 
670     wxPoint m_boardPos;          ///< Board center position in board internal units.
671     wxSize  m_boardSize;         ///< Board size in board internal units.
672     SFVEC3F m_boardCenter;       ///< 3D center position of the board in 3D units.
673     BBOX_3D m_boardBoundingBox;  ///< 3D bounding box of the board in 3D units.
674 
675 
676     ///< Polygon contours for each layer.
677     MAP_POLY          m_layers_poly;
678 
679     SHAPE_POLY_SET*   m_frontPlatedPadPolys;
680     SHAPE_POLY_SET*   m_backPlatedPadPolys;
681 
682     ///< Polygon contours for hole outer diameters for each layer.
683     MAP_POLY          m_layerHoleOdPolys;
684 
685     ///< Polygon contours for hole inner diameters for each layer.
686     MAP_POLY          m_layerHoleIdPolys;
687 
688     ///< Polygon contours for non plated through hole outer diameters.
689     SHAPE_POLY_SET    m_nonPlatedThroughHoleOdPolys;
690 
691     ///< Polygon contours for through hole outer diameters.
692     SHAPE_POLY_SET    m_throughHoleOdPolys;
693 
694     ///< Polygon contours for through holes via outer diameters.
695     SHAPE_POLY_SET    m_throughHoleViaOdPolys;
696 
697     ///< Polygon contours for through hole via annular rings.
698     SHAPE_POLY_SET    m_throughHoleAnnularRingPolys;
699 
700     SHAPE_POLY_SET    m_board_poly;       ///< Board outline polygon.
701 
702     MAP_CONTAINER_2D_BASE  m_layerMap;    ///< 2D elements for each layer.
703 
704 
705     BVH_CONTAINER_2D* m_platedPadsFront;
706     BVH_CONTAINER_2D* m_platedPadsBack;
707 
708     ///< The holes per each layer.
709     MAP_CONTAINER_2D_BASE  m_layerHoleMap;
710 
711     ///< List of through holes with the radius of the hole inflated with the copper thickness.
712     BVH_CONTAINER_2D   m_throughHoleOds;
713 
714     ///< List of plated through hole annular rings.
715     BVH_CONTAINER_2D   m_throughHoleAnnularRings;
716 
717     ///< List of through hole inner diameters.
718     BVH_CONTAINER_2D   m_throughHoleIds;
719 
720     ///< List of through hole vias with the radius of the hole inflated with the copper thickness.
721     BVH_CONTAINER_2D   m_throughHoleViaOds;
722 
723     ///< List of through hole via inner diameters.
724     BVH_CONTAINER_2D   m_throughHoleViaIds;
725 
726     ///< Number of copper layers actually used by the board.
727     unsigned int m_copperLayersCount;
728 
729     ///< Scale factor to convert board internal units to 3D units normalized between -1.0 and 1.0.
730     double m_biuTo3Dunits;
731 
732     ///< Top (End) Z position of each layer in 3D units.
733     std::array<float, PCB_LAYER_ID_COUNT>  m_layerZcoordTop;
734 
735     ///< Bottom (Start) Z position of each layer in 3D units.
736     std::array<float, PCB_LAYER_ID_COUNT>  m_layerZcoordBottom;
737 
738     ///< Copper thickness in 3D units.
739     float  m_copperThickness3DU;
740 
741     ///< Epoxy thickness in 3D units.
742     float  m_epoxyThickness3DU;
743 
744     ///< Non copper layers thickness in 3D units.
745     float  m_nonCopperLayerThickness3DU;
746 
747     ///< solder paste layers thickness in 3D units.
748     float  m_solderPasteLayerThickness3DU;
749 
750     ///< Number of tracks in the board.
751     unsigned int m_trackCount;
752 
753     ///< Track average width.
754     float        m_averageTrackWidth;
755 
756     ///< Number of through hole vias in the board.
757     unsigned int m_viaCount;
758 
759     ///< Computed average diameter of the via holes in 3D units.
760     float        m_averageViaHoleDiameter;
761 
762     ///< Number of holes in the board.
763     unsigned int m_holeCount;
764 
765     ///< Computed average diameter of the holes in 3D units.
766     float        m_averageHoleDiameter;
767 
768     /**
769      *  Trace mask used to enable or disable the trace output of this class.
770      *  The debug output can be turned on by setting the WXTRACE environment variable to
771      *  "KI_TRACE_EDA_CINFO3D_VISU".  See the wxWidgets documentation on wxLogTrace for
772      *  more information.
773      */
774     static const wxChar* m_logTrace;
775 
776 };
777 
778 
779 class EDA_3D_BOARD_HOLDER
780 {
781 public:
782     virtual BOARD_ADAPTER& GetAdapter() = 0;
783     virtual CAMERA&        GetCurrentCamera() = 0;
784 
~EDA_3D_BOARD_HOLDER()785     virtual ~EDA_3D_BOARD_HOLDER() {};
786 };
787 
788 #endif // BOARD_ADAPTER_H
789