Code cleanup / Cycles:
* Avoid 2 int castings in hair code and fix some comments.
This commit is contained in:
@@ -298,7 +298,7 @@ __device_inline void bvh_cardinal_curve_intersect(KernelGlobals *kg, Intersectio
|
|||||||
|
|
||||||
/*obtain curve parameters*/
|
/*obtain curve parameters*/
|
||||||
{
|
{
|
||||||
/*ray transform created - this shold be created at beginning of intersection loop*/
|
/*ray transform created - this should be created at beginning of intersection loop*/
|
||||||
Transform htfm;
|
Transform htfm;
|
||||||
float d = sqrtf(dir.x * dir.x + dir.z * dir.z);
|
float d = sqrtf(dir.x * dir.x + dir.z * dir.z);
|
||||||
htfm = make_transform(
|
htfm = make_transform(
|
||||||
|
@@ -102,7 +102,7 @@ __device float curve_thickness(KernelGlobals *kg, ShaderData *sd)
|
|||||||
{
|
{
|
||||||
float r = 0.0f;
|
float r = 0.0f;
|
||||||
|
|
||||||
if(sd->segment != (int)~0) {
|
if(sd->segment != ~0) {
|
||||||
float4 curvedata = kernel_tex_fetch(__curves, sd->prim);
|
float4 curvedata = kernel_tex_fetch(__curves, sd->prim);
|
||||||
int k0 = __float_as_int(curvedata.x) + sd->segment;
|
int k0 = __float_as_int(curvedata.x) + sd->segment;
|
||||||
int k1 = k0 + 1;
|
int k1 = k0 + 1;
|
||||||
@@ -119,7 +119,7 @@ __device float3 curve_tangent_normal(KernelGlobals *kg, ShaderData *sd)
|
|||||||
{
|
{
|
||||||
float3 tgN = make_float3(0.0f,0.0f,0.0f);
|
float3 tgN = make_float3(0.0f,0.0f,0.0f);
|
||||||
|
|
||||||
if(sd->segment != (int)~0) {
|
if(sd->segment != ~0) {
|
||||||
float normalmix = kernel_data.curve_kernel_data.normalmix;
|
float normalmix = kernel_data.curve_kernel_data.normalmix;
|
||||||
|
|
||||||
tgN = -(-sd->I - sd->dPdu * (dot(sd->dPdu,-sd->I) * normalmix / len_squared(sd->dPdu)));
|
tgN = -(-sd->I - sd->dPdu * (dot(sd->dPdu,-sd->I) * normalmix / len_squared(sd->dPdu)));
|
||||||
|
@@ -102,7 +102,7 @@ __device_noinline bool direct_emission(KernelGlobals *kg, ShaderData *sd, int li
|
|||||||
if(is_zero(light_eval))
|
if(is_zero(light_eval))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/* todo: use visbility flag to skip lights */
|
/* todo: use visibility flag to skip lights */
|
||||||
|
|
||||||
/* evaluate BSDF at shading point */
|
/* evaluate BSDF at shading point */
|
||||||
float bsdf_pdf;
|
float bsdf_pdf;
|
||||||
|
@@ -748,9 +748,9 @@ typedef enum CurveFlag {
|
|||||||
/* runtime flags */
|
/* runtime flags */
|
||||||
CURVE_KN_BACKFACING = 1, /* backside of cylinder? */
|
CURVE_KN_BACKFACING = 1, /* backside of cylinder? */
|
||||||
CURVE_KN_ENCLOSEFILTER = 2, /* don't consider strands surrounding start point? */
|
CURVE_KN_ENCLOSEFILTER = 2, /* don't consider strands surrounding start point? */
|
||||||
CURVE_KN_CURVEDATA = 4, /* curve data available? */
|
CURVE_KN_CURVEDATA = 4, /* curve data available? */
|
||||||
CURVE_KN_INTERPOLATE = 8, /* render as a curve? - not supported yet */
|
CURVE_KN_INTERPOLATE = 8, /* render as a curve? */
|
||||||
CURVE_KN_ACCURATE = 16, /* use accurate intersections test? */
|
CURVE_KN_ACCURATE = 16, /* use accurate intersections test? */
|
||||||
CURVE_KN_INTERSECTCORRECTION = 32, /* correct for width after determing closest midpoint? */
|
CURVE_KN_INTERSECTCORRECTION = 32, /* correct for width after determing closest midpoint? */
|
||||||
CURVE_KN_POSTINTERSECTCORRECTION = 64, /* correct for width after intersect? */
|
CURVE_KN_POSTINTERSECTCORRECTION = 64, /* correct for width after intersect? */
|
||||||
CURVE_KN_NORMALCORRECTION = 128, /* correct tangent normal for slope? */
|
CURVE_KN_NORMALCORRECTION = 128, /* correct tangent normal for slope? */
|
||||||
|
Reference in New Issue
Block a user