moving to a structure in visual representing the underlying APIs first and then layering on top the scene graph. Various other additions and fixes.
This commit is contained in:
parent
7037abbcb6
commit
40e8c43e01
15 changed files with 217 additions and 37 deletions
|
@ -1,17 +1,17 @@
|
|||
|
||||
set(hdrs
|
||||
include/pw/visual/mesh_renderer.hpp
|
||||
include/pw/visual/shader.hpp
|
||||
include/pw/visual/pipeline.hpp
|
||||
include/pw/visual/texture.hpp
|
||||
include/pw/visual/vertex_array.hpp
|
||||
)
|
||||
|
||||
set(srcs
|
||||
src/mesh_renderer.cpp
|
||||
src/shader.cpp
|
||||
src/context.cpp
|
||||
src/pipeline.cpp
|
||||
src/texture.cpp
|
||||
src/vertex_array.cpp
|
||||
)
|
||||
|
||||
|
||||
|
|
|
@ -19,6 +19,12 @@ class texture {
|
|||
shape_3d
|
||||
};
|
||||
|
||||
enum texture_dimension {
|
||||
dimension_s,
|
||||
dimension_t,
|
||||
dimension_r
|
||||
};
|
||||
|
||||
enum wrap_mode {
|
||||
wrap_repeat,
|
||||
wrap_clamp,
|
||||
|
@ -26,7 +32,6 @@ class texture {
|
|||
wrap_clamp_to_repeat
|
||||
};
|
||||
|
||||
|
||||
texture();
|
||||
|
||||
texture(shared_ptr<image> i,texture_shape s,texture_type = color);
|
||||
|
|
|
@ -8,12 +8,12 @@
|
|||
|
||||
namespace pw {
|
||||
|
||||
class mesh_renderer {
|
||||
class vertex_array {
|
||||
public:
|
||||
vertex_array();
|
||||
vertex_array(const mesh& m);
|
||||
|
||||
|
||||
mesh_renderer();
|
||||
~mesh_renderer();
|
||||
~vertex_array();
|
||||
|
||||
bool ready() const;
|
||||
|
||||
|
@ -22,13 +22,6 @@ public:
|
|||
|
||||
void draw();
|
||||
|
||||
|
||||
// void render(const mesh& mesh,
|
||||
// const matrix4x4& model_matrix,
|
||||
// const matrix4x4& view_matrix,
|
||||
// const matrix4x4& projection_matrix
|
||||
// );
|
||||
|
||||
protected:
|
||||
|
||||
struct impl;
|
|
@ -6,12 +6,19 @@
|
|||
#include "pw/core/debug.hpp"
|
||||
#include "pw/visual/pipeline.hpp"
|
||||
#include "pw/visual/shader.hpp"
|
||||
#include "pw/visual/mesh_renderer.hpp"
|
||||
#include "pw/visual/vertex_array.hpp"
|
||||
|
||||
#include "glad/glad.h"
|
||||
|
||||
namespace pw {
|
||||
|
||||
class command {
|
||||
|
||||
// shader
|
||||
// vertexarray
|
||||
|
||||
};
|
||||
|
||||
class queue {
|
||||
|
||||
// vector<commands> ...
|
||||
|
@ -25,7 +32,7 @@ struct triangle_renderer
|
|||
|
||||
shader shader_p;
|
||||
mesh amesh;
|
||||
mesh_renderer amesh_renderer;
|
||||
vertex_array amesh_renderer;
|
||||
timer::tick_t tick;
|
||||
|
||||
triangle_renderer()
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#include "pw/visual/mesh_renderer.hpp"
|
||||
#include "pw/visual/vertex_array.hpp"
|
||||
|
||||
#include "pw/core/mesh.hpp"
|
||||
#include "pw/core/size.hpp"
|
||||
|
@ -9,8 +9,7 @@
|
|||
|
||||
namespace pw {
|
||||
|
||||
|
||||
struct mesh_renderer::impl {
|
||||
struct vertex_array::impl {
|
||||
|
||||
GLuint _vao = 0;
|
||||
std::vector<GLuint> _vbos;
|
||||
|
@ -85,31 +84,37 @@ struct mesh_renderer::impl {
|
|||
//
|
||||
//
|
||||
|
||||
mesh_renderer::mesh_renderer()
|
||||
: _impl(std::make_unique<mesh_renderer::impl>())
|
||||
vertex_array::vertex_array()
|
||||
: _impl(std::make_unique<vertex_array::impl>())
|
||||
{
|
||||
}
|
||||
|
||||
mesh_renderer::~mesh_renderer()
|
||||
vertex_array::vertex_array(const mesh &m)
|
||||
{
|
||||
vertex_array();
|
||||
_impl->create(m);
|
||||
}
|
||||
|
||||
vertex_array::~vertex_array()
|
||||
{
|
||||
}
|
||||
|
||||
bool mesh_renderer::ready() const
|
||||
bool vertex_array::ready() const
|
||||
{
|
||||
return _impl->ready();
|
||||
}
|
||||
|
||||
void mesh_renderer::create(const mesh &m)
|
||||
void vertex_array::create(const mesh &m)
|
||||
{
|
||||
_impl->create(m);
|
||||
}
|
||||
|
||||
void mesh_renderer::destroy()
|
||||
void vertex_array::destroy()
|
||||
{
|
||||
_impl->destroy();
|
||||
}
|
||||
|
||||
void mesh_renderer::draw()
|
||||
void vertex_array::draw()
|
||||
{
|
||||
_impl->draw();
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue