public FontTexturePNGPrinter(CSharpGL.Texts.FontTexture ttfTexture)
 {
     // TODO: Complete member initialization
     this.ttfTexture = ttfTexture;
     this.font = new Font("微软雅黑", ttfTexture.FontHeight / 2);
     this.outputWidth = ttfTexture.FontHeight * 40;
 }
Beispiel #2
0
        void element_BeforeRendering(object sender, CSharpGL.Objects.RenderEventArgs e)
        {
            mat4 projectionMatrix = camera.GetProjectionMat4();

            mat4 viewMatrix = camera.GetViewMat4();

            mat4 modelMatrix = mat4.identity();

            mat4 mvp = projectionMatrix * viewMatrix * modelMatrix;

            IMVP element = sender as IMVP;

            element.SetShaderProgram(mvp);
        }
        void CallbackProc(
            CSharpGL.Enumerations.DebugSource source,
            CSharpGL.Enumerations.DebugType type,
            uint id,
            CSharpGL.Enumerations.DebugSeverity severity,
            int length,
            StringBuilder message,
            IntPtr userParam)
        {
            FormTransformFeedback thisForm = FormTransformFeedback.FromHandle(userParam) as FormTransformFeedback;

            DateTime now = DateTime.Now;

            StringBuilder builder = new StringBuilder();
            {
                builder.AppendLine(string.Format("{0:yyyy-MM-dd HH:mm:ss.ffff}:", now));
                builder.Append("source: ");
                builder.Append(source); builder.Append(", ");
                builder.Append("type: ");
                builder.Append(type); builder.Append(", ");
                builder.Append("id: ");
                builder.Append(id); builder.Append(", ");
                builder.Append("severity: ");
                builder.Append(severity); builder.Append(", ");
                builder.Append("length: ");
                builder.Append(length); builder.Append(", ");
                builder.Append("message: ");
                if (message != null)
                {
                    builder.Append(message.ToString()); builder.Append(", ");
                }
                else
                {
                    builder.Append("<null>"); builder.Append(", ");
                }
                builder.Append("userParam: ");
                builder.Append(userParam);
                builder.AppendLine();
            }

            string text = builder.ToString();

            if (!this.frmWhiteBoard.IsDisposed)
            {
                this.frmWhiteBoard.AppendText(text);
            }
        }
Beispiel #4
0
        /// <summary>
        /// Rendering a evaluator(a bezier curve or surface) and its control points.
        /// </summary>
        /// <param name="controlPoints"></param>
        /// <param name="type"></param>
        /// <param name="model"></param>
        /// <param name="shaderCodes"></param>
        /// <param name="attributeMap"></param>
        /// <param name="positionNameInIBufferable"></param>
        /// <param name="switches"></param>
        private BezierRenderer(IList<vec3> controlPoints, BezierType type, Points model, CSharpGL.ShaderCode[] shaderCodes, CSharpGL.AttributeMap attributeMap, string positionNameInIBufferable, params GLState[] switches)
            : base(model, shaderCodes, attributeMap, positionNameInIBufferable, switches)
        {
            switch (type)
            {
                case BezierType.Curve:
                    this.Evaluator = new Evaluator1DRenderer(controlPoints);//, lengths);
                    break;

                case BezierType.Surface:
                    this.Evaluator = new Evaluator2DRenderer(controlPoints);//, lengths);
                    break;

                default:
                    throw new System.NotImplementedException();
            }
        }
        protected override void DoRender(CSharpGL.RenderEventArgs arg)
        {
            mat4 projection = arg.Camera.GetProjectionMatrix();
            mat4 view = arg.Camera.GetViewMatrix();
            this.SetUniform("projectionMatrix", projection);
            this.SetUniform("viewMatrix", view);
            MarkableStruct<mat4> model = this.GetModelMatrix();
            if (this.modelTicks != model.UpdateTicks)
            {
                this.SetUniform("modelMatrix", model.Value);
                this.modelTicks = model.UpdateTicks;
            }
            if (this.pointColorRecord.IsMarked())
            {
                this.SetUniform("PointColor", this.pointColor);
                this.pointColorRecord.CancelMark();
            }

            base.DoRender(arg);
        }
Beispiel #6
0
 /// <summary>
 /// 用户App或工具用此函数可向Debug流写入一条消息。
 /// </summary>
 /// <param name="source"></param>
 /// <param name="type"></param>
 /// <param name="id"></param>
 /// <param name="severity"></param>
 /// <param name="length">用-1即可。</param>
 /// <param name="buf"></param>
 public static void DebugMessageInsert(
     CSharpGL.Enumerations.DebugSource source,
     CSharpGL.Enumerations.DebugType type,
     uint id,
     CSharpGL.Enumerations.DebugSeverity severity,
     int length,
     StringBuilder buf)
 {
     DebugMessageInsert((uint)source, (uint)type, id, (uint)severity, length, buf);
 }
Beispiel #7
0
 /// <summary>
 /// 设置哪些属性的消息能够/不能被传入callback函数。
 /// </summary>
 /// <param name="source"></param>
 /// <param name="type"></param>
 /// <param name="severity"></param>
 /// <param name="count"></param>
 /// <param name="ids"></param>
 /// <param name="enabled"></param>
 public static void DebugMessageControl(
     CSharpGL.Enumerations.DebugMessageControlSource source,
     CSharpGL.Enumerations.DebugMessageControlType type,
     CSharpGL.Enumerations.DebugMessageControlSeverity severity,
     int count,
     int[] ids,
     bool enabled)
 {
     DebugMessageControl((uint)source, (uint)type, (uint)severity, count, ids, enabled);
 }
Beispiel #8
0
        void element_AfterRendering(object sender, CSharpGL.Objects.RenderEventArgs e)
        {
            IMVP element = sender as IMVP;

            element.ResetShaderProgram();
        }
 private RandomPointsRenderer(CSharpGL.IBufferable model, CSharpGL.ShaderCode[] shaderCodes, CSharpGL.AttributeMap attributeMap, params GLState[] switches)
     : base(model, shaderCodes, attributeMap, switches)
 {
 }
 public FontTextureXmlPrinter(CSharpGL.Texts.FontTexture ttfTexture)
 {
     // TODO: Complete member initialization
     this.ttfTexture = ttfTexture;
 }
Beispiel #11
0
        private void callbackProc(CSharpGL.Enumerations.DebugSource source,
            CSharpGL.Enumerations.DebugType type,
            uint id,
            CSharpGL.Enumerations.DebugSeverity severity,
            int length,
            StringBuilder message,
            IntPtr userParam)
        {
            var obj = System.Runtime.InteropServices.Marshal.PtrToStructure(userParam, typeof(UserParamStruct));

            DateTime now = DateTime.Now;

            StringBuilder builder = new StringBuilder();
            {
                builder.AppendLine(string.Format("{0:yyyy-MM-dd HH:mm:ss.ffff}:", now));
                builder.Append("source: ");
                builder.Append(source); builder.Append(", ");
                builder.Append("type: ");
                builder.Append(type); builder.Append(", ");
                builder.Append("id: ");
                builder.Append(id); builder.Append(", ");
                builder.Append("severity: ");
                builder.Append(severity); builder.Append(", ");
                builder.Append("length: ");
                builder.Append(length); builder.Append(", ");
                builder.Append("message: ");
                if (message != null)
                {
                    builder.Append(message.ToString()); builder.Append(", ");
                }
                else
                {
                    builder.Append("<null>"); builder.Append(", ");
                }
                builder.Append("userParam: ");
                builder.Append(userParam);
                builder.AppendLine();
            }

            string text = builder.ToString();
            this.frmWhiteBoard.AppendText(text);

            string filename = string.Format("debuggingAndProfiling{0:yyyyMMddHHmm}.txt", now);
            using (System.IO.StreamWriter sw = new System.IO.StreamWriter(filename, true))
            {
                sw.Write(text);
            }
        }
 public FontTexturePNGPrinter(CSharpGL.Texts.FontTexture ttfTexture)
 {
     this.ttfTexture = ttfTexture;
     this.font = new Font("微软雅黑", ttfTexture.FontHeight / 2);
     this.outputWidth = ttfTexture.FontHeight * 40;
 }
Beispiel #13
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="model"></param>
 /// <param name="shaderCodes"></param>
 /// <param name="attributeMap"></param>
 /// <param name="positionNameInIBufferable"></param>
 /// <param name="switches"></param>
 public PointsRenderer(Points model, CSharpGL.ShaderCode[] shaderCodes, CSharpGL.AttributeMap attributeMap, string positionNameInIBufferable, params GLState[] switches)
     : base(model, shaderCodes, attributeMap, positionNameInIBufferable, switches)
 {
 }