cgv
Loading...
Searching...
No Matches
textured_surface_material.h
1#pragma once
2
3#include <vector>
4#include "surface_material.h"
5#include "obj_material.h"
6
7#include "lib_begin.h"
8
9namespace cgv {
10 namespace media {
11 namespace illum {
12
15{
16protected:
18 std::string name;
22 std::vector<std::string> image_file_names;
26
30
34
39
48
52public: //@<
55 const std::string& _name = "default",
56 BrdfType _brdf_type = BrdfType(BT_STRAUSS_DIFFUSE + BT_STRAUSS),
57 color_type _diffuse_reflectance = 0.5f,
58 float _roughness = 0.5f,
59 float _metalness = 0.0f,
60 float _ambient_occlusion = 1.0f,
61 color_type _emission = color_type(0, 0, 0),
62 float _transparency = 0.0f,
63 const std::complex<float>& _propagation_slow_down = std::complex<float>(1.5f, 0.0f),
64 float _roughness_anisotropy = 0.0f,
65 float _roughness_orientation = 0.0f,
66 color_type _specular_reflectance = color_type(1, 1, 1),
67 float _bump_scale = 0.1f
68 );
72 void set_name(std::string o) { name = o; }
74 const std::string& get_name() const { return name; }
76 std::string& ref_name() { return name; }
78 void set_sRGBA_textures(bool do_set = true);
80 bool get_sRGBA_textures() const { return sRGBA_textures; }
82 bool& ref_sRGBA_textures() { return sRGBA_textures; }
84 unsigned get_nr_image_files() const { return unsigned(image_file_names.size()); }
86 int add_image_file(const std::string& file_name);
88 std::string get_image_file_name(int i) const { return image_file_names[i]; }
90 void set_image_file_name(int i, std::string image_file_name) { image_file_names[i] = image_file_name; }
92 std::string& ref_image_file_name(int i) { return image_file_names[i]; }
94 virtual size_t get_nr_textures() const { return get_nr_image_files(); }
96 void set_diffuse_index(int i) { diffuse_index = i; }
97 int get_diffuse_index() const { return diffuse_index; }
98 int& ref_diffuse_index() { return diffuse_index; }
99
100 void set_roughness_index(int i) { roughness_index = i; }
101 int get_roughness_index() const { return roughness_index; }
102 int& ref_roughness_index() { return roughness_index; }
103
104 void set_metalness_index(int i) { metalness_index = i; }
105 int get_metalness_index() const { return metalness_index; }
106 int& ref_metalness_index() { return metalness_index; }
107
108 void set_ambient_index(int i) { ambient_index = i; }
109 int get_ambient_index() const { return ambient_index; }
110 int& ref_ambient_index() { return ambient_index; }
111
112 void set_emission_index(int i) { emission_index = i; }
113 int get_emission_index() const { return emission_index; }
114 int& ref_emission_index() { return emission_index; }
115
116 void set_transparency_index(int i) { transparency_index = i; }
117 int get_transparency_index() const { return transparency_index; }
118 int& ref_transparency_index() { return transparency_index; }
119
120 void set_specular_index(int i) { specular_index = i; }
121 int get_specular_index() const { return specular_index; }
122 int& ref_specular_index() { return specular_index; }
123
124 void set_normal_index(int i) { normal_index = i; }
125 int get_normal_index() const { return normal_index; }
126 int& ref_normal_index() { return normal_index; }
127
128 void set_bump_index(int i) { bump_index = i; }
129 int get_bump_index() const { return bump_index; }
130 int& ref_bump_index() { return bump_index; }
131
133 void set_bump_scale(float bs) { bump_scale = bs; }
135 float get_bump_scale() const { return bump_scale; }
137 float& ref_bump_scale() { return bump_scale; }
138};
139
140
141 }
142 }
143}
144
145#include <cgv/config/lib_end.h>
>extension of a phong material with support for texture mapped color channels
simple class to hold the material properties of a phong material
simple class to hold the material properties of a phong material
int metalness_index
index of image from which metalness should be mapped, -1 corresponds to no mapping
const std::string & get_name() const
return name value
void set_image_file_name(int i, std::string image_file_name)
set the image file name of i-th image file
std::vector< std::string > image_file_names
vector of image file names
int propagation_slow_down_index
index of image from which diffuse_reflectance should be mapped, -1 corresponds to no mapping
void set_name(std::string o)
set the name of the material
int transparency_index
index of image from which transparency should be mapped, -1 corresponds to no mapping
bool sRGBA_textures
whether textures are in sRGB format
virtual size_t get_nr_textures() const
virtual method to query number of textures
int roughness_index
index of image from which roughness should be mapped, -1 corresponds to no mapping
bool & ref_sRGBA_textures()
return reference to whether textures are interpreted in sRGB format
std::string & ref_name()
return reference to name value
unsigned get_nr_image_files() const
return number of image files
bool get_sRGBA_textures() const
return whether textures are interpreted in sRGB format
int specular_index
index of image from which specular_reflectance should be mapped, -1 corresponds to no mapping
float & ref_bump_scale()
return reference to bump scale
int ambient_index
index of image from which ambient_occlusion should be mapped, -1 corresponds to no mapping
std::string & ref_image_file_name(int i)
return reference to image file name of i-th image file
int emission_index
index of image from which emission should be mapped, -1 corresponds to no mapping
int bump_index
index of image from which bumps should be mapped, -1 corresponds to no mapping
std::string get_image_file_name(int i) const
return the name of the i-th image file
int diffuse_index
index of image from which diffuse_reflectance should be mapped, -1 corresponds to no mapping
int normal_index
index of image from which normals should be mapped, -1 corresponds to no mapping
the cgv namespace
Definition print.h:11