5 #ifndef BALL_VIEW_RENDERING_RENDERERS_CUDARAYTRACINGRENDERER_H
6 #define BALL_VIEW_RENDERING_RENDERERS_CUDARAYTRACINGRENDERER_H
8 #define BALLVIEW_CUDAVOLUMERENDERER_THROW(exceptionName, message) (throw BALL::Exception::##exceptionName##(__FILE__, __LINE__, message))
10 #include <cudamm/cuda.hpp>
27 cuda::Cuda cudaCtx(0);
28 cuda::Module mod(
"../libVIEW/GeneratedFiles/Debug/raytracer_debug.cubin");
30 catch(cuda::Exception
const &e)
32 BALL::Log.
error() <<
"Initialization of CudaVolumeRenderer failed" << std::endl;
42 return "CUDA Volume Renderer v1";
60 renderImpl<int>(
reinterpret_cast<int*
>(buffer->getData()), fmt.
getWidth(), fmt.
getHeight());
64 renderImpl<float>(
reinterpret_cast<float*
>(buffer->getData()), fmt.
getWidth(), fmt.
getHeight());
70 template<
typename taPixelType>
71 void renderImpl(taPixelType* buffer,
const unsigned int width,
const unsigned int height);
74 void renderImpl(
int* buffer,
const unsigned int width,
const unsigned int height)
76 for (
unsigned int j = 0; j < height; j++)
78 for (
unsigned int i = 0; i < width; i++)
80 if ( (((i / 64) % 2) == 0) && (((j / 64) % 2) == 0))
82 buffer[j*width + i] = (0 << 24) | (255 << 16) | (0 << 8) | (0);
86 buffer[j*width + i] = (0 << 24) | (0 << 16) | (0 << 8) | (255);
94 void renderImpl(
float* buffer,
const unsigned int width,
const unsigned int height)
96 for (
unsigned int j = 0; j < height; j++)
98 for (
unsigned int i = 0; i < width; i++)
100 if ( (((i / 64) % 2) == 0) && (((j / 64) % 2) == 0))
102 buffer[3 * (j*width + i) + 0] = 1;
103 buffer[3 * (j*width + i) + 1] = 0;
104 buffer[3 * (j*width + i) + 2] = 0;
108 buffer[3 * (j*width + i) + 0] = 0;
109 buffer[3 * (j*width + i) + 1] = 1;
110 buffer[3 * (j*width + i) + 2] = 0;
124 #endif // BALL_VIEW_RENDERING_CUDARAYTRACINGRENDERER_H
virtual void prepareBufferedRendering(const Stage &stage)
#define BALLVIEW_CUDAVOLUMERENDERER_THROW(exceptionName, message)
virtual void renderToBufferImpl(FrameBufferPtr buffer)
virtual void formatUpdated()
boost::shared_ptr< FrameBuffer > FrameBufferPtr
BALL_EXPORT LogStream Log
virtual String getRenderer()
LogStream & error(int n=0)
virtual bool init(const Scene &scene)