rare variant
parent
0ae9162c5e
commit
c2ed1dec40
|
@ -1,5 +1,5 @@
|
|||
cmake_minimum_required(VERSION 3.25)
|
||||
project(gpu-particles VERSION 0.0.3)
|
||||
project(gpu-particles VERSION 0.0.4)
|
||||
|
||||
option(ENABLE_ADDRSAN "Enable the address sanitizer" OFF)
|
||||
option(ENABLE_UBSAN "Enable the ub sanitizer" OFF)
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
#ifdef __cplusplus
|
||||
#include <string>
|
||||
const std::string shader_particle_2d_frag = R"("
|
||||
#version 300 es
|
||||
precision mediump float;
|
||||
|
||||
layout (location = 0) in vec4 position_uv;
|
||||
|
||||
out vec2 UVs;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vec4(position_uv.x, position_uv.y, 0.0, 1.0);
|
||||
UVs = position_uv.zw;
|
||||
}
|
||||
|
||||
")";
|
||||
#endif
|
|
@ -1,6 +1,6 @@
|
|||
#ifdef __cplusplus
|
||||
#include <string>
|
||||
const std::string shader_2d_font_frag = R"("
|
||||
const std::string shader_particle_2d_vert = R"("
|
||||
#version 300 es
|
||||
precision mediump float;
|
||||
|
||||
|
|
11
src/main.cpp
11
src/main.cpp
|
@ -18,6 +18,8 @@
|
|||
#include "blt/gfx/renderer/resource_manager.h"
|
||||
#include "blt/gfx/renderer/batch_2d_renderer.h"
|
||||
#include "blt/gfx/renderer/camera.h"
|
||||
#include <shaders/particle.frag>
|
||||
#include <shaders/particle.vert>
|
||||
#include <imgui.h>
|
||||
|
||||
blt::gfx::matrix_state_manager global_matrices;
|
||||
|
@ -32,10 +34,10 @@ struct particle_t
|
|||
blt::vec2 acceleration;
|
||||
};
|
||||
|
||||
blt::gfx::vertex_array_t particle_vao;
|
||||
blt::gfx::vertex_buffer_t particle_vbo;
|
||||
blt::gfx::element_buffer_t alive_particles_ebo;
|
||||
blt::gfx::shader_t particle_shader{};
|
||||
std::unique_ptr<blt::gfx::vertex_array_t> particle_vao;
|
||||
std::unique_ptr<blt::gfx::vertex_buffer_t> particle_vbo;
|
||||
std::unique_ptr<blt::gfx::element_buffer_t> alive_particles_ebo;
|
||||
std::unique_ptr<blt::gfx::shader_t> particle_shader;
|
||||
|
||||
std::vector<blt::u32> alive_particles;
|
||||
std::vector<blt::u32> dead_particles;
|
||||
|
@ -45,6 +47,7 @@ void init(const blt::gfx::window_data&)
|
|||
{
|
||||
using namespace blt::gfx;
|
||||
|
||||
particle_shader = std::unique_ptr<shader_t>(shader_t::make(shader_particle_2d_vert, shader_particle_2d_frag));
|
||||
|
||||
global_matrices.create_internals();
|
||||
resources.load_resources();
|
||||
|
|
Loading…
Reference in New Issue