Пример #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();
 }
Пример #2
0
        int rotation = 0; // model rotation for 3d demonstration

        public Form1()
        {
            /* dot/comma selection for floating point numbers */
            Thread.CurrentThread.CurrentCulture   = new CultureInfo("en-US");
            Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US");

            InitializeComponent();

            glController = new Batu_GL();
            glController.initialize(monitor);
            glController.glInit(monitor, Batu_GL.Ortho_Mode.CENTER);
        }
Пример #3
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.Crimson;
            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_Monitor, Batu_GL.Ortho_Mode.CENTER);
                GL_Monitor.SwapBuffers();
            }
        }
Пример #4
0
        private void GL_Monitor_Paint(object sender, PaintEventArgs e)
        {
            if (!monitorLoaded)
            {
                return;
            }

            Batu_GL.Configure(GL_Monitor, 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_Monitor.SwapBuffers();
        }
Пример #5
0
 private void Form1_Load(object sender, EventArgs e)
 {
     Batu_GL.Configure(GL_Monitor, Batu_GL.Ortho_Mode.CENTER);
 }