From de4f66e0239a736bce24e09c9a0b49b5bb92d84b Mon Sep 17 00:00:00 2001
From: Normand Briere <nbriere@noware.ca>
Date: Tue, 23 Jul 2019 02:41:35 -0400
Subject: [PATCH] Min shader.
---
CameraPane.java | 51 +++++++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 47 insertions(+), 4 deletions(-)
diff --git a/CameraPane.java b/CameraPane.java
index ffbe72c..be97bb1 100644
--- a/CameraPane.java
+++ b/CameraPane.java
@@ -12400,7 +12400,51 @@
//gl.glProgramEnvParameter4fvARB(GL.GL_FRAGMENT_PROGRAM_ARB, 127, lightParams, 0);
String program =
+ // Min shader
"!!ARBfp1.0\n" +
+ "PARAM zero123 = { 0.0, 1.0, 2.0, 3.0 };" +
+ "PARAM pow2 = { 0.5, 0.25, 0.125, 0.0 };" +
+ "PARAM one = { 1.0, 1.0, 1.0, 1.0 };" +
+ "PARAM eps = { 0.001, 0.001, 0.001, 1.0 };" +
+ "PARAM infinity = { 100000000, 100000000, 100000000, 1.0 };" +
+ "TEMP temp;" +
+ "TEMP light;" +
+ "TEMP ndotl;" +
+ "TEMP normal;" +
+ "TEMP depth;" +
+
+ "MAD normal, fragment.color, zero123.z, -zero123.y;" +
+
+ "MOV light, state.light[0].position;" +
+ "DP3 ndotl.x, light, normal;" +
+
+ // shadow
+ "MOV temp, fragment.texcoord[1];" +
+ TextureFetch("depth", "temp", "1") +
+ //"TEX depth, fragment.texcoord[1], texture[1], 2D;" +
+ "SLT temp.x, fragment.texcoord[1].z, depth.z;" +
+
+
+ // No shadow when out of frustum
+ //"SGE temp.y, depth.z, zero123.y;" +
+ //"LRP temp.x, temp.y, zero123.y, temp.x;" +
+
+ "MUL ndotl.x, ndotl.x, temp.x;" +
+ "MAX ndotl.x, ndotl.x, pow2.y;" +
+
+ "TEX temp, fragment.texcoord[0], texture[0], 2D;" +
+ "MUL temp, temp, ndotl.x;" +
+
+ "MUL temp, temp, zero123.z;" +
+
+ "MOV temp.w, zero123.y;" + // reset alpha
+
+ "MOV result.color, temp;" +
+ "END";
+
+ String program2 =
+ "!!ARBfp1.0\n" +
+
//"OPTION ARB_fragment_program_shadow;" +
"PARAM light2cam0 = program.env[10];" +
"PARAM light2cam1 = program.env[11];" +
@@ -12515,8 +12559,7 @@
"TEMP shininess;" +
"\n" +
"MOV texSamp, one;" +
- //"TEX texSamp, fragment.texcoord[0], texture[0], 2D;" +
-
+
"MOV mapgrid.x, one2048th.x;" +
"MOV temp, fragment.texcoord[1];" +
/*
@@ -12921,7 +12964,7 @@
"MAD shadow.x, buffer.x, frac.y, shadow.x;" +
"") +
- // display shadow only (bump == 0)
+ // display shadow only (fakedepth == 0)
"SUB temp.x, half.x, shadow.x;" +
"MOV temp.y, -params5.z;" + // params6.x;" +
"SLT temp.z, temp.y, -one2048th.x;" +
@@ -13413,7 +13456,7 @@
"SLT temp.x, temp.x, zero.x;" + // shadoweps
"LRP " + shadow + ", temp.x, one, " + shadow + ";" +
- // No shadow when out of frustrum
+ // No shadow when out of frustum
"SGE temp.x, " + depth + ".z, one.z;" +
"LRP " + shadow + ", temp.x, one, " + shadow + ";" +
"";
--
Gitblit v1.6.2