示例#1
0
        public float SurfaceArea(scenario_structure_bsp bsp, scenario_structure_bsp.StructureBspMaterialBlock material, int f, EnhancedMesh mesh)
        {
            float area = 0f;
            int   end  = f + material.SurfaceCount;

            for (int x = f; x < end; x++)
            {
                Vector3 v1 = mesh.Vertices[bsp.ScenarioStructureBspValues.Surfaces[x].Tria].position;
                Vector3 v2 = mesh.Vertices[bsp.ScenarioStructureBspValues.Surfaces[x].Trib].position;
                Vector3 v3 = mesh.Vertices[bsp.ScenarioStructureBspValues.Surfaces[x].Tric].position;

                area += ComputeTriangleArea((v2 - v1).Length(), (v3 - v2).Length(), (v1 - v3).Length());
            }
            return(area);
        }
示例#2
0
 public static RadiosityMaterial ToMaterial(this scenario_structure_bsp.StructureBspMaterialBlock block)
 {
     return(new RadiosityMaterial
     {
         AmbientLight = new RealColor(block.AmbientColor),
         DistantLight1Color = new RealColor(block.DistantLight0Color),
         DistantLight1Direction = block.DistantLight0Direction.ToVector(),
         DistantLight2Color = new RealColor(block.DistantLight1Color),
         DistantLight2Direction = block.DistantLight1Direction.ToVector(),
         DistantLightCount = block.DistantLightCount,
         ReflectionTint = new RealColor(block.ReflectionTint),
         ShadowColor = new RealColor(block.ShadowColor),
         ShadowVector = block.ShadowVector.ToVector()
     });
 }