mirror of
https://github.com/processing/processing4.git
synced 2026-02-02 13:21:07 +01:00
sets the ambient color in PShapeOpenGL when setting fill for the first time, fixes issue 1342
This commit is contained in:
@@ -339,6 +339,7 @@ public class PShapeOpenGL extends PShape {
|
||||
tint = pg.tint;
|
||||
tintColor = pg.tintColor;
|
||||
|
||||
setAmbient = pg.setAmbient;
|
||||
ambientColor = pg.ambientColor;
|
||||
specularColor = pg.specularColor;
|
||||
emissiveColor = pg.emissiveColor;
|
||||
@@ -1265,6 +1266,15 @@ public class PShapeOpenGL extends PShape {
|
||||
protected void fillFromCalc() {
|
||||
fill = true;
|
||||
updateFillColor(calcColor);
|
||||
|
||||
if (!setAmbient) {
|
||||
// Setting the ambient color from the current fill
|
||||
// is what the old P3D did and allows to have an
|
||||
// default ambient color when the user doesn't specify
|
||||
// it explicitly.
|
||||
ambientFromCalc();
|
||||
setAmbient = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1636,6 +1646,7 @@ public class PShapeOpenGL extends PShape {
|
||||
|
||||
protected void ambientFromCalc() {
|
||||
updateAmbientColor(calcColor);
|
||||
setAmbient = true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user