Exemplo n.º 1
0
        // This makes new vertices as well as floor and ceiling surfaces
        internal void CreateSurfaces()
        {
            if (updateneeded)
            {
                // Floor color
                int color = CalculateBrightness(floorshade);

                // Make floor vertices
                floorvertices = new FlatVertex[triangles.Vertices.Count];
                for (int i = 0; i < triangles.Vertices.Count; i++)
                {
                    floorvertices[i].x = triangles.Vertices[i].x;
                    floorvertices[i].y = triangles.Vertices[i].y;
                    floorvertices[i].z = 1.0f;
                    floorvertices[i].c = color;
                }

                // Create bounding box
                bbox = CreateBBox();

                // Make update info (this lets the plugin fill in texture coordinates and such)
                SurfaceUpdate updateinfo = new SurfaceUpdate(floorvertices.Length, true, true);

                General.Plugins.OnSectorFloorSurfaceUpdate(this, ref floorvertices);
                floorvertices.CopyTo(updateinfo.FloorVertices, 0);

                // Ceiling color
                color = CalculateBrightness(ceilingshade);

                // Make ceiling vertices
                ceilingvertices = new FlatVertex[triangles.Vertices.Count];
                for (int i = 0; i < triangles.Vertices.Count; i++)
                {
                    ceilingvertices[i].x = triangles.Vertices[i].x;
                    ceilingvertices[i].y = triangles.Vertices[i].y;
                    ceilingvertices[i].z = 1.0f;
                    ceilingvertices[i].c = color;
                }

                General.Plugins.OnSectorCeilingSurfaceUpdate(this, ref ceilingvertices);
                ceilingvertices.CopyTo(updateinfo.CeilingVertices, 0);

                updateinfo.FloorTileIndex   = floortileindex;
                updateinfo.CeilingTileIndex = ceilingtileindex;

                // Update surfaces
                General.Map.CRenderer2D.Surfaces.UpdateSurfaces(surfaceentries, updateinfo);

                // Updated
                updateneeded = false;
            }
        }
Exemplo n.º 2
0
        // This updates the ceiling surface
        public void UpdateCeilingSurface()
        {
            if (flatvertices == null)
            {
                return;
            }

            // Create ceiling vertices
            SurfaceUpdate updateinfo = new SurfaceUpdate(flatvertices.Length, false, true);

            flatvertices.CopyTo(updateinfo.ceilvertices, 0);
            General.Plugins.OnSectorCeilingSurfaceUpdate(this, ref updateinfo.ceilvertices);
            updateinfo.ceiltexture = longceiltexname;

            // Update entry
            General.Map.CRenderer2D.Surfaces.UpdateSurfaces(surfaceentries, updateinfo);
            General.Map.CRenderer2D.Surfaces.UnlockBuffers();
        }
Exemplo n.º 3
0
        // This updates the ceiling surface
        public void UpdateCeilingSurface()
        {
            if (floorvertices == null)
            {
                return;
            }

            // Create ceiling vertices
            SurfaceUpdate updateinfo = new SurfaceUpdate(floorvertices.Length, false, true);

            General.Plugins.OnSectorCeilingSurfaceUpdate(this, ref ceilingvertices);
            ceilingvertices.CopyTo(updateinfo.CeilingVertices, 0);
            updateinfo.CeilingTileIndex = ceilingtileindex;

            // Update entry
            General.Map.CRenderer2D.Surfaces.UpdateSurfaces(surfaceentries, updateinfo);
            General.Map.CRenderer2D.Surfaces.UnlockBuffers();
        }
Exemplo n.º 4
0
        // This updates the floor surface
        public void UpdateFloorSurface()
        {
            if (floorvertices == null)
            {
                return;
            }

            // Create floor vertices
            SurfaceUpdate updateinfo = new SurfaceUpdate(floorvertices.Length, true, false);

            General.Plugins.OnSectorFloorSurfaceUpdate(this, ref floorvertices);
            floorvertices.CopyTo(updateinfo.FloorVertices, 0);
            updateinfo.FloorTileIndex = floortileindex;

            // Update entry
            General.Map.CRenderer2D.Surfaces.UpdateSurfaces(surfaceentries, updateinfo);
            General.Map.CRenderer2D.Surfaces.UnlockBuffers();
        }
Exemplo n.º 5
0
        // This makes new vertices as well as floor and ceiling surfaces
        internal void CreateSurfaces()
        {
            if (updateneeded)
            {
                // Brightness color
                int brightint = General.Map.Renderer2D.CalculateBrightness(brightness);

                // Make vertices
                flatvertices = new FlatVertex[triangles.Vertices.Count];
                for (int i = 0; i < triangles.Vertices.Count; i++)
                {
                    flatvertices[i].x = triangles.Vertices[i].x;
                    flatvertices[i].y = triangles.Vertices[i].y;
                    flatvertices[i].z = 1.0f;
                    flatvertices[i].c = brightint;
                    flatvertices[i].u = flatvertices[i].x;
                    flatvertices[i].v = flatvertices[i].y;
                }

                // Create bounding box
                bbox = CreateBBox();

                // Make update info (this lets the plugin fill in texture coordinates and such)
                SurfaceUpdate updateinfo = new SurfaceUpdate(flatvertices.Length, true, true);
                flatvertices.CopyTo(updateinfo.floorvertices, 0);
                General.Plugins.OnSectorFloorSurfaceUpdate(this, ref updateinfo.floorvertices);
                flatvertices.CopyTo(updateinfo.ceilvertices, 0);
                General.Plugins.OnSectorCeilingSurfaceUpdate(this, ref updateinfo.ceilvertices);
                updateinfo.floortexture = longfloortexname;
                updateinfo.ceiltexture  = longceiltexname;
                updateinfo.desaturation = this.Desaturation;

                // Update surfaces
                General.Map.CRenderer2D.Surfaces.UpdateSurfaces(surfaceentries, updateinfo);

                // Updated
                updateneeded = false;
            }
        }