mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-24 10:45:46 +00:00
ZVISION: Create methods for converting screen coords to image coords
This commit is contained in:
parent
b76927ab4e
commit
a3315037ff
@ -80,6 +80,8 @@ void RenderManager::renderSubRectToScreen(uint16 *buffer, uint32 imageWidth, uin
|
||||
destRect.moveTo((_width - subRectangle.width()) / 2, (_height - subRectangle.height()) / 2);
|
||||
}
|
||||
|
||||
_backgroundOffset = Common::Point(destRect.left, destRect.top);
|
||||
|
||||
if (_renderTable.getRenderState() == RenderTable::FLAT) {
|
||||
_system->copyRectToScreen(buffer + subRectangle.top * horizontalPitch + subRectangle.left, horizontalPitch, destRect.left, destRect.top, destRect.width(), destRect.height());
|
||||
} else {
|
||||
@ -139,7 +141,17 @@ void RenderManager::renderImageToScreen(Common::SeekableReadStream &stream, uint
|
||||
|
||||
tga.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
const Common::Point RenderManager::convertToImageCoords(const Common::Point &point) {
|
||||
Common::Point newPoint(point);
|
||||
|
||||
if (_renderTable.getRenderState() == RenderTable::PANORAMA || _renderTable.getRenderState() == RenderTable::TILT) {
|
||||
newPoint = _renderTable.convertWarpedPointToFlatCoords(newPoint);
|
||||
}
|
||||
|
||||
newPoint -= _backgroundOffset;
|
||||
return newPoint;
|
||||
}
|
||||
|
||||
RenderTable *RenderManager::getRenderTable() {
|
||||
|
@ -53,6 +53,7 @@ private:
|
||||
RenderTable _renderTable;
|
||||
|
||||
Common::SeekableReadStream *_currentBackground;
|
||||
Common::Point _backgroundOffset;
|
||||
|
||||
Video::VideoDecoder *_currentVideo;
|
||||
byte *_scaledVideoFrameBuffer;
|
||||
@ -90,8 +91,9 @@ public:
|
||||
*/
|
||||
void setBackgroundImage(const Common::String &fileName);
|
||||
|
||||
RenderTable *getRenderTable();
|
||||
const Common::Point convertToImageCoords(const Common::Point &point);
|
||||
|
||||
RenderTable *getRenderTable();
|
||||
|
||||
private:
|
||||
void renderSubRectToScreen(uint16 *buffer, uint32 imageWidth, uint32 imageHeight, uint32 horizontalPitch, uint32 destinationX, uint32 destinationY, Common::Rect subRectangle, bool autoCenter);
|
||||
|
@ -60,6 +60,16 @@ void RenderTable::setRenderState(RenderState newState) {
|
||||
}
|
||||
}
|
||||
|
||||
const Common::Point RenderTable::convertWarpedPointToFlatCoords(const Common::Point &point) {
|
||||
uint32 index = point.y * _numColumns + point.x;
|
||||
|
||||
Common::Point newPoint(point);
|
||||
newPoint.x += _internalBuffer[index].x;
|
||||
newPoint.y += _internalBuffer[index].y;
|
||||
|
||||
return newPoint;
|
||||
}
|
||||
|
||||
uint16 mixTwoRGB(uint16 colorOne, uint16 colorTwo, float percentColorOne) {
|
||||
assert(percentColorOne < 1.0f);
|
||||
|
||||
@ -157,7 +167,14 @@ void RenderTable::generatePanoramaLookupTable() {
|
||||
}
|
||||
|
||||
void RenderTable::generateTiltLookupTable() {
|
||||
for (uint x = 0; x < _numColumns; x++) {
|
||||
for (uint y = 0; y < _numRows; y++) {
|
||||
uint32 index = y * _numColumns + x;
|
||||
|
||||
_internalBuffer[index].x = 0;
|
||||
_internalBuffer[index].y = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void RenderTable::setPanoramaFoV(float fov) {
|
||||
|
@ -63,6 +63,9 @@ private:
|
||||
public:
|
||||
RenderState getRenderState() { return _renderState; }
|
||||
void setRenderState(RenderState newState);
|
||||
|
||||
const Common::Point convertWarpedPointToFlatCoords(const Common::Point &point);
|
||||
|
||||
void mutateImage(uint16 *sourceBuffer, uint16* destBuffer, uint32 imageWidth, uint32 imageHeight, Common::Rect subRectangle, Common::Rect destRectangle);
|
||||
void generateRenderTable();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user