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         Plane *m_viewingplane;
00027         int m_width, m_height;
00028         Matrix4x4 *m_viewingtoworld;
00029         int m_raytype, m_rendermode;
00030         rgb *m_image;
00031         Data *m_data;
00032         Transfunc *m_tf;
00033         Color m_background;
00034         bool m_precalc;
00035         float m_zoom;
00036         float m_stepX, m_stepY;
00037         VECTOR m_xdir, m_ydir;
00038         bool SetViewingMatrix();
00039 public:
00040         Raycaster();
00041         ~Raycaster();
00042         bool SetViewingCondition(VECTOR lightpos, Color background, float ambient, float diffuse, float specular, int highlight);
00043 
00044         virtual bool Initialize(VECTOR viewingplanepos, int width, int height, float steplength, Data *data, Transfunc *tf);
00045         virtual bool Raycast();
00046 
00047         bool SetTreshold(int treshold) { m_treshold = treshold; return true;};
00048         bool SetRaytype(int type) { m_raytype = type; return true;};
00049         bool SetRendermode(int rendermode) { m_rendermode = rendermode; return true;};
00050         bool SetPreCalcGradients(bool pc) { m_precalc = pc; return true;};
00051         bool Zoom(float zoom);
00052 
00053         void SetWidth(int width) { m_width = width; };
00054         void SetHeight(int height) { m_height = height; };
00055         void SetStepLength(float steplength) { m_steplength = steplength; };
00056         void SetViewingPlanePos(float x, float y, float z);
00057         void SetAmbient(float ambient) { m_ambient = ambient; };
00058         void SetDiffuse(float diffuse) { m_diffuse = diffuse; };
00059         void SetSpecular(float specular) { m_specular = specular;};
00060         void SetHighlight(int highlight) {m_highlight = highlight;};
00061         void SetLightpos(VECTOR lightpos) { m_lightpos = lightpos;};
00062         void SetLight(bool light){m_light = light;};
00063         void SetBackgroundColor(unsigned char r, unsigned char g, unsigned char b) {
00064                                                                                                                 m_background = Color(r, g, b); };
00065 
00066         
00067         virtual bool RotateX(float alpha);
00068         virtual bool RotateY(float alpha);
00069         virtual bool RotateZ(float alpha);
00070         bool Render(int width, int height);
00071 
00072         int m_dOwnType;
00073 
00074         rgb *GetScreenShotImage(int &width, int &height) { width = m_width;
00075                                                                                                                 height = m_height;
00076                                                                                                                 return m_image; };
00077 };
00078 
00079 class Perspective : public Raycaster {
00080 private:
00081         VECTOR m_eye;
00082         float m_dist;
00083 public:
00084         Perspective();
00085         ~Perspective();
00086         bool Initialize(VECTOR eye, float dist, int width, int height, float steplength, Data *data, Transfunc *tf);
00087 
00088         bool RotateX(float alpha);
00089         bool RotateY(float alpha);
00090         bool RotateZ(float alpha);
00091         bool Raycast();
00092 };
00093 #endif;

Generated on Thu Jan 23 12:32:16 2003 by doxygen1.3-rc2