GraphicsAPI_2020C
scene.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 
46 #pragma once
47 #ifndef AI_SCENE_H_INC
48 #define AI_SCENE_H_INC
49 
50 #include "types.h"
51 #include "texture.h"
52 #include "mesh.h"
53 #include "light.h"
54 #include "camera.h"
55 #include "material.h"
56 #include "anim.h"
57 #include "metadata.h"
58 
59 #ifdef __cplusplus
60 extern "C" {
61 #endif
62 
63 #ifdef __GNUC__
64 #pragma GCC diagnostic push
65 #pragma GCC diagnostic ignored "-Wattributes"
66 #endif
67 
68 // -------------------------------------------------------------------------------
77 // -------------------------------------------------------------------------------
78 struct ASSIMP_API aiNode
79 {
102  C_STRUCT aiString mName;
103 
105  C_STRUCT aiMatrix4x4 mTransformation;
106 
108  C_STRUCT aiNode* mParent;
109 
111  unsigned int mNumChildren;
112 
114  C_STRUCT aiNode** mChildren;
115 
117  unsigned int mNumMeshes;
118 
122  unsigned int* mMeshes;
123 
129  C_STRUCT aiMetadata* mMetaData;
130 
131 #ifdef __cplusplus
132 
133  aiNode();
134 
136  explicit aiNode(const std::string& name);
137 
139  ~aiNode();
140 
148  inline
149  const aiNode* FindNode(const aiString& name) const {
150  return FindNode(name.data);
151  }
152 
153  inline
154  aiNode* FindNode(const aiString& name) {
155  return FindNode(name.data);
156  }
157 
158  const aiNode* FindNode(const char* name) const;
159 
160  aiNode* FindNode(const char* name);
161 
167  void addChildren(unsigned int numChildren, aiNode **children);
168 #endif // __cplusplus
169 };
170 
171 #ifdef __GNUC__
172 #pragma GCC diagnostic pop
173 #endif
174 
175 // -------------------------------------------------------------------------------
182 #define AI_SCENE_FLAGS_INCOMPLETE 0x1
183 
189 #define AI_SCENE_FLAGS_VALIDATED 0x2
190 
199 #define AI_SCENE_FLAGS_VALIDATION_WARNING 0x4
200 
207 #define AI_SCENE_FLAGS_NON_VERBOSE_FORMAT 0x8
208 
221 #define AI_SCENE_FLAGS_TERRAIN 0x10
222 
229 #define AI_SCENE_FLAGS_ALLOW_SHARED 0x20
230 
231 // -------------------------------------------------------------------------------
239 // -------------------------------------------------------------------------------
240 struct aiScene
241 {
247  unsigned int mFlags;
248 
256  C_STRUCT aiNode* mRootNode;
257 
259  unsigned int mNumMeshes;
260 
268  C_STRUCT aiMesh** mMeshes;
269 
271  unsigned int mNumMaterials;
272 
280  C_STRUCT aiMaterial** mMaterials;
281 
283  unsigned int mNumAnimations;
284 
290  C_STRUCT aiAnimation** mAnimations;
291 
293  unsigned int mNumTextures;
294 
301  C_STRUCT aiTexture** mTextures;
302 
306  unsigned int mNumLights;
307 
313  C_STRUCT aiLight** mLights;
314 
318  unsigned int mNumCameras;
319 
327  C_STRUCT aiCamera** mCameras;
328 
329 #ifdef __cplusplus
330 
332  ASSIMP_API aiScene();
333 
335  ASSIMP_API ~aiScene();
336 
339  inline bool HasMeshes() const {
340  return mMeshes != NULL && mNumMeshes > 0;
341  }
342 
345  inline bool HasMaterials() const {
346  return mMaterials != NULL && mNumMaterials > 0;
347  }
348 
350  inline bool HasLights() const {
351  return mLights != NULL && mNumLights > 0;
352  }
353 
355  inline bool HasTextures() const {
356  return mTextures != NULL && mNumTextures > 0;
357  }
358 
360  inline bool HasCameras() const {
361  return mCameras != NULL && mNumCameras > 0;
362  }
363 
365  inline bool HasAnimations() const {
366  return mAnimations != NULL && mNumAnimations > 0;
367  }
368 
369 #endif // __cplusplus
370 
372 #ifdef __cplusplus
373  void* mPrivate;
374 #else
375  char* mPrivate;
376 #endif
377 
378 };
379 
380 #ifdef __cplusplus
381 }
382 #endif
383 
384 #endif // AI_SCENE_H_INC
unsigned int mNumLights
The number of light sources in the scene.
Definition: scene.h:306
unsigned int mNumMeshes
The number of meshes of this node.
Definition: scene.h:117
An animation consists of key-frame data for a number of nodes.
Definition: anim.h:411
Basic data types and primitives, such as vectors or colors.
Defines the material system of the library.
A node in the imported hierarchy.
Definition: scene.h:78
Definition: matrix4x4.h:269
enum aiMorphingMethod
Definition: mesh.h:496
Helper structure to describe a light source.
Definition: light.h:113
unsigned int mFlags
Any combination of the AI_SCENE_FLAGS_XXX flags.
Definition: scene.h:247
Defines the aiCamera data structure.
Helper structure to describe a virtual camera.
Definition: camera.h:100
Defines the data structures for holding node meta information.
Declares the data structures in which the imported geometry is returned by ASSIMP: aiMesh...
Defines texture helper structures for the library.
unsigned int mNumMaterials
The number of materials in the scene.
Definition: scene.h:271
Defines the aiLight data structure.
unsigned int mNumMeshes
The number of meshes in the scene.
Definition: scene.h:259
char * mPrivate
Internal data, do not touch.
Definition: scene.h:375
Represents an UTF-8 string, zero byte terminated.
Definition: types.h:252
Defines the data structures in which the imported animations are returned.
Helper structure to describe an embedded texture.
Definition: texture.h:133
unsigned int * mMeshes
The meshes of this node.
Definition: scene.h:122
unsigned int mNumChildren
The number of child nodes of this node.
Definition: scene.h:111
The root structure of the imported data.
Definition: scene.h:240
unsigned int mNumTextures
The number of textures embedded into the file.
Definition: scene.h:293
char data[MAXLEN]
String buffer.
Definition: types.h:367
Container for holding metadata.
Definition: metadata.h:114
unsigned int mNumCameras
The number of cameras in the scene.
Definition: scene.h:318
Data structure for a material.
Definition: material.h:642
unsigned int mNumAnimations
The number of animations in the scene.
Definition: scene.h:283