Ejemplo n.º 1
0
        private void InitGL()
        {
            if (glview == null)
            {
                previewType        = PreviewGeometryType.Cube;
                previewCameraMode  = PreviewCameraMode.Perspective;
                previewPosition    = PreviewCameraPosition.Perspective;
                glview             = new OpenTK.GLControl(GraphicsMode.Default);
                glview.Load       += Glview_Load;
                glview.Paint      += Glview_Paint;
                glview.MouseWheel += Glview_MouseWheel;
                glview.MouseMove  += Glview_MouseMove;
                glview.MouseDown  += Glview_MouseDown;

                FHost.Child   = glview;
                previewObject = new Transform();

                camera = new Camera();
                camera.LocalEulerAngles = new Vector3(25, 45, 0);
                camera.LocalPosition    = new Vector3(0, 0, 3);
                camera.OnCameraChanged += Camera_OnCameraChanged;

                light = new Light();
                light.LocalPosition = new Vector3(0, 2, 2);
                light.Color         = new Vector3(1, 1, 1);
                light.LocalScale    = new Vector3(0.01f, 0.01f, 0.01f);
            }
        }
Ejemplo n.º 2
0
        private void PreviewType_Click(object sender, RoutedEventArgs e)
        {
            MenuItem s = sender as MenuItem;

            PreviewGeometryType gtype;

            Enum.TryParse <PreviewGeometryType>(s.Header.ToString().Replace("_", "").Replace(" ", ""), out gtype);

            var pane = UIPreviewPane.Instance;

            if (pane != null)
            {
                switch (gtype)
                {
                case PreviewGeometryType.Cube:
                    pane.SetMesh(cube);
                    break;

                case PreviewGeometryType.Cylinder:
                    pane.SetMesh(cylinder);
                    break;

                case PreviewGeometryType.Plane:
                    pane.SetMesh(plane);
                    break;

                case PreviewGeometryType.RoundedCube:
                    pane.SetMesh(cubeRounded);
                    break;

                case PreviewGeometryType.Sphere:
                    pane.SetMesh(sphere);
                    break;

                case PreviewGeometryType.Custom:
                    ShowCustomMeshDialog();
                    pane.SetMesh(custom);
                    break;
                }
            }

            previewType = gtype;

            Invalidate();
        }
Ejemplo n.º 3
0
        private void InitGL()
        {
            if (glview == null)
            {
                previewType       = PreviewGeometryType.Cube;
                previewCameraMode = PreviewCameraMode.Perspective;
                previewPosition   = PreviewCameraPosition.Perspective;

                glview                  = new GLControl(GraphicsMode.Default);
                glview.Load            += Glview_Load;
                glview.Paint           += Glview_Paint;
                glview.MouseWheel      += Glview_MouseWheel;
                glview.MouseMove       += Glview_MouseMove;
                glview.MouseDown       += Glview_MouseDown;
                FHost.Child             = glview;
                previewObject           = new Transform();
                camera                  = new Camera();
                camera.LocalEulerAngles = new Vector3(25, 45, 0);
                camera.LocalPosition    = new Vector3(0, 0, 3);
            }
        }
Ejemplo n.º 4
0
        private void InitGL()
        {
            if (glview == null)
            {
                previewType       = PreviewGeometryType.Cube;
                previewCameraMode = PreviewCameraMode.Perspective;
                previewPosition   = PreviewCameraPosition.Front;

                glview             = new TK.GLControl(new GraphicsMode(new ColorFormat(8, 8, 8, 8), 24));
                glview.Load       += Glview_Load;
                glview.Paint      += Glview_Paint;
                glview.MouseWheel += Glview_MouseWheel;
                glview.MouseMove  += Glview_MouseMove;
                glview.MouseDown  += Glview_MouseDown;
                FHost.Child        = glview;
                rotX              = 25;
                rotY              = 45;
                rotation          = Quaternion.FromEulerAngles(rotX * ((float)Math.PI / 180.0f), rotY * ((float)Math.PI / 180.0f), 0);
                cameraTranslation = new Vector3(0, 0, 3);
                objectTranslation = new Vector3(0, 0, 0);
            }
        }