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

Stores properties of a surface material with support for texturing. 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 ()
 construct using default values
 
 textured_surface_material (const obj_material &obj_mat)
 construct from obj material
 
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
 

Public Attributes

std::string name = "default"
 name of material
 
bool sRGBA_textures = false
 whether textures are in sRGB format
 
int diffuse_index = -1
 index of image from which diffuse_reflectance should be mapped, -1 corresponds to no mapping
 
int roughness_index = -1
 index of image from which roughness should be mapped, -1 corresponds to no mapping
 
int metalness_index = -1
 index of image from which metalness should be mapped, -1 corresponds to no mapping
 
int ambient_index = -1
 index of image from which ambient_occlusion should be mapped, -1 corresponds to no mapping
 
int emission_index = -1
 index of image from which emission should be mapped, -1 corresponds to no mapping
 
int transparency_index = -1
 index of image from which transparency should be mapped, -1 corresponds to no mapping
 
int propagation_slow_down_index = -1
 index of image from which diffuse_reflectance should be mapped, -1 corresponds to no mapping
 
int specular_index = -1
 index of image from which specular_reflectance should be mapped, -1 corresponds to no mapping
 
int normal_index = -1
 index of image from which normals should be mapped, -1 corresponds to no mapping
 
int bump_index = -1
 index of image from which bumps should be mapped, -1 corresponds to no mapping
 
float bump_scale = 0.1f
 scaling factor for bump map
 
- Public Attributes inherited from cgv::media::illum::surface_material
BrdfType brdf_type = BrdfType(BT_STRAUSS_DIFFUSE + BT_STRAUSS)
 store brdf type, defaults to BT_STRAUSS_DIFFUSE + BT_STRAUSS
 
color_type diffuse_reflectance = { 0.5f }
 diffuse reflectance of surface, defaults to 0.5,0.5,0.5
 
float roughness = 0.5f
 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 = 0.0f
 metalness of surface, defaults to 0
 
float ambient_occlusion = 1.0f
 scalar factor to down scale ambient light, defaults to 1
 
color_type emission = { 0.0f }
 emissive color component, defaults to 0,0,0
 
float transparency = 0.0f
 modulation for transparency, defaults to 0
 
std::complex< float > propagation_slow_down = { 1.5f, 0.0f }
 complex fraction of complex interior over real exterior index of refraction, defaults to 1.5,0
 
float roughness_anisotropy = 0.0f
 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 = 0.0f
 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 = { 1.0f }
 specular color used to modulate specular reflection component, should be 1,1,1
 

Protected Attributes

std::vector< std::string > image_file_names
 vector of image file names
 

Additional Inherited Members

- Public Types inherited from cgv::media::illum::surface_material
using color_type = cgv::rgb
 

Detailed Description

Stores properties of a surface material with support for texturing.

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 ( )
inline

construct using default values

Definition at line 52 of file textured_surface_material.h.

◆ 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 44 of file textured_surface_material.cxx.

References image_file_names.

Referenced by textured_surface_material().

◆ 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 61 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 57 of file textured_surface_material.h.

◆ 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 67 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 65 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 63 of file textured_surface_material.h.

Member Data Documentation

◆ ambient_index

int cgv::media::illum::textured_surface_material::ambient_index = -1

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 33 of file textured_surface_material.h.

Referenced by cgv::render::shader_program::set_textured_material_uniform(), and textured_surface_material().

◆ bump_index

int cgv::media::illum::textured_surface_material::bump_index = -1

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 47 of file textured_surface_material.h.

Referenced by cgv::render::shader_program::set_textured_material_uniform(), and textured_surface_material().

◆ bump_scale

float cgv::media::illum::textured_surface_material::bump_scale = 0.1f

scaling factor for bump map

Definition at line 49 of file textured_surface_material.h.

Referenced by textured_surface_material().

◆ diffuse_index

int cgv::media::illum::textured_surface_material::diffuse_index = -1

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

Definition at line 22 of file textured_surface_material.h.

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

◆ emission_index

int cgv::media::illum::textured_surface_material::emission_index = -1

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

Definition at line 35 of file textured_surface_material.h.

Referenced by cgv::render::build_render_info(), cgv::render::shader_program::set_textured_material_uniform(), 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 = -1

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 30 of file textured_surface_material.h.

Referenced by cgv::render::build_render_info(), and cgv::render::shader_program::set_textured_material_uniform().

◆ name

std::string cgv::media::illum::textured_surface_material::name = "default"

◆ normal_index

int cgv::media::illum::textured_surface_material::normal_index = -1

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

Definition at line 44 of file textured_surface_material.h.

◆ propagation_slow_down_index

int cgv::media::illum::textured_surface_material::propagation_slow_down_index = -1

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

Definition at line 40 of file textured_surface_material.h.

◆ roughness_index

int cgv::media::illum::textured_surface_material::roughness_index = -1

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 26 of file textured_surface_material.h.

Referenced by cgv::render::build_render_info(), and cgv::render::shader_program::set_textured_material_uniform().

◆ specular_index

int cgv::media::illum::textured_surface_material::specular_index = -1

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

Definition at line 42 of file textured_surface_material.h.

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

◆ sRGBA_textures

bool cgv::media::illum::textured_surface_material::sRGBA_textures = false

whether textures are in sRGB format

Definition at line 20 of file textured_surface_material.h.

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

◆ transparency_index

int cgv::media::illum::textured_surface_material::transparency_index = -1

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 38 of file textured_surface_material.h.

Referenced by cgv::render::shader_program::set_textured_material_uniform(), and textured_surface_material().


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