Fixing mesh import
This commit is contained in:
@@ -14,6 +14,7 @@ Mesh::~Mesh()
|
||||
|
||||
void Mesh::save(ArchiveBuffer& buffer) const
|
||||
{
|
||||
Serialization::save(buffer, transform);
|
||||
Serialization::save(buffer, vertexData->getTypeName());
|
||||
Serialization::save(buffer, vertexCount);
|
||||
Serialization::save(buffer, indices);
|
||||
@@ -25,6 +26,7 @@ void Mesh::save(ArchiveBuffer& buffer) const
|
||||
void Mesh::load(ArchiveBuffer& buffer)
|
||||
{
|
||||
std::string typeName;
|
||||
Serialization::load(buffer, transform);
|
||||
Serialization::load(buffer, typeName);
|
||||
Serialization::load(buffer, vertexCount);
|
||||
vertexData = VertexData::findByTypeName(typeName);
|
||||
|
||||
@@ -11,6 +11,8 @@ public:
|
||||
Mesh();
|
||||
~Mesh();
|
||||
|
||||
// transform from importing
|
||||
Matrix4 transform = Matrix4(1);
|
||||
VertexData* vertexData;
|
||||
MeshId id;
|
||||
uint64 vertexCount;
|
||||
|
||||
@@ -150,5 +150,6 @@ void ShaderCompiler::createShaders(ShaderPermutation permutation, Gfx::OPipeline
|
||||
createInfo.entryPoint = "fragmentMain";
|
||||
collection.fragmentShader = graphics->createFragmentShader(createInfo);
|
||||
}
|
||||
collection.pipelineLayout->create();
|
||||
shaders[perm] = std::move(collection);
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ void VertexData::updateMesh(PMesh mesh, Component::Transform& transform)
|
||||
{
|
||||
matInstanceData.meshes.add(MeshInstanceData{
|
||||
.instance = InstanceData {
|
||||
.transformMatrix = transform.toMatrix(),
|
||||
.transformMatrix = mesh->transform * transform.toMatrix(),
|
||||
},
|
||||
.data = data,
|
||||
});
|
||||
|
||||
@@ -324,11 +324,15 @@ PipelineLayout::~PipelineLayout() {}
|
||||
Map<uint32, VkPipelineLayout> cachedLayouts;
|
||||
|
||||
void PipelineLayout::create() {
|
||||
vulkanDescriptorLayouts.resize(descriptorSetLayouts.size());
|
||||
for (auto [name, desc] : descriptorSetLayouts) {
|
||||
PDescriptorLayout layout = desc.cast<DescriptorLayout>();
|
||||
layout->create();
|
||||
vulkanDescriptorLayouts[parameterMapping[layout->getName()]] = layout->getHandle();
|
||||
uint32 parameterIndex = parameterMapping[layout->getName()];
|
||||
if (parameterIndex > vulkanDescriptorLayouts.size())
|
||||
{
|
||||
vulkanDescriptorLayouts.resize(parameterIndex + 1);
|
||||
}
|
||||
vulkanDescriptorLayouts[parameterIndex] = layout->getHandle();
|
||||
}
|
||||
|
||||
Array<VkPushConstantRange> vkPushConstants(pushConstants.size());
|
||||
|
||||
@@ -16,7 +16,7 @@ Slang::ComPtr<slang::IBlob> Seele::generateShader(const ShaderCreateInfo& create
|
||||
}
|
||||
slang::SessionDesc sessionDesc;
|
||||
sessionDesc.flags = 0;
|
||||
slang::CompilerOptionEntry option[2];
|
||||
StaticArray<slang::CompilerOptionEntry, 4> option;
|
||||
option[0].name = slang::CompilerOptionName::DumpIntermediates;
|
||||
option[0].value = slang::CompilerOptionValue();
|
||||
option[0].value.kind = slang::CompilerOptionValueKind::Int;
|
||||
@@ -25,8 +25,16 @@ Slang::ComPtr<slang::IBlob> Seele::generateShader(const ShaderCreateInfo& create
|
||||
option[1].value = slang::CompilerOptionValue();
|
||||
option[1].value.kind = slang::CompilerOptionValueKind::Int;
|
||||
option[1].value.intValue0 = 1;
|
||||
sessionDesc.compilerOptionEntries = option;
|
||||
sessionDesc.compilerOptionEntryCount = 2;
|
||||
option[2].name = slang::CompilerOptionName::DebugInformation;
|
||||
option[2].value = slang::CompilerOptionValue();
|
||||
option[2].value.kind = slang::CompilerOptionValueKind::Int;
|
||||
option[2].value.intValue0 = 3;
|
||||
option[3].name = slang::CompilerOptionName::DebugInformationFormat;
|
||||
option[3].value = slang::CompilerOptionValue();
|
||||
option[3].value.kind = slang::CompilerOptionValueKind::Int;
|
||||
option[3].value.stringValue0 = "c7";
|
||||
sessionDesc.compilerOptionEntries = option.data();
|
||||
sessionDesc.compilerOptionEntryCount = option.size();
|
||||
sessionDesc.defaultMatrixLayoutMode = SLANG_MATRIX_LAYOUT_COLUMN_MAJOR;
|
||||
Array<slang::PreprocessorMacroDesc> macros;
|
||||
for(const auto& [key, val] : createInfo.defines)
|
||||
@@ -41,8 +49,6 @@ Slang::ComPtr<slang::IBlob> Seele::generateShader(const ShaderCreateInfo& create
|
||||
slang::TargetDesc targetDesc;
|
||||
targetDesc.profile = globalSession->findProfile("sm_6_6");
|
||||
targetDesc.format = target;
|
||||
targetDesc.compilerOptionEntryCount = 2;
|
||||
targetDesc.compilerOptionEntries = option;
|
||||
sessionDesc.targetCount = 1;
|
||||
sessionDesc.targets = &targetDesc;
|
||||
StaticArray<const char*, 3> searchPaths = {"shaders/", "shaders/lib/", "shaders/generated/"};
|
||||
|
||||
Reference in New Issue
Block a user