public FScene(FContext context) { this.context = context; history = new ChangeHistory(); history_stack = new List <ChangeHistory>(); TypeRegistry = new SORegistry(); initialize_scene_root(); // 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.ToMaterialf(PivotSOMaterial); defaultPrimitiveType = SOTypes.Cylinder; }
public void Create(SOMaterial useMaterial, GameObject parent, float fMinDimension) { meshObject = GameObject.CreatePrimitive(PrimitiveType.Sphere); fMaterial mat = MaterialUtil.ToMaterialf(useMaterial); meshObject.SetMaterial(mat, true); bUpdatePending = true; meshObject.transform.SetParent(parent.transform, false); Height = Width = Depth = fMinDimension; }
virtual public void AssignSOMaterial(SOMaterial m) { sceneMaterial = m; displaySceneMaterial = MaterialUtil.ToMaterialf(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 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")); creation_size = size; shapeGO = create_pivot_shape(); AppendNewGO(shapeGO, pivotGO, false); pivotGO.AddChild(shapeGO); if (frameMaterial != null) { this.frameMaterial = frameMaterial; fMaterial mat = MaterialUtil.ToMaterialf(frameMaterial); frameGO = UnityUtil.CreateMeshGO("pivotFrame", "icon_meshes/axis_frame", size, UnityUtil.MeshAlignOption.NoAlignment, mat, false); MaterialUtil.SetIgnoreMaterialChanges(frameGO); MaterialUtil.DisableShadows(frameGO); AppendNewGO(frameGO, pivotGO, false); } if (nShapeLayer >= 0) { shapeGO.SetLayer(nShapeLayer); } increment_timestamp(); return(this); }
public fMaterial ToFMaterial() { return(MaterialUtil.ToMaterialf(this)); }