implemented basic shader expressions
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
cmake_minimum_required(VERSION 3.7...3.23)
|
||||
|
||||
if(${CMAKE_VERSION} VERSION_LESS 3.12)
|
||||
cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
|
||||
endif()
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
|
||||
project(${GAME_TITLE})
|
||||
|
||||
add_executable(${GAME_TITLE} main.cpp )
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "Window/WindowManager.h"
|
||||
#include ""
|
||||
#include "Asset/AssetRegistry.h"
|
||||
|
||||
int main()
|
||||
@@ -22,7 +23,7 @@ int main()
|
||||
},
|
||||
},
|
||||
};
|
||||
new GameView(windowManager->getGraphics(), window, gameViewInfo);
|
||||
new GameView(windowManager->getGraphics(), window, gameViewInfo, ${DLL_PATH});
|
||||
window->render();
|
||||
return 0;
|
||||
}
|
||||
@@ -14,7 +14,7 @@ VertexStageOutput vertexMain(PositionOnlyVertexShaderInput input)
|
||||
VertexStageOutput output;
|
||||
|
||||
float3 worldPosition = input.getWorldPosition();
|
||||
worldPosition += gMaterial.getWorldOffset();
|
||||
//worldPosition += gMaterial.getWorldOffset();
|
||||
float4 clipSpacePosition;
|
||||
|
||||
float4 viewSpacePosition = mul(gViewParams.viewMatrix, float4(worldPosition, 1));
|
||||
|
||||
@@ -26,7 +26,7 @@ VertexStageOutput vertexMain(
|
||||
VertexStageOutput output;
|
||||
VertexValueCache cache = input.getVertexCache();
|
||||
float3 worldPosition = input.getWorldPosition();
|
||||
worldPosition += gMaterial.getWorldOffset();
|
||||
//worldPosition += gMaterial.getWorldOffset();
|
||||
float4 clipSpacePosition;
|
||||
|
||||
float3x3 tangentToLocal = cache.getTangentToLocal();
|
||||
|
||||
@@ -35,27 +35,24 @@
|
||||
"type": "SamplerState"
|
||||
}
|
||||
},
|
||||
"code": {
|
||||
"baseColor": [
|
||||
"return diffuseTexture.Sample(textureSampler, input.texCoords[0] * uvScale).xyz;"
|
||||
],
|
||||
"metallic": [
|
||||
"return metallic;"
|
||||
],
|
||||
"normal": [
|
||||
"return normalTexture.Sample(textureSampler, input.texCoords[0] * uvScale).xyz;"
|
||||
],
|
||||
"specular": [
|
||||
"return specularTexture.Sample(textureSampler, input.texCoords[0] * uvScale).x;"
|
||||
],
|
||||
"roughness": [
|
||||
"return roughness;"
|
||||
],
|
||||
"sheen": [
|
||||
"return sheen;"
|
||||
],
|
||||
"worldOffset": [
|
||||
"return worldOffset;"
|
||||
]
|
||||
}
|
||||
"code": [
|
||||
{
|
||||
"exp": "Sample",
|
||||
"texture": "diffuseTexture",
|
||||
"sampler": "textureSampler",
|
||||
"coords": "input.texCoords[0]"
|
||||
},
|
||||
{
|
||||
"exp": "Swizzle",
|
||||
"target": 0,
|
||||
"comp": [0, 1, 2]
|
||||
},
|
||||
{
|
||||
"exp": "BRDF",
|
||||
"profile": "BlinnPhong",
|
||||
"values": {
|
||||
"baseColor": 1
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -20,7 +20,7 @@ struct BlinnPhong : IBRDF
|
||||
float3 h = normalize(light + view);
|
||||
float nDotH = saturate(dot(normal, h));
|
||||
|
||||
return baseColor * nDotL + lightColor * specular * pow(nDotH, sheen);
|
||||
return baseColor;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -6,15 +6,6 @@ interface IMaterial
|
||||
{
|
||||
associatedtype BRDF : IBRDF;
|
||||
BRDF prepare(MaterialFragmentParameter input);
|
||||
|
||||
float3 getWorldOffset();
|
||||
|
||||
float3 getBaseColor(MaterialFragmentParameter input);
|
||||
float getMetallic(MaterialFragmentParameter input);
|
||||
float3 getNormal(MaterialFragmentParameter input);
|
||||
float getSpecular(MaterialFragmentParameter input);
|
||||
float getRoughness(MaterialFragmentParameter input);
|
||||
float getSheen(MaterialFragmentParameter input);
|
||||
};
|
||||
|
||||
layout(set = INDEX_MATERIAL, binding = 0, std430)
|
||||
|
||||
Reference in New Issue
Block a user