added 3dengfx into the repo, probably not the correct version for this
[summerhack] / src / 3dengfx / src / 3dengfx / 3denginefx_types.hpp
1 /*
2 This file is part of the 3dengfx, realtime visualization system.
3
4 Copyright (c) 2004, 2005 John Tsiombikas <nuclear@siggraph.org>
5
6 3dengfx is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 3dengfx is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with 3dengfx; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19 */
20
21 /* enumerations and data structures for the low-level 3dengfx state
22  *
23  * Author: John Tsiombikas 2004
24  */
25
26 #ifndef _3DENGINEFX_TYPES_HPP_
27 #define _3DENGINEFX_TYPES_HPP_
28
29 #include "opengl.h"
30 #include "n3dmath2/n3dmath2_types.hpp"
31
32 enum ShadeMode {
33         SHADING_FLAT = GL_FLAT,
34         SHADING_GOURAUD = GL_SMOOTH
35 };
36
37 #ifdef COORD_LHS
38 enum FaceOrder {ORDER_CW = GL_CW, ORDER_CCW = GL_CCW};
39 #else
40 enum FaceOrder {ORDER_CW = GL_CCW, ORDER_CCW = GL_CW};
41 #endif
42
43 enum PrimitiveType {
44         TRIANGLE_LIST   = GL_TRIANGLES,
45         TRIANGLE_STRIP  = GL_TRIANGLE_STRIP,
46         TRIANGLE_FAN    = GL_TRIANGLE_FAN,
47         LINE_LIST               = GL_LINES,
48         LINE_STRIP              = GL_LINE_STRIP,
49         LINE_LOOP               = GL_LINE_LOOP,
50         POINT_LIST              = GL_POINTS,
51         QUAD_LIST               = GL_QUADS,
52         QUAD_STRIP              = GL_QUAD_STRIP
53 };
54
55 enum BlendingFactor {
56         BLEND_ZERO                                      = GL_ZERO,
57         BLEND_ONE                                       = GL_ONE,
58         BLEND_SRC_COLOR                         = GL_SRC_COLOR,
59         BLEND_ONE_MINUS_SRC_COLOR       = GL_ONE_MINUS_SRC_COLOR,
60         BLEND_SRC_ALPHA                         = GL_SRC_ALPHA,
61         BLEND_ONE_MINUS_SRC_ALPHA       = GL_ONE_MINUS_SRC_ALPHA,
62         BLEND_ONE_MINUS_DST_COLOR       = GL_ONE_MINUS_DST_COLOR
63 };
64
65 enum TextureBlendFunction {
66         TOP_REPLACE                     = GL_REPLACE,
67         TOP_ADD                         = GL_ADD,
68         TOP_ADDSIGNED           = GL_ADD_SIGNED,
69         TOP_SUBTRACT            = GL_SUBTRACT,
70         TOP_MODULATE            = GL_MODULATE,
71         TOP_LERP                        = GL_INTERPOLATE,
72         TOP_DOT3                        = GL_DOT3_RGB,
73         TOP_DOT3_RGBA           = GL_DOT3_RGBA
74 };
75
76 enum TextureBlendArgument {
77         TARG_TEXTURE    = GL_TEXTURE,
78         TARG_CONSTANT   = GL_CONSTANT,
79         TARG_COLOR              = GL_PRIMARY_COLOR,
80         TARG_PREV               = GL_PREVIOUS,
81         TARG_NONE
82 };
83
84 enum CmpFunc {
85         CMP_NEVER               = GL_NEVER,
86     CMP_LESS            = GL_LESS,
87     CMP_EQUAL           = GL_EQUAL,
88     CMP_LEQUAL          = GL_LEQUAL,
89     CMP_GREATER         = GL_GREATER,
90     CMP_NOTEQUAL        = GL_NOTEQUAL,
91     CMP_GEQUAL          = GL_GEQUAL,
92     CMP_ALWAYS          = GL_ALWAYS
93 };
94
95 enum StencilOp {
96         SOP_KEEP                = GL_KEEP,
97     SOP_ZERO            = GL_ZERO,
98     SOP_REPLACE         = GL_REPLACE,
99     SOP_INCSAT          = GL_INCR,
100     SOP_DECSAT          = GL_DECR,
101     SOP_INVERT          = GL_INVERT,
102     SOP_INC                     = GL_INCR,      // TODO: find a way to let these wrap around
103     SOP_DEC                     = GL_DECR       //
104 };
105
106 enum TextureFilteringType {
107         POINT_SAMPLING,
108         BILINEAR_FILTERING, 
109         TRILINEAR_FILTERING, 
110         ANISOTROPIC_FILTERING
111 };
112
113 enum TextureAddressing {
114         TEXADDR_WRAP                    = GL_REPEAT,
115         //TexAddrMirror                 = D3DTADDRESS_MIRROR,
116         TEXADDR_CLAMP                   = GL_CLAMP_TO_EDGE,
117         TEXADDR_CLAMP_BORDER    = GL_CLAMP
118         //TexAddrMirrorOnce             = D3DTADDRESS_MIRRORONCE
119 };
120
121 enum TextureDim {
122         TEX_1D          = GL_TEXTURE_1D,
123         TEX_2D          = GL_TEXTURE_2D,
124         TEX_3D          = GL_TEXTURE_3D,
125         TEX_CUBE        = GL_TEXTURE_CUBE_MAP
126 };
127
128 enum CubeMapFace {
129         CUBE_MAP_PX             = GL_TEXTURE_CUBE_MAP_POSITIVE_X,
130         CUBE_MAP_NX             = GL_TEXTURE_CUBE_MAP_NEGATIVE_X,
131         CUBE_MAP_PY             = GL_TEXTURE_CUBE_MAP_POSITIVE_Y,
132         CUBE_MAP_NY             = GL_TEXTURE_CUBE_MAP_NEGATIVE_Y,
133         CUBE_MAP_PZ             = GL_TEXTURE_CUBE_MAP_POSITIVE_Z,
134         CUBE_MAP_NZ             = GL_TEXTURE_CUBE_MAP_NEGATIVE_Z
135 };
136
137 class GfxProg;
138
139 #define DONT_CARE_BPP           1       // 0001
140 #define DONT_CARE_DEPTH         2       // 0010
141 #define DONT_CARE_STENCIL       4       // 0100
142
143 struct GraphicsInitParameters {
144         int x, y;
145         int bpp;
146         int depth_bits;
147         int stencil_bits;
148         bool fullscreen;
149         unsigned short dont_care_flags;
150 };
151
152 struct ProgCaps {
153         bool shader_obj;
154         bool asm_pixel, asm_vertex;
155         bool glslang;
156         bool glsl_pixel, glsl_vertex;
157 };
158
159 struct SysCaps {
160         bool multitex;
161         bool load_transpose;
162         bool gen_mipmaps;
163         bool tex_combine_ops;
164         bool bump_dot3;
165         bool bump_env;
166         bool vertex_buffers;
167         bool depth_texture;
168         bool shadow_mapping;
169         bool point_sprites;
170         bool point_params;
171         int max_texture_units;
172         bool non_power_of_two_textures;
173         int max_lights;
174         ProgCaps prog;
175 };
176
177 enum TransformType {
178         XFORM_WORLD,
179         XFORM_VIEW,
180         XFORM_PROJECTION,
181         XFORM_TEXTURE
182 };
183
184
185
186
187 #endif  // _3DENGINEFX_TYPES_HPP_