Subversion Repositories gelsvn

Rev

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