www.pudn.com > Ì廿֯Âë.rar > ray.h, change:2001-12-09,size:2390b


#ifndef __raycast_h__ 
#define __raycast_h__ 
 
#include "volume.h" 
#include "transfunc.h" 
#include "tfvolume.h" 
 
#define TRANSPARENCYLIMIT 0.01f 
 
// abstract class Ray  
 
class Ray 
{ 
protected: 
   Volume *m_volume; 
   TransferFunction *m_tf; 
   float m_step_length; 
   bool m_usetf; 
   bool m_usehighlights; 
 
public: 
   Ray(Volume *vol, TransferFunction *tf); 
   virtual ~Ray(); 
 
   void UseTransFunc(bool use); 
   void UseHighlights(bool use); 
   void SetStepLength(float steplength); 
   virtual void Cast(coord3 pos, coord3 dir, rgba &color); 
}; 
 
// first hit nearest neigbour  
class RayFirstHitNN : public Ray 
{ 
protected: 
   int m_threshold; 
public: 
   RayFirstHitNN(Volume *vol, TransferFunction *tf) : Ray(vol, tf) {}; 
   virtual ~RayFirstHitNN() {}; 
   void SetThreshold(int threshold); 
   virtual void Cast(coord3 pos, coord3 dir, rgba &color); 
}; 
 
// first hit trilinear filtering 
class RayFirstHitTL : public RayFirstHitNN 
{ 
public: 
   RayFirstHitTL(Volume *vol, TransferFunction *tf) : RayFirstHitNN(vol, tf) {}; 
   virtual ~RayFirstHitTL() {}; 
   virtual void Cast(coord3 pos, coord3 dir, rgba &color); 
}; 
 
// max intensity nearest neigbour 
class RayMaxIntensityNN : public Ray 
{ 
public: 
   RayMaxIntensityNN(Volume *vol, TransferFunction *tf) : Ray(vol, tf) {}; 
   virtual ~RayMaxIntensityNN() {}; 
   virtual void Cast(coord3 pos, coord3 dir, rgba &color); 
}; 
 
// max intensity trilinear filtering 
class RayMaxIntensityTL : public Ray 
{ 
public: 
   RayMaxIntensityTL(Volume *vol, TransferFunction *tf) : Ray(vol, tf) {}; 
   virtual ~RayMaxIntensityTL() {}; 
   virtual void Cast(coord3 pos, coord3 dir, rgba &color); 
}; 
 
// max transparency nearest neighbour 
class RayTransparencyNN : public Ray 
{ 
protected: 
   TransferFunctionVolume *m_tfv; 
public: 
   RayTransparencyNN(Volume *vol, TransferFunction *tf) : Ray(vol, tf) { m_tfv = NULL; }; 
   void SetTransFuncVolume(TransferFunctionVolume *tfv); 
   virtual ~RayTransparencyNN() {}; 
   virtual void Cast(coord3 pos, coord3 dir, rgba &color); 
}; 
 
// max transparency trilinear filtering 
class RayTransparencyTL : public RayTransparencyNN 
{ 
public: 
   RayTransparencyTL(Volume *vol, TransferFunction *tf) : RayTransparencyNN(vol, tf) {}; 
   virtual ~RayTransparencyTL() {}; 
   virtual void Cast(coord3 pos, coord3 dir, rgba &color); 
}; 
 
#endif