diff options
| author | Peter Kohaut | 2016-09-20 00:33:06 +0200 | 
|---|---|---|
| committer | Eugene Sandulenko | 2016-09-29 22:33:41 +0200 | 
| commit | cfc8ffed8af71714cc6378b412557d5fc03781d4 (patch) | |
| tree | c6b1d8c1f2d8f6c8dc3702d706baf60eba34ae7d /engines/bladerunner/view.cpp | |
| parent | 7e7cf4e748172f956fddb7c6f21f34bfef058242 (diff) | |
| download | scummvm-rg350-cfc8ffed8af71714cc6378b412557d5fc03781d4.tar.gz scummvm-rg350-cfc8ffed8af71714cc6378b412557d5fc03781d4.tar.bz2 scummvm-rg350-cfc8ffed8af71714cc6378b412557d5fc03781d4.zip | |
BLADERUNNER: fixed exit selection, added footstep sounds, added some debugging display (scene objects, regions, exits, walkboxes, lights?)
Diffstat (limited to 'engines/bladerunner/view.cpp')
| -rw-r--r-- | engines/bladerunner/view.cpp | 18 | 
1 files changed, 12 insertions, 6 deletions
| diff --git a/engines/bladerunner/view.cpp b/engines/bladerunner/view.cpp index b3b6ad8ad2..f8acb91400 100644 --- a/engines/bladerunner/view.cpp +++ b/engines/bladerunner/view.cpp @@ -49,7 +49,7 @@ bool View::read(Common::ReadStream *stream) {  void View::setFovX(float fovX) {  	_fovX = fovX; -	_viewportHalfWidth  = 320.0f; +	_viewportHalfWidth = 320.0f;  	_viewportHalfHeight = 240.0f;  	_viewportDistance = 320.0f / tanf(_fovX / 2.0f); @@ -60,17 +60,16 @@ void View::calculateSliceViewMatrix() {  	m = m * rotationMatrixX(float(M_PI) / 2.0f); -	Matrix4x3 a( -1.0f,  0.0f,  0.0f,  0.0f, -	              0.0f, -1.0f,  0.0f,  0.0f, -	              0.0f,  0.0f,  1.0f,  0.0f); +	Matrix4x3 a(-1.0f, 0.0f, 0.0f, 0.0f, +	            0.0f, -1.0f, 0.0f, 0.0f, +	            0.0f, 0.0f, 1.0f, 0.0f);  	m = a * m;  	_sliceViewMatrix = m;  } -void View::calculateCameraPosition() -{ +void View::calculateCameraPosition() {  	Matrix4x3 invertedMatrix = invertMatrix(_sliceViewMatrix);  	_cameraPosition.x = invertedMatrix(0, 3); @@ -78,5 +77,12 @@ void View::calculateCameraPosition()  	_cameraPosition.z = invertedMatrix(2, 3);  } +Vector2 View::calculateScreenPosition(Vector3 worldPosition) { +	Vector3 viewPosition = _frameViewMatrix * worldPosition; +	return Vector2( +		this->_viewportHalfWidth - viewPosition.x / viewPosition.z * _viewportDistance, +		this->_viewportHalfHeight - viewPosition.y / viewPosition.z * _viewportDistance +	); +}  } // End of namespace BladeRunner | 
