示例#1
0
        public SceneEditorModifier AddSceneEditorModifier(TgcSceneEditor tool)
        {
            var modifier = new SceneEditorModifier(tool);

            AddModifier(modifier);
            return(modifier);
        }
示例#2
0
        public SceneEditorModifier(TgcSceneEditor editor)
        {
            InitializeComponent();

            this.editor    = editor;
            parser         = new TgcSceneParser();
            sceneLoader    = new TgcSceneLoader();
            pickingRay     = new TgcPickingRay(editor.Input);
            translateGizmo = new SceneEditorTranslateGizmo(editor.Input);
            helpWindow     = new SceneEditorHelpWindow();

            //openMeshDialog
            openMeshDialog = new OpenFileDialog();
            openMeshDialog.CheckFileExists = true;
            openMeshDialog.Title           = "Seleccionar malla de formato TGC";
            openMeshDialog.Filter          = "-TgcScene.xml |*-TgcScene.xml";
            openMeshDialog.Multiselect     = false;
            //openMeshDialog.InitialDirectory = ToolsModel.Instance.ExamplesMediaDir + "ModelosTgc\\";
            openMeshDialog.FileName = Settings.Default.MediaDirectory + "ModelosTgc\\Box\\Box-TgcScene.xml";
            fileName.Text           = "Box-TgcScene.xml";
            meshFilePath            = openMeshDialog.FileName;

            //openHeighmapDialog
            openHeighmapDialog = new OpenFileDialog();
            openHeighmapDialog.CheckFileExists  = true;
            openHeighmapDialog.Title            = "Seleccionar Heighmap";
            openHeighmapDialog.Filter           = ".JPG|*.jpg|.JPEG|*.jpeg|.GIF|*.gif|.PNG|*.png|.BMP|*.bmp | .TGA |*.tga";
            openHeighmapDialog.Multiselect      = false;
            openHeighmapDialog.InitialDirectory = Settings.Default.MediaDirectory + "Heighmaps\\";

            //openHeighmapDialog
            openTextureDialog = new OpenFileDialog();
            openTextureDialog.CheckFileExists  = true;
            openTextureDialog.Title            = "Seleccionar textura de terreno";
            openTextureDialog.Filter           = ".JPG|*.jpg|.JPEG|*.jpeg|.GIF|*.gif|.PNG|*.png|.BMP|*.bmp | .TGA |*.tga";
            openTextureDialog.Multiselect      = false;
            openTextureDialog.InitialDirectory = Settings.Default.MediaDirectory + "Heighmaps\\";

            //saveSceneDialog
            saveSceneDialog              = new SaveFileDialog();
            saveSceneDialog.DefaultExt   = ".xml";
            saveSceneDialog.Filter       = ".XML |*.xml";
            saveSceneDialog.AddExtension = true;

            SelectedMeshList = new List <SceneEditorMeshObject>();

            //Estado inicial
            currentState           = GuiState.Nothing;
            tabControl.SelectedTab = tabControl.TabPages["tabPageCreate"];

            //Camaras
            var pos      = new TGCVector3(50.406f, 185.5353f, -143.7283f);
            var lookAt   = new TGCVector3(-92.5515f, -567.6361f, 498.3744f);
            var upVector = TGCVector3.Up;

            BasicCamera = new TgcCamera();
            BasicCamera.SetCamera(pos, lookAt, upVector);

            FPSCamera = new TgcFpsCamera(editor.Input);
            FPSCamera.SetCamera(pos, lookAt, upVector);

            editor.Camera = FPSCamera;
        }