BRE12
texture.h
Go to the documentation of this file.
1 /*
2 ---------------------------------------------------------------------------
3 Open Asset Import Library (assimp)
4 ---------------------------------------------------------------------------
5 
6 Copyright (c) 2006-2012, assimp team
7 
8 All rights reserved.
9 
10 Redistribution and use of this software in source and binary forms,
11 with or without modification, are permitted provided that the following
12 conditions are met:
13 
14 * Redistributions of source code must retain the above
15  copyright notice, this list of conditions and the
16  following disclaimer.
17 
18 * Redistributions in binary form must reproduce the above
19  copyright notice, this list of conditions and the
20  following disclaimer in the documentation and/or other
21  materials provided with the distribution.
22 
23 * Neither the name of the assimp team, nor the names of its
24  contributors may be used to endorse or promote products
25  derived from this software without specific prior
26  written permission of the assimp team.
27 
28 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
31 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
32 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
33 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
34 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
35 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
36 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
37 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
38 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39 ---------------------------------------------------------------------------
40 */
41 
51 #ifndef AI_TEXTURE_H_INC
52 #define AI_TEXTURE_H_INC
53 
54 #include "types.h"
55 
56 #ifdef __cplusplus
57 extern "C" {
58 #endif
59 
60 
61 // --------------------------------------------------------------------------------
68 #if (!defined AI_MAKE_EMBEDDED_TEXNAME)
69 # define AI_MAKE_EMBEDDED_TEXNAME(_n_) "*" # _n_
70 #endif
71 
72 
73 #include "./Compiler/pushpack1.h"
74 
75 // --------------------------------------------------------------------------------
80 struct aiTexel
81 {
82  unsigned char b,g,r,a;
83 
84 #ifdef __cplusplus
85  bool operator== (const aiTexel& other) const
87  {
88  return b == other.b && r == other.r &&
89  g == other.g && a == other.a;
90  }
91 
93  bool operator!= (const aiTexel& other) const
94  {
95  return b != other.b || r != other.r ||
96  g != other.g || a != other.a;
97  }
98 
100  operator aiColor4D() const
101  {
102  return aiColor4D(r/255.f,g/255.f,b/255.f,a/255.f);
103  }
104 #endif // __cplusplus
105 
106 } PACK_STRUCT;
107 
108 #include "./Compiler/poppack1.h"
109 
110 // --------------------------------------------------------------------------------
120 struct aiTexture
121 {
128  unsigned int mWidth;
129 
135  unsigned int mHeight;
136 
149  char achFormatHint[4];
150 
160  C_STRUCT aiTexel* pcData;
161 
162 #ifdef __cplusplus
163 
169  bool CheckFormat(const char* s) const
170  {
171  return (0 == ::strncmp(achFormatHint,s,3));
172  }
173 
174  // Construction
175  aiTexture ()
176  : mWidth (0)
177  , mHeight (0)
178  , pcData (NULL)
179  {
180  achFormatHint[0] = achFormatHint[1] = 0;
181  achFormatHint[2] = achFormatHint[3] = 0;
182  }
183 
184  // Destruction
185  ~aiTexture ()
186  {
187  delete[] pcData;
188  }
189 #endif
190 };
191 
192 
193 #ifdef __cplusplus
194 }
195 #endif
196 
197 #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:80
unsigned int mWidth
Width of the texture, in pixels.
Definition: texture.h:128
Helper structure to describe an embedded texture.
Definition: texture.h:120
C_STRUCT aiTexel * pcData
Data of the texture.
Definition: texture.h:160
unsigned int mHeight
Height of the texture, in pixels.
Definition: texture.h:135
Definition: color4.h:96