minor cleanup
This commit is contained in:
parent
1fb8d25b31
commit
b564c2b87c
19 changed files with 229 additions and 330 deletions
|
@ -8,5 +8,6 @@ Language: Cpp
|
||||||
# Force pointers to the type for C++.
|
# Force pointers to the type for C++.
|
||||||
DerivePointerAlignment: false
|
DerivePointerAlignment: false
|
||||||
PointerAlignment: Left
|
PointerAlignment: Left
|
||||||
AlignConsecutiveAssignments: true
|
|
||||||
LambdaBodyIndentation: OuterScope
|
LambdaBodyIndentation: OuterScope
|
||||||
|
AlignArrayOfStructures: Left
|
||||||
|
AlignConsecutiveAssignments: true
|
||||||
|
|
|
@ -3,9 +3,9 @@ add_subdirectory(deps)
|
||||||
|
|
||||||
# build internal core
|
# build internal core
|
||||||
add_subdirectory(core)
|
add_subdirectory(core)
|
||||||
add_subdirectory(scene)
|
# add_subdirectory(scene)
|
||||||
# add_subdirectory(system)
|
# add_subdirectory(system)
|
||||||
# add_subdirectory(io)
|
add_subdirectory(io)
|
||||||
|
|
||||||
#add_subdirectory(ui)
|
#add_subdirectory(ui)
|
||||||
# add_subdirectory(binding)
|
# add_subdirectory(binding)
|
||||||
|
|
|
@ -6,10 +6,10 @@ set(hdrs
|
||||||
set(srcs
|
set(srcs
|
||||||
src/script.cpp
|
src/script.cpp
|
||||||
src/script_core.cpp
|
src/script_core.cpp
|
||||||
# src/script_system.cpp
|
src/script_system.cpp
|
||||||
# src/script_io.cpp
|
src/script_io.cpp
|
||||||
# src/script_scene.cpp
|
src/script_scene.cpp
|
||||||
# src/script_visual.cpp
|
src/script_visual.cpp
|
||||||
src/runtime_lua.hpp
|
src/runtime_lua.hpp
|
||||||
src/runtime_lua.cpp
|
src/runtime_lua.cpp
|
||||||
)
|
)
|
||||||
|
|
|
@ -41,26 +41,19 @@ void register_core_function(sol::state& lua, sol::table& ns) {
|
||||||
|
|
||||||
ns.set("pi", pw::pi<float>());
|
ns.set("pi", pw::pi<float>());
|
||||||
|
|
||||||
// clang-format off
|
|
||||||
|
|
||||||
ns.new_usertype<color>(
|
ns.new_usertype<color>(
|
||||||
"color", sol::call_constructor,sol::constructors<color()>(),
|
"color", sol::call_constructor, sol::constructors<color()>(), //
|
||||||
"rgba", &color::rgba,
|
"rgba", &color::rgba, //
|
||||||
"data", sol::property([](color& c) { return c.rgba.data(); }),
|
"data", sol::property([](color& c) { return c.rgba.data(); }), //
|
||||||
"table",
|
"table",
|
||||||
sol::property(
|
sol::property([](const color& c) { //
|
||||||
[](const color& c) {
|
return sol::as_table(std::array<vector4f::value_type, 4>{
|
||||||
return sol::as_table(
|
|
||||||
std::array<vector4f::value_type, 4>{
|
|
||||||
c.rgba.x(), c.rgba.y(), c.rgba.z(), c.rgba.w()});
|
c.rgba.x(), c.rgba.y(), c.rgba.z(), c.rgba.w()});
|
||||||
},
|
}, [](color& c, const sol::table& t) {
|
||||||
[](color& c,const sol::table& t) {
|
c = color{
|
||||||
c = color{.rgba = vector4f{t[0], t[1], t[2], t[3]}};
|
.rgba = vector4f{t[0], t[1], t[2], t[3]}
|
||||||
})
|
};
|
||||||
|
}));
|
||||||
);
|
|
||||||
|
|
||||||
// clang-format on
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#ifndef PW_CORE_AABB_HPP
|
#ifndef PW_CORE_AABB_HPP
|
||||||
#define PW_CORE_AABB_HPP
|
#define PW_CORE_AABB_HPP
|
||||||
|
|
||||||
|
#include "primitives.hpp"
|
||||||
#include <pw/core/vector.hpp>
|
#include <pw/core/vector.hpp>
|
||||||
|
|
||||||
#include <numeric>
|
#include <numeric>
|
||||||
|
|
|
@ -269,9 +269,12 @@ constexpr auto operator*(const matrix<ScalarA, Ra, Ca>& A,
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// type aliases
|
// deduction guides
|
||||||
//
|
//
|
||||||
|
|
||||||
|
//
|
||||||
|
// type aliases
|
||||||
|
//
|
||||||
template <typename Scalar> using matrix2x2 = matrix<Scalar, 2, 2>;
|
template <typename Scalar> using matrix2x2 = matrix<Scalar, 2, 2>;
|
||||||
template <typename Scalar> using matrix3x3 = matrix<Scalar, 3, 3>;
|
template <typename Scalar> using matrix3x3 = matrix<Scalar, 3, 3>;
|
||||||
template <typename Scalar> using matrix4x4 = matrix<Scalar, 4, 4>;
|
template <typename Scalar> using matrix4x4 = matrix<Scalar, 4, 4>;
|
||||||
|
|
|
@ -23,10 +23,10 @@
|
||||||
#ifndef PW_CORE_MATRIX_TRANSFORM_HPP
|
#ifndef PW_CORE_MATRIX_TRANSFORM_HPP
|
||||||
#define PW_CORE_MATRIX_TRANSFORM_HPP
|
#define PW_CORE_MATRIX_TRANSFORM_HPP
|
||||||
|
|
||||||
|
#include <pw/core/frustum.hpp>
|
||||||
#include <pw/core/math.hpp>
|
#include <pw/core/math.hpp>
|
||||||
#include <pw/core/matrix.hpp>
|
#include <pw/core/matrix.hpp>
|
||||||
#include <pw/core/vector.hpp>
|
#include <pw/core/vector.hpp>
|
||||||
#include <pw/core/frustum.hpp>
|
|
||||||
|
|
||||||
namespace pw {
|
namespace pw {
|
||||||
|
|
||||||
|
@ -51,12 +51,12 @@ struct matrix_transform {
|
||||||
const auto C{-(f.z_far + f.z_near) / (f.z_far - f.z_near)};
|
const auto C{-(f.z_far + f.z_near) / (f.z_far - f.z_near)};
|
||||||
const auto D{-Scalar{2} * f.z_far * f.z_near / (f.z_far - f.z_near)};
|
const auto D{-Scalar{2} * f.z_far * f.z_near / (f.z_far - f.z_near)};
|
||||||
|
|
||||||
// clang-format off
|
return {
|
||||||
return {vector{Sx, 0, A, 0},
|
vector{Sx, 0, A, 0 }, //
|
||||||
vector{0, Sy, B, 0},
|
vector{0, Sy, B, 0 }, //
|
||||||
vector{0, 0, C, D},
|
vector{0, 0, C, D }, //
|
||||||
vector{0, 0, -1, Scalar{1}}};
|
vector{0, 0, -1, Scalar{1}} //
|
||||||
// clang-format on
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Scalar>
|
template <typename Scalar>
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#ifndef PW_CORE_POINT_HPP
|
#ifndef PW_CORE_POINT_HPP
|
||||||
#define PW_CORE_POINT_HPP
|
#define PW_CORE_POINT_HPP
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
#include <pw/core/globals.hpp>
|
#include <pw/core/globals.hpp>
|
||||||
#include <pw/core/vector.hpp>
|
#include <pw/core/vector.hpp>
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
|
|
||||||
namespace pw {
|
namespace pw {
|
||||||
|
|
||||||
struct primitives {
|
struct primitives final {
|
||||||
|
|
||||||
enum struct topology_type {
|
enum struct topology_type {
|
||||||
point_list,
|
point_list,
|
||||||
|
@ -47,7 +47,10 @@ struct primitives {
|
||||||
patch_list
|
patch_list
|
||||||
};
|
};
|
||||||
|
|
||||||
std::vector<vector3<float>> vertices{};
|
using vertex_type = vector3<float>;
|
||||||
|
using index_type = std::size_t;
|
||||||
|
|
||||||
|
std::vector<vertex_type> vertices{};
|
||||||
std::vector<std::size_t> indices{};
|
std::vector<std::size_t> indices{};
|
||||||
topology_type topology{};
|
topology_type topology{};
|
||||||
};
|
};
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <concepts>
|
#include <concepts>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
#include <type_traits>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
namespace pw {
|
namespace pw {
|
||||||
|
@ -65,6 +66,13 @@ template <typename Scalar, std::size_t N> struct vector final {
|
||||||
return std::forward<decltype(self)>(self).v_[e];
|
return std::forward<decltype(self)>(self).v_[e];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename ScalarOut>
|
||||||
|
constexpr auto cast() const noexcept -> vector<ScalarOut, N> {
|
||||||
|
return [this]<std::size_t... Ss>(std::index_sequence<Ss...>) {
|
||||||
|
return vector<ScalarOut, N>{ScalarOut((*this)[Ss])...};
|
||||||
|
}(std::make_index_sequence<N>{});
|
||||||
|
}
|
||||||
|
|
||||||
static constexpr auto basis(const auto& d) noexcept {
|
static constexpr auto basis(const auto& d) noexcept {
|
||||||
return [&d]<std::size_t... Ss>(std::index_sequence<Ss...>) {
|
return [&d]<std::size_t... Ss>(std::index_sequence<Ss...>) {
|
||||||
return vector{(d == Ss) ? Scalar(1) : Scalar(0)...};
|
return vector{(d == Ss) ? Scalar(1) : Scalar(0)...};
|
||||||
|
@ -295,8 +303,9 @@ template <typename Scalar, std::size_t N> struct vector final {
|
||||||
//
|
//
|
||||||
// deduction guide
|
// deduction guide
|
||||||
//
|
//
|
||||||
template <class T, class... U, class CT = std::common_type_t<T, U...>>
|
template <class... Scalar>
|
||||||
vector(T, U...) -> vector<CT, 1 + sizeof...(U)>;
|
vector(Scalar&&... s)
|
||||||
|
-> vector<std::common_type_t<Scalar...>, sizeof...(Scalar)>;
|
||||||
|
|
||||||
//
|
//
|
||||||
// type aliases
|
// type aliases
|
||||||
|
|
|
@ -13,3 +13,4 @@ make_test(pwcore_test_aabb)
|
||||||
make_test(pwcore_test_frustum)
|
make_test(pwcore_test_frustum)
|
||||||
make_test(pwcore_test_mesh)
|
make_test(pwcore_test_mesh)
|
||||||
make_test(pwcore_test_serialize)
|
make_test(pwcore_test_serialize)
|
||||||
|
make_test(pwcore_test_image)
|
||||||
|
|
16
src/core/tests/pwcore_test_image.cpp
Normal file
16
src/core/tests/pwcore_test_image.cpp
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
#include <cstddef>
|
||||||
|
#include <map>
|
||||||
|
#include <pw/core/image.hpp>
|
||||||
|
|
||||||
|
namespace pw {
|
||||||
|
|
||||||
|
struct image_layout {
|
||||||
|
enum pixel_layout { RGB8, RGBA, LUM, DEPTH };
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace pw
|
||||||
|
|
||||||
|
auto main() -> int {
|
||||||
|
|
||||||
|
// pw::image
|
||||||
|
}
|
|
@ -70,4 +70,9 @@ auto main() -> int {
|
||||||
|
|
||||||
std::print("\nm44=[{}]\n", m44);
|
std::print("\nm44=[{}]\n", m44);
|
||||||
|
|
||||||
|
|
||||||
|
// auto m_init_ded = pw::matrix{
|
||||||
|
// {1, 2},
|
||||||
|
// {3, 4}
|
||||||
|
// };
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,85 +1,40 @@
|
||||||
|
#include <pw/core/aabb.hpp>
|
||||||
#include <pw/core/axisangle.hpp>
|
#include <pw/core/axisangle.hpp>
|
||||||
|
#include <pw/core/formatter.hpp>
|
||||||
#include <pw/core/matrix_transform.hpp>
|
#include <pw/core/matrix_transform.hpp>
|
||||||
|
#include <pw/core/mesh.hpp>
|
||||||
#include <pw/core/primitives.hpp>
|
#include <pw/core/primitives.hpp>
|
||||||
#include <pw/core/serialize.hpp>
|
#include <pw/core/serialize.hpp>
|
||||||
#include <pw/core/vector.hpp>
|
#include <pw/core/vector.hpp>
|
||||||
#include <pw/core/mesh.hpp>
|
|
||||||
|
|
||||||
#include <print>
|
#include <print>
|
||||||
#include <variant>
|
#include <variant>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace pw {
|
namespace pw {} // namespace pw
|
||||||
|
|
||||||
} // namespace pw
|
|
||||||
|
|
||||||
auto main() -> int {
|
auto main() -> int {
|
||||||
|
|
||||||
auto geom = pw::primitives{
|
auto geom = pw::primitives{
|
||||||
.vertices = {{1.2f, 2.4f, 4.8f},
|
.vertices = {{1.2f, 2.4f, 4.8f},
|
||||||
{2.4f, 1.2f, 4.8f},
|
{2.4f, 1.2f, 4.8f},
|
||||||
{1.2f, 4.8f, 2.4f}},
|
{1.2f, 4.8f, 2.4f} },
|
||||||
.indices = {0, 1, 2},
|
.indices = {0, 1, 2},
|
||||||
.topology = pw::primitives::topology_type::triangle_list};
|
.topology = pw::primitives::topology_type::triangle_list
|
||||||
|
};
|
||||||
|
|
||||||
auto mesh = pw::mesh{.geometry = geom};
|
auto mesh = pw::mesh{.geometry = geom};
|
||||||
|
|
||||||
mesh.attributes.emplace_back(
|
mesh.attributes.emplace_back(
|
||||||
pw::attribute{.type = pw::attribute::normals,
|
pw::attribute{.type = pw::attribute::normals,
|
||||||
.data = std::vector{
|
.data = std::vector{pw::vector{1.2f, 2.4f, 4.8f}}});
|
||||||
pw::vector{1.2f, 2.4f, 4.8f}}});
|
|
||||||
|
|
||||||
for (auto i : geom.indices) {
|
for (auto i : geom.indices) {
|
||||||
std::print("({}) ", pw::serialize::to_string(geom.vertices[i]));
|
std::print("vertex[{}]({})\n", i, geom.vertices[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// pw::geometry geo;
|
auto aabb = pw::aabb<float, 3>::make_from_indexed_vertices(geom.vertices,
|
||||||
|
geom.indices);
|
||||||
|
|
||||||
// pw::vector3_array vs = {
|
std::print("aabb.max = ({}) aabb.min=({})\n", aabb.max, aabb.min);
|
||||||
// { -1, 1, 0 },
|
|
||||||
// { -1,-1, 0 },
|
|
||||||
// { 1,-1, 0 },
|
|
||||||
// { 1, 1, 0 }
|
|
||||||
// };
|
|
||||||
|
|
||||||
// pw::geometry::indices_t idx = {
|
|
||||||
// 0, 1, 2,
|
|
||||||
// 0, 2, 3
|
|
||||||
// };
|
|
||||||
|
|
||||||
// geo.set_vertices(vs);
|
|
||||||
// geo.set_indices(idx);
|
|
||||||
|
|
||||||
// geo.compute_normals();
|
|
||||||
|
|
||||||
// amesh.set_vertices(vs);
|
|
||||||
|
|
||||||
// for (auto v : amesh.vertices()) {
|
|
||||||
// std::cout << pw::serialize::matrix(v.transposed()) << std::endl;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// auto scale = pw::matrix_transform<float>::scale_matrix({2,2,2});
|
|
||||||
|
|
||||||
// amesh.transform(scale);
|
|
||||||
|
|
||||||
// std::cout << "after scale" << std::endl;
|
|
||||||
|
|
||||||
// for (auto v : amesh.vertices()) {
|
|
||||||
// std::cout << pw::serialize::matrix(v.transposed()) << std::endl;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// pw::axisangle aa;
|
|
||||||
|
|
||||||
// aa.axis = pw::vector3({ 0, 0, 1 });
|
|
||||||
// aa.angle = pw::deg_to_rad(90.0f);
|
|
||||||
|
|
||||||
// auto rot_mat = aa.to_matrix();
|
|
||||||
|
|
||||||
// amesh.transform(rot_mat);
|
|
||||||
|
|
||||||
// std::cout << "after rotate" << std::endl;
|
|
||||||
|
|
||||||
// for (auto v : amesh.vertices()) {
|
|
||||||
// std::cout << pw::serialize::matrix(v.transposed()) << std::endl;
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,21 +1,22 @@
|
||||||
#ifndef PW_GEOMETRY_PRIMITIVES_HPP
|
#ifndef PW_GEOMETRY_PRIMITIVES_HPP
|
||||||
#define PW_GEOMETRY_PRIMITIVES_HPP
|
#define PW_GEOMETRY_PRIMITIVES_HPP
|
||||||
|
|
||||||
#include <pw/core/geometry.hpp>
|
#include <pw/core/primitives.hpp>
|
||||||
|
|
||||||
namespace pw {
|
namespace pw {
|
||||||
|
|
||||||
struct primitives {
|
struct primitives {
|
||||||
|
|
||||||
static geometry box(real_t size_x, real_t size_y, real_t size_z);
|
static geometry box(real_t size_x, real_t size_y, real_t size_z);
|
||||||
|
|
||||||
static geometry sphere(real_t radius,int divisions_latitude,int divisions_longitude);
|
static geometry sphere(real_t radius, int divisions_latitude,
|
||||||
|
int divisions_longitude);
|
||||||
|
|
||||||
static geometry cone();
|
static geometry cone();
|
||||||
|
|
||||||
static geometry pyramid();
|
static geometry pyramid();
|
||||||
};
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}; // namespace pw
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <locale>
|
#include <locale>
|
||||||
|
|
||||||
|
|
||||||
namespace pw {
|
namespace pw {
|
||||||
|
|
||||||
// struct window_context : context
|
// struct window_context : context
|
||||||
|
@ -77,8 +76,7 @@ struct window::impl {
|
||||||
|
|
||||||
static void cursor_pos_callback(GLFWwindow* window, double xpos,
|
static void cursor_pos_callback(GLFWwindow* window, double xpos,
|
||||||
double ypos) {
|
double ypos) {
|
||||||
input::get()._mouse_position =
|
input::get()._mouse_position = vector{xpos, ypos}.cast<int32_t>();
|
||||||
point<double>(xpos, ypos).cast<int32_t>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void key_callback(GLFWwindow* window, int key, int scancode,
|
static void key_callback(GLFWwindow* window, int key, int scancode,
|
||||||
|
@ -255,11 +253,11 @@ struct window::impl {
|
||||||
::pw::point<int32_t> position() const {
|
::pw::point<int32_t> position() const {
|
||||||
int x, y;
|
int x, y;
|
||||||
glfwGetWindowPos(_window, &x, &y);
|
glfwGetWindowPos(_window, &x, &y);
|
||||||
return ::pw::point<int32_t>(x, y);
|
return {x, y};
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_position(const point<int32_t>& p) {
|
void set_position(const point<int32_t>& p) {
|
||||||
glfwSetWindowPos(_window, p.x, p.y);
|
glfwSetWindowPos(_window, p.x(), p.y());
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_fullscreen(bool use_fullscreen) {
|
void set_fullscreen(bool use_fullscreen) {
|
||||||
|
@ -267,7 +265,7 @@ struct window::impl {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (use_fullscreen) {
|
if (use_fullscreen) {
|
||||||
glfwGetWindowPos(_window, &_old_pos.x, &_old_pos.y);
|
glfwGetWindowPos(_window, &_old_pos.x(), &_old_pos.y());
|
||||||
glfwGetWindowSize(_window, &_old_size.width, &_old_size.height);
|
glfwGetWindowSize(_window, &_old_size.width, &_old_size.height);
|
||||||
|
|
||||||
GLFWmonitor* monitor = glfwGetPrimaryMonitor();
|
GLFWmonitor* monitor = glfwGetPrimaryMonitor();
|
||||||
|
@ -278,7 +276,7 @@ struct window::impl {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
glfwSetWindowMonitor(_window, nullptr, _old_pos.x, _old_pos.y,
|
glfwSetWindowMonitor(_window, nullptr, _old_pos.x(), _old_pos.y(),
|
||||||
_old_size.width, _old_size.height, 0);
|
_old_size.width, _old_size.height, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,25 +1,21 @@
|
||||||
#ifndef PW_VISUAL_PIPELINE_HPP
|
#ifndef PW_VISUAL_PIPELINE_HPP
|
||||||
#define PW_VISUAL_PIPELINE_HPP
|
#define PW_VISUAL_PIPELINE_HPP
|
||||||
|
|
||||||
#include <pw/core/size.hpp>
|
|
||||||
#include <pw/core/matrix.hpp>
|
|
||||||
#include <pw/core/geometry.hpp>
|
|
||||||
#include <pw/core/color.hpp>
|
#include <pw/core/color.hpp>
|
||||||
|
#include <pw/core/matrix.hpp>
|
||||||
|
#include <pw/core/primitives.hpp>
|
||||||
|
#include <pw/core/size.hpp>
|
||||||
|
|
||||||
#include <pw/visual/shader.hpp>
|
|
||||||
#include <pw/visual/renderer.hpp>
|
#include <pw/visual/renderer.hpp>
|
||||||
|
#include <pw/visual/shader.hpp>
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
namespace pw {
|
namespace pw {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class pipeline {
|
class pipeline {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
pipeline();
|
pipeline();
|
||||||
~pipeline();
|
~pipeline();
|
||||||
|
|
||||||
|
@ -27,26 +23,20 @@ public:
|
||||||
|
|
||||||
bool create(size s);
|
bool create(size s);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
struct impl;
|
struct impl;
|
||||||
std::unique_ptr<impl> _impl;
|
std::unique_ptr<impl> _impl;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
struct render_pass {
|
struct render_pass {
|
||||||
|
|
||||||
void submit(const geometry& g,
|
void submit(const geometry& g, const matrix4x4& model_mat,
|
||||||
const matrix4x4& model_mat,
|
const matrix4x4& view_mat, const matrix4x4& projection_mat);
|
||||||
const matrix4x4& view_mat,
|
|
||||||
const matrix4x4& projection_mat);
|
|
||||||
|
|
||||||
shader _shader;
|
shader _shader;
|
||||||
renderer _renderer;
|
renderer _renderer;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // namespace pw
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -4,89 +4,58 @@
|
||||||
#include "glad/glad.h"
|
#include "glad/glad.h"
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
|
|
||||||
namespace pw {
|
namespace pw {
|
||||||
|
|
||||||
struct context::impl {
|
struct context::impl {
|
||||||
|
|
||||||
vector4f _clear_color { 0, 1, 0, 1};
|
vector4f _clear_color{0, 1, 0, 1};
|
||||||
|
|
||||||
void set_viewport(const rectangle<int32_t>& v)
|
void set_viewport(const rectangle<int32_t>& v) {
|
||||||
{
|
glViewport(v.position.x(), v.position.y(), v.size.width, v.size.height);
|
||||||
glViewport(v.position.x,v.position.y,v.size.width,v.size.height);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const rectangle<int32_t> viewport()
|
const rectangle<int32_t> viewport() {
|
||||||
{
|
auto vp = rectangle<float>{0, 0, 1, 1};
|
||||||
auto vp = rectangle<float>{0,0,1,1};
|
glGetFloatv(GL_VIEWPORT, vp.position.data());
|
||||||
glGetFloatv(GL_VIEWPORT,static_cast<float*>(&vp.position.x));
|
|
||||||
return vp.cast<int32_t>();
|
return vp.cast<int32_t>();
|
||||||
}
|
}
|
||||||
|
|
||||||
void clear()
|
void clear() {
|
||||||
{
|
|
||||||
glEnable(GL_CULL_FACE);
|
glEnable(GL_CULL_FACE);
|
||||||
glCullFace(GL_BACK);
|
glCullFace(GL_BACK);
|
||||||
glFrontFace(GL_CCW);
|
glFrontFace(GL_CCW);
|
||||||
|
|
||||||
glClearColor(_clear_color[0],_clear_color[1],_clear_color[2],_clear_color[3]);
|
glClearColor(_clear_color[0], _clear_color[1], _clear_color[2],
|
||||||
|
_clear_color[3]);
|
||||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
uint32_t get_error() const
|
|
||||||
{
|
|
||||||
return glGetError();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32_t get_error() const { return glGetError(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
context::context()
|
context::context() : _impl(std::make_unique<impl>()) {}
|
||||||
: _impl(std::make_unique<impl>())
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
context::~context()
|
context::~context() {}
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void context::set_blend()
|
void context::set_blend() {}
|
||||||
{
|
|
||||||
|
|
||||||
}
|
void context::set_viewport(const rectangle<int32_t>& v) {
|
||||||
|
|
||||||
void context::set_viewport(const rectangle<int32_t>& v)
|
|
||||||
{
|
|
||||||
_impl->set_viewport(v);
|
_impl->set_viewport(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
rectangle<int32_t> context::viewport() const
|
rectangle<int32_t> context::viewport() const { return _impl->viewport(); }
|
||||||
{
|
|
||||||
return _impl->viewport();
|
|
||||||
}
|
|
||||||
|
|
||||||
void context::clear()
|
void context::clear() { _impl->clear(); }
|
||||||
{
|
|
||||||
_impl->clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
u_int32_t context::get_error() const
|
u_int32_t context::get_error() const { return _impl->get_error(); }
|
||||||
{
|
|
||||||
return _impl->get_error();
|
|
||||||
}
|
|
||||||
|
|
||||||
color context::clearcolor() const
|
color context::clearcolor() const {
|
||||||
{
|
|
||||||
// return _impl->_clear_color;
|
// return _impl->_clear_color;
|
||||||
return color{};
|
return color{};
|
||||||
}
|
}
|
||||||
|
|
||||||
void context::set_clearcolor(const color& c)
|
void context::set_clearcolor(const color& c) {
|
||||||
{
|
|
||||||
// _impl->_clear_color = c;
|
// _impl->_clear_color = c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace pw
|
||||||
}
|
|
||||||
|
|
|
@ -1,30 +1,26 @@
|
||||||
#include "pw/core/size.hpp"
|
|
||||||
#include "pw/core/matrix.hpp"
|
|
||||||
#include "pw/core/geometry.hpp"
|
|
||||||
#include "pw/core/time.hpp"
|
|
||||||
#include "pw/core/axisangle.hpp"
|
#include "pw/core/axisangle.hpp"
|
||||||
#include "pw/core/serialize.hpp"
|
#include "pw/core/geometry.hpp"
|
||||||
|
#include "pw/core/matrix.hpp"
|
||||||
#include "pw/core/matrix_transform.hpp"
|
#include "pw/core/matrix_transform.hpp"
|
||||||
|
#include "pw/core/serialize.hpp"
|
||||||
|
#include "pw/core/size.hpp"
|
||||||
|
#include "pw/core/time.hpp"
|
||||||
|
|
||||||
#include "pw/core/debug.hpp"
|
#include "pw/core/debug.hpp"
|
||||||
#include "pw/visual/pipeline.hpp"
|
|
||||||
#include "pw/visual/shader.hpp"
|
|
||||||
#include "pw/visual/renderer.hpp"
|
|
||||||
#include "pw/visual/framebuffer.hpp"
|
#include "pw/visual/framebuffer.hpp"
|
||||||
|
#include "pw/visual/pipeline.hpp"
|
||||||
|
#include "pw/visual/renderer.hpp"
|
||||||
|
#include "pw/visual/shader.hpp"
|
||||||
#include "pw/visual/texture.hpp"
|
#include "pw/visual/texture.hpp"
|
||||||
|
|
||||||
#include "glad/glad.h"
|
#include "glad/glad.h"
|
||||||
|
|
||||||
namespace pw {
|
namespace pw {
|
||||||
|
|
||||||
|
void render_pass::submit(const geometry& g, const matrix4x4& model_mat,
|
||||||
void render_pass::submit(const geometry &g,
|
const matrix4x4& view_mat,
|
||||||
const matrix4x4 &model_mat,
|
const matrix4x4& projection_mat) {
|
||||||
const matrix4x4 &view_mat,
|
if (!_shader.ready()) { //
|
||||||
const matrix4x4 &projection_mat)
|
|
||||||
{
|
|
||||||
if (!_shader.ready())
|
|
||||||
{ //
|
|
||||||
_shader.build();
|
_shader.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,22 +31,18 @@ void render_pass::submit(const geometry &g,
|
||||||
|
|
||||||
// new version with ...
|
// new version with ...
|
||||||
shader::uniform_cache_t us;
|
shader::uniform_cache_t us;
|
||||||
// us.push_back(std::make_tuple("input_color",mat._color,-1));
|
// us.push_back(std::make_tuple("input_color",mat._color,-1));
|
||||||
us.push_back(std::make_tuple("model",model_mat,-1));
|
us.push_back(std::make_tuple("model", model_mat, -1));
|
||||||
us.push_back(std::make_tuple("view",view_mat,-1));
|
us.push_back(std::make_tuple("view", view_mat, -1));
|
||||||
us.push_back(std::make_tuple("projection",projection_mat,-1));
|
us.push_back(std::make_tuple("projection", projection_mat, -1));
|
||||||
|
|
||||||
_shader.set_uniforms(us);
|
_shader.set_uniforms(us);
|
||||||
|
|
||||||
_shader.use();
|
_shader.use();
|
||||||
_renderer.draw();
|
_renderer.draw();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct triangle_renderer {
|
||||||
struct triangle_renderer
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
texture tex;
|
texture tex;
|
||||||
shader shader_p;
|
shader shader_p;
|
||||||
|
@ -58,12 +50,9 @@ struct triangle_renderer
|
||||||
renderer r;
|
renderer r;
|
||||||
time::tick_t tick;
|
time::tick_t tick;
|
||||||
|
|
||||||
triangle_renderer()
|
triangle_renderer() {}
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void setup()
|
void setup() {
|
||||||
{
|
|
||||||
|
|
||||||
const float z_val = -5.f;
|
const float z_val = -5.f;
|
||||||
const float s = 1.0f;
|
const float s = 1.0f;
|
||||||
|
@ -76,22 +65,22 @@ struct triangle_renderer
|
||||||
// geometry
|
// geometry
|
||||||
vector3_array vertices = {
|
vector3_array vertices = {
|
||||||
{-s, s, z_val} // 0
|
{-s, s, z_val} // 0
|
||||||
,{ s, s, z_val} // 1
|
,
|
||||||
,{-s, -s, z_val} // 2
|
{s, s, z_val} // 1
|
||||||
,{ s, -s, z_val} // 3
|
,
|
||||||
|
{-s, -s, z_val} // 2
|
||||||
|
,
|
||||||
|
{s, -s, z_val} // 3
|
||||||
};
|
};
|
||||||
|
|
||||||
// topology / indices
|
// topology / indices
|
||||||
geometry::indices_t indices = { 2, 1, 0,
|
geometry::indices_t indices = {2, 1, 0, 2, 3, 1};
|
||||||
2, 3, 1};
|
|
||||||
|
|
||||||
|
|
||||||
amesh.set_indices(indices);
|
amesh.set_indices(indices);
|
||||||
amesh.set_vertices(vertices);
|
amesh.set_vertices(vertices);
|
||||||
|
|
||||||
amesh.compute_normals();
|
amesh.compute_normals();
|
||||||
|
|
||||||
|
|
||||||
const char* vertex_shader_2 = R"(
|
const char* vertex_shader_2 = R"(
|
||||||
#version 400
|
#version 400
|
||||||
uniform mat4 model;
|
uniform mat4 model;
|
||||||
|
@ -106,7 +95,7 @@ struct triangle_renderer
|
||||||
}
|
}
|
||||||
)";
|
)";
|
||||||
|
|
||||||
const char *fragment_shader_2 = R"(
|
const char* fragment_shader_2 = R"(
|
||||||
#version 400
|
#version 400
|
||||||
uniform vec4 input_color = vec4(1.0, 0.0, 0.0, 1.0);
|
uniform vec4 input_color = vec4(1.0, 0.0, 0.0, 1.0);
|
||||||
out vec4 frag_colour;
|
out vec4 frag_colour;
|
||||||
|
@ -114,38 +103,37 @@ struct triangle_renderer
|
||||||
frag_colour = input_color;
|
frag_colour = input_color;
|
||||||
})";
|
})";
|
||||||
|
|
||||||
shader_p.set_source(shader::code_type::vertex,vertex_shader_2);
|
shader_p.set_source(shader::code_type::vertex, vertex_shader_2);
|
||||||
shader_p.set_source(shader::code_type::fragment,fragment_shader_2);
|
shader_p.set_source(shader::code_type::fragment, fragment_shader_2);
|
||||||
|
|
||||||
if (!shader_p.build())
|
if (!shader_p.build())
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void draw()
|
void draw() {
|
||||||
{
|
|
||||||
if (!r.ready())
|
if (!r.ready())
|
||||||
r.create(amesh);
|
r.create(amesh);
|
||||||
|
|
||||||
|
|
||||||
// input needed here -
|
// input needed here -
|
||||||
// model view projection
|
// model view projection
|
||||||
|
|
||||||
shader_p.use();
|
shader_p.use();
|
||||||
|
|
||||||
auto v_col = ping_pong(static_cast<float>(time::now()),1.0f);
|
auto v_col = ping_pong(static_cast<float>(time::now()), 1.0f);
|
||||||
|
|
||||||
vector4f col = {0.5f,1-v_col,v_col,1.0f};
|
vector4f col = {0.5f, 1 - v_col, v_col, 1.0f};
|
||||||
|
|
||||||
matrix4x4f model_mat; model_mat.set_identity();
|
matrix4x4f model_mat;
|
||||||
|
model_mat.set_identity();
|
||||||
|
|
||||||
auto v_angle = ping_pong(static_cast<float>(time::now()),2 * ::pw::pi<float>());
|
auto v_angle =
|
||||||
|
ping_pong(static_cast<float>(time::now()), 2 * ::pw::pi<float>());
|
||||||
|
|
||||||
axisangle rot(vector3::forward(),v_angle);
|
axisangle rot(vector3::forward(), v_angle);
|
||||||
model_mat = rot.to_matrix();
|
model_mat = rot.to_matrix();
|
||||||
|
|
||||||
matrix4x4f view_mat = matrix_transform<float>::look_at(vector3({0,0,0}),
|
matrix4x4f view_mat = matrix_transform<float>::look_at(
|
||||||
vector3::forward(),
|
vector3({0, 0, 0}), vector3::forward(), vector3::up());
|
||||||
vector3::up());
|
|
||||||
|
|
||||||
// materials should carry this
|
// materials should carry this
|
||||||
#if 1
|
#if 1
|
||||||
|
@ -154,35 +142,31 @@ struct triangle_renderer
|
||||||
glFrontFace(GL_CCW);
|
glFrontFace(GL_CCW);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// now bind textures
|
// now bind textures
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
auto proj_mat = matrix_transform<float>::orthographic_projection(1.3,1.0,
|
auto proj_mat = matrix_transform<float>::orthographic_projection(
|
||||||
0.2f,100.f);
|
1.3, 1.0, 0.2f, 100.f);
|
||||||
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
auto proj_mat = matrix_transform<float>::perspective_projection(deg_to_rad(60.f),
|
auto proj_mat = matrix_transform<float>::perspective_projection(
|
||||||
1.3f,
|
deg_to_rad(60.f), 1.3f, 0.2f, 1000.f);
|
||||||
0.2f,1000.f);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
// highly inefficient - should be cached -
|
// highly inefficient - should be cached -
|
||||||
shader_p.set_uniform("input_color",col);
|
shader_p.set_uniform("input_color", col);
|
||||||
shader_p.set_uniform("model",model_mat);
|
shader_p.set_uniform("model", model_mat);
|
||||||
shader_p.set_uniform("view",view_mat);
|
shader_p.set_uniform("view", view_mat);
|
||||||
shader_p.set_uniform("projection",proj_mat);
|
shader_p.set_uniform("projection", proj_mat);
|
||||||
|
|
||||||
#else
|
#else
|
||||||
// new version with ...
|
// new version with ...
|
||||||
shader::uniform_cache_t us;
|
shader::uniform_cache_t us;
|
||||||
us.push_back(std::make_tuple("input_color",col,-1));
|
us.push_back(std::make_tuple("input_color", col, -1));
|
||||||
us.push_back(std::make_tuple("model",model_mat,-1));
|
us.push_back(std::make_tuple("model", model_mat, -1));
|
||||||
us.push_back(std::make_tuple("view",view_mat,-1));
|
us.push_back(std::make_tuple("view", view_mat, -1));
|
||||||
us.push_back(std::make_tuple("projection",proj_mat,-1));
|
us.push_back(std::make_tuple("projection", proj_mat, -1));
|
||||||
|
|
||||||
shader_p.set_uniforms(us);
|
shader_p.set_uniforms(us);
|
||||||
|
|
||||||
|
@ -191,7 +175,7 @@ struct triangle_renderer
|
||||||
r.draw();
|
r.draw();
|
||||||
|
|
||||||
auto error = glGetError();
|
auto error = glGetError();
|
||||||
if (error != GL_NO_ERROR){
|
if (error != GL_NO_ERROR) {
|
||||||
debug::e() << "GL error " << error;
|
debug::e() << "GL error " << error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -199,7 +183,6 @@ struct triangle_renderer
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
struct pipeline::impl {
|
struct pipeline::impl {
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
@ -214,35 +197,30 @@ struct pipeline::impl {
|
||||||
|
|
||||||
framebuffer fb;
|
framebuffer fb;
|
||||||
|
|
||||||
|
// testing
|
||||||
//testing
|
|
||||||
triangle_renderer tr;
|
triangle_renderer tr;
|
||||||
|
|
||||||
bool create(size s);
|
bool create(size s);
|
||||||
|
|
||||||
void draw();
|
void draw();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
impl() = default;
|
impl() = default;
|
||||||
~impl() = default;
|
~impl() = default;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
GLuint generate_multisample_texture(const size& s,int samples)
|
GLuint generate_multisample_texture(const size& s, int samples) {
|
||||||
{
|
|
||||||
GLuint texture;
|
GLuint texture;
|
||||||
glGenTextures(1, &texture);
|
glGenTextures(1, &texture);
|
||||||
|
|
||||||
glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, texture);
|
glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, texture);
|
||||||
glTexImage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE, samples, GL_RGB8, s.width, s.height, GL_TRUE);
|
glTexImage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE, samples, GL_RGB8,
|
||||||
|
s.width, s.height, GL_TRUE);
|
||||||
glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, 0);
|
glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, 0);
|
||||||
|
|
||||||
return texture;
|
return texture;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool pipeline::impl::create(::pw::size s)
|
bool pipeline::impl::create(::pw::size s) {
|
||||||
{
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
_size = s;
|
_size = s;
|
||||||
|
@ -293,23 +271,14 @@ bool pipeline::impl::create(::pw::size s)
|
||||||
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
tr.setup();
|
tr.setup();
|
||||||
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void pipeline::impl::draw() {
|
||||||
|
|
||||||
|
glClearColor(1.0, 0, 0, 1);
|
||||||
|
|
||||||
void pipeline::impl::draw()
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
glClearColor(1.0,0,0,1);
|
|
||||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||||
|
|
||||||
// glViewport(0,0,800,600);
|
// glViewport(0,0,800,600);
|
||||||
|
@ -320,12 +289,8 @@ void pipeline::impl::draw()
|
||||||
|
|
||||||
tr.draw();
|
tr.draw();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// reset
|
// reset
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// actuall blitting
|
// actuall blitting
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
@ -346,7 +311,6 @@ void pipeline::impl::draw()
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
|
||||||
glBindFramebuffer(GL_READ_FRAMEBUFFER, _fbo_msaa); // src FBO (multi-sample)
|
glBindFramebuffer(GL_READ_FRAMEBUFFER, _fbo_msaa); // src FBO (multi-sample)
|
||||||
|
@ -372,87 +336,76 @@ void pipeline::impl::draw()
|
||||||
// fb.unbind();
|
// fb.unbind();
|
||||||
|
|
||||||
GLenum err;
|
GLenum err;
|
||||||
while((err = glGetError()) != GL_NO_ERROR)
|
while ((err = glGetError()) != GL_NO_ERROR) {
|
||||||
{
|
|
||||||
std::string error;
|
std::string error;
|
||||||
|
|
||||||
switch(err) {
|
switch (err) {
|
||||||
case GL_INVALID_OPERATION: error="INVALID_OPERATION"; break;
|
case GL_INVALID_OPERATION:
|
||||||
case GL_INVALID_ENUM: error="INVALID_ENUM"; break;
|
error = "INVALID_OPERATION";
|
||||||
case GL_INVALID_VALUE: error="INVALID_VALUE"; break;
|
break;
|
||||||
case GL_OUT_OF_MEMORY: error="OUT_OF_MEMORY"; break;
|
case GL_INVALID_ENUM:
|
||||||
case GL_INVALID_FRAMEBUFFER_OPERATION: error="INVALID_FRAMEBUFFER_OPERATION"; break;
|
error = "INVALID_ENUM";
|
||||||
|
break;
|
||||||
|
case GL_INVALID_VALUE:
|
||||||
|
error = "INVALID_VALUE";
|
||||||
|
break;
|
||||||
|
case GL_OUT_OF_MEMORY:
|
||||||
|
error = "OUT_OF_MEMORY";
|
||||||
|
break;
|
||||||
|
case GL_INVALID_FRAMEBUFFER_OPERATION:
|
||||||
|
error = "INVALID_FRAMEBUFFER_OPERATION";
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
debug::e() << "OpenGL error:" << err << " " << error;
|
debug::e() << "OpenGL error:" << err << " " << error;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
|
||||||
pipeline::pipeline()
|
pipeline::pipeline() : _impl(std::make_unique<pipeline::impl>()) {}
|
||||||
: _impl(std::make_unique<pipeline::impl>())
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
pipeline::~pipeline()
|
pipeline::~pipeline() {
|
||||||
{
|
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
|
||||||
void pipeline::draw()
|
void pipeline::draw() { _impl->draw(); }
|
||||||
{
|
|
||||||
_impl->draw();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool pipeline::create(size s)
|
bool pipeline::create(size s) { return _impl->create(s.cast<int>()); }
|
||||||
{
|
|
||||||
return _impl->create(s.cast<int>());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
} // namespace pw
|
||||||
|
|
||||||
|
// class pipeline;
|
||||||
|
|
||||||
|
// class pass
|
||||||
|
|
||||||
//class pipeline;
|
|
||||||
|
|
||||||
//class pass
|
|
||||||
//{
|
//{
|
||||||
//public:
|
// public:
|
||||||
// virtual void apply(pipeline& p);
|
// virtual void apply(pipeline& p);
|
||||||
//};
|
// };
|
||||||
|
|
||||||
//class pipeline
|
// class pipeline
|
||||||
//{
|
//{
|
||||||
|
|
||||||
//public:
|
// public:
|
||||||
// void apply()
|
// void apply()
|
||||||
// {
|
// {
|
||||||
// for (auto p : _passes) p.apply(*this);
|
// for (auto p : _passes) p.apply(*this);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
//protected:
|
// protected:
|
||||||
// std::vector<pass> _passes;
|
// std::vector<pass> _passes;
|
||||||
//};
|
// };
|
||||||
|
|
||||||
|
// pipeline >
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//pipeline >
|
|
||||||
// n*pass
|
// n*pass
|
||||||
// shadow_pass
|
// shadow_pass
|
||||||
// lighting_pass
|
// lighting_pass
|
||||||
// mesh_pass
|
// mesh_pass
|
||||||
// compositor_pass
|
// compositor_pass
|
||||||
|
|
||||||
//compositor
|
// compositor
|
||||||
// render to fbo > add a
|
// render to fbo > add a
|
||||||
// glBlitFramebuffer .. https://stackoverflow.com/questions/29254574/using-glblitframebuffer-to-display-a-texture
|
// glBlitFramebuffer ..
|
||||||
|
// https://stackoverflow.com/questions/29254574/using-glblitframebuffer-to-display-a-texture
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue