Nebula
Toggle main menu visibility
Loading...
Searching...
No Matches
indextype.h
Go to the documentation of this file.
1
#pragma once
2
//------------------------------------------------------------------------------
12
#include "
core/types.h
"
13
14
//------------------------------------------------------------------------------
15
namespace
CoreGraphics
16
{
17
class
IndexType
18
{
19
public
:
21
enum
Code
22
{
23
None
,
// index type not defined
24
Index16
,
// 16 bit indices
25
Index32
,
// 32 bit indices
26
};
27
29
static
SizeT
SizeOf
(
IndexType::Code
type);
31
static
IndexType::Code
ToIndexType
(
const
SizeT
size);
33
static
Util::String
ToString
(
IndexType::Code
type);
35
static
IndexType::Code
FromString
(
const
Util::String
& str);
36
};
37
38
//------------------------------------------------------------------------------
41
inline
SizeT
42
IndexType::SizeOf
(
IndexType::Code
type)
43
{
44
n_assert
(type !=
None
);
45
switch
(type)
46
{
47
case
Index16
:
return
2;
48
case
Index32
:
return
4;
49
default
:
return
0;
50
}
51
}
52
53
//------------------------------------------------------------------------------
56
inline
IndexType::Code
57
IndexType::ToIndexType
(
const
SizeT
size)
58
{
59
n_assert
(size != 0);
60
switch
(size)
61
{
62
case
2:
return
Index16
;
63
case
4:
return
Index32
;
64
default
:
return
None
;
65
}
66
}
67
68
//------------------------------------------------------------------------------
71
inline
Util::String
72
IndexType::ToString
(
IndexType::Code
type)
73
{
74
switch
(type)
75
{
76
case
None
:
return
"None"
;
77
case
Index16
:
return
"Index16"
;
78
case
Index32
:
return
"Index32"
;
79
default
:
80
n_error
(
"IndexType::ToString(): Invalid IndexType code!"
);
81
return
""
;
82
}
83
}
84
85
//------------------------------------------------------------------------------
88
inline
IndexType::Code
89
IndexType::FromString
(
const
Util::String
& str)
90
{
91
if
(
"None"
== str)
return
None
;
92
else
if
(
"Index16"
== str)
return
Index16
;
93
else
if
(
"Index32"
== str)
return
Index32
;
94
else
95
{
96
n_error
(
"IndexType::FromString(): invalid index type string '%s'!"
, str.
AsCharPtr
());
97
return
None
;
98
}
99
}
100
101
}
102
//------------------------------------------------------------------------------
CoreGraphics::IndexType
Data type of vertex indices (16 bit or 32 bit).
Definition
indextype.h:18
CoreGraphics::IndexType::FromString
static IndexType::Code FromString(const Util::String &str)
convert string to index type
Definition
indextype.h:89
CoreGraphics::IndexType::SizeOf
static SizeT SizeOf(IndexType::Code type)
get byte size of index
Definition
indextype.h:42
CoreGraphics::IndexType::ToString
static Util::String ToString(IndexType::Code type)
convert index type to string
Definition
indextype.h:72
CoreGraphics::IndexType::ToIndexType
static IndexType::Code ToIndexType(const SizeT size)
get size type from size
Definition
indextype.h:57
CoreGraphics::IndexType::Code
Code
index types enum
Definition
indextype.h:22
CoreGraphics::IndexType::None
@ None
Definition
indextype.h:23
CoreGraphics::IndexType::Index32
@ Index32
Definition
indextype.h:25
CoreGraphics::IndexType::Index16
@ Index16
Definition
indextype.h:24
n_error
void __cdecl n_error(const char *msg,...)
This function is called when a serious situation is encountered which requires abortion of the applic...
Definition
debug.cc:138
n_assert
#define n_assert(exp)
Definition
debug.h:50
CoreGraphics
Acceleration structures are used to enable ray tracing on the GPU by dividing the scene into a BVH.
Definition
accelerationstructure.h:24
Util.String
Nebula's universal string class.
Definition
String.cs:8
Util.String::AsCharPtr
const char * AsCharPtr() const
return contents as character pointer
Definition
string.h:572
types.h
SizeT
int SizeT
Definition
types.h:42
code
render
coregraphics
indextype.h
Generated on
for Nebula. Dark theme by
Tilen Majerle
. All rights reserved.