WiP for geometry handling
This commit is contained in:
parent
a4bb53ce8f
commit
9cb55edbb4
2 changed files with 22 additions and 12 deletions
|
@ -20,8 +20,8 @@
|
||||||
* SOFTWARE.
|
* SOFTWARE.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#ifndef PW_CORE_GEOMETRY_HPP
|
#ifndef PW_CORE_PRIMITIVES_HPP
|
||||||
#define PW_CORE_GEOMETRY_HPP
|
#define PW_CORE_PRIMITIVES_HPP
|
||||||
|
|
||||||
#include <pw/core/aabb.hpp>
|
#include <pw/core/aabb.hpp>
|
||||||
#include <pw/core/globals.hpp>
|
#include <pw/core/globals.hpp>
|
||||||
|
@ -31,13 +31,13 @@
|
||||||
|
|
||||||
namespace pw {
|
namespace pw {
|
||||||
|
|
||||||
struct geometry {
|
struct primitives {
|
||||||
|
|
||||||
enum struct topology_type {
|
enum struct topology_type {
|
||||||
point_list,
|
point_list,
|
||||||
line_list,
|
line_list,
|
||||||
line_strip,
|
line_strip,
|
||||||
triange_list,
|
triangle_list,
|
||||||
triangle_strip,
|
triangle_strip,
|
||||||
triangle_fan,
|
triangle_fan,
|
||||||
line_list_with_adjacency,
|
line_list_with_adjacency,
|
|
@ -1,7 +1,6 @@
|
||||||
#include <cstdint>
|
|
||||||
#include <pw/core/axisangle.hpp>
|
#include <pw/core/axisangle.hpp>
|
||||||
#include <pw/core/geometry.hpp>
|
|
||||||
#include <pw/core/matrix_transform.hpp>
|
#include <pw/core/matrix_transform.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>
|
||||||
|
|
||||||
|
@ -29,21 +28,32 @@ struct attribute final {
|
||||||
texture_coordinates,
|
texture_coordinates,
|
||||||
};
|
};
|
||||||
|
|
||||||
using data_type = std::tuple<attribute_type,attribute_data>;
|
attribute_type type{};
|
||||||
|
attribute_data data{};
|
||||||
};
|
};
|
||||||
|
|
||||||
struct mesh_n {
|
struct mesh_n {
|
||||||
geometry data{};
|
primitives geometry{};
|
||||||
|
std::vector<attribute> attributes;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace pw
|
} // namespace pw
|
||||||
|
|
||||||
auto main() -> int {
|
auto main() -> int {
|
||||||
|
|
||||||
auto geom = pw::geometry{.vertices = {{1.2f, 2.4f, 4.8f},
|
auto geom = pw::primitives{
|
||||||
|
.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};
|
||||||
|
|
||||||
|
auto mesh = pw::mesh_n{.geometry = geom};
|
||||||
|
|
||||||
|
mesh.attributes.emplace_back(
|
||||||
|
pw::attribute{.type = pw::attribute::normals,
|
||||||
|
.data = std::vector{
|
||||||
|
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("({}) ", pw::serialize::to_string(geom.vertices[i]));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue