[Scummvm-git-logs] scummvm master -> 9fdc2272b0fa02b137ead790d5ef078193f589b8
sev-
noreply at scummvm.org
Fri Feb 7 12:04:41 UTC 2025
This automated email contains information about 6 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
c77931b627 JANITORIAL: Rearrange QTVR source code
50c5869f52 VIDEO: QTVR: Cleanup unused methods
c47912d327 VIDEO: QTVR: Optimize surface creation when rendering
906a4bb2f1 VIDEO: QTVR: Do not try to update panorama angles based on object slices
35bfa03589 VIDEO: QTVR: Force cursor initialization on load
9fdc2272b0 VIDEO: QTVR: Implement panorama stopper cursors
Commit: c77931b6277dc7bdd8c2c2c517d6bab47dbe0b1c
https://github.com/scummvm/scummvm/commit/c77931b6277dc7bdd8c2c2c517d6bab47dbe0b1c
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2025-02-07T13:04:24+01:00
Commit Message:
JANITORIAL: Rearrange QTVR source code
Changed paths:
video/qtvr_decoder.cpp
diff --git a/video/qtvr_decoder.cpp b/video/qtvr_decoder.cpp
index 13436f9e03a..76f668d8c9e 100644
--- a/video/qtvr_decoder.cpp
+++ b/video/qtvr_decoder.cpp
@@ -154,187 +154,6 @@ void QuickTimeDecoder::updateAngles() {
debugC(1, kDebugLevelMacGUI, "QTVR: row: %d col: %d (%d x %d) pan: %f tilt: %f", getCurrentRow(), getCurrentColumn(), _nav.rows, _nav.columns, getPanAngle(), getTiltAngle());
}
-void QuickTimeDecoder::handleMouseMove(int16 x, int16 y) {
- if (_qtvrType == QTVRType::OBJECT)
- handleObjectMouseMove(x, y);
- else if (_qtvrType == QTVRType::PANORAMA)
- handlePanoMouseMove(x, y);
-
- updateQTVRCursor(x, y);
-}
-
-void QuickTimeDecoder::handleObjectMouseMove(int16 x, int16 y) {
- if (!_isMouseButtonDown)
- return;
-
- VideoTrackHandler *track = (VideoTrackHandler *)_nextVideoTrack;
-
- // HACK: FIXME: Hard coded for now
- const int sensitivity = 10;
- const float speedFactor = 0.1f;
-
- int16 mouseDeltaX = x - _prevMouseX;
- int16 mouseDeltaY = y - _prevMouseY;
-
- float speedX = (float)mouseDeltaX * speedFactor;
- float speedY = (float)mouseDeltaY * speedFactor;
-
- bool changed = false;
-
- if (ABS(mouseDeltaY) >= sensitivity) {
- int newFrame = track->getCurFrame() - round(speedY) * _nav.columns;
-
- if (newFrame >= 0 && newFrame < track->getFrameCount()) {
- track->setCurFrame(newFrame);
- changed = true;
- }
- }
-
- if (ABS(mouseDeltaX) >= sensitivity) {
- int currentRow = track->getCurFrame() / _nav.columns;
- int currentRowStart = currentRow * _nav.columns;
-
- int newFrame = (track->getCurFrame() - (int)roundf(speedX) - currentRowStart) % _nav.columns + currentRowStart;
-
- if (newFrame >= 0 && newFrame < track->getFrameCount()) {
- track->setCurFrame(newFrame);
- changed = true;
- }
- }
-
- if (changed) {
- _prevMouseX = x;
- _prevMouseY = y;
- }
-}
-
-void QuickTimeDecoder::handlePanoMouseMove(int16 x, int16 y) {
- _prevMouseX = x;
- _prevMouseY = y;
-}
-
-#define REPEAT_DELAY 100000
-
-static void repeatCallback(void *data) {
- QuickTimeDecoder *decoder = (QuickTimeDecoder *)data;
-
- if (decoder->_isKeyDown)
- decoder->handleKey(decoder->_lastKey, true, true);
-
- if (decoder->_isMouseButtonDown)
- decoder->handleMouseButton(true, decoder->_prevMouseX, decoder->_prevMouseY, true);
-}
-
-void QuickTimeDecoder::handleMouseButton(bool isDown, int16 x, int16 y, bool repeat) {
- if (_qtvrType == QTVRType::OBJECT)
- handleObjectMouseButton(isDown, x, y, repeat);
- else if (_qtvrType == QTVRType::PANORAMA)
- handlePanoMouseButton(isDown, x, y, repeat);
-
- if (isDown) {
- if (!_repeatTimerActive)
- g_system->getTimerManager()->installTimerProc(&repeatCallback, REPEAT_DELAY, this, "Mouse Repeat Handler");
- _repeatTimerActive = true;
- } else {
- if (_repeatTimerActive) {
- _repeatTimerActive = false;
- g_system->getTimerManager()->removeTimerProc(&repeatCallback);
- }
- }
-
- updateQTVRCursor(x, y);
-}
-
-void QuickTimeDecoder::handleObjectMouseButton(bool isDown, int16 x, int16 y, bool repeat) {
- if (isDown) {
- if (y < _curBbox.top) {
- setCurrentRow(getCurrentRow() + 1);
- } else if (y > _curBbox.bottom) {
- setCurrentRow(getCurrentRow() - 1);
- } else if (x < _curBbox.left) {
- setCurrentColumn((getCurrentColumn() + 1) % _nav.columns);
- } else if (x > _curBbox.right) {
- setCurrentColumn((getCurrentColumn() - 1 + _nav.columns) % _nav.columns);
- } else {
- _prevMouseX = x;
- _prevMouseY = y;
- }
- }
-
- _isMouseButtonDown = isDown;
-}
-
-void QuickTimeDecoder::handlePanoMouseButton(bool isDown, int16 x, int16 y, bool repeat) {
- _isMouseButtonDown = isDown;
-
- if (isDown && !repeat) {
- _prevMouseX = x;
- _prevMouseY = y;
-
- _mouseDrag.x = x;
- _mouseDrag.y = y;
- }
-
- if (!repeat)
- return;
-
- PanoTrackHandler *track = (PanoTrackHandler *)_nextVideoTrack;
-
- // HACK: FIXME: Hard coded for now
- const int sensitivity = 5;
- const float speedFactor = 0.1f;
-
- int16 mouseDeltaX = x - _mouseDrag.x;
- int16 mouseDeltaY = y - _mouseDrag.y;
-
- float speedX = (float)mouseDeltaX * speedFactor;
- float speedY = (float)mouseDeltaY * speedFactor;
-
- if (ABS(mouseDeltaX) >= sensitivity)
- track->setPanAngle(track->getPanAngle() + speedX);
-
- if (ABS(mouseDeltaY) >= sensitivity)
- track->setTiltAngle(track->getTiltAngle() + speedY);
-}
-
-void QuickTimeDecoder::handleKey(Common::KeyState &state, bool down, bool repeat) {
- if (_qtvrType == QTVRType::OBJECT)
- handleObjectKey(state, down, repeat);
- else if (_qtvrType == QTVRType::PANORAMA)
- handlePanoKey(state, down, repeat);
-
- if (down) {
- _lastKey = state;
- _isKeyDown = true;
- if (!_repeatTimerActive)
- g_system->getTimerManager()->installTimerProc(&repeatCallback, REPEAT_DELAY, this, "Keyboard Repeat Handler");
- _repeatTimerActive = true;
- } else {
- _isKeyDown = false;
- if (_repeatTimerActive) {
- _repeatTimerActive = false;
- g_system->getTimerManager()->removeTimerProc(&repeatCallback);
- }
- }
-
- updateQTVRCursor(_prevMouseX, _prevMouseY);
-}
-
-void QuickTimeDecoder::handleObjectKey(Common::KeyState &state, bool down, bool repeat) {
-}
-
-void QuickTimeDecoder::handlePanoKey(Common::KeyState &state, bool down, bool repeat) {
- if ((state.flags & Common::KBD_SHIFT) && (state.flags & Common::KBD_CTRL)) {
- _zoomState = kZoomQuestion;
- } else if (state.flags & Common::KBD_SHIFT) {
- _zoomState = kZoomIn;
- } else if (state.flags & Common::KBD_CTRL) {
- _zoomState = kZoomOut;
- } else {
- _zoomState = kZoomNone;
- }
-}
-
void QuickTimeDecoder::setCurrentRow(int row) {
VideoTrackHandler *track = (VideoTrackHandler *)_nextVideoTrack;
@@ -406,6 +225,10 @@ QuickTimeDecoder::NodeData QuickTimeDecoder::getNodeData(uint32 nodeID) {
return {};
}
+/////////////////////////
+// PANO Track
+////////////////////////
+
QuickTimeDecoder::PanoTrackHandler::PanoTrackHandler(QuickTimeDecoder *decoder, Common::QuickTimeParser::Track *parent) : _decoder(decoder), _parent(parent) {
if (decoder->_qtvrType != QTVRType::PANORAMA)
error("QuickTimeDecoder::PanoTrackHandler: Incorrect track passed");
@@ -473,6 +296,42 @@ const byte *QuickTimeDecoder::PanoTrackHandler::getPalette() const {
return _curPalette;
}
+void QuickTimeDecoder::PanoTrackHandler::setPanAngle(float angle) {
+ PanoSampleDesc *desc = (PanoSampleDesc *)_parent->sampleDescs[0];
+
+ if (angle < desc->_hPanStart + _decoder->_hfov / 2)
+ angle = desc->_hPanStart + _decoder->_hfov / 2;
+
+ if (angle > desc->_hPanEnd - _decoder->_hfov / 2)
+ angle = desc->_hPanEnd - _decoder->_hfov / 2;
+
+ if (_curPanAngle != angle) {
+ _curPanAngle = angle;
+
+ _decoder->setPanAngle(_curPanAngle);
+
+ _dirty = true;
+ }
+}
+
+void QuickTimeDecoder::PanoTrackHandler::setTiltAngle(float angle) {
+ PanoSampleDesc *desc = (PanoSampleDesc *)_parent->sampleDescs[0];
+
+ if (angle < desc->_vPanBottom + _decoder->_fov / 2)
+ angle = desc->_vPanBottom + _decoder->_fov / 2;
+
+ if (angle > desc->_vPanTop - _decoder->_fov / 2)
+ angle = desc->_vPanTop - _decoder->_fov / 2;
+
+ if (_curTiltAngle != angle) {
+ _curTiltAngle = angle;
+
+ _decoder->setTiltAngle(_curTiltAngle);
+
+ _dirty = true;
+ }
+}
+
const Graphics::Surface *QuickTimeDecoder::PanoTrackHandler::decodeNextFrame() {
if (!_isPanoConstructed)
return nullptr;
@@ -745,39 +604,190 @@ void QuickTimeDecoder::PanoTrackHandler::projectPanorama() {
_dirty = false;
}
-void QuickTimeDecoder::PanoTrackHandler::setPanAngle(float angle) {
- PanoSampleDesc *desc = (PanoSampleDesc *)_parent->sampleDescs[0];
- if (angle < desc->_hPanStart + _decoder->_hfov / 2)
- angle = desc->_hPanStart + _decoder->_hfov / 2;
- if (angle > desc->_hPanEnd - _decoder->_hfov / 2)
- angle = desc->_hPanEnd - _decoder->_hfov / 2;
+///////////////////////////////
+// INTERACTIVITY
+//////////////////////////////
- if (_curPanAngle != angle) {
- _curPanAngle = angle;
+void QuickTimeDecoder::handleMouseMove(int16 x, int16 y) {
+ if (_qtvrType == QTVRType::OBJECT)
+ handleObjectMouseMove(x, y);
+ else if (_qtvrType == QTVRType::PANORAMA)
+ handlePanoMouseMove(x, y);
- _decoder->setPanAngle(_curPanAngle);
+ updateQTVRCursor(x, y);
+}
- _dirty = true;
+void QuickTimeDecoder::handleObjectMouseMove(int16 x, int16 y) {
+ if (!_isMouseButtonDown)
+ return;
+
+ VideoTrackHandler *track = (VideoTrackHandler *)_nextVideoTrack;
+
+ // HACK: FIXME: Hard coded for now
+ const int sensitivity = 10;
+ const float speedFactor = 0.1f;
+
+ int16 mouseDeltaX = x - _prevMouseX;
+ int16 mouseDeltaY = y - _prevMouseY;
+
+ float speedX = (float)mouseDeltaX * speedFactor;
+ float speedY = (float)mouseDeltaY * speedFactor;
+
+ bool changed = false;
+
+ if (ABS(mouseDeltaY) >= sensitivity) {
+ int newFrame = track->getCurFrame() - round(speedY) * _nav.columns;
+
+ if (newFrame >= 0 && newFrame < track->getFrameCount()) {
+ track->setCurFrame(newFrame);
+ changed = true;
+ }
+ }
+
+ if (ABS(mouseDeltaX) >= sensitivity) {
+ int currentRow = track->getCurFrame() / _nav.columns;
+ int currentRowStart = currentRow * _nav.columns;
+
+ int newFrame = (track->getCurFrame() - (int)roundf(speedX) - currentRowStart) % _nav.columns + currentRowStart;
+
+ if (newFrame >= 0 && newFrame < track->getFrameCount()) {
+ track->setCurFrame(newFrame);
+ changed = true;
+ }
+ }
+
+ if (changed) {
+ _prevMouseX = x;
+ _prevMouseY = y;
}
}
-void QuickTimeDecoder::PanoTrackHandler::setTiltAngle(float angle) {
- PanoSampleDesc *desc = (PanoSampleDesc *)_parent->sampleDescs[0];
+void QuickTimeDecoder::handlePanoMouseMove(int16 x, int16 y) {
+ _prevMouseX = x;
+ _prevMouseY = y;
+}
- if (angle < desc->_vPanBottom + _decoder->_fov / 2)
- angle = desc->_vPanBottom + _decoder->_fov / 2;
+#define REPEAT_DELAY 100000
- if (angle > desc->_vPanTop - _decoder->_fov / 2)
- angle = desc->_vPanTop - _decoder->_fov / 2;
+static void repeatCallback(void *data) {
+ QuickTimeDecoder *decoder = (QuickTimeDecoder *)data;
- if (_curTiltAngle != angle) {
- _curTiltAngle = angle;
+ if (decoder->_isKeyDown)
+ decoder->handleKey(decoder->_lastKey, true, true);
- _decoder->setTiltAngle(_curTiltAngle);
+ if (decoder->_isMouseButtonDown)
+ decoder->handleMouseButton(true, decoder->_prevMouseX, decoder->_prevMouseY, true);
+}
- _dirty = true;
+void QuickTimeDecoder::handleMouseButton(bool isDown, int16 x, int16 y, bool repeat) {
+ if (_qtvrType == QTVRType::OBJECT)
+ handleObjectMouseButton(isDown, x, y, repeat);
+ else if (_qtvrType == QTVRType::PANORAMA)
+ handlePanoMouseButton(isDown, x, y, repeat);
+
+ if (isDown) {
+ if (!_repeatTimerActive)
+ g_system->getTimerManager()->installTimerProc(&repeatCallback, REPEAT_DELAY, this, "Mouse Repeat Handler");
+ _repeatTimerActive = true;
+ } else {
+ if (_repeatTimerActive) {
+ _repeatTimerActive = false;
+ g_system->getTimerManager()->removeTimerProc(&repeatCallback);
+ }
+ }
+
+ updateQTVRCursor(x, y);
+}
+
+void QuickTimeDecoder::handleObjectMouseButton(bool isDown, int16 x, int16 y, bool repeat) {
+ if (isDown) {
+ if (y < _curBbox.top) {
+ setCurrentRow(getCurrentRow() + 1);
+ } else if (y > _curBbox.bottom) {
+ setCurrentRow(getCurrentRow() - 1);
+ } else if (x < _curBbox.left) {
+ setCurrentColumn((getCurrentColumn() + 1) % _nav.columns);
+ } else if (x > _curBbox.right) {
+ setCurrentColumn((getCurrentColumn() - 1 + _nav.columns) % _nav.columns);
+ } else {
+ _prevMouseX = x;
+ _prevMouseY = y;
+ }
+ }
+
+ _isMouseButtonDown = isDown;
+}
+
+void QuickTimeDecoder::handlePanoMouseButton(bool isDown, int16 x, int16 y, bool repeat) {
+ _isMouseButtonDown = isDown;
+
+ if (isDown && !repeat) {
+ _prevMouseX = x;
+ _prevMouseY = y;
+
+ _mouseDrag.x = x;
+ _mouseDrag.y = y;
+ }
+
+ if (!repeat)
+ return;
+
+ PanoTrackHandler *track = (PanoTrackHandler *)_nextVideoTrack;
+
+ // HACK: FIXME: Hard coded for now
+ const int sensitivity = 5;
+ const float speedFactor = 0.1f;
+
+ int16 mouseDeltaX = x - _mouseDrag.x;
+ int16 mouseDeltaY = y - _mouseDrag.y;
+
+ float speedX = (float)mouseDeltaX * speedFactor;
+ float speedY = (float)mouseDeltaY * speedFactor;
+
+ if (ABS(mouseDeltaX) >= sensitivity)
+ track->setPanAngle(track->getPanAngle() + speedX);
+
+ if (ABS(mouseDeltaY) >= sensitivity)
+ track->setTiltAngle(track->getTiltAngle() + speedY);
+}
+
+void QuickTimeDecoder::handleKey(Common::KeyState &state, bool down, bool repeat) {
+ if (_qtvrType == QTVRType::OBJECT)
+ handleObjectKey(state, down, repeat);
+ else if (_qtvrType == QTVRType::PANORAMA)
+ handlePanoKey(state, down, repeat);
+
+ if (down) {
+ _lastKey = state;
+ _isKeyDown = true;
+ if (!_repeatTimerActive)
+ g_system->getTimerManager()->installTimerProc(&repeatCallback, REPEAT_DELAY, this, "Keyboard Repeat Handler");
+ _repeatTimerActive = true;
+ } else {
+ _isKeyDown = false;
+ if (_repeatTimerActive) {
+ _repeatTimerActive = false;
+ g_system->getTimerManager()->removeTimerProc(&repeatCallback);
+ }
+ }
+
+ updateQTVRCursor(_prevMouseX, _prevMouseY);
+}
+
+void QuickTimeDecoder::handleObjectKey(Common::KeyState &state, bool down, bool repeat) {
+}
+
+void QuickTimeDecoder::handlePanoKey(Common::KeyState &state, bool down, bool repeat) {
+ if ((state.flags & Common::KBD_SHIFT) && (state.flags & Common::KBD_CTRL)) {
+ _zoomState = kZoomQuestion;
+ } else if (state.flags & Common::KBD_SHIFT) {
+ _zoomState = kZoomIn;
+ } else if (state.flags & Common::KBD_CTRL) {
+ _zoomState = kZoomOut;
+ } else {
+ _zoomState = kZoomNone;
}
}
Commit: 50c5869f52b417c35ca6bd70d2fc06cfbbd8beaa
https://github.com/scummvm/scummvm/commit/50c5869f52b417c35ca6bd70d2fc06cfbbd8beaa
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2025-02-07T13:04:24+01:00
Commit Message:
VIDEO: QTVR: Cleanup unused methods
Changed paths:
video/qt_decoder.h
video/qtvr_decoder.cpp
diff --git a/video/qt_decoder.h b/video/qt_decoder.h
index a38bf6fdfda..bef8bdb1cd3 100644
--- a/video/qt_decoder.h
+++ b/video/qt_decoder.h
@@ -335,12 +335,7 @@ private:
int getCurFrame() const { return 1; }
uint32 getNextFrameStartTime() const { return 0; }
Graphics::PixelFormat getPixelFormat() const;
- bool setOutputPixelFormat(const Graphics::PixelFormat &format);
const Graphics::Surface *decodeNextFrame();
- const byte *getPalette() const;
- bool hasDirtyPalette() const { return _curPalette; }
- bool canDither() const;
- void setDither(const byte *palette);
Common::Rational getScaledWidth() const;
Common::Rational getScaledHeight() const;
@@ -357,8 +352,6 @@ private:
QuickTimeDecoder *_decoder;
Common::QuickTimeParser::Track *_parent;
- const byte *_curPalette;
-
void projectPanorama();
const Graphics::Surface *bufferNextFrame();
diff --git a/video/qtvr_decoder.cpp b/video/qtvr_decoder.cpp
index 76f668d8c9e..5d6104fe7c2 100644
--- a/video/qtvr_decoder.cpp
+++ b/video/qtvr_decoder.cpp
@@ -269,7 +269,10 @@ uint16 QuickTimeDecoder::PanoTrackHandler::getHeight() const {
}
Graphics::PixelFormat QuickTimeDecoder::PanoTrackHandler::getPixelFormat() const {
- return Graphics::PixelFormat::createFormatCLUT8();
+ PanoSampleDesc *desc = (PanoSampleDesc *)_parent->sampleDescs[0];
+ VideoTrackHandler *track = (VideoTrackHandler *)(_decoder->getTrack(_decoder->Common::QuickTimeParser::_tracks[desc->_sceneTrackID - 1]->targetTrack));
+
+ return track->getPixelFormat();
}
Common::Rational QuickTimeDecoder::PanoTrackHandler::getScaledWidth() const {
@@ -280,22 +283,6 @@ Common::Rational QuickTimeDecoder::PanoTrackHandler::getScaledHeight() const {
return Common::Rational(_parent->height) / _parent->scaleFactorY;
}
-bool QuickTimeDecoder::PanoTrackHandler::setOutputPixelFormat(const Graphics::PixelFormat &format) {
- return true;
-}
-
-bool QuickTimeDecoder::PanoTrackHandler::canDither() const {
- return false;
-}
-
-void QuickTimeDecoder::PanoTrackHandler::setDither(const byte *palette) {
- assert(canDither());
-}
-
-const byte *QuickTimeDecoder::PanoTrackHandler::getPalette() const {
- return _curPalette;
-}
-
void QuickTimeDecoder::PanoTrackHandler::setPanAngle(float angle) {
PanoSampleDesc *desc = (PanoSampleDesc *)_parent->sampleDescs[0];
@@ -590,7 +577,7 @@ void QuickTimeDecoder::PanoTrackHandler::projectPanorama() {
int32 srcY = static_cast<int32>(yInterpolator * (float)h);
int32 scanlineWidth = static_cast<int32>(xInterpolator * w);
int32 startX = (w - scanlineWidth) / 2;
- int32 endX = startX + scanlineWidth;
+ //int32 endX = startX + scanlineWidth;
// It would be better to compute a reciprocal and do this as a multiply instead,
// doing divides per pixel is SLOW!
Commit: c47912d327655a6fa038ac4e9e6dfd538381f306
https://github.com/scummvm/scummvm/commit/c47912d327655a6fa038ac4e9e6dfd538381f306
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2025-02-07T13:04:24+01:00
Commit Message:
VIDEO: QTVR: Optimize surface creation when rendering
Changed paths:
video/qt_decoder.h
video/qtvr_decoder.cpp
diff --git a/video/qt_decoder.h b/video/qt_decoder.h
index bef8bdb1cd3..8f17aa8c24b 100644
--- a/video/qt_decoder.h
+++ b/video/qt_decoder.h
@@ -359,6 +359,7 @@ private:
Graphics::Surface *_constructedPano;
Graphics::Surface *_constructedHotspots;
Graphics::Surface *_projectedPano;
+ Graphics::Surface *_planarProjection;
bool _isPanoConstructed;
diff --git a/video/qtvr_decoder.cpp b/video/qtvr_decoder.cpp
index 5d6104fe7c2..c04a54002a7 100644
--- a/video/qtvr_decoder.cpp
+++ b/video/qtvr_decoder.cpp
@@ -238,6 +238,7 @@ QuickTimeDecoder::PanoTrackHandler::PanoTrackHandler(QuickTimeDecoder *decoder,
_constructedPano = nullptr;
_constructedHotspots = nullptr;
_projectedPano = nullptr;
+ _planarProjection = nullptr;
_curPanAngle = 0.0f;
_curTiltAngle = 0.0f;
@@ -257,6 +258,9 @@ QuickTimeDecoder::PanoTrackHandler::~PanoTrackHandler() {
if (_projectedPano) {
_projectedPano->free();
delete _projectedPano;
+
+ _planarProjection->free();
+ delete _planarProjection;
}
}
@@ -401,12 +405,12 @@ void QuickTimeDecoder::PanoTrackHandler::projectPanorama() {
uint16 w = _decoder->getWidth(), h = _decoder->getHeight();
- Graphics::Surface planarProjection;
- planarProjection.create(w, h, _constructedPano->format);
-
if (!_projectedPano) {
_projectedPano = new Graphics::Surface();
_projectedPano->create(w, h, _constructedPano->format);
+
+ _planarProjection = new Graphics::Surface();
+ _planarProjection->create(w, h, _constructedPano->format);
}
PanoSampleDesc *desc = (PanoSampleDesc *)_parent->sampleDescs[0];
@@ -564,8 +568,8 @@ void QuickTimeDecoder::PanoTrackHandler::projectPanorama() {
uint32 pixel1 = _constructedPano->getPixel(sourceYCoord, leftSrcCoord);
uint32 pixel2 = _constructedPano->getPixel(sourceYCoord, rightSrcCoord);
- planarProjection.setPixel(x1, y, pixel1);
- planarProjection.setPixel(x2, y, pixel2);
+ _planarProjection->setPixel(x1, y, pixel1);
+ _planarProjection->setPixel(x2, y, pixel2);
}
}
@@ -583,7 +587,7 @@ void QuickTimeDecoder::PanoTrackHandler::projectPanorama() {
// doing divides per pixel is SLOW!
for (uint16 x = 0; x < w; x++) {
int32 srcX = (2 * x + 1) * scanlineWidth / (2 * w) + startX;
- uint32 pixel = planarProjection.getPixel(srcX, srcY);
+ uint32 pixel = _planarProjection->getPixel(srcX, srcY);
_projectedPano->setPixel(x, y, pixel);
}
}
Commit: 906a4bb2f15170f5a68917b0769d1d4c26a9a9a4
https://github.com/scummvm/scummvm/commit/906a4bb2f15170f5a68917b0769d1d4c26a9a9a4
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2025-02-07T13:04:24+01:00
Commit Message:
VIDEO: QTVR: Do not try to update panorama angles based on object slices
Changed paths:
video/qtvr_decoder.cpp
diff --git a/video/qtvr_decoder.cpp b/video/qtvr_decoder.cpp
index c04a54002a7..e677812bf71 100644
--- a/video/qtvr_decoder.cpp
+++ b/video/qtvr_decoder.cpp
@@ -148,10 +148,12 @@ void QuickTimeDecoder::setFOV(float fov) {
}
void QuickTimeDecoder::updateAngles() {
- _panAngle = (float)getCurrentColumn() / (float)_nav.columns * 360.0;
- _tiltAngle = ((_nav.rows - 1) / 2.0 - (float)getCurrentRow()) / (float)(_nav.rows - 1) * 180.0;
+ if (_qtvrType == QTVRType::OBJECT) {
+ _panAngle = (float)getCurrentColumn() / (float)_nav.columns * 360.0;
+ _tiltAngle = ((_nav.rows - 1) / 2.0 - (float)getCurrentRow()) / (float)(_nav.rows - 1) * 180.0;
- debugC(1, kDebugLevelMacGUI, "QTVR: row: %d col: %d (%d x %d) pan: %f tilt: %f", getCurrentRow(), getCurrentColumn(), _nav.rows, _nav.columns, getPanAngle(), getTiltAngle());
+ debugC(1, kDebugLevelMacGUI, "QTVR: row: %d col: %d (%d x %d) pan: %f tilt: %f", getCurrentRow(), getCurrentColumn(), _nav.rows, _nav.columns, getPanAngle(), getTiltAngle());
+ }
}
void QuickTimeDecoder::setCurrentRow(int row) {
Commit: 35bfa03589681703b542ab1ecf29651735e3d205
https://github.com/scummvm/scummvm/commit/35bfa03589681703b542ab1ecf29651735e3d205
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2025-02-07T13:04:24+01:00
Commit Message:
VIDEO: QTVR: Force cursor initialization on load
Changed paths:
video/qtvr_decoder.cpp
diff --git a/video/qtvr_decoder.cpp b/video/qtvr_decoder.cpp
index e677812bf71..d00c14ccc3c 100644
--- a/video/qtvr_decoder.cpp
+++ b/video/qtvr_decoder.cpp
@@ -246,6 +246,8 @@ QuickTimeDecoder::PanoTrackHandler::PanoTrackHandler(QuickTimeDecoder *decoder,
_curTiltAngle = 0.0f;
_dirty = true;
+
+ _decoder->updateQTVRCursor(0, 0); // Initialize all things for cursor
}
QuickTimeDecoder::PanoTrackHandler::~PanoTrackHandler() {
Commit: 9fdc2272b0fa02b137ead790d5ef078193f589b8
https://github.com/scummvm/scummvm/commit/9fdc2272b0fa02b137ead790d5ef078193f589b8
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2025-02-07T13:04:24+01:00
Commit Message:
VIDEO: QTVR: Implement panorama stopper cursors
Changed paths:
video/qtvr_decoder.cpp
diff --git a/video/qtvr_decoder.cpp b/video/qtvr_decoder.cpp
index d00c14ccc3c..7b2ae425d3e 100644
--- a/video/qtvr_decoder.cpp
+++ b/video/qtvr_decoder.cpp
@@ -891,33 +891,58 @@ void QuickTimeDecoder::updateQTVRCursor(int16 x, int16 y) {
setCursor(kCursorPano);
} else {
int res = 0;
+ PanoSampleDesc *desc = (PanoSampleDesc *)_panoTrack->sampleDescs[0];
- if (x < _mouseDrag.x - sensitivity)
+ // left
+ if (x < _mouseDrag.x - sensitivity) {
res |= 1;
- res <<= 1;
+ res <<= 1;
- // left stop
- res <<= 1;
+ // left stop
+ if (_panAngle <= desc->_hPanStart + _hfov / 2)
+ res |= 1;
+ res <<= 1;
+ } else {
+ res <<= 2;
+ }
- if (x > _mouseDrag.x + sensitivity)
+ // right
+ if (x > _mouseDrag.x + sensitivity) {
res |= 1;
- res <<= 1;
+ res <<= 1;
- // right stop
- res <<= 1;
+ // right stop
+ if (_panAngle >= desc->_hPanEnd - _hfov / 2)
+ res |= 1;
+ res <<= 1;
+ } else {
+ res <<= 2;
+ }
- if (y > _mouseDrag.y + sensitivity)
+ // down
+ if (y > _mouseDrag.y + sensitivity) {
res |= 1;
- res <<= 1;
+ res <<= 1;
- // down stop
- res <<= 1;
+ // down stop
+ if (_tiltAngle >= desc->_vPanTop - _fov / 2)
+ res |= 1;
+ res <<= 1;
+ } else {
+ res <<= 2;
+ }
- if (y < _mouseDrag.y - sensitivity)
+ // up
+ if (y < _mouseDrag.y - sensitivity) {
res |= 1;
- res <<= 1;
+ res <<= 1;
- // up stop
+ // up stop
+ if (_tiltAngle <= desc->_vPanBottom + _fov / 2)
+ res |= 1;
+ } else {
+ res <<= 1;
+ }
setCursor(_cursorDirMap[res] ? _cursorDirMap[res] : kCursorPanoNav);
}
More information about the Scummvm-git-logs
mailing list