HPC_Voxel_Engine 0.2.0
High-Performance C++ Voxel Engine
Loading...
Searching...
No Matches
ThermalVolume.h
Go to the documentation of this file.
1
7#pragma once
8#include <glad/glad.h>
9
10namespace Renderer {
11
18public:
19 unsigned int ID;
21
22 ThermalVolume(int iWidth, int iHeight, int iDepth)
23 : iSizeX(iWidth), iSizeY(iHeight), iSizeZ(iDepth) {
24 glCreateTextures(GL_TEXTURE_3D, 1, &ID);
25 glTextureParameteri(ID, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
26 glTextureParameteri(ID, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
27 glTextureParameteri(ID, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
28 glTextureParameteri(ID, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
29 glTextureParameteri(ID, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
30
31 glTextureStorage3D(ID, 1, GL_R32F, iSizeX, iSizeY, iSizeZ);
32 }
33
34 ~ThermalVolume() { glDeleteTextures(1, &ID); }
35
36 ThermalVolume(const ThermalVolume& obj) = delete;
38
39 void Update(const float* pfData) const {
40 glTextureSubImage3D(ID, 0, 0, 0, 0, iSizeX, iSizeY, iSizeZ, GL_RED, GL_FLOAT, pfData);
41 }
42
43 void Bind(unsigned int iSlot) const { glBindTextureUnit(iSlot, ID); }
44};
45
46} // namespace Renderer
RAII wrapper around an OpenGL 3D texture (GL_R32F) for storing and updating thermal voxel data.
Definition ThermalVolume.h:17
ThermalVolume(int iWidth, int iHeight, int iDepth)
Definition ThermalVolume.h:22
void Update(const float *pfData) const
Definition ThermalVolume.h:39
void Bind(unsigned int iSlot) const
Definition ThermalVolume.h:43
ThermalVolume(const ThermalVolume &obj)=delete
int iSizeX
Definition ThermalVolume.h:20
~ThermalVolume()
Definition ThermalVolume.h:34
int iSizeY
Definition ThermalVolume.h:20
int iSizeZ
Definition ThermalVolume.h:20
ThermalVolume & operator=(const ThermalVolume &)=delete
unsigned int ID
Definition ThermalVolume.h:19
Definition Buffer.h:4