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:
-rw-r--r--source/blender/render/intern/source/convertblender.c59
-rw-r--r--source/blender/render/intern/source/pipeline.c9
-rwxr-xr-xsource/blender/yafray/intern/export_File.cpp108
-rw-r--r--source/blender/yafray/intern/export_Plugin.cpp44
-rw-r--r--source/blender/yafray/intern/export_Plugin.h6
-rw-r--r--source/blender/yafray/intern/yafexternal.h1
6 files changed, 153 insertions, 74 deletions
diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c
index 988abd45c18..34ae4ba2b59 100644
--- a/source/blender/render/intern/source/convertblender.c
+++ b/source/blender/render/intern/source/convertblender.c
@@ -3033,16 +3033,28 @@ void RE_Database_FromScene(Render *re, Scene *scene, int use_camera_view)
ob= base->object;
/* OB_DONE means the object itself got duplicated, so was already converted */
- if(ob->flag & OB_DONE);
+ if (ob->flag & OB_DONE) {
+ /* yafray: for some reason this part was removed, but yafray really needs it...
+ Dupliverts objects are treated as instances of an original 'sourceobject',
+ which needs to be included in the renderlist here.
+ exception: lamps, lattices, armatures & camera's */
+ if ((re->r.renderer==R_YAFRAY) && ((ob->type!=OB_LATTICE) && (ob->type!=OB_ARMATURE) &&
+ (ob->type!=OB_LAMP) && (ob->type!=OB_CAMERA)))
+ {
+ printf("Duplivert object %s, adding to renderlist\n", ob->id.name);
+ ob->flag &= ~OB_DONE;
+ init_render_object(re, ob, NULL, 0, 0);
+ ob->flag |= OB_DONE;
+ }
+ }
else if( (base->lay & lay) || (ob->type==OB_LAMP && (base->lay & re->scene->lay)) ) {
if(ob->transflag & OB_DUPLI) {
/* exception: mballs! */
- /* yafray: Include at least one copy of a dupliframe object for yafray in the renderlist.
- mballs comment above true as well for yafray, they are not included, only all other object types */
+ /* yafray: except for mballs, include at least one copy of a dupliframe object in the renderlist. */
if (re->r.renderer==R_YAFRAY) {
if ((ob->type!=OB_MBALL) && ((ob->transflag & OB_DUPLIFRAMES)!=0)) {
- printf("Object %s has OB_DUPLIFRAMES set, adding to renderlist\n", ob->id.name);
+ printf("Dupliframe Object %s, adding to renderlist\n", ob->id.name);
init_render_object(re, ob, NULL, 0, 0);
}
}
@@ -3067,16 +3079,22 @@ void RE_Database_FromScene(Render *re, Scene *scene, int use_camera_view)
Mat4CpyMat4(obd->obmat, dob->mat);
if(obd->type!=OB_MBALL) {
- /* yafray: special handling of duplivert objects for yafray:
- only the matrix is stored, together with the source object name.
- Since the original object is needed as well, it is included in the renderlist (see above)
- NOT done for lamps, these need to be included as normal lamps separately
- correction: also ignore lattices, armatures and cameras (....) */
- if ((obd->type!=OB_LATTICE) && (obd->type!=OB_ARMATURE) &&
- (obd->type!=OB_LAMP) && (obd->type!=OB_CAMERA) && (re->r.renderer==R_YAFRAY))
- {
- printf("Adding dupli matrix for object %s\n", obd->id.name);
- YAF_addDupliMtx(obd);
+ /* yafray: special case handling of duplivert/dupligroup objects.
+ Only one copy included in renderlist(see above), all others treated as instance of that.
+ So only need to store name and matrix. Exception are lamps. lattices, armatures and camera's */
+ if (re->r.renderer==R_YAFRAY) {
+ /* dupligroup obs are included directly */
+ if (obd->flag & OB_FROMGROUP) {
+ printf("Dupligroup object %s, adding to renderlist\n", obd->id.name);
+ init_render_object(re, obd, ob, dob->index, 0);
+ }
+ else if ((obd->type!=OB_LATTICE) && (obd->type!=OB_ARMATURE) &&
+ (obd->type!=OB_LAMP) && (obd->type!=OB_CAMERA))
+ {
+ printf("Adding dupli matrix for object %s\n", obd->id.name);
+ YAF_addDupliMtx(obd);
+ }
+ else init_render_object(re, obd, ob, dob->index, 0);
}
else init_render_object(re, obd, ob, dob->index, 0);
}
@@ -3087,21 +3105,22 @@ void RE_Database_FromScene(Render *re, Scene *scene, int use_camera_view)
}
}
else {
- /* yafray: if there are linked data objects (except lamps, empties or armatures),
- yafray only needs to know about one, the rest can be instanciated.
- The dupliMtx list is used for this purpose.
- Exception: objects which have object linked materials, these cannot be instanciated. */
+ /* yafray: linked data objects treated similarly to dupliverts,
+ If object not known yet (not in renderlist), include in the renderlist,
+ otherwise treat as instance of it, so only name and matrix are stored
+ Exception: objects which have materials linked to object instead of mesh */
if ((re->r.renderer==R_YAFRAY) && (ob->colbits==0))
{
/* Special case, parent object dupli's: ignore if object itself is lamp or parent is lattice or empty */
if (ob->parent) {
if ((ob->type!=OB_LAMP) && (ob->parent->type!=OB_EMPTY) &&
- (ob->parent->type!=OB_LATTICE) && YAF_objectKnownData(ob))
+ (ob->parent->type!=OB_LATTICE) && YAF_objectKnownData(ob))
printf("From parent: Added dupli matrix for linked data object %s\n", ob->id.name);
else
init_render_object(re, ob, NULL, 0, 0);
}
- else if ((ob->type!=OB_EMPTY) && (ob->type!=OB_LAMP) && (ob->type!=OB_ARMATURE) && YAF_objectKnownData(ob))
+ else if ((ob->type!=OB_EMPTY) && (ob->type!=OB_LAMP) &&
+ (ob->type!=OB_ARMATURE) && YAF_objectKnownData(ob))
printf("Added dupli matrix for linked data object %s\n", ob->id.name);
else
init_render_object(re, ob, NULL, 0, 0);
diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c
index 923ea7860d4..0a2fdd12db1 100644
--- a/source/blender/render/intern/source/pipeline.c
+++ b/source/blender/render/intern/source/pipeline.c
@@ -1601,6 +1601,9 @@ static void yafrayRender(Render *re)
free_render_result(re->result);
re->result= new_render_result(re, &re->disprect, 0, RR_USEMEM);
+ // need this too, for aspect/ortho/etc info
+ RE_SetCamera(re, re->scene->camera);
+
// switch must be done before prepareScene()
if (!re->r.YFexportxml)
YAF_switchFile();
@@ -1611,7 +1614,13 @@ static void yafrayRender(Render *re)
RE_Database_FromScene(re, re->scene, 1);
printf("Scene conversion done.\n");
+ re->i.starttime = PIL_check_seconds_timer();
+
YAF_exportScene(re);
+
+ re->i.lastframetime = PIL_check_seconds_timer()- re->i.starttime;
+ re->stats_draw(&re->i);
+
RE_Database_Free(re);
}
diff --git a/source/blender/yafray/intern/export_File.cpp b/source/blender/yafray/intern/export_File.cpp
index 070ff9abc01..25e51a1b0bb 100755
--- a/source/blender/yafray/intern/export_File.cpp
+++ b/source/blender/yafray/intern/export_File.cpp
@@ -157,7 +157,7 @@ bool yafrayFileRender_t::initExport()
#ifdef WIN32
// try to create it
cout << "Trying to create...\n";
- if (createDir(xmlpath.c_str())==0) dir_failed=true; else dir_failed=false;
+ if (createDir(const_cast<char*>(xmlpath.c_str()))==0) dir_failed=true; else dir_failed=false;
#else
dir_failed = true;
#endif
@@ -1048,7 +1048,8 @@ void yafrayFileRender_t::writeMaterialsAndModulators()
else if ((mtex->texco & TEXCO_GLOB) || (mtex->texco & TEXCO_OBJECT))
// object mode is also set as global, but the object matrix was specified above with <modulator..>
ostr << "\t\t<texco value=\"global\" />\n";
- else if (mtex->texco & TEXCO_ORCO)
+ else if ((mtex->texco & TEXCO_ORCO) || (mtex->texco & TEXCO_STRAND))
+ // orco flag now used for 'strand'-mapping as well, see mesh code
ostr << "\t\t<texco value=\"orco\" />\n";
else if (mtex->texco & TEXCO_WINDOW)
ostr << "\t\t<texco value=\"window\" />\n";
@@ -1217,10 +1218,13 @@ void yafrayFileRender_t::writeObject(Object* obj, const vector<VlakRen*> &VLR_li
// Test the rendermaterial texco flag instead.
// update2: bug #3193 it seems it has changed again with the introduction of static 'hair' particles,
// now it uses the vert pointer again as an extra test to make sure there are orco coords available
- bool EXPORT_ORCO = (((face0mat->texco & TEXCO_ORCO)!=0) && (face0->v1->orco!=NULL));
+ int has_orco = 0;
+ if (face0mat->texco & TEXCO_STRAND)
+ has_orco = 1;
+ else
+ has_orco = (((face0mat->texco & TEXCO_ORCO)!=0) && (face0->v1->orco!=NULL)) ? 2 : 0;
- string has_orco = "off";
- if (EXPORT_ORCO) has_orco = "on";
+ string has_orco_st = has_orco ? "on" : "off";
// smooth shading if enabled
bool no_auto = true; //in case non-mesh, or mesh has no autosmooth
@@ -1229,7 +1233,7 @@ void yafrayFileRender_t::writeObject(Object* obj, const vector<VlakRen*> &VLR_li
if (mesh->flag & ME_AUTOSMOOTH) {
no_auto = false;
ostr.str("");
- ostr << "\t<mesh autosmooth=\"" << mesh->smoothresh << "\" has_orco=\"" << has_orco << "\" >\n";
+ ostr << "\t<mesh autosmooth=\"" << mesh->smoothresh << "\" has_orco=\"" << has_orco_st << "\" >\n";
xmlfile << ostr.str();
}
}
@@ -1239,9 +1243,9 @@ void yafrayFileRender_t::writeObject(Object* obj, const vector<VlakRen*> &VLR_li
// or flat shaded, the smooth flag of the first face is used to determine
// the shading for the whole mesh
if (face0->flag & ME_SMOOTH)
- xmlfile << "\t<mesh autosmooth=\"180\" has_orco=\"" << has_orco << "\" >\n";
+ xmlfile << "\t<mesh autosmooth=\"180\" has_orco=\"" << has_orco_st << "\" >\n";
else
- xmlfile << "\t<mesh autosmooth=\"0.1\" has_orco=\"" << has_orco << "\" >\n"; //0 shows artefacts
+ xmlfile << "\t<mesh autosmooth=\"0.1\" has_orco=\"" << has_orco_st << "\" >\n"; //0 shows artefacts
}
// now all vertices
@@ -1271,13 +1275,19 @@ void yafrayFileRender_t::writeObject(Object* obj, const vector<VlakRen*> &VLR_li
MTC_cp3Float(ver->co, tvec);
MTC_Mat4MulVecfl(imat, tvec);
ostr << "\t\t\t<p x=\"" << tvec[0]
- << "\" y=\"" << tvec[1]
- << "\" z=\"" << tvec[2] << "\" />\n";
- if (EXPORT_ORCO) {
+ << "\" y=\"" << tvec[1]
+ << "\" z=\"" << tvec[2] << "\" />\n";
+ // has_orco now an int, if 1 -> strand mapping, if 2 -> normal orco mapping
+ if (has_orco==1) {
+ ostr << "\t\t\t<p x=\"" << ver->accum
+ << "\" y=\"" << ver->accum
+ << "\" z=\"" << ver->accum << "\" />\n";
+ }
+ else if (has_orco==2) {
orco = ver->orco;
ostr << "\t\t\t<p x=\"" << orco[0]
- << "\" y=\"" << orco[1]
- << "\" z=\"" << orco[2] << "\" />\n";
+ << "\" y=\"" << orco[1]
+ << "\" z=\"" << orco[2] << "\" />\n";
}
}
if (vert_idx.find(vlr->v2)==vert_idx.end()) {
@@ -1286,13 +1296,19 @@ void yafrayFileRender_t::writeObject(Object* obj, const vector<VlakRen*> &VLR_li
MTC_cp3Float(ver->co, tvec);
MTC_Mat4MulVecfl(imat, tvec);
ostr << "\t\t\t<p x=\"" << tvec[0]
- << "\" y=\"" << tvec[1]
- << "\" z=\"" << tvec[2] << "\" />\n";
- if (EXPORT_ORCO) {
+ << "\" y=\"" << tvec[1]
+ << "\" z=\"" << tvec[2] << "\" />\n";
+ // has_orco now an int, if 1 -> strand mapping, if 2 -> normal orco mapping
+ if (has_orco==1) {
+ ostr << "\t\t\t<p x=\"" << ver->accum
+ << "\" y=\"" << ver->accum
+ << "\" z=\"" << ver->accum << "\" />\n";
+ }
+ else if (has_orco==2) {
orco = ver->orco;
ostr << "\t\t\t<p x=\"" << orco[0]
- << "\" y=\"" << orco[1]
- << "\" z=\"" << orco[2] << "\" />\n";
+ << "\" y=\"" << orco[1]
+ << "\" z=\"" << orco[2] << "\" />\n";
}
}
if (vert_idx.find(vlr->v3)==vert_idx.end()) {
@@ -1301,13 +1317,19 @@ void yafrayFileRender_t::writeObject(Object* obj, const vector<VlakRen*> &VLR_li
MTC_cp3Float(ver->co, tvec);
MTC_Mat4MulVecfl(imat, tvec);
ostr << "\t\t\t<p x=\"" << tvec[0]
- << "\" y=\"" << tvec[1]
- << "\" z=\"" << tvec[2] << "\" />\n";
- if (EXPORT_ORCO) {
+ << "\" y=\"" << tvec[1]
+ << "\" z=\"" << tvec[2] << "\" />\n";
+ // has_orco now an int, if 1 -> strand mapping, if 2 -> normal orco mapping
+ if (has_orco==1) {
+ ostr << "\t\t\t<p x=\"" << ver->accum
+ << "\" y=\"" << ver->accum
+ << "\" z=\"" << ver->accum << "\" />\n";
+ }
+ else if (has_orco==2) {
orco = ver->orco;
ostr << "\t\t\t<p x=\"" << orco[0]
- << "\" y=\"" << orco[1]
- << "\" z=\"" << orco[2] << "\" />\n";
+ << "\" y=\"" << orco[1]
+ << "\" z=\"" << orco[2] << "\" />\n";
}
}
if ((vlr->v4) && (vert_idx.find(vlr->v4)==vert_idx.end())) {
@@ -1316,13 +1338,19 @@ void yafrayFileRender_t::writeObject(Object* obj, const vector<VlakRen*> &VLR_li
MTC_cp3Float(ver->co, tvec);
MTC_Mat4MulVecfl(imat, tvec);
ostr << "\t\t\t<p x=\"" << tvec[0]
- << "\" y=\"" << tvec[1]
- << "\" z=\"" << tvec[2] << "\" />\n";
- if (EXPORT_ORCO) {
+ << "\" y=\"" << tvec[1]
+ << "\" z=\"" << tvec[2] << "\" />\n";
+ // has_orco now an int, if 1 -> strand mapping, if 2 -> normal orco mapping
+ if (has_orco==1) {
+ ostr << "\t\t\t<p x=\"" << ver->accum
+ << "\" y=\"" << ver->accum
+ << "\" z=\"" << ver->accum << "\" />\n";
+ }
+ else if (has_orco==2) {
orco = ver->orco;
ostr << "\t\t\t<p x=\"" << orco[0]
- << "\" y=\"" << orco[1]
- << "\" z=\"" << orco[2] << "\" />\n";
+ << "\" y=\"" << orco[1]
+ << "\" z=\"" << orco[2] << "\" />\n";
}
}
xmlfile << ostr.str();
@@ -1352,7 +1380,7 @@ void yafrayFileRender_t::writeObject(Object* obj, const vector<VlakRen*> &VLR_li
int idx2 = vert_idx.find(vlr->v2)->second;
int idx3 = vert_idx.find(vlr->v3)->second;
// make sure the indices point to the vertices when orco coords exported
- if (EXPORT_ORCO) { idx1*=2; idx2*=2; idx3*=2; }
+ if (has_orco) { idx1*=2; idx2*=2; idx3*=2; }
ostr.str("");
ostr << "\t\t\t<f a=\"" << idx1 << "\" b=\"" << idx2 << "\" c=\"" << idx3 << "\"";
@@ -1368,8 +1396,8 @@ void yafrayFileRender_t::writeObject(Object* obj, const vector<VlakRen*> &VLR_li
TFace* uvc = vlr->tface; // possible uvcoords (v upside down)
if (uvc) {
ostr << " u_a=\"" << uvc->uv[ui1][0] << "\" v_a=\"" << 1-uvc->uv[ui1][1] << "\""
- << " u_b=\"" << uvc->uv[ui2][0] << "\" v_b=\"" << 1-uvc->uv[ui2][1] << "\""
- << " u_c=\"" << uvc->uv[ui3][0] << "\" v_c=\"" << 1-uvc->uv[ui3][1] << "\"";
+ << " u_b=\"" << uvc->uv[ui2][0] << "\" v_b=\"" << 1-uvc->uv[ui2][1] << "\""
+ << " u_c=\"" << uvc->uv[ui3][0] << "\" v_c=\"" << 1-uvc->uv[ui3][1] << "\"";
}
// since Blender seems to need vcols when uvs are used, for yafray only export when the material actually uses vcols
@@ -1377,13 +1405,13 @@ void yafrayFileRender_t::writeObject(Object* obj, const vector<VlakRen*> &VLR_li
// vertex colors
unsigned char* pt = reinterpret_cast<unsigned char*>(&vlr->vcol[ui1]);
ostr << " vcol_a_r=\"" << (float)pt[3]/255.f << "\" vcol_a_g=\"" << (float)pt[2]/255.f
- << "\" vcol_a_b=\"" << (float)pt[1]/255.f << "\"";
+ << "\" vcol_a_b=\"" << (float)pt[1]/255.f << "\"";
pt = reinterpret_cast<unsigned char*>(&vlr->vcol[ui2]);
ostr << " vcol_b_r=\"" << (float)pt[3]/255.f << "\" vcol_b_g=\"" << (float)pt[2]/255.f
- << "\" vcol_b_b=\"" << (float)pt[1]/255.f << "\"";
+ << "\" vcol_b_b=\"" << (float)pt[1]/255.f << "\"";
pt = reinterpret_cast<unsigned char*>(&vlr->vcol[ui3]);
ostr << " vcol_c_r=\"" << (float)pt[3]/255.f << "\" vcol_c_g=\"" << (float)pt[2]/255.f
- << "\" vcol_c_b=\"" << (float)pt[1]/255.f << "\"";
+ << "\" vcol_c_b=\"" << (float)pt[1]/255.f << "\"";
}
ostr << " shader_name=\"" << fmatname << "\" />\n";
@@ -1394,7 +1422,7 @@ void yafrayFileRender_t::writeObject(Object* obj, const vector<VlakRen*> &VLR_li
idx3 = vert_idx.find(vlr->v1)->second;
// make sure the indices point to the vertices when orco coords exported
- if (EXPORT_ORCO) { idx1*=2; idx2*=2; idx3*=2; }
+ if (has_orco) { idx1*=2; idx2*=2; idx3*=2; }
ostr << "\t\t\t<f a=\"" << idx1 << "\" b=\"" << idx2 << "\" c=\"" << idx3 << "\"";
@@ -1405,20 +1433,20 @@ void yafrayFileRender_t::writeObject(Object* obj, const vector<VlakRen*> &VLR_li
if (uvc) {
ostr << " u_a=\"" << uvc->uv[ui1][0] << "\" v_a=\"" << 1-uvc->uv[ui1][1] << "\""
- << " u_b=\"" << uvc->uv[ui2][0] << "\" v_b=\"" << 1-uvc->uv[ui2][1] << "\""
- << " u_c=\"" << uvc->uv[ui3][0] << "\" v_c=\"" << 1-uvc->uv[ui3][1] << "\"";
+ << " u_b=\"" << uvc->uv[ui2][0] << "\" v_b=\"" << 1-uvc->uv[ui2][1] << "\""
+ << " u_c=\"" << uvc->uv[ui3][0] << "\" v_c=\"" << 1-uvc->uv[ui3][1] << "\"";
}
if ((EXPORT_VCOL) && (vlr->vcol)) {
// vertex colors
unsigned char* pt = reinterpret_cast<unsigned char*>(&vlr->vcol[ui1]);
ostr << " vcol_a_r=\"" << (float)pt[3]/255.f << "\" vcol_a_g=\"" << (float)pt[2]/255.f
- << "\" vcol_a_b=\"" << (float)pt[1]/255.f << "\"";
+ << "\" vcol_a_b=\"" << (float)pt[1]/255.f << "\"";
pt = reinterpret_cast<unsigned char*>(&vlr->vcol[ui2]);
ostr << " vcol_b_r=\"" << (float)pt[3]/255.f << "\" vcol_b_g=\"" << (float)pt[2]/255.f
- << "\" vcol_b_b=\"" << (float)pt[1]/255.f << "\"";
+ << "\" vcol_b_b=\"" << (float)pt[1]/255.f << "\"";
pt = reinterpret_cast<unsigned char*>(&vlr->vcol[ui3]);
ostr << " vcol_c_r=\"" << (float)pt[3]/255.f << "\" vcol_c_g=\"" << (float)pt[2]/255.f
- << "\" vcol_c_b=\"" << (float)pt[1]/255.f << "\"";
+ << "\" vcol_c_b=\"" << (float)pt[1]/255.f << "\"";
}
ostr << " shader_name=\"" << fmatname << "\" />\n";
diff --git a/source/blender/yafray/intern/export_Plugin.cpp b/source/blender/yafray/intern/export_Plugin.cpp
index a82101b24be..8392e32833e 100644
--- a/source/blender/yafray/intern/export_Plugin.cpp
+++ b/source/blender/yafray/intern/export_Plugin.cpp
@@ -966,7 +966,8 @@ void yafrayPluginRender_t::writeMaterialsAndModulators()
// object mode is also set as global, but the object matrix
// was specified above with <modulator..>
params["texco"] = yafray::parameter_t("global");
- else if (mtex->texco & TEXCO_ORCO)
+ else if ((mtex->texco & TEXCO_ORCO) || (mtex->texco & TEXCO_STRAND))
+ // orco flag now used for 'strand'-mapping as well, see mesh code
params["texco"] = yafray::parameter_t("orco");
else if (mtex->texco & TEXCO_WINDOW)
params["texco"] = yafray::parameter_t("window");
@@ -1138,7 +1139,7 @@ void yafrayPluginRender_t::genVcol(vector<yafray::CFLOAT> &vcol, VlakRen *vlr, b
void yafrayPluginRender_t::genFace(vector<int> &faces,vector<string> &shaders,vector<int> &faceshader,
vector<yafray::GFLOAT> &uvcoords,vector<yafray::CFLOAT> &vcol,
map<VertRen*, int> &vert_idx,VlakRen *vlr,
- bool has_orco,bool has_uv)
+ int has_orco,bool has_uv)
{
Material* fmat = vlr->mat;
bool EXPORT_VCOL = ((fmat->mode & (MA_VERTEXCOL|MA_VERTEXCOLP))!=0);
@@ -1184,7 +1185,7 @@ void yafrayPluginRender_t::genFace(vector<int> &faces,vector<string> &shaders,ve
void yafrayPluginRender_t::genCompleFace(vector<int> &faces,/*vector<string> &shaders,*/vector<int> &faceshader,
vector<yafray::GFLOAT> &uvcoords,vector<yafray::CFLOAT> &vcol,
map<VertRen*, int> &vert_idx,VlakRen *vlr,
- bool has_orco,bool has_uv)
+ int has_orco,bool has_uv)
{
Material* fmat = vlr->mat;
bool EXPORT_VCOL = ((fmat->mode & (MA_VERTEXCOL|MA_VERTEXCOLP))!=0);
@@ -1206,7 +1207,7 @@ void yafrayPluginRender_t::genCompleFace(vector<int> &faces,/*vector<string> &sh
}
void yafrayPluginRender_t::genVertices(vector<yafray::point3d_t> &verts, int &vidx,
- map<VertRen*, int> &vert_idx, VlakRen* vlr, bool has_orco, Object* obj)
+ map<VertRen*, int> &vert_idx, VlakRen* vlr, int has_orco, Object* obj)
{
VertRen* ver;
float tvec[3]; // for back2world transform
@@ -1224,7 +1225,11 @@ void yafrayPluginRender_t::genVertices(vector<yafray::point3d_t> &verts, int &vi
MTC_cp3Float(ver->co, tvec);
MTC_Mat4MulVecfl(imat, tvec);
verts.push_back(yafray::point3d_t(tvec[0], tvec[1], tvec[2]));
- if (has_orco) verts.push_back(yafray::point3d_t(ver->orco[0], ver->orco[1], ver->orco[2]));
+ // has_orco now an int, if 1 -> strand mapping, if 2 -> normal orco mapping
+ if (has_orco==1)
+ verts.push_back(yafray::point3d_t(ver->accum));
+ else if (has_orco==2)
+ verts.push_back(yafray::point3d_t(ver->orco[0], ver->orco[1], ver->orco[2]));
}
if (vert_idx.find(vlr->v2)==vert_idx.end())
{
@@ -1233,7 +1238,11 @@ void yafrayPluginRender_t::genVertices(vector<yafray::point3d_t> &verts, int &vi
MTC_cp3Float(ver->co, tvec);
MTC_Mat4MulVecfl(imat, tvec);
verts.push_back(yafray::point3d_t(tvec[0], tvec[1], tvec[2]));
- if (has_orco) verts.push_back(yafray::point3d_t(ver->orco[0], ver->orco[1], ver->orco[2]));
+ // has_orco now an int, if 1 -> strand mapping, if 2 -> normal orco mapping
+ if (has_orco==1)
+ verts.push_back(yafray::point3d_t(ver->accum));
+ else if (has_orco==2)
+ verts.push_back(yafray::point3d_t(ver->orco[0], ver->orco[1], ver->orco[2]));
}
if (vert_idx.find(vlr->v3)==vert_idx.end())
{
@@ -1242,7 +1251,11 @@ void yafrayPluginRender_t::genVertices(vector<yafray::point3d_t> &verts, int &vi
MTC_cp3Float(ver->co, tvec);
MTC_Mat4MulVecfl(imat, tvec);
verts.push_back(yafray::point3d_t(tvec[0], tvec[1], tvec[2]));
- if (has_orco) verts.push_back(yafray::point3d_t(ver->orco[0], ver->orco[1], ver->orco[2]));
+ // has_orco now an int, if 1 -> strand mapping, if 2 -> normal orco mapping
+ if (has_orco==1)
+ verts.push_back(yafray::point3d_t(ver->accum));
+ else if (has_orco==2)
+ verts.push_back(yafray::point3d_t(ver->orco[0], ver->orco[1], ver->orco[2]));
}
if ((vlr->v4) && (vert_idx.find(vlr->v4)==vert_idx.end()))
{
@@ -1251,7 +1264,11 @@ void yafrayPluginRender_t::genVertices(vector<yafray::point3d_t> &verts, int &vi
MTC_cp3Float(ver->co, tvec);
MTC_Mat4MulVecfl(imat, tvec);
verts.push_back(yafray::point3d_t(tvec[0], tvec[1], tvec[2]));
- if (has_orco) verts.push_back(yafray::point3d_t(ver->orco[0], ver->orco[1], ver->orco[2]));
+ // has_orco now an int, if 1 -> strand mapping, if 2 -> normal orco mapping
+ if (has_orco==1)
+ verts.push_back(yafray::point3d_t(ver->accum));
+ else if (has_orco==2)
+ verts.push_back(yafray::point3d_t(ver->orco[0], ver->orco[1], ver->orco[2]));
}
}
@@ -1284,7 +1301,11 @@ void yafrayPluginRender_t::writeObject(Object* obj, const vector<VlakRen*> &VLR_
// Test the rendermaterial texco flag instead.
// update2: bug #3193 it seems it has changed again with the introduction of static 'hair' particles,
// now it uses the vert pointer again as an extra test to make sure there are orco coords available
- bool has_orco = (((face0mat->texco & TEXCO_ORCO)!=0) && (face0->v1->orco!=NULL));
+ int has_orco = 0;
+ if (face0mat->texco & TEXCO_STRAND)
+ has_orco = 1;
+ else
+ has_orco = (((face0mat->texco & TEXCO_ORCO)!=0) && (face0->v1->orco!=NULL)) ? 2 : 0;
bool no_auto = true; //in case non-mesh, or mesh has no autosmooth
float sm_angle = 0.1f;
@@ -1883,8 +1904,9 @@ bool blenderYafrayOutput_t::putPixel(int x, int y, const yafray::color_t &c,
float* zbuf = rres.rectz + px;
if (zbuf) zbuf[x] = depth;
- out = (out+1) & 4095;
- if (out==0) {
+ out++;
+ // draw on completion of bucket & end of pass
+ if (((out & 4095)==0) || ((out % (re->rectx*re->recty))==0)) {
re->result->renlay = render_get_active_layer(re, re->result);
/* XXX second arg is rcti *rect, allows to indicate sub-rect in image to draw */
re->display_draw(re->result, NULL);
diff --git a/source/blender/yafray/intern/export_Plugin.h b/source/blender/yafray/intern/export_Plugin.h
index 14b24599e81..28e71596d50 100644
--- a/source/blender/yafray/intern/export_Plugin.h
+++ b/source/blender/yafray/intern/export_Plugin.h
@@ -53,13 +53,13 @@ class yafrayPluginRender_t : public yafrayRender_t
void genFace(std::vector<int> &faces,std::vector<std::string> &shaders,std::vector<int> &faceshader,
std::vector<yafray::GFLOAT> &uvcoords,std::vector<yafray::CFLOAT> &vcol,
std::map<VertRen*, int> &vert_idx,VlakRen *vlr,
- bool has_orco,bool has_uv);
+ int has_orco,bool has_uv);
void genCompleFace(std::vector<int> &faces,/*std::vector<std::string> &shaders,*/std::vector<int> &faceshader,
std::vector<yafray::GFLOAT> &uvcoords,std::vector<yafray::CFLOAT> &vcol,
std::map<VertRen*, int> &vert_idx,VlakRen *vlr,
- bool has_orco,bool has_uv);
+ int has_orco,bool has_uv);
void genVertices(std::vector<yafray::point3d_t> &verts, int &vidx,
- std::map<VertRen*, int> &vert_idx, VlakRen* vlr, bool has_orco, Object* obj);
+ std::map<VertRen*, int> &vert_idx, VlakRen* vlr, int has_orco, Object* obj);
};
class blenderYafrayOutput_t : public yafray::colorOutput_t
diff --git a/source/blender/yafray/intern/yafexternal.h b/source/blender/yafray/intern/yafexternal.h
index 7353748a1ad..7130bd55466 100644
--- a/source/blender/yafray/intern/yafexternal.h
+++ b/source/blender/yafray/intern/yafexternal.h
@@ -17,6 +17,7 @@ class point3d_t
{
public:
point3d_t() { x = y = z = 0; }
+ point3d_t(PFLOAT ix) { x = y = z = ix; }
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; }