sets the ambient color in PShapeOpenGL when setting fill for the first time, fixes issue 1342

This commit is contained in:
codeanticode
2012-11-21 01:21:18 +00:00
parent 7637b7bcd1
commit 65f8e12c97
8 changed files with 40 additions and 12 deletions

View File

@@ -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;
}