Example #1
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);
    }
    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);
    }