forked from OpenXRay/xray-16
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
shaders: Add GLSL port of particle shaders.
- Loading branch information
Showing
12 changed files
with
121 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
|
||
out vec4 SV_Target; | ||
in vec4 gl_FragCoord; | ||
|
||
struct v2p | ||
{ | ||
float2 tc0 ; // TEXCOORD0; | ||
float4 c ; // COLOR0; | ||
|
||
// Igor: for additional depth dest | ||
#ifdef USE_SOFT_PARTICLES | ||
float4 tctexgen ; // TEXCOORD1; | ||
#endif // USE_SOFT_PARTICLES | ||
|
||
float4 hpos ; // SV_Position; | ||
}; | ||
|
||
layout(location = TEXCOORD0) in float2 p_particle_tc ; // TEXCOORD0; | ||
layout(location = COLOR0) in float4 p_particle_c ; // COLOR0; | ||
#ifdef USE_SOFT_PARTICLES | ||
layout(location = TEXCOORD1) in float4 p_particle_tctexgen; // TEXCOORD1; | ||
#endif // USE_SOFT_PARTICLES | ||
|
||
float4 _main ( v2p I ); | ||
|
||
void main() | ||
{ | ||
v2p I; | ||
I.tc0 = p_particle_tc; | ||
I.c = p_particle_c; | ||
I.tctexgen = p_particle_tctexgen; | ||
I.hpos = gl_FragCoord; | ||
|
||
SV_Target = _main (I); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
|
||
out gl_PerVertex { vec4 gl_Position; }; | ||
|
||
struct vv | ||
{ | ||
float4 P ; // POSITION; | ||
float2 tc ; // TEXCOORD0; | ||
float4 c ; // COLOR0; | ||
}; | ||
|
||
struct v2p | ||
{ | ||
float2 tc ; // TEXCOORD0; | ||
float4 c ; // COLOR0; | ||
|
||
// Igor: for additional depth dest | ||
#ifdef USE_SOFT_PARTICLES | ||
float4 tctexgen ; // TEXCOORD1; | ||
#endif // USE_SOFT_PARTICLES | ||
|
||
float4 hpos ; // SV_Position; | ||
}; | ||
|
||
layout(location = POSITION) in float4 v_particle_P ; // POSITION; | ||
layout(location = TEXCOORD0) in float2 v_particle_tc ; // TEXCOORD0; | ||
layout(location = COLOR) in float4 v_particle_c ; // COLOR; | ||
|
||
layout(location = TEXCOORD0) out float2 v2p_particle_tc ; // TEXCOORD0; | ||
layout(location = COLOR0) out float4 v2p_particle_c ; // COLOR0; | ||
#ifdef USE_SOFT_PARTICLES | ||
layout(location = TEXCOORD1) out float4 v2p_particle_tctexgen; // TEXCOORD1; | ||
#endif // USE_SOFT_PARTICLES | ||
|
||
v2p _main ( vv I ); | ||
|
||
void main() | ||
{ | ||
vv I; | ||
I.P = v_particle_P; | ||
I.tc = v_particle_tc; | ||
I.c = v_particle_c; | ||
|
||
v2p O = _main (I); | ||
|
||
v2p_particle_tc = O.tc; | ||
v2p_particle_c = O.c; | ||
v2p_particle_tctexgen = O.tctexgen; | ||
gl_Position = O.hpos; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#include "common.h" | ||
#include "iostructs\v_particle.h" | ||
|
||
v2p _main (vv v) | ||
{ | ||
v2p o; | ||
|
||
o.hpos = mul (m_WVP, v.P); // xform, input in world coords | ||
o.hpos.z = abs (o.hpos.z); | ||
o.hpos.w = abs (o.hpos.w); | ||
o.tc = v.tc; // copy tc | ||
o.c = v.c; // copy color | ||
|
||
return o; | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#include "common.h" | ||
#include "iostructs\v_particle.h" | ||
|
||
uniform float4x4 mVPTexgen; | ||
|
||
v2p _main (vv v) | ||
{ | ||
v2p o; | ||
|
||
o.hpos = mul (m_WVP, v.P); // xform, input in world coords | ||
// o.hpos = mul (m_VP, v.P); // xform, input in world coords | ||
o.tc = v.tc; // copy tc | ||
o.c = unpack_D3DCOLOR(v.c); // copy color | ||
|
||
// Igor: for additional depth dest | ||
#ifdef USE_SOFT_PARTICLES | ||
o.tctexgen = mul( mVPTexgen, v.P); | ||
o.tctexgen.z = o.hpos.z; | ||
#endif // USE_SOFT_PARTICLES | ||
|
||
return o; | ||
} |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.