CFx SDK Documentation 2026 SP0
Loading...
Searching...
No Matches
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
34{
35public:
40
45 {
46 delete m_pTextureData;
47 m_pTextureData = nullptr;
48 }
49
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
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]);
119 if (format >= count)
120 return 1;
121
122 return sizes[format];
123 }
124
131 {
132 return m_nWidth * m_nHeight * pixelSize(m_format);
133 }
134
141 {
142 return m_nWidth;
143 }
144
151 {
152 return m_nHeight;
153 }
154
161 {
162 return m_format;
163 }
164
171 {
172 return m_pTextureData;
173 }
174
180 const OdUInt8* data() const
181 {
182 return m_pTextureData;
183 }
184
185private:
186 OdUInt8* m_pTextureData = nullptr;
187 OdUInt32 m_nWidth = 0;
188 OdUInt32 m_nHeight = 0;
189 OdUInt32 m_format = 0;
190};
191
192typedef std::shared_ptr<OdTrVisRawTexture> OdTrVisRawTexturePtr;
193
194
195#include "TD_PackPop.h"
196
197#endif
#define ODA_ASSERT_ONCE(exp)
Definition DebugStuff.h:73
unsigned int OdUInt32
unsigned char OdUInt8
std::shared_ptr< OdTrVisRawTexture > OdTrVisRawTexturePtr
void resize(OdUInt32 width, OdUInt32 height, OdUInt32 format)
OdUInt32 height() const
OdUInt32 format() const
OdUInt32 width() const
OdUInt32 size() const
static OdUInt32 pixelSize(OdUInt32 format)
const OdUInt8 * data() const
GLsizei GLsizei * count
Definition gles2_ext.h:276