Voxelizer.h 635 Bytes
Newer Older
Bastian Krayer's avatar
Bastian Krayer committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#ifndef SS18CG3_VOXELIZER_H
#define SS18CG3_VOXELIZER_H

#include <CVK_2/CVK_Framework.h>

struct BoundingBox {
    glm::vec3 min;
    glm::vec3 max;
};

class Voxelizer {
  public:
    Voxelizer(glm::ivec3 res, CVK::Geometry& geometry);
    ~Voxelizer();

    void voxelize(CVK::Geometry& geometry);
    void free();

    GLuint getVoxelTexture();
    BoundingBox getBB();

  protected:
    CVK::ShaderSet m_voxelizationShader;
    GLuint m_voxelTexture;
    GLint m_resUniform;
    GLint m_projUniform;
    GLint m_modelUniform;

    CVK::Ortho m_ortho;
    glm::ivec3 m_res;

    BoundingBox m_bb;
};

#endif // SS18CG3_VOXELIZER_H