Example #1
0
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Space))
        {
            Time.timeScale = Time.timeScale == 1f ? 0f : 1f;
        }

        if (Input.GetKeyDown(KeyCode.UpArrow))
        {
            --m_TestIndex;

            if (m_TestIndex < 0)
            {
                m_TestIndex = m_TestList.Count - 1;
            }

            IMDraw.Flush();

            UpdateIndex();
        }

        if (Input.GetKeyDown(KeyCode.DownArrow))
        {
            ++m_TestIndex;

            if (m_TestIndex >= m_TestList.Count)
            {
                m_TestIndex = 0;
            }

            IMDraw.Flush();

            UpdateIndex();
        }
    }
Example #2
0
    public static void DrawLine3D(Vector3 fromPos, Vector3 toPos, float thickness, Color color)
    {
        Vector3    diff = toPos - fromPos;
        Quaternion dir  = Quaternion.LookRotation(diff, Vector3.up);

        IMDraw.Box3D(Vector3.Lerp(fromPos, toPos, 0.5f), dir, new Vector3(thickness, thickness, diff.magnitude), color);
    }
Example #3
0
    void LateUpdate()
    {
        IMDraw.Axis3D(Vector3.zero, Quaternion.identity, 1000f, 0.2f);

        IMDraw.LabelShadowed(Screen.width / 2f, 10f, Color.white, LabelPivot.UPPER_CENTER, LabelAlignment.CENTER, "EXAMPLE SCENE 2: COLLIDERS & CONTACT POINTS");

        IMDraw.LabelShadowed(10f, Screen.height - 10f, Color.white, LabelPivot.LOWER_LEFT, LabelAlignment.LEFT, m_Controls);
    }
    void OnEnable()
    {
        IMDraw.Flush();
        m_CameraController.SetPosition(m_CameraPosition);
        m_CameraController.SetRotation(m_CameraRotation);

        if (m_TestParticleSystemRenderer == null)
        {
            m_TestParticleSystemRenderer = gameObject.GetComponent <ParticleSystemRenderer>();
        }
    }
Example #5
0
    public override void Execute(float deltaTime)
    {
        IMDraw.Ray3D(new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 1f), 1f, Color.cyan, Color.magenta);

        m_T -= deltaTime;

        if (m_T < 0f)
        {
            IMDraw.Ray3D(new Vector3(1f, 0f, 0f), new Vector3(0f, 0f, 1f), 1f, Color.cyan, Color.magenta, 1f);
            m_T += 2f;
        }
    }
Example #6
0
    void LateUpdate()
    {
        float screenWidth  = (float)Screen.width;
        float screenHeight = (float)Screen.height;

        Vector2 titleSize = IMDraw.GetLabelSize(m_Title);

        IMDraw.Rectangle2D(new Rect(10f - 4f, 10f - 4f, titleSize.x + 8f, titleSize.y + 8f), m_TitleBG, m_TitleBGOutline);
        IMDraw.LabelShadowed(10f, 10f, Color.white, LabelPivot.UPPER_LEFT, LabelAlignment.LEFT, m_Title);

        Rect imageRect = new Rect(screenWidth - m_LogoSize - 10f, screenHeight - m_LogoSize - 10f, m_LogoSize, m_LogoSize);

        IMDraw.Image2D(m_LogoTexture, imageRect, m_LogoColor);
        IMDraw.RectangleOutline2D(imageRect, Color.black);
    }
    public void Tick(World model)
    {
        IMDraw.Axis3D(Vector3.zero, Quaternion.identity, 1000f, 0.2f);
        IMDraw.Grid3D(Vector3.zero, Quaternion.identity, 5f, 5f, 10, 10, new Color(1f, 1f, 1f, 0.5f));

        foreach (var p in model.points.Values)
        {
            if (model.debugSettings.isShowingNodes)
            {
                GraphicsService.DrawCube(p.pos.Vector3(), Vector3.one * 0.25f, Config.Colors.Blue);
                GraphicsService.DrawLabel(p.pos.Vector3(), Config.Colors.White, p.id.ToString() + "\n" + p.pos.ToString());
            }

            float y = 0f;
            foreach (var c in p.colors)
            {
                y += 0.2f;
                GraphicsService.DrawCube(
                    p.pos.Vector3() + new Vector3(0.2f, 0f, y - 0.2f),
                    Vector3.one * 0.1f,
                    ColorService.GetUnityColor(c)
                    );
            }
        }

        foreach (var c in model.connections.Values)
        {
            Point fromPoint = PointService.GetPointWithId(model, c.fromPointId);
            Point toPoint   = PointService.GetPointWithId(model, c.toPointId);
            var   color     = ColorService.GetUnityColor(c.color);
            color.a = 0.75f;
            GraphicsService.DrawLine3D(fromPoint.pos.Vector3(), toPoint.pos.Vector3(), 0.1f, color);

            if (model.debugSettings.isShowingConnectionInfo)
            {
                GraphicsService.DrawLabel(
                    Vector.Lerp(fromPoint.pos, toPoint.pos, 0.5f).Vector3(),
                    Config.Colors.White,
                    c.id.ToString()
                    );
            }
        }

        Color trainColor = ColorService.GetUnityColor(model.train.nextColor);

        GraphicsService.DrawCube(model.train.pos.Vector3(), Vector3.one * 0.5f, trainColor);
        GraphicsService.DrawLabel(model.train.pos.Vector3(), trainColor, "TRAIN" + "\n" + model.train.toGridPos);
    }
    void LateUpdate()
    {
        if (m_ShowFPS)
        {
            float deltaTime = Time.unscaledDeltaTime;

            m_FPSTimeleft -= deltaTime;
            m_FPSAccum    += 1.0f / deltaTime;
            ++m_FPSFrames;

            // Interval ended - update GUI text and start new interval
            if (m_FPSTimeleft <= 0.0)
            {
                float fps = m_FPSAccum / m_FPSFrames;

                if (m_GUIStyle != null)
                {
                    if (fps < 30)
                    {
                        m_GUIStyle.normal.textColor = Color.yellow;
                    }
                    else
                    if (fps < 10)
                    {
                        m_GUIStyle.normal.textColor = Color.red;
                    }
                    else
                    {
                        m_GUIStyle.normal.textColor = Color.green;
                    }
                }

                m_FPSTimeleft += m_FPSUpdateInterval;

                if (m_FPSTimeleft <= 0f)
                {
                    m_FPSTimeleft = m_FPSUpdateInterval;
                }

                m_FPSAccum  = 0.0F;
                m_FPSFrames = 0;

                m_FPSString = System.String.Format("{0} FPS", System.Math.Round(fps, 2));
            }

            IMDraw.LabelShadowed(Screen.width - 10, 10f, Color.white, LabelPivot.UPPER_RIGHT, LabelAlignment.RIGHT, m_FPSString);
        }
    }
Example #9
0
    void LateUpdate()
    {
        IMDraw.Axis3D(Vector3.zero, Quaternion.identity, 100f, 0.2f);

        float deltaTime = Time.deltaTime;

        m_TestList[m_TestIndex].Execute(deltaTime);

        float screenHeight = Screen.height;

        IMDraw.LabelShadowed(Screen.width / 2f, 10f, Color.white, LabelPivot.UPPER_CENTER, LabelAlignment.CENTER, "EXAMPLE SCENE 3: API TEST");

        IMDraw.LabelShadowed(Screen.width / 2f, 24f, Color.white, LabelPivot.UPPER_CENTER, LabelAlignment.CENTER, m_TestTitle);

        IMDraw.LabelShadowed(10f, screenHeight - 10f, Color.white, LabelPivot.LOWER_LEFT, LabelAlignment.LEFT, m_Controls);
    }
Example #10
0
    public override void Execute(float deltaTime)
    {
        m_EulerRotation.x = Mathf.Repeat(m_EulerRotation.x + (90f * deltaTime), 360f);
        m_EulerRotation.z = m_EulerRotation.y = m_EulerRotation.x;

        Quaternion rotation = Quaternion.Euler(m_EulerRotation);

        IMDraw.Ellipsoid3D(new Vector3(0f, 0f, 0f), rotation, new Vector3(0.25f, 0.25f, 0.5f), new Color(1f, 1f, 1f, 0.5f));

        m_T -= deltaTime;

        if (m_T < 0f)
        {
            IMDraw.Ellipsoid3D(new Vector3(1f, 0f, 0f), rotation, new Vector3(0.25f, 0.25f, 0.5f), new Color(1f, 1f, 1f, 0.5f), 1f);
            m_T += 2f;
        }
    }
Example #11
0
    public override void Execute(float deltaTime)
    {
        m_EulerRotation.x = Mathf.Repeat(m_EulerRotation.x + (90f * deltaTime), 360f);
        m_EulerRotation.z = m_EulerRotation.y = m_EulerRotation.x;

        Quaternion rotation = Quaternion.Euler(m_EulerRotation);

        IMDraw.WireBox3D(Vector3.zero, rotation, new Vector3(0.25f, 0.25f, 0.25f), Color.white);

        m_T -= deltaTime;

        if (m_T < 0f)
        {
            IMDraw.WireBox3D(new Vector3(1f, 0f, 0f), Quaternion.identity, new Vector3(0.25f, 0.25f, 0.25f), Color.white, 1f);
            m_T += 2f;
        }
    }
Example #12
0
    private void UpdateTextMesh(float deltaTime)
    {
        m_TextMeshRotation += deltaTime * 45f;

        if (m_TextMeshRotation > 360f)
        {
            m_TextMeshRotation -= 360f;
        }

        Quaternion rotation = Quaternion.Euler(0f, m_TextMeshRotation, 0f);

        IMDraw.TextMesh(rotation * new Vector3(0f, 0.4f, -4f), rotation, 2f, 2f, Color.white, TextAlignment.Center, TextAnchor.MiddleCenter, "TEXT\nMESH");

        Quaternion rotation2 = Quaternion.Euler(0f, 360f - m_TextMeshRotation, 0f);

        IMDraw.TextMesh(rotation2 * new Vector3(0f, -0.4f, -4f), rotation2, 2f, 2f, Color.white, TextAlignment.Center, TextAnchor.MiddleCenter, "TEXT\nMESH");
    }
Example #13
0
    public override void Execute(float deltaTime)
    {
        m_EulerRotation.x = Mathf.Repeat(m_EulerRotation.x + (90f * deltaTime), 360f);
        m_EulerRotation.z = m_EulerRotation.y = m_EulerRotation.x;

        Quaternion rotation = Quaternion.Euler(m_EulerRotation);
        Vector3    size     = new Vector3(0.25f, 0.25f, 0.25f);

        IMDraw.Mesh(m_Mesh, new Vector3(0f, 0f, 0f), rotation, size, new Color(1f, 1f, 1f, 0.5f));

        m_T -= deltaTime;

        if (m_T < 0f)
        {
            IMDraw.Mesh(m_Mesh, new Vector3(1f, 0f, 0f), Quaternion.identity, size, new Color(1f, 1f, 1f, 0.5f), 1f);
            m_T += 2f;
        }
    }
Example #14
0
    public override void Execute(float deltaTime)
    {
        m_EulerRotation.x = Mathf.Repeat(m_EulerRotation.x + (90f * deltaTime), 360f);

        m_T -= deltaTime;

        IMDraw.Arc3D(Vector3.zero, Quaternion.identity, 0.5f, m_EulerRotation.x, Color.red);

        m_EulerRotation.y = Mathf.Repeat(m_EulerRotation.y + (90f * deltaTime), 360f);

        IMDraw.Arc3D(Vector3.zero, Quaternion.identity, 1f, 1.5f, m_EulerRotation.y, 45f, Color.green);

        if (m_T < 0f)
        {
            IMDraw.Arc3D(Vector3.zero, Quaternion.identity, 2f, 2.5f, 0f, 180f, Color.blue, 1f);

            m_T += 2f;
        }
    }
Example #15
0
    public override void Execute(float deltaTime)
    {
        float screenX = Mathf.Round((float)Screen.width * 0.75f);
        float screenY = Mathf.Round((float)Screen.height * 0.75f);

        IMDraw.LabelShadowed(screenX, screenY, Color.white, LabelPivot.MIDDLE_CENTER, LabelAlignment.CENTER, string.Format("LABEL AT SCREEN POSITION\n{0}, {1}", screenX, screenY));

        IMDraw.LabelShadowed(Vector3.zero, Color.white, LabelPivot.MIDDLE_CENTER, LabelAlignment.CENTER, "LABEL AT WORLD POSITION\n0, 0, 0");

        m_T -= deltaTime;

        if (m_T < 0f)
        {
            screenY += 40f;
            IMDraw.LabelShadowed(screenX, screenY, Color.white, LabelPivot.MIDDLE_CENTER, LabelAlignment.CENTER, string.Format("LABEL AT SCREEN POSITION\n{0}, {1}", screenX, screenY), 1f);

            IMDraw.LabelShadowed(new Vector3(0f, 0.2f, 0f), Color.white, LabelPivot.MIDDLE_CENTER, LabelAlignment.CENTER, "LABEL AT WORLD POSITION\n0, 0.2, 0", 1f);
            m_T += 2f;
        }
    }
Example #16
0
    public override void Execute(float deltaTime)
    {
        m_EulerRotation.x = Mathf.Repeat(m_EulerRotation.x + (90f * deltaTime), 360f);
        m_EulerRotation.z = m_EulerRotation.y = m_EulerRotation.x;

        Quaternion rotation = Quaternion.Euler(m_EulerRotation);

        IMDraw.Cone3D(new Vector3(0f, 0f, 0f), rotation, 0.5f, 0.25f, (IMDrawAxis)m_Axis, new Color(1f, 1f, 1f, 0.5f));

        m_T -= deltaTime;

        if (m_T < 0f)
        {
            m_Axis = (m_Axis + 1) % 3;
            UpdateAxis();

            IMDraw.Cone3D(new Vector3(1f, 0f, 0f), Quaternion.identity, 0.5f, 0.25f, (IMDrawAxis)m_Axis, new Color(1f, 1f, 1f, 0.5f), 1f);
            m_T += 2f;
        }

        IMDraw.LabelShadowed(Vector3.zero, Color.white, LabelPivot.MIDDLE_CENTER, LabelAlignment.CENTER, m_AxisString);
    }
Example #17
0
    void OnEnable()
    {
        IMDraw.Flush();
        m_CameraController.SetPosition(m_CameraPosition);
        m_CameraController.SetRotation(m_CameraRotation);

        if (m_TestList == null)
        {
            m_TestIndex = 0;
            m_TestList  = new List <IMDrawCallTest>();
            m_TestList.Add(new IMDrawLine3DTest());
            m_TestList.Add(new IMDrawRay3DTest());
            m_TestList.Add(new IMDrawQuad3DTest());
            m_TestList.Add(new IMDrawGridTest());
            m_TestList.Add(new IMDrawWireBox3DTest());
            m_TestList.Add(new IMDrawBox3DTest());
            m_TestList.Add(new IMDrawWirePyramid3DTest());
            m_TestList.Add(new IMDrawPyramid3DTest());
            m_TestList.Add(new IMDrawWireRhombus3DTest());
            m_TestList.Add(new IMDrawRhombus3DTest());
            m_TestList.Add(new IMDrawWireDiscTest());
            m_TestList.Add(new IMDrawDiscTest());
            m_TestList.Add(new IMDrawWireSphereTest());
            m_TestList.Add(new IMDrawSphereTest());
            m_TestList.Add(new IMDrawWireEllipsoidTest());
            m_TestList.Add(new IMDrawEllipsoidTest());
            m_TestList.Add(new IMDrawWireCone3DTest());
            m_TestList.Add(new IMDrawCone3DTest());
            m_TestList.Add(new IMDrawWireCapsuleTest());
            m_TestList.Add(new IMDrawCapsuleTest());
            m_TestList.Add(new IMDrawWireCylinderTest());
            m_TestList.Add(new IMDrawCylinderTest());
            m_TestList.Add(new IMDrawMeshTest(m_ExampleMesh));
            m_TestList.Add(new IMDrawLabelTest());
            m_TestList.Add(new IMDrawArc3DTest());

            UpdateIndex();
        }
    }
Example #18
0
    public override void Execute(float deltaTime)
    {
        m_EulerRotation.x = Mathf.Repeat(m_EulerRotation.x + (90f * deltaTime), 360f);
        m_EulerRotation.z = m_EulerRotation.y = m_EulerRotation.x;

        Quaternion rotation = Quaternion.Euler(m_EulerRotation);

        IMDraw.Grid3D(new Vector3(0f, 0f, 0f), rotation, 1f, 1f, 10, 10, (IMDrawAxis)m_Axis, new Color(1f, 1f, 1f, 0.5f));

        m_T -= deltaTime;

        if (m_T < 0f)
        {
            //IMDraw.Default.Grid3D(new Vector3(0f, 0f, 0f), rotation, 1f, 1f, 10, 10, (IMDrawAxis)m_Axis, new Color(1f, 1f, 1f, 0.5f), 1f);
            m_T += 2f;

            m_Axis = (m_Axis + 1) % 3;
            UpdateAxis();
        }

        IMDraw.LabelShadowed(Screen.width / 2f, Screen.height / 2f, Color.white, LabelPivot.MIDDLE_CENTER, LabelAlignment.CENTER, m_AxisString);
    }
Example #19
0
 void OnEnable()
 {
     IMDraw.Flush();
     m_CameraController.SetPosition(m_CameraPosition);
     m_CameraController.SetRotation(m_CameraRotation);
 }
Example #20
0
 void LateUpdate()
 {
     IMDraw.LabelShadowed(10f, 10f, Color.white, LabelPivot.UPPER_LEFT, LabelAlignment.LEFT, m_Title);
     IMDraw.LabelShadowed(10f, 30f, Color.white, LabelPivot.UPPER_LEFT, LabelAlignment.LEFT, m_UnityVersion);
 }
Example #21
0
 public static void DrawCube(Vector3 pos, Vector3 size, Color color)
 {
     IMDraw.Box3D(pos, size, new Color(color.r, color.g, color.b, 0.25f));
     IMDraw.WireBox3D(pos, size, color);
 }
Example #22
0
 public static void DrawLabel(Vector3 pos, Color color, string text)
 {
     IMDraw.LabelShadowed(pos, 0f, 0f, color, LabelPivot.MIDDLE_CENTER, LabelAlignment.CENTER, "■");
     IMDraw.LabelShadowed(pos, 25f, 0f, color, LabelPivot.MIDDLE_LEFT, LabelAlignment.LEFT, text);
 }
Example #23
0
 public static void DrawLine(Vector3 fromPos, Vector3 toPos, Color color)
 {
     IMDraw.Line3D(fromPos, toPos, color);
 }
Example #24
0
    void LateUpdate()
    {
        Vector3 position = m_Transform.position;

        float       labelX      = 10f;
        float       labelY      = 0f;
        const float lineSpacing = 14f;

        IMDraw.LabelShadowed(position, 0f, labelY, m_NameColor, LabelPivot.MIDDLE_CENTER, LabelAlignment.CENTER, "■");

        if (m_ShowName)
        {
            // Note: Accessing the name on a gameobject generates garbage...
            IMDraw.LabelShadowed(position, labelX, labelY, m_NameColor, LabelPivot.MIDDLE_LEFT, LabelAlignment.LEFT, name);
            labelY += lineSpacing;
        }

        if (m_ShowTag)
        {
            // Note: Accessing the tag on a gameobject generates garbage...
            IMDraw.LabelShadowed(position, labelX, labelY, m_TagColor, LabelPivot.MIDDLE_LEFT, LabelAlignment.LEFT, tag);
            labelY += lineSpacing;
        }

        if (m_ShowPosition)
        {
            position.x = (float)Math.Round(position.x, POSITION_ROUNDING_DECIMALS);
            position.y = (float)Math.Round(position.y, POSITION_ROUNDING_DECIMALS);
            position.z = (float)Math.Round(position.z, POSITION_ROUNDING_DECIMALS);

            if (position != m_GameObjectPosition)             // Only update the position string when the position has changed, to reduce GC pressure
            {
                m_GameObjectPosition = position;

                m_StringBuilder.Length = 0;
                m_StringBuilder.Append("xyz : ");
                m_StringBuilder.Append(position.x);
                m_StringBuilder.Append(", ");
                m_StringBuilder.Append(position.y);
                m_StringBuilder.Append(", ");
                m_StringBuilder.Append(position.z);
                m_PositionString = m_StringBuilder.ToString();
            }

            IMDraw.LabelShadowed(position, labelX, labelY, m_TagColor, LabelPivot.MIDDLE_LEFT, LabelAlignment.LEFT, m_PositionString);
            labelY += lineSpacing;
        }

        if (m_ShowEulerRotation)
        {
            Vector3 eulerRotation = m_Transform.rotation.eulerAngles;
            eulerRotation.x = (float)Math.Round(eulerRotation.x, ROTATION_ROUNDING_DECIMALS);
            eulerRotation.y = (float)Math.Round(eulerRotation.y, ROTATION_ROUNDING_DECIMALS);
            eulerRotation.z = (float)Math.Round(eulerRotation.z, ROTATION_ROUNDING_DECIMALS);

            if (eulerRotation != m_GameObjectEulerRotation)
            {
                m_GameObjectEulerRotation = eulerRotation;

                m_StringBuilder.Length = 0;
                m_StringBuilder.Append("deg : ");
                m_StringBuilder.Append(eulerRotation.x);
                m_StringBuilder.Append(", ");
                m_StringBuilder.Append(eulerRotation.y);
                m_StringBuilder.Append(", ");
                m_StringBuilder.Append(eulerRotation.z);
                m_RotationString = m_StringBuilder.ToString();
            }

            IMDraw.LabelShadowed(position, labelX, labelY, m_TagColor, LabelPivot.MIDDLE_LEFT, LabelAlignment.LEFT, m_RotationString);
            labelY += lineSpacing;
        }

        if (m_ShowRendererBounds && m_Renderers != null && m_Renderers.Count > 0)
        {
            for (int i = 0; i < m_Renderers.Count; ++i)
            {
                if (m_Renderers[i] != null)
                {
                    IMDraw.Bounds(m_Renderers[i], m_BoundsColor);
                }
            }
        }

        if (m_ShowWireframeColliders && m_Colliders != null && m_Colliders.Count > 0)
        {
            for (int i = 0; i < m_Colliders.Count; ++i)
            {
                if (m_Colliders[i] != null)
                {
                    IMDraw.Collider(m_Colliders[i], m_ColliderColor, m_ColliderScaleOffset, m_ShowSolidColliders);
                }
            }
        }
    }
    void LateUpdate()
    {
        //float screenWidth = Screen.width;
        float screenHeight = Screen.height;
        float deltaTime    = Time.deltaTime;

        m_EulerRotation.x += deltaTime * 90f;
        m_EulerRotation.x  = Mathf.Repeat(m_EulerRotation.x, 360f);
        m_EulerRotation.z  = m_EulerRotation.y = m_EulerRotation.x;
        m_RotationY        = Mathf.Repeat(m_RotationY + (deltaTime * 45f), 360f);

        Vector3    origin = Vector3.zero;
        Vector3    position;
        Quaternion objectRotation = Quaternion.Euler(m_EulerRotation);

        Quaternion rotation = Quaternion.Euler(0f, m_RotationY, 0f);

        IMDraw.Axis3D(Vector3.zero, Quaternion.identity, 100f, 1f);

        IMDraw.Grid3D(Vector3.zero, Quaternion.identity, 5f, 5f, 10, 10, new Color(1f, 1f, 1f, 0.5f));

        position = origin + (rotation * new Vector3(-2f, 2f, 0f));
        IMDraw.Quad3D(position, objectRotation, 1f, 1f, m_TestAxis, ToColor(m_ColorQuad, 0.25f));
        IMDraw.Grid3D(position, objectRotation, 1f, 1f, 1, 1, m_TestAxis, m_ColorQuad);
        IMDraw.LabelShadowed(position, m_ColorQuad, LabelPivot.MIDDLE_CENTER, LabelAlignment.CENTER, "QUAD");

        position = origin + (rotation * new Vector3(0f, 2f, 0f));
        IMDraw.Box3D(position, objectRotation, new Vector3(1f, 1f, 1f), ToColor(m_ColorBox, 0.25f));
        IMDraw.WireBox3D(position, objectRotation, new Vector3(1f, 1f, 1f), m_ColorBox);
        IMDraw.LabelShadowed(position, m_ColorBox, LabelPivot.MIDDLE_CENTER, LabelAlignment.CENTER, "BOX");

        position = origin + (rotation * new Vector3(2f, 2f, 0f));
        float pyramidHeight = 1f, pyramidWidth = 0.5f;

        IMDraw.Pyramid3D(position, objectRotation, pyramidHeight, pyramidWidth, m_TestAxis, ToColor(m_ColorPyramid, 0.25f));
        IMDraw.WirePyramid3D(position, objectRotation, pyramidHeight, pyramidWidth, m_TestAxis, m_ColorPyramid);
        IMDraw.LabelShadowed(position, m_ColorPyramid, LabelPivot.MIDDLE_CENTER, LabelAlignment.CENTER, "PYRAMID");

        position = origin + (rotation * new Vector3(0f, 2f, 2f));
        float rhombusHeight = 2f, rhombusWidth = 0.75f;

        IMDraw.Rhombus3D(position, objectRotation, rhombusHeight, rhombusWidth, m_TestAxis, ToColor(m_ColorRhombus, 0.25f));
        IMDraw.WireRhombus3D(position, objectRotation, rhombusHeight, rhombusWidth, m_TestAxis, m_ColorRhombus);
        IMDraw.LabelShadowed(position, m_ColorRhombus, LabelPivot.MIDDLE_CENTER, LabelAlignment.CENTER, "RHOMBUS");

        position = origin + (rotation * new Vector3(0f, 2f, -2f));
        IMDraw.Disc3D(position, objectRotation, 0.5f, m_TestAxis, ToColor(m_ColorDisc, 0.25f));
        IMDraw.WireDisc3D(position, objectRotation, 0.5f, m_TestAxis, m_ColorDisc);
        IMDraw.LabelShadowed(position, m_ColorDisc, LabelPivot.MIDDLE_CENTER, LabelAlignment.CENTER, "DISC");


        position = origin + (rotation * new Vector3(0f, -2f, 0f));
        IMDraw.WireSphere3D(position, objectRotation, 0.5f, m_ColorSphere);
        IMDraw.Sphere3D(position, objectRotation, 0.5f, ToColor(m_ColorSphere, 0.25f));
        IMDraw.LabelShadowed(position, m_ColorSphere, LabelPivot.MIDDLE_CENTER, LabelAlignment.CENTER, "SPHERE");

        position = origin + (rotation * new Vector3(2f, -2f, 0f));
        IMDraw.Cylinder3D(position, objectRotation, 2f, 0.25f, IMDrawAxis.X, ToColor(m_ColorCylinder, 0.25f));
        IMDraw.WireCylinder3D(position, objectRotation, 2f, 0.25f, IMDrawAxis.X, ToColor(m_ColorCylinder, 0.25f));
        IMDraw.LabelShadowed(position, m_ColorCylinder, LabelPivot.MIDDLE_CENTER, LabelAlignment.CENTER, "CYLINDER");

        position = origin + (rotation * new Vector3(-2f, -2f, 0f));
        IMDraw.Capsule3D(position, objectRotation, 2f, 0.25f, IMDrawAxis.Y, ToColor(m_ColorCapsule, 0.25f));
        IMDraw.WireCapsule3D(position, objectRotation, 2f, 0.25f, IMDrawAxis.Y, m_ColorCapsule);
        IMDraw.LabelShadowed(position, m_ColorCapsule, LabelPivot.MIDDLE_CENTER, LabelAlignment.CENTER, "CAPSULE");

        position = origin + (rotation * new Vector3(0f, -2f, 2f));
        Vector3 ellipsoidSize = new Vector3(2f, 1f, 1f);

        IMDraw.Ellipsoid3D(position, objectRotation, ellipsoidSize, ToColor(m_ColorEllipsoid, 0.25f));
        IMDraw.WireEllipsoid3D(position, objectRotation, ellipsoidSize, m_ColorEllipsoid);
        IMDraw.LabelShadowed(position, m_ColorEllipsoid, LabelPivot.MIDDLE_CENTER, LabelAlignment.CENTER, "ELLIPSOID");

        position = origin + (rotation * new Vector3(0f, -2f, -2f));
        IMDraw.Cone3D(position, objectRotation, 1f, 0.5f, m_TestAxis, ToColor(m_ColorCone, 0.25f));
        IMDraw.WireCone3D(position, objectRotation, 1f, 0.5f, m_TestAxis, m_ColorCone);
        IMDraw.LabelShadowed(position, m_ColorCone, LabelPivot.MIDDLE_CENTER, LabelAlignment.CENTER, "CONE");

        if (m_TestParticleSystemRenderer != null)
        {
            IMDraw.Bounds(m_TestParticleSystemRenderer.bounds, Color.green);
        }

        IMDraw.LabelShadowed(Screen.width / 2f, 10f, Color.white, LabelPivot.UPPER_CENTER, LabelAlignment.CENTER, "EXAMPLE SCENE 1: PRIMITIVES & LABELS");

        IMDraw.LabelShadowed(10f, screenHeight - 10f, Color.white, LabelPivot.LOWER_LEFT, LabelAlignment.LEFT, m_Controls);
    }
Example #26
0
 public static void DrawSphere(Vector3 pos, float radius, Color color)
 {
     IMDraw.Sphere3D(pos, radius, new Color(color.r, color.g, color.b, 0.25f));
     IMDraw.WireSphere3D(pos, radius, color);
 }
 private void DrawContactPoint(ref ContactPoint contactPoint)
 {
     IMDraw.Ray3D(contactPoint.point, contactPoint.normal, m_Size, m_Colour, m_Duration);
 }
Example #28
0
 public static void DrawLine(Color color, Vector3 p1, Vector3 p2)
 {
     IMDraw.Line3D(p1, p2, color, 0f);
 }