mirror of
https://github.com/XProger/OpenLara.git
synced 2025-08-18 19:01:45 +02:00
remove sEnvironment sampler from shaders
This commit is contained in:
@@ -44,16 +44,21 @@ struct VS_INPUT {
|
||||
SamplerState smpLinearWrap : register(s4);
|
||||
SamplerComparisonState smpCmp : register(s5);
|
||||
|
||||
#ifdef DIFFUSE_AS_CUBE
|
||||
TextureCube sDiffuse : register(t0);
|
||||
#else
|
||||
Texture2D sDiffuse : register(t0);
|
||||
#ifdef NORMAL_AS_3D
|
||||
#endif
|
||||
|
||||
#ifdef NORMAL_AS_3D
|
||||
Texture3D sNormal : register(t1);
|
||||
#else
|
||||
#else
|
||||
Texture2D sNormal : register(t1);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
Texture2D sReflect : register(t2);
|
||||
Texture2D sShadow : register(t3);
|
||||
TextureCube sEnvironment : register(t4);
|
||||
Texture2D sMask : register(t5);
|
||||
Texture2D sMask : register(t4);
|
||||
|
||||
#define SAMPLE_2D(T,uv) T.Sample(smpDefault, uv)
|
||||
#define SAMPLE_2D_POINT(T,uv) T.Sample(smpPoint, uv)
|
||||
@@ -64,13 +69,19 @@ struct VS_INPUT {
|
||||
#define SAMPLE_2D_LOD0(T,uv) T.SampleLevel(smpLinear, uv, 0)
|
||||
#define SAMPLE_3D(T,uv) T.SampleLevel(smpLinearWrap, uv, 0)
|
||||
#define SAMPLE_CUBE(T,uv) T.Sample(smpLinear, uv)
|
||||
|
||||
#define POSITION SV_POSITION
|
||||
#else
|
||||
#ifdef DIFFUSE_AS_CUBE
|
||||
samplerCUBE sDiffuse : register(s0);
|
||||
#else
|
||||
sampler2D sDiffuse : register(s0);
|
||||
#endif
|
||||
|
||||
sampler2D sNormal : register(s1);
|
||||
sampler2D sReflect : register(s2);
|
||||
sampler2D sShadow : register(s3);
|
||||
samplerCUBE sEnvironment : register(s4);
|
||||
sampler2D sMask : register(s5);
|
||||
sampler2D sMask : register(s4);
|
||||
|
||||
#define SAMPLE_2D(T,uv) tex2D(T, uv)
|
||||
#define SAMPLE_2D_POINT(T,uv) tex2D(T, uv)
|
||||
@@ -82,7 +93,9 @@ struct VS_INPUT {
|
||||
#define SAMPLE_3D(T,uv) tex3D(T, uv)
|
||||
#define SAMPLE_CUBE(T,uv) texCUBE(T, uv)
|
||||
|
||||
#define SV_POSITION POSITION
|
||||
#ifdef PIXEL
|
||||
#define POSITION VPOS
|
||||
#endif
|
||||
#endif
|
||||
|
||||
float4 uParam : register( c0 );
|
||||
|
@@ -247,10 +247,10 @@ varying vec4 vTexCoord; // xy - atlas coords, zw - trapezoidal correction
|
||||
|
||||
#else
|
||||
|
||||
uniform sampler2D sDiffuse;
|
||||
|
||||
#ifdef TYPE_MIRROR
|
||||
uniform samplerCube sEnvironment;
|
||||
uniform samplerCube sDiffuse;
|
||||
#else
|
||||
uniform sampler2D sDiffuse;
|
||||
#endif
|
||||
|
||||
float unpack(vec4 value) {
|
||||
@@ -356,7 +356,7 @@ varying vec4 vTexCoord; // xy - atlas coords, zw - trapezoidal correction
|
||||
vec4 color;
|
||||
#ifdef TYPE_MIRROR
|
||||
vec3 rv = reflect(-normalize(vViewVec.xyz), normalize(vNormal.xyz));
|
||||
color = textureCube(sEnvironment, normalize(rv));
|
||||
color = textureCube(sDiffuse, normalize(rv));
|
||||
#else
|
||||
#ifndef TYPE_SPRITE
|
||||
#ifdef OPT_TRAPEZOID
|
||||
|
@@ -1,3 +1,4 @@
|
||||
#define DIFFUSE_AS_CUBE
|
||||
#include "common.hlsl"
|
||||
|
||||
struct VS_OUTPUT {
|
||||
@@ -31,7 +32,7 @@ VS_OUTPUT main(VS_INPUT In) {
|
||||
|
||||
float4 main(VS_OUTPUT In) : COLOR0 {
|
||||
float3 rv = reflect(-In.viewVec.xyz, In.normal.xyz);
|
||||
float4 color = SAMPLE_CUBE(sEnvironment, normalize(rv));
|
||||
float4 color = SAMPLE_CUBE(sDiffuse, normalize(rv));
|
||||
|
||||
color *= uMaterial;
|
||||
color.xyz = saturate(color.xyz);
|
||||
|
@@ -71,14 +71,14 @@ uniform mat4 uViewProj;
|
||||
#endif
|
||||
|
||||
#ifdef FILTER_EQUIRECTANGULAR
|
||||
uniform samplerCube sEnvironment;
|
||||
uniform samplerCube sDiffuse;
|
||||
|
||||
#define PI 3.14159265358979323846
|
||||
|
||||
vec4 equirectangular() {
|
||||
vec2 a = (vTexCoord - 0.5) * vec2(PI * 2.0, PI);
|
||||
vec3 v = vec3(sin(a.x) * cos(a.y), -sin(a.y), cos(a.x) * cos(a.y));
|
||||
return textureCube(sEnvironment, normalize(v));
|
||||
return textureCube(sDiffuse, normalize(v));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@@ -3,7 +3,7 @@
|
||||
#include "common.hlsl"
|
||||
|
||||
struct VS_OUTPUT {
|
||||
float4 pos : SV_POSITION;
|
||||
float4 pos : POSITION;
|
||||
half4 color : TEXCOORD0;
|
||||
half2 texCoord : TEXCOORD1;
|
||||
float3 coord : TEXCOORD2;
|
||||
|
@@ -30,10 +30,10 @@ float boxIntersect(float3 rayPos, float3 rayDir, float3 center, float3 hsize) {
|
||||
return max(0.0, max(m.x, max(m.y, m.z)));
|
||||
}
|
||||
|
||||
#ifdef _GAPI_GXM
|
||||
#if defined(_GAPI_GXM)
|
||||
float4 main(VS_OUTPUT In) : COLOR0 {
|
||||
float2 pixelCoord = float2(__pixel_x(), __pixel_y());
|
||||
#else defined(_GAPI_D3D11
|
||||
#else
|
||||
float4 main(VS_OUTPUT In) : COLOR0 {
|
||||
float2 pixelCoord = In.pos.xy;
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user