diff --git a/src/Mod/Raytracing/App/PovTools.cpp b/src/Mod/Raytracing/App/PovTools.cpp index 0c2c84ab7..527ca3629 100644 --- a/src/Mod/Raytracing/App/PovTools.cpp +++ b/src/Mod/Raytracing/App/PovTools.cpp @@ -57,7 +57,7 @@ using namespace std; // angle 45 //} -std::string PovTools::getCamera(const CamDef& Cam) +std::string PovTools::getCamera(const CamDef& Cam, int width, int height) { std::stringstream out; out << "// declares positon and view direction\n" << endl @@ -80,6 +80,7 @@ std::string PovTools::getCamera(const CamDef& Cam) << " look_at cam_look_at" << endl << " sky cam_sky" << endl << " angle cam_angle " << endl + << " right x*" << width << "/" << height << endl << "}"<< endl; return out.str(); } diff --git a/src/Mod/Raytracing/App/PovTools.h b/src/Mod/Raytracing/App/PovTools.h index b1f469432..85ea5f3c9 100644 --- a/src/Mod/Raytracing/App/PovTools.h +++ b/src/Mod/Raytracing/App/PovTools.h @@ -75,7 +75,9 @@ class AppRaytracingExport PovTools { public: /// returns the given camera position as povray defines in a file - static std::string getCamera(const CamDef& Cam); + static std::string getCamera(const CamDef& Cam, + int width=800, + int height=600); /// writes the given camera position as povray defines in a file static void writeCamera(const char* FileName, diff --git a/src/Mod/Raytracing/Gui/AppRaytracingGuiPy.cpp b/src/Mod/Raytracing/Gui/AppRaytracingGuiPy.cpp index dc816ad19..62b8692cb 100644 --- a/src/Mod/Raytracing/Gui/AppRaytracingGuiPy.cpp +++ b/src/Mod/Raytracing/Gui/AppRaytracingGuiPy.cpp @@ -130,8 +130,13 @@ povViewCamera(PyObject *self, PyObject *args) gp_Vec gpLookAt(lookat.getValue()[0],lookat.getValue()[1],lookat.getValue()[2]); gp_Vec gpUp(upvec.getValue()[0],upvec.getValue()[1],upvec.getValue()[2]); + // getting image format + ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Raytracing"); + int width = hGrp->GetInt("OutputWidth", 800); + int height = hGrp->GetInt("OutputHeight", 600); + // call the write method of PovTools.... - out = PovTools::getCamera(CamDef(gpPos,gpDir,gpLookAt,gpUp)); + out = PovTools::getCamera(CamDef(gpPos,gpDir,gpLookAt,gpUp),width,height); return Py::new_reference_to(Py::String(out)); } PY_CATCH;