Subversion Repositories gelsvn

Rev

Rev 510 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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