Raytracing: Moved default light to the template

This commit is contained in:
Yorik van Havre 2013-09-19 18:13:52 -03:00
parent 0a8c44ea09
commit 711708011d
3 changed files with 25 additions and 19 deletions

View File

@ -80,13 +80,7 @@ std::string PovTools::getCamera(const CamDef& Cam)
<< " look_at cam_look_at" << endl
<< " sky cam_sky" << endl
<< " angle cam_angle " << endl
<< "}"<< endl
// default light
<< "//default light" << endl
<< "light_source {" << endl
<< " cam_location + cam_angle * 100 // light's position" << endl
<< " color rgb <10, 10, 10> // light's color" << endl
<< "}" << endl ;
<< "}"<< endl;
return out.str();
}

View File

@ -71,18 +71,22 @@ App::DocumentObjectExecReturn *RayProject::execute(void)
// copy the input of the resource file
while (!file.eof()) {
getline (file,line);
ofile << line << endl;
}
ofile << Camera.getValue();
// get through the children and collect all the views
const std::vector<App::DocumentObject*> &Grp = Group.getValues();
for (std::vector<App::DocumentObject*>::const_iterator It= Grp.begin();It!=Grp.end();++It) {
if ((*It)->getTypeId().isDerivedFrom(Raytracing::RayFeature::getClassTypeId())) {
Raytracing::RayFeature *View = dynamic_cast<Raytracing::RayFeature *>(*It);
ofile << View->Result.getValue();
ofile << endl << endl << endl;
// check if the marker in the template is found
if(line.find("//RaytracingContent") == string::npos)
// if not - write through
ofile << line << endl;
else {
ofile << Camera.getValue();
// get through the children and collect all the views
const std::vector<App::DocumentObject*> &Grp = Group.getValues();
for (std::vector<App::DocumentObject*>::const_iterator It= Grp.begin();It!=Grp.end();++It) {
if ((*It)->getTypeId().isDerivedFrom(Raytracing::RayFeature::getClassTypeId())) {
Raytracing::RayFeature *View = dynamic_cast<Raytracing::RayFeature *>(*It);
ofile << View->Result.getValue();
ofile << endl << endl << endl;
}
}
}
}

View File

@ -43,3 +43,11 @@ plane {
//#declare StdFinish = finish { crand 0.5 phong 0.9};
#declare StdFinish = finish { ambient 0.01 diffuse 0.9 phong 1.0 phong_size 70 metallic brilliance 1.5} ;
//RaytracingContent
//default light
light_source {
cam_location + cam_angle * 100
color rgb <10, 10, 10>
}