Пример #1
0
 private void BuildBillboardFace(BspGeometry res, face_t face)
 {
 }
Пример #2
0
 private BspGeometryVertex BuildVertex(int p, face_t face)
 {
     BspGeometryVertex v = new BspGeometryVertex();
     var src = vertices[p];
     v.Position = src.vPosition;
     v.Normal = src.vNormal;
     v.UV0 = src.vTextureCoord;
     v.UV1 = src.vLightmapCoord;
     if (0 != (texInfo[face.texinfo_id].flags & texture_t.SURF_SKY))
     {
         v.UV0 = Vector2.g_Zero;
         v.UV1 = Vector2.g_Zero;
     }
     v.Color = Color.FromArgb(src.color[3], src.color[0], src.color[1], src.color[2]);
     return v;
 }
Пример #3
0
        private void BuildPathFace(BspGeometry res, face_t face)
        {
            var texture = (face.texinfo_id>=0)?textures[face.texinfo_id]:null;
            BspTexture lightMap = (face.lightmapID>=0)?lightmaps[face.lightmapID]:null;
            var width = face.sizeX;
            var height = face.sizeY;
            if (width * height != face.numOfVerts)
                throw new ApplicationException("wrong patch point count");
            for (int i = 0; i < width - 1; i += 1)
            {
                for (int j = 0; j < height - 1; j += 1)
                {
                    var vert0 = BuildVertex((int)(face.vertexIndex + (i) + (j) * width), face);
                    var vert1 = BuildVertex((int)(face.vertexIndex + (i + 1) + (j) * width), face);
                    var vert2 = BuildVertex((int)(face.vertexIndex + (i + 1) + (j + 1) * width), face);

                    var geoFace = new BspGeometryFace() { Vertex0 = vert2, Vertex1 = vert1, Vertex2 = vert0, Texture = texture, Lightmap = lightMap };
                    res.Faces.Add(geoFace);

                    vert0 = BuildVertex((int)(face.vertexIndex + (i) + (j) * width), face);
                    vert1 = BuildVertex((int)(face.vertexIndex + (i + 1) + (j+1) * width), face);
                    vert2 = BuildVertex((int)(face.vertexIndex + (i) + (j + 1) * width), face);

                    geoFace = new BspGeometryFace() { Vertex0 = vert2, Vertex1 = vert1, Vertex2 = vert0, Texture = texture, Lightmap = lightMap };
                    res.Faces.Add(geoFace);
                }
            }
        }
Пример #4
0
        private void BuildPolygonFace(BspGeometry res, face_t face)
        {
            var texture = (face.texinfo_id >= 0) ? textures[face.texinfo_id] : null;
            BspTexture lightMap = (face.lightmapID >= 0) ? lightmaps[face.lightmapID] : null;

            for (uint j = 0; j + 2 < face.numMeshVerts; j+=3)
            {
                var vert0 = BuildVertex((int)(face.vertexIndex+listOfVertices[face.meshVertIndex+j]), face);
                var vert1 = BuildVertex((int)(face.vertexIndex + listOfVertices[face.meshVertIndex + j+1]), face);
                var vert2 = BuildVertex((int)(face.vertexIndex + listOfVertices[face.meshVertIndex + j + 2]), face);

                var geoFace = new BspGeometryFace() { Vertex0 = vert0, Vertex1 = vert1, Vertex2 = vert2, Texture = texture, Lightmap = lightMap };
                res.Faces.Add(geoFace);
            }
        }
Пример #5
0
 private void BuildMeshFace(BspGeometry res, face_t face)
 {
     BuildPolygonFace(res, face);
 }