API Documentation
Camera.h
1 // Camera.h
3 //
5 
6 namespace nkGraphics
7 {
13  class Camera : public Node
14  {
15  public :
16 
17  // Getters
21  float getNear () const ;
25  float getFar () const ;
29  const Frustum& getFrustum () ;
37  float getFov () const ;
41  float getOrthographicHeight () const ;
49  float getAspectRatio () const ;
57  bool getHidden () const ;
61  const nkMaths::Matrix& getViewMatrix () const ;
70 
71  // Setters
75  virtual void setPositionRelative (const nkMaths::Vector& value) override ;
79  virtual void setPositionAbsolute (const nkMaths::Vector& value) override ;
83  virtual void translateRelative (const nkMaths::Vector& value) override ;
87  virtual void translateAbsolute (const nkMaths::Vector& value) override ;
91  virtual void setOrientationRelative (const nkMaths::Quaternion& value) override ;
95  virtual void setOrientationAbsolute (const nkMaths::Quaternion& value) override ;
99  virtual void rotateRelative (const nkMaths::Quaternion& value) override ;
103  virtual void rotateAbsolute (const nkMaths::Quaternion& value) override ;
107  virtual void setScaleRelative (const nkMaths::Vector& value) override ;
111  virtual void setScaleAbsolute (const nkMaths::Vector& value) override ;
115  virtual void applyScale (const nkMaths::Vector& value) override ;
123  void setNear (float value) ;
131  void setFar (float value) ;
139  void setName (const nkMemory::StringView& name) ;
147  void setFov (float radianValue) ;
156  void setOrthographicHeight (float value) ;
170  void setAspectRatio (float widthOnHeight) ;
187  void setAutoUpdateOnContextSwitch (bool value) ;
195  void setHidden (bool value) ;
196 
197  // Updates
212  void lookAt (const nkMaths::Vector& point, const nkMaths::Vector& enforcedUp = nkMaths::Vector(0, 0, 0, 0)) ;
213 
214  // Utilities
253 
254  // Raycast
266  nkMaths::Vector getDirectionAtPixelWorld (int x, int y, RenderContext* fromContext = nullptr) ;
286  nkMaths::Vector getDirectionAtPixelView (int x, int y, RenderContext* fromContext = nullptr) ;
295 
296  // Import / Export
297  virtual void exportClassToTree (nkExport::Node* rootNode) override ;
298  virtual void importClassFromTree (nkExport::Node* rootNode) override ;
299 
300  public :
301 
302  // Statics
310  static nkMemory::UniquePtr<Camera> create (System* system = nullptr) ;
311  } ;
312 }
nkGraphics::Camera::getDirectionAtPixelView
nkMaths::Vector getDirectionAtPixelView(int x, int y, RenderContext *fromContext=nullptr)
nkGraphics::Camera::setNear
void setNear(float value)
nkGraphics::Camera::setAutoUpdateOnContextSwitch
void setAutoUpdateOnContextSwitch(bool value)
nkGraphics::Camera::lookAt
void lookAt(const nkMaths::Vector &point, const nkMaths::Vector &enforcedUp=nkMaths::Vector(0, 0, 0, 0))
nkGraphics::Camera::setFar
void setFar(float value)
nkGraphics::Camera::getOrthographicHeight
float getOrthographicHeight() const
nkGraphics::Camera::setHidden
void setHidden(bool value)
nkGraphics::Camera::getProjectionMatrix
const nkMaths::Matrix & getProjectionMatrix() const
nkGraphics::Camera::setPositionAbsolute
virtual void setPositionAbsolute(const nkMaths::Vector &value) override
nkGraphics::Camera::setOrthographicHeight
void setOrthographicHeight(float value)
nkGraphics::System
Main interface with the component system.
Definition: System.h:14
nkGraphics::Camera::updateViewMatrix
void updateViewMatrix()
nkGraphics::Camera::exportClassToTree
virtual void exportClassToTree(nkExport::Node *rootNode) override
nkGraphics::Camera
Offers all controls to model a camera.
Definition: Camera.h:14
nkGraphics::Camera::create
static nkMemory::UniquePtr< Camera > create(System *system=nullptr)
nkGraphics::Camera::rotateRelative
virtual void rotateRelative(const nkMaths::Quaternion &value) override
nkGraphics::Camera::getFar
float getFar() const
nkGraphics::Camera::getFov
float getFov() const
nkGraphics::Camera::getViewMatrix
const nkMaths::Matrix & getViewMatrix() const
nkMaths::Quaternion
A quaternion, symbolizing rotations as a 4D vector.
Definition: Quaternion.h:14
nkGraphics::Camera::getFarPlanePoints
void getFarPlanePoints(nkMaths::Vector &a, nkMaths::Vector &b, nkMaths::Vector &c, nkMaths::Vector &d)
nkGraphics::Camera::getAutoUpdateOnContextSwitch
bool getAutoUpdateOnContextSwitch() const
nkGraphics::Camera::getNearPlanePoints
void getNearPlanePoints(nkMaths::Vector &a, nkMaths::Vector &b, nkMaths::Vector &c, nkMaths::Vector &d)
nkGraphics::Camera::getAspectRatio
float getAspectRatio() const
nkGraphics::Camera::setAspectRatio
void setAspectRatio(float widthOnHeight)
nkGraphics::Camera::setProjectionType
void setProjectionType(PROJECTION_TYPE value)
nkMaths::Matrix
Represents a 4x4 float matrix.
Definition: Matrix.h:14
nkGraphics::RenderContext
A rendering context, attached to a window or an offscreen texture.
Definition: RenderContext.h:14
nkGraphics::Camera::getFrustum
const Frustum & getFrustum()
nkGraphics::Camera::translateRelative
virtual void translateRelative(const nkMaths::Vector &value) override
nkGraphics::Camera::getDirectionAtScreenCoordView
nkMaths::Vector getDirectionAtScreenCoordView(float x, float y)
nkGraphics::Camera::translateAbsolute
virtual void translateAbsolute(const nkMaths::Vector &value) override
nkGraphics::Camera::applyScale
virtual void applyScale(const nkMaths::Vector &value) override
nkGraphics::Camera::prepareForContext
void prepareForContext(RenderContext *context)
nkGraphics::Camera::getDirectionAtPixelWorld
nkMaths::Vector getDirectionAtPixelWorld(int x, int y, RenderContext *fromContext=nullptr)
nkGraphics::Camera::getDirectionAtScreenCoordWorld
nkMaths::Vector getDirectionAtScreenCoordWorld(float x, float y)
nkGraphics::Camera::getName
nkMemory::StringView getName() const
nkExport::Node
A node in the tree structure representing the data to export / import.
Definition: Node.h:42
nkGraphics::Camera::rotateAbsolute
virtual void rotateAbsolute(const nkMaths::Quaternion &value) override
nkGraphics::Camera::importClassFromTree
virtual void importClassFromTree(nkExport::Node *rootNode) override
nkMemory::UniquePtr
Smart pointer owning the object instance it encapsulates.
Definition: UniquePtr.h:17
nkGraphics::Camera::updateProjectionMatrix
void updateProjectionMatrix()
nkGraphics::Camera::getHidden
bool getHidden() const
nkMemory::StringView
Class holding information about a string, with no ownership over the data.
Definition: StringView.h:22
nkGraphics::Camera::getFrustumCornersDirectionsWorld
void getFrustumCornersDirectionsWorld(nkMaths::Vector &a, nkMaths::Vector &b, nkMaths::Vector &c, nkMaths::Vector &d)
nkGraphics::Camera::setPositionRelative
virtual void setPositionRelative(const nkMaths::Vector &value) override
nkGraphics::Camera::setScaleRelative
virtual void setScaleRelative(const nkMaths::Vector &value) override
nkGraphics::Camera::getViewProjMatrix
nkMaths::Matrix getViewProjMatrix() const
nkGraphics::Frustum
Defines a frustum.
Definition: Frustum.h:16
nkGraphics::Camera::getNear
float getNear() const
nkGraphics::Camera::setScaleAbsolute
virtual void setScaleAbsolute(const nkMaths::Vector &value) override
nkGraphics::Camera::getProjectionType
PROJECTION_TYPE getProjectionType() const
nkGraphics::Node
Represents a node in a scene graph.
Definition: Node.h:16
nkGraphics::Camera::setFov
void setFov(float radianValue)
nkGraphics
Encompasses all API of component NilkinsGraphics.
Definition: BoundingBox.h:7
nkGraphics::Camera::setOrientationAbsolute
virtual void setOrientationAbsolute(const nkMaths::Quaternion &value) override
nkGraphics::PROJECTION_TYPE
PROJECTION_TYPE
Lists all possible projection types for a camera.
Definition: ProjectionType.h:12
nkGraphics::Camera::getFrustumCornersDirectionsView
void getFrustumCornersDirectionsView(nkMaths::Vector &a, nkMaths::Vector &b, nkMaths::Vector &c, nkMaths::Vector &d)
nkMaths::Vector
A 4-component vector class, with floats.
Definition: Vector.h:12
nkGraphics::Camera::setName
void setName(const nkMemory::StringView &name)
nkGraphics::Camera::setOrientationRelative
virtual void setOrientationRelative(const nkMaths::Quaternion &value) override