Subversion Repositories gelsvn

Rev

Rev 510 | Rev 601 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

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