[Scummvm-git-logs] scummvm master -> 969a2d787137fb8f8e096041d3477cf54c76cb0a

sev- noreply at scummvm.org
Wed Feb 5 11:25:29 UTC 2025


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
f464564f99 VIDEO: QTVR: Capture tilt changes for panoramas
969a2d7871 VIDEO: QTVR: Fix tilt angle mapping computation when rendering panoramas


Commit: f464564f99e90bb888e58ec2c285783d56dab07a
    https://github.com/scummvm/scummvm/commit/f464564f99e90bb888e58ec2c285783d56dab07a
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2025-02-05T12:25:13+01:00

Commit Message:
VIDEO: QTVR: Capture tilt changes for panoramas

Changed paths:
    video/qt_decoder.h
    video/qtvr_decoder.cpp


diff --git a/video/qt_decoder.h b/video/qt_decoder.h
index 1f36c995801..8c8df16100b 100644
--- a/video/qt_decoder.h
+++ b/video/qt_decoder.h
@@ -324,8 +324,10 @@ private:
 		void constructPanorama();
 		Graphics::Surface *constructMosaic(VideoTrackHandler *track, uint w, uint h, Common::String fname);
 
-		float getCurAngle() { return _curAngle; }
-		void setCurAngle(float angle);
+		float getPanAngle() { return _curPanAngle; }
+		void setPanAngle(float angle);
+		float getTiltAngle() { return _curTiltAngle; }
+		void setTiltAngle(float angle);
 
 	private:
 		QuickTimeDecoder *_decoder;
@@ -343,7 +345,8 @@ private:
 
 		bool _isPanoConstructed;
 
-		float _curAngle;
+		float _curPanAngle;
+		float _curTiltAngle;
 		bool _dirty;
 	};
 };
diff --git a/video/qtvr_decoder.cpp b/video/qtvr_decoder.cpp
index 2de219aacfd..2f599ee9f0b 100644
--- a/video/qtvr_decoder.cpp
+++ b/video/qtvr_decoder.cpp
@@ -200,12 +200,16 @@ void QuickTimeDecoder::handlePanoMouseMove(int16 x, int16 y) {
 	bool changed = false;
 
 	if (ABS(mouseDeltaX) >= sensitivity) {
-		track->setCurAngle(track->getCurAngle() + speedX);
+		track->setPanAngle(track->getPanAngle() + speedX);
 
 		changed = true;
 	}
 
-	(void)speedY;
+	if (ABS(mouseDeltaY) >= sensitivity) {
+		track->setTiltAngle(track->getTiltAngle() + speedY);
+
+		changed = true;
+	}
 
 	if (changed) {
 		_prevMouseX = x;
@@ -333,7 +337,8 @@ QuickTimeDecoder::PanoTrackHandler::PanoTrackHandler(QuickTimeDecoder *decoder,
 	_constructedHotspots = nullptr;
 	_projectedPano = nullptr;
 
-	_curAngle = 0.0f;
+	_curPanAngle = 0.0f;
+	_curTiltAngle = 0.0f;
 
 	_dirty = true;
 }
@@ -461,7 +466,8 @@ void QuickTimeDecoder::PanoTrackHandler::constructPanorama() {
 
 	_isPanoConstructed = true;
 
-	_curAngle = desc->_hPanStart;
+	_curPanAngle = desc->_hPanStart;
+	_curTiltAngle = 0.0f;
 }
 
 void QuickTimeDecoder::PanoTrackHandler::projectPanorama() {
@@ -476,7 +482,7 @@ void QuickTimeDecoder::PanoTrackHandler::projectPanorama() {
 	}
 
 	PanoSampleDesc *desc = (PanoSampleDesc *)_parent->sampleDescs[0];
-	int startY = ((float)desc->_sceneSizeY / (desc->_hPanEnd - desc->_hPanStart)) * (_curAngle - desc->_hPanStart);
+	int startY = ((float)desc->_sceneSizeY / (desc->_hPanEnd - desc->_hPanStart)) * (_curPanAngle - desc->_hPanStart);
 
 	for (uint16 y = 0; y < h; y++) {
 		for (uint16 x = 0; x < w; x++) {
@@ -516,7 +522,7 @@ void QuickTimeDecoder::PanoTrackHandler::projectPanorama() {
 #endif
 }
 
-void QuickTimeDecoder::PanoTrackHandler::setCurAngle(float angle) {
+void QuickTimeDecoder::PanoTrackHandler::setPanAngle(float angle) {
 	PanoSampleDesc *desc = (PanoSampleDesc *)_parent->sampleDescs[0];
 
 	if (angle < desc->_hPanStart)
@@ -525,8 +531,24 @@ void QuickTimeDecoder::PanoTrackHandler::setCurAngle(float angle) {
 	if (angle > desc->_hPanEnd)
 		angle = desc->_hPanEnd;
 
-	if (_curAngle != angle) {
-		_curAngle = angle;
+	if (_curPanAngle != angle) {
+		_curPanAngle = angle;
+
+		_dirty = true;
+	}
+}
+
+void QuickTimeDecoder::PanoTrackHandler::setTiltAngle(float angle) {
+	PanoSampleDesc *desc = (PanoSampleDesc *)_parent->sampleDescs[0];
+
+	if (angle < desc->_vPanBottom)
+		angle = desc->_vPanBottom;
+
+	if (angle > desc->_vPanTop)
+		angle = desc->_vPanTop;
+
+	if (_curTiltAngle != angle) {
+		_curTiltAngle = angle;
 
 		_dirty = true;
 	}


Commit: 969a2d787137fb8f8e096041d3477cf54c76cb0a
    https://github.com/scummvm/scummvm/commit/969a2d787137fb8f8e096041d3477cf54c76cb0a
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2025-02-05T12:25:16+01:00

Commit Message:
VIDEO: QTVR: Fix tilt angle mapping computation when rendering panoramas

Changed paths:
    video/qtvr_decoder.cpp


diff --git a/video/qtvr_decoder.cpp b/video/qtvr_decoder.cpp
index 2f599ee9f0b..45227e999bf 100644
--- a/video/qtvr_decoder.cpp
+++ b/video/qtvr_decoder.cpp
@@ -482,11 +482,12 @@ void QuickTimeDecoder::PanoTrackHandler::projectPanorama() {
 	}
 
 	PanoSampleDesc *desc = (PanoSampleDesc *)_parent->sampleDescs[0];
-	int startY = ((float)desc->_sceneSizeY / (desc->_hPanEnd - desc->_hPanStart)) * (_curPanAngle - desc->_hPanStart);
+	int startY = (((float)desc->_sceneSizeY - w) / (desc->_hPanEnd - desc->_hPanStart)) * (_curPanAngle - desc->_hPanStart);
+	int startX = ((float)(desc->_sceneSizeX - h) / (desc->_vPanTop - desc->_vPanBottom)) * (_curTiltAngle - desc->_vPanBottom);
 
 	for (uint16 y = 0; y < h; y++) {
 		for (uint16 x = 0; x < w; x++) {
-			int setX = y;
+			int setX = y + startX;
 			int setY = x + startY;
 
 			uint32 pixel = _constructedPano->getPixel(setX, setY);




More information about the Scummvm-git-logs mailing list