Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlejandro Conty Estevez <conty@yafray.org>2004-06-16 22:44:12 +0400
committerAlejandro Conty Estevez <conty@yafray.org>2004-06-16 22:44:12 +0400
commited86852f7e90d9109959646f5819f2486c0dc03d (patch)
treec5c3860846963b4120117a8fd5fb3279bbdb324d /source/blender/yafray/intern/yafexternal.h
parent54f9086d3c5a75e92474ec4c6e790f6662793bdf (diff)
New export through plugin scheme for yafray. It is working on linux and mac os x
Needs latest yafray, you can get it from cvs, but I have also binaries for os x here: http://www.coala.uniovi.es/~jandro/noname/downloads/yafray-0.0.6-3.pkg.zip To use it, go to yafray panels (global settings) and uncheck the "xml" button. That would tell the export code to avoid xml export and use the yafray plugin instead. You'll see the render being draw while running and you can even stop it with ESC key. Since I'm sure problems will appear, expect updates soon. Remember: does not work on win32
Diffstat (limited to 'source/blender/yafray/intern/yafexternal.h')
-rw-r--r--source/blender/yafray/intern/yafexternal.h179
1 files changed, 179 insertions, 0 deletions
diff --git a/source/blender/yafray/intern/yafexternal.h b/source/blender/yafray/intern/yafexternal.h
new file mode 100644
index 00000000000..2ff95a13611
--- /dev/null
+++ b/source/blender/yafray/intern/yafexternal.h
@@ -0,0 +1,179 @@
+#ifndef __YAFINTERFACE_H
+#define __YAFINTERFACE_H
+
+#include<vector>
+#include<string>
+#include<list>
+#include<map>
+
+namespace yafray
+{
+
+typedef float PFLOAT;
+typedef float GFLOAT;
+typedef float CFLOAT;
+
+class point3d_t
+{
+ public:
+ point3d_t() { x = y = z = 0; }
+ point3d_t(PFLOAT ix, PFLOAT iy, PFLOAT iz=0) { x=ix; y=iy; z=iz; }
+ point3d_t(const point3d_t &s) { x=s.x; y=s.y; z=s.z; }
+ void set(PFLOAT ix, PFLOAT iy, PFLOAT iz=0) { x=ix; y=iy; z=iz; }
+ point3d_t& operator= (const point3d_t &s) { x=s.x; y=s.y; z=s.z; return *this; }
+ ~point3d_t() {};
+ PFLOAT x,y,z;
+};
+
+class color_t
+{
+ public:
+ color_t() {R=G=B=0;};
+ color_t(CFLOAT r,CFLOAT g,CFLOAT b) {R=r;G=g;B=b;};
+ ~color_t() {};
+ void set(CFLOAT r,CFLOAT g,CFLOAT b) {R=r;G=g;B=b;};
+
+ CFLOAT R,G,B;
+};
+
+class colorA_t : public color_t
+{
+ public:
+ colorA_t() { A=1; }
+ colorA_t(const color_t &c):color_t(c) { A=1; }
+ colorA_t(CFLOAT r, CFLOAT g, CFLOAT b, CFLOAT a=0):color_t(r,g,b) {A=a;}
+ ~colorA_t() {};
+ void set(CFLOAT r, CFLOAT g, CFLOAT b, CFLOAT a=0) {color_t::set(r,g,b);A=a; };
+
+ protected:
+ CFLOAT A;
+};
+
+#define TYPE_FLOAT 0
+#define TYPE_STRING 1
+#define TYPE_POINT 2
+#define TYPE_COLOR 3
+#define TYPE_NONE -1
+
+class parameter_t
+{
+ public:
+ parameter_t(const std::string &s):type(TYPE_STRING),used(false),str(s) {};
+ parameter_t(float f):type(TYPE_FLOAT),used(false),fnum(f) {};
+ parameter_t(const colorA_t &c):type(TYPE_COLOR),used(false)
+ ,C(c) {};
+ parameter_t(const point3d_t &p):type(TYPE_POINT),used(false),P(p) {};
+ parameter_t():type(TYPE_NONE),used(false) {};
+ const std::string &getStr() {used=true;return str;};
+ float &getFnum() {used=true;return fnum;};
+ const point3d_t &getP() {used=true;return P;};
+ const color_t &getC() {used=true;return C;};
+ const colorA_t &getAC() {used=true;return C;};
+ int type;
+ bool used;
+ protected:
+ std::string str;
+ float fnum;
+ point3d_t P;
+ colorA_t C;
+};
+
+class paramMap_t : public std::map<std::string,parameter_t>
+{
+ public:
+ virtual bool getParam(const std::string &name,std::string &s);
+ virtual bool getParam(const std::string &name,bool &b);
+ virtual bool getParam(const std::string &name,float &f);
+ virtual bool getParam(const std::string &name,double &f);
+ virtual bool getParam(const std::string &name,int &i);
+ virtual bool getParam(const std::string &name,point3d_t &p);
+ virtual bool getParam(const std::string &name,color_t &c);
+ virtual bool getParam(const std::string &name,colorA_t &c);
+ virtual bool includes(const std::string &label,int type);
+ virtual void checkUnused(const std::string &env);
+ virtual ~paramMap_t() {};
+};
+
+class light_t;
+class shader_t;
+class texture_t;
+class filter_t;
+class background_t;
+
+class renderEnvironment_t
+{
+ public:
+ typedef light_t * light_factory_t(paramMap_t &,renderEnvironment_t &);
+ typedef shader_t *shader_factory_t(paramMap_t &,std::list<paramMap_t> &,
+ renderEnvironment_t &);
+ typedef texture_t *texture_factory_t(paramMap_t &,renderEnvironment_t &);
+ typedef filter_t *filter_factory_t(paramMap_t &,renderEnvironment_t &);
+ typedef background_t *background_factory_t(paramMap_t &,renderEnvironment_t &);
+
+ virtual shader_t *getShader(const std::string name)const=0;
+ virtual texture_t *getTexture(const std::string name)const=0;
+
+ virtual void repeatFirstPass()=0;
+
+ virtual void registerFactory(const std::string &name,light_factory_t *f)=0;
+ virtual void registerFactory(const std::string &name,shader_factory_t *f)=0;
+ virtual void registerFactory(const std::string &name,texture_factory_t *f)=0;
+ virtual void registerFactory(const std::string &name,filter_factory_t *f)=0;
+ virtual void registerFactory(const std::string &name,background_factory_t *f)=0;
+
+ renderEnvironment_t() {};
+ virtual ~renderEnvironment_t() {};
+
+};
+
+class colorOutput_t
+{
+ public:
+ virtual ~colorOutput_t() {};
+ virtual bool putPixel(int x, int y,const color_t &c,
+ CFLOAT alpha=0,PFLOAT depth=0)=0;
+ virtual void flush()=0;
+};
+
+class yafrayInterface_t : public renderEnvironment_t
+{
+ public:
+ virtual void transformPush(float *m)=0;
+ virtual void transformPop()=0;
+ virtual void addObject_trimesh(const std::string &name,
+ std::vector<point3d_t> *verts, const std::vector<int> &faces,
+ std::vector<GFLOAT> *uvcoords, std::vector<CFLOAT> *vcol,
+ const std::vector<std::string> &shaders,const std::vector<int> &faceshader,
+ float sm_angle,bool castShadows,bool useR,bool receiveR,bool caus,bool has_orco,
+ const color_t &caus_rcolor,const color_t &caus_tcolor,float caus_IOR)=0;
+
+ virtual void addObject_reference(const std::string &name,const std::string &original)=0;
+ // lights
+ virtual void addLight(paramMap_t &p)=0;
+ // textures
+ virtual void addTexture(paramMap_t &p)=0;
+ // shaders
+ virtual void addShader(paramMap_t &p,std::list<paramMap_t> &modulators)=0;
+ // filters
+ virtual void addFilter(paramMap_t &p)=0;
+ // backgrounds
+ virtual void addBackground(paramMap_t &p)=0;
+ //camera
+ virtual void addCamera(paramMap_t &p)=0;
+ //render
+ virtual void render(paramMap_t &p)=0;
+ //render
+ virtual void render(paramMap_t &p,colorOutput_t &output)=0;
+
+ virtual void clear()=0;
+
+ virtual ~yafrayInterface_t() {};
+};
+
+typedef yafrayInterface_t * yafrayConstructor(int,const std::string &);
+
+}
+
+#define YAFRAY_SYMBOL "getYafray"
+
+#endif