00001 /****************************************************************************************/ 00002 /* TRaster.H */ 00003 /* */ 00004 /* Author: Mike Sandige */ 00005 /* Description: API layer for Triangle Rasterizer */ 00006 /* */ 00007 /* Code fragments from Chris Hecker's texture mapping articles used with */ 00008 /* permission. http://www.d6.com/users/checker */ 00009 /* */ 00010 /* The contents of this file are subject to the Genesis3D Public License */ 00011 /* Version 1.01 (the "License"); you may not use this file except in */ 00012 /* compliance with the License. You may obtain a copy of the License at */ 00013 /* http://www.genesis3d.com */ 00014 /* */ 00015 /* Software distributed under the License is distributed on an "AS IS" */ 00016 /* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See */ 00017 /* the License for the specific language governing rights and limitations */ 00018 /* under the License. */ 00019 /* */ 00020 /* The Original Code is Genesis3D, released March 25, 1999. */ 00021 /* Genesis3D Version 1.1 released November 15, 1999 */ 00022 /* Copyright (C) 1999 WildTangent, Inc. All Rights Reserved */ 00023 /* */ 00024 /****************************************************************************************/ 00025 #ifndef TRASTER_H 00026 #define TRASTER_H 00027 // TRaster 00028 // Triangle Rasterizer 00029 // 00030 00031 #include "basetype.h" 00032 #include "rop.h" 00033 #include "swthandle.h" // geRDriver_THandle 00034 00035 #ifdef __cplusplus 00036 extern "C" { 00037 #endif 00038 00039 #define TRASTER_DEFAULT_MAX_AFFINE_SIZE (32) 00040 00041 typedef struct 00042 { 00043 unsigned short *BitPtr; // pointer to lightmap bits 00044 int Height; // Lightmap Height 00045 int Width; // Lightmap Width 00046 geFloat LightMapShiftU,LightMapShiftV; // Lightmap coordinates u (LMU) = (TextureU-LightMapShiftU)*LightMapScaleU 00047 geFloat LightMapScaleU,LightMapScaleV; // Lightmap coordinates v (LMV) = (TextureV-LightMapShiftV)*LightMapScaleV 00048 int MipIndex; // Texture's mipping level 00049 } TRaster_Lightmap; 00050 00051 00052 // Call this before calling _Rasterize 00053 void GENESISCC TRaster_Setup( 00054 int MaxAffineSize, // maximum width or height for a non-perspective corrected poly 00055 geRDriver_THandle *Dest, // destination bitmap 00056 geRDriver_THandle *ZBuffer, // zbuffer bitmap 00057 void (*Callback)(TRaster_Lightmap *LM));// initialize lightmap callback 00058 00059 // expected ranges for pVertices elements: 00060 // x,y (pretty much anything) but these are in screen space... 00061 // z (0..65536) 00062 // r,g,b: 0..255 00063 // a: 0..255 00064 // pVertices expected in clockwise winding order. Counter clockwise will not be rasterized. 00065 void GENESISCC TRaster_Rasterize( 00066 geROP ROP, // ROP (raster operation to use for this triangle) 00067 geRDriver_THandle *Texture, // Texture to use (can be NULL if ROP doesn't use it) 00068 int MipIndex, // index of MIP level to use. 0 is highest detail 00069 const DRV_TLVertex *pVertices); // corners of the triangle (there must be 3 of these!) 00070 00071 00072 #ifdef __cplusplus 00073 } 00074 #endif 00075 00076 #endif
1.3.2