YafaRay Core  v3.2.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
environment.h
Go to the documentation of this file.
1 #ifndef Y_ENVIRON_H
2 #define Y_ENVIRON_H
3 
4 #include <yafray_config.h>
5 
6 #include "params.h"
7 #include "yafsystem.h"
8 #include <list>
9 #include <vector>
10 #include <string>
11 #include <core_api/renderpasses.h>
12 #include <core_api/logging.h>
13 
15 class light_t;
16 class material_t;
17 class volumeHandler_t;
18 class VolumeRegion;
19 class texture_t;
20 class camera_t;
21 class background_t;
22 class integrator_t;
23 class shaderNode_t;
24 class integrator_t;
25 class object3d_t;
26 class imageFilm_t;
27 class scene_t;
28 class colorOutput_t;
29 class progressBar_t;
30 class imageHandler_t;
31 
33 {
34  public:
35  void loadPlugins(const std::string &path);
36  bool getPluginPath(std::string &path);
37 
39  typedef material_t *material_factory_t(paraMap_t &,std::list<paraMap_t> &, renderEnvironment_t &);
49 
50  virtual material_t *getMaterial(const std::string &name)const;
51  virtual texture_t *getTexture(const std::string &name)const;
52  virtual shaderNode_t *getShaderNode(const std::string &name)const;
53  camera_t *getCamera(const std::string &name)const;
54  shader_factory_t* getShaderNodeFactory(const std::string &name)const;
55  background_t* getBackground(const std::string &name)const;
56  integrator_t* getIntegrator(const std::string &name)const;
57  scene_t * getScene() { return curren_scene; };
58 
59  light_t* createLight (const std::string &name, paraMap_t &params);
60  texture_t* createTexture (const std::string &name, paraMap_t &params);
61  material_t* createMaterial (const std::string &name, paraMap_t &params, std::list<paraMap_t> &eparams);
62  object3d_t* createObject (const std::string &name, paraMap_t &params);
63  camera_t* createCamera (const std::string &name, paraMap_t &params);
64  background_t* createBackground(const std::string &name, paraMap_t &params);
65  integrator_t* createIntegrator(const std::string &name, paraMap_t &params);
66  shaderNode_t* createShaderNode(const std::string &name, paraMap_t &params);
67  volumeHandler_t* createVolumeH(const std::string &name, const paraMap_t &params);
68  VolumeRegion* createVolumeRegion(const std::string &name, paraMap_t &params);
69  imageFilm_t* createImageFilm(const paraMap_t &params, colorOutput_t &output);
70  imageHandler_t* createImageHandler(const std::string &name, paraMap_t &params, bool addToTable = true);
71  void setScene(scene_t *scene) { curren_scene=scene; };
72  bool setupScene(scene_t &scene, const paraMap_t &params, colorOutput_t &output, progressBar_t *pb = nullptr);
73  void setupRenderPasses(const paraMap_t &params);
74  void setupLoggingAndBadge(const paraMap_t &params);
75  const renderPasses_t* getRenderPasses() const { return &renderPasses; }
76  const std::map<std::string,camera_t *> * getCameraTable() const { return &camera_table; }
77  void setOutput2(colorOutput_t *out2) { output2 = out2; }
78  colorOutput_t* getOutput2() { return output2; }
79 
80  void clearAll();
81 
82  virtual void registerFactory(const std::string &name,light_factory_t *f);
83  virtual void registerFactory(const std::string &name,material_factory_t *f);
84  virtual void registerFactory(const std::string &name,texture_factory_t *f);
85  virtual void registerFactory(const std::string &name,object_factory_t *f);
86  virtual void registerFactory(const std::string &name,camera_factory_t *f);
87  virtual void registerFactory(const std::string &name,background_factory_t *f);
88  virtual void registerFactory(const std::string &name,integrator_factory_t *f);
89  virtual void registerFactory(const std::string &name,shader_factory_t *f);
90  virtual void registerFactory(const std::string &name,volume_factory_t *f);
91  virtual void registerFactory(const std::string &name,volumeregion_factory_t *f);
92 
93  virtual void registerImageHandler(const std::string &name, const std::string &validExtensions, const std::string &fullName, imagehandler_factory_t *f);
94  virtual std::vector<std::string> listImageHandlers();
95  virtual std::vector<std::string> listImageHandlersFullName();
96  virtual std::string getImageFormatFromFullName(const std::string &fullname);
97  virtual std::string getImageFormatFromExtension(const std::string &extension);
98  virtual std::string getImageFullNameFromFormat(const std::string &format);
99 
101  virtual ~renderEnvironment_t();
102 
103  protected:
104  std::list< sharedlibrary_t > pluginHandlers;
105  std::map<std::string,light_factory_t *> light_factory;
106  std::map<std::string,material_factory_t *> material_factory;
107  std::map<std::string,texture_factory_t *> texture_factory;
108  std::map<std::string,object_factory_t *> object_factory;
109  std::map<std::string,camera_factory_t *> camera_factory;
110  std::map<std::string,background_factory_t *> background_factory;
111  std::map<std::string,integrator_factory_t *> integrator_factory;
112  std::map<std::string,shader_factory_t *> shader_factory;
113  std::map<std::string,volume_factory_t *> volume_factory;
114  std::map<std::string,volumeregion_factory_t *> volumeregion_factory;
115  std::map<std::string,imagehandler_factory_t *> imagehandler_factory;
116 
117  std::map<std::string,light_t *> light_table;
118  std::map<std::string,material_t *> material_table;
119  std::map<std::string,texture_t *> texture_table;
120  std::map<std::string,object3d_t *> object_table;
121  std::map<std::string,camera_t *> camera_table;
122  std::map<std::string,background_t *> background_table;
123  std::map<std::string,integrator_t *> integrator_table;
124  std::map<std::string,shaderNode_t *> shader_table;
125  std::map<std::string,volumeHandler_t *> volume_table;
126  std::map<std::string,VolumeRegion *> volumeregion_table;
127 
128  std::map<std::string,imageHandler_t *> imagehandler_table;
129  std::map<std::string,std::string> imagehandler_fullnames;
130  std::map<std::string,std::string> imagehandler_extensions;
131 
134  colorOutput_t *output2; //secondary color output to export to file at the same time it's exported to Blender
135 };
136 
138 #endif // Y_ENVIRON_H
scene_t * curren_scene
Definition: environment.h:132
std::map< std::string, background_t * > background_table
Definition: environment.h:122
object3d_t * object_factory_t(paraMap_t &, renderEnvironment_t &)
Definition: environment.h:41
std::map< std::string, texture_t * > texture_table
Definition: environment.h:119
void setOutput2(colorOutput_t *out2)
Definition: environment.h:77
scene_t * getScene()
Definition: environment.h:57
camera_t * camera_factory_t(paraMap_t &, renderEnvironment_t &)
Definition: environment.h:42
std::map< std::string, material_factory_t * > material_factory
Definition: environment.h:106
std::map< std::string, object_factory_t * > object_factory
Definition: environment.h:108
colorOutput_t * output2
Definition: environment.h:134
std::map< std::string, std::string > imagehandler_extensions
Definition: environment.h:130
Camera base class.
Definition: camera.h:37
std::list< sharedlibrary_t > pluginHandlers
Definition: environment.h:104
#define __BEGIN_YAFRAY
imageHandler_t * imagehandler_factory_t(paraMap_t &, renderEnvironment_t &)
Definition: environment.h:48
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
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
std::map< std::string, light_t * > light_table
Definition: environment.h:117
texture_t * texture_factory_t(paraMap_t &, renderEnvironment_t &)
Definition: environment.h:40
std::map< std::string, camera_t * > camera_table
Definition: environment.h:121
std::map< std::string, material_t * > material_table
Definition: environment.h:118
Definition: light.h:29
std::map< std::string, background_factory_t * > background_factory
Definition: environment.h:110
background_t * background_factory_t(paraMap_t &, renderEnvironment_t &)
Definition: environment.h:43
std::map< std::string, shader_factory_t * > shader_factory
Definition: environment.h:112
std::map< std::string, object3d_t * > object_table
Definition: environment.h:120
renderPasses_t renderPasses
Definition: environment.h:133
std::map< std::string, light_factory_t * > light_factory
Definition: environment.h:105
std::map< std::string, texture_factory_t * > texture_factory
Definition: environment.h:107
std::map< std::string, VolumeRegion * > volumeregion_table
Definition: environment.h:126
const std::map< std::string, camera_t * > * getCameraTable() const
Definition: environment.h:76
VolumeRegion * volumeregion_factory_t(paraMap_t &, renderEnvironment_t &)
Definition: environment.h:47
integrator_t * integrator_factory_t(paraMap_t &, renderEnvironment_t &)
Definition: environment.h:44
void setScene(scene_t *scene)
Definition: environment.h:71
std::map< std::string, std::string > imagehandler_fullnames
Definition: environment.h:129
std::map< std::string, integrator_factory_t * > integrator_factory
Definition: environment.h:111
#define YAFRAYCORE_EXPORT
std::map< std::string, integrator_t * > integrator_table
Definition: environment.h:123
std::map< std::string, imagehandler_factory_t * > imagehandler_factory
Definition: environment.h:115
const renderPasses_t * getRenderPasses() const
Definition: environment.h:75
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
std::map< std::string, imageHandler_t * > imagehandler_table
Definition: environment.h:128
std::map< std::string, volumeHandler_t * > volume_table
Definition: environment.h:125
colorOutput_t * getOutput2()
Definition: environment.h:78
material_t * material_factory_t(paraMap_t &, std::list< paraMap_t > &, renderEnvironment_t &)
Definition: environment.h:39
light_t * light_factory_t(paraMap_t &, renderEnvironment_t &)
Definition: environment.h:38
std::map< std::string, camera_factory_t * > camera_factory
Definition: environment.h:109
#define __END_YAFRAY