Fixing descriptors a little

This commit is contained in:
Dynamitos
2023-11-12 14:46:22 +01:00
parent a9ac3d14a7
commit c1e4891456
8 changed files with 35 additions and 47 deletions
+2 -2
View File
@@ -62,7 +62,7 @@ void MaterialLoader::import(MaterialImportArgs args, PMaterialAsset asset)
// TODO: ALIGNMENT RULES
if(type.compare("float") == 0)
{
OFloatParameter p = new FloatParameter(param.key(), uniformBufferOffset, 0);
OFloatParameter p = new FloatParameter(param.key(), uniformBufferOffset, uniformBinding);
if(uniformBinding == -1)
{
layout->addDescriptorBinding(bindingCounter, Gfx::SE_DESCRIPTOR_TYPE_UNIFORM_BUFFER);
@@ -79,7 +79,7 @@ void MaterialLoader::import(MaterialImportArgs args, PMaterialAsset asset)
// TODO: ALIGNMENT RULES
else if(type.compare("float3") == 0)
{
OVectorParameter p = new VectorParameter(param.key(), uniformBufferOffset, 0);
OVectorParameter p = new VectorParameter(param.key(), uniformBufferOffset, uniformBinding);
if(uniformBinding == -1)
{
layout->addDescriptorBinding(bindingCounter, Gfx::SE_DESCRIPTOR_TYPE_UNIFORM_BUFFER);
+5 -5
View File
@@ -54,10 +54,6 @@ void MeshLoader::loadMaterials(const aiScene* scene, const std::string& baseName
matCode["profile"] = "BlinnPhong"; //TODO: other shading models
aiString texPath;
//TODO make samplers based on used textures
matCode["params"]["textureSampler"] =
{
{"type", "SamplerState"}
};
if(material->GetTexture(aiTextureType_DIFFUSE, 0, &texPath) == AI_SUCCESS)
{
std::string texFilename = std::filesystem::path(texPath.C_Str()).stem().string();
@@ -66,11 +62,15 @@ void MeshLoader::loadMaterials(const aiScene* scene, const std::string& baseName
{"type", "Texture2D"},
{"default", texFilename}
};
matCode["params"]["diffuseSampler"] =
{
{"type", "SamplerState"}
};
matCode["code"].push_back(
{
{ "exp", "Sample" },
{ "texture", "diffuseTexture" },
{ "sampler", "textureSampler" },
{ "sampler", "diffuseSampler" },
{ "coords", "input.texCoords[0]"}
}
);