From 0e4e6ee9bf1f3a640191df6b22e6965a7199d171 Mon Sep 17 00:00:00 2001 From: richiesams Date: Mon, 29 Jul 2013 15:20:51 -0500 Subject: ZVISION: Create methods for altering panoramaOptions and create console commands for them --- engines/zvision/console.cpp | 14 ++++++++++++++ engines/zvision/console.h | 2 ++ engines/zvision/render_table.cpp | 9 +++++++++ engines/zvision/render_table.h | 3 +++ 4 files changed, 28 insertions(+) diff --git a/engines/zvision/console.cpp b/engines/zvision/console.cpp index e9bbdd74bb..3dad7af376 100644 --- a/engines/zvision/console.cpp +++ b/engines/zvision/console.cpp @@ -43,6 +43,8 @@ Console::Console(ZVision *engine) : GUI::Debugger(), _engine(engine) { DCmd_Register("raw2wav", WRAP_METHOD(Console, cmdRawToWav)); DCmd_Register("setrenderstate", WRAP_METHOD(Console, cmdSetRenderState)); DCmd_Register("generaterendertable", WRAP_METHOD(Console, cmdGenerateRenderTable)); + DCmd_Register("setpanoramafov", WRAP_METHOD(Console, cmdSetPanoramaFoV)); + DCmd_Register("setpanoramascale", WRAP_METHOD(Console, cmdSetPanoramaScale)); } bool Console::cmdLoadImage(int argc, const char **argv) { @@ -127,11 +129,23 @@ bool Console::cmdGenerateRenderTable(int argc, const char **argv) { } bool Console::cmdSetPanoramaFoV(int argc, const char **argv) { + if (argc != 2) { + DebugPrintf("Use setpanoramafov to change the current panorama field of view\n"); + return true; + } + + _engine->getRenderManager()->getRenderTable()->setPanoramaFoV(atof(argv[1])); return true; } bool Console::cmdSetPanoramaScale(int argc, const char **argv) { + if (argc != 2) { + DebugPrintf("Use setpanoramascale to change the current panorama scale\n"); + return true; + } + + _engine->getRenderManager()->getRenderTable()->setPanoramaScale(atof(argv[1])); return true; } diff --git a/engines/zvision/console.h b/engines/zvision/console.h index 7fa4acc194..7b1beeb304 100644 --- a/engines/zvision/console.h +++ b/engines/zvision/console.h @@ -43,6 +43,8 @@ private: bool cmdRawToWav(int argc, const char **argv); bool cmdSetRenderState(int argc, const char **argv); bool cmdGenerateRenderTable(int argc, const char **argv); + bool cmdSetPanoramaFoV(int argc, const char **argv); + bool cmdSetPanoramaScale(int argc, const char **argv); }; } // End of namespace ZVision diff --git a/engines/zvision/render_table.cpp b/engines/zvision/render_table.cpp index 1ba1648d39..b5a2809444 100644 --- a/engines/zvision/render_table.cpp +++ b/engines/zvision/render_table.cpp @@ -156,7 +156,16 @@ void RenderTable::generatePanoramaLookupTable() { } void RenderTable::generateTiltLookupTable() { +void RenderTable::setPanoramaFoV(float fov) { + assert(fov > 0.0f); + _panoramaOptions.fieldOfView = fov; +} + +void RenderTable::setPanoramaScale(float scale) { + assert(scale > 0.0f); + + _panoramaOptions.linearScale = scale; } } // End of namespace ZVision diff --git a/engines/zvision/render_table.h b/engines/zvision/render_table.h index a48e608db8..5698feaa03 100644 --- a/engines/zvision/render_table.h +++ b/engines/zvision/render_table.h @@ -64,6 +64,9 @@ public: void mutateImage(uint16 *sourceBuffer, uint16* destBuffer, uint32 imageWidth, uint32 imageHeight, Common::Rect subRectangle, Common::Rect destRectangle); void generateRenderTable(); + void setPanoramaFoV(float fov); + void setPanoramaScale(float scale); + private: void generatePanoramaLookupTable(); void generateTiltLookupTable(); -- cgit v1.2.3