#include <ray.h>
Inheritance diagram for FirstHitNN:

Public Methods | |
| FirstHitNN () | |
| bool | SetTreshold (int treshold) |
| virtual bool | CastNext () |
Protected Attributes | |
| int | m_treshold |
|
|
Definition at line 82 of file ray.h.
00082 {m_treshold = 0.0;};
|
|
|
Reimplemented from Ray. Definition at line 295 of file ray.cpp. References Data::GetDensity(), Transfunc::GetDensityColor(), Transfunc::GetOpacity(), VECTOR::length(), Ray::Lighting(), Ray::m_alpha, Ray::m_backgroundcolor, Ray::m_currentcolor, Ray::m_currentpos, Ray::m_data, Ray::m_direction, Ray::m_radius, Ray::m_startpoint, Ray::m_steplength, Ray::m_tf, m_treshold, Ray::mx, Ray::my, Ray::mz, ROUND, VECTOR::x, VECTOR::y, and VECTOR::z.
00295 {
00296
00297 if(m_data == NULL) return false;
00298 if(m_tf == NULL) return false;
00299
00300 int step_count = 0;
00301 bool first = true;
00302 VECTOR distancetomidpoint = VECTOR(mx/2.0f,my/2.0f,mz/2.0f)-m_currentpos;
00303 int steps = (int)((distancetomidpoint.length() + m_radius)/m_steplength);
00304 do {
00305
00306 if((m_currentpos.x >= 0.0)&&(m_currentpos.y >= 0.0)&&(m_currentpos.z >= 0.0)&&(m_currentpos.x < mx)&&(m_currentpos.y < my)&&(m_currentpos.z < mz)) {
00307 if(first) {
00308 m_startpoint = VECTOR(m_currentpos.x,m_currentpos.y,m_currentpos.z);
00309 first = false;
00310 }
00311 int d = m_data->GetDensity((int)ROUND(m_currentpos.x),(int)ROUND(m_currentpos.y),(int)ROUND(m_currentpos.z));
00312 if(d > m_treshold) {
00313 Color help_color = m_tf->GetDensityColor(d);
00314 float help_alpha = m_tf->GetOpacity(d);
00315 // lightning:
00316 help_color = Lighting(help_color);
00317 // calculate new currentcolor:
00318 m_currentcolor = help_color;
00319 // calculate new alphavalue
00320 m_alpha = help_alpha;
00321 break;
00322 }
00323 }
00324 // calculate new position
00325 m_currentpos += m_steplength*m_direction;
00326
00327 step_count++;
00328 }while(step_count <= steps);
00329 if(m_alpha < 1.0 ) m_currentcolor += m_backgroundcolor*(1.0 - m_alpha);
00330 return true;
00331 }
|
|
|
Definition at line 83 of file ray.h.
00083 { m_treshold = treshold; return true;};
|
|
|
Definition at line 80 of file ray.h. Referenced by CastNext(). |
1.3-rc2