Example #1
0
        public virtual PivotSO Create(SOMaterial shapeMaterial, SOMaterial frameMaterial = null, int nShapeLayer = -1)
        {
            // [TODO] replace frame geometry with line renderer ?
            // [TODO] still cast shadows  (semitransparent objects don't cast shadows, apparently)
            // [TODO] maybe render solid when not obscured by objects? use raycast in PreRender?

            AssignSOMaterial(shapeMaterial);       // need to do this to setup BaseSO material stack

            pivotGO = GameObjectFactory.CreateParentGO(UniqueNames.GetNext("Pivot"));

            shapeGO = create_pivot_shape();
            AppendNewGO(shapeGO, pivotGO, false);

            pivotGO.AddChild(shapeGO);

            if (frameMaterial != null)
            {
                this.frameMaterial = frameMaterial;

                frameGO = UnityUtil.CreateMeshGO("pivotFrame", "icon_meshes/axis_frame", 1.0f,
                                                 UnityUtil.MeshAlignOption.NoAlignment, MaterialUtil.ToUnityMaterial(frameMaterial), false);
                MaterialUtil.SetIgnoreMaterialChanges(frameGO);
                MaterialUtil.DisableShadows(frameGO);
                AppendNewGO(frameGO, pivotGO, false);
            }

            if (nShapeLayer >= 0)
            {
                shapeGO.SetLayer(nShapeLayer);
            }

            increment_timestamp();
            return(this);
        }
Example #2
0
        public override void Setup()
        {
            measureGO = GameObjectFactory.CreateParentGO("dimension");
            measureGO.SetLayer(FPlatform.WidgetOverlayLayer);

            textGO = GameObjectFactory.CreateTextMeshGO("text", "1.0", Colorf.Black, TextHeight.SceneValuef);
            UnityUtil.AddChild(measureGO, textGO, false);
            textGO.SetLayer(FPlatform.WidgetOverlayLayer);
        }
Example #3
0
 public void Start()
 {
     fadeObject = new fGameObject(GameObject.CreatePrimitive(PrimitiveType.Sphere), FGOFlags.NoFlags);
     //fadeObject.transform.localScale = new Vector3(0.5f, 0.5f, 0.5f);
     fadeObject.SetMaterial(MaterialUtil.CreateFlatMaterial(Color.black, 0.0f), true);
     fadeObject.SetName("fade_sphere");
     UnityUtil.ReverseMeshOrientation(fadeObject.GetMesh());
     fadeObject.SetParent(UseCamera.GameObject(), false);
     fadeObject.SetLayer(FPlatform.HUDLayer);
 }
Example #4
0
 public virtual void AppendNewGO(fGameObject go, fGameObject parent, bool bKeepPosition)
 {
     vObjects.Add(go);
     go.SetParent(parent, bKeepPosition);
     go.SetLayer(parent.GetLayer());
     foreach (GameObject child_go in go.Children())
     {
         vObjects.Add(child_go);
         child_go.SetLayer(parent.GetLayer());
     }
 }
Example #5
0
 public override void Setup()
 {
     sphereGO = GameObjectFactory.CreateMeshGO("brush_roi_sphere");
     sphereGO.SetMesh(UnityUtil.GetSphereMesh());
     sphereGO.SetLayer(FPlatform.WidgetOverlayLayer);
 }
Example #6
0
 public virtual void SetLayer(int nLayer)
 {
     rootGO.SetLayer(nLayer, true);
 }
Example #7
0
 override public void SetLayer(int nLayer)
 {
     parentGO.SetLayer(nLayer);
     base.SetLayer(nLayer);
 }