Reference: Muli3D: m3dtypes.h Source File
m3dtypes.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00022
00023
#ifndef __M3DTYPES_H__
00024
#define __M3DTYPES_H__
00025
00026
#include "m3dbase.h"
00027
#include "math/m3dmath.h"
00028
00029
00030
00031
#ifdef WIN32
00032
00033
#define WIN32_LEAN_AND_MEAN
00034
#include <windows.h>
00035
typedef HWND windowhandle;
00036
00037
#endif
00038
00039
00040
#ifdef LINUX_X11
00041
00042
#include <X11/Xlib.h>
00043
#include <X11/Xutil.h>
00044
typedef Window windowhandle;
00045
00046
#endif
00047
00048
00049
#ifdef __amigaos4__
00050
00051
#include <intuition/intuition.h>
00052
typedef struct Window *windowhandle;
00053
00054
#endif
00055
00056
00057
00058 const uint32 c_iVertexCacheSize = 32;
00059 const uint32 c_iVertexShaderRegisters = 8;
00060 const uint32 c_iPixelShaderRegisters = 8;
00061 const uint32 c_iNumShaderConstants = 32;
00062 const uint32 c_iMaxVertexStreams = 8;
00063 const uint32 c_iMaxTextureSamplers = 16;
00064
00065
00066
00068 enum m3drenderstate
00069 {
00070
m3drs_zenable = 0,
00071
m3drs_zwriteenable,
00072
m3drs_zfunc,
00073
00074
m3drs_colorwriteenable,
00075
m3drs_fillmode,
00076
00077
m3drs_cullmode,
00078
00079
m3drs_subdivisionmode,
00080
m3drs_subdivisionlevels,
00081
m3drs_subdivisionpositionregister,
00082
m3drs_subdivisionnormalregister,
00083
m3drs_subdivisionmaxscreenarea,
00084
m3drs_subdivisionmaxinnerlevels,
00085
00086
m3drs_scissortestenable,
00087
00088
m3drs_linethickness,
00089
00090 m3drs_numrenderstates
00091 };
00092
00094 enum m3dcmpfunc
00095 {
00096
m3dcmp_never,
00097
m3dcmp_equal,
00098
m3dcmp_notequal,
00099
m3dcmp_less,
00100
m3dcmp_lessequal,
00101
m3dcmp_greaterequal,
00102
m3dcmp_greater,
00103
m3dcmp_always
00104 };
00105
00107 enum m3dcull
00108 {
00109
m3dcull_none,
00110
m3dcull_cw,
00111
m3dcull_ccw
00112 };
00113
00115 enum m3dfill
00116 {
00117
m3dfill_solid,
00118
m3dfill_wireframe
00119 };
00120
00122 enum m3dtexturesamplerstate
00123 {
00124
m3dtss_addressu = 0,
00125
m3dtss_addressv,
00126
m3dtss_addressw,
00127
m3dtss_minfilter,
00128
m3dtss_magfilter,
00129
m3dtss_mipfilter,
00130
m3dtss_miplodbias,
00131
m3dtss_maxmiplevel,
00132
00133 m3dtss_numtexturesamplerstates
00134 };
00135
00137 enum m3dtextureaddress
00138 {
00139 m3dta_wrap,
00140 m3dta_clamp
00141 };
00142
00144 enum m3dtexturefilter
00145 {
00146
m3dtf_point,
00147
m3dtf_linear
00148 };
00149
00151 enum m3dsubdiv
00152 {
00153
m3dsubdiv_none,
00154
m3dsubdiv_simple,
00155
m3dsubdiv_smooth,
00156
m3dsubdiv_adaptive
00157 };
00158
00162 enum m3dformat
00163 {
00164
00165
m3dfmt_r32f,
00166
m3dfmt_r32g32f,
00167
m3dfmt_r32g32b32f,
00168
m3dfmt_r32g32b32a32f,
00169
00170
00171
m3dfmt_index16,
00172
m3dfmt_index32
00173 };
00174
00176 enum m3dprimitivetype
00177 {
00178
m3dpt_trianglefan,
00179
m3dpt_trianglestrip,
00180
m3dpt_trianglelist
00181 };
00182
00184 enum m3dvertexelementtype
00185 {
00186
m3dvet_float32,
00187
m3dvet_vector2,
00188
m3dvet_vector3,
00189
m3dvet_vector4
00190 };
00191
00193 enum m3dshaderconstant
00194 {
00195
m3dsc_worldmatrix = 0,
00196
m3dsc_viewmatrix = 1,
00197
m3dsc_projectionmatrix = 2,
00198
m3dsc_wvpmatrix = 3,
00199 };
00200
00202 enum m3dtexsampleinput
00203 {
00204
m3dtsi_2coords,
00205
m3dtsi_3coords,
00206
m3dtsi_vector
00207 };
00208
00210 enum m3dcubefaces
00211 {
00212
m3dcf_positive_x = 0,
00213
m3dcf_negative_x,
00214
m3dcf_positive_y,
00215
m3dcf_negative_y,
00216
m3dcf_positive_z,
00217
m3dcf_negative_z
00218 };
00219
00221 enum m3dpixelshaderoutput
00222 {
00223
m3dpso_coloronly,
00224
m3dpso_colordepth,
00225 };
00226
00228 enum m3dshaderregtype
00229 {
00230
m3dsrt_unused = 0,
00231
m3dsrt_float32,
00232
m3dsrt_vector2,
00233
m3dsrt_vector3,
00234
m3dsrt_vector4
00235 };
00236
00237 enum m3dclippingplanes
00238 {
00239
m3dcp_left = 0,
00240
m3dcp_right,
00241
m3dcp_top,
00242
m3dcp_bottom,
00243
m3dcp_near,
00244
m3dcp_far,
00245
00247
m3dcp_user0,
00248 m3dcp_user1,
00249 m3dcp_user2,
00250 m3dcp_user3,
00251
00252 m3dcp_numplanes
00253 };
00254
00255
00256
00258 struct m3drect
00259 {
00260
uint32 iLeft, iTop;
00261
uint32 iRight, iBottom;
00262 };
00263
00265 struct m3dbox
00266 {
00267
uint32 iLeft, iTop, iFront;
00268
uint32 iRight, iBottom, iBack;
00269 };
00270
00272 struct m3ddeviceparameters
00273 {
00274 windowhandle
hDeviceWindow;
00275 bool bWindowed;
00276 uint32 iFullscreenColorBits;
00277
00279 uint32 iBackbufferWidth,
iBackbufferHeight;
00280 };
00281
00283 struct m3dvertexelement
00284 {
00285 uint32 iStream;
00286 m3dvertexelementtype Type;
00287 uint32 iRegister;
00288 };
00289
00290 #define M3DVERTEXFORMATDECL( i_iStream, i_Type, i_Register ) \
00291
{ i_iStream, i_Type, i_Register }
00292
00293
00294
00295
00296
typedef vector4
shaderreg;
00297
00300
struct m3dvsinput
00301 {
00302
shaderreg ShaderInputs[
c_iVertexShaderRegisters];
00303 };
00304
00307
struct m3dvsoutput
00308 {
00309
shaderreg ShaderOutputs[
c_iPixelShaderRegisters];
00310 vector4
vPosition;
00311
00312
m3dvsinput SourceInput;
00313 };
00314
00317
struct m3dtriangleinfo
00318 {
00319
float32 fCommonGradient;
00320 const m3dvsoutput *
pBaseVertex;
00321
00323
float32 fZDdx,
fZDdy;
00324
00326
float32 fWDdx,
fWDdy;
00327
00328
shaderreg ShaderOutputsDdx[
c_iPixelShaderRegisters];
00329 shaderreg ShaderOutputsDdy[
c_iPixelShaderRegisters];
00330
00332
uint32 iCurPixelX,
iCurPixelY;
00333
00334
float32 fCurPixelInvW;
00335 };
00336
00339
struct m3dvertexcacheentry
00340 {
00341
uint32 iVertexIndex;
00342 m3dvsoutput VertexOutput;
00343 uint32 iFetchTime;
00344 };
00345
00346
#endif // __M3DTYPES_H__