JMEditorEnvironment
Loading...
Searching...
No Matches
ObjectViewer Class Reference

#include <ObjectViewer.h>

Public Member Functions

 ObjectViewer (SimEnvironment *Handler, JMwindow *Window, float PosX, float PosY, float SizeX, float SizeY)
 ObjectViewer (ObjectViewer &)=delete
ObjectVieweroperator= (const ObjectViewer &)=delete
 ObjectViewer (ObjectViewer &&)=default
ObjectVieweroperator= (ObjectViewer &&)=default
void display ()
void setPos (float x, float y)
void setSize (float x, float y)
void focusOnObject (SimObject *obj)
 Moves the camera to point at a specific object.
void focusOnCoord (float x, float y, float z)
 Moves the camera to point at a specific location.
float checkMouseOverObject (SimObject *obj)
 Returns the distance from the camera to the object if the mouse is over it, else returns -1.0f. Is kind of expensive, not recomended to call every frame.
bool mouseOver () const
 returns true if the mouse is over the viewer.
bool transformingInViewport () const
 Returns true if an object is being translated, rotated or scaled in the viewport.

Public Attributes

float axisDispSize = 80.0f
 size of the x, y and z axis display in the lower left corner.
float rotSesitivity = 1.0f
 the mouse sensitivity when rotating the view
float zoomSensitivity = 1.0f
 the scoll wheel sensitivity when zooming
float gridSpacing = 100.0f
 the spacing of the grid lines that are displayed in the 3D viewport. Set this before calling display() for the first time.
glm::vec4 gridColor = glm::vec4(0.1f, 0.1f, 0.1f, 1.0f)
 the color of the grid lines that are displayed in the 3D viewport. Set this before calling display() for the first time.
bool spin = false
 if set to true, the view will slowly rotate until any mouse input is recieved.
JMwindow * window = nullptr
JMGraphics * gr = nullptr
RenderEnvironment * rEnvironment = nullptr
unsigned int translateKey = GLFW_KEY_T
 Starts translating the selected object if pressed.
unsigned int rotateKey = GLFW_KEY_R
 Starts rotating the selected object if pressed.
unsigned int scaleKey = GLFW_KEY_S
 Starts scaling the selected object if pressed.
float * xSizeRef = nullptr
 If this is not nullptr, the size will be automatically changed when this changes.
float * ySizeRef = nullptr
 If this is not nullptr, the size will be automatically changed when this changes.
float * xPosRef = nullptr
 If this is not nullptr, the position will be automatically changed when this changes.
float * yPosRef = nullptr
 If this is not nullptr, the position will be automatically changed when this changes.

Detailed Description

A 3D evnironment rendered on a seperate thread that displays the SimObjects contained in a SimEnvironment instance. Allows the user to navigate the 3D environment as well as select and transform the SimObjects.


The documentation for this class was generated from the following file: