Nebula
Toggle main menu visibility
Loading...
Searching...
No Matches
primitivegroup.h
Go to the documentation of this file.
1
#pragma once
2
//------------------------------------------------------------------------------
13
#include "
coregraphics/primitivetopology.h
"
14
#include "
math/bbox.h
"
15
16
//------------------------------------------------------------------------------
17
namespace
CoreGraphics
18
{
19
class
PrimitiveGroup
20
{
21
public
:
23
PrimitiveGroup
();
24
26
void
SetBaseVertex
(
IndexT
i);
28
IndexT
GetBaseVertex
()
const
;
30
void
SetNumVertices
(
SizeT
n);
32
SizeT
GetNumVertices
()
const
;
34
void
SetBaseIndex
(
IndexT
i);
36
IndexT
GetBaseIndex
()
const
;
38
void
SetNumIndices
(
SizeT
n);
40
SizeT
GetNumIndices
()
const
;
42
SizeT
GetNumPrimitives
(
const
CoreGraphics::PrimitiveTopology::Code
& topo)
const
;
44
void
SetBoundingBox
(
const
Math::bbox
&
bbox
);
46
const
Math::bbox
&
GetBoundingBox
()
const
;
47
48
private
:
49
IndexT
baseVertex
;
50
SizeT
numVertices
;
51
IndexT
baseIndex
;
52
SizeT
numIndices
;
53
Math::bbox
boundingBox
;
54
};
55
56
//------------------------------------------------------------------------------
59
inline
60
PrimitiveGroup::PrimitiveGroup
() :
61
baseVertex
(0),
62
numVertices
(0),
63
baseIndex
(0),
64
numIndices
(0)
65
{
66
// empty
67
}
68
69
//------------------------------------------------------------------------------
72
inline
void
73
PrimitiveGroup::SetBaseVertex
(
IndexT
i)
74
{
75
this->
baseVertex
= i;
76
}
77
78
//------------------------------------------------------------------------------
81
inline
IndexT
82
PrimitiveGroup::GetBaseVertex
()
const
83
{
84
return
this->
baseVertex
;
85
}
86
87
//------------------------------------------------------------------------------
90
inline
void
91
PrimitiveGroup::SetNumVertices
(
SizeT
n)
92
{
93
this->
numVertices
= n;
94
}
95
96
//------------------------------------------------------------------------------
99
inline
SizeT
100
PrimitiveGroup::GetNumVertices
()
const
101
{
102
return
this->
numVertices
;
103
}
104
105
//------------------------------------------------------------------------------
108
inline
void
109
PrimitiveGroup::SetBaseIndex
(
IndexT
i)
110
{
111
this->
baseIndex
= i;
112
}
113
114
//------------------------------------------------------------------------------
117
inline
IndexT
118
PrimitiveGroup::GetBaseIndex
()
const
119
{
120
return
this->
baseIndex
;
121
}
122
123
//------------------------------------------------------------------------------
126
inline
void
127
PrimitiveGroup::SetNumIndices
(
SizeT
n)
128
{
129
this->
numIndices
= n;
130
}
131
132
//------------------------------------------------------------------------------
135
inline
SizeT
136
PrimitiveGroup::GetNumIndices
()
const
137
{
138
return
this->
numIndices
;
139
}
140
141
//------------------------------------------------------------------------------
144
inline
SizeT
145
PrimitiveGroup::GetNumPrimitives
(
const
CoreGraphics::PrimitiveTopology::Code
& topo)
const
146
{
147
if
(this->
numIndices
> 0)
148
{
149
return
PrimitiveTopology::NumberOfPrimitives
(topo, this->
numIndices
);
150
}
151
else
152
{
153
return
PrimitiveTopology::NumberOfPrimitives
(topo, this->
numVertices
);
154
}
155
}
156
157
//------------------------------------------------------------------------------
160
inline
void
161
PrimitiveGroup::SetBoundingBox
(
const
Math::bbox
&
bbox
)
162
{
163
this->
boundingBox
=
bbox
;
164
}
165
166
//------------------------------------------------------------------------------
169
inline
const
Math::bbox
&
170
PrimitiveGroup::GetBoundingBox
()
const
171
{
172
return
this->
boundingBox
;
173
}
174
175
}
// namespace PrimitiveGroup
176
//------------------------------------------------------------------------------
177
bbox.h
CoreGraphics::PrimitiveGroup::boundingBox
Math::bbox boundingBox
Definition
primitivegroup.h:53
CoreGraphics::PrimitiveGroup::GetNumPrimitives
SizeT GetNumPrimitives(const CoreGraphics::PrimitiveTopology::Code &topo) const
get computed number of primitives
Definition
primitivegroup.h:145
CoreGraphics::PrimitiveGroup::GetNumIndices
SizeT GetNumIndices() const
get number of indices
Definition
primitivegroup.h:136
CoreGraphics::PrimitiveGroup::GetBaseIndex
IndexT GetBaseIndex() const
get base index index
Definition
primitivegroup.h:118
CoreGraphics::PrimitiveGroup::baseIndex
IndexT baseIndex
Definition
primitivegroup.h:51
CoreGraphics::PrimitiveGroup::numVertices
SizeT numVertices
Definition
primitivegroup.h:50
CoreGraphics::PrimitiveGroup::baseVertex
IndexT baseVertex
Definition
primitivegroup.h:49
CoreGraphics::PrimitiveGroup::PrimitiveGroup
PrimitiveGroup()
constructor
Definition
primitivegroup.h:60
CoreGraphics::PrimitiveGroup::numIndices
SizeT numIndices
Definition
primitivegroup.h:52
CoreGraphics::PrimitiveGroup::GetNumVertices
SizeT GetNumVertices() const
get number of vertices
Definition
primitivegroup.h:100
CoreGraphics::PrimitiveGroup::SetBoundingBox
void SetBoundingBox(const Math::bbox &bbox)
Set the bounding box.
Definition
primitivegroup.h:161
CoreGraphics::PrimitiveGroup::SetNumVertices
void SetNumVertices(SizeT n)
set number of vertices
Definition
primitivegroup.h:91
CoreGraphics::PrimitiveGroup::SetBaseVertex
void SetBaseVertex(IndexT i)
set base vertex index
Definition
primitivegroup.h:73
CoreGraphics::PrimitiveGroup::GetBoundingBox
const Math::bbox & GetBoundingBox() const
Get the bounding box for this primitive.
Definition
primitivegroup.h:170
CoreGraphics::PrimitiveGroup::SetBaseIndex
void SetBaseIndex(IndexT i)
set base index index
Definition
primitivegroup.h:109
CoreGraphics::PrimitiveGroup::SetNumIndices
void SetNumIndices(SizeT n)
set number of indices
Definition
primitivegroup.h:127
CoreGraphics::PrimitiveGroup::GetBaseVertex
IndexT GetBaseVertex() const
get index of base vertex
Definition
primitivegroup.h:82
CoreGraphics::PrimitiveTopology::Code
Code
enumeration
Definition
primitivetopology.h:23
CoreGraphics::PrimitiveTopology::NumberOfPrimitives
static SizeT NumberOfPrimitives(Code topology, SizeT numVertices)
compute number of primitives given a primitive type and number of vertices/indices
Definition
primitivetopology.cc:86
Math::bbox
Nebula's bounding box class.
Definition
bbox.h:24
CoreGraphics
Acceleration structures are used to enable ray tracing on the GPU by dividing the scene into a BVH.
Definition
accelerationstructure.h:24
primitivetopology.h
SizeT
int SizeT
Definition
types.h:42
IndexT
int IndexT
Definition
types.h:41
code
render
coregraphics
primitivegroup.h
Generated on
for Nebula. Dark theme by
Tilen Majerle
. All rights reserved.