引擎接入反射功能
This commit is contained in:
parent
faed6a2228
commit
9289182a1b
12
engine/3rdparty/zlib/include/refl/std/sarray.h
vendored
12
engine/3rdparty/zlib/include/refl/std/sarray.h
vendored
@ -1,13 +1,12 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "svector.h"
|
#include "svector.h"
|
||||||
#include <concepts>
|
#include <concepts>
|
||||||
namespace refl {
|
template<typename T>
|
||||||
template<typename T>
|
class sarray {
|
||||||
class sarray {
|
protected:
|
||||||
protected:
|
|
||||||
const T* m_ptr;
|
const T* m_ptr;
|
||||||
int m_count;
|
int m_count;
|
||||||
public:
|
public:
|
||||||
constexpr sarray(const T* ptr, int count) : m_ptr(ptr), m_count(count) {}
|
constexpr sarray(const T* ptr, int count) : m_ptr(ptr), m_count(count) {}
|
||||||
constexpr sarray(const svector<T>& vec) : m_ptr(vec.front()), m_count(vec.size()) {}
|
constexpr sarray(const svector<T>& vec) : m_ptr(vec.front()), m_count(vec.size()) {}
|
||||||
constexpr sarray() :m_ptr(nullptr), m_count(0) {}
|
constexpr sarray() :m_ptr(nullptr), m_count(0) {}
|
||||||
@ -70,5 +69,4 @@ namespace refl {
|
|||||||
return ptr != other.ptr;
|
return ptr != other.ptr;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
|
||||||
12
engine/3rdparty/zlib/include/refl/std/svector.h
vendored
12
engine/3rdparty/zlib/include/refl/std/svector.h
vendored
@ -1,14 +1,13 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <concepts>
|
#include <concepts>
|
||||||
namespace refl {
|
template<typename T>
|
||||||
template<typename T>
|
class svector {
|
||||||
class svector {
|
protected:
|
||||||
protected:
|
|
||||||
T* m_ptr;
|
T* m_ptr;
|
||||||
int m_count;
|
int m_count;
|
||||||
int m_capicty;
|
int m_capicty;
|
||||||
public:
|
public:
|
||||||
constexpr svector() :m_ptr(nullptr), m_count(0), m_capicty(0){}
|
constexpr svector() :m_ptr(nullptr), m_count(0), m_capicty(0){}
|
||||||
constexpr svector(T* ptr, int size, int count) : m_ptr(ptr), m_capicty(size), m_count(count){}
|
constexpr svector(T* ptr, int size, int count) : m_ptr(ptr), m_capicty(size), m_count(count){}
|
||||||
constexpr T* front()const noexcept {
|
constexpr T* front()const noexcept {
|
||||||
@ -69,5 +68,4 @@ namespace refl {
|
|||||||
return ptr != other.ptr;
|
return ptr != other.ptr;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
|
||||||
@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "zstd/parray.h"
|
#include "zstd/parray.h"
|
||||||
#include "asset_render.h"
|
#include "asset_render.h"
|
||||||
#include "../wrapper/vertex.h"
|
#include "../meta/vertex.h"
|
||||||
namespace engineapi {
|
namespace engineapi {
|
||||||
using zstd::parray;
|
using zstd::parray;
|
||||||
class Texture;
|
class Texture;
|
||||||
|
|||||||
@ -1,31 +1,49 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "math/vector3.h"
|
#include "math/vector3.h"
|
||||||
#include "math/vector2.h"
|
#include "math/vector2.h"
|
||||||
|
#include "refl/refl.h"
|
||||||
// 顶点最多关联4个骨骼
|
// 顶点最多关联4个骨骼
|
||||||
#define MAX_NUM_BONES_PER_VERTEX 4
|
#define MAX_NUM_BONES_PER_VERTEX 4
|
||||||
|
|
||||||
namespace engineapi {
|
namespace engineapi {
|
||||||
struct Vertex {
|
struct Vertex {
|
||||||
//virtual Vector3& GetPosition() = 0;
|
|
||||||
};
|
};
|
||||||
|
struct PosVertex_Meta;
|
||||||
struct PosVertex : public Vertex{
|
struct PosVertex : public Vertex{
|
||||||
|
using MyMeta = PosVertex_Meta;
|
||||||
|
__cppast(Meta = {})
|
||||||
Vector3 Position = {};
|
Vector3 Position = {};
|
||||||
};
|
};
|
||||||
|
struct TexVertex_Meta;
|
||||||
struct TexVertex : public Vertex {
|
struct TexVertex : public Vertex {
|
||||||
|
using MyMeta = TexVertex_Meta;
|
||||||
|
__cppast(Meta = {})
|
||||||
Vector3 Position = {};
|
Vector3 Position = {};
|
||||||
|
__cppast(Meta = {})
|
||||||
Vector3 Normal = {};
|
Vector3 Normal = {};
|
||||||
|
__cppast(Meta = {})
|
||||||
Vector2 TexCoords = {};
|
Vector2 TexCoords = {};
|
||||||
};
|
};
|
||||||
|
struct BoneVertex_Meta;
|
||||||
struct BoneVertex : public Vertex
|
struct BoneVertex : public Vertex
|
||||||
{
|
{
|
||||||
|
using MyMeta = BoneVertex_Meta;
|
||||||
|
__cppast(Meta = {})
|
||||||
Vector3 Position = {};
|
Vector3 Position = {};
|
||||||
|
__cppast(Meta = {})
|
||||||
Vector2 TexCoords = {};
|
Vector2 TexCoords = {};
|
||||||
|
__cppast(Meta = {})
|
||||||
Vector3 Normal = {};
|
Vector3 Normal = {};
|
||||||
|
__cppast(Meta = {})
|
||||||
Vector3 Tangent = {};
|
Vector3 Tangent = {};
|
||||||
// 骨骼蒙皮数据
|
// 骨骼蒙皮数据
|
||||||
|
__cppast(Meta = {})
|
||||||
float Weights[MAX_NUM_BONES_PER_VERTEX] = {};
|
float Weights[MAX_NUM_BONES_PER_VERTEX] = {};
|
||||||
|
__cppast(Meta = {})
|
||||||
uint32_t BoneIDs[MAX_NUM_BONES_PER_VERTEX] = {};
|
uint32_t BoneIDs[MAX_NUM_BONES_PER_VERTEX] = {};
|
||||||
|
|
||||||
void AddBoneData(uint32_t boneID, float weight);
|
void AddBoneData(uint32_t boneID, float weight);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
#include "meta_vertex_gen.inl"
|
||||||
@ -299,7 +299,7 @@ namespace vulkanapi {
|
|||||||
pipelineInfo.pRasterizationState = &rasterizationInfo;
|
pipelineInfo.pRasterizationState = &rasterizationInfo;
|
||||||
pipelineInfo.pMultisampleState = &multisampleInfo;
|
pipelineInfo.pMultisampleState = &multisampleInfo;
|
||||||
pipelineInfo.pColorBlendState = &colorBlending;
|
pipelineInfo.pColorBlendState = &colorBlending;
|
||||||
pipelineInfo.pDepthStencilState = nullptr; &depthStencilInfo;
|
pipelineInfo.pDepthStencilState = nullptr; //&depthStencilInfo;
|
||||||
pipelineInfo.layout = pipelineLayout;
|
pipelineInfo.layout = pipelineLayout;
|
||||||
pipelineInfo.renderPass = PassList[RENDER_FORWARD_RENDERING]->Ptr();
|
pipelineInfo.renderPass = PassList[RENDER_FORWARD_RENDERING]->Ptr();
|
||||||
pipelineInfo.subpass = 0;
|
pipelineInfo.subpass = 0;
|
||||||
|
|||||||
@ -5,6 +5,9 @@ target("zengine")
|
|||||||
set_kind("binary")
|
set_kind("binary")
|
||||||
set_rundir(".")
|
set_rundir(".")
|
||||||
add_rules("volk.env", "glsl.env")
|
add_rules("volk.env", "glsl.env")
|
||||||
|
add_rules("c++.codegen",{
|
||||||
|
files = {"src/engine/render/meta/*.h"}
|
||||||
|
})
|
||||||
add_deps("zlib","zlog")
|
add_deps("zlib","zlog")
|
||||||
add_defines("VULKAN_API")
|
add_defines("VULKAN_API")
|
||||||
add_packages("vulkansdk","tinyobjloader","assimp","nlohmann_json")
|
add_packages("vulkansdk","tinyobjloader","assimp","nlohmann_json")
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user