KiCad PCB EDA Suite
Loading...
Searching...
No Matches
eda_3d_viewer_settings.h
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2020 Jon Evans <[email protected]>
5 * Copyright (C) 2023 CERN
6 * Copyright (C) 2020-2024 KiCad Developers, see AUTHORS.txt for contributors.
7 *
8 * This program is free software: you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation, either version 3 of the License, or (at your
11 * option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License along
19 * with this program. If not, see <http://www.gnu.org/licenses/>.
20 */
21
22#ifndef EDA_3D_VIEWER_SETTINGS_H_
23#define EDA_3D_VIEWER_SETTINGS_H_
24
25#include <3d_enums.h>
28#include <settings/parameters.h>
30#include "render_settings.h"
31
32#define FOLLOW_PCB wxT( "follow_pcb_editor" )
33#define FOLLOW_PLOT_SETTINGS wxT( "follow_plot_settings" )
34#define LEGACY_PRESET_FLAG wxT( "legacy_preset_flag" )
35
36enum class ANTIALIASING_MODE;
37
38
40{
41 LAYER_PRESET_3D( const wxString& aName = wxEmptyString );
42
43 LAYER_PRESET_3D( const wxString& aName, const std::bitset<LAYER_3D_END>& aLayers,
44 const std::map<int, KIGFX::COLOR4D>& aColors ) :
45 name( aName ),
46 layers( aLayers ),
47 colors( aColors )
48 {
49 }
50
51 wxString name;
52 std::bitset<LAYER_3D_END> layers;
53 std::map<int, KIGFX::COLOR4D> colors;
54};
55
56
57class PARAM_LAYER_PRESET_3D : public PARAM_LAMBDA<nlohmann::json>
58{
59public:
60 PARAM_LAYER_PRESET_3D( const std::string& aPath, std::vector<LAYER_PRESET_3D>* aPresetList );
61
62private:
63 nlohmann::json presetsToJson();
64
65 void jsonToPresets( const nlohmann::json& aJson );
66
67 std::vector<LAYER_PRESET_3D>* m_presets;
68};
69
70
72{
73public:
75 {
78 };
79
81 {
86
97
105
109
113
116
120 std::vector<KIGFX::COLOR4D> raytrace_lightColor;
121 std::vector<int> raytrace_lightElevation; // -90 .. 90
122 std::vector<int> raytrace_lightAzimuth; // 0 .. 359
123
150 // Board editor copper colors are used only in OpenGL mode if
151 // use_board_editor_copper_colors is true
153
162 {
163 return engine == RENDER_ENGINE::RAYTRACING ? differentiate_plated_copper
165 }
166 };
167
169 {
174 };
175
177
179
180 LAYER_PRESET_3D* FindPreset( const wxString& aName );
181
182 virtual bool MigrateFromLegacy( wxConfigBase* aLegacyConfig ) override;
183
184public:
188
190 std::vector<LAYER_PRESET_3D> m_LayerPresets;
192
193protected:
194 virtual std::string getLegacyFrameName() const override { return "Viewer3DFrameName"; }
195
196private:
197 bool migrateSchema0to1();
198};
199
200
201#endif
declared enumerations and flags
GRID3D_TYPE
Grid types.
Definition: 3d_enums.h:54
MATERIAL_MODE
Render 3d model shape materials mode.
Definition: 3d_enums.h:71
RENDER_ENGINE
Render engine mode.
Definition: 3d_enums.h:64
APP_SETTINGS_BASE is a settings class that should be derived for each standalone KiCad application.
Definition: app_settings.h:92
virtual bool MigrateFromLegacy(wxConfigBase *aLegacyConfig) override
Migrates from wxConfig to JSON-based configuration.
virtual std::string getLegacyFrameName() const override
LAYER_PRESET_3D * FindPreset(const wxString &aName)
std::vector< LAYER_PRESET_3D > m_LayerPresets
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:104
Like a normal param, but with custom getter and setter functions.
Definition: parameters.h:295
std::vector< LAYER_PRESET_3D > * m_presets
void jsonToPresets(const nlohmann::json &aJson)
ANTIALIASING_MODE
Anti-aliasing options.
Definition: ogl_attr_list.h:37
std::vector< KIGFX::COLOR4D > raytrace_lightColor
bool DifferentiatePlatedCopper()
return true if platted copper aeras and non platted copper areas must be drawn using a different colo...
wxString name
A name for this layer set.
LAYER_PRESET_3D(const wxString &aName, const std::bitset< LAYER_3D_END > &aLayers, const std::map< int, KIGFX::COLOR4D > &aColors)
std::bitset< LAYER_3D_END > layers
std::map< int, KIGFX::COLOR4D > colors