rts_glVolumeViewer.h 1.88 KB
#ifndef RTS_GLVOLUMEVIEWER_H
#define RTS_GLVOLUMEVIEWER_H

#include <windows.h>
#include <gl/glew.h>
#include <FL/glut.h>
#include <gl/gl.h>
//#include <gl/glxext.h>
#include <gl/glext.h>
#include <gl/wglext.h>
//#include <gl/wglext.h>
#include "rtsMath.h"
#include "rtsVolume.h"
#include "rts_glUtilities.h"

class rts_glVolumeViewer
{
private:

	rtsVolume m_source;
	GLuint m_volume_texture;
	vector3D m_texture_size;			//size of the volume being viewed (in voxels)
	vector3D m_voxel_size;
	bool m_optimize;					//optimization flag (use more texture space for faster viz)

	point3D m_p;				//position of the volume (0,0,0) corner in space
	vector3D m_dimensions;

	double m_alpha_scale;
	unsigned char m_min_threshold;	//min and max thresholds to be displayed
	unsigned char m_max_threshold;

	unsigned int m_num_planes;

	GLuint m_dl_planes;			//planes display list

	
	double m_inner_radius;			//radius of the inscribed sphere
	double m_outer_radius;		//radius of the circumscribed sphere
	
	void m_draw_plane(point3D p, vector3D n, vector3D u);	//draws a camera-oriented plane at point with normal n
	void m_load_texture();


public:
	rts_glVolumeViewer();
	//rts_glVolumeViewer(rtsVolume volume_data, point3D position);
	rts_glVolumeViewer(rtsVolume volume_data, 
					   point3D position, 
					   vector3D voxel_size);
	void SetSize(float x, float y, float z);
	void SetVoxelSize(float x, float y, float z);
	vector3D GetSize();
	vector3D GetVoxelSize();
	void RenderBoundingBox();
	void RenderCameraSlice(point3D eye_point, vector3D camera_up, float slice_number = 0.0);
	void RenderVolume(point3D eye_point, vector3D camera_up);
	void SetAlphaScale(double scale){m_alpha_scale = scale;}
	void SetNumPlanes(unsigned int planes);
	void SetThreshold(unsigned char lower, unsigned char upper);
	void Optimize(bool flag);
	void Invert();
};



#endif