aboutsummaryrefslogtreecommitdiff
path: root/dep/include/g3dlite/G3D/constants.h
blob: dd5cb3649e5a5b609158f834105ce00b0df5a0c2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
/**
  @file G3D/constants.h

  @maintainer Morgan McGuire, http://graphics.cs.williams.edu
  @created 2009-05-20
  @edited  2009-05-20
*/
#ifndef G3D_constants_h
#define G3D_constants_h

#include "G3D/platform.h"
#include "G3D/enumclass.h"

namespace G3D {

/** These are defined to have the same value as the equivalent OpenGL
    constant. */
class PrimitiveType {
public:
    enum Value {
        POINTS         = 0x0000,
        LINES          = 0x0001,
        LINE_STRIP     = 0x0003, 
        TRIANGLES      = 0x0004, 
        TRIANGLE_STRIP = 0x0005,
        TRIANGLE_FAN   = 0x0006,
        QUADS          = 0x0007, 
        QUAD_STRIP     = 0x0008
    };

private:

    Value value;

public:

    G3D_DECLARE_ENUM_CLASS_METHODS(PrimitiveType);
};


/** Values for SuperSurface::GPUGeom::refractionHint. */
class RefractionQuality {
public:
    enum Value {
        /** No refraction; a translucent object will appear as if it had the same index of refraction
            as the surrounding medium and objects will be undistorted in the background. */
        NONE = 0, 

        /** Use a static environment map (cube or paraboloid) for computing transmissivity.*/
        STATIC_ENV = 25, 

        /** Use a dynamically rendered 2D environment map; distort the background.  This looks good for many scenes
            but avoids the cost of rendering a cube map for DYNAMIC_ENV. */
        DYNAMIC_FLAT = 50,

        /** Use a dynamically rendered 2D environment map that is re-captured per transparent object.  This works well
            for transparent objects that are separated by a significant camera space z distance but overlap in screen space.*/
        DYNAMIC_FLAT_MULTILAYER = 55,

        /** Render a dynamic environment map */
        DYNAMIC_ENV = 75, 

        /** Use the best method available, ideally true ray tracing. */
        BEST = 100
    };

private:

    /** Used for to/from string conversion.  Last is the emtpy string as a sentinel */
    static const std::string    str[7];
    static const Value          enm[6];
    Value value;

public:
    G3D_DECLARE_ENUM_CLASS_METHODS(RefractionQuality);

    RefractionQuality(const class Any&);
    RefractionQuality& operator=(const Any&);
    operator Any() const;
    const std::string& toString() const;
};


/** Values for SuperSurface::GPUGeom::mirrorHint. */
class MirrorQuality {
public:

    enum Value {
        /** Reflections are black */
        NONE = 0, 
        
        /** Use a static environment map.  This is what most games use */
        STATIC_ENV = 25, 
        
        /** Planar reflection, typically for water or glass windows.  This assumes that the mirror is flat;
        it is distinct from RefractionQuality::DYNAMIC_FLAT, which assumes the <i>background</i> is flat.*/
        DYNAMIC_PLANAR = 50,

        /** Render a dynamic environment map. */
        DYNAMIC_ENV = 75, 
        
        /** Use the best method available, ideally true ray tracing. */
        BEST = 100
    };

private:

    /** Used for to/from string conversion.  Last is the emtpy string as a sentinel */
    static const std::string    str[6];
    static const Value          enm[5];

    Value value;

public:
    G3D_DECLARE_ENUM_CLASS_METHODS(MirrorQuality);
    MirrorQuality(const class Any&);
    MirrorQuality& operator=(const Any&);
    operator Any() const;
    const std::string& toString() const;
};

} // namespace G3D

G3D_DECLARE_ENUM_CLASS_HASHCODE(G3D::PrimitiveType)
G3D_DECLARE_ENUM_CLASS_HASHCODE(G3D::RefractionQuality)
G3D_DECLARE_ENUM_CLASS_HASHCODE(G3D::MirrorQuality)

#endif