Esempio n. 1
0
        /// <summary>
        ///     Fragmenta una pared en varias subparedes, en base a todas las colisiones que hubo con cuartos vecinos
        /// </summary>
        private List <Point> fragmentWall(RoomsEditorWall wall, Point wallSegment, List <Point> intersectingLines,
                                          List <RoomsEditorRoom> intersectingRooms)
        {
            List <Point> finalWallSegments;

            wall.IntersectingRooms.Clear();

            //Hubo intersecciones, fragmentar
            if (intersectingRooms.Count > 0)
            {
                //Agregar rooms vecinos
                wall.IntersectingRooms.AddRange(intersectingRooms);

                //Calcular intersecciones con vecinos en esta pared que hay que quitar de la pared original
                var segmentsToExtract = new List <Point>();
                foreach (var lineSegment in intersectingLines)
                {
                    segmentsToExtract.Add(intersectLineSegments(lineSegment, wallSegment));
                }
                //Quitarle al segmento original los fragmentos
                finalWallSegments = removeSegmentsFromLine(wallSegment, segmentsToExtract);
            }
            //no fragmentar
            else
            {
                finalWallSegments = new List <Point>();
                finalWallSegments.Add(wallSegment);
            }

            return(finalWallSegments);
        }
Esempio n. 2
0
 /// <summary>
 ///     Actualiza datos de la UI en base a una pared
 /// </summary>
 private void updateUiData(RoomsEditorWall wall, PictureBox image, CheckBox autoUv, NumericUpDown uTile, NumericUpDown vTile)
 {
     image.ImageLocation = wall.Texture.FilePath;
     autoUv.Checked      = wall.AutoAdjustUv;
     uTile.Value         = (decimal)wall.UTile;
     vTile.Value         = (decimal)wall.VTile;
 }
Esempio n. 3
0
 /// <summary>
 ///     Actualizar datos de una pared
 /// </summary>
 private void updateWallData(RoomsEditorWall wall, PictureBox image, CheckBox autoUv, NumericUpDown uTile, NumericUpDown vTile)
 {
     if (wall.Texture != null)
     {
         wall.Texture.dispose();
     }
     wall.Texture      = TgcTexture.createTexture(D3DDevice.Instance.Device, image.ImageLocation);
     wall.AutoAdjustUv = autoUv.Checked;
     wall.UTile        = (float)uTile.Value;
     wall.VTile        = (float)vTile.Value;
 }
Esempio n. 4
0
        public RoomsEditorRoom(string name, RoomsEditorMapView.RoomPanel roomPanel)
        {
            Name      = name;
            RoomPanel = roomPanel;

            RoomPanel.Room = this;

            //crear paredes
            Walls    = new RoomsEditorWall[6];
            Walls[0] = new RoomsEditorWall(this, "Roof", RoomsEditorWall.Types.Roof);
            Walls[1] = new RoomsEditorWall(this, "Floor", RoomsEditorWall.Types.Floor);
            Walls[2] = new RoomsEditorWall(this, "East", RoomsEditorWall.Types.East);
            Walls[3] = new RoomsEditorWall(this, "West", RoomsEditorWall.Types.West);
            Walls[4] = new RoomsEditorWall(this, "North", RoomsEditorWall.Types.North);
            Walls[5] = new RoomsEditorWall(this, "South", RoomsEditorWall.Types.South);

            //Valores default
            Height     = 100;
            FloorLevel = 0;
        }
Esempio n. 5
0
        /// <summary>
        ///     Crear paredes 3D para las diferencias de altura entre la pared South de este Room y el resto
        ///     de los Rooms contra los que colisiona
        /// </summary>
        private void createSouthWallSegmentsForHeightDiff(TGCVector3 sceneScale, List <Point> intersectingLines,
                                                          List <RoomsEditorRoom> intersectingRooms, RoomsEditorWall wall)
        {
            var bounds   = RoomPanel.Label.Bounds;
            var wallSide = new Point(RoomPanel.Label.Location.X, RoomPanel.Label.Location.X + RoomPanel.Label.Width);

            Point[] supDiffSegments;
            Point[] infDiffSegments;
            findSegmentsForHeightDiff(intersectingRooms, out supDiffSegments, out infDiffSegments);
            for (var i = 0; i < intersectingRooms.Count; i++)
            {
                var fullIntersecLine = intersectingLines[i];
                var intersecLine     = intersectLineSegments(fullIntersecLine, wallSide);

                //Fragmento superior
                var supSeg = supDiffSegments[i];
                if (supSeg.X != 0 || supSeg.Y != 0)
                {
                    var wall3d = new TgcPlane(
                        new TGCVector3(intersecLine.X * sceneScale.X, supSeg.X * sceneScale.Y,
                                       (bounds.Y + bounds.Height) * sceneScale.Z),
                        new TGCVector3((intersecLine.Y - intersecLine.X) * sceneScale.X, (supSeg.Y - supSeg.X) * sceneScale.Y,
                                       0),
                        TgcPlane.Orientations.XYplane,
                        wall.Texture, wall.UTile, wall.VTile
                        );
                    wall.WallSegments.Add(wall3d);
                }

                //Fragmento inferior
                var infSeg = infDiffSegments[i];
                if (infSeg.X != 0 || infSeg.Y != 0)
                {
                    var wall3d = new TgcPlane(
                        new TGCVector3(intersecLine.X * sceneScale.X, infSeg.X * sceneScale.Y,
                                       (bounds.Y + bounds.Height) * sceneScale.Z),
                        new TGCVector3((intersecLine.Y - intersecLine.X) * sceneScale.X, (infSeg.Y - infSeg.X) * sceneScale.Y,
                                       0),
                        TgcPlane.Orientations.XYplane,
                        wall.Texture, wall.UTile, wall.VTile
                        );
                    wall.WallSegments.Add(wall3d);
                }
            }
        }