Ocean
scenedescription/sdl/assimp/Material.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) Meta Platforms, Inc. and affiliates.
3  *
4  * This source code is licensed under the MIT license found in the
5  * LICENSE file in the root directory of this source tree.
6  */
7 
8 #ifndef META_OCEAN_SCENEDESCRIPTION_SDL_ASSIMP_MATERIAL_H
9 #define META_OCEAN_SCENEDESCRIPTION_SDL_ASSIMP_MATERIAL_H
10 
12 
14 #include "ocean/rendering/Engine.h"
16 
17 #include <assimp/material.h>
18 #include <assimp/scene.h>
19 
20 namespace Ocean
21 {
22 
23 namespace SceneDescription
24 {
25 
26 namespace SDL
27 {
28 
29 namespace Assimp
30 {
31 
32 /**
33  * This class implements a converters for Assimp materials.
34  * @ingroup scenedescriptionsdlassimp
35  */
36 class OCEAN_SCENEDESCRIPTION_SDL_ASSIMP_EXPORT Material
37 {
38  public:
39 
40  /**
41  * Parses an Assimp material and creates a corresponding an Ocean AttributeSet object (which can hold e.g., a material and textures).
42  * @param engine The rendering engine for which the material object will be created
43  * @param sceneFilename The filename of the scene, if known
44  * @param assimpScene The Assimp scene from which the material objects will be created
45  * @param assimpMaterial The Assimp material to parse
46  * @return The resulting Ocean AttributeSet object
47  */
48  static Rendering::AttributeSetRef parseMaterial(const Rendering::Engine& engine, const std::string& sceneFilename, const aiScene& assimpScene, const aiMaterial& assimpMaterial);
49 
50  /**
51  * Parses all Assimp material objects from an Assimp scene.
52  * @param engine The rendering engine for which the material objects will be created
53  * @param sceneFilename The filename of the scene, if known
54  * @param assimpScene The Assimp scene from which the material objects will be created
55  * @return The Ocean AttributeSet objects, one for each Assimp material (with preserved order)
56  */
57  static std::vector<Rendering::AttributeSetRef> parseMaterials(const Rendering::Engine& engine, const std::string& sceneFilename, const aiScene& assimpScene);
58 
59  /**
60  * Parses all textures from an Assimp material.
61  * @param engine The rendering engine for which the material object will be created
62  * @param sceneFilename The filename of the scene, if known
63  * @param assimpScene The Assimp scene from which the material objects will be created
64  * @param assimpMaterial The Assimp material to parse
65  * @param textureIsTransparent Resulting statement whether the texture is transparent or opaque
66  * @return The resulting textures
67  */
68  static Rendering::TexturesRef parseTextures(const Rendering::Engine& engine, const std::string& sceneFilename, const aiScene& assimpScene, const aiMaterial& assimpMaterial, bool& textureIsTransparent);
69 };
70 
71 }
72 
73 }
74 
75 }
76 
77 }
78 
79 #endif // META_OCEAN_SCENEDESCRIPTION_SDL_ASSIMP_MATERIAL_H
This class is the base class for all rendering engines like.
Definition: Engine.h:46
This class implements a converters for Assimp materials.
Definition: scenedescription/sdl/assimp/Material.h:37
static Rendering::AttributeSetRef parseMaterial(const Rendering::Engine &engine, const std::string &sceneFilename, const aiScene &assimpScene, const aiMaterial &assimpMaterial)
Parses an Assimp material and creates a corresponding an Ocean AttributeSet object (which can hold e....
static std::vector< Rendering::AttributeSetRef > parseMaterials(const Rendering::Engine &engine, const std::string &sceneFilename, const aiScene &assimpScene)
Parses all Assimp material objects from an Assimp scene.
static Rendering::TexturesRef parseTextures(const Rendering::Engine &engine, const std::string &sceneFilename, const aiScene &assimpScene, const aiMaterial &assimpMaterial, bool &textureIsTransparent)
Parses all textures from an Assimp material.
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15