Example #1
0
 /// <summary>
 /// Остановка рендеринга
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Btn_render_stop_Click(object sender, EventArgs e)
 {
     modelVAO = null;
     /* if there is an error, deinitialize the gl monitor to clear the screen */
     Batu_GL.Configure(GL_Monitor1, Batu_GL.Ortho_Mode.CENTER);
     GL_Monitor1.SwapBuffers();
 }
Example #2
0
 private void DrawTimer_Tick(object sender, EventArgs e)
 {
     orb.UpdateOrbiter(MousePosition.X, MousePosition.Y);
     GL_Monitor1.Invalidate();
     if (moveForm)
     {
         this.SetDesktopLocation(MousePosition.X - moveOffsetX, MousePosition.Y - moveOffsetY);
     }
 }
Example #3
0
        private void button4_Click(object sender, EventArgs e)
        {
            //string aaa = @"e:\123\AppMag\App\bin\Debug\0a72a763-9f46-4db0-954f-20e2a9cd4c87out3.stl";
            string      aaa = lastname_fullpath;
            AppMainForm aa  = new AppMainForm(aaa);

            aa.ShowDialog();
            GL_Monitor1.MakeCurrent();
            GL.Flush();
            GL_Monitor1.SwapBuffers();
            //ResultView2 resultView2 = new ResultView2(aaa);
            //resultView2.Show();
        }
Example #4
0
        private void ReadSelectedFile(string fileName)
        {
            STLReader stlReader = new STLReader(fileName);

            TriangleMesh[] meshArray = stlReader.ReadFile();
            modelVAO = new Batu_GL.VAO_TRIANGLES();
            modelVAO.parameterArray = STLExport.Get_Mesh_Vertices(meshArray);
            modelVAO.normalArray    = STLExport.Get_Mesh_Normals(meshArray);
            modelVAO.color          = Color.Beige;
            minPos = stlReader.GetMinMeshPosition(meshArray);
            maxPos = stlReader.GetMaxMeshPosition(meshArray);
            orb.Reset_Orientation();
            orb.Reset_Pan();
            orb.Reset_Scale();
            if (stlReader.Get_Process_Error())
            {
                modelVAO = null;
                /* if there is an error, deinitialize the gl monitor to clear the screen */
                Batu_GL.Configure(GL_Monitor1, Batu_GL.Ortho_Mode.CENTER);
                GL_Monitor1.SwapBuffers();
            }
        }
Example #5
0
        private void GL_Monitor_Paint(object sender, PaintEventArgs e)
        {
            if (!monitorLoaded)
            {
                return;
            }

            Batu_GL.Configure(GL_Monitor1, Batu_GL.Ortho_Mode.CENTER);
            if (modelVAO != null)
            {
                ConfigureBasicLighting(modelVAO.color);
            }
            GL.Translate(orb.PanX, orb.PanY, 0);
            GL.Rotate(orb.orbitStr.angle, orb.orbitStr.ox, orb.orbitStr.oy, orb.orbitStr.oz);
            GL.Scale(orb.scaleVal, orb.scaleVal, orb.scaleVal);
            GL.Translate(-minPos.x, -minPos.y, -minPos.z);
            GL.Translate(-(maxPos.x - minPos.x) / 2.0f, -(maxPos.y - minPos.y) / 2.0f, -(maxPos.z - minPos.z) / 2.0f);
            if (modelVAO != null)
            {
                modelVAO.Draw();
            }

            GL_Monitor1.SwapBuffers();
        }