Subversion Repositories gelsvn

Rev

Rev 409 | Rev 417 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 409 Rev 412
Line 14... Line 14...
14
#include "curvature.h"
14
#include "curvature.h"
15
 
15
 
16
using namespace std;
16
using namespace std;
17
using namespace CGLA;
17
using namespace CGLA;
18
using namespace HMesh;
18
using namespace HMesh;
19
 
-
 
-
 
19
using namespace CVarUtils;
20
 
20
 
21
int WINX=800, WINY=800;
21
int WINX=800, WINY=800;
22
 
22
 
23
 
23
 
24
bool VisObj::reload(string _file)
24
bool VisObj::reload(string _file)
Line 54... Line 54...
54
			renderer = new GlazedRenderer(mani, smooth, bsphere_radius);
54
			renderer = new GlazedRenderer(mani, smooth, bsphere_radius);
55
		else if(short_name == "too")
55
		else if(short_name == "too")
56
			renderer = new ToonRenderer(mani, smooth);
56
			renderer = new ToonRenderer(mani, smooth);
57
		else if(short_name == "cur")
57
		else if(short_name == "cur")
58
		{
58
		{
59
			static CVar<string> line_direction("display.curvature_lines.direction", "min");
59
			static string& line_direction = CreateCVar<string>("display.curvature_lines.direction", "min");
60
			
60
			
61
			std::vector<CGLA::Mat3x3d> curvature_tensors;
61
			std::vector<CGLA::Mat3x3d> curvature_tensors;
62
			curvature_tensors_from_edges(mani, curvature_tensors);
62
			curvature_tensors_from_edges(mani, curvature_tensors);
63
			smooth_curvature_tensors(mani,curvature_tensors);
63
			smooth_curvature_tensors(mani,curvature_tensors);
64
			smooth_curvature_tensors(mani,curvature_tensors);
64
			smooth_curvature_tensors(mani,curvature_tensors);
Line 75... Line 75...
75
			
75
			
76
			renderer = new LineFieldRenderer(mani, smooth, lines, bsphere_radius);
76
			renderer = new LineFieldRenderer(mani, smooth, lines, bsphere_radius);
77
		}
77
		}
78
		else if(short_name == "gau")
78
		else if(short_name == "gau")
79
		{
79
		{
80
			static CVar<float> smoothing("display.gaussian_curvature_renderer.smoothing",2);
80
			static float& smoothing = CreateCVar("display.gaussian_curvature_renderer.smoothing",2.0f);
81
			vector<double> scalars;
81
			vector<double> scalars;
82
			gaussian_curvature_angle_defects(mani, scalars, smoothing);
82
			gaussian_curvature_angle_defects(mani, scalars, smoothing);
83
			double max_G = 0;
83
			double max_G = 0;
84
			for(unsigned int i=0;i<scalars.size(); ++i)
84
			for(int i=0;i<scalars.size(); ++i)
85
				max_G = max(abs(scalars[i]), max_G);
85
				max_G = max(abs(scalars[i]), max_G);
86
			renderer = new ScalarFieldRenderer(mani, smooth, scalars, max_G);
86
			renderer = new ScalarFieldRenderer(mani, smooth, scalars, max_G);
87
			
87
			
88
		}
88
		}
89
		else if(short_name == "mea")
89
		else if(short_name == "mea")
90
		{
90
		{
91
			static CVar<float> smoothing("display.mean_curvature_renderer.smoothing",2);
91
			static int& smoothing = CreateCVar("display.mean_curvature_renderer.smoothing",2);
92
			vector<double> scalars;
92
			vector<double> scalars;
93
			mean_curvatures(mani, scalars, smoothing);
93
			mean_curvatures(mani, scalars, smoothing);
94
			double max_G = 0;
94
			double max_G = 0;
-
 
95
			double mean = 0;
95
			for(unsigned int i=0;i<scalars.size(); ++i)
96
			for(int i=0;i<scalars.size(); ++i)
-
 
97
			{
96
				max_G = max(abs(scalars[i]), max_G);
98
				max_G = max(abs(scalars[i]), max_G);
-
 
99
				mean += scalars[i];
-
 
100
			}
97
			renderer = new ScalarFieldRenderer(mani, smooth, scalars, max_G);
101
			renderer = new ScalarFieldRenderer(mani, smooth, scalars, max_G);
98
			
-
 
99
		}
102
		}
100
		else if(short_name == "amb")
103
		else if(short_name == "amb")
101
		{
104
		{
102
			static CVar<float> smoothing("display.ambient_occlusion_renderer.smoothing",1);
105
			static int& smoothing = CreateCVar("display.ambient_occlusion_renderer.smoothing",1);
103
			vector<double> scalars;
106
			vector<double> scalars;
104
			mean_curvatures(mani, scalars, smoothing);
107
			mean_curvatures(mani, scalars, smoothing);
105
			double max_G = 0;
108
			double max_G = 0;
106
			for(unsigned int i=0;i<scalars.size(); ++i)
109
			for(int i=0;i<scalars.size(); ++i)
107
				max_G = max(abs(scalars[i]), max_G);
110
				max_G = max(abs(scalars[i]), max_G);
108
			renderer = new AmbientOcclusionRenderer(mani, smooth, scalars, max_G);
111
			renderer = new AmbientOcclusionRenderer(mani, smooth, scalars, max_G);
109
			
112
			
110
		}
113
		}
111
		else if(short_name == "cop")
114
		else if(short_name == "cop")
112
		{
115
		{
113
			static CVar<float> smoothing("display.patina_renderer.smoothing",1);
116
			static int& smoothing = CreateCVar("display.patina_renderer.smoothing",1);
114
			vector<double> scalars;
117
			vector<double> scalars;
115
			mean_curvatures(mani, scalars, smoothing);
118
			mean_curvatures(mani, scalars, smoothing);
116
			double max_G = 0;
119
			double max_G = 0;
117
			for(unsigned int i=0;i<scalars.size(); ++i)
120
			for(int i=0;i<scalars.size(); ++i)
118
				max_G = max(abs(scalars[i]), max_G);
121
				max_G = max(abs(scalars[i]), max_G);
119
			renderer = new CopperRenderer(mani, smooth, scalars, max_G,bsphere_radius);
122
			renderer = new CopperRenderer(mani, smooth, scalars, max_G,bsphere_radius);
120
			
123
			
121
		}
124
		}
122
		else
125
		else