Subversion Repositories gelsvn

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
660 khor 1
/* ----------------------------------------------------------------------- *
2
 * This file is part of GEL, http://www.imm.dtu.dk/GEL
3
 * Copyright (C) the authors and DTU Informatics
4
 * For license and list of authors, see ../../doc/intro.pdf
5
 * ----------------------------------------------------------------------- */
6
 
7
/**
8
 * @file Material.h
9
 * @brief Contains a simple struct for OpenGL'ish materials.
10
 */
11
 
12
#ifndef __GEOMETRY_MATERIAL_H__
13
#define __GEOMETRY_MATERIAL_H__
14
 
15
#include <string>
16
 
17
namespace Geometry
18
{
19
    /// Simple material definitions.
20
    struct Material
21
    {
22
        /// Name of material
23
        std::string name;
24
 
25
        /// Diffuse reflection
26
        float diffuse[4];			
27
 
28
        /// Ambient reflection
29
        float ambient[4];
30
 
31
        /// Specular reflection
32
        float specular[4];
33
 
34
        /// Specular exponent
35
        float shininess;			
36
 
37
        /// Index of refraction
38
        float ior;
39
 
40
        /// Transmission filter
41
        float transmission[3];
42
 
43
        /** Illumination model
44
 
45
         1 - Color and ambient
46
         2 - Color and ambient and highlight
47
         3 - Reflection
48
         4 - Reflection and refraction
49
         Refer to the MTL format specification for more models. 
50
         Only numbers from 0 to 10 have a specific meaning. */
51
        int illum;
52
 
53
        bool has_texture;
54
        std::string tex_path, tex_name;
55
        int tex_id;
56
 
57
        Material()
58
          :	name("default"), tex_path(""), tex_name(""), tex_id(-1), has_texture(false)
59
        {
60
            ior = 1.5f;
61
            shininess = 0.0f;
62
            diffuse[0] = 0.8f;
63
            diffuse[1] = 0.8f;
64
            diffuse[2] = 0.8f;
65
            diffuse[3] = 1.0f;
66
            ambient[0] = 0.2f;
67
            ambient[1] = 0.2f;
68
            ambient[2] = 0.2f;
69
            ambient[3] = 1.0f;
70
            specular[0] = 0.0f;
71
            specular[1] = 0.0f;
72
            specular[2] = 0.0f;
73
            specular[3] = 1.0f;
74
            transmission[0] = 0.0f;
75
            transmission[1] = 0.0f;
76
            transmission[2] = 0.0f;
77
            illum = 1;
78
        }
79
    };
80
}
81
 
82
#endif