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

#include <RenderTypePlugin.hpp>

Classes

struct  LodView
 Which view is looking, where its level choices are kept, and where the selections it makes are counted. More...

Public Member Functions

i32 treeLayer (Entity entity, i32 authored) const
 The layer entity draws at: its place in a Canvas's tree, unless its author named one.
bool castsIntoView (const glm::vec3 &centre, f32 radius)
 Whether a caster bounded by a sphere can shade anything the camera sees. True where this collect asks no such thing.
bool isOverlay () const
 Whether this collect is the frame's screen overlay.
bool accepts (Entity entity) const
 Whether entity belongs to THIS collect.
bool visible (const glm::vec3 &centre, const glm::vec3 &halfExtents, bool depthTested)
 Whether a renderable bounded by centre / halfExtents is drawn.
f32 sortDepth (const glm::vec3 &worldPos) const
 The sort depth of a draw anchored at worldPos.

Public Attributes

ecs::Registry & registry
const Frustum & frustum
const ClipState & clip_state
TransientBufferPool & buffer_pool
DrawList & draw_list
RenderFrameContext & frame_context
CameraView camera
const std::unordered_set< u32 > * screen_ui = nullptr
 The entities the SCREEN owns (UISystem::screenDomain), or null.
const std::vector< u32 > * screen_root_by_index = nullptr
 With only_root: by entity index, the screen root each entity of the domain draws under (ecs::UISystem::screenRootOf).
u32 only_root = 0
 Nonzero: this collect is one screen root's, and an entity of the domain under any other root is not its to draw.
const std::unordered_map< u32, i32 > * ui_tree_layers = nullptr
 The layer of each emitter and plain Sprite a Canvas holds, by entity id, or null.
const OcclusionView * occlusion = nullptr
 What this view is already blocked by, or null for a collect that must not ask — a shadow face looks from a light, and a camera's answer about what a camera cannot see says nothing about it.
Entity excluded = INVALID_ENTITY
const std::unordered_set< u32 > * selection = nullptr
 A motion collect that draws the editor's selection mask instead (RenderFrame::collectSelection): only these entities (by Entity::id()), opaque or not, each at where it stands now, so the motion program writes coverage and depth and no movement. Null for every other collect.
CasterSplit casters = CasterSplit::All
const Frustum * shadowReceivers = nullptr
 A sun's shadow map only: the camera's frustum, which is what its shadows are worth drawing for, and the way the rays travel.
glm::vec3 shadowRay {0.0f, -1.0f, 0.0f}
f32 shadowFloor = 0.0f
f32 shadowReachCap = 0.0f
u32 shadowCulled = 0
 How many casters that left out.
u32 culled = 0
 How many renderables this collect's frustum rejected.
u32 occluded = 0
 How many of those culled an OCCLUDER refused.
u32 lightsSpared = 0
 Light slots the lit quads of this collect were spared: per quad, the loop lights that cannot reach it.
LodView lod
ShadingMode shading = ShadingMode::Shaded
 How the meshes of THIS collect are shaded. Shaded unless the view asked for another mode; a collect that is not a camera's (the shadow map) leaves it alone, because a depth write has no colour to override.
WeightTarget weights
 The one skinned draw this view colours by a joint's weights, if any.

Detailed Description

Definition at line 278 of file RenderTypePlugin.hpp.

Member Function Documentation

◆ accepts()

bool esengine::RenderCollectContext::accepts ( Entity entity) const
inline

Whether entity belongs to THIS collect.

One predicate, not a test on each side: the two collects partition the world, and two tests drifting apart is how something is drawn twice — or by nobody, which is what a 3D HUD was.

Definition at line 361 of file RenderTypePlugin.hpp.

References excluded, esengine::Entity::id(), esengine::Entity::index(), isOverlay(), only_root, screen_root_by_index, and screen_ui.

Referenced by esengine::ParticlePlugin::collect(), esengine::SpritePlugin::collect(), and esengine::UIElementPlugin::collect().

◆ castsIntoView()

bool esengine::RenderCollectContext::castsIntoView ( const glm::vec3 & centre,
f32 radius )
inline

Whether a caster bounded by a sphere can shade anything the camera sees. True where this collect asks no such thing.

Definition at line 342 of file RenderTypePlugin.hpp.

References shadowCulled, shadowFloor, shadowRay, shadowReachCap, and shadowReceivers.

Referenced by esengine::MeshPlugin::collect().

◆ isOverlay()

bool esengine::RenderCollectContext::isOverlay ( ) const
inline

Whether this collect is the frame's screen overlay.

Definition at line 352 of file RenderTypePlugin.hpp.

References frame_context, and esengine::ScreenOverlay.

Referenced by accepts(), esengine::ParticlePlugin::collect(), esengine::TextPlugin::collect(), esengine::UIElementPlugin::collect(), sortDepth(), and visible().

◆ sortDepth()

f32 esengine::RenderCollectContext::sortDepth ( const glm::vec3 & worldPos) const
inline

The sort depth of a draw anchored at worldPos.

One value for every screen draw: their order is the UI tree's (layer = UI_BASE_LAYER + uiOrder), so a z left on a screen root's transform cannot outrank its siblings.

Definition at line 397 of file RenderTypePlugin.hpp.

References camera, and isOverlay().

Referenced by esengine::ParticlePlugin::collect(), esengine::SpritePlugin::collect(), and esengine::UIElementPlugin::collect().

◆ treeLayer()

i32 esengine::RenderCollectContext::treeLayer ( Entity entity,
i32 authored ) const
inline

The layer entity draws at: its place in a Canvas's tree, unless its author named one.

0 is the default, and says nothing. A layer named outright is the way to hold something over or under a whole UI.

Definition at line 307 of file RenderTypePlugin.hpp.

References esengine::Entity::id(), and ui_tree_layers.

Referenced by esengine::ParticlePlugin::collect(), and esengine::SpritePlugin::collect().

◆ visible()

bool esengine::RenderCollectContext::visible ( const glm::vec3 & centre,
const glm::vec3 & halfExtents,
bool depthTested )
inline

Whether a renderable bounded by centre / halfExtents is drawn.

TWO questions, one answer: outside the view, and inside it behind something solid. depthTested admits the second — an occluder may refuse only a draw a DEPTH TEST would have hidden anyway, since one that ignores depth paints over the wall and really is seen.

Definition at line 378 of file RenderTypePlugin.hpp.

References frustum, isOverlay(), occluded, and occlusion.

Referenced by esengine::MeshPlugin::collect(), esengine::SpritePlugin::collect(), esengine::TextPlugin::collect(), and esengine::UIElementPlugin::collect().

Member Data Documentation

◆ buffer_pool

◆ camera

◆ casters

CasterSplit esengine::RenderCollectContext::casters = CasterSplit::All

Definition at line 326 of file RenderTypePlugin.hpp.

Referenced by esengine::MeshPlugin::collect().

◆ clip_state

◆ culled

u32 esengine::RenderCollectContext::culled = 0

How many renderables this collect's frustum rejected.

Written by the plugins at their continue: a cull leaves no draw and no pixel, so where it happens is the only place to count it. Counts THIS collect — a shadow face has a context of its own, and what its frustum skipped is render.shadow.collects.

Definition at line 409 of file RenderTypePlugin.hpp.

Referenced by esengine::MeshPlugin::collect(), esengine::ShapePlugin::collect(), esengine::SpritePlugin::collect(), esengine::TextPlugin::collect(), esengine::TrailPlugin::collect(), esengine::UIElementPlugin::collect(), and esengine::RenderFrame::collectAll().

◆ draw_list

◆ excluded

Entity esengine::RenderCollectContext::excluded = INVALID_ENTITY

Definition at line 319 of file RenderTypePlugin.hpp.

Referenced by accepts().

◆ frame_context

◆ frustum

◆ lightsSpared

u32 esengine::RenderCollectContext::lightsSpared = 0

Light slots the lit quads of this collect were spared: per quad, the loop lights that cannot reach it.

What lightReachMask2D took off the fragments. A pixel shows nothing of it (a light out of reach added zero before as well), so this is the number that says the reach still rides in the lane.

Definition at line 426 of file RenderTypePlugin.hpp.

Referenced by esengine::SpritePlugin::collect(), and esengine::RenderFrame::collectAll().

◆ lod

LodView esengine::RenderCollectContext::lod

◆ occluded

u32 esengine::RenderCollectContext::occluded = 0

How many of those culled an OCCLUDER refused.

A subset, not a second total: the plugin counts the cull where it happens and this says which question rejected it. One number for both cannot tell an occluder that stopped working from a camera that turned away.

Definition at line 419 of file RenderTypePlugin.hpp.

Referenced by esengine::RenderFrame::collectAll(), and visible().

◆ occlusion

const OcclusionView* esengine::RenderCollectContext::occlusion = nullptr

What this view is already blocked by, or null for a collect that must not ask — a shadow face looks from a light, and a camera's answer about what a camera cannot see says nothing about it.

Definition at line 318 of file RenderTypePlugin.hpp.

Referenced by esengine::RenderFrame::collectAll(), and visible().

◆ only_root

u32 esengine::RenderCollectContext::only_root = 0

Nonzero: this collect is one screen root's, and an entity of the domain under any other root is not its to draw.

Definition at line 298 of file RenderTypePlugin.hpp.

Referenced by accepts().

◆ registry

◆ screen_root_by_index

const std::vector<u32>* esengine::RenderCollectContext::screen_root_by_index = nullptr

With only_root: by entity index, the screen root each entity of the domain draws under (ecs::UISystem::screenRootOf).

Definition at line 296 of file RenderTypePlugin.hpp.

Referenced by accepts().

◆ screen_ui

const std::unordered_set<u32>* esengine::RenderCollectContext::screen_ui = nullptr

The entities the SCREEN owns (UISystem::screenDomain), or null.

A set rather than the UI system itself, so the renderer keeps knowing nothing about UI: what it needs is a membership answer, and that is all a set is.

Definition at line 294 of file RenderTypePlugin.hpp.

Referenced by accepts(), and esengine::RenderFrame::collectAll().

◆ selection

const std::unordered_set<u32>* esengine::RenderCollectContext::selection = nullptr

A motion collect that draws the editor's selection mask instead (RenderFrame::collectSelection): only these entities (by Entity::id()), opaque or not, each at where it stands now, so the motion program writes coverage and depth and no movement. Null for every other collect.

Definition at line 325 of file RenderTypePlugin.hpp.

Referenced by esengine::MeshPlugin::collect().

◆ shading

ShadingMode esengine::RenderCollectContext::shading = ShadingMode::Shaded

How the meshes of THIS collect are shaded. Shaded unless the view asked for another mode; a collect that is not a camera's (the shadow map) leaves it alone, because a depth write has no colour to override.

Definition at line 451 of file RenderTypePlugin.hpp.

Referenced by esengine::MeshPlugin::collect(), and esengine::RenderFrame::collectAll().

◆ shadowCulled

u32 esengine::RenderCollectContext::shadowCulled = 0

How many casters that left out.

Definition at line 339 of file RenderTypePlugin.hpp.

Referenced by castsIntoView().

◆ shadowFloor

f32 esengine::RenderCollectContext::shadowFloor = 0.0f

Definition at line 336 of file RenderTypePlugin.hpp.

Referenced by castsIntoView().

◆ shadowRay

glm::vec3 esengine::RenderCollectContext::shadowRay {0.0f, -1.0f, 0.0f}

Definition at line 335 of file RenderTypePlugin.hpp.

Referenced by castsIntoView().

◆ shadowReachCap

f32 esengine::RenderCollectContext::shadowReachCap = 0.0f

Definition at line 337 of file RenderTypePlugin.hpp.

Referenced by castsIntoView().

◆ shadowReceivers

const Frustum* esengine::RenderCollectContext::shadowReceivers = nullptr

A sun's shadow map only: the camera's frustum, which is what its shadows are worth drawing for, and the way the rays travel.

A caster's shadow is the segment its sphere sweeps along the rays down to the lowest receiver. A caster whose segment stays outside the camera's frustum shades nothing the camera sees, so the map need not hold it. Null: every caster is drawn.

Definition at line 334 of file RenderTypePlugin.hpp.

Referenced by castsIntoView().

◆ ui_tree_layers

const std::unordered_map<u32, i32>* esengine::RenderCollectContext::ui_tree_layers = nullptr

The layer of each emitter and plain Sprite a Canvas holds, by entity id, or null.

See also
ecs::UITreeOrder

Definition at line 301 of file RenderTypePlugin.hpp.

Referenced by esengine::RenderFrame::collectAll(), and treeLayer().

◆ weights

WeightTarget esengine::RenderCollectContext::weights

The one skinned draw this view colours by a joint's weights, if any.

Definition at line 454 of file RenderTypePlugin.hpp.

Referenced by esengine::MeshPlugin::collect(), and esengine::RenderFrame::collectAll().


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