Rendu
A lightweight rendering engine for experimentations
Loading...
Searching...
No Matches
CompositeObj.hpp
1#pragma once
2
3#include "resources/Mesh.hpp"
4#include "Common.hpp"
5#include <unordered_map>
6
11namespace CompositeObj {
12
16struct Material {
17 // Textures.
18 std::string normalTexturePath;
19 std::string alphaTexturePath;
21 std::string colorTexturePath;
22 std::string roughTexturePath;
23 std::string metalTexturePath;
24 std::string specTexturePath;
25
26 // Scalars.
27 glm::vec3 color = glm::vec3(0.0f);
28 float rough = 0.0f;
29 float metal = 0.0f;
30 float spec = 0.0f;
31
32 // Have some of the scalars been set?
33 bool hasColor = false;
34 bool hasRough = false;
35 bool hasMetal = false;
36 bool hasSpec = false;
37};
38
42struct Object {
43
45 std::string name;
46 std::string material;
47
52 explicit Object(const std::string & aName) :
53 mesh(aName), name(aName) {
54 }
55};
56
63int load(const std::string & filePath, std::vector<Object> & objects, std::unordered_map<std::string, Material> & materials);
64
65}
Represents a geometric mesh composed of vertices, other attributes and triangles.
Definition: Mesh.hpp:15
Commposite OBJ files loading.
Definition: CompositeObj.cpp:5
int load(const std::string &filePath, std::vector< Object > &objects, std::unordered_map< std::string, Material > &materials)
Definition: CompositeObj.cpp:318
OBJ material descriptor.
Definition: CompositeObj.hpp:16
bool hasColor
Has an albedo value.
Definition: CompositeObj.hpp:33
std::string displacementTexturePath
Displacement texture path.
Definition: CompositeObj.hpp:20
bool hasRough
Has a roughness value.
Definition: CompositeObj.hpp:34
float spec
Specular value.
Definition: CompositeObj.hpp:30
std::string roughTexturePath
Roughness texture path.
Definition: CompositeObj.hpp:22
std::string colorTexturePath
Albedo texture path.
Definition: CompositeObj.hpp:21
glm::vec3 color
Albedo value.
Definition: CompositeObj.hpp:27
std::string normalTexturePath
Normal texture path.
Definition: CompositeObj.hpp:18
std::string metalTexturePath
Metalness texture path.
Definition: CompositeObj.hpp:23
bool hasMetal
Has a metalness value.
Definition: CompositeObj.hpp:35
float rough
Roughness value.
Definition: CompositeObj.hpp:28
std::string alphaTexturePath
Alpha texture path.
Definition: CompositeObj.hpp:19
float metal
Metalness value.
Definition: CompositeObj.hpp:29
bool hasSpec
Has a specular value.
Definition: CompositeObj.hpp:36
std::string specTexturePath
Specular texture path.
Definition: CompositeObj.hpp:24
Associate a mesh and a material.
Definition: CompositeObj.hpp:42
std::string name
Name of the object.
Definition: CompositeObj.hpp:45
std::string material
Name of the material.
Definition: CompositeObj.hpp:46
Object(const std::string &aName)
Definition: CompositeObj.hpp:52
Mesh mesh
The mesh.
Definition: CompositeObj.hpp:44