New export through plugin scheme for yafray. It is working on linux and mac os x
[blender.git] / source / blender / yafray / intern / export_Plugin.h
1 #ifndef __EXPORT_PLUGIN_H
2 #define __EXPORT_PLUGIN_H
3
4 #include"yafray_Render.h"
5 #include"yafexternal.h"
6 extern "C"
7 {
8 #include"PIL_dynlib.h"
9 }
10
11 class yafrayPluginRender_t : public yafrayRender_t
12 {
13         public:
14                 yafrayPluginRender_t() {handle=NULL;yafrayGate=NULL;}
15                 virtual ~yafrayPluginRender_t();
16         protected:
17                 std::string imgout;
18                 //void *handle;
19                 PILdynlib *handle;
20
21                 yafray::yafrayInterface_t *yafrayGate;
22
23                 void displayImage();
24                 virtual void writeTextures();
25                 virtual void writeMaterialsAndModulators();
26                 virtual void writeObject(Object* obj, 
27                                 const std::vector<VlakRen*> &VLR_list, const float obmat[4][4]);
28                 virtual void writeAllObjects();
29                 void writeAreaLamp(LampRen* lamp,int num);
30                 virtual void writeLamps();
31                 virtual void writeCamera();
32                 virtual void writeHemilight();
33                 virtual void writePathlight();
34                 virtual bool writeWorld();
35                 virtual bool writeRender();
36                 virtual bool initExport();
37                 virtual bool finishExport();
38
39                 void genUVcoords(std::vector<yafray::GFLOAT> *uvcoords,VlakRen *vlr,TFace* uvc);
40                 void genCompleUVcoords(std::vector<yafray::GFLOAT> *uvcoords,/*VlakRen *vlr,*/TFace* uvc);
41                 void genVcol(std::vector<yafray::CFLOAT> *vcol,VlakRen *vlr,
42                                                                 int p1,int p2,int p3,bool EXPORT_VCOL);
43                 void genFace(std::vector<int> &faces,std::vector<std::string> &shaders,std::vector<int> &faceshader,
44                                 std::vector<yafray::GFLOAT> *uvcoords,std::vector<yafray::CFLOAT> *vcol,
45                                 std::map<VertRen*, int> &vert_idx,VlakRen *vlr,
46                                 bool has_orco,bool has_uv,bool has_vcol);
47                 void genCompleFace(std::vector<int> &faces,/*std::vector<std::string> &shaders,*/std::vector<int> &faceshader,
48                                 std::vector<yafray::GFLOAT> *uvcoords,std::vector<yafray::CFLOAT> *vcol,
49                                 std::map<VertRen*, int> &vert_idx,VlakRen *vlr,
50                                 bool has_orco,bool has_uv,bool has_vcol);
51                 void genVertices(std::vector<yafray::point3d_t> *verts,int &vidx,
52                                                                                  std::map<VertRen*, int> &vert_idx,VlakRen* vlr,bool has_orco);
53 };
54
55 class blenderYafrayOutput_t : public yafray::colorOutput_t
56 {
57         public:
58                 blenderYafrayOutput_t() {out=0;};
59                 virtual ~blenderYafrayOutput_t() {};
60                 virtual bool putPixel(int x, int y,const yafray::color_t &c, 
61                                 yafray::CFLOAT alpha=0,yafray::PFLOAT depth=0);
62                 virtual void flush() {};
63         protected:
64                 int out;
65 };
66
67 #endif