]> git.xonotic.org Git - xonotic/netradiant.git/blobdiff - tools/quake2/q2map/qrad.h
eol style
[xonotic/netradiant.git] / tools / quake2 / q2map / qrad.h
index 3bfc3854c703c5305df0989949d5fa3e6142ddca..2eef8bc4c2aef63f24c79a40f659d416791f4004 100644 (file)
-/*\r
-Copyright (C) 1999-2007 id Software, Inc. and contributors.\r
-For a list of contributors, see the accompanying CONTRIBUTORS file.\r
-\r
-This file is part of GtkRadiant.\r
-\r
-GtkRadiant is free software; you can redistribute it and/or modify\r
-it under the terms of the GNU General Public License as published by\r
-the Free Software Foundation; either version 2 of the License, or\r
-(at your option) any later version.\r
-\r
-GtkRadiant is distributed in the hope that it will be useful,\r
-but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-GNU General Public License for more details.\r
-\r
-You should have received a copy of the GNU General Public License\r
-along with GtkRadiant; if not, write to the Free Software\r
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA\r
-*/\r
-/* Files:\r
-\r
-lightmap.c\r
-patches.c\r
-qrad.c\r
-trace.c\r
-\r
-*/\r
-\r
-\r
-#include "cmdlib.h"\r
-#include "mathlib.h"\r
-#include "bspfile.h"\r
-#include "polylib.h"\r
-#include "q2_threads.h"\r
-#include "lbmlib.h"\r
-#include "inout.h"\r
-\r
-#ifdef _WIN32\r
-#include <windows.h>\r
-#endif\r
-\r
-#ifdef _WIN32\r
-       #ifdef NDEBUG                                                   // Don't show in a Release build\r
-               #pragma warning(disable : 4305)     // truncate from double to float\r
-               #pragma warning(disable : 4244)     // conversion from double to float\r
-               #pragma warning(disable : 4018)     // signed/unsigned mismatch\r
-       #endif\r
-#endif\r
-\r
-typedef enum\r
-{\r
-       emit_surface,\r
-       emit_point,\r
-       emit_spotlight\r
-} emittype_t;\r
-\r
-\r
-\r
-typedef struct directlight_s\r
-{\r
-       struct directlight_s *next;\r
-       emittype_t      type;\r
-\r
-       float           intensity;\r
-       int                     style;\r
-       vec3_t          origin;\r
-       vec3_t          color;\r
-       vec3_t          normal;         // for surfaces and spotlights\r
-       float           stopdot;                // for spotlights\r
-} directlight_t;\r
-\r
-\r
-// the sum of all tranfer->transfer values for a given patch\r
-// should equal exactly 0x10000, showing that all radiance\r
-// reaches other patches\r
-typedef struct\r
-{\r
-       unsigned short  patch;\r
-       unsigned short  transfer;\r
-} transfer_t;\r
-\r
-\r
-#define        MAX_PATCHES     65000                   // larger will cause 32 bit overflows\r
-\r
-typedef struct patch_s\r
-{\r
-       winding_t       *winding;\r
-       struct patch_s          *next;          // next in face\r
-       int                     numtransfers;\r
-       transfer_t      *transfers;\r
-\r
-       int                     cluster;                        // for pvs checking\r
-       vec3_t          origin;\r
-       dplane_t        *plane;\r
-\r
-       qboolean        sky;\r
-\r
-       vec3_t          totallight;                     // accumulated by radiosity\r
-                                                                       // does NOT include light\r
-                                                                       // accounted for by direct lighting\r
-       float           area;\r
-\r
-       // illuminance * reflectivity = radiosity\r
-       vec3_t          reflectivity;\r
-       vec3_t          baselight;                      // emissivity only\r
-\r
-       // each style 0 lightmap sample in the patch will be\r
-       // added up to get the average illuminance of the entire patch\r
-       vec3_t          samplelight;\r
-       int                     samples;                // for averaging direct light\r
-} patch_t;\r
-\r
-extern patch_t         *face_patches[MAX_MAP_FACES];\r
-extern entity_t        *face_entity[MAX_MAP_FACES];\r
-extern vec3_t          face_offset[MAX_MAP_FACES];             // for rotating bmodels\r
-extern patch_t         patches[MAX_PATCHES];\r
-extern unsigned        num_patches;\r
-\r
-extern int             leafparents[MAX_MAP_LEAFS];\r
-extern int             nodeparents[MAX_MAP_NODES];\r
-\r
-extern float   lightscale;\r
-\r
-\r
-void MakeShadowSplits (void);\r
-\r
-//==============================================\r
-\r
-\r
-void BuildVisMatrix (void);\r
-qboolean CheckVisBit (unsigned p1, unsigned p2);\r
-\r
-//==============================================\r
-\r
-extern float ambient, maxlight;\r
-\r
-void LinkPlaneFaces (void);\r
-\r
-extern qboolean        extrasamples;\r
-extern int numbounce;\r
-\r
-extern directlight_t   *directlights[MAX_MAP_LEAFS];\r
-\r
-extern byte    nodehit[MAX_MAP_NODES];\r
-\r
-void BuildLightmaps (void);\r
-\r
-void BuildFacelights (int facenum);\r
-\r
-void FinalLightFace (int facenum);\r
-\r
-qboolean PvsForOrigin (vec3_t org, byte *pvs);\r
-\r
-int TestLine_r (int node, vec3_t start, vec3_t stop);\r
-\r
-void CreateDirectLights (void);\r
-\r
-dleaf_t                *Rad_PointInLeaf (vec3_t point);\r
-\r
-\r
-extern dplane_t        backplanes[MAX_MAP_PLANES];\r
-extern int                     fakeplanes;                                     // created planes for origin offset \r
-\r
-extern float   subdiv;\r
-\r
-extern float   direct_scale;\r
-extern float   entity_scale;\r
-\r
-int    PointInLeafnum (vec3_t point);\r
-void MakeTnodes (dmodel_t *bm);\r
-void MakePatches (void);\r
-void SubdividePatches (void);\r
-void PairEdges (void);\r
-void (*CalcTextureReflectivity) (void);\r
-void CalcTextureReflectivity_Quake2(void);\r
-void CalcTextureReflectivity_Heretic2(void);\r
-\r
-//=============================================================================\r
-\r
-// externs\r
-\r
-extern char    *mapname;\r
-extern char    game[64];\r
+/*
+Copyright (C) 1999-2007 id Software, Inc. and contributors.
+For a list of contributors, see the accompanying CONTRIBUTORS file.
+
+This file is part of GtkRadiant.
+
+GtkRadiant is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+GtkRadiant is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GtkRadiant; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+*/
+/* Files:
+
+lightmap.c
+patches.c
+qrad.c
+trace.c
+
+*/
+
+
+#include "cmdlib.h"
+#include "mathlib.h"
+#include "bspfile.h"
+#include "polylib.h"
+#include "q2_threads.h"
+#include "lbmlib.h"
+#include "inout.h"
+
+#ifdef _WIN32
+#include <windows.h>
+#endif
+
+#ifdef _WIN32
+       #ifdef NDEBUG                                                   // Don't show in a Release build
+               #pragma warning(disable : 4305)     // truncate from double to float
+               #pragma warning(disable : 4244)     // conversion from double to float
+               #pragma warning(disable : 4018)     // signed/unsigned mismatch
+       #endif
+#endif
+
+typedef enum
+{
+       emit_surface,
+       emit_point,
+       emit_spotlight
+} emittype_t;
+
+
+
+typedef struct directlight_s
+{
+       struct directlight_s *next;
+       emittype_t      type;
+
+       float           intensity;
+       int                     style;
+       vec3_t          origin;
+       vec3_t          color;
+       vec3_t          normal;         // for surfaces and spotlights
+       float           stopdot;                // for spotlights
+} directlight_t;
+
+
+// the sum of all tranfer->transfer values for a given patch
+// should equal exactly 0x10000, showing that all radiance
+// reaches other patches
+typedef struct
+{
+       unsigned short  patch;
+       unsigned short  transfer;
+} transfer_t;
+
+
+#define        MAX_PATCHES     65000                   // larger will cause 32 bit overflows
+
+typedef struct patch_s
+{
+       winding_t       *winding;
+       struct patch_s          *next;          // next in face
+       int                     numtransfers;
+       transfer_t      *transfers;
+
+       int                     cluster;                        // for pvs checking
+       vec3_t          origin;
+       dplane_t        *plane;
+
+       qboolean        sky;
+
+       vec3_t          totallight;                     // accumulated by radiosity
+                                                                       // does NOT include light
+                                                                       // accounted for by direct lighting
+       float           area;
+
+       // illuminance * reflectivity = radiosity
+       vec3_t          reflectivity;
+       vec3_t          baselight;                      // emissivity only
+
+       // each style 0 lightmap sample in the patch will be
+       // added up to get the average illuminance of the entire patch
+       vec3_t          samplelight;
+       int                     samples;                // for averaging direct light
+} patch_t;
+
+extern patch_t         *face_patches[MAX_MAP_FACES];
+extern entity_t        *face_entity[MAX_MAP_FACES];
+extern vec3_t          face_offset[MAX_MAP_FACES];             // for rotating bmodels
+extern patch_t         patches[MAX_PATCHES];
+extern unsigned        num_patches;
+
+extern int             leafparents[MAX_MAP_LEAFS];
+extern int             nodeparents[MAX_MAP_NODES];
+
+extern float   lightscale;
+
+
+void MakeShadowSplits (void);
+
+//==============================================
+
+
+void BuildVisMatrix (void);
+qboolean CheckVisBit (unsigned p1, unsigned p2);
+
+//==============================================
+
+extern float ambient, maxlight;
+
+void LinkPlaneFaces (void);
+
+extern qboolean        extrasamples;
+extern int numbounce;
+
+extern directlight_t   *directlights[MAX_MAP_LEAFS];
+
+extern byte    nodehit[MAX_MAP_NODES];
+
+void BuildLightmaps (void);
+
+void BuildFacelights (int facenum);
+
+void FinalLightFace (int facenum);
+
+qboolean PvsForOrigin (vec3_t org, byte *pvs);
+
+int TestLine_r (int node, vec3_t start, vec3_t stop);
+
+void CreateDirectLights (void);
+
+dleaf_t                *Rad_PointInLeaf (vec3_t point);
+
+
+extern dplane_t        backplanes[MAX_MAP_PLANES];
+extern int                     fakeplanes;                                     // created planes for origin offset 
+
+extern float   subdiv;
+
+extern float   direct_scale;
+extern float   entity_scale;
+
+int    PointInLeafnum (vec3_t point);
+void MakeTnodes (dmodel_t *bm);
+void MakePatches (void);
+void SubdividePatches (void);
+void PairEdges (void);
+void (*CalcTextureReflectivity) (void);
+void CalcTextureReflectivity_Quake2(void);
+void CalcTextureReflectivity_Heretic2(void);
+
+//=============================================================================
+
+// externs
+
+extern char    *mapname;
+extern char    game[64];