1#include "textured_surface_material.h"
11 brdf_type = BrdfType(BT_LAMBERTIAN + BT_PHONG);
13 float la = sqrt(a[0] * a[0] + a[1] * a[1] + a[2] * a[2]);
14 float ld = sqrt(d[0] * d[0] + d[1] * d[1] + d[2] * d[2]);
19 roughness = std::max(0.0f, std::min(1.0f, 1.0f / (obj_mat.
shininess + 0.992307f) - 0.0077524f));
23 std::map<std::string, int> file_name_map;
25 const auto& add_texture = [
this, &file_name_map](
const std::string& texture_file_name,
int& texture_index) {
26 if(!texture_file_name.empty()) {
28 if(file_name_map.find(texture_file_name) == file_name_map.end())
29 file_name_map[texture_file_name] =
add_image_file(texture_file_name);
31 texture_index = file_name_map[texture_file_name];
std::vector< std::string > image_file_names
vector of image file names
std::string name
name of material
int transparency_index
index of image from which transparency should be mapped, -1 corresponds to no mapping
int add_image_file(const std::string &file_name)
add a new image and return its index
int specular_index
index of image from which specular_reflectance 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
textured_surface_material()
construct using default values
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
int diffuse_index
index of image from which diffuse_reflectance should be mapped, -1 corresponds to no mapping
float bump_scale
scaling factor for bump map