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(); } }
// ------ 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); }
public override void Draw(BxCmUiParam param) { DrawVtf(); base.Draw(param); GL.BindTexture(TextureTarget.Texture2D, 0); }
// ------------------------------------------------------- public void BeginBenchmark(BxCmUiParam param) { if (param.BenchmarkStarted == false) { return; } GL.GenQueries(1, out fBenchmarkID); GL.BeginQuery(QueryTarget.TimeElapsed, fBenchmarkID); }
public void Init(BxCmUiParam param) { if (fGLControl != null) { fProgContainer = NewProgContainer(); fObjGlMain = new BxGlMain(fGLControl, fProgContainer); fObjGlMain.Draw(param); } }
public void ChangeShader(BxCmUiParam param) { if (param.IsWire) { ChangeShaderMain_Wire(param); } else { ChangeShaderMain(param); } }
protected override void DrawMain(BxCmUiParam param) { if (fShade != null) { fShade.Draw(param); } if (fWire != null) { fWire.Draw(param); } }
virtual public void Draw(BxCmUiParam param) { GL.UseProgram(fProgramObj.ShaderProgramID()); TessLevel = param.NumTess; SetTessLevel(); SetProject(); SetView(0.0); SetLight(); DrawMain(param); }
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; } }
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); }
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); }
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); } }
// ------ 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); }
// ------------------------------------------------------- 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); } }
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; }
protected void EndBenchmark(BxCmUiParam param) { Parent.EndBenchmark(param); }
// ------------------------------------------------------- protected void BeginBenchmark(BxCmUiParam param) { Parent.BeginBenchmark(param); }
protected override void GenBufMain(BxCmUiParam param) { GenBufInner(param); }
public void GenBuf(BxCmUiParam param) { GenBufMain(param); }
abstract protected void DrawMain(BxCmUiParam param);
public void GenBuf(BxCmUiParam param) { fObjGlMain.GenBuf(param); }
public void ChangeShader(BxCmUiParam param) { fObjGlMain.ChangeShader(param); }
public void Draw(BxCmUiParam param) { fObjGlMain.Draw(param); }
abstract protected void ChangeShaderMain_Wire(BxCmUiParam param);
abstract protected void GenBufMain(BxCmUiParam param);
abstract protected void SetModelData(BxCmUiParam param);
protected override void SetModelData(BxCmUiParam param) { GenBufInner(param); }