public MultipleCubes() { InitializeComponent(); GraphicsDevice device = GraphicsDeviceManager.Current.GraphicsDevice; string uri = "Silverlight3D;component/mayablur.jpg"; // Create a view that all three cubes will share. Matrix view = Matrix.CreateLookAt(new Vector3(1, 1, 3), Vector3.Zero, Vector3.Up); // Create the three cubes. cube = new Cube3D(device, new Vector3(-1, -1, -1), 2, uri, 1.33f, view); cube2 = new Cube3D(device, new Vector3(-2, -2, 1), 1.5f, uri, 1.33f, view); cube3 = new Cube3D(device, new Vector3(-5, -2, -2.5f), 2, uri, 1.33f, view); }
public AnimationIn3D() { InitializeComponent(); // Create the cube and floor. GraphicsDevice device = GraphicsDeviceManager.Current.GraphicsDevice; Matrix view = Matrix.CreateLookAt(cameraPosition, cameraTarget, Vector3.Up); cube = new Cube3D(device, new Vector3(-1, -1, -1), 2, "Silverlight3D;component/mayablur.jpg", 1.33f, view); floor = new Floor3D(device, 1.33f, view); // Walk the camera back so the scene is visible. // (The camera starts at the origin, so the rotations work around the origin.) cameraPosition -= cameraLook * 6; // Displace it before rotating it, to get an orbiting effect. //Matrix translation = Matrix.CreateTranslation(-2, 0, 0); //cube.World = cube.World * translation; }