public void Fetch (Slide slide) { LightIntensities = slide.LightIntensities; MainLightPosition = slide.MainLightPosition; EnableShadows = slide.EnableShadows; if (slide.FloorImageName != null) { FloorImageName = slide.FloorImageName.Split ('.') [0]; FloorImageExtension = slide.FloorImageName.Split ('.') [1]; } FloorReflectivity = slide.FloorReflectivity; FloorFalloff = slide.FloorFalloff; TransitionDuration = slide.TransitionDuration; TransitionOffsetX = slide.TransitionOffsetX; TransitionOffsetZ = slide.TransitionOffsetZ; TransitionRotation = slide.TransitionRotation; Altitude = slide.Altitude; Pitch = slide.Pitch; IsNewIn10_10 = slide.IsNewIn10_10; }
// Updates the secondary image of the floor if needed private void UpdateFloorImage (NSImage image, Slide slide) { // We don't want to animate if we replace the secondary image by a new one // Otherwise we want to translate the secondary image to the new location var disableAction = false; if (FloorImage != image) { FloorImage = image; disableAction = true; if (image != null) { // Set a new material property with this image to the "floorMap" custom property of the floor var property = SCNMaterialProperty.Create (image); property.WrapS = SCNWrapMode.Repeat; property.WrapT = SCNWrapMode.Repeat; property.MipFilter = SCNFilterMode.Linear; Floor.FirstMaterial.SetValueForKey (property, new NSString ("floorMap")); } } if (image != null) { var slidePosition = slide.GroundNode.ConvertPositionToNode (new SCNVector3 (0, 0, 10), null); if (disableAction) { SCNTransaction.Begin (); SCNTransaction.AnimationDuration = 0; Floor.FirstMaterial.SetValueForKey (NSValue.FromVector (slidePosition), new NSString ("floorImageNamePosition")); SCNTransaction.Commit (); } else Floor.FirstMaterial.SetValueForKey (NSValue.FromVector (slidePosition), new NSString ("floorImageNamePosition")); } }