23#ifndef VCL_IO_MESH_OBJ_MATERIAL_H
24#define VCL_IO_MESH_OBJ_MATERIAL_H
26#include <vclib/space/core.h>
28namespace vcl::detail {
46 bool hasColor =
false;
47 bool hasTexture =
false;
49 ObjMaterial() =
default;
51 ObjMaterial(
const Color& c) : hasColor(true)
59 ObjMaterial(
const std::string& txtName) : map_Kd(txtName), hasTexture(true)
63 ObjMaterial(
const Color& c,
const std::string& txtName) :
64 map_Kd(txtName), hasColor(true), hasTexture(true)
72 bool isEmpty()
const {
return !hasColor && !hasTexture; }
76 return Color(Kd.x() * 255, Kd.y() * 255, Kd.z() * 255, d * 255);
79 const std::string& texture()
const {
return map_Kd; }
81 uint textureId()
const {
return mapId; }
92 bool operator<(
const ObjMaterial& m)
const
102 else if (m.hasColor) {
111 return map_Kd < m.map_Kd;
113 else if (m.hasTexture) {
121 bool operator==(
const ObjMaterial& m)
const
123 return !(*
this < m) && !(m < *
this);
126 bool operator!=(
const ObjMaterial& m)
const {
return !(*
this == m); }
129inline std::ostream& operator<<(std::ostream& out,
const ObjMaterial& m)
132 out <<
"Kd " << m.Kd.x() <<
" " << m.Kd.y() <<
" " << m.Kd.z()
134 out <<
"d " << m.d << std::endl;
137 out <<
"map_Kd " << m.map_Kd << std::endl;
Point3< float > Point3f
A convenience alias for a 3-dimensional Point with floating-point components.
Definition point.h:767