Nebula
Loading...
Searching...
No Matches
modelnode.h
Go to the documentation of this file.
1#pragma once
2//------------------------------------------------------------------------------
17//------------------------------------------------------------------------------
18#include "core/refcounted.h"
19#include "util/stringatom.h"
20#include "io/binaryreader.h"
21#include "math/bbox.h"
22#include "ids/id.h"
24#include "models/model.h"
25#include "materials/material.h"
27
28#include "util/delegate.h"
29
30
31namespace Characters
32{
33class CharacterContext;
34}
35
36namespace Particles
37{
38class ParticleContext;
39}
40
41namespace CoreGraphics
42{
43struct ResourceTableId;
44struct CmdBufferId;
45//enum ShaderPipeline;
46}
47
48namespace Models
49{
50
51struct ModelId;
52class ModelLoader;
54{
55public:
56
58 ModelNode();
60 virtual ~ModelNode();
61
65 const NodeType GetType() const;
67 const NodeBits GetBits() const;
68
70 virtual bool GetImplicitHierarchyActivation() const;
71
73 const Util::StringAtom& GetName() const;
75 const uint32_t HashCode() const;
76
78 virtual std::function<void(const CoreGraphics::CmdBufferId)> GetApplyFunction();
80 virtual std::function<const CoreGraphics::PrimitiveGroup()> GetPrimitiveGroupFunction();
81
83 virtual void Unload();
84
85protected:
86 friend class ModelLoader;
87 friend class ModelContext;
88 friend class ModelServer;
89 friend class CharacterNode;
90 friend class CharacterSkinNode;
93
95 virtual bool Load(const Util::FourCC& fourcc, const Util::StringAtom& tag, const Ptr<IO::BinaryReader>& reader, bool immediate);
96
98 virtual void OnFinishedLoading(ModelStreamingData* streamingData);
99
101 virtual void Discard();
102
106
111
114};
115
116//------------------------------------------------------------------------------
119inline const Util::Array<ModelNode*>&
121{
122 return this->children;
123}
124
125//------------------------------------------------------------------------------
128inline const NodeType
130{
131 return this->type;
132}
133
134//------------------------------------------------------------------------------
137inline const NodeBits
139{
140 return this->bits;
141}
142
143//------------------------------------------------------------------------------
146inline const Util::StringAtom&
148{
149 return this->name;
150}
151
152//------------------------------------------------------------------------------
155inline const uint32_t
157{
158 return (uint32_t)this->uniqueId;
159}
160
161//------------------------------------------------------------------------------
164inline std::function<void(const CoreGraphics::CmdBufferId)>
166{
167 return nullptr;
168}
169
170//------------------------------------------------------------------------------
173inline std::function<const CoreGraphics::PrimitiveGroup()>
175{
176 return nullptr;
177}
178
179} // namespace Models
Assumes control over the character animation functionalities of a model if it contains a character de...
Definition charactercontext.h:58
Defines a group of primitives as a subset of a vertex buffer and index buffer plus the primitive topo...
Definition primitivegroup.h:20
Nebula's bounding box class.
Definition bbox.h:24
Definition characternode.h:21
Definition characterskinnode.h:19
Definition modelcontext.h:58
Definition modelloader.h:27
Definition modelnode.h:54
virtual std::function< void(const CoreGraphics::CmdBufferId)> GetApplyFunction()
Get function to apply node.
Definition modelnode.h:165
IndexT uniqueId
Definition modelnode.h:112
const Util::StringAtom & GetName() const
return name
Definition modelnode.h:147
virtual void Discard()
discard node
Definition modelnode.cc:90
virtual void OnFinishedLoading(ModelStreamingData *streamingData)
call when model node data is finished loading (not accounting for secondary resources)
Definition modelnode.cc:81
const NodeType GetType() const
get type of node
Definition modelnode.h:129
Util::Array< Models::ModelNode * > children
Definition modelnode.h:108
static IndexT ModelNodeUniqueIdCounter
Definition modelnode.h:113
const Util::Array< ModelNode * > & GetChildren() const
return constant reference to children
Definition modelnode.h:120
Math::bbox boundingBox
Definition modelnode.h:109
virtual void Unload()
Unload data (don't call explicitly)
Definition modelnode.cc:72
virtual std::function< const CoreGraphics::PrimitiveGroup()> GetPrimitiveGroupFunction()
Get function to fetch primitive group.
Definition modelnode.h:174
const uint32_t HashCode() const
get hash
Definition modelnode.h:156
ModelNode()
constructor
Definition modelnode.cc:17
virtual bool GetImplicitHierarchyActivation() const
return true if all children should create hierarchies upon calling CreateInstance
Definition modelnode.cc:99
const NodeBits GetBits() const
get feature bits of node
Definition modelnode.h:138
NodeBits bits
Definition modelnode.h:105
virtual ~ModelNode()
destructor
Definition modelnode.cc:26
NodeType type
Definition modelnode.h:104
friend class ModelServer
Definition modelnode.h:88
Util::StringAtom name
Definition modelnode.h:103
Models::ModelNode * parent
Definition modelnode.h:107
Util::StringAtom tag
Definition modelnode.h:110
Definition particlecontext.h:26
Nebula's smart pointer class which manages the life time of RefCounted objects.
Definition ptr.h:38
Nebula's dynamic array class.
Definition array.h:60
A four-character-code is a quasi-human-readable 32-bit-id.
Definition fourcc.h:19
A StringAtom.
Definition stringatom.h:22
A character encapsulates a skeleton resource, an animation resource, and the ability to instantiate s...
Definition charactercontext.cc:21
Acceleration structures are used to enable ray tracing on the GPU by dividing the scene into a BVH.
Definition accelerationstructure.h:24
A model resource consists of nodes, each of which inhibit some information read from an ....
Definition model.cc:10
NodeBits
Definition model.h:37
NodeType
Definition model.h:25
Particle context controls playing and enabling/disabling of particle emitters inside a model.
Definition modelnode.h:37
Definition commandbuffer.h:155
Definition model.h:54
int IndexT
Definition types.h:48