bloboland

diff src/volume.h @ 1:cfe68befb7cc

some progress
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 15 Dec 2012 23:43:03 +0200
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/volume.h	Sat Dec 15 23:43:03 2012 +0200
     1.3 @@ -0,0 +1,39 @@
     1.4 +#ifndef VOLUME_H_
     1.5 +#define VOLUME_H_
     1.6 +
     1.7 +#include "vmath/vmath.h"
     1.8 +
     1.9 +class Volume {
    1.10 +private:
    1.11 +	int xsz, ysz, zsz;
    1.12 +	int slice_size;
    1.13 +	Vector4 *voxels;
    1.14 +
    1.15 +	Vector4 **slices;
    1.16 +
    1.17 +public:
    1.18 +	inline Volume(int xsz, int ysz, int zsz);
    1.19 +	inline ~Volume();
    1.20 +
    1.21 +	inline int get_size(int idx = -1) const;
    1.22 +
    1.23 +	// access to the voxel data based on voxel coordinates
    1.24 +	inline void set_voxel(int x, int y, int z, const Vector4 &val);
    1.25 +	inline void set_voxel_color(int x, int y, int z, const Vector3 &col);
    1.26 +	inline void set_voxel_alpha(int x, int y, int z, float alpha);
    1.27 +
    1.28 +	inline const Vector4 &get_voxel(int x, int y, int z) const;
    1.29 +	inline const Vector3 get_voxel_color(int x, int y, int z) const;
    1.30 +	inline float get_voxel_alpha(int x, int y, int z) const;
    1.31 +
    1.32 +	// linear access to the voxel data
    1.33 +	inline Vector4 &operator [](int idx);
    1.34 +	inline const Vector4 &operator [](int idx) const;
    1.35 +
    1.36 +	// raw access to the voxel data for building the OpenGL texture directly
    1.37 +	inline const Vector4 *get_data_ptr() const;
    1.38 +};
    1.39 +
    1.40 +#include "volume.inl"
    1.41 +
    1.42 +#endif	// VOLUME_H_