public static SurfaceGenerator Convert(SimpleSurfaceGenerator source) { if (source == null) throw new ArgumentNullException("source"); return (ref Vector2d input, out Vector3d normal) => { const double sampleDistance = 1e-6; Vector3d position = source(ref input); Vector2d right = input + new Vector2d(sampleDistance, 0), down = input + new Vector2d(0, sampleDistance); Vector3d s2 = source(ref right) - position; Vector3d s3 = source(ref down) - position; normal = s2.Cross(s3).Normalized; return position; }; }
public static SurfaceGenerator Convert(SimpleSurfaceGenerator source) { if (source == null) { throw new ArgumentNullException("source"); } return((ref Vector2d input, out Vector3d normal) => { const double sampleDistance = 1e-6; Vector3d position = source(ref input); Vector2d right = input + new Vector2d(sampleDistance, 0), down = input + new Vector2d(0, sampleDistance); Vector3d s2 = source(ref right) - position; Vector3d s3 = source(ref down) - position; normal = s2.Cross(s3).Normalized; return position; }); }
public ProceduralParameters StartProcedural(SimpleSurfaceGenerator generator) { return new ProceduralParameters(generator, this); }
public ProceduralParameters(SimpleSurfaceGenerator surfaceGenerator, ModelBuilder builder) : this(Convert(surfaceGenerator), builder) { }
public ProceduralParameters SetSurfaceGenerator(SimpleSurfaceGenerator value) { return SetSurfaceGenerator(Convert(value)); }
public ProceduralParameters StartProcedural(SimpleSurfaceGenerator generator) { return(new ProceduralParameters(generator, this)); }
public ProceduralParameters SetSurfaceGenerator(SimpleSurfaceGenerator value) { return(SetSurfaceGenerator(Convert(value))); }