Estella 0.113.0
A fast 2D and 3D game engine powered by WebAssembly and ECS
Loading...
Searching...
No Matches
esengine::CameraView Struct Reference

What every plugin needs to know about the camera, derived once per collect from the inverse view-projection — the single source for parallax, world-rect culling and the depth draws are sorted by (each previously re-derived, or in the depth's case assumed, inside the plugins). More...

#include <RenderTypePlugin.hpp>

Public Member Functions

f32 viewDepth (const glm::vec3 &worldPos) const
 How near worldPos is to the viewer, larger = nearer — the order the sort key wants, and the one world z gives only while the camera looks down -Z. Orthographic projects onto the viewer direction (head-on that is worldPos.z exactly); perspective answers with -distance to the eye.

Public Attributes

f32 left = 0.0f
f32 bottom = 0.0f
f32 right = 0.0f
f32 top = 0.0f
glm::vec2 center {0.0f}
glm::vec2 parallaxCenter {0.0f}
glm::vec4 eye {0.0f, 0.0f, 1.0f, 0.0f}

Detailed Description

What every plugin needs to know about the camera, derived once per collect from the inverse view-projection — the single source for parallax, world-rect culling and the depth draws are sorted by (each previously re-derived, or in the depth's case assumed, inside the plugins).

Definition at line 110 of file RenderTypePlugin.hpp.

Member Function Documentation

◆ viewDepth()

f32 esengine::CameraView::viewDepth ( const glm::vec3 & worldPos) const
inline

How near worldPos is to the viewer, larger = nearer — the order the sort key wants, and the one world z gives only while the camera looks down -Z. Orthographic projects onto the viewer direction (head-on that is worldPos.z exactly); perspective answers with -distance to the eye.

Definition at line 128 of file RenderTypePlugin.hpp.

References eye.

Referenced by esengine::MeshPlugin::collect(), esengine::ShapePlugin::collect(), and esengine::TrailPlugin::collect().

Member Data Documentation

◆ bottom

f32 esengine::CameraView::bottom = 0.0f

◆ center

glm::vec2 esengine::CameraView::center {0.0f}

Definition at line 112 of file RenderTypePlugin.hpp.

Referenced by esengine::computeCameraView().

◆ eye

glm::vec4 esengine::CameraView::eye {0.0f, 0.0f, 1.0f, 0.0f}

Where the frame is seen from, in FrameConstants::camera's convention: the eye's world position when w = 1, or the unit direction pointing at the viewer when w = 0. From cameraFromViewProjection, as the shaders' copy is.

Definition at line 120 of file RenderTypePlugin.hpp.

Referenced by esengine::MeshPlugin::collect(), esengine::ParticlePlugin::collect(), esengine::computeCameraView(), esengine::towardViewer(), and viewDepth().

◆ left

f32 esengine::CameraView::left = 0.0f

◆ parallaxCenter

glm::vec2 esengine::CameraView::parallaxCenter {0.0f}

The point parallax layers are offset by, from the render origin: the view's own centre, unless a ParallaxAnchor stands in for it (the editor's view, which shows layers where the GAME camera puts them).

Definition at line 115 of file RenderTypePlugin.hpp.

Referenced by esengine::TilemapRenderPlugin::collect(), esengine::computeCameraView(), and esengine::parallaxedWorldPosition().

◆ right

f32 esengine::CameraView::right = 0.0f

◆ top

f32 esengine::CameraView::top = 0.0f

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