46 std::vector<FP_3DMODEL>* aParentModelList ) :
48 m_previewPane( nullptr ),
51 m_currentCamera( m_trackBallCamera ),
78 wxSpinButton* spinButtonList[] =
85 for( wxSpinButton* button : spinButtonList )
86 button->SetRange(INT_MIN, INT_MAX );
97 aFrame->
Prj().Get3DCacheManager() );
126 for( wxEventType eventType : { wxEVT_MENU_OPEN, wxEVT_MENU_CLOSE, wxEVT_MENU_HIGHLIGHT } )
139 wxSize borderFix = wxSize( 4, 4 );
171 wxCHECK_RET(
m_previewPane, wxT(
"Cannot load settings to null canvas" ) );
188 aTarget.r = aColor.
r;
189 aTarget.g = aColor.
g;
190 aTarget.b = aColor.
b;
191 aTarget.a = aColor.
a;
265 aValue /= 25.4 / 1e3;
300 xscale->ChangeValue( wxEmptyString );
301 yscale->ChangeValue( wxEmptyString );
302 zscale->ChangeValue( wxEmptyString );
304 xrot->ChangeValue( wxEmptyString );
305 yrot->ChangeValue( wxEmptyString );
306 zrot->ChangeValue( wxEmptyString );
308 xoff->ChangeValue( wxEmptyString );
309 yoff->ChangeValue( wxEmptyString );
310 zoff->ChangeValue( wxEmptyString );
359 wxSpinButton* spinCtrl = (wxSpinButton*) event.GetEventObject();
361 wxTextCtrl * textCtrl =
xscale;
371 curr_value = std::max( 1/
MAX_SCALE, curr_value );
372 curr_value = std::min( curr_value,
MAX_SCALE );
380 wxSpinButton* spinCtrl = (wxSpinButton*) aEvent.GetEventObject();
381 wxTextCtrl* textCtrl =
xrot;
400 wxSpinButton* spinCtrl = (wxSpinButton*) event.GetEventObject();
402 wxTextCtrl * textCtrl =
xoff;
417 curr_value_mm += ( step_mm * aSign );
418 curr_value_mm = std::max( -
MAX_OFFSET, curr_value_mm );
419 curr_value_mm = std::min( curr_value_mm,
MAX_OFFSET );
427 wxTextCtrl* textCtrl = (wxTextCtrl*) event.GetEventObject();
431 if( event.ShiftDown( ) )
434 if( event.GetWheelRotation() >= 0 )
440 curr_value = std::max( 1/
MAX_SCALE, curr_value );
441 curr_value = std::min( curr_value,
MAX_SCALE );
449 wxTextCtrl* textCtrl = (wxTextCtrl*) event.GetEventObject();
453 if( event.ShiftDown( ) )
456 if( event.GetWheelRotation() >= 0 )
471 wxTextCtrl* textCtrl = (wxTextCtrl*) event.GetEventObject();
475 if( event.ShiftDown( ) )
482 if( event.ShiftDown( ) )
486 if( event.GetWheelRotation() >= 0 )
491 curr_value_mm += step_mm;
492 curr_value_mm = std::max( -
MAX_OFFSET, curr_value_mm );
493 curr_value_mm = std::min( curr_value_mm,
MAX_OFFSET );
509 if( aReloadRequired )
void SetSelectedModel(int idx)
Set the currently selected index in the model list so that the scale/rotation/offset controls can be ...
wxSpinButton * m_spinYoffset
wxSpinButton * m_spinZscale
EDA_UNITS m_userUnits
Index into m_parentInfoList.
#define OFFSET_INCREMENT_MM_FINE
BOARD_ADAPTER m_boardAdapter
wxSpinButton * m_spinZrot
wxSpinButton * m_spinYrot
wxBitmapButton * m_bpvLeft
SFVEC4F m_SilkScreenColorBot
in realistic mode: SilkScreen color ( bot )
EDA_3D_CANVAS * m_previewPane
void UpdateDummyFootprint(bool aRelaodRequired=true)
Copy shapes from the current shape list which are flagged for preview to the copy of footprint that i...
Implementation of conversion functions that require both schematic and board internal units.
#define OFFSET_INCREMENT_MIL_FINE
void doIncrementRotation(wxSpinEvent &aEvent, double aSign)
#define ROTATION_INCREMENT_WHEEL_FINE
static constexpr double IU_PER_MM
Mock up a conversion function.
wxString formatOffsetValue(double aValue)
void SetFlag(DISPLAY3D_FLG aFlag, bool aState)
Set the status of a flag.
wxSpinButton * m_spinXrot
SFVEC4F m_SolderMaskColorTop
in realistic mode: solder mask color ( top )
void SetProjectionMode(int aMode)
Implement a canvas based on a wxGLCanvas.
SFVEC4F m_BoardBodyColor
in realistic mode: FR4 board color
SFVEC4F m_SolderPasteColor
in realistic mode: solder paste color
SFVEC4F m_SolderMaskColorBot
in realistic mode: solder mask color ( bot )
wxString GetAbbreviatedUnitsLabel(EDA_UNITS aUnit, EDA_DATA_TYPE aType)
Get the units string for a given units type.
std::vector< FP_3DMODEL > * m_parentModelList
Declaration of the cogl_att_list class.
#define ROTATION_INCREMENT
void Request_refresh(bool aRedrawImmediately=true)
Schedule a refresh update of the canvas.
void SetAnimationEnabled(bool aEnable)
Enable or disable camera animation when switching to a pre-defined view.
int moving_speed_multiplier
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
static const int * GetAttributesList(ANTIALIASING_MODE aAntiAliasingMode)
Get a list of attributes to pass to wxGLCanvas.
VECTOR3D m_Offset
3D model offset (mm)
wxBitmapButton * m_bpUpdate
Class to handle configuration and automatic determination of the DPI scale to use for canvases.
void updateOrientation(wxCommandEvent &event) override
It will receive the events from editing the fields.
void SetBoard(BOARD *aBoard) noexcept
Set current board to be rendered.
wxBitmapButton * m_bpvBack
void onOpacitySlider(wxCommandEvent &event) override
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT) override
Adds an item to the container.
void onMouseWheelScale(wxMouseEvent &event) override
void SetInfoBar(WX_INFOBAR *aInfoBar)
SFVEC4F m_BgColorTop
background top color
void SetEventDispatcher(TOOL_DISPATCHER *aEventDispatcher)
Set a dispatcher that processes events and forwards them to tools.
void onMouseWheelRot(wxMouseEvent &event) override
wxSpinButton * m_spinXoffset
wxSpinButton * m_spinXscale
#define OFFSET_INCREMENT_MM
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
#define OFFSET_INCREMENT_MIL
VECTOR3D m_Scale
3D model scaling factor (dimensionless)
wxString formatRotationValue(double aValue)
void SetMaterialMode(MATERIAL_MODE aMaterialMode) noexcept
wxBitmapButton * m_bpvFront
SFVEC4F m_BgColorBot
background bottom color
wxString formatScaleValue(double aValue)
wxSpinButton * m_spinYscale
wxBitmap KiBitmap(BITMAPS aBitmap, int aHeightTag)
Construct a wxBitmap from an image identifier Returns the image from the active theme if the image ha...
void SetMovingSpeedMultiplier(int aMultiplier)
Set the camera animation moving speed multiplier option.
void SetRenderEngine(RENDER_ENGINE aRenderEngine) noexcept
wxBitmapButton * m_bpvRight
static double rotationFromString(const wxString &aValue)
Ensure -MAX_ROTATION <= rotation <= MAX_ROTATION.
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
A modified version of the wxInfoBar class that allows us to:
COLOR4D GetColor(int aLayer) const
PANEL_PREVIEW_3D_MODEL(wxWindow *aParent, PCB_BASE_FRAME *aFrame, FOOTPRINT *aFootprint, std::vector< FP_3DMODEL > *aParentModelList)
wxBitmapButton * m_bpvBottom
VECTOR3D m_Rotation
3D model rotation (degrees)
void loadSettings()
Load 3D relevant settings from the user configuration.
wxBitmapButton * m_bpvISO
Information pertinent to a Pcbnew printed circuit board.
SFVEC4F m_CopperColor
in realistic mode: copper color
void doIncrementScale(wxSpinEvent &aEvent, double aSign)
FOOTPRINT * m_dummyFootprint
wxBitmapButton * m_bpvTop
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
void SetScaleFactor(double aFactor)
Set the canvas scale factor, probably for a hi-DPI display.
void OnMenuEvent(wxMenuEvent &aEvent)
The TOOL_DISPATCHER needs these to work around some issues in wxWidgets where the menu events aren't ...
void onMouseWheelOffset(wxMouseEvent &event) override
void ReloadRequest(BOARD *aBoard=nullptr, S3D_CACHE *aCachePointer=nullptr)
Color settings are a bit different than most of the settings objects in that there can be more than o...
SFVEC4F m_SilkScreenColorTop
in realistic mode: SilkScreen color ( top )
double DoubleValueFromString(EDA_UNITS aUnits, const wxString &aTextValue, EDA_DATA_TYPE aType)
Function DoubleValueFromString converts aTextValue to a double.
wxBoxSizer * m_SizerPanelView
#define SCALE_INCREMENT_FINE
wxSpinButton * m_spinZoffset
#define RANGE_SCALE_3D
This defines the range that all coord will have to be rendered.
Class PANEL_PREVIEW_3D_MODEL_BASE.
#define ROTATION_INCREMENT_WHEEL
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
void doIncrementOffset(wxSpinEvent &aEvent, double aSign)
EDA_UNITS GetUserUnits() const
Return the user units currently in use.
void SetBoardUse(BOARD_USE aUse)
Set what the board is going to be used for.
~PANEL_PREVIEW_3D_MODEL()
A color representation with 4 components: red, green, blue, alpha.