Introduce gfx::drawable interface
This commit is contained in:
parent
fb9134993c
commit
8eb134908b
2 changed files with 20 additions and 3 deletions
13
libs/gfx/include/psemek/gfx/drawable.hpp
Normal file
13
libs/gfx/include/psemek/gfx/drawable.hpp
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
#pragma once
|
||||
|
||||
namespace psemek::gfx
|
||||
{
|
||||
|
||||
struct drawable
|
||||
{
|
||||
virtual void draw() const = 0;
|
||||
|
||||
virtual ~drawable() {}
|
||||
};
|
||||
|
||||
}
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <psemek/gfx/gl.hpp>
|
||||
#include <psemek/gfx/drawable.hpp>
|
||||
|
||||
#include <psemek/geom/vector.hpp>
|
||||
#include <psemek/geom/point.hpp>
|
||||
|
|
@ -386,6 +387,7 @@ namespace psemek::gfx
|
|||
}
|
||||
|
||||
struct mesh
|
||||
: drawable
|
||||
{
|
||||
static mesh null();
|
||||
|
||||
|
|
@ -471,7 +473,7 @@ namespace psemek::gfx
|
|||
load(simplices.data(), simplices.size(), usage);
|
||||
}
|
||||
|
||||
void draw() const
|
||||
void draw() const override
|
||||
{
|
||||
if (count_ == 0) return;
|
||||
|
||||
|
|
@ -503,6 +505,7 @@ namespace psemek::gfx
|
|||
};
|
||||
|
||||
struct indexed_mesh
|
||||
: drawable
|
||||
{
|
||||
static indexed_mesh null();
|
||||
|
||||
|
|
@ -593,7 +596,7 @@ namespace psemek::gfx
|
|||
load(simplices.data(), simplices.size(), indices.data(), indices.size(), usage);
|
||||
}
|
||||
|
||||
void draw() const
|
||||
void draw() const override
|
||||
{
|
||||
if (count_ == 0) return;
|
||||
|
||||
|
|
@ -627,6 +630,7 @@ namespace psemek::gfx
|
|||
};
|
||||
|
||||
struct instanced_mesh
|
||||
: drawable
|
||||
{
|
||||
static instanced_mesh null();
|
||||
|
||||
|
|
@ -732,7 +736,7 @@ namespace psemek::gfx
|
|||
load_instance(instances.data(), instances.size(), usage);
|
||||
}
|
||||
|
||||
void draw() const
|
||||
void draw() const override
|
||||
{
|
||||
if (count_ == 0) return;
|
||||
if (instance_count_ == 0) return;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue