public virtual SceneObject BuildCylinder(FScene scene, TypedAttribSet attributes) { CylinderSO so = new CylinderSO(); safe_set_property_f(attributes, IOStrings.ARadius, (f) => { so.Radius = f; }); safe_set_property_f(attributes, IOStrings.AHeight, (f) => { so.Height = f; }); so.Create(scene.DefaultSOMaterial); safe_set_property_s(attributes, IOStrings.ASOName, (s) => { so.Name = s; }); RestoreTransform(so, attributes); RestoreMaterial(so, attributes); return(so); }
override public SceneObject Duplicate() { CylinderSO copy = new CylinderSO(); copy.radius = this.radius; copy.height = this.height; 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); }