Skip to content
Snippets Groups Projects

Implements #133 point alignment

Merged Nicolas Pope requested to merge feature/133/ilw into master
1 file
+ 3
2
Compare changes
  • Side-by-side
  • Inline
@@ -20,14 +20,14 @@ __global__ void computeNormals_kernel(ftl::cuda::TextureObject<float4> output,
@@ -20,14 +20,14 @@ __global__ void computeNormals_kernel(ftl::cuda::TextureObject<float4> output,
const float3 MC = make_float3(input.tex2D((int)x+0, (int)y-1)); //[(y-1)*width+(x+0)];
const float3 MC = make_float3(input.tex2D((int)x+0, (int)y-1)); //[(y-1)*width+(x+0)];
const float3 CM = make_float3(input.tex2D((int)x-1, (int)y+0)); //[(y+0)*width+(x-1)];
const float3 CM = make_float3(input.tex2D((int)x-1, (int)y+0)); //[(y+0)*width+(x-1)];
//if(CC.x != MINF && PC.x != MINF && CP.x != MINF && MC.x != MINF && CM.x != MINF) {
if(CC.x != MINF) { // && PC.x != MINF && CP.x != MINF && MC.x != MINF && CM.x != MINF) {
const float3 n = cross(PC-MC, CP-CM);
const float3 n = cross(PC-MC, CP-CM);
const float l = length(n);
const float l = length(n);
if(l > 0.0f) {
if(l > 0.0f) {
output(x,y) = make_float4(n/-l, 1.0f);
output(x,y) = make_float4(n/-l, 1.0f);
}
}
//}
}
}
}
}
}
@@ -51,6 +51,7 @@ __global__ void smooth_normals_kernel(ftl::cuda::TextureObject<float4> norms,
@@ -51,6 +51,7 @@ __global__ void smooth_normals_kernel(ftl::cuda::TextureObject<float4> norms,
const float3 p = make_float3(points.tex2D((int)x+u,(int)y+v));
const float3 p = make_float3(points.tex2D((int)x+u,(int)y+v));
if (p.x == MINF) continue;
if (p.x == MINF) continue;
const float s = ftl::cuda::spatialWeighting(p0, p, smoothing);
const float s = ftl::cuda::spatialWeighting(p0, p, smoothing);
 
//const float s = 1.0f;
if (s > 0.0f) {
if (s > 0.0f) {
const float4 n = norms.tex2D((int)x+u,(int)y+v);
const float4 n = norms.tex2D((int)x+u,(int)y+v);
Loading