Nebula
Loading...
Searching...
No Matches
modelloader.h
Go to the documentation of this file.
1#pragma once
2//------------------------------------------------------------------------------
9//------------------------------------------------------------------------------
10#include "core/refcounted.h"
12#include "util/stack.h"
13#include "model.h"
16
17namespace Visibility
18{
19class VisibilityContext;
20}
21namespace Characters
22{
24}
25namespace Models
26{
27
28class ModelNode;
29class ModelContext;
31{
33public:
37 virtual ~ModelLoader();
38
40 void Setup() override;
41
42private:
43 friend class PrimitiveNode;
44 friend class CharacterNode;
45 friend class CharacterSkinNode;
46 friend class ParticleSystemNode;
50
56 void Unload(const Resources::ResourceId id) override;
57
61 uint LodMask(const _StreamData& stream, float lod, bool async) const override;
62
65
67#define IMPLEMENT_NODE_ALLOCATOR(FourCC, Type) \
68 nodeConstructors.Add(FourCC, []() -> Models::ModelNode* { \
69 Models::ModelNode* node = (Models::ModelNode*)Memory::Alloc(Memory::ObjectHeap, sizeof(Models::Type)); \
70 new (node) Models::Type; \
71 return node; \
72 });
73
74};
75
78
79} // namespace Models
Assumes control over the character animation functionalities of a model if it contains a character de...
Definition charactercontext.h:59
Definition modelcontext.h:58
ResourceStreamOutput StreamResource(const ResourceLoadJob &job) override
Stream texture.
Definition modelloader.cc:410
ModelLoader()
constructor
Definition modelloader.cc:24
ResourceLoader::ResourceInitOutput InitializeResource(const ResourceLoadJob &job, const Ptr< IO::Stream > &stream) override
Parse the model tree.
Definition modelloader.cc:62
void Unload(const Resources::ResourceId id) override
unload resource
Definition modelloader.cc:392
friend class CharacterSkinNode
Definition modelloader.h:45
Util::Dictionary< Util::FourCC, std::function< Models::ModelNode *()> > nodeConstructors
used for looking up constructors
Definition modelloader.h:64
friend class ParticleSystemNode
Definition modelloader.h:46
friend class CharacterNode
Definition modelloader.h:44
void Setup() override
setup resource loader, initiates the placeholder and error resources if valid
Definition modelloader.cc:41
friend class PrimitiveNode
Definition modelloader.h:43
uint LodMask(const _StreamData &stream, float lod, bool async) const override
Create load mask based on LOD.
Definition modelloader.cc:427
__DeclareClass(ModelLoader)
ResourceLoader::ResourceInitOutput ReinitializeResource(const ResourceLoadJob &job, const Ptr< IO::Stream > &stream) override
Reinitialize the tree.
Definition modelloader.cc:225
friend class Visibility::VisibilityContext
Definition modelloader.h:48
Definition modelnode.h:54
Nebula's smart pointer class which manages the life time of RefCounted objects.
Definition ptr.h:38
Definition resourceloader.h:61
bool async
Definition resourceloader.h:314
Nebula's dynamic array class.
Definition array.h:61
A collection of key/value pairs with quick value retrieval by key at roughly O(log n).
Definition dictionary.h:35
A four-character-code is a quasi-human-readable 32-bit-id.
Definition fourcc.h:19
A character encapsulates a skeleton resource, an animation resource, and the ability to instantiate s...
Definition charactercontext.cc:24
A model resource consists of nodes, each of which inhibit some information read from an ....
Definition graphicsserver.h:35
const Util::Array< Models::ModelNode * > & ModelGetNodes(const ModelId id)
Get model nodes.
Definition model.cc:46
Implements a resource loader for models.
Definition modelcontext.h:35
Definition model.h:24
Definition resourceloader.h:142
Definition resourceloader.h:158
Definition resourceloader.h:182
unsigned int uint
Definition types.h:41