public RoomsEditorTexturesEdit(RoomsEditorMapView mapView)
        {
            InitializeComponent();

            this.mapView = mapView;
            textureBrowser = new TgcTextureBrowser();
            textureBrowser.CurrentDir = mapView.defaultTextureDir;

            //Cargar imagenes default
            string defaultTextureImage = mapView.defaultTextureImage;
            roofImage.ImageLocation = defaultTextureImage;
            floorImage.ImageLocation = defaultTextureImage;
            eastWallImage.ImageLocation = defaultTextureImage;
            westWallImage.ImageLocation = defaultTextureImage;
            northWallImage.ImageLocation = defaultTextureImage;
            southWallImage.ImageLocation = defaultTextureImage;
        }
        public TerrainEditorControl(TgcTerrainEditor terrainEditor)
        {
            // TODO: Complete member initialization
            this.terrainEditor = terrainEditor;

            InitializeComponent();
            //Tab General
            createHeightmapBrowser();

            pictureBoxModifyHeightmap.ImageLocation = heightmapBrowser.SelectedImage;

            textureBrowser = new TgcTextureBrowser();
            textureBrowser.ShowFolders = true;
            textureBrowser.setSelectedImage(GuiController.Instance.ExamplesMediaDir + "Heighmaps\\" + "TerrainTexture1-256x256.jpg");
            pictureBoxModifyTexture.ImageLocation = textureBrowser.SelectedImage;
            terrainEditor.Terrain.loadHeightmap(heightmapBrowser.SelectedImage, (float)nudScaleXZ.Value, (float)nudScaleY.Value, new Microsoft.DirectX.Vector3(0, 0, 0));
            terrainEditor.Terrain.loadTexture(textureBrowser.SelectedImage);
            
            shovel = new Shovel();
            vegetationBrush = new VegetationBrush();
            steamroller = new Steamroller();
            vegetationPicker = new VegetationPicker();

            //Tooltips
            toolTip1.SetToolTip(rbShovel, "Pala.\nAumenta la altura del terreno.\nShovel sound by adough1@freesound");
            toolTip1.SetToolTip(rbSteamroller, "Aplanadora.\nNivela el terreno\nSteamroller stock image by presterjohn1@deviantArt");
            toolTip1.SetToolTip(tbRadius, "Regula el tamaño del pincel");
            toolTip1.SetToolTip(tbIntensity, "Regula la intesidad del efecto del pincel");
            toolTip1.SetToolTip(tbHardness, "Regula el tamaño del radio interno.\nA medida que los vertices se alejan del radio interno, la intensidad disminuye.");
            toolTip1.SetToolTip(cbRounded, "Cuando se deselecciona, el pincel es cuadrado");
            toolTip1.SetToolTip(cbInvert, "Invierte el efecto del pincel.\n(La pala hunde, la aplanadora aumenta los desniveles)");
            toolTip1.SetToolTip(bChangeFolder, "La carpeta seleccionada debe contener carpetas con\nel mismo nombre que el -TgcScene.xml que llevan dentro.");
            
            //Camera
            terrainEditor.Camera.MovementSpeed = tbCameraMovementSpeed.Value;
            terrainEditor.Camera.JumpSpeed = tbCameraJumpSpeed.Value;
        

            //Info
            setInfo();
            folderBrowserDialog1.SelectedPath = InstancesManager.Location;

            //Vegetation
            fillVegetationList(InstancesManager.Location);
        }
            public ImageControl(string imageFile, TgcTextureBrowser textureBrowser, bool isDirectory)
            {
                this.filePath       = imageFile;
                this.textureBrowser = textureBrowser;
                this.isDirectory    = isDirectory;

                this.BorderStyle   = BorderStyle.FixedSingle;
                this.BackColor     = Color.White;
                this.AutoSize      = true;
                this.FlowDirection = FlowDirection.TopDown;
                this.Click        += new EventHandler(ImageControl_Click);

                pictureBox = new PictureBox();

                pictureBox.SizeMode     = PictureBoxSizeMode.Zoom;
                pictureBox.Click       += new EventHandler(pictureBox_Click);
                pictureBox.DoubleClick += new EventHandler(pictureBox_DoubleClick);
                //cargar imagen default para directorios
                if (this.isDirectory)
                {
                    pictureBox.Size  = new Size(100, 100);
                    pictureBox.Image = textureBrowser.pictureBoxDirIcon.Image;
                }
                //cargar imagen de archivo
                else
                {
                    pictureBox.Size  = new Size(200, 200);
                    pictureBox.Image = Image.FromFile(imageFile);
                }
                this.Controls.Add(pictureBox);

                filenameLabel          = new Label();
                filenameLabel.AutoSize = false;
                filenameLabel.Size     = new Size(pictureBox.Width, 20);
                if (isDirectory)
                {
                    filenameLabel.Font = new Font(FontFamily.GenericSansSerif, 8, FontStyle.Bold);
                }
                string[] pathArray = imageFile.Split('\\');
                filenameLabel.Text      = pathArray[pathArray.Length - 1];
                filenameLabel.Click    += new EventHandler(filenameLabel_Click);
                filenameLabel.TextAlign = ContentAlignment.MiddleCenter;
                this.Controls.Add(filenameLabel);
            }
        public MeshCreatorControl(TgcMeshCreator creator)
        {
            InitializeComponent();

            this.creator = creator;
            this.meshes = new List<EditorPrimitive>();
            this.selectionList = new List<EditorPrimitive>();
            this.pickingRay = new TgcPickingRay();
            this.grid = new Grid(this);
            this.selectionRectangle = new SelectionRectangle(this);
            creatingPrimitive = null;
            primitiveNameCounter = 0;
            currentGizmo = null;
            mediaPath = GuiController.Instance.ExamplesMediaDir + "MeshCreator\\";
            defaultTexturePath = mediaPath + "Textures\\Madera\\cajaMadera1.jpg";
            checkBoxShowObjectsBoundingBox.Checked = true;
            popupOpened = false;
            fpsCameraEnabled = false;
            lastSavePath = null;

            //meshBrowser
            //defaultMeshPath = mediaPath + "Meshes\\Vegetacion\\Arbusto\\Arbusto-TgcScene.xml";
            defaultMeshPath = mediaPath + "\\Meshes\\Vegetacion";
            meshBrowser = new TgcMeshBrowser();
            meshBrowser.setSelectedMesh(defaultMeshPath);

            //Export scene dialog
            exportSceneSaveDialog = new SaveFileDialog();
            exportSceneSaveDialog.DefaultExt = ".xml";
            exportSceneSaveDialog.Filter = ".XML |*.xml";
            exportSceneSaveDialog.AddExtension = true;
            exportSceneSaveDialog.Title = "Export scene to a -TgcScene.xml file";

            //Camara
            camera = new MeshCreatorCamera();
            camera.Enable = true;
            camera.setCamera(new Vector3(0, 0, 0), 500);
            camera.BaseRotX = -FastMath.PI / 4f;
            GuiController.Instance.CurrentCamera.Enable = false;

            //Gizmos
            translateGizmo = new TranslateGizmo(this);
            scaleGizmo = new ScaleGizmo(this);

            //Tab inicial
            tabControl.SelectedTab = tabControl.TabPages["tabPageCreate"];
            currentState = State.SelectObject;
            radioButtonSelectObject.Checked = true;

            //Tab Create
            textBoxCreateCurrentLayer.Text = "Default";

            //Tab Modify
            textureBrowser = new TgcTextureBrowser();
            textureBrowser.ShowFolders = true;
            textureBrowser.setSelectedImage(defaultTexturePath);
            textureBrowser.AsyncModeEnable = true;
            textureBrowser.OnSelectImage += new TgcTextureBrowser.SelectImageHandler(textureBrowser_OnSelectImage);
            textureBrowser.OnClose += new TgcTextureBrowser.CloseHandler(textureBrowser_OnClose);
            pictureBoxModifyTexture.ImageLocation = defaultTexturePath;
            pictureBoxModifyTexture.Image = MeshCreatorUtils.getImage(defaultTexturePath);
            updateModifyPanel();

            //ObjectPosition Text
            objectPositionText = new TgcText2d();
            objectPositionText.Align = TgcText2d.TextAlign.LEFT;
            objectPositionText.Color = Color.Yellow;
            objectPositionText.Size = new Size(500, 12);
            objectPositionText.Position = new Point(GuiController.Instance.Panel3d.Width - objectPositionText.Size.Width, GuiController.Instance.Panel3d.Height - 20);

            //Snap to grid
            snapToGridCellSize = (float)numericUpDownCellSize.Value;

            //ObjectBrowser
            objectBrowser = new ObjectBrowser(this);

            //TextureBrowser para EditablePoly
            textureBrowserEPoly = new TgcTextureBrowser();
            textureBrowserEPoly.ShowFolders = true;
            textureBrowserEPoly.setSelectedImage(defaultTexturePath);
            textureBrowserEPoly.AsyncModeEnable = true;
            textureBrowserEPoly.OnSelectImage += new TgcTextureBrowser.SelectImageHandler(textureBrowserEPoly_OnSelectImage);
            textureBrowserEPoly.OnClose += new TgcTextureBrowser.CloseHandler(textureBrowserEPoly_OnClose);

            //Tooltips
            toolTips.SetToolTip(radioButtonSelectObject, "Select object (Q)");
            toolTips.SetToolTip(buttonSelectAll, "Select all objects (CTRL + E)");
            toolTips.SetToolTip(checkBoxShowObjectsBoundingBox, "Show objects BoundingBox");
            toolTips.SetToolTip(checkBoxSnapToGrid, "Toogle snap to grid");
            toolTips.SetToolTip(numericUpDownCellSize, "Snap to grid cell size");
            toolTips.SetToolTip(buttonZoomObject, "Zoom selected object (Z)");
            toolTips.SetToolTip(buttonHideSelected, "Hide selected objects (H)");
            toolTips.SetToolTip(buttonUnhideAll, "Unhide all hidden objects");
            toolTips.SetToolTip(buttonDeleteObject, "Delete selected objects (DEL)");
            toolTips.SetToolTip(buttonCloneObject, "Clone selected objects (CTRL + V)");
            toolTips.SetToolTip(radioButtonFPSCamera, "Toogle First-person camera (C)");
            toolTips.SetToolTip(numericUpDownFPSCameraSpeed, "First-person camera speed factor");
            toolTips.SetToolTip(buttonObjectBrowser, "Open Object Browser (O)");
            toolTips.SetToolTip(buttonTopView, "Set camera in Top-view (T)");
            toolTips.SetToolTip(buttonLeftView, "Set camera in Left-view (L)");
            toolTips.SetToolTip(buttonMergeSelected, "Merge selected objects (G)");
            toolTips.SetToolTip(buttonSaveScene, "Save scene in last used path (CTRL + S)");
            toolTips.SetToolTip(buttonSaveSceneAs, "Save scene in a new path (CTRL + SHIFT + S)");
            toolTips.SetToolTip(checkBoxAttachExport, "If selected all the scene is exported as one single mesh");
            toolTips.SetToolTip(buttonHelp, "Open Help (F1)");

            toolTips.SetToolTip(radioButtonPrimitive_Box, "Create a new Box (B)");
            toolTips.SetToolTip(radioButtonPrimitive_Sphere, "Create a new Sphere");
            toolTips.SetToolTip(radioButtonPrimitive_PlaneXZ, "Create a new XZ-plane (P)");
            toolTips.SetToolTip(radioButtonPrimitive_PlaneXY, "Create a new XY-plane");
            toolTips.SetToolTip(radioButtonPrimitive_PlaneYZ, "Create a new YZ-plane");
            toolTips.SetToolTip(buttonImportMesh, "Import an existing mesh (M)");
            toolTips.SetToolTip(textBoxCreateCurrentLayer, "Default layer for new created objects");

            toolTips.SetToolTip(buttonModifyConvertToMesh, "Conver to Mesh primitive");
            toolTips.SetToolTip(radioButtonModifySelectAndMove, "Move selected objects (W)");
            toolTips.SetToolTip(radioButtonModifySelectAndRotate, "Rotate selected objects (E)");
            toolTips.SetToolTip(radioButtonModifySelectAndScale, "Scale selected objects (R)");
            toolTips.SetToolTip(pictureBoxModifyTexture, "Change primitive texture");
            toolTips.SetToolTip(buttonModifyRecomputeAABB, "Compute a new BoundingBox for the primitive");

            toolTips.SetToolTip(radioButtonEPolyPrimitiveVertex, "Vertex primitve");
            toolTips.SetToolTip(radioButtonEPolyPrimitiveEdge, "Edge primitve");
            toolTips.SetToolTip(radioButtonEPolyPrimitivePolygon, "Polygon primitve");
            toolTips.SetToolTip(radioButtonEPolySelect, "Select primitive (Q)");
            toolTips.SetToolTip(buttonEPolySelectAll, "Select all primitives (CTRL + E)");
            toolTips.SetToolTip(radioButtonEPolyTranslate, "Move selected primitives (W)");
            toolTips.SetToolTip(buttonEPolyDelete, "Delete selected primitives (DEL)");
            toolTips.SetToolTip(buttonEPolyAddTexture, "Add new texture to mesh");
            toolTips.SetToolTip(buttonEPolyDeleteTexture, "Remove current texture");
            toolTips.SetToolTip(pictureBoxEPolyTexture, "Change current texture");
        }
        /// <summary>
        /// Cuando se selecciona una imagen en el textureBrowser
        /// </summary>
        public void textureBrowser_OnSelectImage(TgcTextureBrowser textureBrowser)
        {
            if (ignoreChangeEvents) return;

            //Cambiar la textura si es distinta a la que tenia el mesh
            int n = (int)numericUpDownModifyTextureNumber.Value - 1;
            if (textureBrowser.SelectedImage != selectionList[0].getTexture(n).FilePath)
            {
                Image img = MeshCreatorUtils.getImage(textureBrowser.SelectedImage);
                Image lastImage = pictureBoxModifyTexture.Image;
                pictureBoxModifyTexture.Image = img;
                pictureBoxModifyTexture.ImageLocation = textureBrowser.SelectedImage;
                lastImage.Dispose();
                foreach (EditorPrimitive p in selectionList)
                {
                    p.setTexture(TgcTexture.createTexture(pictureBoxModifyTexture.ImageLocation), n);
                }

            }
        }
 /// <summary>
 /// Cuando se cierra el textureBrowser
 /// </summary>
 public void textureBrowser_OnClose(TgcTextureBrowser textureBrowser)
 {
     popupOpened = false;
 }
示例#7
0
            public ImageControl(string imageFile, TgcTextureBrowser textureBrowser, bool isDirectory)
            {
                this.filePath = imageFile;
                this.textureBrowser = textureBrowser;
                this.isDirectory = isDirectory;

                this.BorderStyle = BorderStyle.FixedSingle;
                this.BackColor = Color.White;
                this.AutoSize = true;
                this.FlowDirection = FlowDirection.TopDown;
                this.Click += new EventHandler(ImageControl_Click);

                pictureBox = new PictureBox();
                
                pictureBox.SizeMode = PictureBoxSizeMode.Zoom;
                pictureBox.Click += new EventHandler(pictureBox_Click);
                pictureBox.DoubleClick += new EventHandler(pictureBox_DoubleClick);
                //cargar imagen default para directorios
                if (this.isDirectory)
                {
                    pictureBox.Size = new Size(100, 100);
                    pictureBox.Image = textureBrowser.pictureBoxDirIcon.Image;
                }
                //cargar imagen de archivo
                else
                {
                    pictureBox.Size = new Size(200, 200);
                    pictureBox.Image = Image.FromFile(imageFile);
                }
                this.Controls.Add(pictureBox);

                filenameLabel = new Label();
                filenameLabel.AutoSize = false;
                filenameLabel.Size = new Size(pictureBox.Width, 20);
                if (isDirectory)
                {
                    filenameLabel.Font = new Font(FontFamily.GenericSansSerif, 8,FontStyle.Bold);
                }
                string[] pathArray = imageFile.Split('\\');
                filenameLabel.Text = pathArray[pathArray.Length - 1];
                filenameLabel.Click += new EventHandler(filenameLabel_Click);
                filenameLabel.TextAlign = ContentAlignment.MiddleCenter;
                this.Controls.Add(filenameLabel);
            }
 private void createHeightmapBrowser()
 {
     heightmapBrowser = new TgcTextureBrowser();
     heightmapBrowser.ShowFolders = true;
     heightmapBrowser.setSelectedImage(GuiController.Instance.ExamplesMediaDir + "Heighmaps\\" + "Heightmap1.jpg");
 }