Example #1
0
        /// <summary>
        /// Event Methode, die aufgerufen wird, wenn der Menüpunkt "File -> Open..."
        /// betätigt wird.
        /// </summary>
        /// <param name="sender">
        /// Der Sender des Events.
        /// </param>
        /// <param name="e">
        /// Die Event Parameter.
        /// </param>
        void OnClickMenuOpen(object sender, EventArgs e)
        {
            if (openFileDialog.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            try {
                var mesh = ObjIO.Load(openFileDialog.FileName);
                var test = new PM(viewport3d, mesh);

                SetRenderObject(test);
            } catch (Exception ex) {
                MessageBox.Show(ex.Message, "Fehler beim Einlesen der Mesh",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #2
0
        /// <summary>
        /// Event Methode, die aufgerufen wird, wenn das Fenster fertig initialisiert
        /// wurde.
        /// </summary>
        /// <param name="sender">
        /// Der Sender des Events.
        /// </param>
        /// <param name="e">
        /// Die Event Parameter.
        /// </param>
        void OnLoad(object sender, EventArgs e)
        {
            var testMesh = ObjIO.Load("Testdata/pm-cow.obj");

            // 1. PM aus testMesh erstellen.
            var test = new PM(viewport3d, testMesh);

            test.Scale    = 0.15f;
            test.Position = new Vector3(test.Position.X, test.Position.Y - .5f, test.Position.Z);

            SetRenderObject(test);

            viewport3d.PointLight.Ambient     = new Color4(0.34f, 0.34f, 0.34f);
            viewport3d.PointLight.Diffuse     = Color.Gray;
            viewport3d.PointLight.Attenuation = new Vector3(0.5f, 0.1f, 0.0f);
            viewport3d.PointLight.Range       = 7.03f;
        }