cgv
Loading...
Searching...
No Matches
cgv::media::illum::textured_surface_material Class Reference

simple class to hold the material properties of a phong material More...

#include <textured_surface_material.h>

Inheritance diagram for cgv::media::illum::textured_surface_material:
cgv::media::illum::surface_material cgv::render::textured_material

Public Member Functions

 textured_surface_material (const std::string &_name="default", BrdfType _brdf_type=BrdfType(BT_STRAUSS_DIFFUSE+BT_STRAUSS), color_type _diffuse_reflectance=0.5f, float _roughness=0.5f, float _metalness=0.0f, float _ambient_occlusion=1.0f, color_type _emission=color_type(0, 0, 0), float _transparency=0.0f, const std::complex< float > &_propagation_slow_down=std::complex< float >(1.5f, 0.0f), float _roughness_anisotropy=0.0f, float _roughness_orientation=0.0f, color_type _specular_reflectance=color_type(1, 1, 1), float _bump_scale=0.1f)
 define default material
 
 textured_surface_material (const obj_material &obj_mat)
 convert obj material
 
void set_name (std::string o)
 set the name of the material
 
const std::string & get_name () const
 return name value
 
std::string & ref_name ()
 return reference to name value
 
void set_sRGBA_textures (bool do_set=true)
 set whether textures are interpreted in sRGB format
 
bool get_sRGBA_textures () const
 return whether textures are interpreted in sRGB format
 
bool & ref_sRGBA_textures ()
 return reference to whether textures are interpreted in sRGB format
 
unsigned get_nr_image_files () const
 return number of image files
 
int add_image_file (const std::string &file_name)
 add a new image and return its index
 
std::string get_image_file_name (int i) const
 return the name of the i-th image file
 
void set_image_file_name (int i, std::string image_file_name)
 set the image file name of i-th image file
 
std::string & ref_image_file_name (int i)
 return reference to image file name of i-th image file
 
virtual size_t get_nr_textures () const
 virtual method to query number of textures
 
void set_diffuse_index (int i)
 
int get_diffuse_index () const
 
int & ref_diffuse_index ()
 
void set_roughness_index (int i)
 
int get_roughness_index () const
 
int & ref_roughness_index ()
 
void set_metalness_index (int i)
 
int get_metalness_index () const
 
int & ref_metalness_index ()
 
void set_ambient_index (int i)
 
int get_ambient_index () const
 
int & ref_ambient_index ()
 
void set_emission_index (int i)
 
int get_emission_index () const
 
int & ref_emission_index ()
 
void set_transparency_index (int i)
 
int get_transparency_index () const
 
int & ref_transparency_index ()
 
void set_specular_index (int i)
 
int get_specular_index () const
 
int & ref_specular_index ()
 
void set_normal_index (int i)
 
int get_normal_index () const
 
int & ref_normal_index ()
 
void set_bump_index (int i)
 
int get_bump_index () const
 
int & ref_bump_index ()
 
void set_bump_scale (float bs)
 set scale of bumps
 
float get_bump_scale () const
 return bump scale
 
float & ref_bump_scale ()
 return reference to bump scale
 
- Public Member Functions inherited from cgv::media::illum::surface_material
 surface_material (BrdfType _brdf_type=BrdfType(BT_STRAUSS_DIFFUSE+BT_STRAUSS), color_type _diffuse_reflectance=color_type(0.5f, 0.5f, 0.5f), float _roughness=0.5f, float _metalness=0.0f, float _ambient_occlusion=1.0f, color_type _emission=color_type(0, 0, 0), float _transparency=0.0f, const std::complex< float > &_propagation_slow_down=std::complex< float >(1.5f, 0.0f), float _roughness_anisotropy=0.0f, float _roughness_orientation=0.0f, color_type _specular_reflectance=color_type(1, 1, 1))
 construct default material
 
void set_brdf_type (BrdfType brdf_type)
 
BrdfType get_brdf_type () const
 
BrdfType & ref_brdf_type ()
 
void set_ambient_occlusion (float ambient_occlusion)
 
float get_ambient_occlusion () const
 
float & ref_ambient_occlusion ()
 
void set_diffuse_reflectance (color_type diffuse_reflectance)
 
color_type get_diffuse_reflectance () const
 
color_typeref_diffuse_reflectance ()
 
void set_specular_reflectance (color_type specular_reflectance)
 
color_type get_specular_reflectance () const
 
color_typeref_specular_reflectance ()
 
void set_emission (color_type emission)
 
color_type get_emission () const
 
color_typeref_emission ()
 
void set_transparency (float transparency)
 
float get_transparency () const
 
float & ref_transparency ()
 
void set_roughness (float roughness)
 
float get_roughness () const
 
float & ref_roughness ()
 
void set_metalness (float metalness)
 
float get_metalness () const
 
float & ref_metalness ()
 
void set_roughness_anisotropy (float roughness_anisotropy)
 
float get_roughness_anisotropy () const
 
float & ref_roughness_anisotropy ()
 
void set_roughness_orientation (float roughness_orientation)
 
float get_roughness_orientation () const
 
float & ref_roughness_orientation ()
 
void set_propagation_slow_down (std::complex< float > propagation_slow_down)
 
std::complex< float > get_propagation_slow_down () const
 
std::complex< float > & ref_propagation_slow_down ()
 

Protected Attributes

std::string name
 name of material
 
bool sRGBA_textures
 whether textures are in sRGB format
 
std::vector< std::string > image_file_names
 vector of image file names
 
int diffuse_index
 index of image from which diffuse_reflectance should be mapped, -1 corresponds to no mapping
 
int roughness_index
 index of image from which roughness should be mapped, -1 corresponds to no mapping
 
int metalness_index
 index of image from which metalness should be mapped, -1 corresponds to no mapping
 
int ambient_index
 index of image from which ambient_occlusion should be mapped, -1 corresponds to no mapping
 
int emission_index
 index of image from which emission should be mapped, -1 corresponds to no mapping
 
int transparency_index
 index of image from which transparency should be mapped, -1 corresponds to no mapping
 
int propagation_slow_down_index
 index of image from which diffuse_reflectance should be mapped, -1 corresponds to no mapping
 
int specular_index
 index of image from which specular_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
 
int bump_index
 index of image from which bumps should be mapped, -1 corresponds to no mapping
 
float bump_scale
 scaling factor for bump map
 
- Protected Attributes inherited from cgv::media::illum::surface_material
BrdfType brdf_type
 store brdf type, defaults to BT_COOK_TORRANCE
 
color_type diffuse_reflectance
 diffuse reflectance of surface, defaults to 0.5,0.5,0.5
 
float roughness
 surface roughness in the range [0,1] (1/2 trace of symmetric 2x2 matrix for anisotropic case where directional roughness is represented in the uv-coordinate system of texcoords), defaults to 0.5
 
float metalness
 metalness of surface
 
float ambient_occlusion
 scalar factor to down scale ambient light, defaults to 1
 
color_type emission
 emissive color component, defaults to 0,0,0
 
float transparency
 modulation for transparency, defaults to 0
 
std::complex< float > propagation_slow_down
 complex fraction of complex interior over real exterior index of refraction, defaults to 1.5,0
 
float roughness_anisotropy
 difference of roughness matrix eigenvalues in range [0,1] relative to roughness, i.e. lambda_1 - lambda_2 = roughness_anisotropy*roughness, defaults to 0
 
float roughness_orientation
 orientation of roughness in range [0,1], where 0 corresponds to u-direction and 0.5 to v direction, defaults to 0
 
color_type specular_reflectance
 specular color used to modulate specular reflection component, should be 1,1,1
 

Additional Inherited Members

- Public Types inherited from cgv::media::illum::surface_material
typedef color< float, RGB > color_type
 used color type
 

Detailed Description

simple class to hold the material properties of a phong material

Definition at line 14 of file textured_surface_material.h.

Constructor & Destructor Documentation

◆ textured_surface_material() [1/2]

cgv::media::illum::textured_surface_material::textured_surface_material ( const std::string &  _name = "default",
BrdfType  _brdf_type = BrdfType(BT_STRAUSS_DIFFUSE + BT_STRAUSS),
color_type  _diffuse_reflectance = 0.5f,
float  _roughness = 0.5f,
float  _metalness = 0.0f,
float  _ambient_occlusion = 1.0f,
color_type  _emission = color_type(0, 0, 0),
float  _transparency = 0.0f,
const std::complex< float > &  _propagation_slow_down = std::complex<float>(1.5f, 0.0f),
float  _roughness_anisotropy = 0.0f,
float  _roughness_orientation = 0.0f,
color_type  _specular_reflectance = color_type(1, 1, 1),
float  _bump_scale = 0.1f 
)

◆ textured_surface_material() [2/2]

Member Function Documentation

◆ add_image_file()

int cgv::media::illum::textured_surface_material::add_image_file ( const std::string &  file_name)

add a new image and return its index

Definition at line 104 of file textured_surface_material.cxx.

References image_file_names.

Referenced by textured_surface_material().

◆ get_ambient_index()

int cgv::media::illum::textured_surface_material::get_ambient_index ( ) const
inline

Definition at line 109 of file textured_surface_material.h.

◆ get_bump_index()

int cgv::media::illum::textured_surface_material::get_bump_index ( ) const
inline

Definition at line 129 of file textured_surface_material.h.

◆ get_bump_scale()

float cgv::media::illum::textured_surface_material::get_bump_scale ( ) const
inline

return bump scale

Definition at line 135 of file textured_surface_material.h.

◆ get_diffuse_index()

int cgv::media::illum::textured_surface_material::get_diffuse_index ( ) const
inline

Definition at line 97 of file textured_surface_material.h.

◆ get_emission_index()

int cgv::media::illum::textured_surface_material::get_emission_index ( ) const
inline

Definition at line 113 of file textured_surface_material.h.

◆ get_image_file_name()

std::string cgv::media::illum::textured_surface_material::get_image_file_name ( int  i) const
inline

return the name of the i-th image file

Definition at line 88 of file textured_surface_material.h.

◆ get_metalness_index()

int cgv::media::illum::textured_surface_material::get_metalness_index ( ) const
inline

Definition at line 105 of file textured_surface_material.h.

◆ get_name()

const std::string & cgv::media::illum::textured_surface_material::get_name ( ) const
inline

return name value

Definition at line 74 of file textured_surface_material.h.

◆ get_normal_index()

int cgv::media::illum::textured_surface_material::get_normal_index ( ) const
inline

Definition at line 125 of file textured_surface_material.h.

◆ get_nr_image_files()

unsigned cgv::media::illum::textured_surface_material::get_nr_image_files ( ) const
inline

return number of image files

Definition at line 84 of file textured_surface_material.h.

Referenced by cgv::render::shader_program::set_textured_material_uniform().

◆ get_nr_textures()

virtual size_t cgv::media::illum::textured_surface_material::get_nr_textures ( ) const
inlinevirtual

virtual method to query number of textures

Reimplemented in cgv::render::textured_material.

Definition at line 94 of file textured_surface_material.h.

◆ get_roughness_index()

int cgv::media::illum::textured_surface_material::get_roughness_index ( ) const
inline

Definition at line 101 of file textured_surface_material.h.

◆ get_specular_index()

int cgv::media::illum::textured_surface_material::get_specular_index ( ) const
inline

Definition at line 121 of file textured_surface_material.h.

◆ get_sRGBA_textures()

bool cgv::media::illum::textured_surface_material::get_sRGBA_textures ( ) const
inline

return whether textures are interpreted in sRGB format

Definition at line 80 of file textured_surface_material.h.

Referenced by cgv::render::shader_program::set_textured_material_uniform().

◆ get_transparency_index()

int cgv::media::illum::textured_surface_material::get_transparency_index ( ) const
inline

Definition at line 117 of file textured_surface_material.h.

◆ ref_ambient_index()

int & cgv::media::illum::textured_surface_material::ref_ambient_index ( )
inline

Definition at line 110 of file textured_surface_material.h.

◆ ref_bump_index()

int & cgv::media::illum::textured_surface_material::ref_bump_index ( )
inline

Definition at line 130 of file textured_surface_material.h.

◆ ref_bump_scale()

float & cgv::media::illum::textured_surface_material::ref_bump_scale ( )
inline

return reference to bump scale

Definition at line 137 of file textured_surface_material.h.

◆ ref_diffuse_index()

int & cgv::media::illum::textured_surface_material::ref_diffuse_index ( )
inline

Definition at line 98 of file textured_surface_material.h.

◆ ref_emission_index()

int & cgv::media::illum::textured_surface_material::ref_emission_index ( )
inline

Definition at line 114 of file textured_surface_material.h.

◆ ref_image_file_name()

std::string & cgv::media::illum::textured_surface_material::ref_image_file_name ( int  i)
inline

return reference to image file name of i-th image file

Definition at line 92 of file textured_surface_material.h.

◆ ref_metalness_index()

int & cgv::media::illum::textured_surface_material::ref_metalness_index ( )
inline

Definition at line 106 of file textured_surface_material.h.

◆ ref_name()

std::string & cgv::media::illum::textured_surface_material::ref_name ( )
inline

return reference to name value

Definition at line 76 of file textured_surface_material.h.

◆ ref_normal_index()

int & cgv::media::illum::textured_surface_material::ref_normal_index ( )
inline

Definition at line 126 of file textured_surface_material.h.

◆ ref_roughness_index()

int & cgv::media::illum::textured_surface_material::ref_roughness_index ( )
inline

Definition at line 102 of file textured_surface_material.h.

◆ ref_specular_index()

int & cgv::media::illum::textured_surface_material::ref_specular_index ( )
inline

Definition at line 122 of file textured_surface_material.h.

◆ ref_sRGBA_textures()

bool & cgv::media::illum::textured_surface_material::ref_sRGBA_textures ( )
inline

return reference to whether textures are interpreted in sRGB format

Definition at line 82 of file textured_surface_material.h.

◆ ref_transparency_index()

int & cgv::media::illum::textured_surface_material::ref_transparency_index ( )
inline

Definition at line 118 of file textured_surface_material.h.

◆ set_ambient_index()

void cgv::media::illum::textured_surface_material::set_ambient_index ( int  i)
inline

Definition at line 108 of file textured_surface_material.h.

◆ set_bump_index()

void cgv::media::illum::textured_surface_material::set_bump_index ( int  i)
inline

Definition at line 128 of file textured_surface_material.h.

◆ set_bump_scale()

void cgv::media::illum::textured_surface_material::set_bump_scale ( float  bs)
inline

set scale of bumps

Definition at line 133 of file textured_surface_material.h.

Referenced by textured_surface_material().

◆ set_diffuse_index()

void cgv::media::illum::textured_surface_material::set_diffuse_index ( int  i)
inline

Definition at line 96 of file textured_surface_material.h.

◆ set_emission_index()

void cgv::media::illum::textured_surface_material::set_emission_index ( int  i)
inline

Definition at line 112 of file textured_surface_material.h.

◆ set_image_file_name()

void cgv::media::illum::textured_surface_material::set_image_file_name ( int  i,
std::string  image_file_name 
)
inline

set the image file name of i-th image file

Definition at line 90 of file textured_surface_material.h.

◆ set_metalness_index()

void cgv::media::illum::textured_surface_material::set_metalness_index ( int  i)
inline

Definition at line 104 of file textured_surface_material.h.

◆ set_name()

void cgv::media::illum::textured_surface_material::set_name ( std::string  o)
inline

set the name of the material

Definition at line 72 of file textured_surface_material.h.

Referenced by cgv::render::build_render_info(), cgv::render::extract_mesh(), and textured_surface_material().

◆ set_normal_index()

void cgv::media::illum::textured_surface_material::set_normal_index ( int  i)
inline

Definition at line 124 of file textured_surface_material.h.

◆ set_roughness_index()

void cgv::media::illum::textured_surface_material::set_roughness_index ( int  i)
inline

Definition at line 100 of file textured_surface_material.h.

◆ set_specular_index()

void cgv::media::illum::textured_surface_material::set_specular_index ( int  i)
inline

Definition at line 120 of file textured_surface_material.h.

◆ set_sRGBA_textures()

void cgv::media::illum::textured_surface_material::set_sRGBA_textures ( bool  do_set = true)

set whether textures are interpreted in sRGB format

Definition at line 39 of file textured_surface_material.cxx.

References sRGBA_textures.

◆ set_transparency_index()

void cgv::media::illum::textured_surface_material::set_transparency_index ( int  i)
inline

Definition at line 116 of file textured_surface_material.h.

Member Data Documentation

◆ ambient_index

int cgv::media::illum::textured_surface_material::ambient_index
protected

index of image from which ambient_occlusion should be mapped, -1 corresponds to no mapping

In case of 4 component textures ambient_occlusion is mapped from the w component.

Definition at line 35 of file textured_surface_material.h.

Referenced by textured_surface_material(), and textured_surface_material().

◆ bump_index

int cgv::media::illum::textured_surface_material::bump_index
protected

index of image from which bumps should be mapped, -1 corresponds to no mapping

If no normal mapping is applies, bump map is also used for normal mapping.

Definition at line 49 of file textured_surface_material.h.

Referenced by textured_surface_material(), and textured_surface_material().

◆ bump_scale

float cgv::media::illum::textured_surface_material::bump_scale
protected

scaling factor for bump map

Definition at line 51 of file textured_surface_material.h.

◆ diffuse_index

int cgv::media::illum::textured_surface_material::diffuse_index
protected

index of image from which diffuse_reflectance should be mapped, -1 corresponds to no mapping

Definition at line 24 of file textured_surface_material.h.

Referenced by textured_surface_material(), and textured_surface_material().

◆ emission_index

int cgv::media::illum::textured_surface_material::emission_index
protected

index of image from which emission should be mapped, -1 corresponds to no mapping

Definition at line 37 of file textured_surface_material.h.

Referenced by textured_surface_material(), and textured_surface_material().

◆ image_file_names

std::vector<std::string> cgv::media::illum::textured_surface_material::image_file_names
protected

◆ metalness_index

int cgv::media::illum::textured_surface_material::metalness_index
protected

index of image from which metalness should be mapped, -1 corresponds to no mapping

In case of 4 component textures metalness is mapped from the w component. For 2 component textures, metalness is mapped from the x-component.

Definition at line 32 of file textured_surface_material.h.

Referenced by textured_surface_material(), and textured_surface_material().

◆ name

std::string cgv::media::illum::textured_surface_material::name
protected

name of material

Definition at line 18 of file textured_surface_material.h.

◆ normal_index

int cgv::media::illum::textured_surface_material::normal_index
protected

index of image from which normals should be mapped, -1 corresponds to no mapping

Definition at line 46 of file textured_surface_material.h.

Referenced by textured_surface_material(), and textured_surface_material().

◆ propagation_slow_down_index

int cgv::media::illum::textured_surface_material::propagation_slow_down_index
protected

index of image from which diffuse_reflectance should be mapped, -1 corresponds to no mapping

Definition at line 42 of file textured_surface_material.h.

Referenced by textured_surface_material(), and textured_surface_material().

◆ roughness_index

int cgv::media::illum::textured_surface_material::roughness_index
protected

index of image from which roughness should be mapped, -1 corresponds to no mapping

In case of 3 or 4 component textures roughness is mapped anisotropically from the xyz components. For 2 component textures, roughness is mapped from the y-component.

Definition at line 28 of file textured_surface_material.h.

Referenced by textured_surface_material(), and textured_surface_material().

◆ specular_index

int cgv::media::illum::textured_surface_material::specular_index
protected

index of image from which specular_reflectance should be mapped, -1 corresponds to no mapping

Definition at line 44 of file textured_surface_material.h.

Referenced by textured_surface_material(), and textured_surface_material().

◆ sRGBA_textures

bool cgv::media::illum::textured_surface_material::sRGBA_textures
protected

whether textures are in sRGB format

Definition at line 20 of file textured_surface_material.h.

Referenced by set_sRGBA_textures(), textured_surface_material(), and textured_surface_material().

◆ transparency_index

int cgv::media::illum::textured_surface_material::transparency_index
protected

index of image from which transparency should be mapped, -1 corresponds to no mapping

In case of 4 component textures transparency is mapped from the w component.

Definition at line 40 of file textured_surface_material.h.

Referenced by textured_surface_material(), and textured_surface_material().


The documentation for this class was generated from the following files: