Reworking tangent lighting
This commit is contained in:
@@ -178,9 +178,9 @@ void DepthCullingPass::render() {
|
||||
command->bindDescriptor({viewParamsSet, vertexData->getVertexDataSet(), vertexData->getInstanceDataSet(), set});
|
||||
VertexData::DrawCallOffsets offsets = {
|
||||
.instanceOffset = 0,
|
||||
.floatOffset = 0,
|
||||
.samplerOffset = 0,
|
||||
.textureOffset = 0,
|
||||
.samplerOffset = 0,
|
||||
.floatOffset = 0,
|
||||
};
|
||||
command->pushConstants(Gfx::SE_SHADER_STAGE_TASK_BIT_EXT | Gfx::SE_SHADER_STAGE_VERTEX_BIT, 0, sizeof(VertexData::DrawCallOffsets),
|
||||
&offsets);
|
||||
|
||||
@@ -32,9 +32,9 @@ void StaticMeshVertexData::loadTexCoords(uint64 offset, uint64 index, const Arra
|
||||
dirty = true;
|
||||
}
|
||||
|
||||
void StaticMeshVertexData::loadNormals(uint64 offset, const Array<Quaternion>& data) {
|
||||
void StaticMeshVertexData::loadNormals(uint64 offset, const Array<uint32>& data) {
|
||||
assert(offset + data.size() <= head);
|
||||
std::memcpy(norData.data() + offset, data.data(), data.size() * sizeof(Quaternion));
|
||||
std::memcpy(norData.data() + offset, data.data(), data.size() * sizeof(uint32));
|
||||
// normals->updateContents(offset * sizeof(Vector4), data.size() * sizeof(Vector4), data.data());
|
||||
dirty = true;
|
||||
}
|
||||
@@ -60,10 +60,10 @@ void StaticMeshVertexData::serializeMesh(MeshId id, uint64 numVertices, ArchiveB
|
||||
Serialization::save(buffer, tex[i]);
|
||||
}
|
||||
Array<Vector> pos(numVertices);
|
||||
Array<Quaternion> nor(numVertices);
|
||||
Array<uint32> nor(numVertices);
|
||||
Array<U16Vector> col(numVertices);
|
||||
std::memcpy(pos.data(), posData.data() + offset, numVertices * sizeof(Vector));
|
||||
std::memcpy(nor.data(), norData.data() + offset, numVertices * sizeof(Quaternion));
|
||||
std::memcpy(nor.data(), norData.data() + offset, numVertices * sizeof(uint32));
|
||||
std::memcpy(col.data(), colData.data() + offset, numVertices * sizeof(U16Vector));
|
||||
Serialization::save(buffer, pos);
|
||||
Serialization::save(buffer, nor);
|
||||
@@ -84,7 +84,7 @@ uint64 StaticMeshVertexData::deserializeMesh(MeshId id, ArchiveBuffer& buffer) {
|
||||
result += tex[i].size() * sizeof(U16Vector2);
|
||||
}
|
||||
Array<Vector> pos;
|
||||
Array<Quaternion> nor;
|
||||
Array<uint32> nor;
|
||||
Array<U16Vector> col;
|
||||
Serialization::load(buffer, pos);
|
||||
Serialization::load(buffer, nor);
|
||||
@@ -93,7 +93,7 @@ uint64 StaticMeshVertexData::deserializeMesh(MeshId id, ArchiveBuffer& buffer) {
|
||||
loadNormals(offset, nor);
|
||||
loadColors(offset, col);
|
||||
result += pos.size() * sizeof(Vector);
|
||||
result += nor.size() * sizeof(Quaternion);
|
||||
result += nor.size() * sizeof(uint32);
|
||||
result += col.size() * sizeof(U16Vector);
|
||||
return result;
|
||||
}
|
||||
@@ -154,7 +154,7 @@ void StaticMeshVertexData::updateBuffers() {
|
||||
normals = graphics->createShaderBuffer(ShaderBufferCreateInfo{
|
||||
.sourceData =
|
||||
{
|
||||
.size = verticesAllocated * sizeof(Quaternion),
|
||||
.size = verticesAllocated * sizeof(uint32),
|
||||
.data = (uint8*)norData.data(),
|
||||
},
|
||||
.name = "Normals",
|
||||
|
||||
@@ -14,7 +14,7 @@ class StaticMeshVertexData : public VertexData {
|
||||
static StaticMeshVertexData* getInstance();
|
||||
void loadPositions(uint64 offset, const Array<Vector>& data);
|
||||
void loadTexCoords(uint64 offset, uint64 index, const Array<U16Vector2>& data);
|
||||
void loadNormals(uint64 offset, const Array<Quaternion>& data);
|
||||
void loadNormals(uint64 offset, const Array<uint32>& data);
|
||||
void loadColors(uint64 offset, const Array<U16Vector>& data);
|
||||
virtual void serializeMesh(MeshId id, uint64 numVertices, ArchiveBuffer& buffer) override;
|
||||
virtual uint64 deserializeMesh(MeshId id, ArchiveBuffer& buffer) override;
|
||||
|
||||
@@ -298,12 +298,6 @@ Gfx::OSampler Graphics::createSampler(const SamplerCreateInfo& createInfo) {
|
||||
return new Sampler(this, vkInfo);
|
||||
}
|
||||
|
||||
Gfx::OComputeShader Graphics::createComputeShaderFromBinary(std::string_view binaryName) {
|
||||
OComputeShader shader = new ComputeShader(this);
|
||||
shader->create(binaryName);
|
||||
return shader;
|
||||
}
|
||||
|
||||
Gfx::ODescriptorLayout Graphics::createDescriptorLayout(const std::string& name) { return new DescriptorLayout(this, name); }
|
||||
|
||||
Gfx::OPipelineLayout Graphics::createPipelineLayout(const std::string& name, Gfx::PPipelineLayout baseLayout) {
|
||||
|
||||
@@ -67,8 +67,6 @@ class Graphics : public Gfx::Graphics {
|
||||
virtual Gfx::PComputePipeline createComputePipeline(Gfx::ComputePipelineCreateInfo createInfo) override;
|
||||
virtual Gfx::OSampler createSampler(const SamplerCreateInfo& createInfo) override;
|
||||
|
||||
virtual Gfx::OComputeShader createComputeShaderFromBinary(std::string_view binaryName) override;
|
||||
|
||||
virtual Gfx::ODescriptorLayout createDescriptorLayout(const std::string& name = "") override;
|
||||
virtual Gfx::OPipelineLayout createPipelineLayout(const std::string& name = "", Gfx::PPipelineLayout baseLayout = nullptr) override;
|
||||
|
||||
|
||||
@@ -142,7 +142,7 @@ void Seele::beginCompilation(const ShaderCompilationInfo& info, SlangCompileTarg
|
||||
for (size_t i = 0; i < signature->getParameterCount(); ++i) {
|
||||
auto param = signature->getParameterByIndex(i);
|
||||
layout->addMapping(param->getName(), param->getBindingIndex());
|
||||
std::cout << param->getName() << ": " << param->getBindingIndex() << std::endl;
|
||||
//std::cout << param->getName() << ": " << param->getBindingIndex() << std::endl;
|
||||
}
|
||||
|
||||
// workaround
|
||||
|
||||
Reference in New Issue
Block a user