Basic initial yafray integration by Eeshlo.
Materials are exported the best we can do by now. It will look almost as in blender except for the missing procedural textures and some minor issues. You have to tweak normal modulation amount to get the desired result cause is not the same in yafray. We added a panel in render space to adjust some yafray settings (GI and so) Also we export transparency and reflection using new raytracing settings, but that will be changed and improved soon. Remember that you have to set YFexport path in user defaults and yafray must be on path (version 0.0.6) We added the "yafray" button to activate all this stuff in the render window. Panel and settings are only shown when checked. So now when activated the code calls yafray export instead of the internal renderer and finally the resulting image is loaded back into render window's buffer. So animation is also possible and results can be saved using blender usual scheme.
This commit is contained in:
132
source/blender/include/yafray_Render.h
Normal file
132
source/blender/include/yafray_Render.h
Normal file
@@ -0,0 +1,132 @@
|
||||
#ifndef __YAFRAY_RENDER_H
|
||||
#define __YAFRAY_RENDER_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
#include "IMB_imbuf_types.h"
|
||||
|
||||
#include "DNA_action_types.h"
|
||||
#include "DNA_armature_types.h"
|
||||
#include "DNA_camera_types.h"
|
||||
#include "DNA_constraint_types.h"
|
||||
#include "DNA_curve_types.h"
|
||||
#include "DNA_effect_types.h"
|
||||
#include "DNA_group_types.h"
|
||||
#include "DNA_ika_types.h"
|
||||
#include "DNA_image_types.h"
|
||||
#include "DNA_key_types.h"
|
||||
#include "DNA_lamp_types.h"
|
||||
#include "DNA_lattice_types.h"
|
||||
#include "DNA_material_types.h"
|
||||
#include "DNA_meta_types.h"
|
||||
#include "DNA_mesh_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_packedFile_types.h"
|
||||
#include "DNA_radio_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
#include "DNA_sound_types.h"
|
||||
#include "DNA_space_types.h"
|
||||
#include "DNA_texture_types.h"
|
||||
#include "DNA_userdef_types.h"
|
||||
#include "DNA_vfont_types.h"
|
||||
#include "DNA_view3d_types.h"
|
||||
#include "DNA_world_types.h"
|
||||
|
||||
#include "BKE_global.h"
|
||||
#include "BKE_image.h"
|
||||
#include "render.h"
|
||||
|
||||
/* useful matrix & vector operations */
|
||||
#include "MTC_matrixops.h"
|
||||
#include "MTC_vectorops.h"
|
||||
|
||||
#include "BLI_blenlib.h"
|
||||
|
||||
/* need error(), so extern declare here */
|
||||
extern void error (char *fmt, ...);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <sstream>
|
||||
#include <fstream>
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
class yafrayRender_t
|
||||
{
|
||||
public:
|
||||
// ctor
|
||||
yafrayRender_t() {}
|
||||
// dtor
|
||||
~yafrayRender_t() {}
|
||||
|
||||
// mtds
|
||||
bool exportScene();
|
||||
|
||||
void displayImage();
|
||||
void addDupliMtx(Object* obj);
|
||||
|
||||
bool objectKnownData(Object* obj);
|
||||
|
||||
private:
|
||||
Object* maincam_obj;
|
||||
float mainCamLens;
|
||||
|
||||
int maxraydepth;
|
||||
|
||||
std::string imgout;
|
||||
|
||||
std::ofstream xmlfile;
|
||||
std::ostringstream ostr;
|
||||
std::map<Object*, std::vector<VlakRen*> > all_objects;
|
||||
std::map<std::string, Material*> used_materials;
|
||||
std::map<std::string, std::pair<Material*, MTex*> > used_textures;
|
||||
std::map<std::string, std::vector<float> > dupliMtx_list;
|
||||
std::map<std::string, Object*> dup_srcob;
|
||||
std::map<void*, Object*> objectData;
|
||||
|
||||
Object* findObject(const char* name);
|
||||
bool getAllMatTexObs();
|
||||
void writeTextures();
|
||||
void writeMaterialsAndModulators();
|
||||
void writeObject(Object* obj, const std::vector<VlakRen*> &VLR_list, const float obmat[4][4]);
|
||||
void writeAllObjects();
|
||||
void writeLamps();
|
||||
void writeCamera();
|
||||
void writeHemilight();
|
||||
void writePathlight();
|
||||
bool writeWorld();
|
||||
void clearAll();
|
||||
|
||||
};
|
||||
|
||||
/* C access to yafray */
|
||||
extern yafrayRender_t YAFBLEND;
|
||||
#endif
|
||||
|
||||
|
||||
/* C interface for Blender */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
int YAF_exportScene();
|
||||
void YAF_displayImage();
|
||||
void YAF_addDupliMtx(Object* obj);
|
||||
int YAF_objectKnownData(Object* obj);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /*__YAFRAY_RENDER_H */
|
||||
Reference in New Issue
Block a user