Example #1
0
        public void  Draw(BxCmUiParam param)
        {
            if (fInitDrawFlag == false)
            {
                InitParams();
                fInitDrawFlag = true;
            }

            if (InitReadFlag == false)
            {
                SetModelData(param);
                InitReadFlag = true;
            }

            if (IsEmpty() == true)
            {
                ClrScreen();
                GLControl().SwapBuffers();
            }
            else
            {
                ClrScreen();
                DrawMain(param);
                GLControl().SwapBuffers();
            }
        }
Example #2
0
        // ------

        public override void  GenBuf(BxCmSeparatePatch_Object patch, BxCmUiParam param)
        {
            fNumSurface = patch.NumSurface;
            TessLevel   = param.NumTess;

            SetVertexBuffer(patch);
            SetIndexBuffer(patch);
            SetVAO();

            Vector3?min = null;
            Vector3?max = null;

            if (param.Min != null)
            {
                min = new Vector3(( float )param.Min.X, ( float )param.Min.Y, ( float )param.Min.Z);
            }
            if (param.Max != null)
            {
                max = new Vector3(( float )param.Max.X, ( float )param.Max.Y, ( float )param.Max.Z);
            }

            if (min != null && max != null)
            {
                Parent.SetObjSize(( Vector3 )min, ( Vector3 )max);
            }

            InitVtf(patch);
        }
Example #3
0
        public override void  Draw(BxCmUiParam param)
        {
            DrawVtf();

            base.Draw(param);

            GL.BindTexture(TextureTarget.Texture2D, 0);
        }
Example #4
0
        // -------------------------------------------------------

        public void  BeginBenchmark(BxCmUiParam param)
        {
            if (param.BenchmarkStarted == false)
            {
                return;
            }

            GL.GenQueries(1, out fBenchmarkID);
            GL.BeginQuery(QueryTarget.TimeElapsed, fBenchmarkID);
        }
Example #5
0
        public void  Init(BxCmUiParam param)
        {
            if (fGLControl != null)
            {
                fProgContainer = NewProgContainer();
                fObjGlMain     = new BxGlMain(fGLControl, fProgContainer);

                fObjGlMain.Draw(param);
            }
        }
Example #6
0
 public void  ChangeShader(BxCmUiParam param)
 {
     if (param.IsWire)
     {
         ChangeShaderMain_Wire(param);
     }
     else
     {
         ChangeShaderMain(param);
     }
 }
Example #7
0
        protected override void  DrawMain(BxCmUiParam param)
        {
            if (fShade != null)
            {
                fShade.Draw(param);
            }

            if (fWire != null)
            {
                fWire.Draw(param);
            }
        }
Example #8
0
        virtual public void  Draw(BxCmUiParam param)
        {
            GL.UseProgram(fProgramObj.ShaderProgramID());

            TessLevel = param.NumTess;

            SetTessLevel();
            SetProject();

            SetView(0.0);
            SetLight();

            DrawMain(param);
        }
Example #9
0
        protected override void  ChangeShaderMain_Wire(BxCmUiParam param)
        {
            switch (param.ShaderMode)
            {
            case BxCmUiParam.EnumShaderMode.KShaderMode_Vbo1:
                ChangeShaderVbo1_Wire();
                break;

            default:
                Debug.Assert(param.ShaderMode == BxCmUiParam.EnumShaderMode.KShaderMode_GL3);
                ChangeShaderGL3_Wire();
                break;
            }
        }
Example #10
0
        virtual protected void  DrawMain(BxCmUiParam param)
        {
            SetFaceColor();

            PatchParameter();

            GL.BindVertexArray(Buf.VaoHandle[0]);
            BeginBenchmark(param);

            GL.DrawArrays(PrimitiveType.Patches, 0, Buf.NumVertices);

            EndBenchmark(param);
            GL.BindVertexArray(0);
        }
Example #11
0
        public string  ExecBenchmark(BxCmUiParam param)
        {
            param.BenchmarkStarted = true;
            param.ElapsedTime      = 0;

            DrawMain(param);

            param.BenchmarkStarted = false;
            string fps = GetFPS(param.ElapsedTime);

            param.ElapsedTime = 0;

            return(fps);
        }
Example #12
0
        virtual public void  GenBuf(BxCmSeparatePatch_Object patch, BxCmUiParam param)
        {
            TessLevel = param.NumTess;

            SetVertexBuffer(patch);
            SetVAO();

            if (param.Min != null && param.Max != null)
            {
                Vector3 min = new Vector3(( float )param.Min.X, ( float )param.Min.Y, ( float )param.Min.Z);
                Vector3 max = new Vector3(( float )param.Max.X, ( float )param.Max.Y, ( float )param.Max.Z);

                Parent.SetObjSize(min, max);
            }
        }
Example #13
0
        // ------

        protected override void  DrawMain(BxCmUiParam param)
        {
            SetUniformForTexture();
            SetFaceColor();

            GL.BindVertexArray(Buf.VaoHandle[0]);
            GL.BindBuffer(BufferTarget.ElementArrayBuffer, Buf.EboID[0]);
            BeginBenchmark(param);

            DrawMain_NonPreDiv();
            DrawMain_PreDiv();

            EndBenchmark(param);
            GL.BindVertexArray(0);
        }
Example #14
0
        // -------------------------------------------------------

        private void  GenBufInner(BxCmUiParam param)
        {
            if (fPatch == null)
            {
                return;
            }

            BxCmSeparatePatch_Object correctPatch;

            CorrectProc(fPatch, out correctPatch);

            if (fShade != null)
            {
                fShade.GenBuf(correctPatch, param);
            }

            if (fWire != null)
            {
                fWire.GenBuf(correctPatch, param);
            }
        }
Example #15
0
        public void  EndBenchmark(BxCmUiParam param)
        {
            if (param.BenchmarkStarted == false)
            {
                return;
            }

            GL.EndQuery(QueryTarget.TimeElapsed);

            int done = 0;

            while (done == 0)
            {
                GL.GetQueryObject(fBenchmarkID, GetQueryObjectParam.QueryResultAvailable, out done);
            }

            long elapsedTime;

            GL.GetQueryObject(fBenchmarkID, GetQueryObjectParam.QueryResult, out elapsedTime);
            GL.DeleteQueries(1, ref fBenchmarkID);

            param.ElapsedTime = elapsedTime;
        }
Example #16
0
 protected void  EndBenchmark(BxCmUiParam param)
 {
     Parent.EndBenchmark(param);
 }
Example #17
0
        // -------------------------------------------------------

        protected void  BeginBenchmark(BxCmUiParam param)
        {
            Parent.BeginBenchmark(param);
        }
Example #18
0
 protected override void  GenBufMain(BxCmUiParam param)
 {
     GenBufInner(param);
 }
Example #19
0
 public void  GenBuf(BxCmUiParam param)
 {
     GenBufMain(param);
 }
Example #20
0
 abstract protected void   DrawMain(BxCmUiParam param);
Example #21
0
 public void  GenBuf(BxCmUiParam param)
 {
     fObjGlMain.GenBuf(param);
 }
Example #22
0
 public void  ChangeShader(BxCmUiParam param)
 {
     fObjGlMain.ChangeShader(param);
 }
Example #23
0
 public void  Draw(BxCmUiParam param)
 {
     fObjGlMain.Draw(param);
 }
Example #24
0
 abstract protected void   ChangeShaderMain_Wire(BxCmUiParam param);
Example #25
0
 abstract protected void   GenBufMain(BxCmUiParam param);
Example #26
0
 abstract protected void   SetModelData(BxCmUiParam param);
Example #27
0
 protected override void  SetModelData(BxCmUiParam param)
 {
     GenBufInner(param);
 }