예제 #1
0
        /*
         * =============
         * RB_SurfaceTriangles
         * =============
         */
        void RB_SurfaceTriangles(srfTriangles_t *srf)
        {
            int         i;
            drawVert_t *dv;
            float *     xyz, *normal, *texCoords;
            byte *      color;
            int         dlightBits;
            bool        needsNormal;

            dlightBits       = srf->dlightBits[backEnd.smpFrame];
            tess.dlightBits |= dlightBits;

            RB_CHECKOVERFLOW(srf->numVerts, srf->numIndexes);

            for (i = 0; i < srf->numIndexes; i += 3)
            {
                tess.indexes[tess.numIndexes + i + 0] = tess.numVertexes + srf->indexes[i + 0];
                tess.indexes[tess.numIndexes + i + 1] = tess.numVertexes + srf->indexes[i + 1];
                tess.indexes[tess.numIndexes + i + 2] = tess.numVertexes + srf->indexes[i + 2];
            }
            tess.numIndexes += srf->numIndexes;

            dv          = srf->verts;
            xyz         = tess.xyz[tess.numVertexes];
            normal      = tess.normal[tess.numVertexes];
            texCoords   = tess.texCoords[tess.numVertexes][0];
            color       = tess.vertexColors[tess.numVertexes];
            needsNormal = tess.shader->needsNormal;

            for (i = 0; i < srf->numVerts; i++, dv++, xyz += 4, normal += 4, texCoords += 4, color += 4)
            {
                xyz[0] = dv->xyz[0];
                xyz[1] = dv->xyz[1];
                xyz[2] = dv->xyz[2];

                if (needsNormal)
                {
                    normal[0] = dv->normal[0];
                    normal[1] = dv->normal[1];
                    normal[2] = dv->normal[2];
                }

                texCoords[0] = dv->st[0];
                texCoords[1] = dv->st[1];

                texCoords[2] = dv->lightmap[0];
                texCoords[3] = dv->lightmap[1];

                *(int *)color = *(int *)dv->color;
            }

            for (i = 0; i < srf->numVerts; i++)
            {
                tess.vertexDlightBits[tess.numVertexes + i] = dlightBits;
            }

            tess.numVertexes += srf->numVerts;
        }
예제 #2
0
        /*
         * =================
         * R_CullTriSurf
         *
         * Returns true if the grid is completely culled away.
         * Also sets the clipped hint bit in tess
         * =================
         */
        static bool     R_CullTriSurf(srfTriangles_t *cv)
        {
            int boxCull;

            boxCull = R_CullLocalBox(cv->bounds);

            if (boxCull == CULL_OUT)
            {
                return(true);
            }
            return(false);
        }
예제 #3
0
 static int R_DlightTrisurf(srfTriangles_t *surf, int dlightBits)
 {
     // FIXME: more dlight culling to trisurfs...
     surf->dlightBits[tr.smpFrame] = dlightBits;
     return(dlightBits);
 }