GraphicsAPI_2020C
texture.h
Go to the documentation of this file.
1 /*
2 ---------------------------------------------------------------------------
3 Open Asset Import Library (assimp)
4 ---------------------------------------------------------------------------
5 
6 Copyright (c) 2006-2017, assimp team
7 
8 
9 All rights reserved.
10 
11 Redistribution and use of this software in source and binary forms,
12 with or without modification, are permitted provided that the following
13 conditions are met:
14 
15 * Redistributions of source code must retain the above
16  copyright notice, this list of conditions and the
17  following disclaimer.
18 
19 * Redistributions in binary form must reproduce the above
20  copyright notice, this list of conditions and the
21  following disclaimer in the documentation and/or other
22  materials provided with the distribution.
23 
24 * Neither the name of the assimp team, nor the names of its
25  contributors may be used to endorse or promote products
26  derived from this software without specific prior
27  written permission of the assimp team.
28 
29 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
30 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
31 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
32 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
33 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
34 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
35 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
36 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
37 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
38 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
39 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40 ---------------------------------------------------------------------------
41 */
42 
51 #pragma once
52 #ifndef AI_TEXTURE_H_INC
53 #define AI_TEXTURE_H_INC
54 
55 #include "types.h"
56 
57 #ifdef __cplusplus
58 extern "C" {
59 #endif
60 
61 
62 // --------------------------------------------------------------------------------
63 
67 #ifndef AI_EMBEDDED_TEXNAME_PREFIX
68 # define AI_EMBEDDED_TEXNAME_PREFIX "*"
69 #endif
70 
77 #if (!defined AI_MAKE_EMBEDDED_TEXNAME)
78 # define AI_MAKE_EMBEDDED_TEXNAME(_n_) AI_EMBEDDED_TEXNAME_PREFIX # _n_
79 #endif
80 
81 
82 #include "./Compiler/pushpack1.h"
83 
84 // --------------------------------------------------------------------------------
89 struct aiTexel
90 {
91  unsigned char b,g,r,a;
92 
93 #ifdef __cplusplus
94  bool operator== (const aiTexel& other) const
96  {
97  return b == other.b && r == other.r &&
98  g == other.g && a == other.a;
99  }
100 
102  bool operator!= (const aiTexel& other) const
103  {
104  return b != other.b || r != other.r ||
105  g != other.g || a != other.a;
106  }
107 
109  operator aiColor4D() const
110  {
111  return aiColor4D(r/255.f,g/255.f,b/255.f,a/255.f);
112  }
113 #endif // __cplusplus
114 
115 } PACK_STRUCT;
116 
117 #include "./Compiler/poppack1.h"
118 
119 // --------------------------------------------------------------------------------
133 struct aiTexture
134 {
141  unsigned int mWidth;
142 
148  unsigned int mHeight;
149 
169  char achFormatHint[9];// 8 for string + 1 for terminator.
170 
180  C_STRUCT aiTexel* pcData;
181 
182 #ifdef __cplusplus
183 
189  bool CheckFormat(const char* s) const
190  {
191  return (0 == ::strncmp(achFormatHint, s, sizeof(achFormatHint)));
192  }
193 
194  // Construction
195  aiTexture ()
196  : mWidth (0)
197  , mHeight (0)
198  , pcData (NULL)
199  {
200  achFormatHint[0] = achFormatHint[1] = 0;
201  achFormatHint[2] = achFormatHint[3] = 0;
202  }
203 
204  // Destruction
205  ~aiTexture ()
206  {
207  delete[] pcData;
208  }
209 #endif
210 };
211 
212 
213 #ifdef __cplusplus
214 }
215 #endif
216 
217 #endif // AI_TEXTURE_H_INC
Basic data types and primitives, such as vectors or colors.
Helper structure to represent a texel in a ARGB8888 format.
Definition: texture.h:89
unsigned int mWidth
Width of the texture, in pixels.
Definition: texture.h:141
Helper structure to describe an embedded texture.
Definition: texture.h:133
unsigned int mHeight
Height of the texture, in pixels.
Definition: texture.h:148
Definition: color4.h:98