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:
Diffstat (limited to 'source/blender/render')
-rw-r--r--source/blender/render/extern/include/RE_pipeline.h4
-rw-r--r--source/blender/render/intern/source/convertblender.c18
-rw-r--r--source/blender/render/intern/source/pipeline.c57
-rw-r--r--source/blender/render/intern/source/pointdensity.c2
-rw-r--r--source/blender/render/intern/source/render_texture.c3
5 files changed, 75 insertions, 9 deletions
diff --git a/source/blender/render/extern/include/RE_pipeline.h b/source/blender/render/extern/include/RE_pipeline.h
index d9ed83a00b2..0736bed4faf 100644
--- a/source/blender/render/extern/include/RE_pipeline.h
+++ b/source/blender/render/extern/include/RE_pipeline.h
@@ -51,6 +51,7 @@ struct ReportList;
struct ReportList;
struct Scene;
struct SceneRenderLayer;
+struct EnvMap;
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
/* this include is what is exposed of render to outside world */
@@ -230,6 +231,9 @@ void RE_ReadRenderResult(struct Scene *scene, struct Scene *scenode);
void RE_WriteRenderResult(RenderResult *rr, const char *filename, int compress);
struct RenderResult *RE_MultilayerConvert(void *exrhandle, int rectx, int recty);
+extern const float default_envmap_layout[];
+int RE_WriteEnvmapResult(struct ReportList *reports, struct Scene *scene, struct EnvMap *env, const char *relpath, int imtype, float layout[12]);
+
/* do a full sample buffer compo */
void RE_MergeFullSample(struct Render *re, struct Main *bmain, struct Scene *sce, struct bNodeTree *ntree);
diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c
index 7033ec27fc0..2f79560efd6 100644
--- a/source/blender/render/intern/source/convertblender.c
+++ b/source/blender/render/intern/source/convertblender.c
@@ -1345,8 +1345,11 @@ static void particle_billboard(Render *re, ObjectRen *obr, Material *ma, Particl
VlakRen *vlr;
MTFace *mtf;
float xvec[3], yvec[3], zvec[3], bb_center[3];
+ /* Number of tiles */
int totsplit = bb->uv_split * bb->uv_split;
- float uvx = 0.0f, uvy = 0.0f, uvdx = 1.0f, uvdy = 1.0f, time = 0.0f;
+ int tile, x, y;
+ /* Tile offsets */
+ float uvx = 0.0f, uvy = 0.0f, uvdx = 1.0f, uvdy = 1.0f, time = 0.0f;
vlr= RE_findOrAddVlak(obr, obr->totvlak++);
vlr->v1= RE_findOrAddVert(obr, obr->totvert++);
@@ -1420,11 +1423,14 @@ static void particle_billboard(Render *re, ObjectRen *obr, Material *ma, Particl
else if(bb->split_offset==PART_BB_OFF_RANDOM)
time = (float)fmod(time + bb->random, 1.0f);
- uvx = uvdx * floor((float)(bb->uv_split * bb->uv_split) * (float)fmod((double)time, (double)uvdx));
- uvy = uvdy * floor((1.0f - time) * (float)bb->uv_split);
-
- if(fmod(time, 1.0f / bb->uv_split) == 0.0f)
- uvy -= uvdy;
+ /* Find the coordinates in tile space (integer), then convert to UV
+ * space (float). Note that Y is flipped. */
+ tile = (int)((time + FLT_EPSILON10) * totsplit);
+ x = tile % bb->uv_split;
+ y = tile / bb->uv_split;
+ y = (bb->uv_split - 1) - y;
+ uvx = uvdx * x;
+ uvy = uvdy * y;
}
/* normal UVs */
diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c
index 0afbffc5fd5..0d5f8c77f6b 100644
--- a/source/blender/render/intern/source/pipeline.c
+++ b/source/blender/render/intern/source/pipeline.c
@@ -3463,3 +3463,60 @@ static int external_render_3d(Render *re, int do_all)
return 1;
}
+const float default_envmap_layout[] = { 0,0, 1,0, 2,0, 0,1, 1,1, 2,1 };
+
+int RE_WriteEnvmapResult(struct ReportList *reports, Scene *scene, EnvMap *env, const char *relpath, int imtype, float layout[12])
+{
+ ImBuf *ibuf=NULL;
+ int ok;
+ int dx;
+ int maxX=0,maxY=0,i=0;
+ char filepath[FILE_MAX];
+
+ if(env->cube[1]==NULL) {
+ BKE_report(reports, RPT_ERROR, "There is no generated environment map available to save");
+ return 0;
+ }
+
+ dx= env->cube[1]->x;
+
+ if (env->type == ENV_CUBE) {
+ for (i=0; i < 12; i+=2) {
+ maxX = MAX2(maxX,layout[i] + 1);
+ maxY = MAX2(maxY,layout[i+1] + 1);
+ }
+
+ ibuf = IMB_allocImBuf(maxX*dx, maxY*dx, 24, IB_rectfloat);
+
+ for (i=0; i < 12; i+=2)
+ if (layout[i] > -1 && layout[i+1] > -1)
+ IMB_rectcpy(ibuf, env->cube[i/2], layout[i]*dx, layout[i+1]*dx, 0, 0, dx, dx);
+ }
+ else if (env->type == ENV_PLANE) {
+ ibuf = IMB_allocImBuf(dx, dx, 24, IB_rectfloat);
+ IMB_rectcpy(ibuf, env->cube[1], 0, 0, 0, 0, dx, dx);
+ }
+ else {
+ BKE_report(reports, RPT_ERROR, "Invalid environment map type");
+ return 0;
+ }
+
+ if (scene->r.color_mgt_flag & R_COLOR_MANAGEMENT)
+ ibuf->profile = IB_PROFILE_LINEAR_RGB;
+
+ /* to save, we first get absolute path */
+ BLI_strncpy(filepath, relpath, sizeof(filepath));
+ BLI_path_abs(filepath, G.main->name);
+
+ ok= BKE_write_ibuf(ibuf, filepath, imtype, scene->r.subimtype, scene->r.quality);
+
+ IMB_freeImBuf(ibuf);
+
+ if(ok) {
+ return TRUE;
+ }
+ else {
+ BKE_report(reports, RPT_ERROR, "Error writing environment map.");
+ return FALSE;
+ }
+}
diff --git a/source/blender/render/intern/source/pointdensity.c b/source/blender/render/intern/source/pointdensity.c
index b45528b96d9..980f6b6af1e 100644
--- a/source/blender/render/intern/source/pointdensity.c
+++ b/source/blender/render/intern/source/pointdensity.c
@@ -104,7 +104,7 @@ static void pointdensity_cache_psys(Render *re, PointDensity *pd, Object *ob, Pa
{
DerivedMesh* dm;
ParticleKey state;
- ParticleSimulationData sim= {0};
+ ParticleSimulationData sim= {NULL};
ParticleData *pa=NULL;
float cfra = BKE_curframe(re->scene);
int i, childexists;
diff --git a/source/blender/render/intern/source/render_texture.c b/source/blender/render/intern/source/render_texture.c
index a4c1778c624..fbbb33d0172 100644
--- a/source/blender/render/intern/source/render_texture.c
+++ b/source/blender/render/intern/source/render_texture.c
@@ -1789,7 +1789,7 @@ static int compatible_bump_compute(CompatibleBump *compat_bump, ShadeInput *shi,
const float adx[3] = {fabsf(dx[0]), fabsf(dx[1]), fabsf(dx[2])};
const float ady[3] = {fabsf(dy[0]), fabsf(dy[1]), fabsf(dy[2])};
du = MAX3(adx[0], adx[1], adx[2]);
- dv = MAX3(ady[1], ady[1], ady[2]);
+ dv = MAX3(ady[0], ady[1], ady[2]);
}
}
@@ -2358,7 +2358,6 @@ void do_material_tex(ShadeInput *shi)
f1= shi->vn[0];
f2= shi->vn[1];
texres.nor[0]= f1*co_nor+f2*si;
- texres.nor[1]= f2*co_nor-f1*si;
f1= shi->vn[1];
f2= shi->vn[2];
texres.nor[1]= f1*co_nor+f2*si;