Subversion Repositories gelsvn

Rev

Rev 630 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 630 Rev 632
Line 39... Line 39...
39
				diff(max_val - min_val) {}
39
				diff(max_val - min_val) {}
40
			
40
			
41
			void operator()(const CGLA::Vec3i& pi, const float& vox_val)
41
			void operator()(const CGLA::Vec3i& pi, const float& vox_val)
42
				{
42
				{
43
					float scaled = (vox_val-min_val) / diff;
43
					float scaled = (vox_val-min_val) / diff;
44
					float clamped = 255.0f *(CGLA::s_min(1.0f,CGLA::s_max(0.0f,scaled)));
44
					float clamped = 255.0f *(std::min(1.0f,std::max(0.0f,scaled)));
45
					unsigned char x = static_cast<unsigned char>(clamped);
45
					unsigned char x = static_cast<unsigned char>(clamped);
46
					of.write((char*) &x, 1);
46
					of.write((char*) &x, 1);
47
				}	
47
				}	
48
		};
48
		};
49
 
49