aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java
diff options
context:
space:
mode:
authorphil <[email protected]>2016-11-02 13:39:32 +1300
committerphil <[email protected]>2016-11-02 13:39:32 +1300
commit58ba592b289a22136f77c66b6cfe16f20413de04 (patch)
tree8d35bd52e7f4d24c08b4e4c38855dc2339be1818 /src/main/java
parentc0871563aac84a42920708b971ca91a4298fac6f (diff)
Transparency value must be clamped [0.0, 1.0]
Otherwise you can easily get crash to desktop error in the pipeline.
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/org/jogamp/java3d/TransparencyAttributesRetained.java2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/main/java/org/jogamp/java3d/TransparencyAttributesRetained.java b/src/main/java/org/jogamp/java3d/TransparencyAttributesRetained.java
index ddade7a..f56a941 100644
--- a/src/main/java/org/jogamp/java3d/TransparencyAttributesRetained.java
+++ b/src/main/java/org/jogamp/java3d/TransparencyAttributesRetained.java
@@ -92,6 +92,7 @@ class TransparencyAttributesRetained extends NodeComponentRetained {
* fully opaque and 1.0 being fully transparent
*/
final void initTransparency(float transparency) {
+ transparency = Math.max(0, Math.min(1, transparency));
this.transparency = transparency;
}
@@ -103,6 +104,7 @@ class TransparencyAttributesRetained extends NodeComponentRetained {
* fully opaque and 1.0 being fully transparent
*/
final void setTransparency(float transparency) {
+ transparency = Math.max(0, Math.min(1, transparency));
initTransparency(transparency);
sendMessage(VALUE_CHANGED, new Float(transparency));
}