CFx SDK Documentation
2026 SP0
Loading...
Searching...
No Matches
SDK
CFx
dd_inc
Tr
TrVisRawTexture.h
Go to the documentation of this file.
1
2
// Copyright (C) 2002-2024, Open Design Alliance (the "Alliance").
3
// All rights reserved.
4
//
5
// This software and its documentation and related materials are owned by
6
// the Alliance. The software may only be incorporated into application
7
// programs owned by members of the Alliance, subject to a signed
8
// Membership Agreement and Supplemental Software License Agreement with the
9
// Alliance. The structure and organization of this software are the valuable
10
// trade secrets of the Alliance and its suppliers. The software is also
11
// protected by copyright law and international treaty provisions. Application
12
// programs incorporating this software must include the following statement
13
// with their copyright notices:
14
//
15
// This application incorporates Open Design Alliance software pursuant to a license
16
// agreement with Open Design Alliance.
17
// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.
18
// All rights reserved.
19
//
20
// By use of this software, its documentation or related materials, you
21
// acknowledge and accept the above terms.
23
#ifndef ODTRVISRAWTEXTURE
24
#define ODTRVISRAWTEXTURE
25
26
#include "
TD_PackPush.h
"
27
#include "
OdPlatform.h
"
28
#include <memory>
29
33
class
OdTrVisRawTexture
34
{
35
public
:
39
OdTrVisRawTexture
() {}
40
44
~OdTrVisRawTexture
()
45
{
46
delete
m_pTextureData;
47
m_pTextureData =
nullptr
;
48
}
49
56
void
resize
(
OdUInt32
width
,
OdUInt32
height
,
OdUInt32
format
)
57
{
58
m_nWidth =
width
;
59
m_nHeight =
height
;
60
m_format =
format
;
61
62
OdUInt32
totalSize =
size
();
63
delete
m_pTextureData;
64
m_pTextureData =
new
OdUInt8
[totalSize];
65
}
66
73
static
OdUInt32
pixelSize
(
OdUInt32
format
)
74
{
75
static
const
OdUInt8
sizes[] =
//enum Format
76
{
// Basic 8 bit formats
77
1,
//kRed,
78
1,
//kAlpha,
79
2,
//kRG,
80
3,
//kRGB,
81
4,
//kRGBA,
82
3,
//kBGR,
83
4,
//kBGRA,
84
1,
//kPalette,
85
86
//Depth/Stencil
87
1,
//kStencil8,
88
2,
//kDepth16,
89
4,
//kDepth24Stencil8,//Most used depth format. getColor() returns only depth value. For stencil data use textureData() function
90
4,
//kDepth32,
91
92
//16 bit
93
2,
//kR16,
94
4,
//kRG16,
95
8,
//kRGBA16,
96
2,
//kAlpha16,
97
98
//Float
99
4,
//kFloatR,
100
8,
//kFloatRG,
101
16,
//kFloatRGBA,
102
2,
//kHalfFloatR,
103
4,
//kHalfFloatRG,
104
8,
//kHalfFloatRGBA,
105
106
//Signed normalized
107
1,
//kRSNorm,
108
1,
//kAlphaSNorm,
109
2,
//kRGSNorm,
110
4,
//kRGBASNorm,
111
2,
//kR16SNorm,
112
2,
//kAlpha16SNorm,
113
4,
//kRG16SNorm,
114
8,
//kRGBA16SNorm,
115
};
116
117
static
const
OdUInt32
count
=
sizeof
(sizes) /
sizeof
(sizes[0]);
118
ODA_ASSERT_ONCE
(
format
<
count
);
119
if
(
format
>=
count
)
120
return
1;
121
122
return
sizes[
format
];
123
}
124
130
OdUInt32
size
()
const
131
{
132
return
m_nWidth * m_nHeight *
pixelSize
(m_format);
133
}
134
140
OdUInt32
width
()
const
141
{
142
return
m_nWidth;
143
}
144
150
OdUInt32
height
()
const
151
{
152
return
m_nHeight;
153
}
154
160
OdUInt32
format
()
const
161
{
162
return
m_format;
163
}
164
170
OdUInt8
*
data
()
171
{
172
return
m_pTextureData;
173
}
174
180
const
OdUInt8
*
data
()
const
181
{
182
return
m_pTextureData;
183
}
184
185
private
:
186
OdUInt8
* m_pTextureData =
nullptr
;
187
OdUInt32
m_nWidth = 0;
188
OdUInt32
m_nHeight = 0;
189
OdUInt32
m_format = 0;
190
};
191
192
typedef
std::shared_ptr<OdTrVisRawTexture>
OdTrVisRawTexturePtr
;
193
194
195
#include "
TD_PackPop.h
"
196
197
#endif
ODA_ASSERT_ONCE
#define ODA_ASSERT_ONCE(exp)
Definition
DebugStuff.h:73
OdPlatform.h
OdUInt32
unsigned int OdUInt32
Definition
OdPlatformSettings.h:768
OdUInt8
unsigned char OdUInt8
Definition
OdPlatformSettings.h:744
TD_PackPop.h
TD_PackPush.h
OdTrVisRawTexturePtr
std::shared_ptr< OdTrVisRawTexture > OdTrVisRawTexturePtr
Definition
TrVisRawTexture.h:192
OdTrVisRawTexture::resize
void resize(OdUInt32 width, OdUInt32 height, OdUInt32 format)
Definition
TrVisRawTexture.h:56
OdTrVisRawTexture::height
OdUInt32 height() const
Definition
TrVisRawTexture.h:150
OdTrVisRawTexture::format
OdUInt32 format() const
Definition
TrVisRawTexture.h:160
OdTrVisRawTexture::OdTrVisRawTexture
OdTrVisRawTexture()
Definition
TrVisRawTexture.h:39
OdTrVisRawTexture::width
OdUInt32 width() const
Definition
TrVisRawTexture.h:140
OdTrVisRawTexture::size
OdUInt32 size() const
Definition
TrVisRawTexture.h:130
OdTrVisRawTexture::~OdTrVisRawTexture
~OdTrVisRawTexture()
Definition
TrVisRawTexture.h:44
OdTrVisRawTexture::pixelSize
static OdUInt32 pixelSize(OdUInt32 format)
Definition
TrVisRawTexture.h:73
OdTrVisRawTexture::data
const OdUInt8 * data() const
Definition
TrVisRawTexture.h:180
OdTrVisRawTexture::data
OdUInt8 * data()
Definition
TrVisRawTexture.h:170
count
GLsizei GLsizei * count
Definition
gles2_ext.h:276
Generated on Tue Apr 15 2025 11:30:07