Subversion Repositories gelsvn

Rev

Rev 601 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

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