Nebula
|
#include <modelcontext.h>
Inherits Graphics::GraphicsContext.
Classes | |
struct | MaterialInstanceContext |
struct | ModelInstance |
struct | NodeInstanceState |
Public Member Functions | |
ModelContext () | |
constructor | |
virtual | ~ModelContext () |
destructor | |
Public Member Functions inherited from Graphics::GraphicsContext | |
GraphicsContext () | |
constructor | |
virtual | ~GraphicsContext () |
destructor | |
Static Public Member Functions | |
static void | Create () |
create context | |
static void | Setup (const Graphics::GraphicsEntityId id, const Resources::ResourceName &name, const Util::StringAtom &tag, std::function< void()> finishedCallback) |
setup | |
static void | Setup (const Graphics::GraphicsEntityId id, const Math::mat4 transform, const Math::bbox &boundingBox, const Materials::MaterialId material, const CoreGraphics::MeshId mesh, const IndexT primitiveGroup) |
Setup without a model resource. | |
static void | ChangeModel (const Graphics::GraphicsEntityId id, const Resources::ResourceName &name, const Util::StringAtom &tag, std::function< void()> finishedCallback) |
change model for existing entity | |
static const Models::ModelId | GetModel (const Graphics::GraphicsEntityId id) |
get model | |
static void | SetTransform (const Graphics::GraphicsEntityId id, const Math::mat4 &transform) |
set the transform for a model | |
static Math::mat4 | GetTransform (const Graphics::GraphicsEntityId id) |
get the transform for a model | |
static Math::mat4 | GetTransform (const Graphics::ContextEntityId id) |
get the transform for a model | |
static Math::bbox | ComputeBoundingBox (const Graphics::GraphicsEntityId id) |
Compute the bounding box for a model. | |
static IndexT | GetNodeIndex (const Graphics::GraphicsEntityId id, const Util::StringAtom &name) |
Get node index based on name. | |
static MaterialInstanceContext & | SetupMaterialInstanceContext (const Graphics::GraphicsEntityId id, const IndexT nodeIndex, const MaterialTemplates::BatchGroup batch) |
Setup material instance context. | |
static MaterialInstanceContext & | SetupMaterialInstanceContext (const Graphics::GraphicsEntityId id, const MaterialTemplates::BatchGroup batch) |
Setup material instance context. | |
static CoreGraphics::ConstantBufferOffset | AllocateInstanceConstants (const Graphics::GraphicsEntityId id, const IndexT nodeIndex, const Materials::BatchIndex batch) |
Allocate constant memory for instance constants in this frame. | |
static CoreGraphics::ConstantBufferOffset | AllocateInstanceConstants (const Graphics::GraphicsEntityId id, const Materials::BatchIndex batch) |
Allocate constant memory for instance constants in this frame. | |
static void | SetAlwaysVisible (const Graphics::GraphicsEntityId id) |
Set all nodes in the model to always be visible. | |
static void | UpdateTransforms (const Graphics::FrameContext &ctx) |
runs before frame is updated | |
static void | WaitForWork (const Graphics::FrameContext &ctx) |
Wait for thread work to finish. | |
static void | OnRenderDebug (uint32_t flags) |
debug rendering | |
static const Models::ModelId | GetModel (const Graphics::ContextEntityId id) |
get model | |
static const NodeInstanceRange & | GetModelRenderableRange (const Graphics::GraphicsEntityId id) |
Get model node instance states. | |
static const NodeInstanceRange & | GetModelTransformableRange (const Graphics::GraphicsEntityId id) |
Get model node instance transformables. | |
static const Util::Array< NodeInstanceState > & | GetModelRenderableStates () |
Get array to all model node states. | |
static const Util::Array< Math::bbox > & | GetModelRenderableBoundingBoxes () |
Get array to all model node instace bounding boxes. | |
static const Util::Array< NodeInstanceFlags > & | GetModelRenderableFlags () |
Get array to all model node instance flags. | |
static const ModelInstance::Renderable & | GetModelRenderables () |
Get node renderable context. | |
static const ModelInstance::Transformable & | GetModelTransformables () |
Get node transformable context. | |
static bool | IsLoaded (const Graphics::GraphicsEntityId id) |
Get if model is loaded. | |
Static Public Attributes | |
static Threading::AtomicCounter | ConstantsUpdateCounter = 0 |
static Threading::AtomicCounter | TransformsUpdateCounter = 0 |
Private Types | |
enum | { Model_Id , Model_NodeInstanceRoots , Model_NodeInstanceTransform , Model_NodeInstanceStates , Model_NodeLookup , Model_Transform , Model_Dirty } |
typedef Ids::IdAllocator< Resources::ResourceId, Util::Array< uint32 >, NodeInstanceRange, NodeInstanceRange, Util::Dictionary< Util::StringAtom, IndexT >, Math::mat4, bool > | ModelContextAllocator |
Private Member Functions | |
__DeclareContext () | |
Static Private Member Functions | |
static Graphics::ContextEntityId | Alloc () |
allocate a new slice for this context | |
static void | Dealloc (Graphics::ContextEntityId id) |
deallocate a slice | |
Static Private Attributes | |
static ModelInstance | NodeInstances |
static Memory::RangeAllocator | TransformInstanceAllocator |
static Memory::RangeAllocator | RenderInstanceAllocator |
static ModelContextAllocator | modelContextAllocator |
static Util::Dictionary< Models::ModelNode *, MaterialInstanceContext > | materialInstanceContexts |
static Threading::Event | completionEvent |
Friends | |
class | Visibility::VisibilityContext |
class | Raytracing::RaytracingContext |
Additional Inherited Members | |
Static Protected Member Functions inherited from Graphics::GraphicsContext | |
static void | InternalRegisterEntity (const Graphics::GraphicsEntityId id, Graphics::GraphicsContextState &&state) |
static void | InternalDeregisterEntity (const Graphics::GraphicsEntityId id, Graphics::GraphicsContextState &&state) |
template<class ID_ALLOCATOR > | |
static void | InternalDefragment (ID_ALLOCATOR &allocator, Graphics::GraphicsContextState &&state) |
|
private |
|
private |
Models::ModelContext::ModelContext | ( | ) |
constructor
|
virtual |
destructor
|
private |
|
inlinestaticprivate |
allocate a new slice for this context
|
static |
Allocate constant memory for instance constants in this frame.
|
static |
Allocate constant memory for instance constants in this frame.
|
static |
change model for existing entity
|
static |
Compute the bounding box for a model.
|
static |
create context
|
inlinestaticprivate |
deallocate a slice
|
static |
get model
|
static |
get model
|
static |
Get array to all model node instace bounding boxes.
|
static |
Get array to all model node instance flags.
|
static |
Get model node instance states.
|
static |
Get node renderable context.
|
static |
Get array to all model node states.
|
static |
Get model node instance transformables.
|
static |
Get node transformable context.
|
static |
Get node index based on name.
|
static |
get the transform for a model
|
static |
get the transform for a model
|
static |
Get if model is loaded.
|
static |
debug rendering
|
static |
Set all nodes in the model to always be visible.
|
static |
set the transform for a model
|
static |
Setup without a model resource.
|
static |
setup
|
static |
Setup material instance context.
|
static |
Setup material instance context.
|
static |
runs before frame is updated
Go through all models and apply their transforms.
|
static |
Wait for thread work to finish.
|
friend |
|
friend |
|
staticprivate |
|
static |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
static |