protected override void Initialize() { mMaterial = new Material("shader.fx", Window.Device); mRefugeeBinding = new MeshMaterialBinding(Window.Device, mMaterial, new Cube(Window.Device, new Vector4(0.8f, 0, 0, 0))); mSeekerBinding = new MeshMaterialBinding(Window.Device, mMaterial, new Cube(Window.Device, new Vector4(0, 0, 0.8f, 0))); mArriveBinding = new MeshMaterialBinding(Window.Device, mMaterial, new Cube(Window.Device, new Vector4(0, 0.8f, 0, 0))); mGroundBinding = new MeshMaterialBinding(Window.Device, mMaterial, new Quad(Window.Device, new Vector4(0.2f, 0.2f, 0.2f, 0))); mKeyboard = new Keyboard(); var stand = new Stand(); stand.Position = new Vector3(0, 140, 0); stand.Direction = -Vector3.YAxis; stand.Up = -Vector3.ZAxis; var lens = new PerspectiveProjectionLens(); mCamera = new Camera(stand, lens); var commands = new CommandManager(); commands.Add(ESCAPE, Exit); commands.Add(TAKE_SCREENSHOT, Window.TakeScreenshot); mInputCommandBinder = new InputCommandBinder(commands, mKeyboard); mInputCommandBinder.Bind(Button.Escape, ESCAPE); mInputCommandBinder.Bind(Button.PrintScreen, TAKE_SCREENSHOT); mCameraCommandManager = new CameraCommandManager(commands, mInputCommandBinder, stand); mSeekSteering = new SeekSteering(mSeekerKinematic, mRefugeeKinematic, 15); mArriveSteering = new ArrivingSteering(mArriveKinematic, mRefugeeKinematic, maxAcceleration: 15, slowRadius: 4, satisfactionRadius: 2); mRefugeeSteering = new RefugeeSteering(mRefugeeKinematic, mSeekerKinematic, 15); }
protected override void Initialize() { mMaterial = new Material("texture.fx", Window.Device); mQuadBinding = new MeshMaterialBinding(Window.Device, mMaterial, new Quad(Window.Device, new Vector4(0.6f, 0.6f, 0.6f, 0))); mTexture = new Texture(Window.Device, "texture.png"); mKeyboard = new Keyboard(); var stand = new OrbitingStand {Radius = 7, Azimuth = Constants.HALF_PI}; var lens = new PerspectiveProjectionLens(); mCamera = new Camera(stand, lens); var commands = new CommandManager(); commands.Add(ESCAPE, Exit); commands.Add(TAKE_SCREENSHOT, Window.TakeScreenshot); mInputCommandBinder = new InputCommandBinder(commands, mKeyboard); mInputCommandBinder.Bind(Button.Escape, ESCAPE); mInputCommandBinder.Bind(Button.PrintScreen, TAKE_SCREENSHOT); commands.Add(MOVE_BACKWARD, () => stand.Radius += Frametime); commands.Add(MOVE_FORWARD, () => stand.Radius -= Frametime); commands.Add(STRAFE_RIGHT, () => stand.Azimuth -= Frametime); commands.Add(STRAFE_LEFT, () => stand.Azimuth += Frametime); commands.Add(UP, () => stand.Declination += Frametime); commands.Add(DOWN, () => stand.Declination -= Frametime); mInputCommandBinder.Bind(Button.W, MOVE_FORWARD); mInputCommandBinder.Bind(Button.S, MOVE_BACKWARD); mInputCommandBinder.Bind(Button.D, STRAFE_RIGHT); mInputCommandBinder.Bind(Button.A, STRAFE_LEFT); mInputCommandBinder.Bind(Button.R, UP); mInputCommandBinder.Bind(Button.F, DOWN); }
protected override void Initialize() { var quadMesh = new Quad(Window.Device); var triangleMesh = new Triangle(Window.Device); var cubeMesh = new Cube(Window.Device); var sphereMesh = new Sphere(Window.Device); mMaterial = new Material("shader.fx", Window.Device); mQuadBinding = new MeshMaterialBinding(Window.Device, mMaterial, quadMesh); mTriangleBinding = new MeshMaterialBinding(Window.Device, mMaterial, triangleMesh); mCubeBinding = new MeshMaterialBinding(Window.Device, mMaterial, cubeMesh); mSphereBinding = new MeshMaterialBinding(Window.Device, mMaterial, sphereMesh); mKeyboard = new Keyboard(); var stand = new FirstPersonStand { Position = new Vector3(0, 0, 3), Direction = -Vector3.ZAxis }; var lens = new PerspectiveProjectionLens(); mCamera = new Camera(stand, lens); var commands = new CommandManager(); commands.Add(ESCAPE, Exit); commands.Add(TAKE_SCREENSHOT, Window.TakeScreenshot); commands.Add(TURN_LEFT, () => stand.Yaw(-Frametime)); commands.Add(TURN_RIGHT, () => stand.Yaw(Frametime)); commands.Add(TURN_UP, () => stand.Pitch(-Frametime)); commands.Add(TURN_DOWN, () => stand.Pitch(Frametime)); commands.Add(ROLL_LEFT, () => stand.Roll(Frametime)); commands.Add(ROLL_RIGHT, () => stand.Roll(-Frametime)); mInputCommandBinder = new InputCommandBinder(commands, mKeyboard); mInputCommandBinder.Bind(Button.Escape, ESCAPE); mInputCommandBinder.Bind(Button.PrintScreen, TAKE_SCREENSHOT); mInputCommandBinder.Bind(Button.J, TURN_LEFT); mInputCommandBinder.Bind(Button.L, TURN_RIGHT); mInputCommandBinder.Bind(Button.I, TURN_UP); mInputCommandBinder.Bind(Button.K, TURN_DOWN); mInputCommandBinder.Bind(Button.U, ROLL_LEFT); mInputCommandBinder.Bind(Button.O, ROLL_RIGHT); mCameraCommandManager = new CameraCommandManager(commands, mInputCommandBinder, stand); mVector3Random = new Vector3RandomGenerator(new Vector3(-2, -1, -2), new Vector3(2, 1, 2), 1); mCubePositions = new[] { mVector3Random.Next(), mVector3Random.Next(), mVector3Random.Next() }; mTrianglePositions = new[] { mVector3Random.Next(), mVector3Random.Next(), mVector3Random.Next() }; mQuadPositions = new[] { mVector3Random.Next(), mVector3Random.Next(), mVector3Random.Next() }; }