Files
Seele/res/shaders/lib/Material.slang
T

42 lines
965 B
Plaintext
Raw Normal View History

2020-06-02 11:46:18 +02:00
import Common;
2023-11-05 10:36:01 +01:00
import MaterialParameter;
2024-06-18 19:19:05 +02:00
import Scene;
2020-06-02 11:46:18 +02:00
2024-04-26 19:32:38 +02:00
//interface IMaterial
//{
2025-01-30 23:25:41 +01:00
// associatedtype BRDF: IBRDF;
// static BRDF prepare(MaterialParameter input);
2024-04-26 19:32:38 +02:00
//};
2024-08-28 17:54:14 +02:00
struct MaterialResources
{
Texture2D textureArray[512];
SamplerState samplerArray[512];
2024-09-27 15:57:37 +02:00
StructuredBuffer<float> floatArray;
2024-08-28 17:54:14 +02:00
};
layout(set=4)
ParameterBlock<MaterialResources> pResources;
2024-06-18 19:19:05 +02:00
Texture2D getMaterialTextureParameter(uint index)
{
2024-08-28 17:54:14 +02:00
return pResources.textureArray[pOffsets.textureOffset + index];
2024-06-18 19:19:05 +02:00
}
SamplerState getMaterialSamplerParameter(uint index)
{
2024-08-28 17:54:14 +02:00
return pResources.samplerArray[pOffsets.samplerOffset + index];
2024-06-18 19:19:05 +02:00
}
float getMaterialFloatParameter(uint index)
{
2024-08-28 17:54:14 +02:00
return pResources.floatArray[pOffsets.floatOffset + index];
2024-06-18 19:19:05 +02:00
}
float3 getMaterialVectorParameter(uint index)
{
return float3(
2024-08-28 17:54:14 +02:00
pResources.floatArray[pOffsets.floatOffset + index],
pResources.floatArray[pOffsets.floatOffset + index + 1],
pResources.floatArray[pOffsets.floatOffset + index + 2]
2024-06-18 19:19:05 +02:00
);
}