Пример #1
0
        /// <summary>
        /// Engine render element callback
        /// </summary>
        /// <param name="PDI"></param>
        public virtual void DrawWidgets(NRenderPrimitiveDrawInterface pdi)
        {
            // self draw
            if (drawDebugInfo)
            {
                int yOffest = 5;
                foreach (string info in debugInfos)
                {
                    pdi.DrawDebugString(5, yOffest, info, new Color4ub(230, 180, 20, 255));

                    yOffest += 16;
                }

                //pdi.DrawDebugString(5, yOffest,
                //    String.Format("Camera: FOV:{0} Yaw:{1} Pitch:{2} Distance:{3} LookAt:{4}",
                //    MathHelper.ToDegrees(GameplayCamera.FOV).ToString(".00", CultureInfo.CurrentCulture),
                //    MathHelper.ToDegrees(GameplayCamera.Yaw).ToString(".00", CultureInfo.CurrentCulture),
                //    MathHelper.ToDegrees(GameplayCamera.Pitch).ToString(".00", CultureInfo.CurrentCulture),
                //    GameplayCamera.Distance.ToString(".00", CultureInfo.CurrentCulture),
                //    GameplayCamera.LookAt.ToString()),
                //    new Color4ub(230, 180, 20, 255));
            }
            debugInfos.Clear();
        }
Пример #2
0
        virtual public void DrawWidgets(NRenderPrimitiveDrawInterface PDI)
        {
            PDI.DrawDebugString(3, 3, m_mode.ToString(), new Color4ub(0, 5, 5, 255));
            PDI.DrawDebugString(2, 2, m_mode.ToString(), new Color4ub(255, 250, 250, 255));

            //-- draw axis
            int     p = 32;
            Vector3 c = m_view.Camera.ScreenToWorld(p, (int)this.m_view.Height - p);
            Vector3 t = m_view.Camera.ScreenToWorld(p, (int)this.m_view.Height);
            float   d = Vector3.Distance(c, t);

            c += m_view.Camera.Forward * d;
            Vector3 cx = c;

            cx.x += d;
            Vector3 cy = c;

            cy.y += d;
            Vector3 cz = c;

            cz.z += d;

            float g = 195.0f / 256.0f;

            PDI.BeginLineBatch();

            //-- draw axis
            PDI.DrawLine(c, cx, new Color4f(g, 0, 0));
            PDI.DrawLine(c, cy, new Color4f(0, g, 0));
            PDI.DrawLine(c, cz, new Color4f(0, 0, g));

            int offset = -8;

            System.Drawing.Point vp = m_view.Camera.WorldToScreen(cx);
            PDI.DrawDebugString(vp.X, vp.Y + offset, "X", new Color4ub(195, 0, 0, 255));

            vp = m_view.Camera.WorldToScreen(cy);
            PDI.DrawDebugString(vp.X, vp.Y + offset, "Y", new Color4ub(0, 195, 0, 255));

            vp = m_view.Camera.WorldToScreen(cz);
            PDI.DrawDebugString(vp.X, vp.Y + offset, "Z", new Color4ub(0, 0, 195, 255));

            //-- draw xz plane
            int     num            = 20;
            float   grid           = 100;
            Color4f gridColorLight = new Color4f(148 / 256.0f, 148 / 256.0f, 148 / 256.0f);
            Color4f gridColor      = new Color4f(118 / 256.0f, 118 / 256.0f, 118 / 256.0f);
            Color4f blackColor     = new Color4f();

            for (int z = 1; z < num; z++)
            {
                float px = num * grid;
                float pz = z * grid;

                Color4f ct = gridColorLight;

                if (z % 10 == 0)
                {
                    ct = gridColor;
                }

                PDI.DrawLine(new Vector3(-px, 0, pz), new Vector3(px, 0, pz), ct);
                PDI.DrawLine(new Vector3(-px, 0, -pz), new Vector3(px, 0, -pz), ct);

                PDI.DrawLine(new Vector3(pz, 0, px), new Vector3(pz, 0, -px), ct);
                PDI.DrawLine(new Vector3(-pz, 0, px), new Vector3(-pz, 0, -px), ct);
            }

            float l = num * grid;

            PDI.DrawLine(new Vector3(-l, 0, 0), new Vector3(l, 0, 0), blackColor);
            PDI.DrawLine(new Vector3(0, 0, -l), new Vector3(0, 0, l), blackColor);

            PDI.EndLineBatch();
        }
 /// <summary>
 /// Engine render element callback
 /// </summary>
 /// <param name="PDI"></param>
 override public void DrawWidgets(NRenderPrimitiveDrawInterface PDI)
 {
     PDI.DrawDebugString(2, 2, "Welcome Nexus GUI tester application", new Color4ub(255, 150, 150, 255));
     // TODO self draw
 }