22 #ifndef WATCHMAKER_RENDER_H 23 #define WATCHMAKER_RENDER_H 25 #include "common/array.h" 26 #include "watchmaker/types.h" 27 #include "watchmaker/windows_hacks.h" 28 #include "watchmaker/3d/texture.h" 29 #include "watchmaker/3d/material.h" 34 #define T3D_MATERIAL_CLIPMAP (1<<0) // clipmap 35 #define T3D_MATERIAL_OPACITY (1<<1) // opacity (0-24) 36 #define T3D_MATERIAL_ADDITIVE (1<<2) // additive (25-49) 37 #define T3D_MATERIAL_GLASS (1<<3) // glass (50-74) 38 #define T3D_MATERIAL_BOTTLE (1<<4) // bottle (75-100) 39 #define T3D_MATERIAL_ENVIRONMENT (1<<5) // environment 40 #define T3D_MATERIAL_SKY (1<<6) // sky 41 #define T3D_MATERIAL_NOLIGHTMAP (1<<7) // no lightmap 42 #define T3D_MATERIAL_MOVIE (1<<8) // with movie 43 #define T3D_MATERIAL_FLARE (1<<9) // flare 44 #define T3D_MATERIAL_FLARE_SUN (1<<10) // flare sun 45 #define T3D_MATERIAL_FLARESOFT (1<<11) // flare soft 46 #define T3D_MATERIAL_SMOKE (1<<12) // smoke 47 #define T3D_MATERIAL_MOVIEPAUSED (1<<13) // if movie is paused 50 #define rCLEARZBUFFER (1<<0) // clear zbuffer 51 #define rCLEARBACKBUFFER (1<<1) // clear back buffer 52 #define rCLEARSCREENBUFFER (1<<2) // clear screen buffer 55 #define rSOLIDMODE 1 // render in solid mode 56 #define rWIREFRAMEMODE 2 // render in wireframe 59 #define rVBLOCK_READONLY 1 // lock VB for reading 60 #define rVBLOCK_WRITEONLY 2 // lock VB for writing 61 #define rVBLOCK_NOSYSLOCK 4 // lock VB without hanging the system 64 #define MAX_LINES 50000 // max lines in VB 65 #define MAX_SHADOWS_PER_LIGHT 30 // max shadows per light 67 #define MAX_BATCH_BLOCKS 512 // max normal batch blocks 68 #define MAX_BATCH_BLOCKS_SPECIAL 128 // max special batch blocks 69 #define MAX_BATCH_BLOCKS_LIGHTMAPS 512 // max lightmaps batch blocks 70 #define MAX_BATCH_BLOCKS_SKY 4 // max sky batch blocks 72 #define FLEXIBLEVERTEXFLAGS (D3DFVF_XYZ | D3DFVF_DIFFUSE |D3DFVF_TEX2 ) // VB struct elements 76 #define rBITMAPSURFACE (0) // Plain bitmap image; fit the backbuffer pixelformat 77 #define rTEXTURESURFACE (1<<0) // Use when loading an image; if flag specified the image fit the texture pixelformat 78 #define rSURFACESTRETCH (1<<1) // Used for bitmaps; strech the pic to a new dimension using DX (could produce very bad results) 79 #define rSURFACECOPY (1<<2) // Not supported yet 80 #define rSURFACEHALF (1<<3) // Used for texture; hal the dimension during loading 81 #define rSURFACEFLIP (1<<4) // Flip upside-down the loaded image 89 uint32 totalverts, num_objverts;
90 uint32 num_side_indices, num_cap_indices;
94 uint16 *pwShadVolIndices;
95 uint16 *pwShadVolSideIndices;
96 int16 *pwShadVolCapIndices;
101 SHADOW ShadowsList[MAX_SHADOWS_PER_LIGHT];
102 unsigned int NumShadowsList;
109 uint16 ViewMatrixNum;
113 signed short int Texture1 = 0, Texture2 = 0;
114 unsigned int Flags1 = 0, Flags2 = 0;
115 signed short int ViewMatrixNum = 0;
116 unsigned short int NumFaces() {
117 return FacesList.size();
119 unsigned short int NumVerts() {
120 if (VBO)
return VBO->_buffer.size();
128 gBatchBlock(
signed short int texture1,
signed short int texture2,
unsigned int flags1,
unsigned int flags2) : Texture1(texture1), Texture2(texture2), Flags1(flags1), Flags2(flags2) {}
134 gBatchBlock *rNewBatchBlock(
signed short int T1,
unsigned int F1,
signed short int T2,
unsigned int F2);
135 void rBuildMaterialList(
MaterialTable &MatList,
unsigned int NumMat,
signed short int ViewMatrixNum);
137 void rResetPipeline();
140 bool rGrabVideo(
const char *path,
char flags);
145 bool rSetMovieFrame(
MaterialPtr mat, uint32 dwCurrFrame);
147 void rReleaseAllTextures(
unsigned int NotFlags);
149 int rLoadBitmapImage(
WGame &game,
const char *TextName,
unsigned char flags);
150 void rReleaseAllBitmaps(
unsigned int NotFlags);
151 void rReleaseBitmap(
int i);
152 void rReleaseBitmapDirect(
gTexture *b);
153 void rSetLoaderFlags(
unsigned int NewLoaderFlags);
154 int rCreateSurface(
unsigned int dimx,
unsigned int dimy,
unsigned char flags);
155 void *rCreateSurfaceP(
unsigned int dimx,
unsigned int dimy,
unsigned char flags);
156 char *rGetBitmapName(
unsigned int id);
157 void rSetBitmapName(
unsigned int id,
const char *s);
158 unsigned char *rLockSurface(
int surf,
unsigned int *pitch);
159 unsigned char *rLockSurfaceDirect(
gTexture *t,
unsigned int *pitch);
160 void rUnlockSurface(
int surf);
161 void rUnlockSurfaceDirect(
gTexture *t);
162 uint16 rRGBAToSurfaceFormat(
unsigned int R,
unsigned int G,
unsigned int B,
unsigned int A);
163 uint16 rRGBAToTextureFormat(
unsigned int r,
unsigned int g,
unsigned int b,
unsigned int a);
164 void rSurfaceFormatToRGBA(uint32 color,
unsigned int *R,
unsigned int *G,
unsigned int *B,
unsigned int *A);
165 void rTextureFormatToRGBA(uint16 color,
unsigned int *R,
unsigned int *G,
unsigned int *B,
unsigned int *A);
166 gTexture *rGetSurfaceTexture(
int pos);
173 gVertex *rLockVertexPtr(
void *vb,
int flags);
174 void *rGetUserVertexBuffer();
175 unsigned int rGetUserVertexBufferCounter();
176 void rSetUserVertexBufferCounter(
unsigned int uvbc);
177 bool rUnlockVertexPtr(
void *vb);
178 uint16 *rGetLinesArrayPtr();
179 void rAddLinesArray();
180 unsigned int rGetNumLinesArray();
181 void rAddTrianglesArray(
float x,
float y,
int r,
int g,
int b,
int a);
182 int16 *rGetTrianglesArrayPtr();
183 unsigned int rGetNumTrianglesArray();
184 void *rLockPointArray();
185 void rUnlockPointArray();
186 unsigned int rGetNumPointArray();
187 void rAddPointArray();
188 void rOptimizeVertexArray(
void *v);
190 bool rMakeShadowVolume(
SHADOWBOX *sb,
gVertex *InVerts, DWORD nverts,
float lightm[9]);
191 bool rMakeShadowBox(
SHADOWBOX *sb,
float BoxX,
float BoxY,
float BoxZ, WORD intens);
192 bool rMakeProjectiveShadow(
SHADOWBOX *sb,
void *InVerts, DWORD nverts);
196 bool rInitialize3DEnvironment(
WGame &game,
char *cfg);
197 char *rGetRenderDllDesc();
198 void rSetFlagsFullScreen();
199 bool rGetFlagsFullScreen();
200 void rSetRenderMode(
int state);
201 bool rClearBuffers(
char flags);
202 void rGetScreenInfos(
unsigned int *width,
unsigned int *height,
unsigned int *bpp);
203 void rRelaseFontTable(
unsigned short *ft);
204 void rRelaseAllFontTable();
205 void rGetBlitterViewport(
unsigned int *left,
unsigned int *top,
unsigned int *right,
unsigned int *bottom);
206 void rUpdateExtends(
int x1,
int y1,
int x2,
int y2);
207 void rGetExtends(
int *x1,
int *y1,
int *x2,
int *y2);
208 void rResetExtends();
209 int rBlitSetStandardFont(
signed int color,
unsigned short *table);
210 int DebugQuick(
signed int StdPx,
signed int StdPy,
const char *format, ...);
211 bool rGetStencilBitDepth();
214 void rBlitter(
WGame &game,
int dst,
int src,
int dposx,
int dposy,
int sposx,
int sposy,
int sdimx,
int sdimy);
219 void rSetViewMatrix(
const t3dM3X3F &viewMatrix,
const t3dV3F &translation);
220 int rBuildLinesViewMatrix(
const t3dM3X3F &viewMatrix,
const t3dV3F &translation);
221 int rAddUserViewMatrix(
const t3dM3X3F &viewMatrix,
const t3dV3F &translation);
222 void rSetUserViewMatrix(
int num);
223 void rSaveViewMatrix();
224 void rRestoreViewMatrix();
225 void rSetLinesViewMatrix();
227 bool checkGlError(
const char *when =
"");
231 #endif // WATCHMAKER_RENDER_H
Definition: 2d_stuff.h:30
Definition: work_dirs.h:30