]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - cl_video.c
huge (16%) speed gain on surface rendering by eliminating the surfmesh chain in q1bsp...
[xonotic/darkplaces.git] / cl_video.c
index 857d5d8fb85bba8cc477c04cab432d7c21ae6c4c..b9b215d1cd55d46bd0fdaaae9a36639733727b8b 100644 (file)
@@ -56,7 +56,7 @@ void CL_VideoFrame(void)
        }
        if (cl_videosoundrate && (samples = S_RawSamples_QueueWantsMore()))
        {
-               Con_Printf("%i = S_RawSamples_QueueWantsMore()\n", samples);
+               Con_DPrintf("%i = S_RawSamples_QueueWantsMore()\n", samples);
 
                // calculate how much source data we need to fill the output...
                s = samples * cl_videosoundrate / S_RawSamples_SampleRate();
@@ -90,38 +90,31 @@ void CL_DrawVideo(void)
        if (cl_videoplaying)
        {
                drawqueuemesh_t mesh;
-               int indices[6];
-               float vertices[16];
-               float texcoords[8];
-               float colorsf[16];
+               float vertex3f[12];
+               float texcoord2f[8];
+               float color4f[16];
                float s1, t1, s2, t2, x1, y1, x2, y2;
-               indices[0] = 0;
-               indices[1] = 1;
-               indices[2] = 2;
-               indices[3] = 0;
-               indices[4] = 2;
-               indices[5] = 3;
                x1 = 0;
                y1 = 0;
                x2 = vid.conwidth;
                y2 = vid.conheight;
                R_FragmentLocation(cl_videotexture, NULL, NULL, &s1, &t1, &s2, &t2);
-               texcoords[0] = s1;texcoords[1] = t1;
-               texcoords[2] = s2;texcoords[3] = t1;
-               texcoords[4] = s2;texcoords[5] = t2;
-               texcoords[6] = s1;texcoords[7] = t2;
-               R_FillColors(colorsf, 4, r_colorscale, r_colorscale, r_colorscale, 1);
-               vertices[ 0] = x1;vertices[ 1] = y1;vertices[ 2] = 0;vertices[ 3] = 0;
-               vertices[ 4] = x2;vertices[ 5] = y1;vertices[ 6] = 0;vertices[ 7] = 0;
-               vertices[ 8] = x2;vertices[ 9] = y2;vertices[10] = 0;vertices[11] = 0;
-               vertices[12] = x1;vertices[13] = y2;vertices[14] = 0;vertices[15] = 0;
+               texcoord2f[0] = s1;texcoord2f[1] = t1;
+               texcoord2f[2] = s2;texcoord2f[3] = t1;
+               texcoord2f[4] = s2;texcoord2f[5] = t2;
+               texcoord2f[6] = s1;texcoord2f[7] = t2;
+               R_FillColors(color4f, 4, 1, 1, 1, 1);
+               vertex3f[ 0] = x1;vertex3f[ 1] = y1;vertex3f[ 2] = 0;
+               vertex3f[ 3] = x2;vertex3f[ 4] = y1;vertex3f[ 5] = 0;
+               vertex3f[ 6] = x2;vertex3f[ 7] = y2;vertex3f[ 8] = 0;
+               vertex3f[ 9] = x1;vertex3f[10] = y2;vertex3f[11] = 0;
                mesh.texture = cl_videotexture;
-               mesh.numtriangles = 2;
-               mesh.numvertices = 4;
-               mesh.indices = indices;
-               mesh.vertices = vertices;
-               mesh.texcoords = texcoords;
-               mesh.colors = colorsf;
+               mesh.num_triangles = 2;
+               mesh.num_vertices = 4;
+               mesh.data_element3i = polygonelements;
+               mesh.data_vertex3f = vertex3f;
+               mesh.data_texcoord2f = texcoord2f;
+               mesh.data_color4f = color4f;
                DrawQ_Mesh(&mesh, 0);
                //DrawQ_Pic(0, 0, "engine_videoframe", vid.conwidth, vid.conheight, 1, 1, 1, 1, 0);
        }
@@ -159,7 +152,7 @@ void CL_VideoStart(char *filename)
        cl_videosoundresampledata = NULL;
 
        cl_videotexturepool = R_AllocTexturePool();
-       cl_videotexture = R_LoadTexture(cl_videotexturepool, "videotexture", cl_videoimagewidth, cl_videoimageheight, NULL, TEXTYPE_RGBA, TEXF_FRAGMENT);
+       cl_videotexture = R_LoadTexture2D(cl_videotexturepool, "videotexture", cl_videoimagewidth, cl_videoimageheight, NULL, TEXTYPE_RGBA, TEXF_FRAGMENT, NULL);
 }
 
 void CL_VideoStop(void)
@@ -200,7 +193,7 @@ static void CL_PlayVideo_f(void)
                return;
        }
 
-       sprintf(name, "%s/video/%s.dpv", com_gamedir, Cmd_Argv(1));
+       sprintf(name, "video/%s.dpv", Cmd_Argv(1));
        CL_VideoStart(name);
 }