cgv
textured_surface_material.h
1 #pragma once
2 
3 #include <vector>
4 #include "surface_material.h"
5 #include "obj_material.hh"
6 
7 #include "lib_begin.h"
8 
9 namespace cgv {
10  namespace media {
11  namespace illum {
12 
15 {
16 protected:
18  std::string name;
22  std::vector<std::string> image_file_names;
26 
30 
34 
39 
48 
51  float bump_scale;
52 public: //@<
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>
cgv::media::illum::textured_surface_material::diffuse_index
int diffuse_index
index of image from which diffuse_reflectance should be mapped, -1 corresponds to no mapping
Definition: textured_surface_material.h:24
cgv::media::illum::textured_surface_material::metalness_index
int metalness_index
index of image from which metalness should be mapped, -1 corresponds to no mapping
Definition: textured_surface_material.h:32
cgv::media::illum::textured_surface_material::get_bump_scale
float get_bump_scale() const
return bump scale
Definition: textured_surface_material.h:135
cgv::media::illum::textured_surface_material::transparency_index
int transparency_index
index of image from which transparency should be mapped, -1 corresponds to no mapping
Definition: textured_surface_material.h:40
cgv::media::illum::textured_surface_material::get_sRGBA_textures
bool get_sRGBA_textures() const
return whether textures are interpreted in sRGB format
Definition: textured_surface_material.h:80
cgv::media::illum::textured_surface_material::specular_index
int specular_index
index of image from which specular_reflectance should be mapped, -1 corresponds to no mapping
Definition: textured_surface_material.h:44
cgv::media::illum::textured_surface_material::sRGBA_textures
bool sRGBA_textures
whether textures are in sRGB format
Definition: textured_surface_material.h:20
cgv::media::illum::obj_material
>extension of a phong material with support for texture mapped color channels
Definition: obj_material.hh:12
cgv::media::illum::textured_surface_material::propagation_slow_down_index
int propagation_slow_down_index
index of image from which diffuse_reflectance should be mapped, -1 corresponds to no mapping
Definition: textured_surface_material.h:42
cgv::media::illum::textured_surface_material::bump_index
int bump_index
index of image from which bumps should be mapped, -1 corresponds to no mapping
Definition: textured_surface_material.h:49
cgv::media::illum::textured_surface_material::normal_index
int normal_index
index of image from which normals should be mapped, -1 corresponds to no mapping
Definition: textured_surface_material.h:46
cgv::media::illum::textured_surface_material::image_file_names
std::vector< std::string > image_file_names
vector of image file names
Definition: textured_surface_material.h:22
cgv::media::illum::textured_surface_material::get_nr_textures
virtual size_t get_nr_textures() const
virtual method to query number of textures
Definition: textured_surface_material.h:94
cgv::media::illum::textured_surface_material::ref_bump_scale
float & ref_bump_scale()
return reference to bump scale
Definition: textured_surface_material.h:137
cgv::media::illum::textured_surface_material::roughness_index
int roughness_index
index of image from which roughness should be mapped, -1 corresponds to no mapping
Definition: textured_surface_material.h:28
cgv::media::color< float, RGB >
cgv::media::illum::textured_surface_material::get_image_file_name
std::string get_image_file_name(int i) const
return the name of the i-th image file
Definition: textured_surface_material.h:88
cgv::media::illum::surface_material
simple class to hold the material properties of a phong material
Definition: surface_material.h:26
cgv::media::illum::textured_surface_material::get_name
const std::string & get_name() const
return name value
Definition: textured_surface_material.h:74
cgv::media::illum::textured_surface_material::emission_index
int emission_index
index of image from which emission should be mapped, -1 corresponds to no mapping
Definition: textured_surface_material.h:37
cgv::media::illum::textured_surface_material::bump_scale
float bump_scale
scaling factor for bump map
Definition: textured_surface_material.h:51
cgv::media::illum::textured_surface_material::get_nr_image_files
unsigned get_nr_image_files() const
return number of image files
Definition: textured_surface_material.h:84
cgv::media::illum::textured_surface_material::set_image_file_name
void set_image_file_name(int i, std::string image_file_name)
set the image file name of i-th image file
Definition: textured_surface_material.h:90
cgv::media::illum::textured_surface_material::ref_image_file_name
std::string & ref_image_file_name(int i)
return reference to image file name of i-th image file
Definition: textured_surface_material.h:92
cgv::media::illum::textured_surface_material::set_bump_scale
void set_bump_scale(float bs)
set scale of bumps
Definition: textured_surface_material.h:133
cgv::media::illum::textured_surface_material::set_name
void set_name(std::string o)
set the name of the material
Definition: textured_surface_material.h:72
cgv::media::illum::textured_surface_material
simple class to hold the material properties of a phong material
Definition: textured_surface_material.h:15
cgv::media::illum::textured_surface_material::ref_sRGBA_textures
bool & ref_sRGBA_textures()
return reference to whether textures are interpreted in sRGB format
Definition: textured_surface_material.h:82
cgv
the cgv namespace
Definition: vr_calib.cxx:9
cgv::media::illum::textured_surface_material::ambient_index
int ambient_index
index of image from which ambient_occlusion should be mapped, -1 corresponds to no mapping
Definition: textured_surface_material.h:35
cgv::media::illum::textured_surface_material::ref_name
std::string & ref_name()
return reference to name value
Definition: textured_surface_material.h:76
cgv::media::illum::textured_surface_material::name
std::string name
name of material
Definition: textured_surface_material.h:18