20 struct JobFuncContext;
36 class VisibilityContext;
80 ,
const IndexT primitiveGroup
169#if NEBULA_GRAPHICS_DEBUG
220 Resources::ResourceId,
258 if (rid != Resources::InvalidResourceId)
260 rid = Resources::InvalidResourceId;
Definition graphicscontext.h:165
An ID allocator associates an id with a slice in an N number of arrays.
Definition idallocator.h:39
Ids::Id32 Alloc()
Allocate an object.
Definition idallocator.h:45
void Dealloc(Ids::Id32 index)
Deallocate an object. Just places it in freeids array for recycling.
Definition idallocator.h:65
Nebula's bounding box class.
Definition bbox.h:24
Allocates memory ranges using the TLSF method, with extended handling of padding to better suit GPUs.
void Dealloc(const RangeAllocation &allocation)
Deallocate range.
Definition rangeallocator.h:299
Definition modelcontext.h:58
static ModelInstance NodeInstances
Definition modelcontext.h:206
static const Util::Array< NodeInstanceFlags > & GetModelRenderableFlags()
Get array to all model node instance flags.
Definition modelcontext.cc:563
static Memory::RangeAllocator TransformInstanceAllocator
Definition modelcontext.h:207
static Util::Dictionary< Models::ModelNode *, MaterialInstanceContext > materialInstanceContexts
Definition modelcontext.h:230
static Math::bbox ComputeBoundingBox(const Graphics::GraphicsEntityId id)
Compute the bounding box for a model.
Definition modelcontext.cc:396
@ Model_NodeInstanceRoots
Definition modelcontext.h:212
@ Model_Dirty
Definition modelcontext.h:217
@ Model_Id
Definition modelcontext.h:211
@ Model_NodeLookup
Definition modelcontext.h:215
@ Model_Transform
Definition modelcontext.h:216
@ Model_NodeInstanceTransform
Definition modelcontext.h:213
@ Model_NodeInstanceStates
Definition modelcontext.h:214
static CoreGraphics::ConstantBufferOffset AllocateInstanceConstants(const Graphics::GraphicsEntityId id, const IndexT nodeIndex, const Materials::BatchIndex batch)
Allocate constant memory for instance constants in this frame.
Definition modelcontext.cc:490
static void UpdateTransforms(const Graphics::FrameContext &ctx)
runs before frame is updated
Definition modelcontext.cc:600
static const ModelInstance::Renderable & GetModelRenderables()
Get node renderable context.
Definition modelcontext.cc:572
static MaterialInstanceContext & SetupMaterialInstanceContext(const Graphics::GraphicsEntityId id, const IndexT nodeIndex, const MaterialTemplates::BatchGroup batch)
Setup material instance context.
Definition modelcontext.cc:451
virtual ~ModelContext()
destructor
Definition modelcontext.cc:55
static void SetTransform(const Graphics::GraphicsEntityId id, const Math::mat4 &transform)
set the transform for a model
Definition modelcontext.cc:383
static Memory::RangeAllocator RenderInstanceAllocator
Definition modelcontext.h:207
static void Dealloc(Graphics::ContextEntityId id)
deallocate a slice
Definition modelcontext.h:253
static void ChangeModel(const Graphics::GraphicsEntityId id, const Resources::ResourceName &name, const Util::StringAtom &tag, std::function< void()> finishedCallback)
change model for existing entity
Definition modelcontext.cc:337
static const NodeInstanceRange & GetModelRenderableRange(const Graphics::GraphicsEntityId id)
Get model node instance states.
Definition modelcontext.cc:525
static const ModelInstance::Transformable & GetModelTransformables()
Get node transformable context.
Definition modelcontext.cc:581
static const NodeInstanceRange & GetModelTransformableRange(const Graphics::GraphicsEntityId id)
Get model node instance transformables.
Definition modelcontext.cc:535
static const Util::Array< Math::bbox > & GetModelRenderableBoundingBoxes()
Get array to all model node instace bounding boxes.
Definition modelcontext.cc:554
ModelContext()
constructor
Definition modelcontext.cc:47
static Math::mat4 GetTransform(const Graphics::GraphicsEntityId id)
get the transform for a model
Definition modelcontext.cc:419
static void Setup(const Graphics::GraphicsEntityId id, const Resources::ResourceName &name, const Util::StringAtom &tag, std::function< void()> finishedCallback)
setup
Definition modelcontext.cc:83
static const Models::ModelId GetModel(const Graphics::GraphicsEntityId id)
get model
Definition modelcontext.cc:364
static Threading::Event completionEvent
Definition modelcontext.h:232
static void OnRenderDebug(uint32_t flags)
debug rendering
Definition modelcontext.cc:805
static Threading::AtomicCounter ConstantsUpdateCounter
Definition modelcontext.h:199
static void Create()
create context
Definition modelcontext.cc:64
static bool IsLoaded(const Graphics::GraphicsEntityId id)
Get if model is loaded.
Definition modelcontext.cc:590
Ids::IdAllocator< Resources::ResourceId, Util::Array< uint32 >, NodeInstanceRange, NodeInstanceRange, Util::Dictionary< Util::StringAtom, IndexT >, Math::mat4, bool > ModelContextAllocator
Definition modelcontext.h:227
static Threading::AtomicCounter TransformsUpdateCounter
Definition modelcontext.h:200
static ModelContextAllocator modelContextAllocator
Definition modelcontext.h:228
static void SetAlwaysVisible(const Graphics::GraphicsEntityId id)
Set all nodes in the model to always be visible.
Definition modelcontext.cc:511
static const Util::Array< NodeInstanceState > & GetModelRenderableStates()
Get array to all model node states.
Definition modelcontext.cc:545
static void WaitForWork(const Graphics::FrameContext &ctx)
Wait for thread work to finish.
Definition modelcontext.cc:795
static IndexT GetNodeIndex(const Graphics::GraphicsEntityId id, const Util::StringAtom &name)
Get node index based on name.
Definition modelcontext.cc:438
static Graphics::ContextEntityId Alloc()
allocate a new slice for this context
Definition modelcontext.h:244
friend class Visibility::VisibilityContext
Definition modelcontext.h:203
Definition raytracingcontext.h:40
tuple_array_t< MEMBER, TYPES... > & Get(const uint32_t index)
get single item from resource
Definition arrayallocator.h:260
Nebula's dynamic array class.
Definition array.h:60
A collection of key/value pairs with quick value retrieval by key at roughly O(log n).
Definition dictionary.h:34
Implements a fixed size one-dimensional array.
Definition fixedarray.h:20
Definition pinnedarray.h:17
A StringAtom.
Definition stringatom.h:22
Acceleration structures are used to enable ray tracing on the GPU by dividing the scene into a BVH.
Definition accelerationstructure.h:24
uint ConstantBufferOffset
Definition config.h:21
Job system allows for scheduling and execution of a parallel task.
Definition jobs.cc:11
Material special version of variant.
Definition material.cc:11
IndexT BatchIndex
Definition material.h:33
A model resource consists of nodes, each of which inhibit some information read from an ....
Definition model.cc:10
NodeInstanceFlags
Definition modelcontext.h:48
@ NodeInstance_AlwaysVisible
Context dealing with scene management for ray tracing.
Definition modelcontext.h:40
void DiscardResource(const Resources::ResourceId id)
Definition resourceserver.h:409
volatile int AtomicCounter
Definition interlocked.h:19
Implements a resource loader for models.
Definition modelcontext.h:35
#define NEBULA_GRAPHICS_DEBUG
Definition config.h:322
A resource table declares a list of resources (ResourceTable in DX12, DescriptorSet in Vulkan)
#define __ImplementEnumBitOperators(type)
Definition graphicscontext.h:133
Definition graphicsserver.h:31
The graphics entity is only an Id, to which we can attach GraphicsContexts.
Definition graphicsentity.h:16
A 4x4 single point precision float matrix.
Definition mat4.h:49
Definition modelcontext.h:177
Materials::BatchIndex batch
Definition modelcontext.h:178
SizeT constantBufferSize
Definition modelcontext.h:179
The bounding boxes are used by visibility and the states by rendering.
Definition modelcontext.h:150
Util::PinnedArray< 0xFFFF, Util::Tuple< float, float > > nodeLodDistances
Definition modelcontext.h:153
Util::PinnedArray< 0xFFFF, Models::NodeType > nodeTypes
Definition modelcontext.h:162
Util::PinnedArray< 0xFFFF, CoreGraphics::MeshId > nodeMeshes
Definition modelcontext.h:164
Util::PinnedArray< 0xFFFF, Math::bbox > nodeBoundingBoxes
Definition modelcontext.h:152
Util::PinnedArray< 0xFFFF, void * > nodeSpecialData
Definition modelcontext.h:168
Util::PinnedArray< 0xFFFF, Models::ModelNode * > nodes
Definition modelcontext.h:163
Util::PinnedArray< 0xFFFF, Math::bbox > origBoundingBoxes
Definition modelcontext.h:151
Util::PinnedArray< 0xFFFF, const MaterialTemplates::Entry * > nodeMaterialTemplates
Definition modelcontext.h:160
Util::PinnedArray< 0xFFFF, Materials::MaterialId > nodeMaterials
Definition modelcontext.h:159
Util::PinnedArray< 0xFFFF, NodeInstanceState > nodeStates
Definition modelcontext.h:161
Util::PinnedArray< 0xFFFF, uint64 > nodeSortId
Definition modelcontext.h:157
Util::PinnedArray< 0xFFFF, uint32 > nodeTransformIndex
Definition modelcontext.h:156
Util::PinnedArray< 0xFFFF, float > textureLods
Definition modelcontext.h:155
Util::PinnedArray< 0xFFFF, float > nodeLods
Definition modelcontext.h:154
Util::PinnedArray< 0xFFFF, CoreGraphics::PrimitiveGroup > nodePrimitiveGroup
Definition modelcontext.h:165
Util::PinnedArray< 0xFFFF, NodeInstanceFlags > nodeFlags
Definition modelcontext.h:158
Util::PinnedArray< 0xFFFF, Util::Tuple< uint32, uint32 > > nodeDrawModifiers
Definition modelcontext.h:166
Transforms are only used by the model context to traverse and propagate the transform hierarchy.
Definition modelcontext.h:142
Util::PinnedArray< 0xFFFF, Math::mat4 > origTransforms
Definition modelcontext.h:143
Util::PinnedArray< 0xFFFF, Math::mat4 > nodeTransforms
Definition modelcontext.h:144
Util::PinnedArray< 0xFFFF, uint32 > nodeParents
Definition modelcontext.h:145
Definition modelcontext.h:139
struct Models::ModelContext::ModelInstance::Renderable renderable
struct Models::ModelContext::ModelInstance::Transformable transformable
Definition modelcontext.h:128
IndexT instancingConstantsIndex
Definition modelcontext.h:133
Util::FixedArray< uint32_t > resourceTableOffsets
Definition modelcontext.h:131
Materials::MaterialInstanceId materialInstance
Definition modelcontext.h:130
IndexT skinningConstantsIndex
Definition modelcontext.h:134
IndexT objectConstantsIndex
Definition modelcontext.h:132
Util::FixedArray< CoreGraphics::ResourceTableId > resourceTables
Definition modelcontext.h:129
IndexT particleConstantsIndex
Definition modelcontext.h:135
Nebula's universal string class.
Definition string.h:50
#define N_BIT(x)
Definition types.h:86
int SizeT
Definition types.h:49
int IndexT
Definition types.h:48