Merge branch 'blender2.7'

This commit is contained in:
Brecht Van Lommel 2019-03-18 19:06:21 +01:00
commit a29186efb4
Notes: blender-bot 2023-02-14 03:17:59 +01:00
Referenced by issue #62772, erase alpha not shown in overlay mode
6 changed files with 15 additions and 29 deletions

View File

@ -250,7 +250,7 @@ static bool ObtainCacheParticleUV(Mesh *mesh,
BL::Mesh::uv_layers_iterator l;
b_mesh->uv_layers.begin(l);
float3 uv = make_float3(0.0f, 0.0f, 0.0f);
float2 uv = make_float2(0.0f, 0.0f);
if(b_mesh->uv_layers.length())
b_psys.uv_on_emitter(psmd, *b_pa, pa_no, uv_num, &uv.x);
CData->curve_uv.push_back_slow(uv);
@ -752,45 +752,29 @@ static void ExportCurveSegmentsMotion(Mesh *mesh, ParticleCurveData *CData, int
static void ExportCurveTriangleUV(ParticleCurveData *CData,
int vert_offset,
int resol,
float3 *uvdata)
float2 *uvdata)
{
if(uvdata == NULL)
return;
float time = 0.0f;
float prevtime = 0.0f;
int vertexindex = vert_offset;
for(int sys = 0; sys < CData->psys_firstcurve.size(); sys++) {
for(int curve = CData->psys_firstcurve[sys]; curve < CData->psys_firstcurve[sys] + CData->psys_curvenum[sys]; curve++) {
for(int curvekey = CData->curve_firstkey[curve]; curvekey < CData->curve_firstkey[curve] + CData->curve_keynum[curve] - 1; curvekey++) {
const float curve_time = CData->curvekey_time[curvekey];
const float curve_length = CData->curve_length[curve];
time = (curve_length > 0.0f) ? curve_time / curve_length : 0.0f;
for(int section = 0; section < resol; section++) {
uvdata[vertexindex] = CData->curve_uv[curve];
uvdata[vertexindex].z = prevtime;
vertexindex++;
uvdata[vertexindex] = CData->curve_uv[curve];
uvdata[vertexindex].z = time;
vertexindex++;
uvdata[vertexindex] = CData->curve_uv[curve];
uvdata[vertexindex].z = prevtime;
vertexindex++;
uvdata[vertexindex] = CData->curve_uv[curve];
uvdata[vertexindex].z = time;
vertexindex++;
uvdata[vertexindex] = CData->curve_uv[curve];
uvdata[vertexindex].z = prevtime;
vertexindex++;
uvdata[vertexindex] = CData->curve_uv[curve];
uvdata[vertexindex].z = time;
vertexindex++;
}
prevtime = time;
}
}
}
@ -1063,9 +1047,9 @@ void BlenderSync::sync_curves(Mesh *mesh,
if(active_render)
attr_uv = mesh->attributes.add(std, name);
else
attr_uv = mesh->attributes.add(name, TypeDesc::TypePoint, ATTR_ELEMENT_CORNER);
attr_uv = mesh->attributes.add(name, TypeFloat2, ATTR_ELEMENT_CORNER);
float3 *uv = attr_uv->data_float3();
float2 *uv = attr_uv->data_float2();
ExportCurveTriangleUV(&CData, tri_num * 3, used_res, uv);
}
@ -1073,9 +1057,9 @@ void BlenderSync::sync_curves(Mesh *mesh,
if(active_render)
attr_uv = mesh->curve_attributes.add(std, name);
else
attr_uv = mesh->curve_attributes.add(name, TypeDesc::TypePoint, ATTR_ELEMENT_CURVE);
attr_uv = mesh->curve_attributes.add(name, TypeFloat2, ATTR_ELEMENT_CURVE);
float3 *uv = attr_uv->data_float3();
float2 *uv = attr_uv->data_float2();
if(uv) {
size_t i = 0;

View File

@ -125,7 +125,9 @@
#define fmodf(x, y) fmod((float)(x), (float)(y))
#define sinhf(x) sinh(((float)(x)))
#if !(defined(__KERNEL_OPENCL_AMD__) || defined(__KERNEL_OPENCL_INTEL_CPU__))
/* Use native functions with possibly lower precision for performance,
* no issues found so far. */
#if 1
# define sinf(x) native_sin(((float)(x)))
# define cosf(x) native_cos(((float)(x)))
# define tanf(x) native_tan(((float)(x)))
@ -140,7 +142,7 @@
# define expf(x) exp(((float)(x)))
# define sqrtf(x) sqrt(((float)(x)))
# define logf(x) log(((float)(x)))
# define rcp(x) recip(x))
# define rcp(x) recip(x)
#endif
/* data lookup defines */

View File

@ -318,7 +318,7 @@ ccl_device_noinline float3 indirect_background(KernelGlobals *kg,
# endif
path_state_modify_bounce(state, true);
shader_eval_surface(kg, emission_sd, state, PATH_RAY_EMISSION);
shader_eval_surface(kg, emission_sd, state, state->flag | PATH_RAY_EMISSION);
path_state_modify_bounce(state, false);
L = shader_background_eval(emission_sd);

View File

@ -75,7 +75,7 @@ public:
array<int> curve_firstkey;
array<int> curve_keynum;
array<float> curve_length;
array<float3> curve_uv;
array<float2> curve_uv;
array<float3> curve_vcol;
array<float3> curvekey_co;

View File

@ -192,7 +192,7 @@ bool LightManager::has_background_light(Scene *scene)
return false;
}
void LightManager::disable_ineffective_light(Device * /*device*/, Scene *scene)
void LightManager::disable_ineffective_light(Scene *scene)
{
/* Make all lights enabled by default, and perform some preliminary checks
* needed for finer-tuning of settings (for example, check whether we've
@ -880,7 +880,7 @@ void LightManager::device_update(Device *device, DeviceScene *dscene, Scene *sce
use_light_visibility = false;
disable_ineffective_light(device, scene);
disable_ineffective_light(scene);
device_update_points(device, dscene, scene);
if(progress.get_cancel()) return;

View File

@ -110,7 +110,7 @@ protected:
* which doesn't contribute to the scene or which is only used for MIS
* and scene doesn't need MIS.
*/
void disable_ineffective_light(Device *device, Scene *scene);
void disable_ineffective_light(Scene *scene);
void device_update_points(Device *device,
DeviceScene *dscene,