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:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2006-12-21 16:47:27 +0300
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2006-12-21 16:47:27 +0300
commit47bc3d1208c48903f53728d17d3acbb1ccbd06cb (patch)
treeeca808294b88940590b8dc7e9693acc20ef2048f /source/blender/yafray
parentedccdf934018264002c034906e8a287d12b7ead7 (diff)
Added names to UV and vertex color layers, and display them as a list.
Added support for multiple UVs in the render engine. This also involved changing the way faces are stored, to allow data to be added optionally per 256 faces, same as the existing system for vertices. A UV layer can be specified in the Map Input panel and the Geometry node by name. Leaving this field blank will default to the active UV layer. Also added sharing of face selection and hiding between UV layers, and at the same time improved syncing with editmode selection and hiding. Still to do: - Multi UV support for fastshade. - Multires and NMesh preservation of multiple UV sets.
Diffstat (limited to 'source/blender/yafray')
-rwxr-xr-xsource/blender/yafray/intern/export_File.cpp24
-rw-r--r--source/blender/yafray/intern/export_Plugin.cpp19
-rw-r--r--source/blender/yafray/intern/yafray_Render.cpp19
-rw-r--r--source/blender/yafray/intern/yafray_Render.h1
4 files changed, 36 insertions, 27 deletions
diff --git a/source/blender/yafray/intern/export_File.cpp b/source/blender/yafray/intern/export_File.cpp
index 7d9f23a4e4c..c8c0b3c6bb1 100755
--- a/source/blender/yafray/intern/export_File.cpp
+++ b/source/blender/yafray/intern/export_File.cpp
@@ -1230,7 +1230,7 @@ void yafrayFileRender_t::writeObject(Object* obj, const vector<VlakRen*> &VLR_li
string matname(face0mat->id.name);
// use name in imgtex_shader list if 'TexFace' enabled for this material
if (face0mat->mode & MA_FACETEXTURE) {
- MTFace* tface = face0->tface;
+ MTFace* tface = RE_vlakren_get_tface(re, face0, 0, NULL, 0);
if (tface) {
Image* fimg = (Image*)tface->tpage;
if (fimg) matname = imgtex_shader[string(face0mat->id.name) + string(fimg->id.name)];
@@ -1412,7 +1412,7 @@ void yafrayFileRender_t::writeObject(Object* obj, const vector<VlakRen*> &VLR_li
string fmatname(fmat->id.name);
// use name in imgtex_shader list if 'TexFace' enabled for this face material
if (fmat->mode & MA_FACETEXTURE) {
- MTFace* tface = vlr->tface;
+ MTFace* tface = RE_vlakren_get_tface(re, vlr, 0, NULL, 0);
if (tface) {
Image* fimg = (Image*)tface->tpage;
if (fimg) fmatname = imgtex_shader[fmatname + string(fimg->id.name)];
@@ -1437,23 +1437,25 @@ void yafrayFileRender_t::writeObject(Object* obj, const vector<VlakRen*> &VLR_li
}
else if (vlr->flag & R_FACE_SPLIT) { ui2++; ui3++; }
- MTFace* uvc = vlr->tface; // possible uvcoords (v upside down)
+ MTFace* uvc = RE_vlakren_get_tface(re, vlr, 0, NULL, 0); // 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] << "\"";
}
+ MCol *mcol= RE_vlakren_get_mcol(re, vlr, 0, NULL, 0);
+
// since Blender seems to need vcols when uvs are used, for yafray only export when the material actually uses vcols
- if ((EXPORT_VCOL) && (vlr->vcol)) {
+ if ((EXPORT_VCOL) && mcol) {
// vertex colors
- unsigned char* pt = reinterpret_cast<unsigned char*>(&vlr->vcol[ui1]);
+ unsigned char* pt = reinterpret_cast<unsigned char*>(&mcol[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 << "\"";
- pt = reinterpret_cast<unsigned char*>(&vlr->vcol[ui2]);
+ pt = reinterpret_cast<unsigned char*>(&mcol[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 << "\"";
- pt = reinterpret_cast<unsigned char*>(&vlr->vcol[ui3]);
+ pt = reinterpret_cast<unsigned char*>(&mcol[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 << "\"";
}
@@ -1480,15 +1482,15 @@ void yafrayFileRender_t::writeObject(Object* obj, const vector<VlakRen*> &VLR_li
<< " 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)) {
+ if ((EXPORT_VCOL) && mcol) {
// vertex colors
- unsigned char* pt = reinterpret_cast<unsigned char*>(&vlr->vcol[ui1]);
+ unsigned char* pt = reinterpret_cast<unsigned char*>(&mcol[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 << "\"";
- pt = reinterpret_cast<unsigned char*>(&vlr->vcol[ui2]);
+ pt = reinterpret_cast<unsigned char*>(&mcol[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 << "\"";
- pt = reinterpret_cast<unsigned char*>(&vlr->vcol[ui3]);
+ pt = reinterpret_cast<unsigned char*>(&mcol[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 << "\"";
}
diff --git a/source/blender/yafray/intern/export_Plugin.cpp b/source/blender/yafray/intern/export_Plugin.cpp
index d2ed7f66f32..6a6137fefe9 100644
--- a/source/blender/yafray/intern/export_Plugin.cpp
+++ b/source/blender/yafray/intern/export_Plugin.cpp
@@ -1109,7 +1109,9 @@ void yafrayPluginRender_t::genUVcoords(vector<yafray::GFLOAT> &uvcoords, VlakRen
void yafrayPluginRender_t::genVcol(vector<yafray::CFLOAT> &vcol, VlakRen *vlr, bool comple)
{
- if (vlr->vcol)
+ MCol *mcol= RE_vlakren_get_mcol(re, vlr, 0, NULL, 0);
+
+ if (mcol)
{
// tri vcol split indices
int ui1=0, ui2=1, ui3=2;
@@ -1123,11 +1125,11 @@ void yafrayPluginRender_t::genVcol(vector<yafray::CFLOAT> &vcol, VlakRen *vlr, b
ui2 = (ui2+2) & 3;
ui3 = (ui3+2) & 3;
}
- unsigned char* pt = reinterpret_cast<unsigned char*>(&vlr->vcol[ui1]);
+ unsigned char* pt = reinterpret_cast<unsigned char*>(&mcol[ui1]);
vcol.push_back((float)pt[3]/255.f); vcol.push_back((float)pt[2]/255.f); vcol.push_back((float)pt[1]/255.f);
- pt = reinterpret_cast<unsigned char*>(&vlr->vcol[ui2]);
+ pt = reinterpret_cast<unsigned char*>(&mcol[ui2]);
vcol.push_back((float)pt[3]/255.f); vcol.push_back((float)pt[2]/255.f); vcol.push_back((float)pt[1]/255.f);
- pt = reinterpret_cast<unsigned char*>(&vlr->vcol[ui3]);
+ pt = reinterpret_cast<unsigned char*>(&mcol[ui3]);
vcol.push_back((float)pt[3]/255.f); vcol.push_back((float)pt[2]/255.f); vcol.push_back((float)pt[1]/255.f);
}
else
@@ -1148,7 +1150,7 @@ void yafrayPluginRender_t::genFace(vector<int> &faces,vector<string> &shaders,ve
string fmatname(fmat->id.name);
// use name in imgtex_shader list if 'TexFace' enabled for this face material
if (fmat->mode & MA_FACETEXTURE) {
- MTFace* tface = vlr->tface;
+ MTFace* tface = RE_vlakren_get_tface(re, vlr, 0, NULL, 0);
if (tface) {
Image* fimg = (Image*)tface->tpage;
if (fimg) fmatname = imgtex_shader[fmatname + string(fimg->id.name)];
@@ -1168,7 +1170,8 @@ void yafrayPluginRender_t::genFace(vector<int> &faces,vector<string> &shaders,ve
shaders.push_back(fmatname);
faceshader.push_back(shaders.size()-1);
}
- MTFace* uvc = vlr->tface; // possible uvcoords (v upside down)
+
+ MTFace* uvc = RE_vlakren_get_tface(re, vlr, 0, NULL, 0); // possible uvcoords (v upside down)
int idx1, idx2, idx3;
idx1 = vert_idx.find(vlr->v1)->second;
@@ -1193,7 +1196,7 @@ void yafrayPluginRender_t::genCompleFace(vector<int> &faces,/*vector<string> &sh
bool EXPORT_VCOL = ((fmat->mode & (MA_VERTEXCOL|MA_VERTEXCOLP))!=0);
faceshader.push_back(faceshader.back());
- MTFace* uvc = vlr->tface; // possible uvcoords (v upside down)
+ MTFace* uvc = RE_vlakren_get_tface(re, vlr, 0, NULL, 0); // possible uvcoords (v upside down)
int idx1, idx2, idx3;
idx1 = vert_idx.find(vlr->v3)->second;
idx2 = vert_idx.find(vlr->v4)->second;
@@ -1336,7 +1339,7 @@ void yafrayPluginRender_t::writeObject(Object* obj, const vector<VlakRen*> &VLR_
{
VlakRen* vlr = *fci;
genVertices(verts, vidx, vert_idx, vlr, has_orco, obj);
- if(vlr->tface) has_uv=true;
+ if(RE_vlakren_get_tface(re, vlr, 0, NULL, 0)) has_uv=true;
}
// all faces using the index list created above
vector<int> faces;
diff --git a/source/blender/yafray/intern/yafray_Render.cpp b/source/blender/yafray/intern/yafray_Render.cpp
index 0d9757b19ad..01ab49c001b 100644
--- a/source/blender/yafray/intern/yafray_Render.cpp
+++ b/source/blender/yafray/intern/yafray_Render.cpp
@@ -86,7 +86,7 @@ bool yafrayRender_t::getAllMatTexObs()
for (int i=0; i < re->totvlak; i++) {
- if ((i & 255)==0) vlr = re->blovl[i>>8]; else vlr++;
+ if ((i & 255)==0) vlr=re->vlaknodes[i>>8].vlak; else vlr++;
// ---- The materials & textures
// in this case, probably every face has a material assigned, which can be the default material,
@@ -129,17 +129,20 @@ bool yafrayRender_t::getAllMatTexObs()
// Also make list of facetexture images (material 'TexFace').
if (vlr->ob) {
int nv = 0; // number of vertices
+ MTFace *tface;
+
if (vlr->v4) nv=4; else if (vlr->v3) nv=3;
if (nv) {
renderobs[vlr->ob->id.name] = vlr->ob;
all_objects[vlr->ob].push_back(vlr);
- if (vlr->tface) {
- Image* fc_img = vlr->tface->tpage;
- if (fc_img) {
- Material* fmat = vlr->mat;
- // only save if TexFace enabled
- if (fmat && (fmat->mode & MA_FACETEXTURE)) imagetex[fc_img].insert(fmat);
- }
+
+ tface= RE_vlakren_get_tface(re, vlr, 0, NULL, 0);
+ if (tface && tface->tpage) {
+ Material* fmat = vlr->mat;
+
+ // only save if TexFace enabled
+ if(fmat && (fmat->mode & MA_FACETEXTURE))
+ imagetex[tface->tpage].insert(fmat);
}
}
}
diff --git a/source/blender/yafray/intern/yafray_Render.h b/source/blender/yafray/intern/yafray_Render.h
index 0d794b6755d..4002f514a6e 100644
--- a/source/blender/yafray/intern/yafray_Render.h
+++ b/source/blender/yafray/intern/yafray_Render.h
@@ -24,6 +24,7 @@ extern "C" {
#include "BKE_global.h"
#include "render_types.h"
+#include "renderdatabase.h"
/* display_draw() needs render layer info */
#include "renderpipeline.h"