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

Scene-level 2D mesh renderer (MeshRenderer component). More...

#include <MeshPlugin.hpp>

Inheritance diagram for esengine::MeshPlugin:

Public Member Functions

void init (RenderFrameContext &ctx) override
bool castsShadows () const override
bool drawsMotion () const override
bool castInputs (RenderFrameContext &ctx, ecs::Registry &registry, u64 &key) override
 For a plugin that casts: one number for everything its depth collect reads apart from the shadow views and the frame's camera, so a frame whose number, views and camera match those of the frame that drew the shadow map need not collect it again.
bool castHeldInputs (u64 &key) const override
u32 castMoverCount () const override
void collect (RenderCollectContext &ctx) override
RenderPrewarmResult prewarm (RenderFrameContext &ctx, ecs::Registry &registry, const Entity *entities, u32 count, bool shadowPasses) override
RenderPrewarmResult prewarmFacts (RenderFrameContext &ctx, const MeshProgramFacts *facts, u32 count, bool shadowPasses, bool residentGeometry)
 Ready programs from facts already gathered — the door a PREPARED cell comes through, before any entity of it exists.
RenderPrewarmResult prewarmDocument (RenderFrameContext &ctx, const MeshDocumentRecord *rows, u32 count, bool shadowPasses) override
 The same readiness, asked of a PREPARED cell's own description.
const char * collectScope () const override
 What this plugin's collect is called in a frame profile.
bool clusterInspect (u32 entityId, u32 &triangles, u32 &clusters) const override
 What the last frames drew of the Cluster LOD mesh of the entity entityId.
Public Member Functions inherited from esengine::RenderTypePlugin
virtual ~RenderTypePlugin ()=default
virtual void shutdown ()
virtual bool drawsScreenUI () const
 Whether this plugin can draw an entity that lives in a UI tree.

Detailed Description

Scene-level 2D mesh renderer (MeshRenderer component).

Streams component-local geometry through the unified Batch face each frame — CPU-transformed like every 2D renderable — so meshes sort, clip, light, and multi-texture-merge exactly like sprites. The whole plugin is "vertices + BatchDrawKey + append": no bottom-layer changes.

Definition at line 34 of file MeshPlugin.hpp.

Member Function Documentation

◆ castHeldInputs()

bool esengine::MeshPlugin::castHeldInputs ( u64 & key) const
overridevirtual

Reimplemented from esengine::RenderTypePlugin.

Definition at line 682 of file MeshPlugin.cpp.

◆ castInputs()

bool esengine::MeshPlugin::castInputs ( RenderFrameContext & ,
ecs::Registry & ,
u64 &  )
overridevirtual

For a plugin that casts: one number for everything its depth collect reads apart from the shadow views and the frame's camera, so a frame whose number, views and camera match those of the frame that drew the shadow map need not collect it again.

Returns
False when it cannot vouch for what it would read (the frame then collects). Asked once a frame, before the shadow collect; a plugin may keep what it needs between calls.

Reimplemented from esengine::RenderTypePlugin.

Definition at line 687 of file MeshPlugin.cpp.

References esengine::ecs::Registry::activityEpoch(), esengine::ecs::Registry::anyChangedSince(), esengine::ecs::Registry::anyChangedSinceWhere(), esengine::ecs::Registry::beginChangeRead(), esengine::hash::combine(), esengine::ecs::Registry::countOf(), esengine::ctx(), ES_PROFILE_COUNTER, esengine::ecs::Registry::has(), esengine::ecs::Registry::identity(), esengine::hash::kFnv64Offset, and esengine::renderOrigin().

◆ castMoverCount()

u32 esengine::MeshPlugin::castMoverCount ( ) const
inlineoverridevirtual

Reimplemented from esengine::RenderTypePlugin.

Definition at line 43 of file MeshPlugin.hpp.

◆ castsShadows()

bool esengine::MeshPlugin::castsShadows ( ) const
inlineoverridevirtual

Resident geometry is the only thing the engine draws depth-only. A flat renderable's shadow is ShadowCaster2D's to cast, not the map's.

Reimplemented from esengine::RenderTypePlugin.

Definition at line 39 of file MeshPlugin.hpp.

◆ clusterInspect()

bool esengine::MeshPlugin::clusterInspect ( u32 ,
u32 & ,
u32 &  ) const
overridevirtual

What the last frames drew of the Cluster LOD mesh of the entity entityId.

Its triangles and its clusters, as the cut picked for the scene view; false from a plugin that draws no such mesh, and for an entity it has not drawn lately. The editor's selection readout says it beside the mesh's own count, which a clustered mesh does not draw.

Reimplemented from esengine::RenderTypePlugin.

Definition at line 1167 of file MeshPlugin.cpp.

References esengine::kClusterCutFreshCollects.

◆ collect()

void esengine::MeshPlugin::collect ( RenderCollectContext & ctx)
overridevirtual

Implements esengine::RenderTypePlugin.

Definition at line 1252 of file MeshPlugin.cpp.

References esengine::Albedo, esengine::All, esengine::appendIndexedBatch(), esengine::ProbeStore::atlasTexture(), esengine::Back, esengine::BatchDrawKey::blend, esengine::MeshSkinChunk::boneCount, esengine::MeshSkinChunk::boneOffset, esengine::lod::boundingSphere(), esengine::RenderCollectContext::buffer_pool, esengine::RenderCollectContext::camera, esengine::RenderCollectContext::casters, esengine::RenderCollectContext::castsIntoView(), esengine::RenderCollectContext::clip_state, esengine::Clusters, esengine::lod::ClusterHierarchy::clusters, esengine::Mesh::clusters, esengine::ecs::MeshRenderer::color, esengine::lod::LevelSet::count, esengine::RenderCollectContext::LodView::counts, esengine::ctx(), esengine::BatchDrawKey::cull, esengine::RenderCollectContext::culled, esengine::GfxDevice::deleteBuffer(), esengine::BatchDrawKey::depthBias, esengine::BatchDrawKey::depthShaderId, esengine::BatchDrawKey::depthTest, esengine::MaterialRecord::depthTest, esengine::BatchDrawKey::depthWrite, esengine::RenderCollectContext::draw_list, esengine::Mesh::edgeIndexBuffer, esengine::Mesh::edgeIndexCount, esengine::ecs::Billboard::enabled, esengine::FrameProfiler::enabled(), esengine::WeightTarget::entity, esengine::BatchDrawKey::envTextureId, ES_LOG_WARN, ES_PROFILE_COUNTER, esengine::es_profile_now_ms(), esengine::CameraView::eye, esengine::billboard::facing(), esengine::Mesh::firstIndex, esengine::MeshSkinChunk::firstIndex, esengine::RenderCollectContext::LodView::follow, esengine::RenderCollectContext::frame_context, esengine::RenderCollectContext::frustum, esengine::gatherLodLevels(), esengine::FrameProfiler::get(), esengine::Mesh::hasEdges(), esengine::Mesh::hasLightmapUV, esengine::Mesh::hasNormals, esengine::MeshProgramFacts::hasNormals, esengine::Mesh::hasTangents, esengine::Entity::id(), esengine::BatchDrawKey::indexBuffer, esengine::Mesh::indexBuffer, esengine::Mesh::indexCount, esengine::MeshSkinChunk::indexCount, esengine::Mesh::indices, esengine::BatchDrawKey::instanceCount, esengine::BatchDrawKey::instanceStride, esengine::Frustum::intersectsAABB(), esengine::Invalid, esengine::ProbeConstants::irradiance, esengine::Mesh::isChunked(), esengine::Mesh::isDrawable(), esengine::WeightTarget::joint, esengine::kClusterCutIdleCollects, esengine::lod::kCulled, esengine::Mesh::layout, esengine::BatchDrawKey::layoutId, esengine::BatchDrawKey::lightmapTextureId, esengine::Lines, esengine::Lit, esengine::LodLevels::localMax, esengine::Mesh::localMax, esengine::LodLevels::localMin, esengine::Mesh::localMin, esengine::RenderCollectContext::lod, esengine::BatchDrawKey::materialId, esengine::ecs::MeshInstances::maxScale, esengine::Mesh, esengine::LodLevels::mesh, esengine::MESH_INSTANCE_STRIDE, esengine::MESH_INSTANCE_TEXEL_LIGHTMAP, esengine::MESH_INSTANCE_TEXEL_MODEL, esengine::MESH_INSTANCE_TEXEL_NORMAL, esengine::MESH_INSTANCE_TEXEL_TINT, esengine::MESH_INSTANCE_TEXELS, esengine::MeshInstance, esengine::meshLocalBounds(), esengine::ecs::Billboard::mode, esengine::BatchDrawKey::morphIndex, esengine::Mesh::morphTexture, esengine::BatchDrawKey::morphTextureId, esengine::Motion, esengine::Movers, esengine::None, esengine::Normal, esengine::MeshProgramFacts::normalTextureId, esengine::ProbeStore::noteDraw(), esengine::Opaque, esengine::orientedWorldAabb(), esengine::ecs::MeshInstances::originMax, esengine::ecs::MeshInstances::originMin, esengine::packColor(), esengine::parallaxedWorldPosition(), esengine::placementCoarseMesh(), esengine::BatchDrawKey::planarIndex, esengine::BatchDrawKey::probeGridTextureId, esengine::BatchDrawKey::probeIndex, esengine::GfxDevice::programReady(), esengine::pushBatchDraw(), esengine::placement_bounds::radius(), esengine::rebased(), esengine::lod::SelectionCounts::record(), esengine::ProbeConstants::reflection, esengine::RenderCollectContext::registry, esengine::renderOrigin(), esengine::ProbeStore::sampleBox(), esengine::Scene, esengine::lod::screenRelativeSize(), esengine::RenderCollectContext::selection, esengine::lod::selectLevel(), esengine::LodLevels::set, esengine::Shaded, esengine::BatchDrawKey::shaderId, esengine::RenderCollectContext::shading, esengine::ShadowDepth, esengine::BatchDrawKey::shadowTextureId, esengine::Mesh::skinChunkBones, esengine::Mesh::skinChunks, esengine::BatchDrawKey::skinCount, esengine::MeshProgramFacts::skinned, esengine::BatchDrawKey::skinOffset, esengine::GfxDevice::skipPendingPrograms(), esengine::BatchDrawKey::stage, esengine::RenderCollectContext::LodView::state, esengine::MeshProgramFacts::tangents, esengine::ecs::MeshRenderer::texture, esengine::BatchDrawKey::topology, esengine::ecs::MeshInstances::transforms, esengine::Transparent, esengine::Mesh::uvDensity, esengine::BatchDrawKey::vertexBuffer, esengine::Mesh::vertexBuffer, esengine::BatchDrawKey::vertexLayout, esengine::Mesh::vertices, esengine::RenderCollectContext::LodView::view, esengine::CameraView::viewDepth(), esengine::RenderCollectContext::visible(), esengine::RenderCollectContext::weights, and esengine::Wireframe.

◆ collectScope()

const char * esengine::MeshPlugin::collectScope ( ) const
inlineoverridevirtual

What this plugin's collect is called in a frame profile.

A literal: the profiler keys scopes by content and keeps the pointer. A type that does not answer is reported as other rather than folded into a neighbour, whose cost it would become.

Reimplemented from esengine::RenderTypePlugin.

Definition at line 53 of file MeshPlugin.hpp.

◆ drawsMotion()

bool esengine::MeshPlugin::drawsMotion ( ) const
inlineoverridevirtual

Whether the Motion collect asks this plugin: what it draws can move by itself, and the picture after it needs to know by how much.

Reimplemented from esengine::RenderTypePlugin.

Definition at line 40 of file MeshPlugin.hpp.

◆ init()

void esengine::MeshPlugin::init ( RenderFrameContext & ctx)
overridevirtual

Reimplemented from esengine::RenderTypePlugin.

Definition at line 417 of file MeshPlugin.cpp.

References esengine::ctx().

◆ prewarm()

RenderPrewarmResult esengine::MeshPlugin::prewarm ( RenderFrameContext & ctx,
ecs::Registry & registry,
const Entity * entities,
u32 count,
bool shadowPasses )
overridevirtual

Reimplemented from esengine::RenderTypePlugin.

Definition at line 593 of file MeshPlugin.cpp.

References esengine::ctx(), prewarmFacts(), and esengine::ecs::Registry::tryGet().

◆ prewarmDocument()

RenderPrewarmResult esengine::MeshPlugin::prewarmDocument ( RenderFrameContext & ctx,
const MeshDocumentRecord * rows,
u32 count,
bool shadowPasses )
overridevirtual

The same readiness, asked of a PREPARED cell's own description.

The second fact source. What it derives must equal what prewarm derives from the live entities, which is a claim a criterion holds rather than a comment.

Reimplemented from esengine::RenderTypePlugin.

Definition at line 577 of file MeshPlugin.cpp.

References esengine::ctx(), and prewarmFacts().

◆ prewarmFacts()


The documentation for this class was generated from the following files:
  • /home/runner/work/estella/estella/src/esengine/renderer/plugins/MeshPlugin.hpp
  • /home/runner/work/estella/estella/src/esengine/renderer/plugins/MeshPlugin.cpp