Raytracing: Added function to rescale a luxrender matrix

This commit is contained in:
Yorik van Havre
2013-09-25 18:26:04 -03:00
parent bfea93d618
commit 41b423351f
3 changed files with 36 additions and 2 deletions

View File

@@ -37,7 +37,9 @@
#include <Base/Console.h>
#include <Base/Exception.h>
#include <Base/Sequencer.h>
#include <Base/Matrix.h>
#include <App/ComplexGeoData.h>
#include <boost/regex.hpp>
#include "PovTools.h"
@@ -135,3 +137,19 @@ void LuxTools::writeShape(std::ostream &out, const char *PartName, const TopoDS_
out << " \"string name\" [\"" << PartName << "\"]" << endl;
out << "AttributeEnd # \"\"" << endl;
}
std::string LuxTools::rescaleMatrix(std::string mat, float factor)
{
// clean the input string
std::string matstring = mat.substr(11);
unsigned pos = matstring.find("]");
matstring = matstring.substr(0,pos);
// create a matrix and rescale it
Base::Matrix4D trans;
trans.fromString(matstring);
trans.scale(factor,factor,factor);
// create output
std::stringstream result;
result << "Transform [" << trans.toString() << "]" << endl;
return result.str();
}