]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
now supports skyboxes in q3bsp (note: must use the "sky" key in worldspawn to set...
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 21 Sep 2003 03:34:58 +0000 (03:34 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 21 Sep 2003 03:34:58 +0000 (03:34 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@3490 d7cf8633-e32d-0410-b094-e92efae38249

gl_rsurf.c
model_brush.c
model_shared.h
r_sky.c
todo

index 38d17b1119f18e5ee762fe1696ee80d3a78129c6..161344ab0e47689e0cc2c9e5c723076c13fbdd82 100644 (file)
@@ -1946,8 +1946,50 @@ void R_DrawCollisionBrush(colbrushf_t *brush)
 void R_Q3BSP_DrawFace(entity_render_t *ent, q3mface_t *face)
 {
        rmeshstate_t m;
-       if ((face->texture->renderflags & Q3MTEXTURERENDERFLAGS_NODRAW) || !face->numtriangles)
+       if (!face->numtriangles)
                return;
+       if (face->texture->renderflags)
+       {
+               if (face->texture->renderflags & Q3MTEXTURERENDERFLAGS_SKY)
+               {
+                       if (skyrendernow)
+                       {
+                               skyrendernow = false;
+                               if (skyrendermasked)
+                                       R_Sky();
+                       }
+
+                       R_Mesh_Matrix(&ent->matrix);
+
+                       GL_Color(fogcolor[0] * r_colorscale, fogcolor[1] * r_colorscale, fogcolor[2] * r_colorscale, 1);
+                       if (skyrendermasked)
+                       {
+                               // depth-only (masking)
+                               qglColorMask(0,0,0,0);
+                               // just to make sure that braindead drivers don't draw anything
+                               // despite that colormask...
+                               GL_BlendFunc(GL_ZERO, GL_ONE);
+                       }
+                       else
+                       {
+                               // fog sky
+                               GL_BlendFunc(GL_ONE, GL_ZERO);
+                       }
+                       GL_DepthMask(true);
+                       GL_DepthTest(true);
+
+                       memset(&m, 0, sizeof(m));
+                       R_Mesh_State_Texture(&m);
+
+                       GL_VertexPointer(face->data_vertex3f);
+                       R_Mesh_Draw(face->numvertices, face->numtriangles, face->data_element3i);
+                       qglColorMask(1,1,1,1);
+                       return;
+               }
+               if (face->texture->renderflags & Q3MTEXTURERENDERFLAGS_NODRAW)
+                       return;
+       }
+       R_Mesh_Matrix(&ent->matrix);
        face->visframe = r_framecount;
        memset(&m, 0, sizeof(m));
        GL_BlendFunc(GL_ONE, GL_ZERO);
index 2c577105f03366f44b7394e414e6ac32b46f27a6..1fb281ebe6d79135cc1580b4d0a788daac38d774 100644 (file)
@@ -1833,15 +1833,25 @@ static void Mod_Q1BSP_LoadLeafs(lump_t *l)
 
                out->firstmarksurface = loadmodel->brushq1.marksurfaces + LittleShort(in->firstmarksurface);
                out->nummarksurfaces = LittleShort(in->nummarksurfaces);
+               if (out->firstmarksurface < 0 || LittleShort(in->firstmarksurface) + out->nummarksurfaces > loadmodel->brushq1.nummarksurfaces)
+               {
+                       Con_Printf("Mod_Q1BSP_LoadLeafs: invalid marksurface range %i:%i outside range %i:%i\n", out->firstmarksurface, out->firstmarksurface + out->nummarksurfaces, 0, loadmodel->brushq1.nummarksurfaces);
+                       out->firstmarksurface = NULL;
+                       out->nummarksurfaces = 0;
+               }
 
                out->pvsdata = pvs;
+               memset(out->pvsdata, 0xFF, pvschainbytes);
                pvs += pvschainbytes;
 
                p = LittleLong(in->visofs);
                if (p >= 0)
-                       Mod_Q1BSP_DecompressVis(loadmodel->brushq1.data_compressedpvs + p, loadmodel->brushq1.data_compressedpvs + loadmodel->brushq1.num_compressedpvs, out->pvsdata, out->pvsdata + pvschainbytes);
-               else
-                       memset(out->pvsdata, 0xFF, pvschainbytes);
+               {
+                       if (p >= loadmodel->brushq1.num_compressedpvs)
+                               Con_Printf("Mod_Q1BSP_LoadLeafs: invalid visofs\n");
+                       else
+                               Mod_Q1BSP_DecompressVis(loadmodel->brushq1.data_compressedpvs + p, loadmodel->brushq1.data_compressedpvs + loadmodel->brushq1.num_compressedpvs, out->pvsdata, out->pvsdata + pvschainbytes);
+               }
 
                for (j = 0;j < 4;j++)
                        out->ambient_sound_level[j] = in->ambient_level[j];
@@ -3322,6 +3332,8 @@ static void Mod_Q3BSP_LoadTextures(lump_t *l)
                out->renderflags = 0;
                if (!strcmp(out->name, "caulk") || !strcmp(out->name, "common/caulk") || !strcmp(out->name, "textures/common/caulk"))
                        out->renderflags |= Q3MTEXTURERENDERFLAGS_NODRAW;
+               if (!strncmp(out->name, "textures/skies/", 15))
+                       out->renderflags |= Q3MTEXTURERENDERFLAGS_SKY;
 
                out->number = i;
                Mod_LoadSkinFrame(&out->skin, out->name, TEXF_MIPMAP | TEXF_ALPHA | TEXF_PRECACHE, false, true, true);
index 7c1f5ec867f96c3f85f4eb27fbb9424d45e8caa8..5802d2c15da8761aae166c6a49ac34380ecafb8f 100644 (file)
@@ -269,6 +269,7 @@ model_brushq2_t;
 */
 
 #define Q3MTEXTURERENDERFLAGS_NODRAW 1
+#define Q3MTEXTURERENDERFLAGS_SKY 2
 
 typedef struct q3mtexture_s
 {
diff --git a/r_sky.c b/r_sky.c
index 41f9876351dd6497d711f8cf478f924ff9abb8f3..ae126cf66d724c3d6249d94342a241cc89aed62e 100644 (file)
--- a/r_sky.c
+++ b/r_sky.c
@@ -186,18 +186,18 @@ float skyboxtexcoord2f[6*4*2] =
 
 int skyboxelements[6*2*3] =
 {
-       // skyside[0]
-        8,  9, 10,
-        8, 10, 11,
+       // skyside[3]
+        0,  1,  2,
+        0,  2,  3,
        // skyside[1]
         4,  5,  6,
         4,  6,  7,
+       // skyside[0]
+        8,  9, 10,
+        8, 10, 11,
        // skyside[2]
        12, 13, 14,
        12, 14, 15,
-       // skyside[3]
-        0,  1,  2,
-        0,  2,  3,
        // skyside[4]
        16, 17, 18,
        16, 18, 19,
diff --git a/todo b/todo
index 601e4d1e4a6dc129e64ca6b9190187c071221ce7..aa9e35332a33b97e7815bbf54847007712d9daaa 100644 (file)
--- a/todo
+++ b/todo
@@ -12,6 +12,8 @@
 -n darkplaces: server is starting before the "port" cvar is set by commandline and scripts? (yummyluv)
 -n darkplaces: typing ip in join game menu should show 'trying' and 'no response' after a while, or 'no network' if networking is not initialized (yummyluv)
 -n dpmod: make grapple off-hand (joe hill)
+0 darkplaces: server should send sv_gravity to client somehow (Vermeulen)
+0 darkplaces: server should send slowmo to client somehow (Vermeulen)
 0 darkplaces: make a getattachmentvectors qc builtin (Supajoe)
 0 darkplaces: add _reflect textures which filter use of skybox as a cubemap reflection (FrikaC)
 0 darkplaces: ability to disable fopen builtin access to read /, read data/, write data/, or disable fopen builtin entirely