Subversion Repositories gelsvn

Rev

Rev 595 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 595 Rev 601
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
#include <vector>
16
#include <vector>
17
#include "CGLA/Vec3f.h"
17
#include "../CGLA/Vec3f.h"
18
#include "CGLA/Vec3i.h"
18
#include "../CGLA/Vec3i.h"
19
 
19
 
20
namespace Geometry
20
namespace Geometry
21
{
21
{
22
    /// Simple material definitions.
22
    /// Simple material definitions.
23
    struct Material
23
    struct Material
24
    {
24
    {
25
        /// Name of material
25
        /// Name of material
26
        std::string name;
26
        std::string name;
27
        
27
        
28
        /// Diffuse reflection
28
        /// Diffuse reflection
29
        CGLA::Vec3f diffuse;			
29
        CGLA::Vec3f diffuse;			
30
        
30
        
31
        /// Ambient reflection
31
        /// Ambient reflection
32
        CGLA::Vec3f ambient;
32
        CGLA::Vec3f ambient;
33
        
33
        
34
        /// Specular reflection
34
        /// Specular reflection
35
        CGLA::Vec3f specular;		
35
        CGLA::Vec3f specular;		
36
        
36
        
37
        /// Specular exponent
37
        /// Specular exponent
38
        float shininess;			
38
        float shininess;			
39
        
39
        
40
        /// Index of refraction in the inverted normal direction ("inside")
40
        /// Index of refraction in the inverted normal direction ("inside")
41
        float ior_in;
41
        float ior_in;
42
        
42
        
43
        /// Index of refraction in the normal direction ("outside")
43
        /// Index of refraction in the normal direction ("outside")
44
        float ior_out;
44
        float ior_out;
45
        
45
        
46
        /// Transmission filter
46
        /// Transmission filter
47
        CGLA::Vec3f transmission;
47
        CGLA::Vec3f transmission;
48
        
48
        
49
        /** Illumination model
49
        /** Illumination model
50
         0 - Color
50
         0 - Color
51
         1 - Color and ambient
51
         1 - Color and ambient
52
         2 - Color and ambient and highlight
52
         2 - Color and ambient and highlight
53
         3 - Reflection
53
         3 - Reflection
54
         4 - Reflection and refraction
54
         4 - Reflection and refraction
55
         Refer to the MTL format specification for more models. 
55
         Refer to the MTL format specification for more models. 
56
         Only numbers from 0 to 10 have a specific meaning. */
56
         Only numbers from 0 to 10 have a specific meaning. */
57
        int illum;
57
        int illum;
58
        
58
        
59
        bool has_texture;
59
        bool has_texture;
60
        std::string tex_path, tex_name;
60
        std::string tex_path, tex_name;
61
        int tex_id;
61
        int tex_id;
62
        
62
        
63
        Material():	name("default"),
63
        Material():	name("default"),
64
        tex_path(""), tex_name(""), tex_id(-1) 
64
        tex_path(""), tex_name(""), tex_id(-1) 
65
        {
65
        {
66
            ior_in = 1.5f;
66
            ior_in = 1.5f;
67
            ior_out = 1.0f;
67
            ior_out = 1.0f;
68
            shininess = 0.0f;
68
            shininess = 0.0f;
69
            diffuse[0] = 0.8f;
69
            diffuse[0] = 0.8f;
70
            diffuse[1] = 0.8f;
70
            diffuse[1] = 0.8f;
71
            diffuse[2] = 0.8f;
71
            diffuse[2] = 0.8f;
72
            ambient[0] = 0.2f;
72
            ambient[0] = 0.2f;
73
            ambient[1] = 0.2f;
73
            ambient[1] = 0.2f;
74
            ambient[2] = 0.2f;
74
            ambient[2] = 0.2f;
75
            specular[0] = 0.0f;
75
            specular[0] = 0.0f;
76
            specular[1] = 0.0f;
76
            specular[1] = 0.0f;
77
            specular[2] = 0.0f;
77
            specular[2] = 0.0f;
78
            transmission[0] = 0.0f;
78
            transmission[0] = 0.0f;
79
            transmission[1] = 0.0f;
79
            transmission[1] = 0.0f;
80
            transmission[2] = 0.0f;
80
            transmission[2] = 0.0f;
81
            illum = 2;
81
            illum = 2;
82
        }
82
        }
83
    };
83
    };
84
}
84
}
85
 
85
 
86
#endif
86
#endif
87
 
87