public Box(Size baseSize, Vector2 position, Vector2 scale, float rotation = 0, Vector2? origin = null) { _size = baseSize.Half; _position = position; _scale = scale; _rotation = new Rotation(rotation); _origin = origin ?? Vector2.Zero; Transform(); }
private static Scene CreateScene3() { Size resolution = new Size(640, 480); Point3D position = new Point3D(0, 0, 5000); double focus = 1000; SizeF projectionWindow = new SizeF(200, 150); Rotation rotation = new Rotation(-Math.PI * 0.25, 0, -Math.PI / 2.3); PerspectiveCamera camera = new PerspectiveCamera(position, rotation, projectionWindow, resolution, focus); Scene scene = new Scene(); scene.Camera = camera; scene.InfinityColor = Color.Black; Material mS1 = new Material(Color.Green, 0.3, 0.3, 0.6, 0, 5); Material mS2 = new Material(Color.Red, 0.4, 0.4, 0, 0.4, 5); Material mS3 = new Material(Color.Yellow, 0.4, 0.3, 0.5, 0, 5); Material mS4 = new Material(Color.BlueViolet, 0.4, 0.3, 0.4, 0, 5); Material mC1 = new Material(Color.Black, 0.3, 0.3, 0.4, 0, 5); Material mC2 = new Material(Color.White, 0.3, 0.3, 0.4, 0, 5); Carpet carpet = new Carpet(new Point3D(0, 0, 0), new SizeF(5000, 5000), new Size(50, 50), mC1, mC2); double r = 100; double h = 2 * r * 0.866; double x = -h * 0.66 * 0.7; //шары в форме пирамиды Sphere sphere1 = new Sphere(new Point3D(x, x, r), r, mS1); Sphere sphere2 = new Sphere(new Point3D(x + h * 0.7 - r * 0.7, x + h * 0.7 + r * 0.7, r), r, mS2); Sphere sphere3 = new Sphere(new Point3D(x + h * 0.7 + r * 0.7, x + h * 0.7 - r * 0.7, r), r, mS3); Sphere sphere4 = new Sphere(new Point3D(x + h * 0.7 * 0.66, x + h * 0.7 * 0.66, 2.5 * r), r, mS4); scene.AddGraphicsObject(carpet); scene.AddGraphicsObject(sphere1); scene.AddGraphicsObject(sphere2); scene.AddGraphicsObject(sphere3); scene.AddGraphicsObject(sphere4); Light L1 = new Light(new Point3D(0, 0, 2000), Color.White); Light L2 = new Light(new Point3D(0, 2000, 3000), Color.White); Light L3 = new Light(new Point3D(2000, 0, 3000), Color.White); Light L4 = new Light(new Point3D(0, -2000, 3000), Color.White); Light L5 = new Light(new Point3D(-2000, 0, 3000), Color.White); //scene.AddLight(L1); scene.AddLight(L2); scene.AddLight(L3); scene.AddLight(L4); scene.AddLight(L5); return scene; }
static IRender GetRender(int quantity) { List<ICamera> camersList = new List<ICamera>(); for(int i = 0; i < quantity; i++) { Size resolution = new Size(640, 480); Point3D position = new Point3D(0, 0, 5000); double focus = 1000; SizeF projectionWindow = new SizeF(200, 150); double aroundOZ = -(Math.PI * 2.0) * (((double)i) / quantity); Rotation rotation = new Rotation(aroundOZ, 0, -Math.PI / 2.3); PerspectiveCamera camera = new PerspectiveCamera(position, rotation, projectionWindow, resolution, focus); camersList.Add(camera); } return new EOculusRender(CreateScene3(), new Size(800, 600), camersList.GetEnumerator()); }
/// <summary> /// Checks if current rotation is equal to other rotation /// </summary> /// <param name="other">Other rotation</param> /// <returns>True if equals, otherwise false</returns> public bool Equals(Rotation other) { return this == other; }
/// <summary> /// Adds new rotation to current rotation /// </summary> /// <param name="rotation">Rotation to add</param> /// <returns>Result rotation</returns> public Rotation Add(Rotation rotation) { return new Rotation(_degrees + rotation.Value); }