diff --git a/3d-viewer/3d_cache/3d_cache.cpp b/3d-viewer/3d_cache/3d_cache.cpp index ddd6ac9449..c3d8fd7c99 100644 --- a/3d-viewer/3d_cache/3d_cache.cpp +++ b/3d-viewer/3d_cache/3d_cache.cpp @@ -211,7 +211,8 @@ SCENEGRAPH* S3D_CACHE::load( const wxString& aModelFile, const wxString& aBasePa } -SCENEGRAPH* S3D_CACHE::Load( const wxString& aModelFile, const wxString& aBasePath, const EMBEDDED_FILES* aEmbeddedFiles ) +SCENEGRAPH* S3D_CACHE::Load( const wxString& aModelFile, const wxString& aBasePath, + const EMBEDDED_FILES* aEmbeddedFiles ) { return load( aModelFile, aBasePath, nullptr, aEmbeddedFiles ); } @@ -612,4 +613,4 @@ void S3D_CACHE::CleanCacheDir( int aNumDaysOld ) } } } -} \ No newline at end of file +} diff --git a/3d-viewer/3d_cache/3d_cache.h b/3d-viewer/3d_cache/3d_cache.h index 0738445500..8d40187f9d 100644 --- a/3d-viewer/3d_cache/3d_cache.h +++ b/3d-viewer/3d_cache/3d_cache.h @@ -63,7 +63,7 @@ public: } /** - * Sets the configuration directory to be used by the model manager for storing 3D + * Set the configuration directory to be used by the model manager for storing 3D * model manager configuration data and the model cache. * * The config directory may only be set once in the lifetime of the object. @@ -98,7 +98,8 @@ public: * @param aEmbeddedFiles is a pointer to the embedded files list. * @return true if the model was successfully loaded, otherwise false. */ - SCENEGRAPH* Load( const wxString& aModelFile, const wxString& aBasePath, const EMBEDDED_FILES* aEmbeddedFiles ); + SCENEGRAPH* Load( const wxString& aModelFile, const wxString& aBasePath, + const EMBEDDED_FILES* aEmbeddedFiles ); FILENAME_RESOLVER* GetResolver() noexcept; @@ -130,7 +131,8 @@ public: * @param aEmbeddedFiles is a pointer to the embedded files list. * @return is a pointer to the render data or NULL if not available. */ - S3DMODEL* GetModel( const wxString& aModelFileName, const wxString& aBasePath, const EMBEDDED_FILES* aEmbeddedFiles ); + S3DMODEL* GetModel( const wxString& aModelFileName, const wxString& aBasePath, + const EMBEDDED_FILES* aEmbeddedFiles ); /** * Delete up old cache files in cache directory. @@ -172,12 +174,12 @@ private: // the real load function (can supply a cache entry pointer to member functions) SCENEGRAPH* load( const wxString& aModelFile, const wxString& aBasePath, S3D_CACHE_ENTRY** aCachePtr = nullptr, - const EMBEDDED_FILES* aEmbeddedFiles = nullptr ); + const EMBEDDED_FILES* aEmbeddedFiles = nullptr ); - /// cache entries + /// Cache entries. std::list< S3D_CACHE_ENTRY* > m_CacheList; - /// mapping of file names to cache names and data + /// Mapping of file names to cache names and data. std::map< wxString, S3D_CACHE_ENTRY*, rsort_wxString > m_CacheMap; FILENAME_RESOLVER* m_FNResolver; @@ -186,7 +188,7 @@ private: PROJECT* m_project; wxString m_CacheDir; - wxString m_ConfigDir; /// base configuration path for 3D items + wxString m_ConfigDir; ///< base configuration path for 3D items. }; #endif // CACHE_3D_H diff --git a/3d-viewer/3d_cache/3d_plugin_manager.cpp b/3d-viewer/3d_cache/3d_plugin_manager.cpp index 0a77a1d654..2ee53d3028 100644 --- a/3d-viewer/3d_cache/3d_plugin_manager.cpp +++ b/3d-viewer/3d_cache/3d_plugin_manager.cpp @@ -444,7 +444,8 @@ SCENEGRAPH* S3D_PLUGIN_MANAGER::Load3DModel( const wxString& aFileName, std::str ext_to_find.MakeLower(); #endif - // .gz files are compressed versions that may have additional information in the previous extension + // .gz files are compressed versions that may have additional information in the previous + // extension. if( ext_to_find == wxT( "gz" ) ) { wxFileName second( raw.GetName() ); @@ -518,8 +519,7 @@ bool S3D_PLUGIN_MANAGER::CheckTag( const char* aTag ) ptag.clear(); (*pS)->GetPluginInfo( ptag ); - // if the plugin name matches then the version - // must also match + // if the plugin name matches then the version must also match if( !ptag.compare( 0, pname.size(), pname ) ) { if( ptag.compare( tname ) ) diff --git a/3d-viewer/3d_canvas/board_adapter.cpp b/3d-viewer/3d_canvas/board_adapter.cpp index 387f8dc658..bed4df3907 100644 --- a/3d-viewer/3d_canvas/board_adapter.cpp +++ b/3d-viewer/3d_canvas/board_adapter.cpp @@ -374,7 +374,8 @@ void BOARD_ADAPTER::InitSettings( REPORTER* aStatusReporter, REPORTER* aWarningR m_nonCopperLayerThickness3DU = DEFAULT_TECH_LAYER_THICKNESS * m_biuTo3Dunits; m_solderPasteLayerThickness3DU = SOLDERPASTE_LAYER_THICKNESS * m_biuTo3Dunits; - g_BevelThickness3DU = pcbIUScale.mmToIU( ADVANCED_CFG::GetCfg().m_3DRT_BevelHeight_um / 1000.0 ) * m_biuTo3Dunits; + g_BevelThickness3DU = pcbIUScale.mmToIU( ADVANCED_CFG::GetCfg().m_3DRT_BevelHeight_um / 1000.0 ) + * m_biuTo3Dunits; if( m_board ) { @@ -395,9 +396,10 @@ void BOARD_ADAPTER::InitSettings( REPORTER* aStatusReporter, REPORTER* aWarningR case BS_ITEM_TYPE_COPPER: { - // The copper thickness must be > 0 to avoid draw issues (divide by 0 for instance) - // We use a minimal arbitrary value = 1 micrometer here: - int copper_thickness = std::max( item->GetThickness(), pcbIUScale.mmToIU( 0.001 ) ); + // The copper thickness must be > 0 to avoid draw issues (divide by 0 for + // instance). We use a minimal arbitrary value = 1 micrometer here: + int copper_thickness = std::max( item->GetThickness(), + pcbIUScale.mmToIU( 0.001 ) ); if( item->GetBrdLayerId() == F_Cu ) m_frontCopperThickness3DU = copper_thickness * m_biuTo3Dunits; @@ -419,8 +421,10 @@ void BOARD_ADAPTER::InitSettings( REPORTER* aStatusReporter, REPORTER* aWarningR // Init Z position of each layer // calculate z position for each copper layer - // Zstart = -m_epoxyThickness / 2.0 is the z position of the back (bottom layer) (layer id = B_Cu) - // Zstart = +m_epoxyThickness / 2.0 is the z position of the front (top layer) (layer id = F_Cu) + // Zstart = -m_epoxyThickness / 2.0 is the z position of the back (bottom layer) + // (layer id = B_Cu) + // Zstart = +m_epoxyThickness / 2.0 is the z position of the front (top layer) + // (layer id = F_Cu) // ____==__________==________==______ <- Bottom = +m_epoxyThickness / 2.0, // | | Top = Bottom + m_copperThickness @@ -470,12 +474,14 @@ void BOARD_ADAPTER::InitSettings( REPORTER* aStatusReporter, REPORTER* aWarningR continue; m_layerZcoordBottom[(PCB_LAYER_ID)layer_id] = zpos_copperTop_back - 2.0f * zpos_offset; - m_layerZcoordTop[(PCB_LAYER_ID)layer_id] = m_layerZcoordBottom[(PCB_LAYER_ID)layer_id] - m_backCopperThickness3DU; + m_layerZcoordTop[(PCB_LAYER_ID) layer_id] = + m_layerZcoordBottom[(PCB_LAYER_ID) layer_id] - m_backCopperThickness3DU; } // calculate z position for each technical layer // Solder mask and Solder paste have the same Z position - for( PCB_LAYER_ID layer_id : { B_Adhes, B_Mask, B_Paste, F_Adhes, F_Mask, F_Paste, B_SilkS, F_SilkS } ) + for( PCB_LAYER_ID layer_id : + { B_Adhes, B_Mask, B_Paste, F_Adhes, F_Mask, F_Paste, B_SilkS, F_SilkS } ) { float zposTop = 0.0; float zposBottom = 0.0; @@ -641,7 +647,8 @@ std::map<int, COLOR4D> BOARD_ADAPTER::GetLayerColors() const // Can't do a const KIGFX::COLOR4D& return type here because there are temporary variables auto findColor = - []( const wxString& aColorName, const CUSTOM_COLORS_LIST& aColorSet ) -> const KIGFX::COLOR4D + []( const wxString& aColorName, + const CUSTOM_COLORS_LIST& aColorSet ) -> const KIGFX::COLOR4D { if( aColorName.StartsWith( wxT( "#" ) ) ) { diff --git a/3d-viewer/3d_canvas/board_adapter.h b/3d-viewer/3d_canvas/board_adapter.h index fe9ac78bdb..d1e2b115ff 100644 --- a/3d-viewer/3d_canvas/board_adapter.h +++ b/3d-viewer/3d_canvas/board_adapter.h @@ -140,7 +140,7 @@ public: double BiuTo3dUnits() const noexcept { return m_biuTo3Dunits; } /** - * Get the board outling bounding box. + * Get the board outline bounding box. * * @return the board bounding box in 3D units. */ @@ -352,8 +352,16 @@ public: */ const MAP_POLY& GetPolyMap() const noexcept { return m_layers_poly; } - const SHAPE_POLY_SET* GetFrontPlatedPadAndGraphicPolys() { return m_frontPlatedPadAndGraphicPolys; } - const SHAPE_POLY_SET* GetBackPlatedPadAndGraphicPolys() { return m_backPlatedPadAndGraphicPolys; } + const SHAPE_POLY_SET* GetFrontPlatedPadAndGraphicPolys() + { + return m_frontPlatedPadAndGraphicPolys; + } + + const SHAPE_POLY_SET* GetBackPlatedPadAndGraphicPolys() + { + return m_backPlatedPadAndGraphicPolys; + } + const MAP_POLY& GetHoleIdPolysMap() const noexcept { return m_layerHoleIdPolys; } const MAP_POLY& GetHoleOdPolysMap() const noexcept { return m_layerHoleOdPolys; } @@ -403,8 +411,8 @@ private: PCB_LAYER_ID aLayerId ); void createArcSegments( const VECTOR2I& aCentre, const VECTOR2I& aStart, - const EDA_ANGLE& aArcAngle, int aCircleToSegmentsCount, int aWidth, - CONTAINER_2D_BASE* aContainer, const BOARD_ITEM& aOwner ); + const EDA_ANGLE& aArcAngle, int aCircleToSegmentsCount, int aWidth, + CONTAINER_2D_BASE* aContainer, const BOARD_ITEM& aOwner ); void buildPadOutlineAsSegments( const PAD* aPad, PCB_LAYER_ID aLayer, CONTAINER_2D_BASE* aDstContainer, int aWidth ); diff --git a/3d-viewer/3d_canvas/create_3Dgraphic_brd_items.cpp b/3d-viewer/3d_canvas/create_3Dgraphic_brd_items.cpp index 80dde864e3..84a09b2d15 100644 --- a/3d-viewer/3d_canvas/create_3Dgraphic_brd_items.cpp +++ b/3d-viewer/3d_canvas/create_3Dgraphic_brd_items.cpp @@ -219,9 +219,11 @@ void BOARD_ADAPTER::addFootprintShapes( const FOOTPRINT* aFootprint, CONTAINER_2 { if( !aVisibilityFlags.test( LAYER_FP_TEXT ) ) continue; - else if( text->GetText() == wxT( "${REFERENCE}" ) && !aVisibilityFlags.test( LAYER_FP_REFERENCES ) ) + else if( text->GetText() == wxT( "${REFERENCE}" ) + && !aVisibilityFlags.test( LAYER_FP_REFERENCES ) ) continue; - else if( text->GetText() == wxT( "${VALUE}" ) && !aVisibilityFlags.test( LAYER_FP_VALUES ) ) + else if( text->GetText() == wxT( "${VALUE}" ) + && !aVisibilityFlags.test( LAYER_FP_VALUES ) ) continue; addText( text, aContainer, text ); @@ -396,7 +398,8 @@ void BOARD_ADAPTER::createPadWithMargin( const PAD* aPad, CONTAINER_2D_BASE* aCo } else { - auto padShapes = std::static_pointer_cast<SHAPE_COMPOUND>( aPad->GetEffectiveShape( aLayer ) ); + auto padShapes = + std::static_pointer_cast<SHAPE_COMPOUND>( aPad->GetEffectiveShape( aLayer ) ); for( const SHAPE* shape : padShapes->Shapes() ) { @@ -483,7 +486,7 @@ void BOARD_ADAPTER::createPadWithMargin( const PAD* aPad, CONTAINER_2D_BASE* aCo void BOARD_ADAPTER::createPadWithHole( const PAD* aPad, CONTAINER_2D_BASE* aDstContainer, - int aInflateValue ) + int aInflateValue ) { if( !aPad->HasHole() ) { @@ -706,7 +709,7 @@ void BOARD_ADAPTER::addShape( const PCB_SHAPE* aShape, CONTAINER_2D_BASE* aConta ERROR_INSIDE ); // Some polygons can be a bit complex (especially when coming from a - // picture ot a text converted to a polygon + // picture of a text converted to a polygon // So call Simplify before calling ConvertPolygonToTriangles, just in case. polyList.Simplify(); diff --git a/3d-viewer/3d_canvas/eda_3d_canvas.cpp b/3d-viewer/3d_canvas/eda_3d_canvas.cpp index 397d8d6954..56e3a23e2d 100644 --- a/3d-viewer/3d_canvas/eda_3d_canvas.cpp +++ b/3d-viewer/3d_canvas/eda_3d_canvas.cpp @@ -348,7 +348,8 @@ void EDA_3D_CANVAS::DisplayStatus() m_parentStatusBar->SetStatusText( msg, static_cast<int>( EDA_3D_VIEWER_STATUSBAR::Y_POS ) ); msg.Printf( wxT( "zoom %3.2f" ), 1 / m_camera.GetZoom() ); - m_parentStatusBar->SetStatusText( msg, static_cast<int>( EDA_3D_VIEWER_STATUSBAR::ZOOM_LEVEL ) ); + m_parentStatusBar->SetStatusText( msg, + static_cast<int>( EDA_3D_VIEWER_STATUSBAR::ZOOM_LEVEL ) ); } } @@ -479,7 +480,7 @@ void EDA_3D_CANVAS::DoRePaint() if( m_camera_is_moving ) { const int64_t curtime_delta = GetRunningMicroSecs() - m_strtime_camera_movement; - curtime_delta_s = (curtime_delta / 1e6) * m_camera_moving_speed; + curtime_delta_s = ( curtime_delta / 1e6 ) * m_camera_moving_speed; m_camera.Interpolate( curtime_delta_s ); if( curtime_delta_s > 1.0f ) diff --git a/3d-viewer/3d_canvas/eda_3d_canvas.h b/3d-viewer/3d_canvas/eda_3d_canvas.h index ac4ffefa87..de9c53f7bf 100644 --- a/3d-viewer/3d_canvas/eda_3d_canvas.h +++ b/3d-viewer/3d_canvas/eda_3d_canvas.h @@ -109,16 +109,16 @@ public: void RenderRaytracingRequest(); /** - * Request a screenshot and output it to the \a aDstImage + * Request a screenshot and output it to the \a aDstImage. * - * @param aDstImage - Screenshot destination image + * @param aDstImage - Screenshot destination image. */ void GetScreenshot( wxImage& aDstImage ); /** - * Select a specific 3D view or operation + * Select a specific 3D view or operation. * - * @param aRequestedView the view to move to + * @param aRequestedView the view to move to. * @return true if the view request was handled, false if no command found for this view. */ bool SetView3D( VIEW3D_TYPE aRequestedView ); @@ -331,7 +331,7 @@ private: bool m_render3dmousePivot = false; // Render the 3dmouse pivot SFVEC3F m_3dmousePivotPos; // The position of the 3dmouse pivot - ///< Used to track gesture events. + /// Used to track gesture events. double m_gestureLastZoomFactor = 1.0; double m_gestureLastAngle = 0.0; diff --git a/3d-viewer/3d_model_viewer/eda_3d_model_viewer.cpp b/3d-viewer/3d_model_viewer/eda_3d_model_viewer.cpp index be34740111..b4eb37352f 100644 --- a/3d-viewer/3d_model_viewer/eda_3d_model_viewer.cpp +++ b/3d-viewer/3d_model_viewer/eda_3d_model_viewer.cpp @@ -44,8 +44,8 @@ #include <macros.h> /** - * Scale conversion from 3d model units to pcb units - */ + * Scale conversion from 3d model units to pcb units + */ #define UNITS3D_TO_UNITSPCB ( pcbIUScale.IU_PER_MM ) /** diff --git a/3d-viewer/3d_navlib/nl_3d_viewer_plugin_impl.cpp b/3d-viewer/3d_navlib/nl_3d_viewer_plugin_impl.cpp index 5f58ae7dd0..5cd3045f87 100644 --- a/3d-viewer/3d_navlib/nl_3d_viewer_plugin_impl.cpp +++ b/3d-viewer/3d_navlib/nl_3d_viewer_plugin_impl.cpp @@ -24,7 +24,7 @@ #include <3d-viewer/3d_rendering/track_ball.h> #include <3d-viewer/3d_canvas/eda_3d_canvas.h> -// KiCAD includes +// KiCad includes #include <tool/action_manager.h> #include <tool/tool_manager.h> #include <tool/tools_holder.h> @@ -73,7 +73,8 @@ bool equals( glm::mat<L, C, T, Q> const& aFirst, glm::mat<L, C, T, Q> const& aSe } -NL_3D_VIEWER_PLUGIN_IMPL::NL_3D_VIEWER_PLUGIN_IMPL( EDA_3D_CANVAS* aCanvas, const std::string& aProfileHint ) : +NL_3D_VIEWER_PLUGIN_IMPL::NL_3D_VIEWER_PLUGIN_IMPL( EDA_3D_CANVAS* aCanvas, + const std::string& aProfileHint ) : NAV_3D( false, false ), m_canvas( aCanvas ), m_capIsMoving( false ), @@ -111,15 +112,7 @@ void NL_3D_VIEWER_PLUGIN_IMPL::Connect() exportCommandsAndImages(); } -/** - * Add a category to the store. - * - * The function adds category paths of the format "A.B" where B is a sub-category of A. - * - * @param aCategoryPath is the std::string representation of the category. - * @param aCategoryStore is the CATEGORY_STORE instance to add to. - * @return a CATEGORY_STORE::iterator where the category was added. - */ + CATEGORY_STORE::iterator add_category( std::string aCategoryPath, CATEGORY_STORE& aCategoryStore ) { using TDx::SpaceMouse::CCategory; @@ -192,7 +185,7 @@ void NL_3D_VIEWER_PLUGIN_IMPL::exportCommandsAndImages() std::string name = action->GetName(); - // Do no export commands for the pcbnew app. + // Do no export commands for the Pcbnew app. if( name.rfind( "pcbnew.", 0 ) == 0 ) { continue; diff --git a/3d-viewer/3d_navlib/nl_3d_viewer_plugin_impl.h b/3d-viewer/3d_navlib/nl_3d_viewer_plugin_impl.h index 757efadc94..592c1e5245 100644 --- a/3d-viewer/3d_navlib/nl_3d_viewer_plugin_impl.h +++ b/3d-viewer/3d_navlib/nl_3d_viewer_plugin_impl.h @@ -29,7 +29,7 @@ // TDxWare SDK. #include <SpaceMouse/CNavigation3D.hpp> -// KiCAD +// KiCad #include <include/plugins/3dapi/xv3d_types.h> // wx @@ -45,6 +45,15 @@ class TRACK_BALL; // temporary store for the categories typedef std::map<std::string, TDx::CCommandTreeNode*> CATEGORY_STORE; +/** + * Add a category to the store. + * + * The function adds category paths of the format "A.B" where B is a sub-category of A. + * + * @param aCategoryPath is the std::string representation of the category. + * @param aCategoryStore is the CATEGORY_STORE instance to add to. + * @return a CATEGORY_STORE::iterator where the category was added. + */ CATEGORY_STORE::iterator add_category( std::string aCategoryPath, CATEGORY_STORE& aCategoryStore ); // Convenience typedef. diff --git a/3d-viewer/3d_navlib/nl_footprint_properties_plugin_impl.h b/3d-viewer/3d_navlib/nl_footprint_properties_plugin_impl.h index d6a9a1584c..dd08058ab0 100644 --- a/3d-viewer/3d_navlib/nl_footprint_properties_plugin_impl.h +++ b/3d-viewer/3d_navlib/nl_footprint_properties_plugin_impl.h @@ -31,13 +31,14 @@ #include <SpaceMouse/CNavigation3D.hpp> /** - * The class that adjusts NL_3D_VIEWER_PLUGIN_IMPL implementation for 3D Model preview in footprint properties dialog. + * The class that adjusts NL_3D_VIEWER_PLUGIN_IMPL implementation for 3D Model preview in + * footprint properties dialog. */ class NL_FOOTPRINT_PROPERTIES_PLUGIN_IMPL : public NL_3D_VIEWER_PLUGIN_IMPL { public: /** - * Initializes a new instance of the NL_FOOTPRINT_PROPERTIES_PLUGIN. + * Initialize a new instance of the NL_FOOTPRINT_PROPERTIES_PLUGIN. * * @param aCanvas is the viewport to be navigated. */ @@ -60,8 +61,8 @@ private: /** * 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_NL_FOOTPRINT_PROPERTIES_PLUGIN". See the wxWidgets documentation on wxLogTrace for - * more information. + * "KI_TRACE_NL_FOOTPRINT_PROPERTIES_PLUGIN". See the wxWidgets documentation on + * wxLogTrace for more information. */ static const wxChar* m_logTrace; }; diff --git a/3d-viewer/3d_rendering/opengl/3d_model.cpp b/3d-viewer/3d_rendering/opengl/3d_model.cpp index 8af9c7d879..78c6752ecf 100644 --- a/3d-viewer/3d_rendering/opengl/3d_model.cpp +++ b/3d-viewer/3d_rendering/opengl/3d_model.cpp @@ -98,8 +98,8 @@ MODEL_3D::MODEL_3D( const S3DMODEL& a3DModel, MATERIAL_MODE aMaterialMode ) /** * WARNING: Horrible hack here! - * Somehow, buffer values are being shared between pcbnew and the 3d viewer, which then frees - * the buffer, resulting in errors in pcbnew. To resolve this temporarily, we generate + * Somehow, buffer values are being shared between Pcbnew and the 3d viewer, which then frees + * the buffer, resulting in errors in Pcbnew. To resolve this temporarily, we generate * extra buffers in 3dviewer and use the higher numbers. These are freed on close. * todo: Correctly separate the OpenGL contexts to prevent overlapping buffer vals */ @@ -332,7 +332,8 @@ MODEL_3D::MODEL_3D( const S3DMODEL& a3DModel, MATERIAL_MODE aMaterialMode ) // temporary index buffer which will contain either GLushort or GLuint // type indices. allocate with a bit of meadow at the end. - auto tmp_idx = std::make_unique<GLuint[]>( ( idx_size * total_index_count + 8 ) / sizeof( GLuint ) ); + auto tmp_idx = + std::make_unique<GLuint[]>( ( idx_size * total_index_count + 8 ) / sizeof( GLuint ) ); unsigned int prev_vtx_count = 0; unsigned int idx_offset = 0; @@ -507,9 +508,9 @@ void MODEL_3D::Draw( bool aTransparent, float aOpacity, bool aUseSelectedMateria { for( const MODEL_3D::MATERIAL& mat : m_materials ) { - // There is at least one default material created in case a mesh has no declared materials. - // Most meshes have a material, so usually the first material will have nothing to render and is skip. - // See S3D::GetModel for more details. + // There is at least one default material created in case a mesh has no declared + // materials. Most meshes have a material, so usually the first material will have + // nothing to render and is skip. See S3D::GetModel for more details. if( mat.m_render_idx_count == 0 ) { continue; @@ -535,7 +536,8 @@ void MODEL_3D::Draw( bool aTransparent, float aOpacity, bool aUseSelectedMateria break; case MATERIAL_MODE::DIFFUSE_ONLY: - OglSetDiffuseMaterial( mat->m_Diffuse, aOpacity, aUseSelectedMaterial, aSelectionColor ); + OglSetDiffuseMaterial( mat->m_Diffuse, aOpacity, aUseSelectedMaterial, + aSelectionColor ); break; case MATERIAL_MODE::CAD_MODE: diff --git a/3d-viewer/3d_rendering/opengl/3d_model.h b/3d-viewer/3d_rendering/opengl/3d_model.h index 22f3cdc894..588b24ae0f 100644 --- a/3d-viewer/3d_rendering/opengl/3d_model.h +++ b/3d-viewer/3d_rendering/opengl/3d_model.h @@ -146,7 +146,8 @@ private: unsigned int m_render_idx_buffer_offset = 0; unsigned int m_render_idx_count = 0; - BBOX_3D m_bbox; ///< bounding box for this material group, used for transparent material ordering + BBOX_3D m_bbox; ///< bounding box for this material group, used for transparent + ///< material ordering. MATERIAL( const SMATERIAL& aOther ) : SMATERIAL( aOther ) { } bool IsTransparent() const { return m_Transparency > FLT_EPSILON; } diff --git a/3d-viewer/3d_rendering/opengl/create_scene.cpp b/3d-viewer/3d_rendering/opengl/create_scene.cpp index 8f3baaf213..c9dd977017 100644 --- a/3d-viewer/3d_rendering/opengl/create_scene.cpp +++ b/3d-viewer/3d_rendering/opengl/create_scene.cpp @@ -607,8 +607,10 @@ void RENDER_3D_OPENGL::reload( REPORTER* aStatusReporter, REPORTER* aWarningRepo if( m_boardAdapter.m_Cfg->m_Render.DifferentiatePlatedCopper() ) { - const SHAPE_POLY_SET* frontPlatedPadAndGraphicPolys = m_boardAdapter.GetFrontPlatedPadAndGraphicPolys(); - const SHAPE_POLY_SET* backPlatedPadAndGraphicPolys = m_boardAdapter.GetBackPlatedPadAndGraphicPolys(); + const SHAPE_POLY_SET* frontPlatedPadAndGraphicPolys = + m_boardAdapter.GetFrontPlatedPadAndGraphicPolys(); + const SHAPE_POLY_SET* backPlatedPadAndGraphicPolys = + m_boardAdapter.GetBackPlatedPadAndGraphicPolys(); if( frontPlatedPadAndGraphicPolys ) { @@ -617,7 +619,8 @@ void RENDER_3D_OPENGL::reload( REPORTER* aStatusReporter, REPORTER* aWarningRepo poly.BooleanSubtract( m_boardAdapter.GetTH_ODPolys() ); poly.BooleanSubtract( m_boardAdapter.GetNPTH_ODPolys() ); - m_platedPadsFront = generateLayerList( m_boardAdapter.GetPlatedPadsFront(), &poly, F_Cu ); + m_platedPadsFront = generateLayerList( m_boardAdapter.GetPlatedPadsFront(), &poly, + F_Cu ); // An entry for F_Cu must exist in m_layers or we'll never look at m_platedPadsFront if( m_layers.count( F_Cu ) == 0 ) @@ -965,7 +968,9 @@ void RENDER_3D_OPENGL::load3dModels( REPORTER* aStatusReporter ) { // It is not present, try get it from cache const S3DMODEL* modelPtr = - m_boardAdapter.Get3dCacheManager()->GetModel( fp_model.m_Filename, footprintBasePath, footprint ); + m_boardAdapter.Get3dCacheManager()->GetModel( fp_model.m_Filename, + footprintBasePath, + footprint ); // only add it if the return is not NULL if( modelPtr ) diff --git a/3d-viewer/3d_rendering/opengl/layer_triangles.cpp b/3d-viewer/3d_rendering/opengl/layer_triangles.cpp index 9f0824a632..1c3a050020 100644 --- a/3d-viewer/3d_rendering/opengl/layer_triangles.cpp +++ b/3d-viewer/3d_rendering/opengl/layer_triangles.cpp @@ -129,7 +129,7 @@ void TRIANGLE_DISPLAY_LIST::AddToMiddleContourns( const std::vector< SFVEC2F >& { if( aContournPoints.size() >= 4 ) { - // Calculate normals of each segment of the contourn + // Calculate normals of each segment of the contour std::vector< SFVEC2F > contournNormals; contournNormals.clear(); @@ -245,7 +245,7 @@ void TRIANGLE_DISPLAY_LIST::AddToMiddleContourns( const SHAPE_LINE_CHAIN& outlin } } - // Add first position fo the list to close the path + // Add first position of the list to close the path. if( lastV != contournPoints[0] ) contournPoints.push_back( contournPoints[0] ); @@ -472,10 +472,10 @@ void OPENGL_RENDER_LIST::DrawAll( bool aDrawMiddle ) const void OPENGL_RENDER_LIST::DrawCulled( bool aDrawMiddle, - const OPENGL_RENDER_LIST* aSubtractList, - const OPENGL_RENDER_LIST* bSubtractList, - const OPENGL_RENDER_LIST* cSubtractList, - const OPENGL_RENDER_LIST* dSubtractList ) const + const OPENGL_RENDER_LIST* aSubtractList, + const OPENGL_RENDER_LIST* bSubtractList, + const OPENGL_RENDER_LIST* cSubtractList, + const OPENGL_RENDER_LIST* dSubtractList ) const { glClearStencil( 0x00 ); glClear( GL_STENCIL_BUFFER_BIT ); @@ -502,8 +502,8 @@ void OPENGL_RENDER_LIST::DrawCulled( bool aDrawMiddle, if( dSubtractList ) dSubtractList->DrawBot(); - glEnable(GL_DEPTH_TEST); - glDepthMask(GL_TRUE); + glEnable( GL_DEPTH_TEST ); + glDepthMask( GL_TRUE ); glColorMask( GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE ); glStencilFunc( GL_EQUAL, 0, 1 ); @@ -529,8 +529,8 @@ void OPENGL_RENDER_LIST::DrawCulled( bool aDrawMiddle, if( dSubtractList ) dSubtractList->DrawTop(); - glEnable(GL_DEPTH_TEST); - glDepthMask(GL_TRUE); + glEnable( GL_DEPTH_TEST ); + glDepthMask( GL_TRUE ); glColorMask( GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE ); glStencilFunc( GL_NOTEQUAL, 2, 0x03 ); glStencilOp( GL_KEEP, GL_KEEP, GL_INCR ); @@ -584,11 +584,11 @@ void OPENGL_RENDER_LIST::SetItIsTransparent( bool aSetTransparent ) GLuint OPENGL_RENDER_LIST::generate_top_or_bot_seg_ends( const TRIANGLE_LIST* aTriangleContainer, bool aIsNormalUp, GLuint aTextureId ) const { - wxASSERT( aTriangleContainer != nullptr ); + wxCHECK( aTriangleContainer != nullptr, 0 ); wxASSERT( ( aTriangleContainer->GetVertexSize() % 3 ) == 0 ); - // Top and Bot dont have normals array stored in container + // Top and Bot don't have normals array stored in container wxASSERT( aTriangleContainer->GetNormalsSize() == 0 ); if( ( aTriangleContainer->GetVertexSize() > 0 ) @@ -651,11 +651,11 @@ GLuint OPENGL_RENDER_LIST::generate_top_or_bot_seg_ends( GLuint OPENGL_RENDER_LIST::generate_top_or_bot_triangles( const TRIANGLE_LIST* aTriangleContainer, bool aIsNormalUp ) const { - wxASSERT( aTriangleContainer != nullptr ); + wxCHECK( aTriangleContainer != nullptr, 0 ); wxASSERT( ( aTriangleContainer->GetVertexSize() % 3 ) == 0 ); - // Top and Bot dont have normals array stored in container + // Top and Bot dint have normals array stored in container wxASSERT( aTriangleContainer->GetNormalsSize() == 0 ); if( ( aTriangleContainer->GetVertexSize() > 0 ) @@ -695,7 +695,7 @@ GLuint OPENGL_RENDER_LIST::generate_top_or_bot_triangles( const TRIANGLE_LIST* a GLuint OPENGL_RENDER_LIST::generate_middle_triangles( const TRIANGLE_LIST* aTriangleContainer ) const { - wxASSERT( aTriangleContainer != nullptr ); + wxCHECK( aTriangleContainer != nullptr, 0 ); // We expect that it is a multiple of 3 vertex wxASSERT( ( aTriangleContainer->GetVertexSize() % 3 ) == 0 ); @@ -767,3 +767,5 @@ void OPENGL_RENDER_LIST::beginTransformation() const glScalef( 1.0f, 1.0f, m_zScaleTransformation ); } } + +// LocalWords: EDA Luzeiro txt MERCHANTABILITY wxASSERT normals fo diff --git a/3d-viewer/3d_rendering/opengl/render_3d_opengl.cpp b/3d-viewer/3d_rendering/opengl/render_3d_opengl.cpp index dc6ea15fd5..c1051e45f2 100644 --- a/3d-viewer/3d_rendering/opengl/render_3d_opengl.cpp +++ b/3d-viewer/3d_rendering/opengl/render_3d_opengl.cpp @@ -605,7 +605,7 @@ bool RENDER_3D_OPENGL::Redraw( bool aIsMoving, REPORTER* aStatusReporter, if( layerFlags.test( LAYER_3D_BOARD ) && m_boardAdapter.m_BoardBodyColor.a > opacity_min ) { - // generating internal copper layers is time consumming. so skip them + // generating internal copper layers is time consuming. so skip them // if the board body is masking them (i.e. if the opacity is near 1.0) // B_Cu is layer 2 and all inner layers are higher values if( layer > B_Cu && IsCopperLayer( layer ) ) @@ -716,7 +716,8 @@ bool RENDER_3D_OPENGL::Redraw( bool aIsMoving, REPORTER* aStatusReporter, renderBoardBody( skipRenderHoles ); // Display transparent mask layers - if( layerFlags.test( LAYER_3D_SOLDERMASK_TOP ) || layerFlags.test( LAYER_3D_SOLDERMASK_BOTTOM ) ) + if( layerFlags.test( LAYER_3D_SOLDERMASK_TOP ) + || layerFlags.test( LAYER_3D_SOLDERMASK_BOTTOM ) ) { // add a depth buffer offset, it will help to hide some artifacts // on silkscreen where the SolderMask is removed @@ -766,7 +767,9 @@ bool RENDER_3D_OPENGL::Redraw( bool aIsMoving, REPORTER* aStatusReporter, // Enables Texture Env so it can combine model transparency with each footprint opacity glEnable( GL_TEXTURE_2D ); glActiveTexture( GL_TEXTURE0 ); - glBindTexture( GL_TEXTURE_2D, m_circleTexture ); // Uses an existent texture so the glTexEnv operations will work + + // Uses an existent texture so the glTexEnv operations will work. + glBindTexture( GL_TEXTURE_2D, m_circleTexture ); glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE ); glTexEnvf( GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_INTERPOLATE ); @@ -985,7 +988,8 @@ void RENDER_3D_OPENGL::get3dModelsSelected( std::list<MODELTORENDER> &aDstRender const bool isFlipped = fp->IsFlipped(); if( aGetTop == !isFlipped || aGetBot == isFlipped ) - get3dModelsFromFootprint( aDstRenderList, fp, aRenderTransparentOnly, highlight ); + get3dModelsFromFootprint( aDstRenderList, fp, aRenderTransparentOnly, + highlight ); } } } @@ -1046,7 +1050,8 @@ void RENDER_3D_OPENGL::get3dModelsFromFootprint( std::list<MODELTORENDER> &aDstR glm::mat4 modelworldMatrix = fpMatrix; const SFVEC3F offset = SFVEC3F( sM.m_Offset.x, sM.m_Offset.y, sM.m_Offset.z ); - const SFVEC3F rotation = SFVEC3F( sM.m_Rotation.x, sM.m_Rotation.y, sM.m_Rotation.z ); + const SFVEC3F rotation = SFVEC3F( sM.m_Rotation.x, sM.m_Rotation.y, + sM.m_Rotation.z ); const SFVEC3F scale = SFVEC3F( sM.m_Scale.x, sM.m_Scale.y, sM.m_Scale.z ); std::vector<float> key = { offset.x, offset.y, offset.z, diff --git a/3d-viewer/3d_rendering/raytracing/accelerators/bvh_pbrt.cpp b/3d-viewer/3d_rendering/raytracing/accelerators/bvh_pbrt.cpp index 516f9174a3..cc389cd6ab 100644 --- a/3d-viewer/3d_rendering/raytracing/accelerators/bvh_pbrt.cpp +++ b/3d-viewer/3d_rendering/raytracing/accelerators/bvh_pbrt.cpp @@ -848,7 +848,7 @@ BVHBuildNode *BVH_PBRT::emitLBVH( BVHBuildNode* &buildNodes, while( searchStart + 1 != searchEnd ) { - wxASSERT(searchStart != searchEnd); + wxASSERT( searchStart != searchEnd ); const int mid = ( searchStart + searchEnd ) / 2; diff --git a/3d-viewer/3d_rendering/raytracing/create_scene.cpp b/3d-viewer/3d_rendering/raytracing/create_scene.cpp index ca42a61d2f..abee264f61 100644 --- a/3d-viewer/3d_rendering/raytracing/create_scene.cpp +++ b/3d-viewer/3d_rendering/raytracing/create_scene.cpp @@ -67,18 +67,22 @@ static float TransparencyControl( float aGrayColorValue, float aTransparency ) } /** - * Scale conversion from 3d model units to pcb units - */ + * Scale conversion from 3d model units to pcb units + */ #define UNITS3D_TO_UNITSPCB ( pcbIUScale.IU_PER_MM ) void RENDER_3D_RAYTRACE_BASE::setupMaterials() { - MATERIAL::SetDefaultRefractionRayCount( m_boardAdapter.m_Cfg->m_Render.raytrace_nrsamples_refractions ); - MATERIAL::SetDefaultReflectionRayCount( m_boardAdapter.m_Cfg->m_Render.raytrace_nrsamples_reflections ); + MATERIAL::SetDefaultRefractionRayCount( + m_boardAdapter.m_Cfg->m_Render.raytrace_nrsamples_refractions ); + MATERIAL::SetDefaultReflectionRayCount( + m_boardAdapter.m_Cfg->m_Render.raytrace_nrsamples_reflections ); - MATERIAL::SetDefaultRefractionRecursionCount( m_boardAdapter.m_Cfg->m_Render.raytrace_recursivelevel_refractions ); - MATERIAL::SetDefaultReflectionRecursionCount( m_boardAdapter.m_Cfg->m_Render.raytrace_recursivelevel_reflections ); + MATERIAL::SetDefaultRefractionRecursionCount( + m_boardAdapter.m_Cfg->m_Render.raytrace_recursivelevel_refractions ); + MATERIAL::SetDefaultReflectionRecursionCount( + m_boardAdapter.m_Cfg->m_Render.raytrace_recursivelevel_reflections ); double mmTo3Dunits = pcbIUScale.IU_PER_MM * m_boardAdapter.BiuTo3dUnits(); @@ -177,8 +181,8 @@ void RENDER_3D_RAYTRACE_BASE::setupMaterials() void RENDER_3D_RAYTRACE_BASE::createObject( CONTAINER_3D& aDstContainer, const OBJECT_2D* aObject2D, - float aZMin, float aZMax, const MATERIAL* aMaterial, - const SFVEC3F& aObjColor ) + float aZMin, float aZMax, const MATERIAL* aMaterial, + const SFVEC3F& aObjColor ) { switch( aObject2D->GetObjectType() ) { @@ -541,7 +545,8 @@ void RENDER_3D_RAYTRACE_BASE::Reload( REPORTER* aStatusReporter, REPORTER* aWarn radius ); objPtr->SetMaterial( &m_materials.m_EpoxyBoard ); - objPtr->SetColor( ConvertSRGBToLinear( m_boardAdapter.m_BoardBodyColor ) ); + objPtr->SetColor( + ConvertSRGBToLinear( m_boardAdapter.m_BoardBodyColor ) ); m_objectContainer.Add( objPtr ); } @@ -560,7 +565,8 @@ void RENDER_3D_RAYTRACE_BASE::Reload( REPORTER* aStatusReporter, REPORTER* aWarn aStatusReporter->Report( _( "Load Raytracing: layers" ) ); // Add layers maps (except B_Mask and F_Mask) - for( const std::pair<const PCB_LAYER_ID, BVH_CONTAINER_2D*>& entry : m_boardAdapter.GetLayerMap() ) + for( const std::pair<const PCB_LAYER_ID, BVH_CONTAINER_2D*>& entry : + m_boardAdapter.GetLayerMap() ) { const PCB_LAYER_ID layer_id = entry.first; const BVH_CONTAINER_2D* container2d = entry.second; @@ -667,7 +673,8 @@ void RENDER_3D_RAYTRACE_BASE::Reload( REPORTER* aStatusReporter, REPORTER* aWarn { const MATERIAL* materialLayer = &m_materials.m_SolderMask; - for( const std::pair<const PCB_LAYER_ID, BVH_CONTAINER_2D*>& entry : m_boardAdapter.GetLayerMap() ) + for( const std::pair<const PCB_LAYER_ID, BVH_CONTAINER_2D*>& entry : + m_boardAdapter.GetLayerMap() ) { const PCB_LAYER_ID layer_id = entry.first; const BVH_CONTAINER_2D* container2d = entry.second; @@ -1193,7 +1200,8 @@ void RENDER_3D_RAYTRACE_BASE::addPadsAndVias() } -void RENDER_3D_RAYTRACE_BASE::load3DModels( CONTAINER_3D& aDstContainer, bool aSkipMaterialInformation ) +void RENDER_3D_RAYTRACE_BASE::load3DModels( CONTAINER_3D& aDstContainer, + bool aSkipMaterialInformation ) { if( !m_boardAdapter.GetBoard() ) return; @@ -1249,6 +1257,7 @@ void RENDER_3D_RAYTRACE_BASE::load3DModels( CONTAINER_3D& aDstContainer, bool aS wxString libraryName = fp->GetFPID().GetLibNickname(); wxString footprintBasePath = wxEmptyString; + if( m_boardAdapter.GetBoard()->GetProject() ) { try @@ -1409,8 +1418,8 @@ MODEL_MATERIALS* RENDER_3D_RAYTRACE_BASE::getModelMaterial( const S3DMODEL* a3DM void RENDER_3D_RAYTRACE_BASE::addModels( CONTAINER_3D& aDstContainer, const S3DMODEL* a3DModel, - const glm::mat4& aModelMatrix, float aFPOpacity, - bool aSkipMaterialInformation, BOARD_ITEM* aBoardItem ) + const glm::mat4& aModelMatrix, float aFPOpacity, + bool aSkipMaterialInformation, BOARD_ITEM* aBoardItem ) { // Validate a3DModel pointers wxASSERT( a3DModel != nullptr ); diff --git a/3d-viewer/3d_rendering/raytracing/material.h b/3d-viewer/3d_rendering/raytracing/material.h index 7c403e8954..cc4a4a40ed 100644 --- a/3d-viewer/3d_rendering/raytracing/material.h +++ b/3d-viewer/3d_rendering/raytracing/material.h @@ -345,22 +345,22 @@ protected: SFVEC3F m_specularColor; float m_reflectivity; - ///< 1.0 is completely transparent, 0.0 completely opaque. + /// 1.0 is completely transparent, 0.0 completely opaque. float m_transparency; float m_absorbance; ///< absorbance factor for the transparent material. float m_reflection; ///< 1.0 completely reflective, 0.0 no reflective. bool m_castShadows; ///< true if this object will block the light. - ///< Number of rays that will be interpolated for this material if it is transparent. + /// Number of rays that will be interpolated for this material if it is transparent. unsigned int m_refractionRayCount; - ///< Number of rays that will be interpolated for this material if it is reflective. + /// Number of rays that will be interpolated for this material if it is reflective. unsigned int m_reflectionRayCount; - ///< Number of levels it allows for refraction recursiveness. + /// Number of levels it allows for refraction recursiveness. unsigned int m_refractionRecursionCount; - ///< Number of levels it allows for reflection recursiveness. + /// Number of levels it allows for reflection recursiveness. unsigned int m_reflectionRecursionCount; const MATERIAL_GENERATOR* m_generator; diff --git a/3d-viewer/3d_rendering/raytracing/render_3d_raytrace_base.cpp b/3d-viewer/3d_rendering/raytracing/render_3d_raytrace_base.cpp index b6caeae943..b9f57e4b11 100644 --- a/3d-viewer/3d_rendering/raytracing/render_3d_raytrace_base.cpp +++ b/3d-viewer/3d_rendering/raytracing/render_3d_raytrace_base.cpp @@ -256,6 +256,7 @@ static SFVEC3F convertLinearToSRGB( const SFVEC3F& aRGBcolor ) glm::lessThan( clampedColor, SFVEC3F(0.0031308f) ) ); } + static SFVEC4F convertLinearToSRGBA( const SFVEC4F& aRGBAcolor ) { return SFVEC4F( convertLinearToSRGB( SFVEC3F( aRGBAcolor ) ), aRGBAcolor.a ); @@ -275,6 +276,7 @@ SFVEC3F ConvertSRGBToLinear( const SFVEC3F& aSRGBcolor ) glm::lessThanEqual( aSRGBcolor, SFVEC3F( 0.04045f ) ) ); } + SFVEC4F ConvertSRGBAToLinear( const SFVEC4F& aSRGBAcolor ) { return SFVEC4F( ConvertSRGBToLinear( SFVEC3F( aSRGBAcolor ) ), aSRGBAcolor.a ); @@ -319,8 +321,8 @@ static void HITINFO_PACKET_init( HITINFO_PACKET* aHitPacket ) void RENDER_3D_RAYTRACE_BASE::renderRayPackets( const SFVEC4F* bgColorY, const RAY* aRayPkt, - HITINFO_PACKET* aHitPacket, bool is_testShadow, - SFVEC4F* aOutHitColor ) + HITINFO_PACKET* aHitPacket, bool is_testShadow, + SFVEC4F* aOutHitColor ) { for( unsigned int y = 0, i = 0; y < RAYPACKET_DIM; ++y ) { @@ -341,9 +343,9 @@ void RENDER_3D_RAYTRACE_BASE::renderRayPackets( const SFVEC4F* bgColorY, const R void RENDER_3D_RAYTRACE_BASE::renderAntiAliasPackets( const SFVEC4F* aBgColorY, - const HITINFO_PACKET* aHitPck_X0Y0, - const HITINFO_PACKET* aHitPck_AA_X1Y1, - const RAY* aRayPck, SFVEC4F* aOutHitColor ) + const HITINFO_PACKET* aHitPck_X0Y0, + const HITINFO_PACKET* aHitPck_AA_X1Y1, + const RAY* aRayPck, SFVEC4F* aOutHitColor ) { const bool is_testShadow = m_boardAdapter.m_Cfg->m_Render.raytrace_shadows; @@ -368,8 +370,8 @@ void RENDER_3D_RAYTRACE_BASE::renderAntiAliasPackets( const SFVEC4F* aBgColorY, unsigned int nodex1y0 = 0; - if( x < (RAYPACKET_DIM - 1) ) - nodex1y0 = aHitPck_X0Y0[ i + 1 ].m_HitInfo.m_acc_node_info; + if( x < ( RAYPACKET_DIM - 1 ) ) + nodex1y0 = aHitPck_X0Y0[i + 1].m_HitInfo.m_acc_node_info; unsigned int nodex0y1 = 0; @@ -503,9 +505,9 @@ void RENDER_3D_RAYTRACE_BASE::renderBlockTracing( uint8_t* ptrPBO, signed int iB for( unsigned int x = 0; x < RAYPACKET_DIM; ++x ) { - m_postShaderSsao.SetPixelData( blockPos.x + x, yBlockPos, - SFVEC3F( 0.0f ), outColor, - SFVEC3F( 0.0f ), 0, 1.0f ); + m_postShaderSsao.SetPixelData( blockPos.x + x, yBlockPos, + SFVEC3F( 0.0f ), outColor, + SFVEC3F( 0.0f ), 0, 1.0f ); } } } @@ -727,7 +729,8 @@ void RENDER_3D_RAYTRACE_BASE::postProcessShading( uint8_t* /* ptrPBO */, REPORTE } -void RENDER_3D_RAYTRACE_BASE::postProcessBlurFinish( uint8_t* ptrPBO, REPORTER* /* aStatusReporter */ ) +void RENDER_3D_RAYTRACE_BASE::postProcessBlurFinish( uint8_t* ptrPBO, + REPORTER* /* aStatusReporter */ ) { if( m_boardAdapter.m_Cfg->m_Render.raytrace_post_processing ) { @@ -854,9 +857,9 @@ void RENDER_3D_RAYTRACE_BASE::renderPreview( uint8_t* ptrPBO ) hitColorShading[i] = bhColorY; } - COLOR_RGBA cLRB_old[(RAYPACKET_DIM - 1)]; + COLOR_RGBA cLRB_old[( RAYPACKET_DIM - 1 )]; - for( unsigned int y = 0; y < (RAYPACKET_DIM - 1); ++y ) + for( unsigned int y = 0; y < ( RAYPACKET_DIM - 1 ); ++y ) { const SFVEC4F bgColorY = bgColor[y]; const COLOR_RGBA bgColorYRGB = COLOR_RGBA( bgColorY ); @@ -981,11 +984,12 @@ void RENDER_3D_RAYTRACE_BASE::renderPreview( uint8_t* ptrPBO ) hitInfoLRT.m_tHit = ( hitPacket[ iLT ].m_HitInfo.m_tHit + hitPacket[ iRT ].m_HitInfo.m_tHit ) * 0.5f; hitInfoLRT.m_HitNormal = - glm::normalize( ( hitPacket[ iLT ].m_HitInfo.m_HitNormal + - hitPacket[ iRT ].m_HitInfo.m_HitNormal ) * 0.5f ); + glm::normalize( ( hitPacket[iLT].m_HitInfo.m_HitNormal + + hitPacket[iRT].m_HitInfo.m_HitNormal ) + * 0.5f ); cLRT = COLOR_RGBA( shadeHit( bgColorY, rayLRT, hitInfoLRT, false, - 0, false ) ); + 0, false ) ); cLRT = BlendColor( cLRT, BlendColor( cLT, cRT ) ); } else @@ -1017,8 +1021,8 @@ void RENDER_3D_RAYTRACE_BASE::renderPreview( uint8_t* ptrPBO ) if( m_accelerator->Intersect( rayLRT,hitInfoLRT ) ) cLRT = COLOR_RGBA( shadeHit( bgColorY, rayLRT, - hitInfoLRT, false, - 0, false ) ); + hitInfoLRT, false, + 0, false ) ); } } } @@ -1039,7 +1043,7 @@ void RENDER_3D_RAYTRACE_BASE::renderPreview( uint8_t* ptrPBO ) // Trace the center ray RAY rayLTB; rayLTB.Init( ( oriLT + oriLB ) * 0.5f, - glm::normalize( ( dirLT + dirLB ) * 0.5f ) ); + glm::normalize( ( dirLT + dirLB ) * 0.5f ) ); HITINFO hitInfoLTB; hitInfoLTB.m_tHit = std::numeric_limits<float>::infinity(); @@ -1052,10 +1056,11 @@ void RENDER_3D_RAYTRACE_BASE::renderPreview( uint8_t* ptrPBO ) hitInfoLTB.m_tHit = ( hitPacket[ iLT ].m_HitInfo.m_tHit + hitPacket[ iLB ].m_HitInfo.m_tHit ) * 0.5f; hitInfoLTB.m_HitNormal = - glm::normalize( ( hitPacket[ iLT ].m_HitInfo.m_HitNormal + - hitPacket[ iLB ].m_HitInfo.m_HitNormal ) * 0.5f ); - cLTB = COLOR_RGBA( shadeHit( bgColorY, rayLTB, hitInfoLTB, false, - 0, false ) ); + glm::normalize( ( hitPacket[iLT].m_HitInfo.m_HitNormal + + hitPacket[iLB].m_HitInfo.m_HitNormal ) + * 0.5f ); + cLTB = COLOR_RGBA( + shadeHit( bgColorY, rayLTB, hitInfoLTB, false, 0, false ) ); cLTB = BlendColor( cLTB, BlendColor( cLT, cLB) ); } else @@ -1080,15 +1085,15 @@ void RENDER_3D_RAYTRACE_BASE::renderPreview( uint8_t* ptrPBO ) if( hittedLTB ) cLTB = COLOR_RGBA( shadeHit( bgColorY, rayLTB, hitInfoLTB, - false, 0, false ) ); + false, 0, false ) ); else { hitInfoLTB.m_tHit = std::numeric_limits<float>::infinity(); if( m_accelerator->Intersect( rayLTB, hitInfoLTB ) ) cLTB = COLOR_RGBA( shadeHit( bgColorY, rayLTB, - hitInfoLTB, false, - 0, false ) ); + hitInfoLTB, false, + 0, false ) ); } } } @@ -1119,11 +1124,12 @@ void RENDER_3D_RAYTRACE_BASE::renderPreview( uint8_t* ptrPBO ) hitPacket[ iRB ].m_HitInfo.m_tHit ) * 0.5f; hitInfoRTB.m_HitNormal = - glm::normalize( ( hitPacket[ iRT ].m_HitInfo.m_HitNormal + - hitPacket[ iRB ].m_HitInfo.m_HitNormal ) * 0.5f ); + glm::normalize( ( hitPacket[iRT].m_HitInfo.m_HitNormal + + hitPacket[iRB].m_HitInfo.m_HitNormal ) + * 0.5f ); cRTB = COLOR_RGBA( shadeHit( bgColorY, rayRTB, hitInfoRTB, false, 0, - false ) ); + false ) ); cRTB = BlendColor( cRTB, BlendColor( cRT, cRB ) ); } else @@ -1149,7 +1155,7 @@ void RENDER_3D_RAYTRACE_BASE::renderPreview( uint8_t* ptrPBO ) if( hittedRTB ) { cRTB = COLOR_RGBA( shadeHit( bgColorY, rayRTB, hitInfoRTB, - false, 0, false) ); + false, 0, false) ); } else { @@ -1157,7 +1163,7 @@ void RENDER_3D_RAYTRACE_BASE::renderPreview( uint8_t* ptrPBO ) if( m_accelerator->Intersect( rayRTB, hitInfoRTB ) ) cRTB = COLOR_RGBA( shadeHit( bgColorY, rayRTB, hitInfoRTB, - false, 0, false ) ); + false, 0, false ) ); } } } @@ -1188,11 +1194,12 @@ void RENDER_3D_RAYTRACE_BASE::renderPreview( uint8_t* ptrPBO ) hitPacket[ iRB ].m_HitInfo.m_tHit ) * 0.5f; hitInfoLRB.m_HitNormal = - glm::normalize( ( hitPacket[ iLB ].m_HitInfo.m_HitNormal + - hitPacket[ iRB ].m_HitInfo.m_HitNormal ) * 0.5f ); + glm::normalize( ( hitPacket[iLB].m_HitInfo.m_HitNormal + + hitPacket[iRB].m_HitInfo.m_HitNormal ) + * 0.5f ); cLRB = COLOR_RGBA( shadeHit( bgColorY, rayLRB, hitInfoLRB, false, 0, - false ) ); + false ) ); cLRB = BlendColor( cLRB, BlendColor( cLB, cRB ) ); } else @@ -1218,7 +1225,7 @@ void RENDER_3D_RAYTRACE_BASE::renderPreview( uint8_t* ptrPBO ) if( hittedLRB ) { cLRB = COLOR_RGBA( shadeHit( bgColorY, rayLRB, hitInfoLRB, - false, 0, false ) ); + false, 0, false ) ); } else { @@ -1226,7 +1233,7 @@ void RENDER_3D_RAYTRACE_BASE::renderPreview( uint8_t* ptrPBO ) if( m_accelerator->Intersect( rayLRB, hitInfoLRB ) ) cLRB = COLOR_RGBA( shadeHit( bgColorY, rayLRB, hitInfoLRB, - false, 0, false ) ); + false, 0, false ) ); } } } @@ -1257,7 +1264,7 @@ void RENDER_3D_RAYTRACE_BASE::renderPreview( uint8_t* ptrPBO ) if( hitted ) cLTC = COLOR_RGBA( shadeHit( bgColorY, rayLTC, hitInfoLTC, false, - 0, false ) ); + 0, false ) ); } // Trace and shade cRTC @@ -1278,12 +1285,12 @@ void RENDER_3D_RAYTRACE_BASE::renderPreview( uint8_t* ptrPBO ) if( hittedC ) hitted = centerHitInfo.pHitObject->Intersect( rayRTC, hitInfoRTC ); else if( hitPacket[ iRT ].m_hitresult ) - hitted = hitPacket[ iRT ].m_HitInfo.pHitObject->Intersect( rayRTC, - hitInfoRTC ); + hitted = hitPacket[iRT].m_HitInfo.pHitObject->Intersect( + rayRTC, hitInfoRTC ); if( hitted ) cRTC = COLOR_RGBA( shadeHit( bgColorY, rayRTC, hitInfoRTC, false, - 0, false ) ); + 0, false ) ); } // Trace and shade cLBC @@ -1304,12 +1311,12 @@ void RENDER_3D_RAYTRACE_BASE::renderPreview( uint8_t* ptrPBO ) if( hittedC ) hitted = centerHitInfo.pHitObject->Intersect( rayLBC, hitInfoLBC ); else if( hitPacket[ iLB ].m_hitresult ) - hitted = hitPacket[ iLB ].m_HitInfo.pHitObject->Intersect( rayLBC, - hitInfoLBC ); + hitted = hitPacket[iLB].m_HitInfo.pHitObject->Intersect( + rayLBC, hitInfoLBC ); if( hitted ) cLBC = COLOR_RGBA( shadeHit( bgColorY, rayLBC, hitInfoLBC, false, - 0, false ) ); + 0, false ) ); } // Trace and shade cRBC @@ -1330,12 +1337,12 @@ void RENDER_3D_RAYTRACE_BASE::renderPreview( uint8_t* ptrPBO ) if( hittedC ) hitted = centerHitInfo.pHitObject->Intersect( rayRBC, hitInfoRBC ); else if( hitPacket[ iRB ].m_hitresult ) - hitted = hitPacket[ iRB ].m_HitInfo.pHitObject->Intersect( rayRBC, - hitInfoRBC ); + hitted = hitPacket[iRB].m_HitInfo.pHitObject->Intersect( + rayRBC, hitInfoRBC ); if( hitted ) cRBC = COLOR_RGBA( shadeHit( bgColorY, rayRBC, hitInfoRBC, false, - 0, false ) ); + 0, false ) ); } // Set pixel colors @@ -1382,9 +1389,9 @@ void RENDER_3D_RAYTRACE_BASE::renderPreview( uint8_t* ptrPBO ) #define USE_EXPERIMENTAL_SOFT_SHADOWS 1 -SFVEC4F RENDER_3D_RAYTRACE_BASE::shadeHit( const SFVEC4F& aBgColor, const RAY& aRay, HITINFO& aHitInfo, - bool aIsInsideObject, unsigned int aRecursiveLevel, - bool is_testShadow ) const +SFVEC4F RENDER_3D_RAYTRACE_BASE::shadeHit( const SFVEC4F& aBgColor, const RAY& aRay, + HITINFO& aHitInfo, bool aIsInsideObject, + unsigned int aRecursiveLevel, bool is_testShadow ) const { const MATERIAL* objMaterial = aHitInfo.pHitObject->GetMaterial(); wxASSERT( objMaterial != nullptr ); @@ -1536,9 +1543,10 @@ SFVEC4F RENDER_3D_RAYTRACE_BASE::shadeHit( const SFVEC4F& aBgColor, const RAY& a { // Apply some randomize to the reflected vector const SFVEC3F random_reflectVector = - glm::normalize( reflectVector + - UniformRandomHemisphereDirection() * - m_boardAdapter.m_Cfg->m_Render.raytrace_spread_reflections ); + glm::normalize( reflectVector + + UniformRandomHemisphereDirection() + * m_boardAdapter.m_Cfg->m_Render + .raytrace_spread_reflections ); reflectedRay.Init( hitPoint, random_reflectVector ); } @@ -1548,13 +1556,14 @@ SFVEC4F RENDER_3D_RAYTRACE_BASE::shadeHit( const SFVEC4F& aBgColor, const RAY& a if( m_accelerator->Intersect( reflectedRay, reflectedHit ) ) { - SFVEC4F add = ( diffuseColorObj + SFVEC4F( objMaterial->GetSpecularColor(), 1.0f ) ) * - shadeHit( aBgColor, reflectedRay, reflectedHit, false, - aRecursiveLevel + 1, is_testShadow ) * - SFVEC4F( objMaterial->GetReflection() * - // Falloff factor - (1.0f / ( 1.0f + 0.75f * reflectedHit.m_tHit * - reflectedHit.m_tHit) ) ); + SFVEC4F add = ( diffuseColorObj + SFVEC4F( objMaterial->GetSpecularColor(), + 1.0f ) ) * + shadeHit( aBgColor, reflectedRay, reflectedHit, false, + aRecursiveLevel + 1, is_testShadow ) * + SFVEC4F( objMaterial->GetReflection() * + // Falloff factor + (1.0f / ( 1.0f + 0.75f * reflectedHit.m_tHit * + reflectedHit.m_tHit) ) ); sum_color += add; } diff --git a/3d-viewer/3d_rendering/raytracing/render_3d_raytrace_base.h b/3d-viewer/3d_rendering/raytracing/render_3d_raytrace_base.h index 4d4a2d6912..9034b9ce47 100644 --- a/3d-viewer/3d_rendering/raytracing/render_3d_raytrace_base.h +++ b/3d-viewer/3d_rendering/raytracing/render_3d_raytrace_base.h @@ -35,10 +35,10 @@ #include <map> -/// Vector of materials +/// Vector of materials. typedef std::vector< BLINN_PHONG_MATERIAL > MODEL_MATERIALS; -/// Maps a S3DMODEL pointer with a created BLINN_PHONG_MATERIAL vector +/// Maps a #S3DMODEL pointer with a created BLINN_PHONG_MATERIAL vector. typedef std::map< const S3DMODEL* , MODEL_MATERIALS > MAP_MODEL_MATERIALS; typedef enum @@ -167,7 +167,7 @@ protected: CONTAINER_3D m_objectContainer; - ///< Store the list of created objects special for RT that will be clear in the end. + /// Store the list of created objects special for RT that will be clear in the end. CONTAINER_2D m_containerWithObjectsToDelete; CONTAINER_2D* m_outlineBoard2dObjects; @@ -178,16 +178,16 @@ protected: SFVEC4F m_backgroundColorTop; SFVEC4F m_backgroundColorBottom; - ///< Used to see if the windows size changed. + /// Used to see if the windows size changed. wxSize m_oldWindowsSize; - ///< Encode Morton code positions. + /// Encode Morton code positions. std::vector< SFVEC2UI > m_blockPositions; - ///< Flag if a position was already processed (cleared each new render). + /// Flag if a position was already processed (cleared each new render). std::vector< int > m_blockPositionsWasProcessed; - ///< Encode the Morton code positions (on fast preview mode). + /// Encode the Morton code positions (on fast preview mode). std::vector< SFVEC2UI > m_blockPositionsFast; SFVEC2UI m_realBufferSize; diff --git a/3d-viewer/3d_rendering/raytracing/render_3d_raytrace_gl.cpp b/3d-viewer/3d_rendering/raytracing/render_3d_raytrace_gl.cpp index c8dac8e815..73a626d088 100644 --- a/3d-viewer/3d_rendering/raytracing/render_3d_raytrace_gl.cpp +++ b/3d-viewer/3d_rendering/raytracing/render_3d_raytrace_gl.cpp @@ -36,7 +36,8 @@ #include <wx/log.h> -RENDER_3D_RAYTRACE_GL::RENDER_3D_RAYTRACE_GL( EDA_3D_CANVAS* aCanvas, BOARD_ADAPTER& aAdapter, CAMERA& aCamera ) : +RENDER_3D_RAYTRACE_GL::RENDER_3D_RAYTRACE_GL( EDA_3D_CANVAS* aCanvas, BOARD_ADAPTER& aAdapter, + CAMERA& aCamera ) : RENDER_3D_RAYTRACE_BASE( aAdapter, aCamera ) { wxLogTrace( m_logTrace, wxT( "RENDER_3D_RAYTRACE_GL::RENDER_3D_RAYTRACE_GL" ) ); @@ -79,7 +80,7 @@ void RENDER_3D_RAYTRACE_GL::SetCurWindowSize( const wxSize& aSize ) bool RENDER_3D_RAYTRACE_GL::Redraw( bool aIsMoving, REPORTER* aStatusReporter, - REPORTER* aWarningReporter ) + REPORTER* aWarningReporter ) { bool requestRedraw = false; diff --git a/3d-viewer/3d_rendering/raytracing/shapes2D/bbox_2d.cpp b/3d-viewer/3d_rendering/raytracing/shapes2D/bbox_2d.cpp index 411767f453..c3444c07ec 100644 --- a/3d-viewer/3d_rendering/raytracing/shapes2D/bbox_2d.cpp +++ b/3d-viewer/3d_rendering/raytracing/shapes2D/bbox_2d.cpp @@ -268,20 +268,20 @@ bool BBOX_2D::Intersect( const RAY2D& aRay, float* t ) const else *t = tmax; - return (tmax >= 0.0f) && (tmax >= tmin); + return ( tmax >= 0.0f ) && ( tmax >= tmin ); } bool BBOX_2D::Intersect( const RAYSEG2D& aRaySeg ) const { - const float tx1 = (m_min.x - aRaySeg.m_Start.x) * aRaySeg.m_InvDir.x; - const float tx2 = (m_max.x - aRaySeg.m_Start.x) * aRaySeg.m_InvDir.x; + const float tx1 = ( m_min.x - aRaySeg.m_Start.x ) * aRaySeg.m_InvDir.x; + const float tx2 = ( m_max.x - aRaySeg.m_Start.x ) * aRaySeg.m_InvDir.x; float tmin = glm::min( tx1, tx2 ); float tmax = glm::max( tx1, tx2 ); - const float ty1 = (m_min.y - aRaySeg.m_Start.y) * aRaySeg.m_InvDir.y; - const float ty2 = (m_max.y - aRaySeg.m_Start.y) * aRaySeg.m_InvDir.y; + const float ty1 = ( m_min.y - aRaySeg.m_Start.y ) * aRaySeg.m_InvDir.y; + const float ty2 = ( m_max.y - aRaySeg.m_Start.y ) * aRaySeg.m_InvDir.y; tmin = glm::max( tmin, glm::min( ty1, ty2 ) ); tmax = glm::min( tmax, glm::max( ty1, ty2 ) ); diff --git a/3d-viewer/3d_rendering/raytracing/shapes3D/bbox_3d.cpp b/3d-viewer/3d_rendering/raytracing/shapes3D/bbox_3d.cpp index 90b9d12cf2..4b8e01ddad 100644 --- a/3d-viewer/3d_rendering/raytracing/shapes3D/bbox_3d.cpp +++ b/3d-viewer/3d_rendering/raytracing/shapes3D/bbox_3d.cpp @@ -291,10 +291,10 @@ bool BBOX_3D::Intersect( const RAY& aRay, float* aOutHitt0, float* aOutHitt1 ) c if( ( tmin > tzmax ) || ( tzmin > tmax ) ) return false; - tmin = (tzmin > tmin)? tzmin : tmin; - tmin = ( tmin < 0.0f)? 0.0f : tmin; + tmin = ( tzmin > tmin ) ? tzmin : tmin; + tmin = ( tmin < 0.0f ) ? 0.0f : tmin; - tmax = (tzmax < tmax)? tzmax : tmax; + tmax = ( tzmax < tmax ) ? tzmax : tmax; *aOutHitt0 = tmin; *aOutHitt1 = tmax; diff --git a/3d-viewer/3d_rendering/raytracing/shapes3D/layer_item_3d.cpp b/3d-viewer/3d_rendering/raytracing/shapes3D/layer_item_3d.cpp index 0de71c554a..b3c2484919 100644 --- a/3d-viewer/3d_rendering/raytracing/shapes3D/layer_item_3d.cpp +++ b/3d-viewer/3d_rendering/raytracing/shapes3D/layer_item_3d.cpp @@ -255,12 +255,15 @@ bool LAYER_ITEM::Intersect( const RAY& aRay, HITINFO& aHitInfo ) const } // For items that are > than g_BevelThickness3DU - // (eg on board vias / plated holeS) use a factor based on m_bbox.GetExtent().z - const float bevelThickness = glm::max( g_BevelThickness3DU, - m_bbox.GetExtent().z * - (float)ADVANCED_CFG::GetCfg().m_3DRT_BevelExtentFactor ); + // (eg on board vias / plated holeS) use a factor based on + // m_bbox.GetExtent().z + const float bevelThickness = glm::max( + g_BevelThickness3DU, + m_bbox.GetExtent().z + * (float) ADVANCED_CFG::GetCfg().m_3DRT_BevelExtentFactor ); - if( ( zDistanceToTopOrBot > 0.0f ) && ( zDistanceToTopOrBot < bevelThickness ) ) + if( ( zDistanceToTopOrBot > 0.0f ) + && ( zDistanceToTopOrBot < bevelThickness ) ) { // Invert and Normalize the distance 0..1 zBend = ( bevelThickness - zDistanceToTopOrBot ) / bevelThickness; @@ -304,8 +307,8 @@ bool LAYER_ITEM::Intersect( const RAY& aRay, HITINFO& aHitInfo ) const SFVEC2F outNormal; RAYSEG2D raySeg( boxHitPointStart2D, boxHitPointEnd2D ); - if( ( m_object2d->IsPointInside( boxHitPointStart2D ) && - m_object2d->IsPointInside( boxHitPointEnd2D ) ) ) + if( ( m_object2d->IsPointInside( boxHitPointStart2D ) + && m_object2d->IsPointInside( boxHitPointEnd2D ) ) ) { if( tBBoxEnd < aHitInfo.m_tHit ) { diff --git a/3d-viewer/3d_rendering/raytracing/shapes3D/round_segment_3d.cpp b/3d-viewer/3d_rendering/raytracing/shapes3D/round_segment_3d.cpp index e82d974a89..3b9f8c4908 100644 --- a/3d-viewer/3d_rendering/raytracing/shapes3D/round_segment_3d.cpp +++ b/3d-viewer/3d_rendering/raytracing/shapes3D/round_segment_3d.cpp @@ -358,12 +358,12 @@ bool ROUND_SEGMENT::IntersectP( const RAY& aRay, float aMaxDistance ) const double c_Start = p_dot_p_Start - m_radius_squared; - float delta_Start = (float)(b_Start * b_Start - a * c_Start); + float delta_Start = (float)( b_Start * b_Start - a * c_Start ); if( delta_Start > FLT_EPSILON ) { float sdelta = sqrtf( delta_Start ); - float t = (-b_Start - sdelta) / a; + float t = ( -b_Start - sdelta ) / a; float z = aRay.m_Origin.z + t * aRay.m_Dir.z; if( ( z >= m_bbox.Min().z ) && ( z <= m_bbox.Max().z ) ) diff --git a/3d-viewer/3d_rendering/raytracing/shapes3D/triangle_3d.cpp b/3d-viewer/3d_rendering/raytracing/shapes3D/triangle_3d.cpp index 286d56e87d..66bb8457af 100644 --- a/3d-viewer/3d_rendering/raytracing/shapes3D/triangle_3d.cpp +++ b/3d-viewer/3d_rendering/raytracing/shapes3D/triangle_3d.cpp @@ -74,7 +74,7 @@ void TRIANGLE::pre_calc_const() m_nd = glm::dot( m_n, A ) * krec; // first line equation - float reci = 1.0f / (b[u] * c[v] - b[v] * c[u]); + float reci = 1.0f / ( b[u] * c[v] - b[v] * c[u] ); m_bnu = b[u] * reci; m_bnv = -b[v] * reci; @@ -209,7 +209,7 @@ bool TRIANGLE::Intersect( const RAY& aRay, HITINFO& aHitInfo ) const const SFVEC3F& D = aRay.m_Dir; const SFVEC3F& A = m_vertex[0]; - const float lnd = 1.0f / (D[m_k] + m_nu * D[ku] + m_nv * D[kv]); + const float lnd = 1.0f / ( D[m_k] + m_nu * D[ku] + m_nv * D[kv] ); const float t = ( m_nd - O[m_k] - m_nu * O[ku] - m_nv * O[kv] ) * lnd; if( !( ( aHitInfo.m_tHit > t ) && ( t > 0.0f ) ) ) @@ -230,7 +230,7 @@ bool TRIANGLE::Intersect( const RAY& aRay, HITINFO& aHitInfo ) const const float v = gamma; const float u = beta; - if( (u + v) > 1.0f ) + if( ( u + v ) > 1.0f ) return false; if( glm::dot( D, m_n ) > 0.0f ) @@ -263,7 +263,7 @@ bool TRIANGLE::IntersectP( const RAY& aRay, float aMaxDistance ) const const SFVEC3F D = aRay.m_Dir; const SFVEC3F A = m_vertex[0]; - const float lnd = 1.0f / (D[m_k] + m_nu * D[ku] + m_nv * D[kv]); + const float lnd = 1.0f / ( D[m_k] + m_nu * D[ku] + m_nv * D[kv] ); const float t = ( m_nd - O[m_k] - m_nu * O[ku] - m_nv * O[kv] ) * lnd; if( !( ( aMaxDistance > t ) && ( t > 0.0f ) ) ) @@ -284,7 +284,7 @@ bool TRIANGLE::IntersectP( const RAY& aRay, float aMaxDistance ) const const float v = gamma; const float u = beta; - if( (u + v) > 1.0f ) + if( ( u + v ) > 1.0f ) return false; if( glm::dot( D, m_n ) > 0.0f ) diff --git a/3d-viewer/3d_rendering/render_3d_base.h b/3d-viewer/3d_rendering/render_3d_base.h index 68cc8c2f93..eb6cd89de8 100644 --- a/3d-viewer/3d_rendering/render_3d_base.h +++ b/3d-viewer/3d_rendering/render_3d_base.h @@ -98,18 +98,18 @@ protected: */ std::unique_ptr<BUSY_INDICATOR> CreateBusyIndicator() const; - ///< Settings reference in use for this render. + /// Settings reference in use for this render. BOARD_ADAPTER& m_boardAdapter; CAMERA& m_camera; - ///< Flag if the canvas specific for this render was already initialized. + /// Flag if the canvas specific for this render was already initialized. bool m_canvasInitialized; - ///< @todo This must be reviewed in order to flag change types. + /// @todo This must be reviewed in order to flag change types. bool m_reloadRequested; - ///< The window size that this camera is working. + /// The window size that this camera is working. wxSize m_windowSize; /** @@ -121,7 +121,7 @@ protected: static const wxChar* m_logTrace; private: - ///< Factory that returns a suitable busy indicator for the context. + /// Factory that returns a suitable busy indicator for the context. BUSY_INDICATOR::FACTORY m_busyIndicatorFactory; }; diff --git a/3d-viewer/3d_rendering/trackball.cpp b/3d-viewer/3d_rendering/trackball.cpp index 2a076dd501..1498da6126 100644 --- a/3d-viewer/3d_rendering/trackball.cpp +++ b/3d-viewer/3d_rendering/trackball.cpp @@ -72,6 +72,7 @@ static double tb_project_to_sphere( double, double, double ); static void normalize_quat( double [4] ); + void vzero( double *v ) { v[0] = 0.0; @@ -79,6 +80,7 @@ void vzero( double *v ) v[2] = 0.0; } + void vset( double *v, double x, double y, double z ) { v[0] = x; @@ -86,6 +88,7 @@ void vset( double *v, double x, double y, double z ) v[2] = z; } + void vsub( const double *src1, const double *src2, double *dst ) { dst[0] = src1[0] - src2[0]; @@ -93,6 +96,7 @@ void vsub( const double *src1, const double *src2, double *dst ) dst[2] = src1[2] - src2[2]; } + void vcopy( const double *v1, double *v2 ) { int i; @@ -101,6 +105,7 @@ void vcopy( const double *v1, double *v2 ) v2[i] = v1[i]; } + void vcross( const double *v1, const double *v2, double *cross ) { double temp[3]; @@ -111,11 +116,13 @@ void vcross( const double *v1, const double *v2, double *cross ) vcopy(temp, cross); } + double vlength( const double *v ) { return (double) sqrt( v[0] * v[0] + v[1] * v[1] + v[2] * v[2] ); } + void vscale( double *v, double div ) { v[0] *= div; @@ -123,16 +130,19 @@ void vscale( double *v, double div ) v[2] *= div; } + void vnormal( double *v ) { vscale( v, 1.0f / vlength( v ) ); } + double vdot( const double *v1, const double *v2 ) { return v1[0]*v2[0] + v1[1]*v2[1] + v1[2]*v2[2]; } + void vadd( const double *src1, const double *src2, double *dst ) { dst[0] = src1[0] + src2[0]; @@ -140,6 +150,7 @@ void vadd( const double *src1, const double *src2, double *dst ) dst[2] = src1[2] + src2[2]; } + /* * Ok, simulate a track-ball. Project the points onto the virtual * trackball, then figure out the axis of rotation, which is the cross @@ -177,13 +188,13 @@ void trackball( double q[4], double p1x, double p1y, double p2x, double p2y ) /* * Now, we want the cross product of P1 and P2 */ - vcross(p2,p1,a); + vcross( p2, p1, a ); /* * Figure out how much to rotate around that axis. */ vsub( p1, p2, d ); - t = vlength( d ) / (2.0f * TRACKBALLSIZE); + t = vlength( d ) / ( 2.0f * TRACKBALLSIZE ); /* * Avoid problems with out-of-control values... @@ -199,6 +210,7 @@ void trackball( double q[4], double p1x, double p1y, double p2x, double p2y ) axis_to_quat( a, phi, q ); } + /* * Given an axis and angle, compute quaternion. */ @@ -210,6 +222,7 @@ void axis_to_quat( double a[3], double phi, double q[4] ) q[3] = (double) cos( phi / 2.0 ); } + /* * Project an x,y pair onto a sphere of radius r OR a hyperbolic sheet * if we are away from the center of the sphere. @@ -233,6 +246,7 @@ static double tb_project_to_sphere( double r, double x, double y ) return z; } + /* * Given two rotations, e1 and e2, expressed as quaternion rotations, * figure out the equivalent single rotation and stuff it into dest. @@ -248,7 +262,7 @@ static double tb_project_to_sphere( double r, double x, double y ) void add_quats( double q1[4], double q2[4], double dest[4] ) { - static int count=0; + static int count = 0; double t1[4], t2[4], t3[4]; double tf[4]; @@ -276,6 +290,7 @@ void add_quats( double q1[4], double q2[4], double dest[4] ) } } + /* * Quaternions always obey: a^2 + b^2 + c^2 + d^2 = 1.0 * If they don't add up to 1.0, dividing by their magnitued will @@ -293,31 +308,31 @@ static void normalize_quat( double q[4] ) int i; double mag; - mag = (q[0]*q[0] + q[1]*q[1] + q[2]*q[2] + q[3]*q[3]); + mag = ( q[0] * q[0] + q[1] * q[1] + q[2] * q[2] + q[3] * q[3] ); for( i = 0; i < 4; i++ ) q[i] /= mag; } + /* * Build a rotation matrix, given a quaternion rotation. - * */ void build_rotmatrix( float m[4][4], double q[4] ) { - m[0][0] = (float)(1.0 - 2.0 * (q[1] * q[1] + q[2] * q[2])); - m[0][1] = (float)(2.0 * (q[0] * q[1] - q[2] * q[3])); - m[0][2] = (float)(2.0 * (q[2] * q[0] + q[1] * q[3])); + m[0][0] = (float) ( 1.0 - 2.0 * ( q[1] * q[1] + q[2] * q[2] ) ); + m[0][1] = (float) ( 2.0 * ( q[0] * q[1] - q[2] * q[3] ) ); + m[0][2] = (float) ( 2.0 * ( q[2] * q[0] + q[1] * q[3] ) ); m[0][3] = 0.0f; - m[1][0] = (float)(2.0 * (q[0] * q[1] + q[2] * q[3])); - m[1][1] = (float)(1.0 - 2.0f * (q[2] * q[2] + q[0] * q[0])); - m[1][2] = (float)(2.0 * (q[1] * q[2] - q[0] * q[3])); + m[1][0] = (float) ( 2.0 * ( q[0] * q[1] + q[2] * q[3] ) ); + m[1][1] = (float) ( 1.0 - 2.0f * ( q[2] * q[2] + q[0] * q[0] ) ); + m[1][2] = (float) ( 2.0 * ( q[1] * q[2] - q[0] * q[3] ) ); m[1][3] = 0.0f; - m[2][0] = (float)(2.0 * (q[2] * q[0] - q[1] * q[3])); - m[2][1] = (float)(2.0 * (q[1] * q[2] + q[0] * q[3])); - m[2][2] = (float)(1.0 - 2.0 * (q[1] * q[1] + q[0] * q[0])); + m[2][0] = (float) ( 2.0 * ( q[2] * q[0] - q[1] * q[3] ) ); + m[2][1] = (float) ( 2.0 * ( q[1] * q[2] + q[0] * q[3] ) ); + m[2][2] = (float) ( 1.0 - 2.0 * ( q[1] * q[1] + q[0] * q[0] ) ); m[2][3] = 0.0f; m[3][0] = 0.0f; diff --git a/3d-viewer/3d_viewer/3d_toolbar.cpp b/3d-viewer/3d_viewer/3d_toolbar.cpp index 7719c0077e..a09c18d800 100644 --- a/3d-viewer/3d_viewer/3d_toolbar.cpp +++ b/3d-viewer/3d_viewer/3d_toolbar.cpp @@ -48,7 +48,8 @@ void EDA_3D_VIEWER_FRAME::ReCreateMainToolbar() else { m_mainToolBar = new ACTION_TOOLBAR( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize, - KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT | wxAUI_TB_HORIZONTAL ); + KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT | + wxAUI_TB_HORIZONTAL ); m_mainToolBar->SetAuiManager( &m_auimgr ); } diff --git a/3d-viewer/3d_viewer/eda_3d_viewer_frame.cpp b/3d-viewer/3d_viewer/eda_3d_viewer_frame.cpp index 3395446bd9..c963be03b7 100644 --- a/3d-viewer/3d_viewer/eda_3d_viewer_frame.cpp +++ b/3d-viewer/3d_viewer/eda_3d_viewer_frame.cpp @@ -272,25 +272,27 @@ void EDA_3D_VIEWER_FRAME::setupUIConditions() return m_boardAdapter.m_Cfg->m_AuiPanels.show_layer_manager; }; - RegisterUIUpdateHandler( ID_RENDER_CURRENT_VIEW, ACTION_CONDITIONS().Check( raytracing ) ); + RegisterUIUpdateHandler( ID_RENDER_CURRENT_VIEW, ACTION_CONDITIONS().Check( raytracing ) ); - mgr->SetConditions( EDA_3D_ACTIONS::showTHT, ACTION_CONDITIONS().Check( showTH ) ); - mgr->SetConditions( EDA_3D_ACTIONS::showSMD, ACTION_CONDITIONS().Check( showSMD ) ); - mgr->SetConditions( EDA_3D_ACTIONS::showVirtual, ACTION_CONDITIONS().Check( showVirtual ) ); - mgr->SetConditions( EDA_3D_ACTIONS::showNotInPosFile, ACTION_CONDITIONS().Check( show_NotInPosfile ) ); - mgr->SetConditions( EDA_3D_ACTIONS::showDNP, ACTION_CONDITIONS().Check( show_DNP ) ); + mgr->SetConditions( EDA_3D_ACTIONS::showTHT, ACTION_CONDITIONS().Check( showTH ) ); + mgr->SetConditions( EDA_3D_ACTIONS::showSMD, ACTION_CONDITIONS().Check( showSMD ) ); + mgr->SetConditions( EDA_3D_ACTIONS::showVirtual, ACTION_CONDITIONS().Check( showVirtual ) ); + mgr->SetConditions( EDA_3D_ACTIONS::showNotInPosFile, + ACTION_CONDITIONS().Check( show_NotInPosfile ) ); + mgr->SetConditions( EDA_3D_ACTIONS::showDNP, ACTION_CONDITIONS().Check( show_DNP ) ); - mgr->SetConditions( EDA_3D_ACTIONS::showBBoxes, ACTION_CONDITIONS().Check( showBBoxes ) ); - mgr->SetConditions( EDA_3D_ACTIONS::showAxis, ACTION_CONDITIONS().Check( showAxes ) ); + mgr->SetConditions( EDA_3D_ACTIONS::showBBoxes, ACTION_CONDITIONS().Check( showBBoxes ) ); + mgr->SetConditions( EDA_3D_ACTIONS::showAxis, ACTION_CONDITIONS().Check( showAxes ) ); - mgr->SetConditions( EDA_3D_ACTIONS::noGrid, GridSizeCheck( GRID3D_TYPE::NONE ) ); - mgr->SetConditions( EDA_3D_ACTIONS::show10mmGrid, GridSizeCheck( GRID3D_TYPE::GRID_10MM ) ); - mgr->SetConditions( EDA_3D_ACTIONS::show5mmGrid, GridSizeCheck( GRID3D_TYPE::GRID_5MM ) ); - mgr->SetConditions( EDA_3D_ACTIONS::show2_5mmGrid, GridSizeCheck( GRID3D_TYPE::GRID_2P5MM ) ); - mgr->SetConditions( EDA_3D_ACTIONS::show1mmGrid, GridSizeCheck( GRID3D_TYPE::GRID_1MM ) ); - mgr->SetConditions( EDA_3D_ACTIONS::toggleOrtho, ACTION_CONDITIONS().Check( ortho ) ); + mgr->SetConditions( EDA_3D_ACTIONS::noGrid, GridSizeCheck( GRID3D_TYPE::NONE ) ); + mgr->SetConditions( EDA_3D_ACTIONS::show10mmGrid, GridSizeCheck( GRID3D_TYPE::GRID_10MM ) ); + mgr->SetConditions( EDA_3D_ACTIONS::show5mmGrid, GridSizeCheck( GRID3D_TYPE::GRID_5MM ) ); + mgr->SetConditions( EDA_3D_ACTIONS::show2_5mmGrid, GridSizeCheck( GRID3D_TYPE::GRID_2P5MM ) ); + mgr->SetConditions( EDA_3D_ACTIONS::show1mmGrid, GridSizeCheck( GRID3D_TYPE::GRID_1MM ) ); + mgr->SetConditions( EDA_3D_ACTIONS::toggleOrtho, ACTION_CONDITIONS().Check( ortho ) ); - mgr->SetConditions( EDA_3D_ACTIONS::showLayersManager, ACTION_CONDITIONS().Check( appearances ) ); + mgr->SetConditions( EDA_3D_ACTIONS::showLayersManager, + ACTION_CONDITIONS().Check( appearances ) ); #undef GridSizeCheck } @@ -643,7 +645,8 @@ void EDA_3D_VIEWER_FRAME::CommonSettingsChanged( bool aEnvVarsChanged, bool aTex ReCreateMainToolbar(); loadCommonSettings(); - applySettings( Pgm().GetSettingsManager().GetAppSettings<EDA_3D_VIEWER_SETTINGS>( "3d_viewer" ) ); + applySettings( + Pgm().GetSettingsManager().GetAppSettings<EDA_3D_VIEWER_SETTINGS>( "3d_viewer" ) ); m_appearancePanel->CommonSettingsChanged(); @@ -710,7 +713,8 @@ void EDA_3D_VIEWER_FRAME::takeScreenshot( wxCommandEvent& event ) if( event.GetId() != ID_TOOL_SCREENCOPY_TOCLIBBOARD ) { // Remember path between saves during this session only. - const wxString wildcard = fmt_is_jpeg ? FILEEXT::JpegFileWildcard() : FILEEXT::PngFileWildcard(); + const wxString wildcard = + fmt_is_jpeg ? FILEEXT::JpegFileWildcard() : FILEEXT::PngFileWildcard(); const wxString ext = fmt_is_jpeg ? FILEEXT::JpegFileExtension : FILEEXT::PngFileExtension; // First time path is set to the project path. diff --git a/3d-viewer/3d_viewer/eda_3d_viewer_settings.cpp b/3d-viewer/3d_viewer/eda_3d_viewer_settings.cpp index c869754ed4..d6cdfc4129 100644 --- a/3d-viewer/3d_viewer/eda_3d_viewer_settings.cpp +++ b/3d-viewer/3d_viewer/eda_3d_viewer_settings.cpp @@ -469,12 +469,15 @@ bool EDA_3D_VIEWER_SETTINGS::MigrateFromLegacy( wxConfigBase* aCfg ) ret &= fromLegacy<int>( aCfg, "RenderEngine", "render.engine" ); ret &= fromLegacy<int>( aCfg, "ShowGrid3D", "render.grid_type" ); ret &= fromLegacy<int>( aCfg, "Render_Material", "render.material_mode" ); - ret &= fromLegacy<bool>( aCfg, "Render_OGL_ShowCopperThickness", "render.opengl_copper_thickness" ); - ret &= fromLegacy<bool>( aCfg, "Render_OGL_ShowModelBoudingBoxes", "render.opengl_show_model_bbox" ); + ret &= fromLegacy<bool>( aCfg, "Render_OGL_ShowCopperThickness", + "render.opengl_copper_thickness" ); + ret &= fromLegacy<bool>( aCfg, "Render_OGL_ShowModelBoudingBoxes", + "render.opengl_show_model_bbox" ); ret &= fromLegacy<bool>( aCfg, "Render_RAY_AntiAliasing", "render.raytrace_anti_aliasing" ); ret &= fromLegacy<bool>( aCfg, "Render_RAY_Backfloor", "render.raytrace_backfloor" ); ret &= fromLegacy<bool>( aCfg, "Render_RAY_PostProcess", "render.raytrace_post_processing" ); - ret &= fromLegacy<bool>( aCfg, "Render_RAY_ProceduralTextures", "render.raytrace_procedural_textures" ); + ret &= fromLegacy<bool>( aCfg, "Render_RAY_ProceduralTextures", + "render.raytrace_procedural_textures" ); ret &= fromLegacy<bool>( aCfg, "Render_RAY_Reflections", "render.raytrace_reflections" ); ret &= fromLegacy<bool>( aCfg, "Render_RAY_Refractions", "render.raytrace_refractions" ); ret &= fromLegacy<bool>( aCfg, "Render_RAY_Shadows", "render.raytrace_shadows" ); diff --git a/3d-viewer/3d_viewer/tools/eda_3d_conditions.h b/3d-viewer/3d_viewer/tools/eda_3d_conditions.h index 702564780e..2ce5cfadbd 100644 --- a/3d-viewer/3d_viewer/tools/eda_3d_conditions.h +++ b/3d-viewer/3d_viewer/tools/eda_3d_conditions.h @@ -54,11 +54,11 @@ public: SELECTION_CONDITION GridSize( GRID3D_TYPE aGridSize ); private: - ///< Helper function used by GridDize() + /// Helper function used by GridDize(). static bool gridSizeFunction( const SELECTION& aSelection, BOARD_ADAPTER* aAdapter, GRID3D_TYPE aGridSize ); - ///< The board adapter to read the 3D viewer state from + /// The board adapter to read the 3D viewer state from. BOARD_ADAPTER* m_adapter; }; diff --git a/3d-viewer/3d_viewer/tools/eda_3d_controller.cpp b/3d-viewer/3d_viewer/tools/eda_3d_controller.cpp index e027019d43..ecc76bea53 100644 --- a/3d-viewer/3d_viewer/tools/eda_3d_controller.cpp +++ b/3d-viewer/3d_viewer/tools/eda_3d_controller.cpp @@ -182,6 +182,7 @@ int EDA_3D_CONTROLLER::RotateView( const TOOL_EVENT& aEvent ) { case ROTATION_DIR::X_CW: m_camera->RotateX( -rotIncrement ); break; case ROTATION_DIR::X_CCW: m_camera->RotateX( rotIncrement ); break; + /// Y rotations are backward b/c the RHR has Y pointing into the screen case ROTATION_DIR::Y_CW: m_camera->RotateY( rotIncrement ); break; case ROTATION_DIR::Y_CCW: m_camera->RotateY( -rotIncrement ); break; @@ -234,7 +235,8 @@ int EDA_3D_CONTROLLER::ToggleVisibility( const TOOL_EVENT& aEvent ) auto flipLayer = [&]( int layer ) { - appearanceManager->OnLayerVisibilityChanged( layer, !visibilityFlags.test( layer ) ); + appearanceManager->OnLayerVisibilityChanged( layer, + !visibilityFlags.test( layer ) ); }; EDA_BASE_FRAME* frame = dynamic_cast<EDA_BASE_FRAME*>( m_toolMgr->GetToolHolder() ); @@ -311,7 +313,8 @@ int EDA_3D_CONTROLLER::doZoomInOut( bool aDirection, bool aCenterOnCursor ) { if( m_canvas ) { - m_canvas->SetView3D( aDirection ? VIEW3D_TYPE::VIEW3D_ZOOM_IN : VIEW3D_TYPE::VIEW3D_ZOOM_OUT ); + m_canvas->SetView3D( aDirection ? VIEW3D_TYPE::VIEW3D_ZOOM_IN + : VIEW3D_TYPE::VIEW3D_ZOOM_OUT ); m_canvas->DisplayStatus(); } diff --git a/3d-viewer/3d_viewer/tools/eda_3d_controller.h b/3d-viewer/3d_viewer/tools/eda_3d_controller.h index 7931313eba..4e793cdbb7 100644 --- a/3d-viewer/3d_viewer/tools/eda_3d_controller.h +++ b/3d-viewer/3d_viewer/tools/eda_3d_controller.h @@ -32,9 +32,7 @@ class BOARD_ADAPTER; /** - * EDA_3D_CONTROLLER - * - * Handles view actions for various 3D canvases. + * Handle view actions for various 3D canvases. */ class EDA_3D_CONTROLLER : public TOOL_INTERACTIVE @@ -99,7 +97,7 @@ public: int ToggleLayersManager( const TOOL_EVENT& aEvent ); private: - ///< Sets up handlers for various events. + /// Set up handlers for various events. void setTransitions() override; int doZoomInOut( bool aDirection, bool aCenterOnCursor ); diff --git a/3d-viewer/dialogs/appearance_controls_3D.cpp b/3d-viewer/dialogs/appearance_controls_3D.cpp index 7db808aaab..85159fa148 100644 --- a/3d-viewer/dialogs/appearance_controls_3D.cpp +++ b/3d-viewer/dialogs/appearance_controls_3D.cpp @@ -45,42 +45,46 @@ #include <../3d_rendering/opengl/render_3d_opengl.h> - -#define RR APPEARANCE_CONTROLS_3D::APPEARANCE_SETTING_3D // Render Row abbreviation to reduce source width +/// Render Row abbreviation to reduce source width. +#define RR APPEARANCE_CONTROLS_3D::APPEARANCE_SETTING_3D /// Template for object appearance settings const APPEARANCE_CONTROLS_3D::APPEARANCE_SETTING_3D APPEARANCE_CONTROLS_3D::s_layerSettings[] = { // text id tooltip - RR( _HKI( "Board Body" ), LAYER_3D_BOARD, _HKI( "Show board body" ) ), - RR( _HKI( "F.Cu" ), LAYER_3D_COPPER_TOP, _HKI( "Show front copper / surface finish color" ) ), - RR( _HKI( "B.Cu" ), LAYER_3D_COPPER_BOTTOM, _HKI( "Show back copper / surface finish color" ) ), - RR( _HKI( "Adhesive" ), LAYER_3D_ADHESIVE, _HKI( "Show adhesive" ) ), - RR( _HKI( "Solder Paste" ), LAYER_3D_SOLDERPASTE, _HKI( "Show solder paste" ) ), - RR( _HKI( "F.Silkscreen" ), LAYER_3D_SILKSCREEN_TOP, _HKI( "Show front silkscreen" ) ), - RR( _HKI( "B.Silkscreen" ), LAYER_3D_SILKSCREEN_BOTTOM, _HKI( "Show back silkscreen" ) ), - RR( _HKI( "F.Mask" ), LAYER_3D_SOLDERMASK_TOP, _HKI( "Show front solder mask" ) ), - RR( _HKI( "B.Mask" ), LAYER_3D_SOLDERMASK_BOTTOM, _HKI( "Show back solder mask" ) ), - RR( _HKI( "User.Drawings" ), LAYER_3D_USER_DRAWINGS, _HKI( "Show user drawings layer" ) ), - RR( _HKI( "User.Comments" ), LAYER_3D_USER_COMMENTS, _HKI( "Show user comments layer" ) ), - RR( _HKI( "User.Eco1" ), LAYER_3D_USER_ECO1, _HKI( "Show user ECO1 layer" ) ), - RR( _HKI( "User.Eco2" ), LAYER_3D_USER_ECO2, _HKI( "Show user ECO2 layer" ) ), + RR( _HKI( "Board Body" ), LAYER_3D_BOARD, _HKI( "Show board body" ) ), + RR( _HKI( "F.Cu" ), LAYER_3D_COPPER_TOP, _HKI( "Show front copper / surface finish color" ) ), + RR( _HKI( "B.Cu" ), LAYER_3D_COPPER_BOTTOM, _HKI( "Show back copper / surface finish color" ) ), + RR( _HKI( "Adhesive" ), LAYER_3D_ADHESIVE, _HKI( "Show adhesive" ) ), + RR( _HKI( "Solder Paste" ), LAYER_3D_SOLDERPASTE, _HKI( "Show solder paste" ) ), + RR( _HKI( "F.Silkscreen" ), LAYER_3D_SILKSCREEN_TOP, _HKI( "Show front silkscreen" ) ), + RR( _HKI( "B.Silkscreen" ), LAYER_3D_SILKSCREEN_BOTTOM, _HKI( "Show back silkscreen" ) ), + RR( _HKI( "F.Mask" ), LAYER_3D_SOLDERMASK_TOP, _HKI( "Show front solder mask" ) ), + RR( _HKI( "B.Mask" ), LAYER_3D_SOLDERMASK_BOTTOM, _HKI( "Show back solder mask" ) ), + RR( _HKI( "User.Drawings" ), LAYER_3D_USER_DRAWINGS, _HKI( "Show user drawings layer" ) ), + RR( _HKI( "User.Comments" ), LAYER_3D_USER_COMMENTS, _HKI( "Show user comments layer" ) ), + RR( _HKI( "User.Eco1" ), LAYER_3D_USER_ECO1, _HKI( "Show user ECO1 layer" ) ), + RR( _HKI( "User.Eco2" ), LAYER_3D_USER_ECO2, _HKI( "Show user ECO2 layer" ) ), RR(), - RR( _HKI( "Through-hole Models" ), LAYER_3D_TH_MODELS, EDA_3D_ACTIONS::showTHT ), - RR( _HKI( "SMD Models" ), LAYER_3D_SMD_MODELS, EDA_3D_ACTIONS::showSMD ), - RR( _HKI( "Virtual Models" ), LAYER_3D_VIRTUAL_MODELS, EDA_3D_ACTIONS::showVirtual ), - RR( _HKI( "Models not in POS File" ), LAYER_3D_MODELS_NOT_IN_POS, EDA_3D_ACTIONS::showNotInPosFile ), - RR( _HKI( "Models marked DNP" ), LAYER_3D_MODELS_MARKED_DNP, EDA_3D_ACTIONS::showDNP ), - RR( _HKI( "Model Bounding Boxes" ), LAYER_3D_BOUNDING_BOXES, EDA_3D_ACTIONS::showBBoxes ), + RR( _HKI( "Through-hole Models" ), LAYER_3D_TH_MODELS, EDA_3D_ACTIONS::showTHT ), + RR( _HKI( "SMD Models" ), LAYER_3D_SMD_MODELS, EDA_3D_ACTIONS::showSMD ), + RR( _HKI( "Virtual Models" ), LAYER_3D_VIRTUAL_MODELS, EDA_3D_ACTIONS::showVirtual ), + RR( _HKI( "Models not in POS File" ), LAYER_3D_MODELS_NOT_IN_POS, + EDA_3D_ACTIONS::showNotInPosFile ), + RR( _HKI( "Models marked DNP" ), LAYER_3D_MODELS_MARKED_DNP, EDA_3D_ACTIONS::showDNP ), + RR( _HKI( "Model Bounding Boxes" ), LAYER_3D_BOUNDING_BOXES, EDA_3D_ACTIONS::showBBoxes ), RR(), - RR( _HKI( "Values" ), LAYER_FP_VALUES, _HKI( "Show footprint values" ) ), - RR( _HKI( "References" ), LAYER_FP_REFERENCES, _HKI( "Show footprint references" ) ), - RR( _HKI( "Footprint Text" ), LAYER_FP_TEXT, _HKI( "Show all footprint text" ) ), - RR( _HKI( "Off-board Silkscreen" ), LAYER_3D_OFF_BOARD_SILK, _HKI( "Do not clip silk layers to board outline" ) ), + RR( _HKI( "Values" ), LAYER_FP_VALUES, _HKI( "Show footprint values" ) ), + RR( _HKI( "References" ), LAYER_FP_REFERENCES, _HKI( "Show footprint references" ) ), + RR( _HKI( "Footprint Text" ), LAYER_FP_TEXT, _HKI( "Show all footprint text" ) ), + RR( _HKI( "Off-board Silkscreen" ), LAYER_3D_OFF_BOARD_SILK, + _HKI( "Do not clip silk layers to board outline" ) ), RR(), - RR( _HKI( "3D Axis" ), LAYER_3D_AXES, EDA_3D_ACTIONS::showAxis ), - RR( _HKI( "Background Start" ), LAYER_3D_BACKGROUND_TOP, _HKI( "Background gradient start color" ) ), - RR( _HKI( "Background End" ), LAYER_3D_BACKGROUND_BOTTOM, _HKI( "Background gradient end color" ) ), + RR( _HKI( "3D Axis" ), LAYER_3D_AXES, EDA_3D_ACTIONS::showAxis ), + RR( _HKI( "Background Start" ), LAYER_3D_BACKGROUND_TOP, + _HKI( "Background gradient start color" ) ), + RR( _HKI( "Background End" ), LAYER_3D_BACKGROUND_BOTTOM, + _HKI( "Background gradient end color" ) ), }; // The list of IDs that can have colors coming from the board stackup, and cannot be @@ -136,7 +140,7 @@ APPEARANCE_CONTROLS_3D::APPEARANCE_CONTROLS_3D( EDA_3D_VIEWER_FRAME* aParent, } ); m_cbUseBoardEditorCopperColors = new wxCheckBox( m_panelLayers, wxID_ANY, - _( "Use board editor copper colors" ) ); + _( "Use board editor copper colors" ) ); m_cbUseBoardEditorCopperColors->SetFont( infoFont ); m_cbUseBoardEditorCopperColors->SetToolTip( _( "Use the board editor copper colors (openGL only)" ) ); @@ -154,7 +158,8 @@ APPEARANCE_CONTROLS_3D::APPEARANCE_CONTROLS_3D( EDA_3D_VIEWER_FRAME* aParent, m_panelLayersSizer->Add( m_cbUseBoardStackupColors, 0, wxEXPAND | wxTOP | wxLEFT | wxRIGHT, 7 ); - m_panelLayersSizer->Add( m_cbUseBoardEditorCopperColors, 0, wxEXPAND | wxTOP | wxLEFT | wxRIGHT, 7 ); + m_panelLayersSizer->Add( m_cbUseBoardEditorCopperColors, 0, + wxEXPAND | wxTOP | wxLEFT | wxRIGHT, 7 ); m_cbLayerPresets->SetToolTip( wxString::Format( _( "Save and restore color and visibility " "combinations.\n" @@ -529,7 +534,8 @@ void APPEARANCE_CONTROLS_3D::rebuildLayers() sizer->AddSpacer( 5 ); - wxStaticText* label = new wxStaticText( m_windowLayers, layer, aSetting->GetLabel() ); + wxStaticText* label = new wxStaticText( m_windowLayers, layer, + aSetting->GetLabel() ); label->Wrap( -1 ); label->SetToolTip( aSetting->GetTooltip() ); @@ -916,7 +922,8 @@ void APPEARANCE_CONTROLS_3D::onViewportChanged( wxCommandEvent& aEvent ) { m_viewports[name] = VIEWPORT3D( name, m_frame->GetCurrentCamera().GetViewMatrix() ); - index = m_cbViewports->Insert( name, index-1, static_cast<void*>( &m_viewports[name] ) ); + index = m_cbViewports->Insert( name, index-1, + static_cast<void*>( &m_viewports[name] ) ); } else { diff --git a/3d-viewer/dialogs/appearance_controls_3D.h b/3d-viewer/dialogs/appearance_controls_3D.h index 9608afd6cd..3fb52b6a5a 100644 --- a/3d-viewer/dialogs/appearance_controls_3D.h +++ b/3d-viewer/dialogs/appearance_controls_3D.h @@ -125,10 +125,10 @@ public: const wxArrayString& GetLayerPresetsMRU() { return m_presetMRU; } - ///< Return a list of viewports created by the user. + /// Return a list of viewports created by the user. std::vector<VIEWPORT3D> GetUserViewports() const; - ///< Update the current viewports from those saved in the project file. + /// Update the current viewports from those saved in the project file. void SetUserViewports( std::vector<VIEWPORT3D>& aPresetList ); void ApplyViewport( const wxString& aPresetName ); diff --git a/3d-viewer/dialogs/dialog_select_3d_model.cpp b/3d-viewer/dialogs/dialog_select_3d_model.cpp index 821d8ce5a8..8dcca72ffa 100644 --- a/3d-viewer/dialogs/dialog_select_3d_model.cpp +++ b/3d-viewer/dialogs/dialog_select_3d_model.cpp @@ -51,9 +51,8 @@ DIALOG_SELECT_3DMODEL::DIALOG_SELECT_3DMODEL( wxWindow* aParent, S3D_CACHE* aCac m_previousDir( prevModelSelectDir ), m_modelViewer( nullptr ) { - m_modelViewer = new EDA_3D_MODEL_VIEWER( m_pane3Dviewer, - OGL_ATT_LIST::GetAttributesList( ANTIALIASING_MODE::AA_8X ), - m_cache ); + m_modelViewer = new EDA_3D_MODEL_VIEWER( + m_pane3Dviewer, OGL_ATT_LIST::GetAttributesList( ANTIALIASING_MODE::AA_8X ), m_cache ); m_modelViewer->SetMinSize( wxSize( 400, -1 ) ); m_Sizer3Dviewer->Add( m_modelViewer, 1, wxEXPAND|wxRIGHT, 5 ); diff --git a/3d-viewer/dialogs/panel_3D_opengl_options.cpp b/3d-viewer/dialogs/panel_3D_opengl_options.cpp index a83bccfb68..4e40e7bfdc 100644 --- a/3d-viewer/dialogs/panel_3D_opengl_options.cpp +++ b/3d-viewer/dialogs/panel_3D_opengl_options.cpp @@ -74,7 +74,8 @@ bool PANEL_3D_OPENGL_OPTIONS::TransferDataFromWindow() cfg->m_Render.show_model_bbox = m_checkBoxBoundingBoxes->GetValue(); cfg->m_Render.highlight_on_rollover = m_checkBoxHighlightOnRollOver->GetValue(); - cfg->m_Render.opengl_AA_mode = static_cast<ANTIALIASING_MODE>( m_choiceAntiAliasing->GetSelection() ); + cfg->m_Render.opengl_AA_mode = + static_cast<ANTIALIASING_MODE>( m_choiceAntiAliasing->GetSelection() ); cfg->m_Render.opengl_selection_color = m_selectionColorSwatch->GetSwatchColor(); cfg->m_Render.opengl_AA_disableOnMove = m_checkBoxDisableAAMove->GetValue(); diff --git a/3d-viewer/dialogs/panel_preview_3d_model.cpp b/3d-viewer/dialogs/panel_preview_3d_model.cpp index 5fe023f25b..ecd4589e1e 100644 --- a/3d-viewer/dialogs/panel_preview_3d_model.cpp +++ b/3d-viewer/dialogs/panel_preview_3d_model.cpp @@ -142,7 +142,9 @@ PANEL_PREVIEW_3D_MODEL::PANEL_PREVIEW_3D_MODEL( wxWindow* aParent, PCB_BASE_FRAM m_boardAdapter.SetBoard( m_dummyBoard ); m_boardAdapter.m_IsBoardView = false; - m_boardAdapter.m_IsPreviewer = true; // Force display 3D models, regardless the 3D viewer options + + // Force display 3D models, regardless the 3D viewer options. + m_boardAdapter.m_IsPreviewer = true; loadSettings(); @@ -244,7 +246,8 @@ void PANEL_PREVIEW_3D_MODEL::loadSettings() */ static double rotationFromString( const wxString& aValue ) { - double rotation = EDA_UNIT_UTILS::UI::DoubleValueFromString( unityScale, EDA_UNITS::DEGREES, aValue ); + double rotation = EDA_UNIT_UTILS::UI::DoubleValueFromString( unityScale, EDA_UNITS::DEGREES, + aValue ); if( rotation > MAX_ROTATION ) { @@ -307,7 +310,7 @@ void PANEL_PREVIEW_3D_MODEL::SetSelectedModel( int idx ) yscale->ChangeValue( formatScaleValue( modelInfo.m_Scale.y ) ); zscale->ChangeValue( formatScaleValue( modelInfo.m_Scale.z ) ); - // Rotation is stored in the file as postive-is-CW, but we use postive-is-CCW in the GUI + // Rotation is stored in the file as positive-is-CW, but we use positive-is-CCW in the GUI // to match the rest of KiCad xrot->ChangeValue( formatRotationValue( -modelInfo.m_Rotation.x ) ); yrot->ChangeValue( formatRotationValue( -modelInfo.m_Rotation.y ) ); @@ -354,7 +357,7 @@ void PANEL_PREVIEW_3D_MODEL::updateOrientation( wxCommandEvent &event ) modelInfo->m_Scale.z = EDA_UNIT_UTILS::UI::DoubleValueFromString( pcbIUScale, EDA_UNITS::UNSCALED, zscale->GetValue() ); - // Rotation is stored in the file as postive-is-CW, but we use postive-is-CCW in the GUI + // Rotation is stored in the file as positive-is-CW, but we use positive-is-CCW in the GUI // to match the rest of KiCad modelInfo->m_Rotation.x = -rotationFromString( xrot->GetValue() ); modelInfo->m_Rotation.y = -rotationFromString( yrot->GetValue() ); @@ -395,7 +398,7 @@ void PANEL_PREVIEW_3D_MODEL::onOpacitySlider( wxCommandEvent& event ) void PANEL_PREVIEW_3D_MODEL::setBodyStyleView( wxCommandEvent& event ) { - // turn ON or OFF options to show the board body if OFF, soder paste, soldermask + // turn ON or OFF options to show the board body if OFF, solder paste, soldermask // and board body are hidden, to allows a good view of the 3D model and its pads. EDA_3D_VIEWER_SETTINGS* cfg = m_boardAdapter.m_Cfg; @@ -663,4 +666,4 @@ void PANEL_PREVIEW_3D_MODEL::onModify() if( kiwayHolder && kiwayHolder->GetType() == KIWAY_HOLDER::DIALOG ) static_cast<DIALOG_SHIM*>( kiwayHolder )->OnModify(); -} \ No newline at end of file +} diff --git a/include/notifications_manager.h b/include/notifications_manager.h index 072c9ac413..b9832d9691 100644 --- a/include/notifications_manager.h +++ b/include/notifications_manager.h @@ -40,11 +40,11 @@ class wxCloseEvent; struct KICOMMON_API NOTIFICATION { public: - wxString title; ///< Title of the notification - wxString description; ///< Additional message displayed under title - wxString href; ///< URL if any to link to for details - wxString key; ///< Unique key to find a notification - wxString date; ///< Date notification will display + wxString title; ///< Title of the notification. + wxString description; ///< Additional message displayed under title. + wxString href; ///< URL if any to link to for details. + wxString key; ///< Unique key to find a notification. + wxString date; ///< Date notification will display. }; @@ -56,66 +56,67 @@ public: NOTIFICATIONS_MANAGER(); /** - * Creates a notification with the given parameters or updates an existing one with the same key + * Create a notification with the given parameters or updates an existing one with the same key. * - * @param aKey is a unique key for the notification, this allows removing or updating the same notification - * @param aTitle is the displayed title for the event + * @param aKey is a unique key for the notification, this allows removing or updating the same + * notification. + * @param aTitle is the displayed title for the event. * @param aDescription is the text that displays underneath the title and has slightly more info - * them later programtically in case a notificaiton is no logner required - * @param aHref is link to external or internal content + * them later programatically in case a notification is no longer required. + * @param aHref is link to external or internal content. */ void CreateOrUpdate( const wxString& aKey, const wxString& aTitle, const wxString& aDescription, const wxString& aHref = wxEmptyString ); /** - * Remove a notification by key + * Remove a notification by key. * - * @param aKey is the unique key to locate + * @param aKey is the unique key to locate. */ void Remove( const wxString& aKey ); /** - * Loads notifications stored from disk + * Load notifications stored from disk. */ void Load(); /** - * Saves notifications to disk + * Save notifications to disk. */ void Save(); /** - * Shows the notification list + * Show the notification list. */ void ShowList( wxWindow* aParent, wxPoint aPos ); /** - * Add a status bar for handling + * Add a status bar for handling. */ void RegisterStatusBar( KISTATUSBAR* aStatusBar ); /** - * Removes status bar from handling + * Remove status bar from handling. */ void UnregisterStatusBar( KISTATUSBAR* aStatusBar ); private: /** - * Handles removing the shown list window from our list of shown windows + * Handle removing the shown list window from our list of shown windows. */ void onListWindowClosed( wxCloseEvent& aEvent ); - ///< Current stack of notifications + /// Current stack of notifications. std::vector<NOTIFICATION> m_notifications; - ///< Currently shown notification lists + /// Currently shown notification lists. std::vector<NOTIFICATIONS_LIST*> m_shownDialogs; - ///< Status bars registered for updates + /// Status bars registered for updates. std::vector<KISTATUSBAR*> m_statusBars; - ///< The cached file path to read/write notifications on disk + /// The cached file path to read/write notifications on disk. wxFileName m_destFileName; }; -#endif \ No newline at end of file +#endif diff --git a/include/origin_viewitem.h b/include/origin_viewitem.h index 2a026a33a7..2b2a71518b 100644 --- a/include/origin_viewitem.h +++ b/include/origin_viewitem.h @@ -41,7 +41,7 @@ namespace KIGFX { class ORIGIN_VIEWITEM : public EDA_ITEM { public: - ///< Marker symbol styles + /// Marker symbol styles. enum MARKER_STYLE { NO_GRAPHIC, CROSS, X, DOT, CIRCLE_CROSS, CIRCLE_X, CIRCLE_DOT, DASH_LINE @@ -144,22 +144,22 @@ public: } protected: - ///< Marker coordinates. + /// Marker coordinates. VECTOR2D m_position; - ///< Marker end position for markers that stretch between points + /// Marker end position for markers that stretch between points. VECTOR2D m_end; - ///< Marker size (in pixels). + /// Marker size (in pixels). int m_size; - ///< Marker color. + /// Marker color. COLOR4D m_color; - ///< Marker symbol. + /// Marker symbol. MARKER_STYLE m_style; - ///< If set, the marker will be drawn even if its position is 0,0 + /// If set, the marker will be drawn even if its position is 0,0. bool m_drawAtZero; }; diff --git a/include/pcb_base_frame.h b/include/pcb_base_frame.h index bd0ef5633f..2d3af88424 100644 --- a/include/pcb_base_frame.h +++ b/include/pcb_base_frame.h @@ -137,7 +137,7 @@ public: const VECTOR2I GetUserOrigin() const; /** - * Return a reference to the default ORIGIN_TRANSFORMS object + * Return a reference to the default #ORIGIN_TRANSFORMS object. */ ORIGIN_TRANSFORMS& GetOriginTransforms() override; @@ -150,7 +150,7 @@ public: void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ) override; /** - * Returns the BOARD_DESIGN_SETTINGS for the open project. + * Return the BOARD_DESIGN_SETTINGS for the open project. */ virtual BOARD_DESIGN_SETTINGS& GetDesignSettings() const; @@ -159,7 +159,8 @@ public: */ virtual COLOR_SETTINGS* GetColorSettings( bool aForceRefresh = false ) const override { - wxFAIL_MSG( wxT( "Color settings requested for a PCB_BASE_FRAME that does not override!" ) ); + wxFAIL_MSG( wxT( "Color settings requested for a PCB_BASE_FRAME that does not " + "override!" ) ); return nullptr; } @@ -172,9 +173,10 @@ public: const PCB_DISPLAY_OPTIONS& GetDisplayOptions() const { return m_displayOptions; } /** - * Updates the current display options from the given options struct - * @param aOptions is the options struct to apply - * @param aRefresh will refresh the view after updating + * Update the current display options. + * + * @param aOptions is the options struct to apply. + * @param aRefresh will refresh the view after updating. */ void SetDisplayOptions( const PCB_DISPLAY_OPTIONS& aOptions, bool aRefresh = true ); @@ -186,11 +188,13 @@ public: /** * Reload the footprint from the library. + * * @param aFootprint is the footprint to reload. */ virtual void ReloadFootprint( FOOTPRINT* aFootprint ) { - wxFAIL_MSG( wxT( "Attempted to reload a footprint for PCB_BASE_FRAME that does not override!" ) ); + wxFAIL_MSG( wxT( "Attempted to reload a footprint for PCB_BASE_FRAME that does not " + "override!" ) ); } /** @@ -224,7 +228,7 @@ public: PCB_SCREEN* GetScreen() const override { return (PCB_SCREEN*) EDA_DRAW_FRAME::GetScreen(); } /** - * Shows the 3D view frame. + * Show the 3D view frame. * * If it does not exist, it is created. If it exists, it is brought to the foreground. */ @@ -250,13 +254,13 @@ public: void OnModify() override; /** - * Creates a new footprint, at position 0,0. + * Create a new footprint at position 0,0. * * The new footprint contains only 2 texts: a reference and a value: * Reference = REF** * Value = "VAL**" or Footprint name in lib * - * @note They are dummy texts, which will be replaced by the actual texts when the + * @note They are dummy texts which will be replaced by the actual texts when the * footprint is placed on a board and a netlist is read. * * @param aFootprintName is the name of the new footprint in library. @@ -265,7 +269,7 @@ public: FOOTPRINT* CreateNewFootprint( wxString aFootprintName, const wxString& aLibName ); /** - * Places \a aFootprint at the current cursor position and updates footprint coordinates + * Place \a aFootprint at the current cursor position and updates footprint coordinates * with the new position. * * @param aRecreateRatsnest A bool true redraws the footprint ratsnest. @@ -307,7 +311,7 @@ public: virtual void SaveCopyInUndoList( EDA_ITEM* aItemToCopy, UNDO_REDO aTypeCommand ) {}; /** - * Creates a new entry in undo list of commands. + * Create a new entry in undo list of commands. * * @param aItemsList is the list of items modified by the command to undo. * @param aTypeCommand is the command type (see enum #UNDO_REDO) @@ -336,9 +340,9 @@ public: wxPoint aDlgPosition = wxDefaultPosition ); /** - * Change the active layer in the frame + * Change the active layer in the frame. * - * @param aLayer New layer to make active + * @param aLayer New layer to make active. */ virtual void SwitchLayer( PCB_LAYER_ID aLayer ); @@ -369,7 +373,7 @@ public: /** * Add \a aListener to post #EDA_EVT_BOARD_CHANGED command events to. * - * @warning The caller is reponsible for removing any listeners that are no long valid. + * @warning The caller is responsible for removing any listeners that are no long valid. * * @note This only gets called when the board editor is in stand alone mode. Changing * projects in the project manager closes the board editor when a new project is @@ -402,7 +406,7 @@ protected: virtual void doReCreateMenuBar() override; /** - * Attempts to load \a aFootprintId from the footprint library table. + * Attempt to load \a aFootprintId from the footprint library table. * * @param aFootprintId is the #LIB_ID of component footprint to load. * @return the #FOOTPRINT if found or NULL if \a aFootprintId not found in any of the @@ -417,7 +421,8 @@ protected: void rebuildConnectivity(); /** - * Creates (or removes) a watcher on the specified footprint + * Create or removes a watcher on the specified footprint. + * * @param aFootprint If nullptr, the watcher is removed. Otherwise, set a change watcher */ void setFPWatcher( FOOTPRINT* aFootprint ); diff --git a/include/pgm_base.h b/include/pgm_base.h index 2952ce5f90..b09c6d16d6 100644 --- a/include/pgm_base.h +++ b/include/pgm_base.h @@ -126,9 +126,15 @@ public: virtual COMMON_SETTINGS* GetCommonSettings() const; - virtual BACKGROUND_JOBS_MONITOR& GetBackgroundJobMonitor() const { return *m_background_jobs_monitor; } + virtual BACKGROUND_JOBS_MONITOR& GetBackgroundJobMonitor() const + { + return *m_background_jobs_monitor; + } - virtual NOTIFICATIONS_MANAGER& GetNotificationsManager() const { return *m_notifications_manager; } + virtual NOTIFICATIONS_MANAGER& GetNotificationsManager() const + { + return *m_notifications_manager; + } #ifdef KICAD_IPC_API virtual API_PLUGIN_MANAGER& GetPluginManager() const { return *m_plugin_manager; } @@ -150,11 +156,11 @@ public: virtual const wxString& GetTextEditor( bool aCanShowFileChooser = true ); /** - * Shows a dialog that instructs the user to select a new preferred editor. + * Show a dialog that instructs the user to select a new preferred editor. + * * @param aDefaultEditor Default full path for the default editor this dialog should * show by default. - * @return Returns the full path of the editor, or an empty string if no editor was - * chosen. + * @return the full path of the editor, or an empty string if no editor was chosen. */ virtual const wxString AskUserForPreferredEditor( const wxString& aDefaultEditor = wxEmptyString ); @@ -199,10 +205,12 @@ public: virtual bool SetLanguage( wxString& aErrMsg, bool first_time = false ); /** - * Set the default language without reference to any preferences. Can be used to set - * the language for dialogs that show before preferences are loaded - * @param aErrMsg String to return the error message(s) in - * @return false if the language could not be set + * Set the default language without reference to any preferences. + * + * Can be used to set the language for dialogs that show before preferences are loaded. + * + * @param aErrMsg String to return the error message(s) in. + * @return false if the language could not be set. */ bool SetDefaultLanguage( wxString& aErrMsg ); @@ -238,7 +246,7 @@ public: virtual void WritePdfBrowserInfos(); /** - * Sets the environment variable \a aName to \a aValue. + * Set the environment variable \a aName to \a aValue. * * This function first checks to see if the environment variable \a aName is already * defined. If it is not defined, then the environment variable \a aName is set to @@ -252,8 +260,9 @@ public: virtual bool SetLocalEnvVariable( const wxString& aName, const wxString& aValue ); /** - * Updates the local environment with the contents of the current ENV_VAR_MAP stored in the - * COMMON_SETTINGS + * Update the local environment with the contents of the current #ENV_VAR_MAP stored in the + * #COMMON_SETTINGS. + * * @see GetLocalEnvVariables() */ virtual void SetLocalEnvVariables(); @@ -261,7 +270,7 @@ public: virtual ENV_VAR_MAP& GetLocalEnvVariables() const; /** - * Returns a bare naked wxApp which may come from wxPython, SINGLE_TOP, or kicad.exe. + * Return a bare naked wxApp which may come from wxPython, SINGLE_TOP, or kicad.exe. * * This should return what wxGetApp() returns. */ @@ -303,51 +312,51 @@ public: bool IsSentryOptedIn(); /** - * Sets the Sentry opt in state, this will also terminate sentry - * immediately if needed, however it will not init sentry if opted in + * Set the Sentry opt in state, this will also terminate sentry + * immediately if needed, however it will not init sentry if opted in. * - * @param aOptIn True/false to agreeing to the use of sentry + * @param aOptIn True/false to agreeing to the use of sentry. */ void SetSentryOptIn( bool aOptIn ); /** - * Generates and stores a new sentry id at random using the boost uuid generator + * Generate and stores a new sentry id at random using the boost uuid generator. */ void ResetSentryId(); /** - * Gets the current id string being used as "user id" in sentry reports + * Get the current id string being used as "user id" in sentry reports. */ const wxString& GetSentryId(); #endif /** - * A exception handler to be used at the top level if exceptions bubble up that for + * A exception handler to be used at the top level if exceptions bubble up that for. * - * The purpose is to have a central place to log a wxWidgets error message and/or sentry report + * The purpose is to have a central place to log a wxWidgets error message and/or sentry report. * - * @param aPtr Pass the std::current_exception() from within the catch block + * @param aPtr Pass the std::current_exception() from within the catch block. */ void HandleException( std::exception_ptr aPtr ); /** - * A common assert handler to be used between single_top and kicad + * A common assert handler to be used between single_top and kicad. * - * This lets us have a common set of assert handling, including triggering sentry reports + * This lets us have a common set of assert handling, including triggering sentry reports. * - * @param aFile the file path of the assert - * @param aLine the line number of the assert - * @param aFunc the function name the assert is within - * @param aCond the condition of the assert - * @param aMsg the attached assert message (can be empty) + * @param aFile the file path of the assert. + * @param aLine the line number of the assert. + * @param aFunc the function name the assert is within. + * @param aCond the condition of the assert. + * @param aMsg the attached assert message (can be empty). */ void HandleAssert( const wxString& aFile, int aLine, const wxString& aFunc, const wxString& aCond, const wxString& aMsg ); /** - * Determine if the application is running with a GUI + * Determine if the application is running with a GUI. * - * @return true if there is a GUI and false otherwise + * @return true if there is a GUI and false otherwise. */ bool IsGUI(); @@ -356,8 +365,8 @@ public: void HideSplash(); /** - * Allows access to the wxSingleInstanceChecker to test for other running KiCads - */ + * Allow access to the wxSingleInstanceChecker to test for other running KiCads. + */ std::unique_ptr<wxSingleInstanceChecker>& SingleInstance() { return m_pgm_checker; @@ -375,10 +384,10 @@ public: bool m_PropertyGridInitialized; protected: - /// Loads internal settings from COMMON_SETTINGS + /// Load internal settings from #COMMON_SETTINGS. void loadCommonSettings(); - /// Trap all changes in here, simplifies debugging + /// Trap all changes in here, simplifies debugging. void setLanguageId( int aId ) { m_language_id = aId; } #ifdef KICAD_USE_SENTRY @@ -394,7 +403,7 @@ protected: std::unique_ptr<SCRIPTING> m_python_scripting; - /// Checks if there is another copy of Kicad running at the same time + /// Check if there is another copy of Kicad running at the same time. std::unique_ptr<wxSingleInstanceChecker> m_pgm_checker; #ifdef KICAD_IPC_API @@ -402,13 +411,13 @@ protected: std::unique_ptr<KICAD_API_SERVER> m_api_server; #endif - wxString m_kicad_env; /// The KICAD system environment variable. + wxString m_kicad_env; ///< The KICAD system environment variable. wxLocale* m_locale; int m_language_id; bool m_use_system_pdf_browser; - wxString m_pdf_browser; /// Filename of the app selected for browsing PDFs + wxString m_pdf_browser; ///< Filename of the app selected for browsing PDFs. wxString m_text_editor; @@ -420,8 +429,12 @@ protected: wxString m_sentryUid; #endif - char** m_argvUtf8; /// argv parameters converted to utf8 form, because wxwidgets has opinions - /// and will return argv as either force converted to ascii in char* or wchar_t only + /** + * argv parameters converted to utf8 form because wxWidgets has opinions. + * + * This will return argv as either force converted to ASCII in char* or wchar_t only. + */ + char** m_argvUtf8; int m_argcUtf8; @@ -429,12 +442,18 @@ protected: }; -/// The global Program "get" accessor. -/// Implemented in: 1) common/single_top.cpp, 2) kicad/kicad.cpp, and 3) scripting/kiway.i +/** + * The global program "get" accessor. + * + * Implemented in: + * 1. common/single_top.cpp + * 2. kicad/kicad.cpp + * 3. scripting/kiway.i + */ KICOMMON_API extern PGM_BASE& Pgm(); -/// similar to PGM_BASE& Pgm(), but return a reference that can be nullptr -/// when running a shared lib from a script, not from a kicad appl +/// Return a reference that can be nullptr when running a shared lib from a script, not from +/// a kicad app. KICOMMON_API extern PGM_BASE* PgmOrNull(); KICOMMON_API extern void SetPgm( PGM_BASE* pgm ); diff --git a/include/rc_item.h b/include/rc_item.h index 0e3cd420f0..a1688bdb28 100644 --- a/include/rc_item.h +++ b/include/rc_item.h @@ -148,7 +148,8 @@ public: * @return None */ virtual void GetJsonViolation( RC_JSON::VIOLATION& aViolation, UNITS_PROVIDER* aUnitsProvider, - SEVERITY aSeverity, const std::map<KIID, EDA_ITEM*>& aItemMap ) const; + SEVERITY aSeverity, + const std::map<KIID, EDA_ITEM*>& aItemMap ) const; int GetErrorCode() const { return m_errorCode; } void SetErrorCode( int aCode ) { m_errorCode = aCode; } @@ -205,7 +206,8 @@ public: COMMENT }; - RC_TREE_NODE( RC_TREE_NODE* aParent, const std::shared_ptr<RC_ITEM>& aRcItem, NODE_TYPE aType ) : + RC_TREE_NODE( RC_TREE_NODE* aParent, const std::shared_ptr<RC_ITEM>& aRcItem, + NODE_TYPE aType ) : m_Type( aType ), m_RcItem( aRcItem ), m_Parent( aParent ) @@ -293,8 +295,9 @@ public: void DeleteCurrentItem( bool aDeep ); /** - * Deletes the current item or all items. If all, \a aIncludeExclusions determines - * whether or not exclusions are also deleted. + * Delete the current item or all items. + * + * If all, \a aIncludeExclusions determines whether or not exclusions are also deleted. */ void DeleteItems( bool aCurrentOnly, bool aIncludeExclusions, bool aDeep ); diff --git a/include/reference_image.h b/include/reference_image.h index f660a92738..7e5b002672 100644 --- a/include/reference_image.h +++ b/include/reference_image.h @@ -140,9 +140,10 @@ private: const EDA_IU_SCALE& m_iuScale; - VECTOR2I m_pos; // XY coordinates of center of the bitmap - ///< Center of scaling, etc, relative to the image center + VECTOR2I m_pos; ///< XY coordinates of center of the bitmap. + + /// Center of scaling, etc, relative to the image center. VECTOR2I m_transformOriginOffset; std::unique_ptr<BITMAP_BASE> m_bitmapBase; -}; \ No newline at end of file +}; diff --git a/include/richio.h b/include/richio.h index c3debbf2c4..fc2b3b428c 100644 --- a/include/richio.h +++ b/include/richio.h @@ -72,7 +72,7 @@ KICOMMON_API std::string /** * Nominally opens a file and reads it into a string. But unlike other facilities, this handles - * mis-encded Wine-written files on macOS. + * mis-encoded Wine-written files on macOS. * * @param aFilePath * @param aReadType @@ -297,7 +297,7 @@ public: char* ReadLine() override; protected: - wxInputStream* m_stream; //< The input stream to read. No ownership of this pointer. + wxInputStream* m_stream; ///< The input stream to read. No ownership of this pointer. }; diff --git a/include/rtti_dump.h b/include/rtti_dump.h index b81193ad84..8c1d4e5f2d 100644 --- a/include/rtti_dump.h +++ b/include/rtti_dump.h @@ -35,189 +35,242 @@ #include <string> #include <typeinfo> -#if defined(__ANDROID__) && !defined(RTTI_DUMP_USE_PRINTF) +#if defined( __ANDROID__ ) && !defined( RTTI_DUMP_USE_PRINTF ) #include <android/log.h> -#define RTTI_DUMP_LOG(fmt, ...) \ - __android_log_print(ANDROID_LOG_INFO, "rtti_dump", fmt, ## __VA_ARGS__) +#define RTTI_DUMP_LOG( fmt, ... ) \ + __android_log_print( ANDROID_LOG_INFO, "rtti_dump", fmt, ##__VA_ARGS__ ) #else -#define RTTI_DUMP_LOG(fmt, ...) printf(fmt "\n", ## __VA_ARGS__) +#define RTTI_DUMP_LOG( fmt, ... ) printf( fmt "\n", ##__VA_ARGS__ ) #endif // Avoid compiler warnings. -#define RTTI_DUMP_UNUSED __attribute__((unused)) +#define RTTI_DUMP_UNUSED __attribute__( ( unused ) ) // Use an anonymous namespace so this header file can be included at the top of // multiple C++ source files without breaking the One Definition Rule. -namespace rtti_dump { -namespace { +namespace rtti_dump +{ +namespace +{ -// Returns the type of the current exception object or NULL if the thread is -// not currently in a catch block. -extern "C" const std::type_info *__cxa_current_exception_type(); + // Returns the type of the current exception object or NULL if the thread is + // not currently in a catch block. + extern "C" const std::type_info* __cxa_current_exception_type(); -// Using run-time type information, returns an std::type_info* corresponding to -// the most-derived class of a pointer to an object. The pointed-to type must -// be a polymorphic class. (i.e. The class must have a virtual function or a -// base class with a virtual function.) -// -// The function can return NULL if the object's vtable comes from an object -// file compiled without -frtti. -template <typename T> -RTTI_DUMP_UNUSED const std::type_info *runtime_typeid(const volatile T *dynptr) { - T *dynptr_unqual = const_cast<T*>(dynptr); + // Using run-time type information, returns an std::type_info* corresponding to + // the most-derived class of a pointer to an object. The pointed-to type must + // be a polymorphic class. (i.e. The class must have a virtual function or a + // base class with a virtual function.) + // + // The function can return NULL if the object's vtable comes from an object + // file compiled without -frtti. + template <typename T> + RTTI_DUMP_UNUSED const std::type_info* runtime_typeid( const volatile T* dynptr ) + { + T* dynptr_unqual = const_cast<T*>( dynptr ); - // Use dynamic_cast<void*> to ensure that T is polymorphic. The result is - // discarded just in case the most-derived object vtable and the subobject - // vtable point to different typeinfo objects. (XXX: I *think* that's - // impossible, though.) - (void)sizeof(dynamic_cast<void*>(dynptr_unqual)); + // Use dynamic_cast<void*> to ensure that T is polymorphic. The result is + // discarded just in case the most-derived object vtable and the subobject + // vtable point to different typeinfo objects. (XXX: I *think* that's + // impossible, though.) + (void) sizeof( dynamic_cast<void*>( dynptr_unqual ) ); - void *vptr = *reinterpret_cast<void**>(dynptr_unqual); - void *typeid_void = reinterpret_cast<void**>(vptr)[-1]; - return reinterpret_cast<const std::type_info*>(typeid_void); -} - -// Returns the name of the DSO or binary containing the given address. -RTTI_DUMP_UNUSED std::string dladdr_fname(const void *ptr) { - Dl_info info = { 0 }; - if (!dladdr(const_cast<void*>(ptr), &info)) { - char buf[64]; - snprintf(buf, sizeof(buf), "[error: dladdr failed - %d]", errno); - return buf; - } else { - return std::string(info.dli_fname); - } -} - -// Dump the address of the std::type_info object, its name, and the shared -// object where the type_info object is defined. -RTTI_DUMP_UNUSED -void dump_type(const std::type_info *type, const char *label="dump_type", int indent=0) { - const std::string prefix = label + std::string(": ") + std::string(indent, ' '); - if (type == NULL) { - RTTI_DUMP_LOG("%sERROR: dump_type called with type==NULL!", prefix.c_str()); - } else { - struct type_info { - virtual ~type_info() {} - const char *type_name; - }; - assert(sizeof(type_info) == sizeof(std::type_info)); - const char *const name = type->name(); - const char *const raw_name = reinterpret_cast<const type_info*>(type)->type_name; - if (name == raw_name) { - RTTI_DUMP_LOG("%stype %s:", prefix.c_str(), name); - } else if (raw_name + 1 == name) { - RTTI_DUMP_LOG("%stype %s (raw name == '%s' @ %p):", prefix.c_str(), name, raw_name, raw_name); - } else { - RTTI_DUMP_LOG("%stype %s (raw name == %p):", prefix.c_str(), name, raw_name); - } - RTTI_DUMP_LOG("%s type_info obj: %p (in %s)", - prefix.c_str(), type, dladdr_fname(type).c_str()); - RTTI_DUMP_LOG("%s type_info name: %p (in %s)", - prefix.c_str(), name, dladdr_fname(name).c_str()); - } -} - -// Call from a catch block to dump the type of the current exception. -RTTI_DUMP_UNUSED -void dump_current_exception(const char *label="dump_current_exception") { - const std::type_info *type = __cxa_current_exception_type(); - if (type != NULL) { - dump_type(type, label); - } else { - RTTI_DUMP_LOG("%s: ERROR: dump_current_exception called outside a catch block!", label); - } -} - -namespace hierarchy_dumper_internals { - - // std::type_info has virtual member functions, so the most-derived type of - // a pointer to a std::type_info object can be determined at run-time by - // looking for the std::type_info's own std::type_info. We rely upon this - // property to walk a class's RTTI graph at run-time. - - struct __class_type_info : std::type_info {}; - - struct __si_class_type_info : __class_type_info { - const __class_type_info *__base_type; - }; - - struct __base_class_type_info { - const __class_type_info* __base_type; - long __offset_flags; - }; - - struct __vmi_class_type_info : __class_type_info { - unsigned int __flags; - unsigned int __base_count; - __base_class_type_info __base_info[1]; - }; - - class Dumper { - const char *label_; - std::set<const std::type_info*> seen_; - public: - Dumper(const char *label) : label_(label) {} - void dump_type(const std::type_info *info, int indent); - }; - - const int kIndent = 4; - - void Dumper::dump_type(const std::type_info *info, int indent) { - ::rtti_dump::dump_type(info, label_, indent * kIndent); - - if (info == NULL) { - return; + void* vptr = *reinterpret_cast<void**>( dynptr_unqual ); + void* typeid_void = reinterpret_cast<void**>( vptr )[-1]; + return reinterpret_cast<const std::type_info*>( typeid_void ); } - const std::type_info *info_type = runtime_typeid(info); - __base_class_type_info lone_base = { 0 }; - const __base_class_type_info *base_table = NULL; - unsigned int base_count = 0; + // Returns the name of the DSO or binary containing the given address. + RTTI_DUMP_UNUSED std::string dladdr_fname( const void* ptr ) + { + Dl_info info = { 0 }; - // Determine type equality using a string comparison, because this dumping - // system doesn't trust std::type_info::operator== to work with multiple - // shared objects. - - const int sub_indent_sp = (indent + 1) * kIndent; - - if (info_type == NULL) { - // I don't think info_type can ever be NULL here. - RTTI_DUMP_LOG("%s: %*sERROR: runtime_typeid(info) was NULL!", label_, sub_indent_sp, ""); - } else if (!strcmp(info_type->name(), "N10__cxxabiv120__si_class_type_infoE")) { - const __si_class_type_info &infox = - *reinterpret_cast<const __si_class_type_info*>(info); - lone_base.__base_type = infox.__base_type; - base_count = 1; - base_table = &lone_base; - } else if (!strcmp(info_type->name(), "N10__cxxabiv121__vmi_class_type_infoE")) { - const __vmi_class_type_info &infox = - *reinterpret_cast<const __vmi_class_type_info*>(info); - base_count = infox.__base_count; - base_table = infox.__base_info; - } - - if (base_count > 0) { - if (seen_.find(info) != seen_.end()) { - RTTI_DUMP_LOG("%s: %*sbase classes: ...elided...", label_, sub_indent_sp, ""); - } else { - RTTI_DUMP_LOG("%s: %*sbase classes:", label_, sub_indent_sp, ""); - seen_.insert(info); - for (unsigned int i = 0; i < base_count; ++i) { - dump_type(base_table[i].__base_type, indent + 2); + if( !dladdr( const_cast<void*>( ptr ), &info ) ) + { + char buf[64]; + snprintf( buf, sizeof( buf ), "[error: dladdr failed - %d]", errno ); + return buf; + } + else + { + return std::string( info.dli_fname ); } - } } - } -} // namespace hierarchy_dumper_internals -// Dump the std::type_info object, and if it represents a class with base -// classes, then dumps the class hierarchy. -RTTI_DUMP_UNUSED -void dump_class_hierarchy(const std::type_info *info, const char *label="dump_class_hierarchy") { - hierarchy_dumper_internals::Dumper dumper(label); - dumper.dump_type(info, 0); -} + // Dump the address of the std::type_info object, its name, and the shared + // object where the type_info object is defined. + RTTI_DUMP_UNUSED + void dump_type( const std::type_info* type, const char* label = "dump_type", int indent = 0 ) + { + const std::string prefix = label + std::string( ": " ) + std::string( indent, ' ' ); + + if( type == NULL ) + { + RTTI_DUMP_LOG( "%sERROR: dump_type called with type==NULL!", prefix.c_str() ); + } + else + { + struct type_info + { + virtual ~type_info() {} + const char* type_name; + }; + + assert( sizeof( type_info ) == sizeof( std::type_info ) ); + const char* const name = type->name(); + const char* const raw_name = reinterpret_cast<const type_info*>( type )->type_name; + + if( name == raw_name ) + { + RTTI_DUMP_LOG( "%stype %s:", prefix.c_str(), name ); + } + else if( raw_name + 1 == name ) + { + RTTI_DUMP_LOG( "%stype %s (raw name == '%s' @ %p):", prefix.c_str(), name, raw_name, + raw_name ); + } + else + { + RTTI_DUMP_LOG( "%stype %s (raw name == %p):", prefix.c_str(), name, raw_name ); + } + + RTTI_DUMP_LOG( "%s type_info obj: %p (in %s)", prefix.c_str(), type, + dladdr_fname( type ).c_str() ); + RTTI_DUMP_LOG( "%s type_info name: %p (in %s)", prefix.c_str(), name, + dladdr_fname( name ).c_str() ); + } + } + + // Call from a catch block to dump the type of the current exception. + RTTI_DUMP_UNUSED + void dump_current_exception( const char* label = "dump_current_exception" ) + { + const std::type_info* type = __cxa_current_exception_type(); + + if( type != NULL ) + { + dump_type( type, label ); + } + else + { + RTTI_DUMP_LOG( "%s: ERROR: dump_current_exception called outside a catch block!", + label ); + } + } + + namespace hierarchy_dumper_internals + { + + // std::type_info has virtual member functions, so the most-derived type of + // a pointer to a std::type_info object can be determined at run-time by + // looking for the std::type_info's own std::type_info. We rely upon this + // property to walk a class's RTTI graph at run-time. + + struct __class_type_info : std::type_info + { + }; + + struct __si_class_type_info : __class_type_info + { + const __class_type_info* __base_type; + }; + + struct __base_class_type_info + { + const __class_type_info* __base_type; + long __offset_flags; + }; + + struct __vmi_class_type_info : __class_type_info + { + unsigned int __flags; + unsigned int __base_count; + __base_class_type_info __base_info[1]; + }; + + class Dumper + { + const char* label_; + std::set<const std::type_info*> seen_; + + public: + Dumper( const char* label ) : label_( label ) {} + void dump_type( const std::type_info* info, int indent ); + }; + + const int kIndent = 4; + + void Dumper::dump_type( const std::type_info* info, int indent ) + { + ::rtti_dump::dump_type( info, label_, indent * kIndent ); + + if( info == NULL ) + { + return; + } + + const std::type_info* info_type = runtime_typeid( info ); + __base_class_type_info lone_base = { 0 }; + const __base_class_type_info* base_table = NULL; + unsigned int base_count = 0; + + // Determine type equality using a string comparison, because this dumping + // system doesn't trust std::type_info::operator== to work with multiple + // shared objects. + + const int sub_indent_sp = ( indent + 1 ) * kIndent; + + if( info_type == NULL ) + { + // I don't think info_type can ever be NULL here. + RTTI_DUMP_LOG( "%s: %*sERROR: runtime_typeid(info) was NULL!", label_, + sub_indent_sp, "" ); + } + else if( !strcmp( info_type->name(), "N10__cxxabiv120__si_class_type_infoE" ) ) + { + const __si_class_type_info& infox = + *reinterpret_cast<const __si_class_type_info*>( info ); + lone_base.__base_type = infox.__base_type; + base_count = 1; + base_table = &lone_base; + } + else if( !strcmp( info_type->name(), "N10__cxxabiv121__vmi_class_type_infoE" ) ) + { + const __vmi_class_type_info& infox = + *reinterpret_cast<const __vmi_class_type_info*>( info ); + base_count = infox.__base_count; + base_table = infox.__base_info; + } + + if( base_count > 0 ) + { + if( seen_.find( info ) != seen_.end() ) + { + RTTI_DUMP_LOG( "%s: %*sbase classes: ...elided...", label_, sub_indent_sp, "" ); + } + else + { + RTTI_DUMP_LOG( "%s: %*sbase classes:", label_, sub_indent_sp, "" ); + seen_.insert( info ); + + for( unsigned int i = 0; i < base_count; ++i ) + { + dump_type( base_table[i].__base_type, indent + 2 ); + } + } + } + } + } // namespace hierarchy_dumper_internals + + // Dump the std::type_info object, and if it represents a class with base + // classes, then dumps the class hierarchy. + RTTI_DUMP_UNUSED + void dump_class_hierarchy( const std::type_info* info, + const char* label = "dump_class_hierarchy" ) + { + hierarchy_dumper_internals::Dumper dumper( label ); + dumper.dump_type( info, 0 ); + } } // anonymous namespace } // namespace rtti_dump diff --git a/include/scoped_set_reset.h b/include/scoped_set_reset.h index a5517f5715..32c229958a 100644 --- a/include/scoped_set_reset.h +++ b/include/scoped_set_reset.h @@ -46,9 +46,7 @@ template <typename VAL_TYPE> class SCOPED_SET_RESET { public: - - SCOPED_SET_RESET( VAL_TYPE& target, VAL_TYPE value ): - m_target( target ) + SCOPED_SET_RESET( VAL_TYPE& target, VAL_TYPE value ) : m_target( target ) { m_original = target; m_target = value; @@ -57,13 +55,10 @@ public: /** * Destruct the class, and return the target to its original value. */ - ~SCOPED_SET_RESET() - { - m_target = m_original; - } + ~SCOPED_SET_RESET() { m_target = m_original; } private: - VAL_TYPE m_original; + VAL_TYPE m_original; VAL_TYPE& m_target; }; @@ -72,21 +67,18 @@ private: * RAII class that executes a function at construction and another at destruction. * * Useful to ensure cleanup code is executed even if an exception is thrown. -*/ + */ template <typename Func> class SCOPED_EXECUTION { public: - SCOPED_EXECUTION(Func initFunc, Func destroyFunc) : - m_initFunc(initFunc), m_destroyFunc(destroyFunc) + SCOPED_EXECUTION( Func initFunc, Func destroyFunc ) : + m_initFunc( initFunc ), m_destroyFunc( destroyFunc ) { m_initFunc(); } - ~SCOPED_EXECUTION() - { - m_destroyFunc(); - } + ~SCOPED_EXECUTION() { m_destroyFunc(); } private: Func m_initFunc; diff --git a/include/status_popup.h b/include/status_popup.h index 2a14f55145..91accb7f48 100644 --- a/include/status_popup.h +++ b/include/status_popup.h @@ -41,7 +41,6 @@ class EDA_DRAW_FRAME; * A tiny, headerless popup window used to display useful status (e.g. line length * tuning info) next to the mouse cursor. */ - class STATUS_POPUP: public wxPopupWindow { public: @@ -67,7 +66,7 @@ protected: void onCharHook( wxKeyEvent& aEvent ); - ///< Expire timer even handler + /// Expire timer even handler. void onExpire( wxTimerEvent& aEvent ); protected: diff --git a/include/stroke_params.h b/include/stroke_params.h index 3f1f2077d7..9452de6ef4 100644 --- a/include/stroke_params.h +++ b/include/stroke_params.h @@ -62,8 +62,8 @@ struct LINE_STYLE_DESC }; -/* - * Conversion map between LINE_STYLE values and style names displayed +/** + * Conversion map between LINE_STYLE values and style names displayed. */ extern const std::map<LINE_STYLE, struct LINE_STYLE_DESC> lineTypeNames; @@ -113,7 +113,8 @@ public: static void Stroke( const SHAPE* aShape, LINE_STYLE aLineStyle, int aWidth, const KIGFX::RENDER_SETTINGS* aRenderSettings, - const std::function<void( const VECTOR2I& a, const VECTOR2I& b )>& aStroker ); + const std::function<void( const VECTOR2I& a, + const VECTOR2I& b )>& aStroker ); private: int m_width; diff --git a/include/undo_redo_container.h b/include/undo_redo_container.h index 210b7e23cd..d7e7ea8510 100644 --- a/include/undo_redo_container.h +++ b/include/undo_redo_container.h @@ -52,7 +52,7 @@ class BASE_SCREEN; /** - * Type of undo/redo operations + * Type of undo/redo operations. * * Each type must be redo/undone by a specific operation. */ @@ -122,7 +122,8 @@ private: * duplicate) m_Item points the duplicate (i.e the old * copy of an active item) and m_Link points the active * item in schematic */ - KIID m_groupId; /* Id of the group of items in case this is a group/ungroup command */ + KIID m_groupId; /* Id of the group of items in case this is a + * group/ungroup command */ BASE_SCREEN* m_screen; /* For new and deleted items the screen the item should * be added to/removed from. */ diff --git a/include/validators.h b/include/validators.h index 0158a26e1f..d068895dc6 100644 --- a/include/validators.h +++ b/include/validators.h @@ -51,10 +51,12 @@ /** - * This class provides a custom wxValidator object for limiting the allowable characters when - * defining footprint names. Since the introduction of the PRETTY footprint library format, - * footprint names cannot have any characters that would prevent file creation on any platform. - * The characters \/:*?|"<> are illegal and filtered by the validator. + * Provide a custom wxValidator object for limiting the allowable characters when + * defining footprint names. + * + * Since the introduction of the PRETTY footprint library format, footprint names cannot have + * any characters that would prevent file creation on any platform. The characters \/:*?|"<> + * are illegal and filtered by the validator. */ class FOOTPRINT_NAME_VALIDATOR : public wxTextValidator { @@ -64,8 +66,9 @@ public: /** - * This class provides a custom wxValidator object for limiting the allowable characters when + * Provide a custom wxValidator object for limiting the allowable characters when * defining file names with path, for instance in schematic sheet file names. + * * The characters *?|"<> are illegal and filtered by the validator, * but /\: are valid (\ and : only on Windows.) */ @@ -77,10 +80,11 @@ public: /** - * This class provides a custom wxValidator object for limiting the allowable characters - * when defining an environment variable name in a text edit control. Only uppercase, - * numbers, and underscore (_) characters are valid and the first character of the name - * cannot start with a number. This is according to IEEE Std 1003.1-2001. Even though + * Provide a custom wxValidator object for limiting the allowable characters when defining an + * environment variable name in a text edit control. + * + * Only uppercase, numbers, and underscore (_) characters are valid and the first character of + * the name cannot start with a number. This is according to IEEE Std 1003.1-2001. Even though * most systems support other characters, these characters guarantee compatibility for * all shells. */ @@ -106,8 +110,7 @@ public: /** - * Custom validator that checks verifies that a string *exactly* matches a - * regular expression. + * Custom validator that checks verifies that a string *exactly* matches a regular expression. */ class REGEX_VALIDATOR : public wxTextValidator { @@ -151,16 +154,16 @@ public: } protected: - ///< Compiles and stores a regular expression + /// Compiles and stores a regular expression. void compileRegEx( const wxString& aRegEx, int aFlags ); - ///< Original regular expression (for copy constructor) + /// Original regular expression (for copy constructor). wxString m_regExString; - ///< Original compilation flags (for copy constructor) + /// Original compilation flags (for copy constructor). int m_regExFlags; - ///< Compiled regex + /// Compiled regular expression. wxRegEx m_regEx; }; @@ -182,7 +185,7 @@ public: virtual bool Validate( wxWindow *aParent ) override; protected: - // returns the error message if the contents of 'val' are invalid + /// @return the error message if the contents of @a aVal are invalid. wxString IsValid( const wxString& aVal ) const override; private: