public static void EmitSphereSO(SceneSerializer s, IOutputStream o, SphereSO so) { o.AddAttribute(IOStrings.ASOName, so.Name); o.AddAttribute(IOStrings.ASOUuid, so.UUID); s.EmitTransform(o, so); o.AddAttribute(IOStrings.ARadius, so.Radius); s.EmitMaterial(o, so.GetAssignedSOMaterial()); }
override public SceneObject Duplicate() { SphereSO copy = new SphereSO(); copy.radius = this.radius; copy.Create(this.GetAssignedSOMaterial()); copy.SetLocalFrame( this.GetLocalFrame(CoordSpace.ObjectCoords), CoordSpace.ObjectCoords); copy.SetLocalScale(this.GetLocalScale()); return(copy); }
public virtual SceneObject BuildSphere(FScene scene, TypedAttribSet attributes) { SphereSO so = new SphereSO(); safe_set_property_f(attributes, IOStrings.ARadius, (f) => { so.Radius = f; }); so.Create(scene.DefaultSOMaterial); safe_set_property_s(attributes, IOStrings.ASOName, (s) => { so.Name = s; }); RestoreTransform(so, attributes); RestoreMaterial(so, attributes); return(so); }
public PrimitiveSO BuildSO(FScene scene, SOMaterial material) { Frame3f sceneFrame = scene.ToSceneFrame(shiftedFrame); float scale = 1.0f / scene.GetSceneScale(); float w = (float)Math.Abs(Width); float h = (float)Math.Abs(Height); float d = (float)Math.Abs(Depth); if (Type == PrimType.Cylinder) { CylinderSO cyl = new CylinderSO() { Center = this.Center, Radius = w * 0.5f * scale, Height = h * scale }; cyl.Create(material); cyl.SetLocalFrame(sceneFrame, CoordSpace.WorldCoords); return(cyl); } else if (Type == PrimType.Box) { BoxSO box = new BoxSO() { Center = this.Center, Width = w * scale, Height = h * scale, Depth = d * scale }; box.Create(material); box.SetLocalFrame(sceneFrame, CoordSpace.WorldCoords); return(box); } else if (Type == PrimType.Sphere) { SphereSO sphere = new SphereSO() { Center = this.Center, Radius = w * 0.5f * scale }; sphere.Create(material); sphere.SetLocalFrame(sceneFrame, CoordSpace.WorldCoords); return(sphere); } return(null); }
public static void Emit(this SceneSerializer s, IOutputStream o, SphereSO so) { o.AddAttribute(IOStrings.ASOType, IOStrings.TypeSphere); EmitSphereSO(s, o, so); }