Blue Brain BioExplorer
MeshLoader.h
Go to the documentation of this file.
1 /*
2  * Copyright 2015-2024 Blue Brain Project / EPFL
3  *
4  * The Blue Brain BioExplorer is a tool for scientists to extract and analyse
5  * scientific data from visualization
6  *
7  * This file is part of Blue Brain BioExplorer <https://github.com/BlueBrain/BioExplorer>
8  *
9  * This program is free software: you can redistribute it and/or modify it under
10  * the terms of the GNU General Public License as published by the Free Software
11  * Foundation, either version 3 of the License, or (at your option) any later
12  * version.
13  *
14  * This program is distributed in the hope that it will be useful, but WITHOUT
15  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
17  * details.
18  *
19  * You should have received a copy of the GNU General Public License along with
20  * this program. If not, see <https://www.gnu.org/licenses/>.
21  */
22 
23 #pragma once
24 
27 
28 struct aiScene;
29 
30 namespace core
31 {
35 class MeshLoader : public Loader
36 {
37 public:
38  MeshLoader(Scene& scene);
39  MeshLoader(Scene& scene, const GeometryParameters& geom);
40 
41  std::vector<std::string> getSupportedStorage() const final;
42  std::string getName() const final;
43  PropertyMap getProperties() const final;
44 
45  bool isSupported(const std::string& storage, const std::string& extension) const final;
46 
47  ModelDescriptorPtr importFromStorage(const std::string& storage, const LoaderProgress& callback,
48  const PropertyMap& properties) const final;
49 
50  ModelDescriptorPtr importFromBlob(Blob&& blob, const LoaderProgress& callback,
51  const PropertyMap& properties) const final;
52 
53  ModelMetadata importMesh(const std::string& fileName, const LoaderProgress& callback, Model& model,
54  const Matrix4f& transformation, const size_t defaultMaterialId,
55  const GeometryQuality geometryQuality) const;
56 
57 private:
58  PropertyMap _defaults;
59 
60  void _createMaterials(Model& model, const aiScene* aiScene, const std::string& folder) const;
61 
62  ModelMetadata _postLoad(const aiScene* aiScene, Model& model, const Matrix4f& transformation,
63  const size_t defaultMaterial, const std::string& folder,
64  const LoaderProgress& callback) const;
65  size_t _getQuality(const GeometryQuality geometryQuality) const;
66 };
67 } // namespace core
bool isSupported(const std::string &storage, const std::string &extension) const final
Definition: MeshLoader.cpp:137
std::string getName() const final
Definition: MeshLoader.cpp:438
ModelMetadata importMesh(const std::string &fileName, const LoaderProgress &callback, Model &model, const Matrix4f &transformation, const size_t defaultMaterialId, const GeometryQuality geometryQuality) const
Definition: MeshLoader.cpp:399
MeshLoader(Scene &scene)
Definition: MeshLoader.cpp:123
PropertyMap getProperties() const final
Definition: MeshLoader.cpp:448
ModelDescriptorPtr importFromStorage(const std::string &storage, const LoaderProgress &callback, const PropertyMap &properties) const final
Definition: MeshLoader.cpp:143
ModelDescriptorPtr importFromBlob(Blob &&blob, const LoaderProgress &callback, const PropertyMap &properties) const final
Definition: MeshLoader.cpp:164
std::vector< std::string > getSupportedStorage() const final
Definition: MeshLoader.cpp:443
The abstract Model class holds the geometry attached to an asset of the scene (mesh,...
Definition: Model.h:469
Scene object This object contains collections of geometries, materials and light sources that are use...
Definition: Scene.h:43
GeometryQuality
Definition: Types.h:222
std::map< std::string, std::string > ModelMetadata
Definition: Types.h:104
std::shared_ptr< ModelDescriptor > ModelDescriptorPtr
Definition: Types.h:112
glm::mat4 Matrix4f
Definition: MathTypes.h:125