forked from bartvdbraak/blender
Fix for normal scaling when using triangle primitives for hair.
and some code clean ups in blender_curves and node_shader_hair_info.c
This commit is contained in:
parent
178a877a95
commit
0f3931dee4
@ -380,7 +380,7 @@ void ExportCurveTrianglePlanes(Mesh *mesh, ParticleCurveData *CData, int interpo
|
||||
float3 ickey_loc = make_float3(0.0f,0.0f,0.0f);
|
||||
float time = 0.0f;
|
||||
|
||||
if ((interpolation == 2) && (curvekey == CData->curve_firstkey[curve]) && (subv == 0))
|
||||
if ((interpolation == CURVE_BSPLINE) && (curvekey == CData->curve_firstkey[curve]) && (subv == 0))
|
||||
ickey_loc = CData->curvekey_co[curvekey];
|
||||
else
|
||||
InterpolateKeySegments(subv, segments, curvekey, curve, &ickey_loc, &time, CData , interpolation);
|
||||
@ -413,6 +413,7 @@ void ExportCurveTrianglePlanes(Mesh *mesh, ParticleCurveData *CData, int interpo
|
||||
mesh->attributes.remove(ATTR_STD_FACE_NORMAL);
|
||||
mesh->add_face_normals();
|
||||
mesh->add_vertex_normals();
|
||||
mesh->attributes.remove(ATTR_STD_FACE_NORMAL);
|
||||
|
||||
/* texture coords still needed */
|
||||
|
||||
@ -494,7 +495,7 @@ void ExportCurveTriangleRibbons(Mesh *mesh, ParticleCurveData *CData, int interp
|
||||
float3 ickey_loc = make_float3(0.0f,0.0f,0.0f);
|
||||
float time = 0.0f;
|
||||
|
||||
if ((interpolation == 2) && (curvekey == CData->curve_firstkey[curve]) && (subv == 0))
|
||||
if ((interpolation == CURVE_BSPLINE) && (curvekey == CData->curve_firstkey[curve]) && (subv == 0))
|
||||
ickey_loc = CData->curvekey_co[curvekey];
|
||||
else
|
||||
InterpolateKeySegments(subv, segments, curvekey, curve, &ickey_loc, &time, CData , interpolation);
|
||||
@ -526,7 +527,7 @@ void ExportCurveTriangleRibbons(Mesh *mesh, ParticleCurveData *CData, int interp
|
||||
mesh->attributes.remove(ATTR_STD_FACE_NORMAL);
|
||||
mesh->add_face_normals();
|
||||
mesh->add_vertex_normals();
|
||||
|
||||
mesh->attributes.remove(ATTR_STD_FACE_NORMAL);
|
||||
/* texture coords still needed */
|
||||
|
||||
}
|
||||
@ -611,7 +612,7 @@ void ExportCurveTriangleGeometry(Mesh *mesh, ParticleCurveData *CData, int inter
|
||||
float3 ickey_loc = make_float3(0.0f,0.0f,0.0f);
|
||||
float time = 0.0f;
|
||||
|
||||
if ((interpolation == 2) && (curvekey == CData->curve_firstkey[curve]) && (subv == 0))
|
||||
if ((interpolation == CURVE_BSPLINE) && (curvekey == CData->curve_firstkey[curve]) && (subv == 0))
|
||||
ickey_loc = CData->curvekey_co[curvekey];
|
||||
else
|
||||
InterpolateKeySegments(subv, segments, curvekey, curve, &ickey_loc, &time, CData , interpolation);
|
||||
@ -649,6 +650,7 @@ void ExportCurveTriangleGeometry(Mesh *mesh, ParticleCurveData *CData, int inter
|
||||
mesh->attributes.remove(ATTR_STD_FACE_NORMAL);
|
||||
mesh->add_face_normals();
|
||||
mesh->add_vertex_normals();
|
||||
mesh->attributes.remove(ATTR_STD_FACE_NORMAL);
|
||||
|
||||
/* texture coords still needed */
|
||||
}
|
||||
|
@ -35,11 +35,6 @@ static bNodeSocketTemplate outputs[] = {
|
||||
{ -1, 0, "" }
|
||||
};
|
||||
|
||||
static int node_shader_gpu_curve_attrib(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out)
|
||||
{
|
||||
return GPU_stack_link(mat, "NODE_HAIR_INFO", in, out);
|
||||
}
|
||||
|
||||
/* node type definition */
|
||||
void register_node_type_sh_hair_info(bNodeTreeType *ttype)
|
||||
{
|
||||
@ -52,7 +47,7 @@ void register_node_type_sh_hair_info(bNodeTreeType *ttype)
|
||||
node_type_init(&ntype, NULL);
|
||||
node_type_storage(&ntype, "", NULL, NULL);
|
||||
node_type_exec(&ntype, NULL);
|
||||
node_type_gpu(&ntype, node_shader_gpu_curve_attrib);
|
||||
node_type_gpu(&ntype, NULL);
|
||||
|
||||
nodeRegisterType(ttype, &ntype);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user