Skip to content

Commit

Permalink
sandbox:(VERA): prefer smart pointers over raw pointers
Browse files Browse the repository at this point in the history
sandbox.cpp:
* Made cursor vbo use std::unique_ptr.
  • Loading branch information
tcoyvwac committed Jul 29, 2022
1 parent 065eb13 commit 6db639f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
7 changes: 2 additions & 5 deletions src/sandbox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1732,8 +1732,8 @@ void Sandbox::renderUI() {

if (cursor && vera::getMouseEntered()) {
// TRACK_BEGIN("cursor")
if (m_cross_vbo == nullptr)
m_cross_vbo = new vera::Vbo( vera::crossMesh( glm::vec3(0.0f, 0.0f, 0.0f), 10.0f) );
if (m_cross_vbo == nullptr)
m_cross_vbo = std::unique_ptr<vera::Vbo>(new vera::Vbo( vera::crossMesh( glm::vec3(0.0f, 0.0f, 0.0f), 10.0f) ));

vera::Shader* fill = vera::getFillShader();
fill->use();
Expand Down Expand Up @@ -1784,9 +1784,6 @@ void Sandbox::clear() {

if (uniforms.models.size() > 0)
m_sceneRender.clear();

if (m_cross_vbo)
delete m_cross_vbo;
}

void Sandbox::printDependencies(ShaderType _type) const {
Expand Down
2 changes: 1 addition & 1 deletion src/sandbox.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ class Sandbox {
bool m_postprocessing;

// Cursor
vera::Vbo* m_cross_vbo;
std::unique_ptr<vera::Vbo> m_cross_vbo;

// debug plot texture and shader for histogram or fps plots
vera::Shader m_plot_shader;
Expand Down

0 comments on commit 6db639f

Please sign in to comment.