Nebula
Toggle main menu visibility
Loading...
Searching...
No Matches
model.h
Go to the documentation of this file.
1
#pragma once
2
//------------------------------------------------------------------------------
10
//------------------------------------------------------------------------------
11
#include "
ids/id.h
"
12
#include "
ids/idallocator.h
"
13
#include "
util/stringatom.h
"
14
#include "
resources/resourceid.h
"
15
#include "
core/rttimacros.h
"
16
#include "
memory/rangeallocator.h
"
17
#include "
coreanimation/infinitytype.h
"
18
#include <functional>
19
namespace
Models
20
{
21
22
class
ModelNode
;
23
24
RESOURCE_ID_TYPE
(
ModelId
);
25
26
enum
NodeType
27
{
28
CharacterNodeType
,
29
TransformNodeType
,
30
ShaderStateNodeType
,
31
PrimitiveNodeType
,
32
ParticleSystemNodeType
,
33
CharacterSkinNodeType
,
34
35
NumNodeTypes
36
};
37
38
enum
NodeBits
39
{
40
NoBits
=
N_BIT
(0),
41
HasTransformBit
=
N_BIT
(1),
42
HasStateBit
=
N_BIT
(2)
43
};
44
__ImplementEnumBitOperators
(
NodeBits
);
45
46
enum class
LoadBits
47
{
48
NoBits
=
N_BIT
(0),
49
MeshBit
=
N_BIT
(1),
50
AnimBit
=
N_BIT
(2),
51
MaterialBit
=
N_BIT
(3)
52
};
53
__ImplementEnumBitOperators
(
LoadBits
);
54
55
struct
ModelStreamingData
56
{
57
LoadBits
requiredBits
;
58
LoadBits
loadedBits
;
59
};
60
61
struct
NodeInstanceRange
62
{
63
Memory::RangeAllocation
allocation
;
64
SizeT
begin
,
end
;
65
};
66
67
struct
JointMask
68
{
69
Util::StringAtom
name
;
70
Util::FixedArray<float>
weights
;
71
};
72
73
struct
Take
74
{
75
struct
Clip
76
{
77
Util::StringAtom
name
;
78
float
start
,
end
;
79
CoreAnimation::InfinityType::Code
preInfinity
,
postInfinity
;
80
81
struct
Event
82
{
83
Util::StringAtom
name
;
84
float
time
;
85
};
86
87
Util::FixedArray<Event>
events
;
88
};
89
90
Util::FixedArray<Clip>
clips
;
91
};
92
93
struct
ModelCreateInfo
94
{
95
Math::bbox
boundingBox
;
96
Util::Array<Models::ModelNode*>
nodes
;
97
Util::FixedArray<JointMask>
jointMasks
;
98
Util::FixedArray<Take>
takes
;
99
#if WITH_NEBULA_EDITOR
100
Util::Dictionary<Util::StringAtom, Models::ModelNode*>
nodeLookup;
101
#endif
102
};
103
105
const
ModelId
CreateModel
(
const
ModelCreateInfo
& info);
107
void
DestroyModel
(
const
ModelId
id
);
108
110
const
Util::Array<Models::ModelNode*>
&
ModelGetNodes
(
const
ModelId
id
);
112
const
Math::bbox
&
ModelGetBoundingBox
(
const
ModelId
id
);
113
114
#if WITH_NEBULA_EDITOR
116
const
Util::Dictionary<Util::StringAtom, Models::ModelNode*>
& GetModelNodeTable(
const
ModelId
id
);
117
#endif
118
119
enum
120
{
121
Model_BoundingBox
,
122
Model_Nodes
,
123
Model_JointMasks
,
124
Model_Takes
,
125
#if WITH_NEBULA_EDITOR
126
Model_NodeLookup
127
#endif
128
};
129
130
typedef
Ids::IdAllocator
<
131
Math::bbox
,
132
Util::Array<Models::ModelNode*>
,
133
Util::FixedArray<JointMask>
,
134
Util::FixedArray<Take>
135
#if WITH_NEBULA_EDITOR
136
,
Util::Dictionary<Util::StringAtom, Models::ModelNode*>
137
#endif
138
>
ModelAllocator
;
139
extern
ModelAllocator
modelAllocator
;
140
}
// namespace Models
CoreAnimation::InfinityType::Code
Code
anim infinity types
Definition
infinitytype.h:26
Ids::IdAllocator
An ID allocator associates an id with a slice in an N number of arrays.
Definition
idallocator.h:39
Math::bbox
Nebula's bounding box class.
Definition
bbox.h:24
Models::ModelNode
Definition
modelnode.h:55
Util::Array
Nebula's dynamic array class.
Definition
array.h:61
Util::Dictionary
A collection of key/value pairs with quick value retrieval by key at roughly O(log n).
Definition
dictionary.h:35
Util::FixedArray
Implements a fixed size one-dimensional array.
Definition
fixedarray.h:20
Util::StringAtom
A StringAtom.
Definition
stringatom.h:22
idallocator.h
id.h
infinitytype.h
Models
A model resource consists of nodes, each of which inhibit some information read from an ....
Definition
model.cc:10
Models::DestroyModel
void DestroyModel(const ModelId id)
discard model (resource)
Definition
model.cc:37
Models::ModelGetBoundingBox
const Math::bbox & ModelGetBoundingBox(const ModelId id)
Get model bounding box.
Definition
model.cc:56
Models::ModelAllocator
Ids::IdAllocator< Math::bbox, Util::Array< Models::ModelNode * >, Util::FixedArray< JointMask >, Util::FixedArray< Take > > ModelAllocator
Definition
model.h:138
Models::modelAllocator
ModelAllocator modelAllocator
Definition
model.cc:12
Models::Model_Nodes
@ Model_Nodes
Definition
model.h:122
Models::Model_Takes
@ Model_Takes
Definition
model.h:124
Models::Model_JointMasks
@ Model_JointMasks
Definition
model.h:123
Models::Model_BoundingBox
@ Model_BoundingBox
Definition
model.h:121
Models::CreateModel
const ModelId CreateModel(const ModelCreateInfo &info)
create model (resource)
Definition
model.cc:17
Models::NodeBits
NodeBits
Definition
model.h:39
Models::NoBits
@ NoBits
Definition
model.h:40
Models::HasTransformBit
@ HasTransformBit
Definition
model.h:41
Models::HasStateBit
@ HasStateBit
Definition
model.h:42
Models::ModelGetNodes
const Util::Array< Models::ModelNode * > & ModelGetNodes(const ModelId id)
Get model nodes.
Definition
model.cc:47
Models::LoadBits
LoadBits
Definition
model.h:47
Models::LoadBits::MaterialBit
@ MaterialBit
Definition
model.h:51
Models::LoadBits::MeshBit
@ MeshBit
Definition
model.h:49
Models::LoadBits::AnimBit
@ AnimBit
Definition
model.h:50
Models::NodeType
NodeType
Definition
model.h:27
Models::TransformNodeType
@ TransformNodeType
Definition
model.h:29
Models::CharacterNodeType
@ CharacterNodeType
Definition
model.h:28
Models::NumNodeTypes
@ NumNodeTypes
Definition
model.h:35
Models::CharacterSkinNodeType
@ CharacterSkinNodeType
Definition
model.h:33
Models::PrimitiveNodeType
@ PrimitiveNodeType
Definition
model.h:31
Models::ShaderStateNodeType
@ ShaderStateNodeType
Definition
model.h:30
Models::ParticleSystemNodeType
@ ParticleSystemNodeType
Definition
model.h:32
rangeallocator.h
resourceid.h
RESOURCE_ID_TYPE
#define RESOURCE_ID_TYPE(type)
Definition
resourceid.h:41
__ImplementEnumBitOperators
#define __ImplementEnumBitOperators(type)
rttimacros.h
This defines the macros for Nebula's RTTI mechanism (__DeclareClass, __ImplementClass,...
stringatom.h
Memory::RangeAllocation
Describes a range allocated by the Memory::RangeAllocator.
Definition
rangeallocator.h:25
Models::JointMask
Definition
model.h:68
Models::JointMask::name
Util::StringAtom name
Definition
model.h:69
Models::JointMask::weights
Util::FixedArray< float > weights
Definition
model.h:70
Models::ModelCreateInfo
Definition
model.h:94
Models::ModelCreateInfo::nodes
Util::Array< Models::ModelNode * > nodes
Definition
model.h:96
Models::ModelCreateInfo::boundingBox
Math::bbox boundingBox
Definition
model.h:95
Models::ModelCreateInfo::takes
Util::FixedArray< Take > takes
Definition
model.h:98
Models::ModelCreateInfo::jointMasks
Util::FixedArray< JointMask > jointMasks
Definition
model.h:97
Models::ModelId
Definition
model.h:24
Models::ModelStreamingData
Definition
model.h:56
Models::ModelStreamingData::requiredBits
LoadBits requiredBits
Definition
model.h:57
Models::ModelStreamingData::loadedBits
LoadBits loadedBits
Definition
model.h:58
Models::NodeInstanceRange
Definition
model.h:62
Models::NodeInstanceRange::end
SizeT end
Definition
model.h:64
Models::NodeInstanceRange::allocation
Memory::RangeAllocation allocation
Definition
model.h:63
Models::NodeInstanceRange::begin
SizeT begin
Definition
model.h:64
Models::Take::Clip::Event
Definition
model.h:82
Models::Take::Clip::Event::name
Util::StringAtom name
Definition
model.h:83
Models::Take::Clip::Event::time
float time
Definition
model.h:84
Models::Take::Clip
Definition
model.h:76
Models::Take::Clip::name
Util::StringAtom name
Definition
model.h:77
Models::Take::Clip::start
float start
Definition
model.h:78
Models::Take::Clip::events
Util::FixedArray< Event > events
Definition
model.h:87
Models::Take::Clip::end
float end
Definition
model.h:78
Models::Take::Clip::preInfinity
CoreAnimation::InfinityType::Code preInfinity
Definition
model.h:79
Models::Take::Clip::postInfinity
CoreAnimation::InfinityType::Code postInfinity
Definition
model.h:79
Models::Take
Definition
model.h:74
Models::Take::clips
Util::FixedArray< Clip > clips
Definition
model.h:90
N_BIT
#define N_BIT(x)
Definition
types.h:52
SizeT
int SizeT
Definition
types.h:42
code
render
models
model.h
Generated on
for Nebula. Dark theme by
Tilen Majerle
. All rights reserved.