Ejemplo n.º 1
0
 private void UpdateLightmap(BspTexture result, Atlas atlas)
 {
     foreach (var geo in allClusters)
     {
         Size dstSize = new Size(atlas.Bitmap.Width, atlas.Bitmap.Height);
         for (int i = 0; i < geo.Faces.Count; ++i)
         {
             var f = geo.Faces[i];
             if (f.Lightmap != null)
             {
                 if (f.Lightmap.Equals(result))
                     continue;
                 var item = atlas.GetItem(((BspEmbeddedTexture)f.Lightmap).mipMaps[0]);
                 var ff = new BspGeometryFace() { Texture = f.Texture, Lightmap = result };
                 ff.Vertex0 = CorrectLightmapCoords(f.Vertex0, dstSize, item);
                 ff.Vertex1 = CorrectLightmapCoords(f.Vertex1, dstSize, item);
                 ff.Vertex2 = CorrectLightmapCoords(f.Vertex2, dstSize, item);
                 geo.Faces[i] = ff;
             }
         }
     }
 }