Subversion Repositories gelsvn

Rev

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

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