00001 #include <Cg/cgGL.h>
00002 #include "VolumeBuffer.h"
00003
00004
00005 class VolumeRender {
00006 public:
00007 VolumeRender(CGcontext cg_context, VolumeBuffer *volume);
00008 ~VolumeRender();
00009
00010 void render();
00011
00012 void setVolume(VolumeBuffer *volume) { m_volume = volume; }
00013
00014 void setDensity(float x) { m_density = x; }
00015 void setBrightness(float x) { m_brightness = x; }
00016
00017 void setSteps(int x) { m_steps = x; }
00018
00019
00020
00021 GLuint m_tfid;
00022
00023 private:
00024 void loadPrograms();
00025
00026 VolumeBuffer *m_volume;
00027
00028 CGcontext m_cg_context;
00029 CGprofile m_cg_vprofile, m_cg_fprofile;
00030
00031 CGprogram m_raymarch_vprog, m_raymarch_fprog;
00032 CGparameter m_density_param, m_brightness_param;
00033 CGparameter m_steps_param;
00034
00035 CGparameter transfer_function;
00036
00037 float m_density, m_brightness;
00038 int m_steps;
00039 };