10 #include <string_view>
18 struct Error : std::runtime_error {
30 : std::runtime_error(message)
35 : std::runtime_error(message)
87 [[nodiscard]]
static Scene parse(std::string_view objString);
IlluminationModel
Illumination model to use when rendering a specific Material.
Definition: obj.hpp:101
@ BLINN_PHONG_RAYTRACE_FRESNEL
Implementation-defined.
@ LAMBERT
Implementation-defined.
@ BLINN_PHONG_RAYTRACE_GLASS
Implementation-defined.
@ BLINN_PHONG_RAYTRACE_REFRACT_FRESNEL
Implementation-defined.
@ BLINN_PHONG_REFLECT
Implementation-defined.
@ BLINN_PHONG_REFLECT_GLASS
Implementation-defined.
@ SHADOW
Implementation-defined.
@ BLINN_PHONG_RAYTRACE
Implementation-defined.
@ BLINN_PHONG_RAYTRACE_REFRACT
Implementation-defined.
@ BLINN_PHONG
Implementation-defined.
@ FLAT
Implementation-defined.
Definition: utilities.hpp:114
Exception type for errors originating from the OBJ API.
Definition: obj.hpp:18
std::size_t lineNumber
Line number, starting at 1 for the first line, where the error occured.
Definition: obj.hpp:27
Error(const std::string &message, std::string_view::iterator position, std::size_t lineNumber)
Definition: obj.hpp:29
std::string_view::iterator position
Iterator into the source OBJ string where the error originated from.
Definition: obj.hpp:22
Error(const char *message, std::string_view::iterator position, std::size_t lineNumber)
Definition: obj.hpp:34
Single vertex of a polygonal Face element.
Definition: obj.hpp:43
std::uint32_t textureCoordinateIndex
Index of the texture coordinates in the Scene that define the texture coordinates of the vertex.
Definition: obj.hpp:45
std::uint32_t normalIndex
Index of the normal vector in the Scene that define the vertex normal.
Definition: obj.hpp:46
std::uint32_t vertexIndex
Index of the vertex coordinates in the Scene that define the vertex position.
Definition: obj.hpp:44
Face element forming a single polygon of FaceVertex vertices.
Definition: obj.hpp:52
std::vector< FaceVertex > vertices
List of vertices that make up the polygon.
Definition: obj.hpp:53
Group containing polygonal Face elements within an Object.
Definition: obj.hpp:59
std::string materialName
Name of the material of this group, which should be found in one of the associated material libraries...
Definition: obj.hpp:62
std::string name
Name of the group, or empty if no name was specified.
Definition: obj.hpp:60
std::vector< Face > faces
List of faces belonging to this group.
Definition: obj.hpp:61
Object mesh containing Group elements within a Scene.
Definition: obj.hpp:68
std::string name
Name of the object, or empty if no name was specified.
Definition: obj.hpp:69
std::vector< Group > groups
List of groups belonging to this object.
Definition: obj.hpp:70
Scene of Object elements defined by an OBJ file.
Definition: obj.hpp:76
std::vector< vec2 > textureCoordinates
List of texture coordinates referenced by the face vertices defined in this scene.
Definition: obj.hpp:91
std::vector< vec3 > normals
List of normal vectors referenced by the face vertices defined in this scene.
Definition: obj.hpp:92
static Scene parse(std::string_view objString)
Parse a scene from an OBJ string.
std::vector< Object > objects
List of objects belonging to this scene.
Definition: obj.hpp:93
std::vector< std::string > materialLibraryFilenames
List of relative filepaths of the material libraries associated with this scene.
Definition: obj.hpp:89
std::vector< vec3 > vertices
List of vertex positions referenced by the face vertices defined in this scene.
Definition: obj.hpp:90
Material library that stores the material properties for objects defined in a Scene.
Definition: obj.hpp:140
std::vector< Material > materials
List of materials belonging to this library.
Definition: obj.hpp:153
static Library parse(std::string_view mtlString)
Parse a material library from an MTL string.
Material properties of an Object.
Definition: obj.hpp:118
vec3 diffuseColor
Diffuse color factor to multiply the sampled diffuse map value by.
Definition: obj.hpp:128
std::string specularExponentMapName
Relative filepath of the specular exponent map image, or empty for no specular exponent map.
Definition: obj.hpp:124
vec3 ambientColor
Ambient color factor to multiply the sampled ambient map value by.
Definition: obj.hpp:127
float dissolveFactor
Dissolve factor to multiply the sampled dissolve factor map value by.
Definition: obj.hpp:132
float specularExponent
Specular exponent factor to multiply the sampled specular exponent map value by.
Definition: obj.hpp:131
vec3 specularColor
Specular color factor to multiply the sampled specular map value by.
Definition: obj.hpp:129
IlluminationModel illuminationModel
Illumination model to use for rendering this material.
Definition: obj.hpp:133
std::string ambientMapName
Relative filepath of the ambient map image, or empty for no ambient map.
Definition: obj.hpp:120
std::string specularMapName
Relative filepath of the specular map image, or empty for no specular map.
Definition: obj.hpp:122
std::string diffuseMapName
Relative filepath of the diffuse map image, or empty for no diffuse map.
Definition: obj.hpp:121
std::string bumpMapName
Relative filepath of the bump/normal map image, or empty for no bump/normal map.
Definition: obj.hpp:126
std::string emissiveMapName
Relative filepath of the emissive map image, or empty for no emissive map.
Definition: obj.hpp:123
std::string dissolveFactorMapName
Relative filepath of the dissolve factor map image, or empty for no dissolve factor map.
Definition: obj.hpp:125
std::string name
Name of the material.
Definition: obj.hpp:119
vec3 emissiveColor
Emissive color factor to multiply the sampled emissive map value by.
Definition: obj.hpp:130