Add assimp-based mesh import

This commit is contained in:
2026-03-26 02:53:34 +08:00
parent b414bc5326
commit cb05472205
103 changed files with 24502 additions and 25 deletions

View File

@@ -6,6 +6,10 @@
#include "../RHICommandList.h"
#ifdef MemoryBarrier
#undef MemoryBarrier
#endif
namespace XCEngine {
namespace RHI {

View File

@@ -2,6 +2,8 @@
#include <XCEngine/Core/Asset/IResource.h>
#include <XCEngine/Core/Containers/Array.h>
#include <XCEngine/Core/Math/Vector2.h>
#include <XCEngine/Core/Math/Vector3.h>
#include <XCEngine/Core/Types.h>
namespace XCEngine {
@@ -10,7 +12,28 @@ namespace Resources {
enum class VertexAttribute : Core::uint32 {
Position = 1 << 0, Normal = 1 << 1, Tangent = 1 << 2,
Color = 1 << 3, UV0 = 1 << 4, UV1 = 1 << 5,
UV2 = 1 << 6, UV3 = 1 << 7, BoneWeights = 1 << 8, BoneIndices = 1 << 9
UV2 = 1 << 6, UV3 = 1 << 7, BoneWeights = 1 << 8, BoneIndices = 1 << 9,
Bitangent = 1 << 10
};
inline VertexAttribute operator|(VertexAttribute a, VertexAttribute b) {
return static_cast<VertexAttribute>(static_cast<Core::uint32>(a) | static_cast<Core::uint32>(b));
}
inline VertexAttribute operator&(VertexAttribute a, VertexAttribute b) {
return static_cast<VertexAttribute>(static_cast<Core::uint32>(a) & static_cast<Core::uint32>(b));
}
inline bool HasVertexAttribute(VertexAttribute attributes, VertexAttribute flag) {
return (static_cast<Core::uint32>(attributes) & static_cast<Core::uint32>(flag)) != 0;
}
struct StaticMeshVertex {
Math::Vector3 position = Math::Vector3::Zero();
Math::Vector3 normal = Math::Vector3::Zero();
Math::Vector3 tangent = Math::Vector3::Zero();
Math::Vector3 bitangent = Math::Vector3::Zero();
Math::Vector2 uv0 = Math::Vector2::Zero();
};
struct MeshSection {
@@ -52,6 +75,8 @@ public:
const Containers::Array<MeshSection>& GetSections() const { return m_sections; }
private:
void UpdateMemorySize();
Core::uint32 m_vertexCount = 0;
Core::uint32 m_vertexStride = 0;
VertexAttribute m_attributes = VertexAttribute::Position;