Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

raycaster.h

Go to the documentation of this file.
00001 #ifndef RAYCASTER_H
00002 #define RAYCASTER_H
00003 
00004 
00005 
00006 #include "ray.h"
00007 #include "matrix.h"
00008 #define PI 3.141592654
00009 
00010 enum {
00011         RAYCASTER, PERSPECTIVE
00012 };
00013 
00014 
00015 class Raycaster {
00016 
00017 
00018 protected:
00019         
00020         bool ready;
00021         bool m_light;
00022         VECTOR m_lightpos;
00023 
00024         float m_ambient, m_diffuse, m_steplength, m_specular;
00025         int m_treshold, m_highlight;
00026         int m_width, m_height;
00027         Matrix4x4 *m_viewingtoworld, *m_viewingtoworld_inv;
00028         int m_raytype, m_rendermode;
00029         rgb *m_image;
00030         Data *m_data;
00031         Transfunc *m_tf;
00032         Color m_background;
00033         bool m_precalc;
00034         float m_zoom;
00035         float m_stepX, m_stepY;
00036         VECTOR m_xdir, m_ydir;
00037 
00038         int m_dMinDens, m_dMaxDens;
00039 
00040         bool SetViewingMatrix();
00041 public:
00042         Raycaster();
00043         ~Raycaster();
00044         bool SetViewingCondition(VECTOR lightpos, Color background, float ambient, float diffuse, float specular, int highlight);
00045 
00046         virtual bool Initialize(int width, int height, float steplength, Data *data, Transfunc *tf);
00047         virtual bool Raycast();
00048 
00049         bool SetTreshold(int treshold) { m_treshold = treshold; return true;};
00050         bool SetRaytype(int type) { m_raytype = type; return true;};
00051         bool SetRendermode(int rendermode) { m_rendermode = rendermode; return true;};
00052         bool SetPreCalcGradients(bool pc) { m_precalc = pc; return true;};
00053         bool Zoom(float zoom);
00054 
00055         void SetWidth(int width) { m_width = width; };
00056         void SetHeight(int height) { m_height = height; };
00057         void SetStepLength(float steplength) { m_steplength = steplength; };
00058         //void SetViewingPlanePos(float x, float y, float z);
00059         void SetAmbient(float ambient) { m_ambient = ambient; };
00060         void SetDiffuse(float diffuse) { m_diffuse = diffuse; };
00061         void SetSpecular(float specular) { m_specular = specular;};
00062         void SetHighlight(int highlight) {m_highlight = highlight;};
00063         void SetLightpos(VECTOR lightpos) { m_lightpos = lightpos;};
00064         void SetLight(bool light){m_light = light;};
00065         void SetBackgroundColor(unsigned char r, unsigned char g, unsigned char b) {
00066                                                                                                                 m_background = Color(r, g, b); };
00067 
00068         void SetDensRange(int mindens, int maxdens) { m_dMinDens = mindens; m_dMaxDens = maxdens; };
00069         
00070         virtual bool RotateX(float alpha);
00071         virtual bool RotateY(float alpha);
00072         virtual bool RotateZ(float alpha);
00073         bool Render(int width, int height);
00074 
00075         int m_dOwnType;
00076 
00077         rgb *GetScreenShotImage(int &width, int &height) { width = m_width;
00078                                                                                                                 height = m_height;
00079                                                                                                                 return m_image; };
00080 };
00081 /*
00082 class Perspective : public Raycaster {
00083 private:
00084         VECTOR m_eye;
00085         float m_dist;
00086 public:
00087         Perspective();
00088         ~Perspective();
00089         bool Initialize(VECTOR eye, float dist, int width, int height, float steplength, Data *data, Transfunc *tf);
00090 
00091         bool RotateX(float alpha);
00092         bool RotateY(float alpha);
00093         bool RotateZ(float alpha);
00094         bool Raycast();
00095 };
00096 */
00097 #endif;

Generated on Thu Jan 30 21:35:43 2003 for 3DVis by doxygen1.3-rc2