Shader #include + Remved unused Dx11Effect

This commit is contained in:
Simon Lübeß
2022-05-09 18:19:24 +02:00
parent dc235399c8
commit 3c2c37b270
10 changed files with 53 additions and 81 deletions
@@ -1,3 +1,5 @@
#include "ShaderFunctions.hlsl"
#define PI 3.14159265358979323846f
SamplerState Sampler : register(s0);
@@ -109,10 +111,10 @@ float3 FresnelSchlick(float cosTheta, float3 F0)
* Reconstructs the z-component of a normalized normal vector from a two-component value
* cnrm: The x- and y-components of a normalized normal vector
*/
float3 DecompressNormal(float2 cnrm)
{
return float3(cnrm, sqrt(1.0 - cnrm.x * cnrm.x - cnrm.y * cnrm.y));
}
//float3 DecompressNormal(float2 cnrm)
//{
// return float3(cnrm, sqrt(1.0 - cnrm.x * cnrm.x - cnrm.y * cnrm.y));
//}
float4 PS(PS_IN input) : SV_TARGET
{
+28 -26
View File
@@ -116,8 +116,7 @@ namespace GlitchyEditor
private void TestEntitiesWithModels()
{
Effect myEffect = new Effect("content/Shaders/myEffect.hlsl")..ReleaseRefNoDelete();
using (Effect myEffect = new Effect("content/Shaders/myEffect.hlsl"))
using (Texture2D albedo = new Texture2D("Textures/TestMat/rustediron2_albedo.png", true))
using (Texture2D normal = new Texture2D("Textures/TestMat/rustediron2_normal.png"))
using (Texture2D rough = new Texture2D("Textures/TestMat/rustediron2_roughness.png"))
@@ -127,31 +126,34 @@ namespace GlitchyEditor
normal.SamplerState = SamplerStateManager.AnisotropicClamp;
rough.SamplerState = SamplerStateManager.AnisotropicClamp;
metal.SamplerState = SamplerStateManager.AnisotropicClamp;
Material mat = new Material(myEffect)..ReleaseRefNoDelete();
mat.SetTexture("AlbedoTexture", albedo);
mat.SetTexture("NormalTexture", normal);
mat.SetTexture("MetallicTexture", metal);
mat.SetTexture("RoughnessTexture", rough);
//mat.SetVariable("BaseColor", Vector4(1, 0, 1, 1));
//mat.SetVariable("LightDir", Vector3(1, 1, 0).Normalized());
List<AnimationClip> clips = scope .();
ModelLoader.LoadModel("content/Models/sphere.glb", myEffect, mat, _scene.[Friend]_ecsWorld, clips);
mat = new Material(myEffect)..ReleaseRefNoDelete();
mat.SetTexture("AlbedoTexture", albedo);
mat.SetTexture("NormalTexture", normal);
mat.SetTexture("MetallicTexture", metal);
mat.SetTexture("RoughnessTexture", rough);
//mat.SetVariable("BaseColor", Vector4(1, 1, 0, 1));
//mat.SetVariable("LightDir", Vector3(0, 1, 0).Normalized());
clips = scope .();
ModelLoader.LoadModel("content/Models/sphere.glb", myEffect, mat, _scene.[Friend]_ecsWorld, clips);
List<AnimationClip> clips = scope .();
using (Material mat = new .(myEffect))
{
mat.SetTexture("AlbedoTexture", albedo);
mat.SetTexture("NormalTexture", normal);
mat.SetTexture("MetallicTexture", metal);
mat.SetTexture("RoughnessTexture", rough);
//mat.SetVariable("BaseColor", Vector4(1, 0, 1, 1));
//mat.SetVariable("LightDir", Vector3(1, 1, 0).Normalized());
ModelLoader.LoadModel("content/Models/sphere.glb", myEffect, mat, _scene.[Friend]_ecsWorld, clips);
}
using (Material mat = new .(myEffect))
{
mat.SetTexture("AlbedoTexture", albedo);
mat.SetTexture("NormalTexture", normal);
mat.SetTexture("MetallicTexture", metal);
mat.SetTexture("RoughnessTexture", rough);
//mat.SetVariable("BaseColor", Vector4(1, 1, 0, 1));
//mat.SetVariable("LightDir", Vector3(0, 1, 0).Normalized());
ModelLoader.LoadModel("content/Models/sphere.glb", myEffect, mat, _scene.[Friend]_ecsWorld, clips);
}
ClearAndReleaseItems!(clips);
}
}