]> de.git.xonotic.org Git - xonotic/netradiant.git/blobdiff - tools/quake3/q3map2/q3map2.h
Increase the influence of directional lights on the deluxemap by a)Ignoring angle...
[xonotic/netradiant.git] / tools / quake3 / q3map2 / q3map2.h
index ddc5b0a96eefd89021590c29ebeb2b302b25a5ef..644a0510ab14a1b4893d3cc3271bd9140d2bb693 100644 (file)
@@ -83,7 +83,7 @@ dependencies
 #include "vfs.h"
 #include "png.h"
 #include "md4.h"
-
+#include "radiant_jpeglib.h"
 #include <stdlib.h>
 
 
@@ -185,7 +185,7 @@ constants
 /* bsp */
 #define        MAX_PATCH_SIZE                  32
 #define        MAX_BRUSH_SIDES                 1024
-#define MAX_BUILD_SIDES                        300
+#define MAX_BUILD_SIDES                        1024
 
 #define        MAX_EXPANDED_AXIS               128
 
@@ -196,6 +196,7 @@ constants
 #define        HINT_PRIORITY                   1000            /* ydnar: force hint splits first and antiportal/areaportal splits last */
 #define ANTIPORTAL_PRIORITY            -1000
 #define AREAPORTAL_PRIORITY            -1000
+#define DETAIL_PRIORITY                -3000
 
 #define        PSIDE_FRONT                             1
 #define        PSIDE_BACK                              2
@@ -214,10 +215,10 @@ constants
 
 #define        PORTALFILE                              "PRT1"
 
-#define        MAX_PORTALS                             32768
+#define        MAX_PORTALS                             0x20000 /* same as MAX_MAP_PORTALS */
 #define MAX_SEPERATORS                 MAX_POINTS_ON_WINDING
 #define        MAX_POINTS_ON_FIXED_WINDING     24      /* ydnar: increased this from 12 at the expense of more memory */
-#define        MAX_PORTALS_ON_LEAF             128
+#define        MAX_PORTALS_ON_LEAF             1024
 
 
 /* light */
@@ -237,6 +238,7 @@ constants
 #define LIGHT_FAST_TEMP                        512
 #define LIGHT_FAST_ACTUAL              (LIGHT_FAST | LIGHT_FAST_TEMP)
 #define LIGHT_NEGATIVE                 1024
+#define LIGHT_UNNORMALIZED             2048    /* vortex: do not normalize _color */
 
 #define LIGHT_SUN_DEFAULT              (LIGHT_ATTEN_ANGLE | LIGHT_GRID | LIGHT_SURFACES)
 #define LIGHT_AREA_DEFAULT             (LIGHT_ATTEN_ANGLE | LIGHT_ATTEN_DISTANCE | LIGHT_GRID | LIGHT_SURFACES)        /* q3a and wolf are the same */
@@ -270,7 +272,7 @@ constants
 #define SUPER_NORMAL_SIZE              4
 #define SUPER_DELUXEL_SIZE             3
 #define BSP_DELUXEL_SIZE               3
-#define SUPER_FLOODLIGHT_SIZE  1
+#define SUPER_FLOODLIGHT_SIZE  4
 
 #define VERTEX_LUXEL( s, v )   (vertexLuxels[ s ] + ((v) * VERTEX_LUXEL_SIZE))
 #define RAD_VERTEX_LUXEL( s, v )(radVertexLuxels[ s ] + ((v) * VERTEX_LUXEL_SIZE))
@@ -314,7 +316,8 @@ abstracted bsp file
 #define        MAX_MAP_PORTALS                 0x20000
 #define        MAX_MAP_LIGHTING                0x800000
 #define        MAX_MAP_LIGHTGRID               0x100000        //%     0x800000 /* ydnar: set to points, not bytes */
-#define        MAX_MAP_VISIBILITY              0x200000
+#define MAX_MAP_VISCLUSTERS     0x4000 // <= MAX_MAP_LEAFS
+#define        MAX_MAP_VISIBILITY              (VIS_HEADER_SIZE + MAX_MAP_VISCLUSTERS * (((MAX_MAP_VISCLUSTERS + 63) & ~63) >> 3))
 
 #define        MAX_MAP_DRAW_SURFS              0x20000
 #define        MAX_MAP_DRAW_INDEXES    0x80000
@@ -532,6 +535,13 @@ typedef struct surfaceParm_s
 }
 surfaceParm_t;
 
+typedef enum
+{
+       MINIMAP_MODE_GRAY,
+       MINIMAP_MODE_BLACK,
+       MINIMAP_MODE_WHITE
+}
+miniMapMode_t;
 
 typedef struct game_s
 {
@@ -550,6 +560,21 @@ typedef struct game_s
        float                           lightmapGamma;                                  /* default lightmap gamma */
        float                           lightmapExposure;                               /* default lightmap exposure */
        float                           lightmapCompensate;                             /* default lightmap compensate value */
+       float                           gridScale;                                              /* vortex: default lightgrid scale (affects both directional and ambient spectres) */
+       float                           gridAmbientScale;                               /* vortex: default lightgrid ambient spectre scale */
+       qboolean                        lightAngleHL;                                   /* jal: use half-lambert curve for light angle attenuation */
+       qboolean                        noStyles;                                               /* use lightstyles hack or not */
+       qboolean                        keepLights;                                             /* keep light entities on bsp */
+       int                                     patchSubdivisions;                              /* default patch subdivisions tolerance */
+       qboolean                        patchShadows;                                   /* patch casting enabled */
+       qboolean                        deluxeMap;                                              /* compile deluxemaps */
+       int                                     deluxeMode;                                             /* deluxemap mode (0 - modelspace, 1 - tangentspace with renormalization, 2 - tangentspace without renormalization) */
+       int                 miniMapSize;                    /* minimap size */
+       float               miniMapSharpen;                 /* minimap sharpening coefficient */
+       float               miniMapBorder;                  /* minimap border amount */
+       qboolean            miniMapKeepAspect;              /* minimap keep aspect ratio by letterboxing */
+       miniMapMode_t       miniMapMode;                    /* minimap mode */
+       char                *miniMapNameFormat;             /* minimap name format */
        char                            *bspIdent;                                              /* 4-letter bsp file prefix */
        int                                     bspVersion;                                             /* bsp version to use */
        qboolean                        lumpSwap;                                               /* cod-style len/ofs order */
@@ -672,6 +697,7 @@ typedef struct shaderInfo_s
        char                            *backShader;                                    /* for surfaces that generate different front and back passes */
        char                            *cloneShader;                                   /* ydnar: for cloning of a surface */
        char                            *remapShader;                                   /* ydnar: remap a shader in final stage */
+       char                            *deprecateShader;                               /* vortex: shader is deprecated and replaced by this on use */
 
        surfaceModel_t          *surfaceModel;                                  /* ydnar: for distribution of models */
        foliage_t                       *foliage;                                               /* ydnar/splash damage: wolf et foliage */
@@ -747,7 +773,13 @@ typedef struct shaderInfo_s
        
        vec3_t                          color;                                                  /* normalized color */
        vec3_t                          averageColor;
-       byte                            lightStyle;
+       byte                            lightStyle;                                     
+
+       /* vortex: per-surface floodlight */
+       float                           floodlightDirectionScale;
+       vec3_t                          floodlightRGB; 
+       float                           floodlightIntensity;
+       float                           floodlightDistance;
        
        qb_t                            lmMergable;                                             /* ydnar */
        int                                     lmCustomWidth, lmCustomHeight;  /* ydnar */
@@ -778,7 +810,7 @@ typedef struct face_s
        struct face_s           *next;
        int                                     planenum;
        int                                     priority;
-       qboolean                        checked;
+       //qboolean                      checked;
        int                                     compileFlags;
        winding_t                       *w;
 }
@@ -790,6 +822,7 @@ typedef struct plane_s
        vec3_t                          normal;
        vec_t                           dist;
        int                                     type;
+       int                 counter;
        int                                     hash_chain;
 }
 plane_t;
@@ -857,7 +890,9 @@ typedef struct brush_s
        shaderInfo_t            *celShader;                     /* :) */
        
        /* ydnar: gs mods */
+       int                                     lightmapSampleSize; /* jal : entity based _lightmapsamplesize */
        float                           lightmapScale;
+       float                           shadeAngleDegrees; /* jal : entity based _shadeangle */
        vec3_t                          eMins, eMaxs;
        indexMap_t                      *im;
 
@@ -908,6 +943,7 @@ typedef struct parseMesh_s
        shaderInfo_t            *celShader;                             /* :) */
        
        /* ydnar: gs mods */
+       int                                     lightmapSampleSize;             /* jal : entity based _lightmapsamplesize */
        float                           lightmapScale;
        vec3_t                          eMins, eMaxs;
        indexMap_t                      *im;
@@ -1005,6 +1041,9 @@ typedef struct mapDrawSurface_s
        
        /* ydnar: per-surface (per-entity, actually) lightmap sample size scaling */
        float                           lightmapScale;
+
+       /* jal: per-surface (per-entity, actually) shadeangle */
+       float                           shadeAngleDegrees;
        
        /* ydnar: surface classification */
        vec3_t                          mins, maxs;
@@ -1023,7 +1062,7 @@ typedef struct mapDrawSurface_s
        int                                     maxIterations;
        int                                     patchWidth, patchHeight;
        vec3_t                          bounds[ 2 ];
-       
+
        /* ydnar/sd: for foliage */
        int                                     numFoliageInstances;
        
@@ -1048,6 +1087,7 @@ typedef struct metaTriangle_s
        shaderInfo_t            *si;
        side_t                          *side;
        int                                     entityNum, surfaceNum, planeNum, fogNum, sampleSize, castShadows, recvShadows;
+       float                           shadeAngleDegrees;
        vec4_t                          plane;
        vec3_t                          lightmapAxis;
        int                                     indexes[ 3 ];
@@ -1105,6 +1145,8 @@ typedef struct node_s
        entity_t                        *occupant;              /* for leak file testing */
 
        struct portal_s         *portals;               /* also on nodes during construction */
+
+       qboolean            has_structural_children;
 }
 node_t;
 
@@ -1262,6 +1304,7 @@ typedef struct light_s
        float                           radiusByDist;   /* for spotlights */
        float                           fade;                   /* ydnar: from wolf, for linear lights */
        float                           angleScale;             /* ydnar: stolen from vlight for K */
+       float                           extraDist;              /* "extra dimension" distance of the light, to kill hot spots */
 
        float                           add;                    /* ydnar: used for area lights */
        float                           envelope;               /* ydnar: units until falloff < tolerance */
@@ -1307,7 +1350,9 @@ typedef struct
        
        /* input and output */
        vec3_t                          color;                  /* starts out at full color, may be reduced if transparent surfaces are crossed */
-       
+       vec3_t                          colorNoShadow;  /* result color with no shadow casting */
+       vec3_t                          directionContribution; /* result contribution to the deluxe map */
+
        /* output */
        vec3_t                          hit;
        int                                     compileFlags;   /* for determining surface compile flags traced through */
@@ -1378,6 +1423,13 @@ typedef struct rawLightmap_s
        int                                             numLightClusters, *lightClusters;
        
        int                                             sampleSize, actualSampleSize, axisNum;
+
+       /* vortex: per-surface floodlight */
+       float                                   floodlightDirectionScale;
+       vec3_t                                  floodlightRGB; 
+       float                                   floodlightIntensity;
+       float                                   floodlightDistance;
+
        int                                             entityNum;
        int                                             recvShadows;
        vec3_t                                  mins, maxs, axis, origin, *vecs;
@@ -1433,8 +1485,6 @@ typedef struct surfaceInfo_s
 }
 surfaceInfo_t;
 
-
-
 /* -------------------------------------------------------------------------------
 
 prototypes
@@ -1568,6 +1618,7 @@ void                                              FreeTreePortals_r( node_t *node );
 void                                           ParsePatch( qboolean onlyLights );
 mesh_t                                         *SubdivideMesh( mesh_t in, float maxError, float minLength );
 void                                           PatchMapDrawSurfs( entity_t *e );
+void                                           TriangulatePatchSurface( entity_t *e , mapDrawSurface_t *ds );
 
 
 /* tjunction.c */
@@ -1593,7 +1644,7 @@ void                                              PicoPrintFunc( int level, const char *str );
 void                                           PicoLoadFileFunc( char *name, byte **buffer, int *bufSize );
 picoModel_t                                    *FindModel( char *name, int frame );
 picoModel_t                                    *LoadModel( char *name, int frame );
-void                                           InsertModel( char *name, int frame, m4x4_t transform, remap_t *remap, shaderInfo_t *celShader, int eNum, int castShadows, int recvShadows, int spawnFlags, float lightmapScale );
+void                                           InsertModel( char *name, int frame, m4x4_t transform, remap_t *remap, shaderInfo_t *celShader, int eNum, int castShadows, int recvShadows, int spawnFlags, float lightmapScale, int lightmapSampleSize, float shadeAngle );
 void                                           AddTriangleModels( entity_t *e );
 
 
@@ -1622,6 +1673,8 @@ void                                              SubdivideFaceSurfaces( entity_t *e, tree_t *tree );
 void                                           AddEntitySurfaceModels( entity_t *e );
 int                                                    AddSurfaceModels( mapDrawSurface_t *ds );
 void                                           FilterDrawsurfsIntoTree( entity_t *e, tree_t *tree );
+void                                           EmitPatchSurface( entity_t *e, mapDrawSurface_t *ds );
+void                                           EmitTriangleSurface( mapDrawSurface_t *ds );
 
 
 /* surface_fur.c */
@@ -1719,7 +1772,9 @@ float                                             DirtForSample( trace_t *trace );
 void                                           DirtyRawLightmap( int num );
 
 void                                           SetupFloodLight();
-float                                          FloodLightForSample( trace_t *trace );
+void                                           FloodlightRawLightmaps();
+void                                           FloodlightIlluminateLightmap( rawLightmap_t *lm );
+float                                          FloodLightForSample( trace_t *trace , float floodLightDistance, qboolean floodLightLowQuality);
 void                                           FloodLightRawLightmap( int num );
 
 void                                           IlluminateRawLightmap( int num );
@@ -1871,6 +1926,12 @@ Q_EXTERN game_t                          games[]
                                                                ,
                                                                #include "game_qfusion.h"       /* qfusion game */
                                                                ,
+                                                               #include "game_darkplaces.h"    /* vortex: darkplaces q1 engine */
+                                                               ,
+                                                               #include "game_dq.h"    /* vortex: deluxe quake game ( darkplaces q1 engine) */
+                                                               ,
+                                                               #include "game_prophecy.h"      /* vortex: prophecy game ( darkplaces q1 engine) */
+                                                               ,
                                                                { NULL }        /* null game */
                                                        };
 #endif
@@ -1919,6 +1980,8 @@ Q_EXTERN qboolean                 nofog Q_ASSIGN( qfalse );
 Q_EXTERN qboolean                      noHint Q_ASSIGN( qfalse );                              /* ydnar */
 Q_EXTERN qboolean                      renameModelShaders Q_ASSIGN( qfalse );  /* ydnar */
 Q_EXTERN qboolean                      skyFixHack Q_ASSIGN( qfalse );                  /* ydnar */
+Q_EXTERN qboolean                      bspAlternateSplitWeights Q_ASSIGN( qfalse );                    /* 27 */
+Q_EXTERN qboolean                      deepBSP Q_ASSIGN( qfalse );                     /* div0 */
 
 Q_EXTERN int                           patchSubdivisions Q_ASSIGN( 8 );                /* ydnar: -patchmeta subdivisions */
 
@@ -1957,6 +2020,7 @@ Q_EXTERN char                             outbase[ 32 ];
 
 Q_EXTERN int                           sampleSize;                                             /* lightmap sample size in units */
 Q_EXTERN int                           minSampleSize;                  /* minimum sample size to use at all */
+Q_EXTERN int                           sampleScale;                                    /* vortex: lightmap sample scale (ie quality)*/
 
 Q_EXTERN int                           mapEntityNum Q_ASSIGN( 0 );
 
@@ -2033,15 +2097,13 @@ Q_EXTERN qboolean                       fastvis;
 Q_EXTERN qboolean                      noPassageVis;
 Q_EXTERN qboolean                      passageVisOnly;
 Q_EXTERN qboolean                      mergevis;
+Q_EXTERN qboolean                      mergevisportals;
 Q_EXTERN qboolean                      nosort;
 Q_EXTERN qboolean                      saveprt;
 Q_EXTERN qboolean                      hint;   /* ydnar */
 Q_EXTERN char                          inbase[ MAX_QPATH ];
 Q_EXTERN char                          globalCelShader[ MAX_QPATH ];
 
-/* other bits */
-Q_EXTERN int                           totalvis;
-
 Q_EXTERN float                         farPlaneDist;   /* rr2do2, rf, mre, ydnar all contributed to this one... */
 
 Q_EXTERN int                           numportals;
@@ -2081,8 +2143,10 @@ light global variables
 
 /* commandline arguments */
 Q_EXTERN qboolean                      wolfLight Q_ASSIGN( qfalse );
+Q_EXTERN float                         extraDist Q_ASSIGN( 0.0f );
 Q_EXTERN qboolean                      loMem Q_ASSIGN( qfalse );
 Q_EXTERN qboolean                      noStyles Q_ASSIGN( qfalse );
+Q_EXTERN qboolean                      keepLights Q_ASSIGN( qfalse );
 
 Q_EXTERN int                           sampleSize Q_ASSIGN( DEFAULT_LIGHTMAP_SAMPLE_SIZE );
 Q_EXTERN int                           minSampleSize Q_ASSIGN( DEFAULT_LIGHTMAP_MIN_SAMPLE_SIZE );
@@ -2096,6 +2160,7 @@ Q_EXTERN qboolean                 cpmaHack Q_ASSIGN( qfalse );
 
 Q_EXTERN qboolean                      deluxemap Q_ASSIGN( qfalse );
 Q_EXTERN qboolean                      debugDeluxemap Q_ASSIGN( qfalse );
+Q_EXTERN int                           deluxemode Q_ASSIGN( 0 );       /* deluxemap format (0 - modelspace, 1 - tangentspace with renormalization, 2 - tangentspace without renormalization) */
 
 Q_EXTERN qboolean                      fast Q_ASSIGN( qfalse );
 Q_EXTERN qboolean                      faster Q_ASSIGN( qfalse );
@@ -2118,10 +2183,12 @@ Q_EXTERN qboolean                       dark Q_ASSIGN( qfalse );
 Q_EXTERN qboolean                      sunOnly Q_ASSIGN( qfalse );
 Q_EXTERN int                           approximateTolerance Q_ASSIGN( 0 );
 Q_EXTERN qboolean                      noCollapse Q_ASSIGN( qfalse );
+Q_EXTERN int                           lightmapSearchBlockSize Q_ASSIGN( 0 );
 Q_EXTERN qboolean                      exportLightmaps Q_ASSIGN( qfalse );
 Q_EXTERN qboolean                      externalLightmaps Q_ASSIGN( qfalse );
 Q_EXTERN int                           lmCustomSize Q_ASSIGN( LIGHTMAP_WIDTH );
 Q_EXTERN char *                                lmCustomDir Q_ASSIGN( NULL );
+Q_EXTERN int                           lmLimitSize Q_ASSIGN( 0 );
 
 Q_EXTERN qboolean                      dirty Q_ASSIGN( qfalse );
 Q_EXTERN qboolean                      dirtDebug Q_ASSIGN( qfalse );
@@ -2130,12 +2197,13 @@ Q_EXTERN float                          dirtDepth Q_ASSIGN( 128.0f );
 Q_EXTERN float                         dirtScale Q_ASSIGN( 1.0f );
 Q_EXTERN float                         dirtGain Q_ASSIGN( 1.0f );
 
-Q_EXTERN qboolean                      debugnormals Q_ASSIGN( qfalse );
-Q_EXTERN qboolean                      floodlighty Q_ASSIGN( qfalse );
-Q_EXTERN qboolean                      floodlight_lowquality Q_ASSIGN( qfalse );
-Q_EXTERN vec3_t                                floodlightRGB;
-Q_EXTERN float                         floodlightIntensity Q_ASSIGN( 512 );
-Q_EXTERN float                         floodlightDistance Q_ASSIGN( 1024 );
+/* 27: floodlighting */
+Q_EXTERN qboolean                                      debugnormals Q_ASSIGN( qfalse );
+Q_EXTERN qboolean                                      floodlighty Q_ASSIGN( qfalse );
+Q_EXTERN qboolean                                      floodlight_lowquality Q_ASSIGN( qfalse );
+Q_EXTERN vec3_t                                                floodlightRGB;
+Q_EXTERN float                                         floodlightIntensity Q_ASSIGN( 512.0f );
+Q_EXTERN float                                         floodlightDistance Q_ASSIGN( 1024.0f );
 
 Q_EXTERN qboolean                      dump Q_ASSIGN( qfalse );
 Q_EXTERN qboolean                      debug Q_ASSIGN( qfalse );
@@ -2154,6 +2222,16 @@ Q_EXTERN float                           areaScale Q_ASSIGN( 0.25f );
 Q_EXTERN float                         skyScale Q_ASSIGN( 1.0f );
 Q_EXTERN float                         bounceScale Q_ASSIGN( 0.25f );
 
+/* jal: alternative angle attenuation curve */
+Q_EXTERN qboolean                      lightAngleHL Q_ASSIGN( qfalse );
+/* vortex: gridscale and gridambientscale */
+Q_EXTERN float                         gridScale Q_ASSIGN( 1.0f );
+Q_EXTERN float                         gridAmbientScale Q_ASSIGN( 1.0f );
+Q_EXTERN float                         gridDirectionality Q_ASSIGN( 1.0f );
+Q_EXTERN float                         gridAmbientDirectionality Q_ASSIGN( 0.0f );
+Q_EXTERN qboolean                      inGrid Q_ASSIGN(0);
+
 /* ydnar: lightmap gamma/compensation */
 Q_EXTERN float                         lightmapGamma Q_ASSIGN( 1.0f );
 Q_EXTERN float                         lightmapExposure Q_ASSIGN( 1.0f );
@@ -2264,6 +2342,9 @@ Q_EXTERN int                              numBSPLightmaps Q_ASSIGN( 0 );
 Q_EXTERN int                           numExtLightmaps Q_ASSIGN( 0 );
 Q_EXTERN outLightmap_t         *outLightmaps Q_ASSIGN( NULL );
 
+/* vortex: per surface floodlight statictics */
+Q_EXTERN int                           numSurfacesFloodlighten Q_ASSIGN( 0 );
+
 /* grid points */
 Q_EXTERN int                           numRawGridPoints Q_ASSIGN( 0 );
 Q_EXTERN rawGridPoint_t                *rawGridPoints Q_ASSIGN( NULL );
@@ -2314,7 +2395,8 @@ Q_EXTERN int                              allocatedBSPShaders Q_ASSIGN( 0 );
 Q_EXTERN bspShader_t*          bspShaders Q_ASSIGN(0);
 
 Q_EXTERN int                           bspEntDataSize Q_ASSIGN( 0 );
-Q_EXTERN char                          bspEntData[ MAX_MAP_ENTSTRING ];
+Q_EXTERN int                           allocatedBSPEntData Q_ASSIGN( 0 );
+Q_EXTERN char                          *bspEntData Q_ASSIGN(0);
 
 Q_EXTERN int                           numBSPLeafs Q_ASSIGN( 0 );
 Q_EXTERN bspLeaf_t                     bspLeafs[ MAX_MAP_LEAFS ];