.. _api_Camera: Camera ====== Inherited: :ref:`Component` .. _api_Camera_description: Description ----------- .. _api_Camera_public: Public Methods -------------- +------------------------------+---------------------------------------------------------------------------+ | :ref:`Ray` | :ref:`castRay` (float x, float y) | +------------------------------+---------------------------------------------------------------------------+ | :ref:`Vector4` | :ref:`color` () const | +------------------------------+---------------------------------------------------------------------------+ | float | :ref:`farPlane` () const | +------------------------------+---------------------------------------------------------------------------+ | float | :ref:`focalDistance` () const | +------------------------------+---------------------------------------------------------------------------+ | float | :ref:`fov` () const | +------------------------------+---------------------------------------------------------------------------+ | :ref:`Frustum` | :ref:`frustum` () const | +------------------------------+---------------------------------------------------------------------------+ | bool | :ref:`isScreenSpace` () const | +------------------------------+---------------------------------------------------------------------------+ | float | :ref:`nearPlane` () const | +------------------------------+---------------------------------------------------------------------------+ | float | :ref:`orthoSize` () const | +------------------------------+---------------------------------------------------------------------------+ | bool | :ref:`orthographic` () const | +------------------------------+---------------------------------------------------------------------------+ | :ref:`Vector3` | :ref:`project` (const Vector3 & worldSpace) const | +------------------------------+---------------------------------------------------------------------------+ | :ref:`Matrix4` | :ref:`projectionMatrix` () const | +------------------------------+---------------------------------------------------------------------------+ | float | :ref:`ratio` () const | +------------------------------+---------------------------------------------------------------------------+ | void | :ref:`setColor` (const Vector4 color) | +------------------------------+---------------------------------------------------------------------------+ | void | :ref:`setFar` (const float distance) | +------------------------------+---------------------------------------------------------------------------+ | void | :ref:`setFocalDistance` (const float focal) | +------------------------------+---------------------------------------------------------------------------+ | void | :ref:`setFov` (const float angle) | +------------------------------+---------------------------------------------------------------------------+ | void | :ref:`setNear` (const float distance) | +------------------------------+---------------------------------------------------------------------------+ | void | :ref:`setOrthoSize` (const float size) | +------------------------------+---------------------------------------------------------------------------+ | void | :ref:`setOrthographic` (const bool mode) | +------------------------------+---------------------------------------------------------------------------+ | void | :ref:`setRatio` (float ratio) | +------------------------------+---------------------------------------------------------------------------+ | void | :ref:`setScreenSpace` (bool mode) | +------------------------------+---------------------------------------------------------------------------+ | :ref:`Vector3` | :ref:`unproject` (const Vector3 & screenSpace) const | +------------------------------+---------------------------------------------------------------------------+ | :ref:`Matrix4` | :ref:`viewMatrix` () const | +------------------------------+---------------------------------------------------------------------------+ .. _api_Camera_static: Static Methods -------------- +---------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Camera` * | :ref:`current` () | +---------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | std::array>` | :ref:`frustumCorners` (const Camera & camera) | +---------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | std::array>` | :ref:`frustumCorners` (bool ortho, float sigma, float ratio, const Vector3 & position, const Quaternion & rotation, float nearPlane, float farPlane) | +---------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`setCurrent` (Camera * current) | +---------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ .. _api_Camera_methods: Methods Description ------------------- .. _api_Camera_b6517ca0: :ref:`Ray` **Camera::castRay** (float *x*, float *y*) Returns ray with origin point in camera position and direction to projection plane with *x* and *y* coordinates. ---- .. _api_Camera_60b37981: :ref:`Vector4` **Camera::color** () const Returns the color with which the screen will be cleared. **See also** setColor(). ---- .. _api_Camera_c903dafb: :ref:`Camera` * **Camera::current** () Returns current active camera. **See also** setCurrent(). ---- .. _api_Camera_d295ea73: float **Camera::farPlane** () const Returns a distance to far cut plane. ---- .. _api_Camera_492f6ce1: float **Camera::focalDistance** () const Returns a focal distance for the camera. **See also** setFocalDistance(). ---- .. _api_Camera_4f76b15c: float **Camera::fov** () const Returns field of view angle for the camera in degrees. **See also** setFov(). ---- .. _api_Camera_eb5c7183: :ref:`Frustum` **Camera::frustum** () const Returns a set of frustum planes. ---- .. _api_Camera_257018fc: std::array>` **Camera::frustumCorners** (:ref:`Camera` & *camera*) Returns frustum corners for the camera. ---- .. _api_Camera_b20d93e8: std::array>` **Camera::frustumCorners** (bool *ortho*, float *sigma*, float *ratio*, :ref:`Vector3` & *position*, :ref:`Quaternion` & *rotation*, float *nearPlane*, float *farPlane*) Returns frustum corners with provided parameters. This function accepts a list of parameters: *ortho* is a flag that points orthographic or perspective camera. *sigma* is an angle of frustum or *ortho* size in the case of an orthographic camera. *ratio* is an aspect ratio. *position* of the frustum in world space. *rotation* of frustum in world space. *nearPlane* clipping plane. *farPlane* clipping plane. ---- .. _api_Camera_c678ed51: bool **Camera::isScreenSpace** () const Returns true is this camera in the screen space mode. Typically used for Editor. ---- .. _api_Camera_1cf53deb: float **Camera::nearPlane** () const Returns a distance to near cut plane. ---- .. _api_Camera_68cfeba2: float **Camera::orthoSize** () const Returns camera size for orthographic mode. **See also** setOrthoSize(). ---- .. _api_Camera_9ef6dc52: bool **Camera::orthographic** () const Returns true for the orthographic mode; for the perspective mode, returns false. **See also** setOrthographic(). ---- .. _api_Camera_1fe49068: :ref:`Vector3` **Camera::project** (:ref:`Vector3` & *worldSpace*) const Transforms position from *worldSpace* into screen space. Returns result of transformation. ---- .. _api_Camera_3ca5fe86: :ref:`Matrix4` **Camera::projectionMatrix** () const Returns projection matrix for the camera. ---- .. _api_Camera_e87c9d14: float **Camera::ratio** () const Returns the aspect ratio (width divided by height). **See also** setRatio(). ---- .. _api_Camera_1bf0a753: void **Camera::setColor** (:ref:`Vector4` *color*) Sets the *color* with which the screen will be cleared. **See also** color(). ---- .. _api_Camera_76fa51b0: void **Camera::setCurrent** (:ref:`Camera` * *current*) Sets *current* active camera. **See also** current(). ---- .. _api_Camera_be49560a: void **Camera::setFar** (float *distance*) Sets a *distance* to far cut plane. ---- .. _api_Camera_ea6095db: void **Camera::setFocalDistance** (float *focal*) Sets a *focal* distance for the camera. **See also** focalDistance(). ---- .. _api_Camera_a17c243e: void **Camera::setFov** (float *angle*) Sets field of view *angle* for the camera in degrees. **Note:** Applicable only for the perspective mode. **See also** fov(). ---- .. _api_Camera_8a3f67d0: void **Camera::setNear** (float *distance*) Sets a *distance* to near cut plane. ---- .. _api_Camera_d6753198: void **Camera::setOrthoSize** (float *size*) Sets camera *size* for orthographic mode. **See also** orthoSize(). ---- .. _api_Camera_63bf2c9e: void **Camera::setOrthographic** (bool *mode*) Sets orthographic mode. **See also** orthographic(). ---- .. _api_Camera_93fcb45a: void **Camera::setRatio** (float *ratio*) Sets the aspect *ratio* (width divided by height). **See also** ratio(). ---- .. _api_Camera_9bed6a41: void **Camera::setScreenSpace** (bool *mode*) Sets the screen space *mode* for the camera. Typically used for Editor. **See also** isScreenSpace(). ---- .. _api_Camera_a7542c83: :ref:`Vector3` **Camera::unproject** (:ref:`Vector3` & *screenSpace*) const Transforms position from *screenSpace* into world space. Returns result of transformation. ---- .. _api_Camera_10e56d4b: :ref:`Matrix4` **Camera::viewMatrix** () const Returns view matrix for the camera.