// creates a button with a floating primitive in front of the button shape public void Create(float fRadius, Material bgMaterial) { Shape = new HUDShape(HUDShapeType.Disc, fRadius); tempMaterial = MaterialUtil.ToUnityMaterial(Material); base.Create(PrimitiveType.Sphere, tempMaterial, 1.2f); ((GameObject)button).transform.localRotation = Quaternion.identity; }
public void Create(SOMaterial useMaterial, GameObject parent, float fMinDimension) { meshObject = GameObject.CreatePrimitive(PrimitiveType.Sphere); meshObject.GetComponent <MeshRenderer>().material = MaterialUtil.ToUnityMaterial(useMaterial); bUpdatePending = true; meshObject.transform.SetParent(parent.transform, false); Height = Width = Depth = fMinDimension; }
virtual public void AssignSOMaterial(SOMaterial m) { sceneMaterial = m; displaySceneMaterial = MaterialUtil.ToUnityMaterial(m); if (vMaterialStack.Count > 0) { // material 0 is always our base material, higher levels of stack are // temp materials that will be popped eventually vMaterialStack[0] = displaySceneMaterial; } else { displayMaterial = displaySceneMaterial; set_material_internal(displayMaterial); } increment_timestamp(); }
public FScene(FContext context) { this.context = context; history = new ChangeHistory(); TypeRegistry = new SORegistry(); vObjects = new List <SceneObject>(); vSelected = new List <SceneObject>(); vUIElements = new List <SceneUIElement>(); vBoundsObjects = new List <fGameObject>(); ObjectAnimator = new GenericAnimator(); LinkManager = new SOLinkManager(this); sceneRoot = GameObjectFactory.CreateParentGO("Scene"); // for animation playbacks sceneRoot.AddComponent <SceneAnimator>().Scene = this; sceneRoot.AddComponent <UnityPerFrameAnimationBehavior>().Animator = ObjectAnimator; scene_objects = GameObjectFactory.CreateParentGO("scene_objects"); sceneRoot.AddChild(scene_objects, false); deleted_objects = GameObjectFactory.CreateParentGO("deleted_objects"); sceneRoot.AddChild(deleted_objects, false); vDeleted = new List <SceneObject>(); // initialize materials DefaultSOMaterial = new SOMaterial() { Name = "DefaultSO", Type = SOMaterial.MaterialType.StandardRGBColor, RGBColor = ColorUtil.StandardBeige }; DefaultCurveSOMaterial = new SOMaterial() { Name = "DefaultCurveSO", Type = SOMaterial.MaterialType.UnlitRGBColor, RGBColor = Colorf.DarkSlateGrey }; DefaultMeshSOMaterial = new SOMaterial() { Name = "DefaultMeshSO", Type = SOMaterial.MaterialType.PerVertexColor, RGBColor = Colorf.White }; NewSOMaterial = new SOMaterial() { Name = "NewSO", Type = SOMaterial.MaterialType.StandardRGBColor, RGBColor = Colorf.CornflowerBlue }; TransparentNewSOMaterial = new SOMaterial() { Name = "NewSO", Type = SOMaterial.MaterialType.TransparentRGBColor, RGBColor = new Colorf(Colorf.CornflowerBlue, 0.5f) }; PivotSOMaterial = new SOMaterial() { Name = "PivotSO", Type = SOMaterial.MaterialType.TransparentRGBColor, RGBColor = ColorUtil.PivotYellow.SetAlpha(0.75f) }; FrameSOMaterial = new SOMaterial() { Name = "PivotFrame", Type = SOMaterial.MaterialType.StandardRGBColor, RGBColor = ColorUtil.DarkGrey }; SelectedMaterial = MaterialUtil.CreateStandardMaterial(ColorUtil.SelectionGold); FrameMaterial = MaterialUtil.CreateStandardMaterial(ColorUtil.DarkGrey); PivotMaterial = MaterialUtil.ToUnityMaterial(PivotSOMaterial); defaultPrimitiveType = SOTypes.Cylinder; }
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); }