esp::gfx::RenderCamera class

Public types

enum class Flag: unsigned int { FrustumCulling = 1 << 0, ObjectsOnly = 1 << 1, ObjectPicking = 1 << 2 }
Rendering Flags.
using Flags = Corrade::Containers::EnumSet<Flag>

Constructors, destructors, conversion operators

RenderCamera(scene::SceneNode& node)
RenderCamera(scene::SceneNode& node, const vec3f& eye, const vec3f& target, const vec3f& up)
~RenderCamera() virtual

Public functions

auto node() -> scene::SceneNode&
auto node() const -> const scene::SceneNode&
auto object() -> scene::SceneNode&
auto object() const -> const scene::SceneNode&
auto setProjectionMatrix(int width, int height, float znear, float zfar, float hfov) -> RenderCamera&
auto draw(MagnumDrawableGroup& drawables, Flags flags = {}) -> uint32_t
Overload function to render the drawables.
auto cull(std::vector<std::pair<std::reference_wrapper<Magnum::SceneGraph::Drawable3D>, Magnum::Matrix4>>& drawableTransforms) -> size_t
performs the frustum culling
auto removeNonObjects(std::vector<std::pair<std::reference_wrapper<Magnum::SceneGraph::Drawable3D>, Magnum::Matrix4>>& drawableTransforms) -> size_t
Cull Drawables for SceneNodes which are not OBJECT type.
auto isRenderingForObjectPicking() -> bool
if the rendering pass is for picking the object (drawable)
auto unproject(const Mn::Vector2i& viewportPosition) -> esp::geo::Ray
Unproject a 2D viewport point to a 3D ray with origin at camera position.

Protected variables

bool renderingForObjectPicking_

Enum documentation

enum class esp::gfx::RenderCamera::Flag: unsigned int

Rendering Flags.

Enumerators
FrustumCulling

Cull Drawables with bounding boxes not intersecting the camera frustum.

ObjectsOnly

Cull Drawables not attached to SceneNodes with scene::SceneNodeType::OBJECT.

ObjectPicking

Render the drawables for object (drawable) picking purpose

Function documentation

uint32_t esp::gfx::RenderCamera::draw(MagnumDrawableGroup& drawables, Flags flags = {})

Overload function to render the drawables.

Parameters
drawables drawable group containing all the drawables
flags
Returns the number of drawables that are drawn

size_t esp::gfx::RenderCamera::cull(std::vector<std::pair<std::reference_wrapper<Magnum::SceneGraph::Drawable3D>, Magnum::Matrix4>>& drawableTransforms)

performs the frustum culling

Parameters
drawableTransforms vector of pairs of Drawable3D object and its absolute transformation
Returns the number of drawables that are not culled

NOTE: user are not encouraged to call this function directly. The preferred way is to enable the frustum culling by calling setFrustumCullingEnabled and then call draw

size_t esp::gfx::RenderCamera::removeNonObjects(std::vector<std::pair<std::reference_wrapper<Magnum::SceneGraph::Drawable3D>, Magnum::Matrix4>>& drawableTransforms)

Cull Drawables for SceneNodes which are not OBJECT type.

Parameters
drawableTransforms vector of pairs of Drawable3D object and its absolute transformation
Returns the number of drawables that are not culled

esp::geo::Ray esp::gfx::RenderCamera::unproject(const Mn::Vector2i& viewportPosition)

Unproject a 2D viewport point to a 3D ray with origin at camera position.

Parameters
viewportPosition The 2D point on the viewport to unproject ([0,width], [0,height]).
Returns a esp::geo::Ray with unit length direction or zero direction if failed.