22#ifndef PANEL_PREVIEW_3D_MODEL_H
23#define PANEL_PREVIEW_3D_MODEL_H
42#define MAX_SCALE 10000.0
43#define MAX_ROTATION 180.0
44#define MAX_OFFSET 1000.0
46#define SCALE_INCREMENT_FINE 0.02
47#define SCALE_INCREMENT 0.1
49#define ROTATION_INCREMENT 90
50#define ROTATION_INCREMENT_FINE 1
52#define OFFSET_INCREMENT_MM 0.5
53#define OFFSET_INCREMENT_MM_FINE 0.1
55#define OFFSET_INCREMENT_MIL 25.0
56#define OFFSET_INCREMENT_MIL_FINE 5.0
69#if defined(__linux__) || defined(__FreeBSD__)
75#define PANEL_PREVIEW_3D_MODEL_ID wxID_HIGHEST + 1244
81 std::vector<FP_3DMODEL>* aParentModelList );
121 void onAlign( wxCommandEvent& aEvent )
override;
310#if defined(__linux__) || defined(__FreeBSD__)
Helper class to handle information needed to display 3D board.
Information pertinent to a Pcbnew printed circuit board.
A class used to derive camera objects from.
Implement a canvas based on a wxGLCanvas.
Provide an extensible class to resolve 3D model paths.
PANEL_PREVIEW_3D_MODEL_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(-1,-1), long style=wxTAB_TRAVERSAL, const wxString &name=wxEmptyString)
void View3DTop(wxCommandEvent &event) override
void dismissAlignmentInfoBar()
VECTOR3D m_alignAnimFromOffset
const S3DMODEL * m_alignGeometry
void tickAlignmentAnimation()
wxString formatOffsetValue(double aValue)
void onAlign(wxCommandEvent &aEvent) override
void onMouseWheelRot(wxMouseEvent &event) override
void View3DSettings(wxCommandEvent &event) override
size_t m_dummySelectedModel
Selected model in the dummy footprint.
void onOpacitySlider(wxCommandEvent &event) override
void View3DFront(wxCommandEvent &event) override
void onDecrementRot(wxSpinEvent &event) override
void onIncrementScale(wxSpinEvent &event) override
void setBodyStyleView(wxCommandEvent &event) override
void hoverAlignment(const std::optional< RAY > &aRay)
void evalRotationValue(TEXT_CTRL_EVAL *aRotationControl)
void onMouseWheelScale(wxMouseEvent &event) override
EDA_3D_VIEWER_SETTINGS::RENDER_SETTINGS m_initialRender
The 3d viewer Render initial settings (must be saved and restored)
std::vector< SFVEC3F > m_alignFaceTriangles
Picked face, kept until the move finishes.
void UpdateDummyFootprint(bool aRelaodRequired=true)
Copy shapes from the current shape list which are flagged for preview to the copy of footprint that i...
~PANEL_PREVIEW_3D_MODEL()
void syncLocalEmbeddedFiles()
wxString formatScaleValue(double aValue)
void doIncrementRotation(wxSpinEvent &aEvent, double aSign)
void refreshAlignmentView()
void loadSettings()
Load 3D relevant settings from the user configuration.
glm::mat4 alignmentModelMatrix() const
Transform carrying the selected model's geometry into world units.
std::optional< bool > m_alignBodyShown
void View3DBack(wxCommandEvent &event) override
void onAlignKey(wxKeyEvent &aEvent)
void onAlignUpdateUI(wxUpdateUIEvent &aEvent) override
VECTOR3D m_alignAnimRotation
void OnMenuEvent(wxMenuEvent &aEvent)
The TOOL_DISPATCHER needs these to work around some issues in wxWidgets where the menu events aren't ...
WX_INFOBAR * m_alignmentInfoBar
void onUnitsChanged(wxCommandEvent &aEvent)
BOARD_ADAPTER & GetAdapter()
void doIncrementOffset(wxSpinEvent &aEvent, double aSign)
wxWindow * GetToolCanvas() const override
Canvas access.
BOARD_ADAPTER m_boardAdapter
ALIGN_STATE m_alignState
Index into m_parentInfoList.
void startAlignmentAnimation(const VECTOR3D &aRotation, const VECTOR3D &aOffset)
Slide the preview from its current placement to the solved one.
void onIncrementOffset(wxSpinEvent &event) override
std::vector< SFVEC3F > alignmentRegionTriangles(size_t aRegion) const
Model-space triangle soup of one region, for the selection overlay.
PANEL_PREVIEW_3D_MODEL(wxWindow *aParent, PCB_BASE_FRAME *aFrame, FOOTPRINT *aFootprint, std::vector< FP_3DMODEL > *aParentModelList)
FOOTPRINT * GetDummyFootprint() const
Get the dummy footprint that is used for previewing the 3D model.
std::vector< MODEL_ALIGN::REGION > m_alignRegions
void onAlignAnimation(wxTimerEvent &aEvent)
void updateAlignmentOverlays()
Push the selection and roll-over overlays to the canvas.
std::optional< size_t > alignmentRegionAt(const RAY &aRay)
Region under the ray, as an index into m_alignRegions.
std::vector< SFVEC3F > alignmentPadTriangles(const PAD &aPad) const
World-space triangle soup covering a pad's copper shape.
const PAD * m_alignHoverPad
VECTOR3D m_alignAnimFromRotation
void onDecrementOffset(wxSpinEvent &event) override
PCB_BASE_FRAME * m_parentFrame
void SetEmbeddedFilesDelegate(EMBEDDED_FILES *aDelegate)
EDA_3D_CANVAS * m_previewPane
EXTRUDED_3D_BODY * m_extrudedBody
void SetExtrusionTransformMode(EXTRUDED_3D_BODY *aBody)
void doIncrementScale(wxSpinEvent &aEvent, double aSign)
bool pickAlignment(const RAY &aRay)
void View3DLeft(wxCommandEvent &event) override
void updateOrientation(wxCommandEvent &event) override
It will receive the events from editing the fields.
const S3DMODEL * alignmentModel()
void View3DISO(wxCommandEvent &event) override
wxString formatRotationValue(double aValue)
void onMouseWheelOffset(wxMouseEvent &event) override
std::optional< size_t > m_alignHoverRegion
std::optional< std::bitset< LAYER_3D_END > > m_alignLayers
std::unique_ptr< NL_FOOTPRINT_PROPERTIES_PLUGIN > m_spaceMouse
void restoreAlignmentView()
FOOTPRINT * m_dummyFootprint
void View3DBottom(wxCommandEvent &event) override
TRACK_BALL m_trackBallCamera
std::vector< MODEL_ALIGN::ALIGN_SOLUTION > m_alignSolutions
void onDecrementScale(wxSpinEvent &event) override
std::map< std::array< unsigned int, 2 >, size_t > m_alignTriangleRegions
void onIncrementRot(wxSpinEvent &event) override
void onPanelShownEvent(wxCommandEvent &aEvent)
void stopAlignmentAnimation()
EMBEDDED_FILES * m_localEmbeddedFiles
VECTOR3D m_alignAnimOffset
void SetSelectedModel(int idx)
Set the currently selected index in the model list so that the scale/rotation/offset controls can be ...
void View3DRight(wxCommandEvent &event) override
std::vector< FP_3DMODEL > * m_parentModelList
CAMERA & GetCurrentCamera()
void View3DUpdate(wxCommandEvent &event) override
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
Cache for storing the 3D shapes.
wxTextCtrl wrapper to handle math expression evaluation.
A modified version of the wxInfoBar class that allows us to:
wxDECLARE_EVENT(wxCUSTOM_PANEL_SHOWN_EVENT, wxCommandEvent)
Store the a model based on meshes and materials.
Declaration for a track ball camera.
VECTOR3< double > VECTOR3D