YafaRay Core  v3.2.0-ALPHA-10-g60452c5
environment.cc
Go to the documentation of this file.
1 /****************************************************************************
2  *
3  * environment.cc: Yafray environment for plugin loading and
4  * object instatiation
5  * This is part of the yafray package
6  * Copyright (C) 2005 Alejandro Conty Estévez, Mathias Wein
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21  *
22  */
23 
24 #include <core_api/environment.h>
25 
26 #ifdef _WIN32
27  #include <io.h>
28  #include <windows.h>
29 #endif
30 
31 #include <boost/filesystem.hpp>
32 
33 #include <core_api/light.h>
34 #include <core_api/material.h>
35 #include <core_api/integrator.h>
36 #include <core_api/texture.h>
37 #include <core_api/background.h>
38 #include <core_api/camera.h>
39 #include <core_api/shader.h>
40 #include <core_api/imagefilm.h>
41 #include <core_api/imagehandler.h>
42 #include <core_api/object3d.h>
43 #include <core_api/volume.h>
45 #include <string>
46 #include <sstream>
47 
48 
50 #define ENV_TAG << "Environment: "
51 #define Y_INFO_ENV Y_INFO ENV_TAG
52 #define Y_VERBOSE_ENV Y_VERBOSE ENV_TAG
53 #define Y_ERROR_ENV Y_ERROR ENV_TAG
54 #define Y_WARN_ENV Y_WARNING ENV_TAG
55 
56 #define WarnExist Y_WARN_ENV << "Sorry, " << pname << " \"" << name << "\" already exists!" << yendl
57 
58 #define ErrNoType Y_ERROR_ENV << pname << " type not specified for \"" << name << "\" node!" << yendl
59 #define ErrUnkType(t) Y_ERROR_ENV << "Don't know how to create " << pname << " of type '" << t << "'!" << yendl
60 #define ErrOnCreate(t) Y_ERROR_ENV << "No " << pname << " was constructed by plugin '" << t << "'!" << yendl
61 
62 #define InfoSuccess(name, t) Y_INFO_ENV << "Added " << pname << " '"<< name << "' (" << t << ")!" << yendl
63 #define InfoSuccessDisabled(name, t) Y_INFO_ENV << "Added " << pname << " '"<< name << "' (" << t << ")! [DISABLED]" << yendl
64 
65 #define SuccessReg(t, name) Y_INFO_ENV << "Registered " << t << " type '" << name << "'" << yendl
66 
67 #define InfoVerboseSuccess(name, t) Y_VERBOSE_ENV << "Added " << pname << " '"<< name << "' (" << t << ")!" << yendl
68 #define InfoVerboseSuccessDisabled(name, t) Y_VERBOSE_ENV << "Added " << pname << " '"<< name << "' (" << t << ")! [DISABLED]" << yendl
69 
70 #define SuccessVerboseReg(t, name) Y_VERBOSE_ENV << "Registered " << t << " type '" << name << "'" << yendl
71 
73 {
74  Y_INFO << PACKAGE << " Core (" << session.getYafaRayCoreVersion() << ")" << " " << sysInfoGetOS() << sysInfoGetArchitecture() << sysInfoGetPlatform() << sysInfoGetCompiler() << yendl;
75  object_factory["sphere"] = sphere_factory;
76  output2 = nullptr;
77  session.setDifferentialRaysEnabled(false); //By default, disable ray differential calculations. Only if at least one texture uses them, then enable differentials.
78 
79 #ifndef HAVE_OPENCV
80  Y_WARNING << PACKAGE << " built without OpenCV support. The following functionality will not work: image output denoise, background IBL blur, object/face edge render passes, toon render pass." << yendl;
81 #endif
82 }
83 
84 template <class T>
85 void freeMap(std::map< std::string, T* > &map)
86 {
87  for(auto i=map.begin(); i!=map.end(); ++i) delete i->second;
88 }
89 
91 {
101 }
102 
104 {
115 
116  light_table.clear();
117  texture_table.clear();
118  material_table.clear();
119  object_table.clear();
120  camera_table.clear();
121  background_table.clear();
122  integrator_table.clear();
123  volume_table.clear();
124  volumeregion_table.clear();
125  imagehandler_table.clear();
126 }
127 
128 void renderEnvironment_t::loadPlugins(const std::string &path)
129 {
130  typedef void (reg_t)(renderEnvironment_t &);
131  Y_INFO_ENV << "Loading plugins ..." << yendl;
132  std::list<std::string> plugins=listDir(path);
133 
134  for(auto i=plugins.begin();i!=plugins.end();++i)
135  {
136  sharedlibrary_t plug(i->c_str());
137  if(!plug.isOpen()) continue;
138  reg_t *registerPlugin;
139  registerPlugin=(reg_t *)plug.getSymbol("registerPlugin");
140  if(registerPlugin==nullptr) continue;
141  registerPlugin(*this);
142  pluginHandlers.push_back(plug);
143  }
144 }
145 
146 bool renderEnvironment_t::getPluginPath(std::string &path)
147 {
148  // Steps to find the plugins path.
149 
150  // First check if the plugins path has been manually set and if it exists:
151  if(!path.empty())
152  {
153  if(boost::filesystem::exists( path ))
154  {
155  Y_VERBOSE_ENV << "Plugins path found: '" << path << "'" << yendl;
156  return true;
157  }
158  else
159  {
160  Y_VERBOSE_ENV << "Plugins path NOT found in '" << path << "'" << yendl;
161  }
162  }
163 
164  // If the previous check does not work, check if the plugins path is in a subfolder of the currently executed file. This only works if the executable is executed with the full path, as this will not search for the executable in the search paths.
165  path = session.getPathYafaRayXml()+"/yafaray-plugins/";
166  if ( boost::filesystem::exists( path ) )
167  {
168  Y_VERBOSE_ENV << "Plugins path found: '" << path << "'" << yendl;
169  return true;
170  }
171  else
172  {
173  Y_VERBOSE_ENV << "Plugins path NOT found in '" << path << "'" << yendl;
174  }
175 
176  // If the previous check does not work, check if the plugins path is in a "lib" subfolder of the parent of the currently executed file. This only works if the executable is executed with the full path, as this will not search for the executable in the search paths.
177  path = session.getPathYafaRayXml()+"/../lib/yafaray-plugins/";
178  if ( boost::filesystem::exists( path ) )
179  {
180  Y_VERBOSE_ENV << "Plugins path found: '" << path << "'" << yendl;
181  return true;
182  }
183  else
184  {
185  Y_VERBOSE_ENV << "Plugins path NOT found in '" << path << "'" << yendl;
186  }
187 
188  // If the previous checks do not work, check if the plugins path is in the plugins search directory defined in CMake during the building process
189  path = std::string(YAF_RUNTIME_SEARCH_PLUGIN_DIR);
190  if ( boost::filesystem::exists( path ) )
191  {
192  Y_VERBOSE_ENV << "Plugins path found: '" << path << "'" << yendl;
193  return true;
194  }
195  else
196  {
197  Y_VERBOSE_ENV << "Plugins path NOT found in '" << path << "'" << yendl;
198  }
199 
200 return false;
201 }
202 
203 
204 material_t* renderEnvironment_t::getMaterial(const std::string &name)const
205 {
206  auto i=material_table.find(name);
207  if(i!=material_table.end()) return i->second;
208  else return nullptr;
209 }
210 
211 texture_t* renderEnvironment_t::getTexture(const std::string &name)const
212 {
213  auto i=texture_table.find(name);
214  if(i!=texture_table.end()) return i->second;
215  else return nullptr;
216 }
217 
218 camera_t* renderEnvironment_t::getCamera(const std::string &name)const
219 {
220  auto i=camera_table.find(name);
221  if(i!=camera_table.end()) return i->second;
222  else return nullptr;
223 }
224 
225 background_t* renderEnvironment_t::getBackground(const std::string &name)const
226 {
227  auto i=background_table.find(name);
228  if(i!=background_table.end()) return i->second;
229  else return nullptr;
230 }
231 
232 integrator_t* renderEnvironment_t::getIntegrator(const std::string &name)const
233 {
234  auto i=integrator_table.find(name);
235  if(i!=integrator_table.end()) return i->second;
236  else return nullptr;
237 }
238 
239 shaderNode_t* renderEnvironment_t::getShaderNode(const std::string &name)const
240 {
241  auto i=shader_table.find(name);
242  if(i!=shader_table.end()) return i->second;
243  else return nullptr;
244 }
245 
246 light_t* renderEnvironment_t::createLight(const std::string &name, paraMap_t &params)
247 {
248  std::string pname = "Light";
249  if(light_table.find(name) != light_table.end() )
250  {
251  WarnExist; return nullptr;
252  }
253  std::string type;
254  if(! params.getParam("type", type) )
255  {
256  ErrNoType; return nullptr;
257  }
258  light_t* light;
259  auto i=light_factory.find(type);
260  if(i!=light_factory.end()) light = i->second(params,*this);
261  else
262  {
263  ErrUnkType(type); return nullptr;
264  }
265  if(light)
266  {
267  light_table[name] = light;
268 
269  if(light->lightEnabled()) InfoVerboseSuccess(name, type);
270  else InfoVerboseSuccessDisabled(name, type);
271 
272  return light;
273  }
274  ErrOnCreate(type);
275  return nullptr;
276 }
277 
278 texture_t* renderEnvironment_t::createTexture(const std::string &name, paraMap_t &params)
279 {
280  std::string pname = "Texture";
281  if(texture_table.find(name) != texture_table.end() )
282  {
283  WarnExist; return nullptr;
284  }
285  std::string type;
286  if(! params.getParam("type", type) )
287  {
288  ErrNoType; return nullptr;
289  }
290  texture_t* texture;
291  auto i=texture_factory.find(type);
292  if(i!=texture_factory.end()) texture = i->second(params,*this);
293  else
294  {
295  ErrUnkType(type); return nullptr;
296  }
297  if(texture)
298  {
299  texture_table[name] = texture;
300  InfoVerboseSuccess(name, type);
301  return texture;
302  }
303  ErrOnCreate(type);
304  return nullptr;
305 }
306 
308 {
309  std::string pname = "ShaderNode";
310  if(shader_table.find(name) != shader_table.end() )
311  {
312  WarnExist; return nullptr;
313  }
314  std::string type;
315  if(! params.getParam("type", type) )
316  {
317  ErrNoType; return nullptr;
318  }
319  shaderNode_t* shader;
320  auto i=shader_factory.find(type);
321  if(i!=shader_factory.end()) shader = i->second(params,*this);
322  else
323  {
324  ErrUnkType(type); return nullptr;
325  }
326  if(shader)
327  {
328  shader_table[name] = shader;
329  InfoVerboseSuccess(name, type);
330  return shader;
331  }
332  ErrOnCreate(type);
333  return nullptr;
334 }
335 
336 material_t* renderEnvironment_t::createMaterial(const std::string &name, paraMap_t &params, std::list<paraMap_t> &eparams)
337 {
338  std::string pname = "Material";
339  if(material_table.find(name) != material_table.end() )
340  {
341  WarnExist; return nullptr;
342  }
343  std::string type;
344  if(! params.getParam("type", type) )
345  {
346  ErrNoType; return nullptr;
347  }
348  params["name"] = name;
349  material_t* material;
350  auto i=material_factory.find(type);
351  if(i!=material_factory.end()) material = i->second(params, eparams, *this);
352  else
353  {
354  ErrUnkType(type); return nullptr;
355  }
356  if(material)
357  {
358  material_table[name] = material;
359  InfoVerboseSuccess(name, type);
360  return material;
361  }
362  ErrOnCreate(type);
363  return nullptr;
364 }
365 
367 {
368  std::string pname = "Background";
369  if(background_table.find(name) != background_table.end() )
370  {
371  WarnExist; return nullptr;
372  }
373  std::string type;
374  if(! params.getParam("type", type) )
375  {
376  ErrNoType; return nullptr;
377  }
378  background_t* background;
379  auto i=background_factory.find(type);
380  if(i!=background_factory.end()) background = i->second(params,*this);
381  else
382  {
383  ErrUnkType(type); return nullptr;
384  }
385  if(background)
386  {
387  background_table[name] = background;
388  InfoVerboseSuccess(name, type);
389  return background;
390  }
391  ErrOnCreate(type);
392  return nullptr;
393 }
394 
395 imageHandler_t* renderEnvironment_t::createImageHandler(const std::string &name, paraMap_t &params, bool addToTable)
396 {
397  std::string pname = "ImageHandler";
398  std::stringstream newname;
399  int sufixCount = 0;
400 
401  newname << name;
402 
403  if(addToTable)
404  {
405  while(true)
406  {
407  if(imagehandler_table.find(newname.str()) != imagehandler_table.end() )
408  {
409  newname.seekg(0, std::ios::beg);
410  newname << name << ".";
411  newname.width(3);
412  newname.fill('0');
413  newname.flags(std::ios::right);
414  newname << sufixCount;
415  sufixCount++;
416  }
417  else break;
418  }
419  }
420 
421  std::string type;
422 
423  if(! params.getParam("type", type) )
424  {
425  ErrNoType; return nullptr;
426  }
427 
428  imageHandler_t* ih = nullptr;
429  auto i=imagehandler_factory.find(type);
430 
431  if(i!=imagehandler_factory.end())
432  {
433  ih = i->second(params,*this);
434  }
435  else
436  {
437  ErrUnkType(type); return nullptr;
438  }
439 
440  if(ih)
441  {
442  if(addToTable) imagehandler_table[newname.str()] = ih;
443 
444  InfoVerboseSuccess(newname.str(), type);
445 
446  return ih;
447  }
448 
449  ErrOnCreate(type);
450 
451  return nullptr;
452 }
453 
454 object3d_t* renderEnvironment_t::createObject(const std::string &name, paraMap_t &params)
455 {
456  std::string pname = "Object";
457  if(object_table.find(name) != object_table.end() )
458  {
459  WarnExist; return nullptr;
460  }
461  std::string type;
462  if(! params.getParam("type", type) )
463  {
464  ErrNoType; return nullptr;
465  }
466  object3d_t* object;
467  auto i=object_factory.find(type);
468  if(i!=object_factory.end()) object = i->second(params,*this);
469  else
470  {
471  ErrUnkType(type); return nullptr;
472  }
473  if(object)
474  {
475  object_table[name] = object;
476  InfoVerboseSuccess(name, type);
477  return object;
478  }
479  ErrOnCreate(type);
480  return nullptr;
481 }
482 
483 camera_t* renderEnvironment_t::createCamera(const std::string &name, paraMap_t &params)
484 {
485  std::string pname = "Camera";
486  if(camera_table.find(name) != camera_table.end() )
487  {
488  WarnExist; return nullptr;
489  }
490  std::string type;
491  if(! params.getParam("type", type) )
492  {
493  ErrNoType; return nullptr;
494  }
495  camera_t* camera;
496  auto i=camera_factory.find(type);
497  if(i!=camera_factory.end()) camera = i->second(params,*this);
498  else
499  {
500  ErrUnkType(type); return nullptr;
501  }
502  if(camera)
503  {
504  camera_table[name] = camera;
505  InfoVerboseSuccess(name, type);
506  int viewNumber = renderPasses.view_names.size();
507  camera->set_camera_name(name);
508  renderPasses.view_names.push_back(camera->get_view_name());
509 
510  Y_INFO << "Environment: View number=" << viewNumber << ", view name: '" << renderPasses.view_names[viewNumber] << "', camera name: '" << camera->get_camera_name() << "'" << yendl;
511 
512  return camera;
513  }
514  ErrOnCreate(type);
515  return nullptr;
516 }
517 
519 {
520  std::string pname = "Integrator";
521  if(integrator_table.find(name) != integrator_table.end() )
522  {
523  WarnExist; return nullptr;
524  }
525  std::string type;
526  if(! params.getParam("type", type) )
527  {
528  ErrNoType; return nullptr;
529  }
530  integrator_t* integrator;
531  auto i=integrator_factory.find(type);
532  if(i!=integrator_factory.end()) integrator = i->second(params,*this);
533  else
534  {
535  ErrUnkType(type); return nullptr;
536  }
537  if(integrator)
538  {
539  integrator_table[name] = integrator;
540  InfoVerboseSuccess(name, type);
541  if(type == "bidirectional") Y_WARNING << "The Bidirectional integrator is DEPRECATED. It might give unexpected and perhaps even incorrect render results. This integrator is no longer supported, will not receive any fixes/updates in the short/medium term and might be removed in future versions. Use at your own risk." << yendl;
542  return integrator;
543  }
544  ErrOnCreate(type);
545  return nullptr;
546 }
547 
549 {
550  std::string externalPass, internalPass;
551  int pass_mask_obj_index = 0, pass_mask_mat_index = 0;
552  bool pass_mask_invert = false;
553  bool pass_mask_only = false;
554 
555  color_t toonEdgeColor(0.f);
556  int objectEdgeThickness = 2;
557  float objectEdgeThreshold = 0.3f;
558  float objectEdgeSmoothness = 0.75f;
559  float toonPreSmooth = 3.f;
560  float toonQuantization = 0.1f;
561  float toonPostSmooth = 3.f;
562  int facesEdgeThickness = 1;
563  float facesEdgeThreshold = 0.01f;
564  float facesEdgeSmoothness = 0.5f;
565 
566  params.getParam("pass_mask_obj_index", pass_mask_obj_index);
567  params.getParam("pass_mask_mat_index", pass_mask_mat_index);
568  params.getParam("pass_mask_invert", pass_mask_invert);
569  params.getParam("pass_mask_only", pass_mask_only);
570 
571  params.getParam("toonEdgeColor", toonEdgeColor);
572  params.getParam("objectEdgeThickness", objectEdgeThickness);
573  params.getParam("objectEdgeThreshold", objectEdgeThreshold);
574  params.getParam("objectEdgeSmoothness", objectEdgeSmoothness);
575  params.getParam("toonPreSmooth", toonPreSmooth);
576  params.getParam("toonQuantization", toonQuantization);
577  params.getParam("toonPostSmooth", toonPostSmooth);
578  params.getParam("facesEdgeThickness", facesEdgeThickness);
579  params.getParam("facesEdgeThreshold", facesEdgeThreshold);
580  params.getParam("facesEdgeSmoothness", facesEdgeSmoothness);
581 
582  //Adding the render passes and associating them to the internal YafaRay pass defined in the Blender Exporter "pass_xxx" parameters.
583  for(auto it = renderPasses.extPassMapIntString.begin(); it != renderPasses.extPassMapIntString.end(); ++it)
584  {
585  internalPass = "";
586  externalPass = it->second;
587  params.getParam("pass_" + externalPass, internalPass);
588  if(internalPass != "disabled" && internalPass != "") renderPasses.extPass_add(externalPass, internalPass);
589  }
590 
591  //Generate any necessary auxiliar render passes
593 
594  renderPasses.set_pass_mask_obj_index((float) pass_mask_obj_index);
595  renderPasses.set_pass_mask_mat_index((float) pass_mask_mat_index);
596  renderPasses.set_pass_mask_invert(pass_mask_invert);
597  renderPasses.set_pass_mask_only(pass_mask_only);
598 
599  renderPasses.objectEdgeThickness = objectEdgeThickness;
600  renderPasses.objectEdgeThreshold = objectEdgeThreshold;
601  renderPasses.objectEdgeSmoothness = objectEdgeSmoothness;
602  renderPasses.toonPreSmooth = toonPreSmooth;
603  renderPasses.toonQuantization = toonQuantization;
604  renderPasses.toonPostSmooth = toonPostSmooth;
605  renderPasses.facesEdgeThickness = facesEdgeThickness;
606  renderPasses.facesEdgeThreshold = facesEdgeThreshold;
607  renderPasses.facesEdgeSmoothness = facesEdgeSmoothness;
608 
609  renderPasses.toonEdgeColor[0] = toonEdgeColor.R;
610  renderPasses.toonEdgeColor[1] = toonEdgeColor.G;
611  renderPasses.toonEdgeColor[2] = toonEdgeColor.B;
612 }
613 
615 {
616  const std::string *name=0;
617  const std::string *tiles_order=0;
618  int width=320, height=240, xstart=0, ystart=0;
619  std::string color_space_string = "Raw_Manual_Gamma";
620  colorSpaces_t color_space = RAW_MANUAL_GAMMA;
621  std::string color_space_string2 = "Raw_Manual_Gamma";
622  colorSpaces_t color_space2 = RAW_MANUAL_GAMMA;
623  float filt_sz = 1.5, gamma=1.f, gamma2=1.f;
624  bool showSampledPixels = false;
625  int tileSize = 32;
626  bool premult = false;
627  bool premult2 = false;
628  std::string images_autosave_interval_type_string = "none";
629  int images_autosave_interval_type = AUTOSAVE_NONE;
630  int images_autosave_interval_passes = 1;
631  double images_autosave_interval_seconds = 300.0;
632  std::string film_save_load_string = "none";
633  int film_save_load = FILM_FILE_NONE;
634  bool film_save_binary_format = true;
635  std::string film_autosave_interval_type_string = "none";
636  int film_autosave_interval_type = AUTOSAVE_NONE;
637  int film_autosave_interval_passes = 1;
638  double film_autosave_interval_seconds = 300.0;
639 
640  params.getParam("color_space", color_space_string);
641  params.getParam("gamma", gamma);
642  params.getParam("color_space2", color_space_string2);
643  params.getParam("gamma2", gamma2);
644  params.getParam("AA_pixelwidth", filt_sz);
645  params.getParam("width", width); // width of rendered image
646  params.getParam("height", height); // height of rendered image
647  params.getParam("xstart", xstart); // x-offset (for cropped rendering)
648  params.getParam("ystart", ystart); // y-offset (for cropped rendering)
649  params.getParam("filter_type", name); // AA filter type
650  params.getParam("show_sam_pix", showSampledPixels); // Show pixels marked to be resampled on adaptative sampling
651  params.getParam("tile_size", tileSize); // Size of the render buckets or tiles
652  params.getParam("tiles_order", tiles_order); // Order of the render buckets or tiles
653  params.getParam("premult", premult); // Premultipy Alpha channel for better alpha antialiasing against bg
654  params.getParam("premult2", premult2); // Premultipy Alpha channel for better alpha antialiasing against bg, for the optional secondary output
655  params.getParam("images_autosave_interval_type", images_autosave_interval_type_string);
656  params.getParam("images_autosave_interval_passes", images_autosave_interval_passes);
657  params.getParam("images_autosave_interval_seconds", images_autosave_interval_seconds);
658  params.getParam("film_save_load", film_save_load_string);
659  params.getParam("film_save_binary_format", film_save_binary_format); // If enabled, it will autosave the Image Film in binary format (faster, smaller, but not portable). Otherwise it will autosave in text format (portable but bigger and slower)
660  params.getParam("film_autosave_interval_type", film_autosave_interval_type_string);
661  params.getParam("film_autosave_interval_passes", film_autosave_interval_passes);
662  params.getParam("film_autosave_interval_seconds", film_autosave_interval_seconds);
663 
664  Y_DEBUG << "Images autosave: " << images_autosave_interval_type_string << ", " << images_autosave_interval_passes << ", " << images_autosave_interval_seconds << yendl;
665 
666  Y_DEBUG << "ImageFilm autosave: " << film_save_load_string << ", " << film_autosave_interval_type_string << ", " << film_autosave_interval_passes << ", " << film_autosave_interval_seconds << yendl;
667 
668  if(color_space_string == "sRGB") color_space = SRGB;
669  else if(color_space_string == "XYZ") color_space = XYZ_D65;
670  else if(color_space_string == "LinearRGB") color_space = LINEAR_RGB;
671  else if(color_space_string == "Raw_Manual_Gamma") color_space = RAW_MANUAL_GAMMA;
672  else color_space = SRGB;
673 
674  if(color_space_string2 == "sRGB") color_space2 = SRGB;
675  else if(color_space_string2 == "XYZ") color_space2 = XYZ_D65;
676  else if(color_space_string2 == "LinearRGB") color_space2 = LINEAR_RGB;
677  else if(color_space_string2 == "Raw_Manual_Gamma") color_space2 = RAW_MANUAL_GAMMA;
678  else color_space2 = SRGB;
679 
680  if(images_autosave_interval_type_string == "pass-interval") images_autosave_interval_type = AUTOSAVE_PASS_INTERVAL;
681  else if(images_autosave_interval_type_string == "time-interval") images_autosave_interval_type = AUTOSAVE_TIME_INTERVAL;
682  else images_autosave_interval_type = AUTOSAVE_NONE;
683 
684  if(film_save_load_string == "load-save") film_save_load = FILM_FILE_LOAD_SAVE;
685  else if(film_save_load_string == "save") film_save_load = FILM_FILE_SAVE;
686  else film_save_load = FILM_FILE_NONE;
687 
688  if(film_autosave_interval_type_string == "pass-interval") film_autosave_interval_type = AUTOSAVE_PASS_INTERVAL;
689  else if(film_autosave_interval_type_string == "time-interval") film_autosave_interval_type = AUTOSAVE_TIME_INTERVAL;
690  else film_autosave_interval_type = AUTOSAVE_NONE;
691 
693 
695  if(name)
696  {
697  if(*name == "mitchell") type = imageFilm_t::MITCHELL;
698  else if(*name == "gauss") type = imageFilm_t::GAUSS;
699  else if(*name == "lanczos") type = imageFilm_t::LANCZOS;
700  else type = imageFilm_t::BOX;
701  }
702  else Y_WARN_ENV << "No AA filter defined defaulting to Box!" << yendl;
703 
705  if(tiles_order)
706  {
707  if(*tiles_order == "linear") tilesOrder = imageSpliter_t::LINEAR;
708  else if(*tiles_order == "random") tilesOrder = imageSpliter_t::RANDOM;
709  else if(*tiles_order == "centre") tilesOrder = imageSpliter_t::CENTRE_RANDOM;
710  }
711  else Y_VERBOSE_ENV << "Defaulting to Centre tiles order." << yendl; // this is info imho not a warning
712 
713  imageFilm_t *film = new imageFilm_t(width, height, xstart, ystart, output, filt_sz, type, this, showSampledPixels, tileSize, tilesOrder, premult);
714 
715  if(color_space == RAW_MANUAL_GAMMA)
716  {
717  if(gamma > 0 && std::fabs(1.f-gamma) > 0.001) film->setColorSpace(color_space, gamma);
718  else film->setColorSpace(LINEAR_RGB, 1.f); //If the gamma is too close to 1.f, or negative, ignore gamma and do a pure linear RGB processing without gamma.
719  }
720  else film->setColorSpace(color_space, gamma);
721 
722  if(color_space2 == RAW_MANUAL_GAMMA)
723  {
724  if(gamma2 > 0 && std::fabs(1.f-gamma2) > 0.001) film->setColorSpace2(color_space2, gamma2);
725  else film->setColorSpace2(LINEAR_RGB, 1.f); //If the gamma is too close to 1.f, or negative, ignore gamma and do a pure linear RGB processing without gamma.
726  }
727  else film->setColorSpace2(color_space2, gamma2);
728 
729  film->setPremult2(premult2);
730 
731  film->setImagesAutoSaveIntervalType(images_autosave_interval_type);
732  film->setImagesAutoSaveIntervalSeconds(images_autosave_interval_seconds);
733  film->setImagesAutoSaveIntervalPasses(images_autosave_interval_passes);
734 
735  film->setFilmFileSaveLoad(film_save_load);
736  film->setFilmFileSaveBinaryFormat(film_save_binary_format);
737  film->setFilmAutoSaveIntervalType(film_autosave_interval_type);
738  film->setFilmAutoSaveIntervalSeconds(film_autosave_interval_seconds);
739  film->setFilmAutoSaveIntervalPasses(film_autosave_interval_passes);
740 
741  if(images_autosave_interval_type == AUTOSAVE_PASS_INTERVAL) Y_INFO_ENV << "AutoSave partially rendered image every " << images_autosave_interval_passes << " passes" << yendl;
742 
743  if(images_autosave_interval_type == AUTOSAVE_TIME_INTERVAL) Y_INFO_ENV << "AutoSave partially rendered image every " << images_autosave_interval_seconds << " seconds" << yendl;
744 
745  if(film_save_load != FILM_FILE_NONE && film_save_binary_format) Y_INFO_ENV << "Enabling imageFilm file saving feature in binary format (smaller, faster but not portable among systems)" << yendl;
746  if(film_save_load != FILM_FILE_NONE && !film_save_binary_format) Y_INFO_ENV << "Enabling imageFilm file saving in text format (portable among systems but bigger and slower)" << yendl;
747  if(film_save_load == FILM_FILE_LOAD_SAVE) Y_INFO_ENV << "Enabling imageFilm Loading feature. It will load and combine the ImageFilm files from the currently selected image output folder before start rendering, autodetecting each film format (binary/text) automatically. If they don't match exactly the scene, bad results could happen. Use WITH CARE!" << yendl;
748 
749  if(film_autosave_interval_type == AUTOSAVE_PASS_INTERVAL) Y_INFO_ENV << "AutoSave internal imageFilm every " << film_autosave_interval_passes << " passes" << yendl;
750 
751  if(film_autosave_interval_type == AUTOSAVE_TIME_INTERVAL) Y_INFO_ENV << "AutoSave internal imageFilm image every " << film_autosave_interval_seconds << " seconds" << yendl;
752 
753  return film;
754 }
755 
756 volumeHandler_t* renderEnvironment_t::createVolumeH(const std::string &name, const paraMap_t &params)
757 {
758  std::string pname = "VolumeHandler";
759  if(volume_table.find(name) != volume_table.end() )
760  {
761  WarnExist; return nullptr;
762  }
763  std::string type;
764  if(! params.getParam("type", type) )
765  {
766  ErrNoType; return nullptr;
767  }
768  volumeHandler_t* volume;
769  auto i=volume_factory.find(type);
770  if(i!=volume_factory.end()) volume = i->second(params,*this);
771  else
772  {
773  ErrUnkType(type); return nullptr;
774  }
775  if(volume)
776  {
777  volume_table[name] = volume;
778  InfoVerboseSuccess(name, type);
779  return volume;
780  }
781  ErrOnCreate(type);
782  return nullptr;
783 }
784 
786 {
787  std::string pname = "VolumeRegion";
788  if(volumeregion_table.find(name) != volumeregion_table.end() )
789  {
790  WarnExist; return nullptr;
791  }
792  std::string type;
793  if(! params.getParam("type", type) )
794  {
795  ErrNoType; return nullptr;
796  }
797  VolumeRegion* volumeregion;
798  auto i=volumeregion_factory.find(type);
799  if(i!=volumeregion_factory.end()) volumeregion = i->second(params,*this);
800  else
801  {
802  ErrUnkType(type); return nullptr;
803  }
804  if(volumeregion)
805  {
806  volumeregion_table[name] = volumeregion;
807  InfoVerboseSuccess(name, type);
808  return volumeregion;
809  }
810  ErrOnCreate(type);
811  return nullptr;
812 }
813 
815 {
816  bool logging_saveLog = false;
817  bool logging_saveHTML = false;
818  bool logging_drawRenderSettings = true;
819  bool logging_drawAANoiseSettings = true;
820  const std::string *logging_paramsBadgePosition = nullptr;
821  const std::string *logging_title = nullptr;
822  const std::string *logging_author = nullptr;
823  const std::string *logging_contact = nullptr;
824  const std::string *logging_comments = nullptr;
825  const std::string *logging_customIcon = nullptr;
826  const std::string *logging_fontPath = nullptr;
827  float logging_fontSizeFactor = 1.f;
828 
829  params.getParam("logging_paramsBadgePosition", logging_paramsBadgePosition);
830  params.getParam("logging_saveLog", logging_saveLog);
831  params.getParam("logging_saveHTML", logging_saveHTML);
832  params.getParam("logging_drawRenderSettings", logging_drawRenderSettings);
833  params.getParam("logging_drawAANoiseSettings", logging_drawAANoiseSettings);
834  params.getParam("logging_author", logging_author);
835  params.getParam("logging_title", logging_title);
836  params.getParam("logging_contact", logging_contact);
837  params.getParam("logging_comments", logging_comments);
838  params.getParam("logging_customIcon", logging_customIcon);
839  params.getParam("logging_fontPath", logging_fontPath);
840  params.getParam("logging_fontSizeFactor", logging_fontSizeFactor);
841 
842  yafLog.setSaveLog(logging_saveLog);
843  yafLog.setSaveHTML(logging_saveHTML);
844  yafLog.setDrawRenderSettings(logging_drawRenderSettings);
845  yafLog.setDrawAANoiseSettings(logging_drawAANoiseSettings);
846  if(logging_paramsBadgePosition) yafLog.setParamsBadgePosition(*logging_paramsBadgePosition);
847  if(logging_title) yafLog.setLoggingTitle(*logging_title);
848  if(logging_author) yafLog.setLoggingAuthor(*logging_author);
849  if(logging_contact) yafLog.setLoggingContact(*logging_contact);
850  if(logging_comments) yafLog.setLoggingComments(*logging_comments);
851  if(logging_customIcon) yafLog.setLoggingCustomIcon(*logging_customIcon);
852  if(logging_fontPath) yafLog.setLoggingFontPath(*logging_fontPath);
853  yafLog.setLoggingFontSizeFactor(logging_fontSizeFactor);
854 }
855 
862 {
863  const std::string *name=0;
864  int AA_passes=1, AA_samples=1, AA_inc_samples=1, nthreads=-1, nthreads_photons=-1;
865  double AA_threshold=0.05;
866  float AA_resampled_floor=0.f;
867  float AA_sample_multiplier_factor = 1.f;
868  float AA_light_sample_multiplier_factor = 1.f;
869  float AA_indirect_sample_multiplier_factor = 1.f;
870  bool AA_detect_color_noise = false;
871  std::string AA_dark_detection_type_string = "none";
872  int AA_dark_detection_type = DARK_DETECTION_NONE;
873  float AA_dark_threshold_factor = 0.f;
874  int AA_variance_edge_size = 10;
875  int AA_variance_pixels = 0;
876  float AA_clamp_samples = 0.f;
877  float AA_clamp_indirect = 0.f;
878 
879  bool adv_auto_shadow_bias_enabled=true;
880  float adv_shadow_bias_value=YAF_SHADOW_BIAS;
881  bool adv_auto_min_raydist_enabled=true;
882  float adv_min_raydist_value=MIN_RAYDIST;
883  int adv_base_sampling_offset = 0;
884  int adv_computer_node = 0;
885 
886  bool background_resampling = true; //If false, the background will not be resampled in subsequent adaptative AA passes
887 
888  if(! params.getParam("camera_name", name) )
889  {
890  Y_ERROR_ENV << "Specify a Camera!!" << yendl;
891  return false;
892  }
893 
894  if(!params.getParam("integrator_name", name) )
895  {
896  Y_ERROR_ENV << "Specify an Integrator!!" << yendl;
897  return false;
898  }
899 
900  integrator_t *inte = this->getIntegrator(*name);
901 
902  if(!inte)
903  {
904  Y_ERROR_ENV << "Specify an _existing_ Integrator!!" << yendl;
905  return false;
906  }
907 
909  {
910  Y_ERROR_ENV << "Integrator is no surface integrator!" << yendl;
911  return false;
912  }
913 
914  if(! params.getParam("volintegrator_name", name) )
915  {
916  Y_ERROR_ENV << "Specify a Volume Integrator!" << yendl;
917  return false;
918  }
919 
920  integrator_t *volInte = this->getIntegrator(*name);
921 
922  background_t *backg = nullptr;
923  if( params.getParam("background_name", name) )
924  {
925  backg = this->getBackground(*name);
926  if(!backg) Y_ERROR_ENV << "please specify an _existing_ Background!!" << yendl;
927  }
928 
929  params.getParam("AA_passes", AA_passes);
930  params.getParam("AA_minsamples", AA_samples);
931  AA_inc_samples = AA_samples;
932  params.getParam("AA_inc_samples", AA_inc_samples);
933  params.getParam("AA_threshold", AA_threshold);
934  params.getParam("AA_resampled_floor", AA_resampled_floor);
935  params.getParam("AA_sample_multiplier_factor", AA_sample_multiplier_factor);
936  params.getParam("AA_light_sample_multiplier_factor", AA_light_sample_multiplier_factor);
937  params.getParam("AA_indirect_sample_multiplier_factor", AA_indirect_sample_multiplier_factor);
938  params.getParam("AA_detect_color_noise", AA_detect_color_noise);
939  params.getParam("AA_dark_detection_type", AA_dark_detection_type_string);
940  params.getParam("AA_dark_threshold_factor", AA_dark_threshold_factor);
941  params.getParam("AA_variance_edge_size", AA_variance_edge_size);
942  params.getParam("AA_variance_pixels", AA_variance_pixels);
943  params.getParam("AA_clamp_samples", AA_clamp_samples);
944  params.getParam("AA_clamp_indirect", AA_clamp_indirect);
945  params.getParam("threads", nthreads); // number of threads, -1 = auto detection
946  params.getParam("background_resampling", background_resampling);
947 
948  nthreads_photons = nthreads; //if no "threads_photons" parameter exists, make "nthreads_photons" equal to render threads
949 
950  params.getParam("threads_photons", nthreads_photons); // number of threads for photon mapping, -1 = auto detection
951  params.getParam("adv_auto_shadow_bias_enabled", adv_auto_shadow_bias_enabled);
952  params.getParam("adv_shadow_bias_value", adv_shadow_bias_value);
953  params.getParam("adv_auto_min_raydist_enabled", adv_auto_min_raydist_enabled);
954  params.getParam("adv_min_raydist_value", adv_min_raydist_value);
955  params.getParam("adv_base_sampling_offset", adv_base_sampling_offset); //Base sampling offset, in case of multi-computer rendering each should have a different offset so they don't "repeat" the same samples (user configurable)
956  params.getParam("adv_computer_node", adv_computer_node); //Computer node in multi-computer render environments/render farms
957  imageFilm_t *film = createImageFilm(params, output);
958 
959  if (pb)
960  {
961  film->setProgressBar(pb);
962  inte->setProgressBar(pb);
963  }
964 
965  params.getParam("filter_type", name); // AA filter type
966 
967  std::stringstream aaSettings;
968  aaSettings << "AA Settings (" << ((name)?*name:"box") << "): Tile size=" << film->getTileSize();
969  yafLog.appendAANoiseSettings(aaSettings.str());
970 
971  if(AA_dark_detection_type_string == "linear") AA_dark_detection_type = DARK_DETECTION_LINEAR;
972  else if(AA_dark_detection_type_string == "curve") AA_dark_detection_type = DARK_DETECTION_CURVE;
973  else AA_dark_detection_type = DARK_DETECTION_NONE;
974 
975  //setup scene and render.
976  scene.setImageFilm(film);
978  scene.setVolIntegrator((volumeIntegrator_t*)volInte);
979  scene.setAntialiasing(AA_samples, AA_passes, AA_inc_samples, AA_threshold, AA_resampled_floor, AA_sample_multiplier_factor, AA_light_sample_multiplier_factor, AA_indirect_sample_multiplier_factor, AA_detect_color_noise, AA_dark_detection_type, AA_dark_threshold_factor, AA_variance_edge_size, AA_variance_pixels, AA_clamp_samples, AA_clamp_indirect);
980  scene.setNumThreads(nthreads);
981  scene.setNumThreadsPhotons(nthreads_photons);
982  if(backg) scene.setBackground(backg);
983  scene.shadowBiasAuto = adv_auto_shadow_bias_enabled;
984  scene.shadowBias = adv_shadow_bias_value;
985  scene.rayMinDistAuto = adv_auto_min_raydist_enabled;
986  scene.rayMinDist = adv_min_raydist_value;
987 
988  Y_DEBUG << "adv_base_sampling_offset="<<adv_base_sampling_offset<<yendl;
989  film->setBaseSamplingOffset(adv_base_sampling_offset);
990  film->setComputerNode(adv_computer_node);
991 
992  film->setBackgroundResampling(background_resampling);
993 
994  return true;
995 }
996 
998 {
999  light_factory[name]=f;
1000  SuccessVerboseReg("Light", name);
1001 }
1002 
1004 {
1005  material_factory[name]=f;
1006  SuccessVerboseReg("Material", name);
1007 }
1008 
1010 {
1011  texture_factory[name]=f;
1012  SuccessVerboseReg("Texture", name);
1013 }
1014 
1016 {
1017  shader_factory[name]=f;
1018  SuccessVerboseReg("ShaderNode", name);
1019 }
1020 
1022 {
1023  object_factory[name]=f;
1024  SuccessVerboseReg("Object", name);
1025 }
1026 
1028 {
1029  camera_factory[name]=f;
1030  SuccessVerboseReg("Camera", name);
1031 }
1032 
1034 {
1035  background_factory[name]=f;
1036  SuccessVerboseReg("Background", name);
1037 }
1038 
1040 {
1041  integrator_factory[name]=f;
1042  SuccessVerboseReg("Integrator", name);
1043 }
1044 
1046 {
1047  volume_factory[name]=f;
1048  SuccessVerboseReg("VolumetricHandler", name);
1049 }
1050 
1052 {
1053  volumeregion_factory[name]=f;
1054  SuccessVerboseReg("VolumeRegion", name);
1055 }
1056 
1057 void renderEnvironment_t::registerImageHandler(const std::string &name, const std::string &validExtensions, const std::string &fullName, imagehandler_factory_t *f)
1058 {
1059  imagehandler_factory[name] = f;
1060  imagehandler_fullnames[name] = fullName;
1061  imagehandler_extensions[name] = validExtensions;
1062  SuccessVerboseReg("ImageHandler", name);
1063 }
1064 
1065 std::vector<std::string> renderEnvironment_t::listImageHandlers()
1066 {
1067  std::vector<std::string> ret;
1068  if(imagehandler_fullnames.size() > 0)
1069  {
1070  for(auto i=imagehandler_fullnames.begin(); i != imagehandler_fullnames.end(); ++i)
1071  {
1072  ret.push_back(i->first);
1073  }
1074  }
1075  else Y_ERROR_ENV << "There is no image handlers registrered" << yendl;
1076 
1077  return ret;
1078 }
1079 
1081 {
1082  std::vector<std::string> ret;
1083  if(imagehandler_fullnames.size() > 0)
1084  {
1085  for(auto i=imagehandler_fullnames.begin(); i != imagehandler_fullnames.end(); ++i)
1086  {
1087  ret.push_back(i->second);
1088  }
1089  }
1090  else Y_ERROR_ENV << "There is no image handlers registrered" << yendl;
1091 
1092  return ret;
1093 }
1094 
1095 std::string renderEnvironment_t::getImageFormatFromFullName(const std::string &fullname)
1096 {
1097  std::string ret;
1098  if(imagehandler_fullnames.size() > 0)
1099  {
1100  for(auto i=imagehandler_fullnames.begin(); i != imagehandler_fullnames.end(); ++i)
1101  {
1102  if(i->second == fullname) ret = i->first;
1103  }
1104  }
1105  else Y_ERROR_ENV << "There is no image handlers registrered" << yendl;
1106 
1107  return ret;
1108 }
1109 
1110 std::string renderEnvironment_t::getImageFormatFromExtension(const std::string &ext)
1111 {
1112  std::string ret = "";
1113 
1114  if(ext == "" || ext == " ") return ret;
1115 
1116  if(imagehandler_extensions.size() > 0)
1117  {
1118  for(auto i=imagehandler_extensions.begin(); i != imagehandler_extensions.end(); ++i)
1119  {
1120  if(i->second.find(ext) != std::string::npos) ret = i->first;
1121  }
1122  }
1123  else Y_ERROR_ENV << "There is no image handlers registrered" << yendl;
1124 
1125  return ret;
1126 }
1127 
1128 std::string renderEnvironment_t::getImageFullNameFromFormat(const std::string &format)
1129 {
1130  std::string ret;
1131  if(imagehandler_fullnames.size() > 0)
1132  {
1133  for(auto i=imagehandler_fullnames.begin(); i != imagehandler_fullnames.end(); ++i)
1134  {
1135  if(i->first == format) ret = i->second;
1136  }
1137  }
1138  else Y_ERROR_ENV << "There is no image handlers registrered" << yendl;
1139 
1140  return ret;
1141 }
1142 
1144 {
1145  auto i=shader_factory.find(name);
1146  if(i!=shader_factory.end()) return i->second;
1147  Y_ERROR_ENV << "There is no factory for '"<<name<<"'\n";
1148  return nullptr;
1149 }
1150 
#define PACKAGE
std::vector< std::string > view_names
Definition: renderpasses.h:248
void setDrawAANoiseSettings(bool draw_noise_settings)
Definition: logging.h:90
bool lightEnabled() const
Enable/disable entire light source.
Definition: light.h:65
std::map< std::string, background_t * > background_table
Definition: environment.h:122
void appendAANoiseSettings(const std::string &aa_noise_settings)
Definition: logging.cc:355
void setDrawRenderSettings(bool draw_render_settings)
Definition: logging.h:91
virtual void registerFactory(const std::string &name, light_factory_t *f)
Definition: environment.cc:997
object3d_t * object_factory_t(paraMap_t &, renderEnvironment_t &)
Definition: environment.h:41
bool shadowBiasAuto
Definition: scene.h:212
background_t * getBackground(const std::string &name) const
Definition: environment.cc:225
void setLoggingAuthor(const std::string &author)
Definition: logging.h:80
shaderNode_t * createShaderNode(const std::string &name, paraMap_t &params)
Definition: environment.cc:307
std::map< std::string, texture_t * > texture_table
Definition: environment.h:119
YAFRAYCORE_EXPORT std::string sysInfoGetPlatform()
Definition: sysinfo.cc:66
void setImagesAutoSaveIntervalType(int interval_type)
Definition: imagefilm.h:169
void setLoggingCustomIcon(const std::string &iconPath)
Definition: logging.h:83
camera_t * camera_factory_t(paraMap_t &, renderEnvironment_t &)
Definition: environment.h:42
#define Y_VERBOSE_ENV
Definition: environment.cc:52
void setFilmAutoSaveIntervalPasses(int interval_passes)
Definition: imagefilm.h:178
void setLoggingFontPath(const std::string &fontPath)
Definition: logging.h:84
std::map< std::string, material_factory_t * > material_factory
Definition: environment.h:106
virtual std::string getImageFormatFromFullName(const std::string &fullname)
float toonPostSmooth
Definition: renderpasses.h:257
std::map< std::string, object_factory_t * > object_factory
Definition: environment.h:108
colorOutput_t * output2
Definition: environment.h:134
virtual void initTilesPasses(int totalViews, int numExtPasses)
Definition: output.h:40
float G
Definition: color.h:157
std::map< std::string, std::string > imagehandler_extensions
Definition: environment.h:130
YAFRAYCORE_EXPORT std::string sysInfoGetOS()
Definition: sysinfo.cc:53
void setLoggingFontSizeFactor(float &fontSizeFactor)
Definition: logging.h:85
virtual void registerImageHandler(const std::string &name, const std::string &validExtensions, const std::string &fullName, imagehandler_factory_t *f)
Camera base class.
Definition: camera.h:37
imageHandler_t * createImageHandler(const std::string &name, paraMap_t &params, bool addToTable=true)
Definition: environment.cc:395
std::list< sharedlibrary_t > pluginHandlers
Definition: environment.h:104
void set_pass_mask_only(bool mask_only)
void set_pass_mask_obj_index(float new_obj_index)
void setNumThreadsPhotons(int threads_photons)
Definition: scene.cc:387
void setNumThreads(int threads)
Definition: scene.cc:344
#define __BEGIN_YAFRAY
virtual std::string getImageFullNameFromFormat(const std::string &format)
camera_t * getCamera(const std::string &name) const
Definition: environment.cc:218
void setLoggingTitle(const std::string &title)
Definition: logging.h:79
imageFilm_t * createImageFilm(const paraMap_t &params, colorOutput_t &output)
Definition: environment.cc:614
void setAntialiasing(int numSamples, int numPasses, int incSamples, double threshold, float resampled_floor, float sample_multiplier_factor, float light_sample_multiplier_factor, float indirect_sample_multiplier_factor, bool detect_color_noise, int dark_detection_type, float dark_threshold_factor, int variance_edge_size, int variance_pixels, float clamp_samples, float clamp_indirect)
Definition: scene.cc:803
void setImagesAutoSaveIntervalPasses(int interval_passes)
Definition: imagefilm.h:171
imageHandler_t * imagehandler_factory_t(paraMap_t &, renderEnvironment_t &)
Definition: environment.h:48
YAFRAYCORE_EXPORT std::string sysInfoGetCompiler()
Definition: sysinfo.cc:36
void setProgressBar(progressBar_t *pb)
Definition: imagefilm.cc:1099
void setupRenderPasses(const paraMap_t &params)
Definition: environment.cc:548
std::map< std::string, shaderNode_t * > shader_table
Definition: environment.h:124
shaderNode_t * shader_factory_t(const paraMap_t &, renderEnvironment_t &)
Definition: environment.h:45
void setBaseSamplingOffset(unsigned int offset)
Definition: imagefilm.h:158
Progress bar abstract class with pure virtual members.
Definition: monitor.h:9
volumeHandler_t * volume_factory_t(const paraMap_t &, renderEnvironment_t &)
Definition: environment.h:46
Definition: scene.h:143
colorSpaces_t
Definition: color.h:41
void setColorSpace2(colorSpaces_t color_space, float gammaVal)
Definition: imagefilm.cc:1088
std::map< std::string, light_t * > light_table
Definition: environment.h:117
void setImageFilm(imageFilm_t *film)
Definition: scene.cc:747
texture_t * texture_factory_t(paraMap_t &, renderEnvironment_t &)
Definition: environment.h:40
YAFRAYCORE_EXPORT const std::list< std::string > & listDir(const std::string &dir)
Definition: yafsystem.cc:133
Definition: color.h:45
void setBackground(background_t *bg)
Definition: scene.cc:752
std::map< std::string, camera_t * > camera_table
Definition: environment.h:121
float shadowBias
Definition: scene.h:211
std::map< std::string, material_t * > material_table
Definition: environment.h:118
int getTileSize() const
Definition: imagefilm.h:149
void setSaveLog(bool save_log)
Definition: logging.h:76
Definition: color.h:49
float B
Definition: color.h:157
#define InfoVerboseSuccessDisabled(name, t)
Definition: environment.cc:68
void setParamsBadgePosition(const std::string &badgePosition)
Definition: logging.cc:391
void setPremult2(bool premult)
Definition: imagefilm.cc:1094
Definition: light.h:29
void setDifferentialRaysEnabled(bool value)
Definition: session.h:56
virtual void setProgressBar(progressBar_t *pb)
Definition: integrator.h:49
std::map< std::string, background_factory_t * > background_factory
Definition: environment.h:110
#define Y_ERROR_ENV
Definition: environment.cc:53
integrator_t * getIntegrator(const std::string &name) const
Definition: environment.cc:232
bool setupScene(scene_t &scene, const paraMap_t &params, colorOutput_t &output, progressBar_t *pb=nullptr)
Definition: environment.cc:861
void setComputerNode(unsigned int computer_node)
Definition: imagefilm.h:157
bool rayMinDistAuto
Definition: scene.h:215
virtual material_t * getMaterial(const std::string &name) const
Definition: environment.cc:204
background_t * background_factory_t(paraMap_t &, renderEnvironment_t &)
Definition: environment.h:43
Definition: color.h:46
YAFRAYCORE_EXPORT session_t session
Definition: session.cc:33
std::map< std::string, shader_factory_t * > shader_factory
Definition: environment.h:112
YAFRAYPLUGIN_EXPORT void registerPlugin(renderEnvironment_t &render)
Definition: darksky.cc:378
object3d_t * sphere_factory(paraMap_t &params, renderEnvironment_t &env)
std::map< std::string, object3d_t * > object_table
Definition: environment.h:120
void setFilmAutoSaveIntervalSeconds(double interval_seconds)
Definition: imagefilm.h:177
#define ErrUnkType(t)
Definition: environment.cc:59
light_t * createLight(const std::string &name, paraMap_t &params)
Definition: environment.cc:246
renderPasses_t renderPasses
Definition: environment.h:133
std::map< std::string, light_factory_t * > light_factory
Definition: environment.h:105
virtual texture_t * getTexture(const std::string &name) const
Definition: environment.cc:211
void set_pass_mask_mat_index(float new_mat_index)
void set_pass_mask_invert(bool mask_invert)
void freeMap(std::map< std::string, T * > &map)
Definition: environment.cc:85
material_t * createMaterial(const std::string &name, paraMap_t &params, std::list< paraMap_t > &eparams)
Definition: environment.cc:336
std::map< std::string, texture_factory_t * > texture_factory
Definition: environment.h:107
std::map< std::string, VolumeRegion * > volumeregion_table
Definition: environment.h:126
#define InfoVerboseSuccess(name, t)
Definition: environment.cc:67
void setupLoggingAndBadge(const paraMap_t &params)
Definition: environment.cc:814
integrator_t * createIntegrator(const std::string &name, paraMap_t &params)
Definition: environment.cc:518
void setLoggingContact(const std::string &contact)
Definition: logging.h:81
bool getParam(const std::string &name, T &val) const
template function to get a value, available types are those of parameter_t::getVal() ...
Definition: params.h:82
void setImagesAutoSaveIntervalSeconds(double interval_seconds)
Definition: imagefilm.h:170
float objectEdgeThreshold
Definition: renderpasses.h:253
virtual std::string getImageFormatFromExtension(const std::string &extension)
void set_camera_name(std::string name)
Definition: camera.h:79
float rayMinDist
Definition: scene.h:214
void setFilmAutoSaveIntervalType(int interval_type)
Definition: imagefilm.h:176
void setColorSpace(colorSpaces_t color_space, float gammaVal)
Definition: imagefilm.cc:1082
void setFilmFileSaveBinaryFormat(bool binary_format)
Definition: imagefilm.h:175
virtual std::vector< std::string > listImageHandlersFullName()
VolumeRegion * volumeregion_factory_t(paraMap_t &, renderEnvironment_t &)
Definition: environment.h:47
float objectEdgeSmoothness
Definition: renderpasses.h:254
void extPass_add(const std::string &sExternalPass, const std::string &sInternalPass)
float R
Definition: color.h:157
background_t * createBackground(const std::string &name, paraMap_t &params)
Definition: environment.cc:366
integrator_t * integrator_factory_t(paraMap_t &, renderEnvironment_t &)
Definition: environment.h:44
void setLoggingComments(const std::string &comments)
Definition: logging.h:82
std::vector< float > toonEdgeColor
Definition: renderpasses.h:251
std::map< extPassTypes_t, std::string > extPassMapIntString
Definition: renderpasses.h:244
#define ErrNoType
Definition: environment.cc:58
volumeHandler_t * createVolumeH(const std::string &name, const paraMap_t &params)
Definition: environment.cc:756
VolumeRegion * createVolumeRegion(const std::string &name, paraMap_t &params)
Definition: environment.cc:785
camera_t * createCamera(const std::string &name, paraMap_t &params)
Definition: environment.cc:483
std::map< std::string, std::string > imagehandler_fullnames
Definition: environment.h:129
void setFilmFileSaveLoad(int film_file_save_load)
Definition: imagefilm.h:174
std::map< std::string, integrator_factory_t * > integrator_factory
Definition: environment.h:111
#define ErrOnCreate(t)
Definition: environment.cc:60
TYPE integratorType()
Definition: integrator.h:54
#define Y_WARN_ENV
Definition: environment.cc:54
std::map< std::string, integrator_t * > integrator_table
Definition: environment.h:123
void auxPasses_generate()
void setVolIntegrator(volumeIntegrator_t *v)
Definition: scene.cc:764
object3d_t * createObject(const std::string &name, paraMap_t &params)
Definition: environment.cc:454
#define WarnExist
Definition: environment.cc:56
float facesEdgeThreshold
Definition: renderpasses.h:260
std::map< std::string, imagehandler_factory_t * > imagehandler_factory
Definition: environment.h:115
void loadPlugins(const std::string &path)
Definition: environment.cc:128
void setBackgroundResampling(bool background_resampling)
Definition: imagefilm.h:153
texture_t * createTexture(const std::string &name, paraMap_t &params)
Definition: environment.cc:278
int extPassesSize() const
Definition: renderpasses.cc:38
std::string get_view_name() const
Definition: camera.h:81
std::map< std::string, volumeregion_factory_t * > volumeregion_factory
Definition: environment.h:114
std::map< std::string, volume_factory_t * > volume_factory
Definition: environment.h:113
virtual shaderNode_t * getShaderNode(const std::string &name) const
Definition: environment.cc:239
virtual ~renderEnvironment_t()
Definition: environment.cc:90
std::map< std::string, imageHandler_t * > imagehandler_table
Definition: environment.h:128
float toonQuantization
Definition: renderpasses.h:256
std::map< std::string, volumeHandler_t * > volume_table
Definition: environment.h:125
shader_factory_t * getShaderNodeFactory(const std::string &name) const
material_t * material_factory_t(paraMap_t &, std::list< paraMap_t > &, renderEnvironment_t &)
Definition: environment.h:39
void setSurfIntegrator(surfaceIntegrator_t *s)
Definition: scene.cc:757
bool getPluginPath(std::string &path)
Definition: environment.cc:146
float facesEdgeSmoothness
Definition: renderpasses.h:261
std::string getPathYafaRayXml()
Definition: session.cc:190
__BEGIN_YAFRAY YAFRAYCORE_EXPORT std::string sysInfoGetArchitecture()
Definition: sysinfo.cc:25
light_t * light_factory_t(paraMap_t &, renderEnvironment_t &)
Definition: environment.h:38
YAFRAYCORE_EXPORT yafarayLog_t yafLog
Definition: session.cc:30
virtual std::vector< std::string > listImageHandlers()
void setSaveHTML(bool save_html)
Definition: logging.h:77
#define SuccessVerboseReg(t, name)
Definition: environment.cc:70
std::map< std::string, camera_factory_t * > camera_factory
Definition: environment.h:109
#define Y_INFO_ENV
Definition: environment.cc:51
std::string get_camera_name() const
Definition: camera.h:80
std::string getYafaRayCoreVersion()
Definition: session.cc:207
#define __END_YAFRAY