Subversion Repositories gelsvn

Rev

Rev 606 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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