Exemplo n.º 1
0
        public void Startup(FearEngineImpl engine)
        {
            rotatingLight = engine.GameObjectFactory.CreateGameObject("RotatingLightFixture");
            rotatingLight.AddUpdatable(engine.UpdateableFactory.CreateContinuousRandomSlerp(rotatingLight.Transform, 0.25f));

            Light             light    = engine.LightFactory.CreateDirectionalLight();
            TransformAttacher attacher = (TransformAttacher)light;

            attacher.AttactToTransform(rotatingLight.Transform);

            cam   = engine.GameObjectFactory.CreateGameObject("Camera");
            scene = engine.SceneFactory.CreateSceneWithSingleLight(engine.CameraFactory.CreateDebugCamera(cam), light);

            GameObject  teapot         = engine.GameObjectFactory.CreateGameObject("Teapot");
            Mesh        mesh           = engine.Resources.GetMesh("TEAPOT");
            Material    material       = engine.Resources.GetMaterial("ShadowedPBR");
            SceneObject shadowedTeapot = new SceneObject(teapot, mesh, material);

            scene.AddSceneObject(shadowedTeapot);

            GameObject planeObj = engine.GameObjectFactory.CreateGameObject("Plane");

            planeObj.Transform.SetScale(3.0f);
            Mesh        plane         = engine.Resources.GetMesh("PLANE");
            SceneObject shadowedPlane = new SceneObject(planeObj, plane, material);

            scene.AddSceneObject(shadowedPlane);

            scene.EnableShadows();
        }
Exemplo n.º 2
0
        public FearCamera CreateDebugCamera(GameObject cameraObject)
        {
            cameraObject.AddUpdatable(updateableFactory.CreateCameraControllerComponent(cameraObject.Transform));

            Vector3 cameraPos = new Vector3(1, 5, -9);

            cameraObject.Transform.MoveTo(cameraPos);
            cameraObject.Transform.LookAt(Vector3.Zero);

            FearCamera camera = new FearCamera();

            camera.AdjustProjection(SharpDX.MathUtil.Pi * 0.25f, 1280.0f / 720.0f, 0.01f, 1000.0f);

            TransformAttacher transformAttacher = (TransformAttacher)camera;

            transformAttacher.AttactToTransform(cameraObject.Transform);

            return(camera);
        }