13 #include <unordered_map>
18 namespace visualization {
20 struct MaterialRecord;
24 using TextureMaps = std::unordered_map<std::string, t::geometry::Image>;
29 std::hash<std::string>,
30 std::equal_to<std::string>,
31 Eigen::aligned_allocator<
32 std::pair<const std::string, Eigen::Vector4f>>>;
46 : material_name_(material_name) {}
54 bool IsValid()
const {
return !material_name_.empty(); }
70 return texture_maps_.at(key);
75 return scalar_properties_;
83 return scalar_properties_.at(key);
88 return vector_properties_;
96 return vector_properties_.at(key);
112 scalar_properties_[key] = value;
121 const Eigen::Vector4f &value) {
122 vector_properties_[key] = value;
131 material_name_ = material_name;
138 return texture_maps_.count(key) > 0;
145 return scalar_properties_.count(key) > 0;
152 return vector_properties_.count(key) > 0;
335 std::string material_name_;
std::shared_ptr< core::Tensor > image
The Image class stores image with customizable rows, cols, channels, dtype and device.
void SetMaterialName(const std::string &material_name)
Set material name. The material name should match the name of a built.
Eigen::Vector4f GetAbsorptionColor() const
const std::string & GetMaterialName() const
Get the name of the material.
bool HasThickness() const
void SetThickness(float value)
const t::geometry::Image & GetMetallicMap() const
void SetRoughnessMap(const t::geometry::Image &image)
bool HasNormalMap() const
std::unordered_map< std::string, t::geometry::Image > TextureMaps
std::string ToString() const
String reprentation for printing.
void SetClearcoatRoughnessMap(const t::geometry::Image &image)
bool HasVectorProperty(const std::string &key) const
Eigen::Vector4f GetBaseColor() const
bool HasRoughnessMap() const
float GetThickness() const
void SetDefaultProperties()
const VectorPropertyMap & GetVectorProperties() const
Returns the map of vector properties.
const t::geometry::Image & GetAnisotropyMap() const
bool HasMetallicMap() const
void SetReflectanceMap(const t::geometry::Image &image)
const ScalarPropertyMap & GetScalarProperties() const
Returns the map of scalar properties.
void SetBaseReflectance(float value)
Eigen::Vector4f GetVectorProperty(const std::string &key) const
void SetLineWidth(float value)
void ToMaterialRecord(MaterialRecord &record) const
Fills a legacy MaterialRecord constructed from this Material.
float GetBaseClearcoatRoughness() const
bool HasAlbedoMap() const
bool HasLineWidth() const
void SetAbsorptionDistance(float value)
void SetClearcoatMap(const t::geometry::Image &image)
const t::geometry::Image & GetRoughnessMap() const
bool HasBaseRoughness() const
bool HasEmissiveColor() const
bool HasAnisotropyMap() const
bool HasAnisotropy() const
Eigen::Vector4f GetEmissiveColor() const
bool HasBaseReflectance() const
bool HasClearcoatMap() const
void SetVectorProperty(const std::string &key, const Eigen::Vector4f &value)
float GetAnisotropy() const
float GetBaseClearcoat() const
float GetLineWidth() const
void SetAnisotropyMap(const t::geometry::Image &image)
void SetAORoughnessMetalMap(const t::geometry::Image &image)
bool HasTextureMap(const std::string &key) const
void SetAOMap(const t::geometry::Image &image)
static Material FromMaterialRecord(const MaterialRecord &mat)
Convert from MaterialRecord.
std::unordered_map< std::string, float > ScalarPropertyMap
void SetAbsorptionColor(const Eigen::Vector4f &value)
bool HasClearcoatRoughnessMap() const
Material & operator=(const Material &other)=default
const t::geometry::Image & GetNormalMap() const
void SetBaseRoughness(float value)
bool HasBaseColor() const
bool HasReflectanceMap() const
bool HasBaseClearcoatRoughness() const
float GetBaseRoughness() const
void SetPointSize(float value)
void SetTransmission(float value)
float GetAbsorptionDistance() const
void SetScalarProperty(const std::string &key, float value)
Material(const std::string &material_name)
Create an empty but valid material for the specified material name.
bool HasBaseClearcoat() const
void SetTextureMap(const std::string &key, const t::geometry::Image &image)
float GetBaseMetallic() const
void SetBaseColor(const Eigen::Vector4f &value)
bool HasBaseMetallic() const
bool HasAORoughnessMetalMap() const
void SetEmissiveColor(const Eigen::Vector4f &value)
float GetBaseReflectance() const
void SetAlbedoMap(const t::geometry::Image &image)
void SetAnisotropy(float value)
void SetMetallicMap(const t::geometry::Image &image)
bool HasAbsorptionDistance() const
void SetBaseClearcoat(float value)
bool HasTransmission() const
Material()=default
Create an empty, invalid material.
const t::geometry::Image & GetTextureMap(const std::string &key) const
void SetBaseClearcoatRoughness(float value)
bool HasPointSize() const
std::unordered_map< std::string, Eigen::Vector4f, std::hash< std::string >, std::equal_to< std::string >, Eigen::aligned_allocator< std::pair< const std::string, Eigen::Vector4f > >> VectorPropertyMap
void SetBaseMetallic(float value)
float GetPointSize() const
bool HasAbsorptionColor() const
Material(const Material &mat)=default
bool HasScalarProperty(const std::string &key) const
const t::geometry::Image & GetClearcoatMap() const
const t::geometry::Image & GetAOMap() const
float GetTransmission() const
const t::geometry::Image & GetAORoughnessMetalMap() const
const TextureMaps & GetTextureMaps() const
Returns the texture map map.
const t::geometry::Image & GetAlbedoMap() const
const t::geometry::Image & GetClearcoatRoughnessMap() const
float GetScalarProperty(const std::string &key) const
void SetNormalMap(const t::geometry::Image &image)
const t::geometry::Image & GetReflectanceMap() const
Generic file read and write utility for python interface.