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