From cd6e9986b6268baa01161c373a921c9a2577f217 Mon Sep 17 00:00:00 2001 From: scrawl Date: Wed, 11 Jul 2012 09:09:38 +0200 Subject: [PATCH] forgot to add files --- files/materials/stars.shader | 46 +++++++++++++++++++++++++++++++++ files/materials/stars.shaderset | 15 +++++++++++ 2 files changed, 61 insertions(+) create mode 100644 files/materials/stars.shader create mode 100644 files/materials/stars.shaderset diff --git a/files/materials/stars.shader b/files/materials/stars.shader new file mode 100644 index 000000000..75592fc72 --- /dev/null +++ b/files/materials/stars.shader @@ -0,0 +1,46 @@ +#include "core.h" + +#define MRT @shGlobalSettingBool(mrt_output) + +#ifdef SH_VERTEX_SHADER + + SH_BEGIN_PROGRAM + shUniform(float4x4, wvp) @shAutoConstant(wvp, worldviewproj_matrix) + + shInput(float2, uv0) + shOutput(float2, UV) + shOutput(float, fade) + + SH_START_PROGRAM + { + shOutputPosition = shMatrixMult(wvp, shInputPosition); + UV = uv0; + + fade = (shInputPosition.z > 50) ? 1 : 0; + } + +#else + + SH_BEGIN_PROGRAM +#if MRT + shDeclareMrtOutput(1) +#endif + + shInput(float2, UV) + shInput(float, fade) + + shSampler2D(diffuseMap) + shUniform(float, nightFade) @shSharedParameter(nightFade) + + + SH_START_PROGRAM + { + shOutputColour(0) = shSample(diffuseMap, UV) * float4(1,1,1, nightFade * fade); + + +#if MRT + shOutputColour(1) = float4(1,1,1,1); +#endif + } + +#endif diff --git a/files/materials/stars.shaderset b/files/materials/stars.shaderset new file mode 100644 index 000000000..0f8803450 --- /dev/null +++ b/files/materials/stars.shaderset @@ -0,0 +1,15 @@ +shader_set stars_vertex +{ + source stars.shader + type vertex + profiles_cg vs_2_0 arbvp1 + profiles_hlsl vs_2_0 +} + +shader_set stars_fragment +{ + source stars.shader + type fragment + profiles_cg ps_2_x ps_2_0 ps arbfp1 + profiles_hlsl ps_2_0 +}