test
parent
43303bc19a
commit
7d1d4ff56e
|
@ -1,5 +1,5 @@
|
||||||
cmake_minimum_required(VERSION 3.25)
|
cmake_minimum_required(VERSION 3.25)
|
||||||
project(gpu-particles VERSION 0.0.6)
|
project(gpu-particles VERSION 0.0.8)
|
||||||
|
|
||||||
option(ENABLE_ADDRSAN "Enable the address sanitizer" OFF)
|
option(ENABLE_ADDRSAN "Enable the address sanitizer" OFF)
|
||||||
option(ENABLE_UBSAN "Enable the ub sanitizer" OFF)
|
option(ENABLE_UBSAN "Enable the ub sanitizer" OFF)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/python3
|
#!python3
|
||||||
|
|
||||||
import subprocess
|
import subprocess
|
||||||
import argparse
|
import argparse
|
||||||
|
|
62
src/main.cpp
62
src/main.cpp
|
@ -34,22 +34,68 @@ blt::gfx::first_person_camera camera;
|
||||||
|
|
||||||
// use types for state that way you are not confused about what is happening?
|
// use types for state that way you are not confused about what is happening?
|
||||||
|
|
||||||
|
class unique_vbo_t
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit unique_vbo_t(const GLuint type): type(type)
|
||||||
|
{
|
||||||
|
glGenBuffers(1, &*vboID);
|
||||||
|
}
|
||||||
|
|
||||||
|
unique_vbo_t(const unique_vbo_t&) = delete;
|
||||||
|
|
||||||
|
unique_vbo_t& operator=(const unique_vbo_t&) = delete;
|
||||||
|
|
||||||
|
unique_vbo_t(unique_vbo_t&& other) noexcept: vboID(std::exchange(other.vboID, std::nullopt)), type(other.type)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
unique_vbo_t& operator=(unique_vbo_t&& other) noexcept
|
||||||
|
{
|
||||||
|
vboID = std::exchange(other.vboID, vboID);
|
||||||
|
type = std::exchange(other.type, type);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
~unique_vbo_t()
|
||||||
|
{
|
||||||
|
if (vboID)
|
||||||
|
glDeleteBuffers(1, &*vboID);
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::optional<GLuint> vboID;
|
||||||
|
GLuint type;
|
||||||
|
};
|
||||||
|
|
||||||
class unique_vao_t
|
class unique_vao_t
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
unique_vao_t(): vaoID(0)
|
unique_vao_t(): vaoID(0)
|
||||||
{}
|
|
||||||
|
|
||||||
void create()
|
|
||||||
{
|
{
|
||||||
#if blt_debug_has_flag(BLT_DEBUG_CONTRACTS)
|
|
||||||
BLT_CONTRACT(!vaoID, "VAO already created");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
vaoID = 0;
|
|
||||||
glGenVertexArrays(1, &*vaoID);
|
glGenVertexArrays(1, &*vaoID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unique_vao_t(const unique_vao_t&) = delete;
|
||||||
|
|
||||||
|
unique_vao_t& operator=(const unique_vao_t&) = delete;
|
||||||
|
|
||||||
|
unique_vao_t(unique_vao_t&& other) noexcept: vaoID(std::exchange(other.vaoID, std::nullopt))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
unique_vao_t& operator=(unique_vao_t&& other) noexcept
|
||||||
|
{
|
||||||
|
vaoID = std::exchange(other.vaoID, vaoID);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
~unique_vao_t()
|
||||||
|
{
|
||||||
|
if (vaoID)
|
||||||
|
glDeleteVertexArrays(1, &*vaoID);
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::optional<GLuint> vaoID;
|
std::optional<GLuint> vaoID;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue