Example #1
0
        static GizmoUtility()
        {
            HandlesMaterial = new Material(Shader.Find("Battlehub/RTGizmos/Handles"));
            HandlesMaterial.enableInstancing = true;
            LinesMaterial = new Material(Shader.Find("Battlehub/RTCommon/LineBillboard"));
            LinesMaterial.SetFloat("_Scale", 0.5f);
            LinesMaterial.enableInstancing = true;
            SelectionMaterial = new Material(Shader.Find("Battlehub/RTGizmos/Handles"));
            SelectionMaterial.SetFloat("_Offset", 1);
            SelectionMaterial.SetFloat("_MinAlpha", 1);
            SelectionMaterial.enableInstancing = true;

            CubeHandles  = CreateCubeHandles(HandleScale);
            ConeHandles  = CreateConeHandles(HandleScale);
            Selection    = CreateHandlesMesh(HandleScale, new[] { Vector3.zero }, new[] { Vector3.back });
            WireCircle   = GraphicsUtility.CreateWireCircle();
            WireArc1     = GraphicsUtility.CreateWireArc(Vector3.zero, 1, 32, 0, Mathf.PI);
            WireArc2     = GraphicsUtility.CreateWireArc(Vector3.zero, 1, 32, Mathf.PI, Mathf.PI * 2);
            WireCube     = GraphicsUtility.CreateWireCubeMesh();
            WireCylinder = GraphicsUtility.CreateWireCylinder();
            WireCone     = CreateWireConeMesh();
            WireCapsule  = CreateWireCapsuleMesh();
        }