diff options
| author | Jasper van de Gronde <jasper.vandegronde@gmail.com> | 2009-04-03 15:16:18 +0000 |
|---|---|---|
| committer | jaspervdg <jaspervdg@users.sourceforge.net> | 2009-04-03 15:16:18 +0000 |
| commit | 863cc2bbd59361f196a10b08dc52f1f32ccc1e86 (patch) | |
| tree | e885bbc1df3cfa943dd0f1136009e63cc9ccc7cc /src/display/nr-3dutils.cpp | |
| parent | io/crystalegg.xml: Fix a couple of textual errors. (diff) | |
| download | inkscape-863cc2bbd59361f196a10b08dc52f1f32ccc1e86.tar.gz inkscape-863cc2bbd59361f196a10b08dc52f1f32ccc1e86.zip | |
And now gradients should be (almost) perfect... The gradient vector is set up to be a good approximation to the "true" gradient and it is used consistently throughout (I hope).
Also some other, minor, tweaks and a small bugfix.
(bzr r7616)
Diffstat (limited to 'src/display/nr-3dutils.cpp')
| -rw-r--r-- | src/display/nr-3dutils.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/display/nr-3dutils.cpp b/src/display/nr-3dutils.cpp index dd1419f2b..89c21940a 100644 --- a/src/display/nr-3dutils.cpp +++ b/src/display/nr-3dutils.cpp @@ -125,13 +125,14 @@ void compute_surface_normal(Fvector &N, gdouble ss, NRPixBlock *in, int i, int j alpha_idx_y = alpha_idx + 4*(k-1)*dy*w; for (l = START(x_carac); l <= FINISH(x_carac); l++) { alpha = (data + alpha_idx_y + 4*dx*(l-1))[3]; - accu_x += K_X[y_carac][x_carac][k][l] * alpha / 255; - accu_y += K_X[x_carac][y_carac][l][k] * alpha / 255; + accu_x += K_X[y_carac][x_carac][k][l] * alpha; + accu_y += K_X[x_carac][y_carac][l][k] * alpha; } } - N[X_3D] = -1 * ss * FACTOR_X[y_carac][x_carac] * accu_x / dx; - N[Y_3D] = -1 * ss * FACTOR_X[x_carac][y_carac] * accu_y / dy; - N[Z_3D] = 1; + ss /= 255.0; // Correction for scale of pixel values + N[X_3D] = -ss * FACTOR_X[y_carac][x_carac] * accu_x / dx; + N[Y_3D] = -ss * FACTOR_X[x_carac][y_carac] * accu_y / dy; + N[Z_3D] = 1.0; normalize_vector(N); //std::cout << "(" << N[X_3D] << ", " << N[Y_3D] << ", " << N[Z_3D] << ")" << std::endl; } |
