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 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); }