From 9a984d23dfa975ce8b01f3e605414bf69b2ac239 Mon Sep 17 00:00:00 2001 From: nico Date: Tue, 19 Dec 2017 00:57:20 +1100 Subject: [PATCH] refactored a bit the code --- wrap/gl/gl_field.h | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/wrap/gl/gl_field.h b/wrap/gl/gl_field.h index f48f0530..b887801e 100644 --- a/wrap/gl/gl_field.h +++ b/wrap/gl/gl_field.h @@ -74,10 +74,11 @@ public: const ScalarType &size, const bool oneside, const bool onlyPD1, - const ScalarType maxN) + const ScalarType maxN, + const ScalarType minN) { CoordType center=(f.cP(0)+f.cP(1)+f.cP(2))/3; - CoordType normal=f.cN(); + //CoordType normal=f.cN(); CoordType dir[4]; vcg::tri::CrossField::CrossVector(f,dir); @@ -92,10 +93,10 @@ public: ScalarType IntervW=MaxW-MinW; if (Norm0>maxN)Norm0=maxN; if (Norm1>maxN)Norm1=maxN; - vcg::Color4b Col0=vcg::Color4b::ColorRamp(0,maxN,Norm0); - vcg::Color4b Col1=vcg::Color4b::ColorRamp(0,maxN,Norm1); - ScalarType W0=(Norm0/maxN)*IntervW+MinW; - ScalarType W1=(Norm1/maxN)*IntervW+MinW; + vcg::Color4b Col0=vcg::Color4b::ColorRamp(minN,maxN,Norm0); + vcg::Color4b Col1=vcg::Color4b::ColorRamp(minN,maxN,Norm1); + ScalarType W0=(Norm0/(maxN-minN))*IntervW+MinW; + ScalarType W1=(Norm1/(maxN-minN))*IntervW+MinW; GLDrawField(dir,center,size,W0,W1,Col0,Col1,oneside,onlyPD1); } } @@ -132,7 +133,8 @@ public: bool onlyPD1, bool oneside, ScalarType GlobalScale=0.002, - const ScalarType maxN=0) + const ScalarType maxN=0, + const ScalarType minN=0) { glPushAttrib(GL_ALL_ATTRIB_BITS); @@ -144,7 +146,7 @@ public: for (unsigned int i=0;i