From 1af7d3700724834e40ad8636bc9a56cdc3b19b15 Mon Sep 17 00:00:00 2001 From: Normand Briere <nbriere@noware.ca> Date: Sat, 27 Jul 2019 11:52:38 -0400 Subject: [PATCH] New layout icons --- CameraPane.java | 54 +++++++++++++++++++++++++++++++++++++++--------------- 1 files changed, 39 insertions(+), 15 deletions(-) diff --git a/CameraPane.java b/CameraPane.java index 07290d0..fdb5f77 100644 --- a/CameraPane.java +++ b/CameraPane.java @@ -206,7 +206,8 @@ SetCamera(cam); - SetLight(new Camera(new cVector(10, 10, -20))); + // Warning: not used. + SetLight(new Camera(new cVector(15, 10, -20))); object = o; @@ -12402,44 +12403,66 @@ String program = // Min shader "!!ARBfp1.0\n" + - "PARAM zero123 = { 0.0, 1.0, 2.0, 1.25 };" + + "PARAM zero123 = { 0.0, 1.0, 2, 1.25 };" + "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 };" + + "PARAM light2cam0 = program.env[10];" + + "PARAM light2cam1 = program.env[11];" + + "PARAM light2cam2 = program.env[12];" + "TEMP temp;" + "TEMP light;" + "TEMP ndotl;" + "TEMP normal;" + "TEMP depth;" + + "TEMP eye;" + + "TEMP pos;" + "MAD normal, fragment.color, zero123.z, -zero123.y;" + - + Normalize("normal") + "MOV light, state.light[0].position;" + "DP3 ndotl.x, light, normal;" + // shadow - "MOV temp, fragment.texcoord[1];" + - TextureFetch("depth", "temp", "1") + + "MOV pos, fragment.texcoord[1];" + + "MOV temp, pos;" + + ShadowTextureFetch("depth", "temp", "1") + //"TEX depth, fragment.texcoord[1], texture[1], 2D;" + - "SLT temp.x, fragment.texcoord[1].z, depth.z;" + - + "SLT ndotl.z, 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;" + + "MUL ndotl.x, ndotl.x, ndotl.z;" + // Shadow + // Backlit + "MOV pos.w, zero123.y;" + + "DP4 eye.x, pos, light2cam0;" + + "DP4 eye.y, pos, light2cam1;" + + "DP4 eye.z, pos, light2cam2;" + + Normalize("eye") + + + "DP3 ndotl.y, -eye, normal;" + + //"MUL ndotl.y, ndotl.y, pow2.x;" + + "POW ndotl.y, ndotl.y, pow2.z;" + // backlit + "SUB ndotl.y, zero123.y, ndotl.y;" + + //"SUB ndotl.y, zero123.y, ndotl.y;" + + //"MUL ndotl.y, ndotl.y, pow2.z;" + + + "MAX ndotl.x, ndotl.x, ndotl.y;" + // Ambient + + // Pigment "TEX temp, fragment.texcoord[0], texture[0], 2D;" + "LRP temp, zero123.w, temp, one;" + // texture proportion "MUL temp, temp, ndotl.x;" + "MUL temp, temp, zero123.z;" + - "MOV temp.w, zero123.y;" + // reset alpha + //"MUL temp, temp, ndotl.y;" + + "MOV temp.w, zero123.y;" + // reset alpha "MOV result.color, temp;" + "END"; @@ -12581,20 +12604,20 @@ "MUL temp, floor, mapgrid.x;" + //"TEX depth0, temp, texture[1], 2D;" + (((mode & FP_SOFTSHADOW) == 0) ? "" : - TextureFetch("depth0", "temp", "1") + + ShadowTextureFetch("depth0", "temp", "1") + "") + "ADD temp.x, temp.x, mapgrid.x;" + //"TEX depth1, temp, texture[1], 2D;" + (((mode & FP_SOFTSHADOW) == 0) ? "" : - TextureFetch("depth1", "temp", "1") + + ShadowTextureFetch("depth1", "temp", "1") + "") + "ADD temp.y, temp.y, mapgrid.x;" + //"TEX depth2, temp, texture[1], 2D;" + - TextureFetch("depth2", "temp", "1") + + ShadowTextureFetch("depth2", "temp", "1") + "SUB temp.x, temp.x, mapgrid.x;" + //"TEX depth3, temp, texture[1], 2D;" + (((mode & FP_SOFTSHADOW) == 0) ? "" : - TextureFetch("depth3", "temp", "1") + + ShadowTextureFetch("depth3", "temp", "1") + "") + //"MUL texSamp0, texSamp0, state.material.front.diffuse;" + //"MOV params, material;" + @@ -13392,7 +13415,8 @@ return out; } - String TextureFetch(String dest, String src, String unit) + // Also does frustum culling + String ShadowTextureFetch(String dest, String src, String unit) { return "TEX " + dest + ", " + src + ", texture[" + unit + "], 2D;" + "SGE " + src + ".w, " + src + ".x, eps.x;" + -- Gitblit v1.6.2