From 037fae3e49b5c85e983d41b3a9dc81412c453e46 Mon Sep 17 00:00:00 2001
From: Philip Jordan
Date: Sun, 16 Jul 2023 17:30:59 +1200
Subject: [PATCH] tidied up the punch through alpha of SimpleShaderAppearance
---
.../utils/shader/SimpleShaderAppearance.java | 28 ++++++++-----------
1 file changed, 11 insertions(+), 17 deletions(-)
diff --git a/src/main/java/org/jogamp/java3d/utils/shader/SimpleShaderAppearance.java b/src/main/java/org/jogamp/java3d/utils/shader/SimpleShaderAppearance.java
index d3e6cab..19ad1ee 100644
--- a/src/main/java/org/jogamp/java3d/utils/shader/SimpleShaderAppearance.java
+++ b/src/main/java/org/jogamp/java3d/utils/shader/SimpleShaderAppearance.java
@@ -168,23 +168,17 @@ public static void setVersion120() {
"uniform int alphaTestFunction;\n" + //
"uniform float alphaTestValue;\n";
- public static String alphaTestMethod = "if(alphaTestEnabled != 0)\n" + //
- "{ \n" + //
- " if(alphaTestFunction==516)//>\n" + //
- " if(baseMap.a<=alphaTestValue)discard;\n" + //
- " else if(alphaTestFunction==518)//>=\n" + //
- " if(baseMap.a=alphaTestValue)discard;\n" + //
- " else if(alphaTestFunction==515)//<=\n" + //
- " if(baseMap.a>alphaTestValue)discard;\n" + //
- " else if(alphaTestFunction==512)//never \n" + //
- " discard; \n" + //
- "}\n";
+ public static String alphaTestMethod = " if(alphaTestEnabled != 0){\r\n"//
+ + " if(alphaTestFunction==512)discard;//never (never keep it)\r\n"//
+ + " if(alphaTestFunction==513 && !(baseMap.a< alphaTestValue))discard;\r\n"//
+ + " if(alphaTestFunction==514 && !(baseMap.a==alphaTestValue))discard;\r\n"//
+ + " if(alphaTestFunction==515 && !(baseMap.a<=alphaTestValue))discard;\r\n"//
+ + " if(alphaTestFunction==516 && !(baseMap.a> alphaTestValue))discard;\r\n"//
+ + " if(alphaTestFunction==517 && !(baseMap.a!=alphaTestValue))discard;\r\n"//
+ + " if(alphaTestFunction==518 && !(baseMap.a>=alphaTestValue))discard;\r\n"//
+ + " //alphaTestFunction==519//always (always keep it)\r\n"
+ + " }";//
+
public static String glFrontMaterial = "struct material\n" + //
" {\n" + //