Adding basic depth prepass

This commit is contained in:
Dynamitos
2021-05-06 17:02:10 +02:00
parent 4a078bd24c
commit 0cf13bcff5
52 changed files with 880 additions and 155 deletions
+2 -2
View File
@@ -66,7 +66,7 @@ void BlinnPhong::generateMaterialCode(std::ofstream& codeStream, json codeJson)
};
accessorStream << "float3 getBaseColor(MaterialFragmentParameter input) {\n";
generateAccessor(accessorStream, "baseColor", "float3(0, 0, 0)");
generateAccessor(accessorStream, "baseColor", "float3(0.5f, 0.5f, 0.5f)");
accessorStream << "}";
accessorStream << "float getMetallic(MaterialFragmentParameter input) {\n";
@@ -121,7 +121,7 @@ void BlinnPhong::generateMaterialCode(std::ofstream& codeStream, json codeJson)
codeStream << name << " result;" << std::endl;
codeStream << "result.baseColor = getBaseColor(geometry);" << std::endl;
codeStream << "result.metallic = getMetallic(geometry);" << std::endl;
codeStream << "result.normal = geometry.transformNormalTexture(getNormal(geometry));" << std::endl;
codeStream << "result.normal = getNormal(geometry);" << std::endl;
codeStream << "result.specular = getSpecular(geometry);" << std::endl;
codeStream << "result.roughness = getRoughness(geometry);" << std::endl;
codeStream << "result.sheen = getSheen(geometry);" << std::endl;
+1 -1
View File
@@ -43,11 +43,11 @@ void Material::load()
void Material::compile()
{
setStatus(Status::Loading);
layout = WindowManager::getGraphics()->createDescriptorLayout();
auto& stream = getReadStream();
json j;
stream >> j;
materialName = j["name"].get<std::string>();
layout = WindowManager::getGraphics()->createDescriptorLayout(materialName + "Layout");
//Shader file needs to conform to the slang standard, which prohibits _
materialName.erase(std::remove(materialName.begin(), materialName.end(), '_'), materialName.end());
std::ofstream codeStream("./shaders/generated/"+materialName+".slang");