Exemplo n.º 1
0
 public MeshCreatorModifier(string varName, TgcMeshCreator creator)
     : base(varName)
 {
     control = new MeshCreatorControl(creator);
     contentPanel.Controls.Add(control);
 }
Exemplo n.º 2
0
        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");
        }
 public MeshCreatorModifier(string varName, TgcMeshCreator creator)
     : base(varName)
 {
     control = new MeshCreatorControl(creator);
     contentPanel.Controls.Add(control);
 }