Exemplo n.º 1
0
        private void InitializeCameraForTextureTest()
        {
            CC3Vector cameraPos = new CC3Vector(750.0f, 1000.0f, 10.0f);
            CC3Vector cameraTarget = new CC3Vector(0.0f, 300.0f, 0.0f);
            float cameraFieldOfViewInDegrees = 45.0f;
            float cameraAspectRatio = _graphicsContext.ScreenAspectRatio;
            float cameraNearClippingDistance = 200.0f;
            float cameraFarClippingDistance = 10000.0f;

            CC3CameraPerspectiveBuilder cameraBuilder = new CC3CameraPerspectiveBuilder();
            cameraBuilder.PositionAtPoint(cameraPos).LookingAtPoint(cameraTarget);
            cameraBuilder.WithFieldOfView(cameraFieldOfViewInDegrees).WithAspectRatio(cameraAspectRatio);
            cameraBuilder.WithNearAndFarClippingDistances(cameraNearClippingDistance, cameraFarClippingDistance);

            _camera = cameraBuilder.Build();

            this.ActiveCamera = _camera;
        }
Exemplo n.º 2
0
        private void InitializeCamera()
        {
            CC3Vector cameraPos = new CC3Vector(0.0f, 10.0f, 5.0f);
            CC3Vector cameraTarget = new CC3Vector(0.0f, 0.0f, -10.0f);
            float cameraFieldOfViewInDegrees = 60.0f;
            float cameraAspectRatio = _graphicsContext.ScreenAspectRatio;
            float cameraNearClippingDistance = 1.0f;
            float cameraFarClippingDistance = 10000.0f;

            CC3CameraPerspectiveBuilder cameraBuilder = new CC3CameraPerspectiveBuilder();
            cameraBuilder.PositionAtPoint(cameraPos).LookingAtPoint(cameraTarget);
            cameraBuilder.WithFieldOfView(cameraFieldOfViewInDegrees).WithAspectRatio(cameraAspectRatio);
            cameraBuilder.WithNearAndFarClippingDistances(cameraNearClippingDistance, cameraFarClippingDistance);

            _camera = cameraBuilder.Build();

            // Replace above block with below to instead use an orthographic camera
            /*
            CC3CameraOrthographicBuilder cameraBuilder = new CC3CameraOrthographicBuilder();
            cameraBuilder.PositionAtPoint(cameraPos).LookingAtPoint(cameraTarget);
            cameraBuilder.WithViewWidth(10.0f * cameraAspectRatio).WithViewHeight(10.0f);
            cameraBuilder.WithNearAndFarClippingDistances(cameraNearClippingDistance, cameraFarClippingDistance);

            _camera = cameraBuilder.Build() as CC3CameraOrthographic;
            */

            this.ActiveCamera = _camera;
        }