Merge branch 'master' into master
This commit is contained in:
@@ -24,7 +24,9 @@
|
||||
|
||||
#ifndef _PreComp_
|
||||
# include <Standard.hxx>
|
||||
# include <iosfwd>
|
||||
# include <string>
|
||||
# include <vector>
|
||||
#endif
|
||||
|
||||
#include <App/Application.h>
|
||||
@@ -58,7 +60,7 @@ void LuxProject::onDocumentRestored()
|
||||
Base::FileInfo fi(Template.getValue());
|
||||
if (fi.fileName().empty())
|
||||
fi.setFile(PageResult.getValue());
|
||||
std::string path = App::Application::getResourceDir() + "Mod/Raytracing/Templates/" + fi.fileName();
|
||||
string path = App::Application::getResourceDir() + "Mod/Raytracing/Templates/" + fi.fileName();
|
||||
// try to find the template in user dir/Templates first
|
||||
Base::FileInfo tempfi(App::Application::getUserAppDataDir() + "data/Mod/Raytracing/Templates/" + fi.fileName());
|
||||
if (tempfi.exists())
|
||||
@@ -69,18 +71,18 @@ void LuxProject::onDocumentRestored()
|
||||
|
||||
App::DocumentObjectExecReturn *LuxProject::execute(void)
|
||||
{
|
||||
if (std::string(PageResult.getValue()).empty())
|
||||
if (string(PageResult.getValue()).empty())
|
||||
PageResult.setValue(Template.getValue());
|
||||
|
||||
Base::FileInfo fi(Template.getValue());
|
||||
if (!fi.isReadable()) {
|
||||
Base::Console().Log("LuxProject::execute() not able to open %s!\n",Template.getValue());
|
||||
std::string error = std::string("Cannot open file ") + Template.getValue();
|
||||
string error = string("Cannot open file ") + Template.getValue();
|
||||
return new App::DocumentObjectExecReturn(error);
|
||||
}
|
||||
// open Template file
|
||||
string line;
|
||||
ifstream file ( fi.filePath().c_str() );
|
||||
ifstream file (fi.filePath().c_str());
|
||||
|
||||
// make a temp file for FileIncluded Property
|
||||
string tempName = PageResult.getExchangeTempFile();
|
||||
@@ -101,8 +103,8 @@ App::DocumentObjectExecReturn *LuxProject::execute(void)
|
||||
// get through the children and collect all the views
|
||||
ofile << "# declares FreeCAD objects" << endl
|
||||
<< "# Generated by FreeCAD (http://www.freecadweb.org/)" << endl << endl;
|
||||
const std::vector<App::DocumentObject*> &Grp = Group.getValues();
|
||||
for (std::vector<App::DocumentObject*>::const_iterator It= Grp.begin();It!=Grp.end();++It) {
|
||||
const vector<App::DocumentObject*> &Grp = Group.getValues();
|
||||
for (vector<App::DocumentObject*>::const_iterator It= Grp.begin();It!=Grp.end();++It) {
|
||||
if ((*It)->getTypeId().isDerivedFrom(Raytracing::RaySegment::getClassTypeId())) {
|
||||
Raytracing::RaySegment *View = static_cast<Raytracing::RaySegment *>(*It);
|
||||
ofile << View->Result.getValue();
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
# include <TopExp_Explorer.hxx>
|
||||
# include <TopoDS.hxx>
|
||||
# include <TopoDS_Face.hxx>
|
||||
|
||||
#endif
|
||||
|
||||
#include <Base/Console.h>
|
||||
@@ -41,22 +40,21 @@
|
||||
|
||||
|
||||
using Base::Console;
|
||||
|
||||
using namespace Raytracing;
|
||||
using namespace std;
|
||||
|
||||
std::string LuxTools::getCamera(const CamDef& Cam)
|
||||
{
|
||||
std::stringstream out;
|
||||
out << "# declares position and view direction" << endl
|
||||
<< "# Generated by FreeCAD (http://www.freecadweb.org/)" << endl
|
||||
out << "# declares position and view direction" << std::endl
|
||||
<< "# Generated by FreeCAD (http://www.freecadweb.org/)"
|
||||
<< std::endl
|
||||
|
||||
// writing Camera positions
|
||||
<< "LookAt " << Cam.CamPos.X() << " " << Cam.CamPos.Y() << " " << Cam.CamPos.Z() << " "
|
||||
// writing lookat
|
||||
<< Cam.LookAt.X() << " " << Cam.LookAt.Y() << " " << Cam.LookAt.Z() << " "
|
||||
// writing the Up Vector
|
||||
<< Cam.Up.X() << " " << Cam.Up.Y() << " " << Cam.Up.Z() << endl;
|
||||
<< Cam.Up.X() << " " << Cam.Up.Y() << " " << Cam.Up.Z() << std::endl;
|
||||
|
||||
return out.str();
|
||||
}
|
||||
@@ -74,10 +72,10 @@ void LuxTools::writeShape(std::ostream &out, const char *PartName, const TopoDS_
|
||||
Base::SequencerLauncher seq("Writing file", l);
|
||||
|
||||
// write object
|
||||
out << "AttributeBegin # \"" << PartName << "\"" << endl;
|
||||
out << "Transform [1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1]" << endl;
|
||||
out << "NamedMaterial \"FreeCADMaterial_" << PartName << "\"" << endl;
|
||||
out << "Shape \"mesh\"" << endl;
|
||||
out << "AttributeBegin # \"" << PartName << "\"" << std::endl;
|
||||
out << "Transform [1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1]" << std::endl;
|
||||
out << "NamedMaterial \"FreeCADMaterial_" << PartName << "\"" << std::endl;
|
||||
out << "Shape \"mesh\"" << std::endl;
|
||||
|
||||
// gather vertices, normals and face indices
|
||||
std::stringstream triindices;
|
||||
@@ -124,10 +122,10 @@ void LuxTools::writeShape(std::ostream &out, const char *PartName, const TopoDS_
|
||||
} // end of face loop
|
||||
|
||||
// write mesh data
|
||||
out << " \"integer triindices\" [" << triindices.str() << "]" << endl;
|
||||
out << " \"point P\" [" << P.str() << "]" << endl;
|
||||
out << " \"normal N\" [" << N.str() << "]" << endl;
|
||||
out << " \"bool generatetangents\" [\"false\"]" << endl;
|
||||
out << " \"string name\" [\"" << PartName << "\"]" << endl;
|
||||
out << "AttributeEnd # \"\"" << endl;
|
||||
out << " \"integer triindices\" [" << triindices.str() << "]" << std::endl;
|
||||
out << " \"point P\" [" << P.str() << "]" << std::endl;
|
||||
out << " \"normal N\" [" << N.str() << "]" << std::endl;
|
||||
out << " \"bool generatetangents\" [\"false\"]" << std::endl;
|
||||
out << " \"string name\" [\"" << PartName << "\"]" << std::endl;
|
||||
out << "AttributeEnd # \"\"" << std::endl;
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#ifdef _PreComp_
|
||||
|
||||
// STL
|
||||
#include <iosfwd>
|
||||
#include <sstream>
|
||||
#include <vector>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user