private void validate(ResourceFactory f) { if (diffuseColorDirty) { if (diffuseColor != null) { material.setDiffuseColor( diffuseColor.getRed(), diffuseColor.getGreen(), diffuseColor.getBlue(), diffuseColor.getAlpha()); } else { material.setDiffuseColor(0, 0, 0, 0); } diffuseColorDirty = false; } if (diffuseMap.isDirty()) { if (diffuseMap.getImage() == null) { diffuseMap.setImage(WHITE_1X1); } material.setTextureMap(diffuseMap); } if (bumpMap.isDirty()) { material.setTextureMap(bumpMap); } if (selfIllumMap.isDirty()) { material.setTextureMap(selfIllumMap); } if (specularMap.isDirty()) { material.setTextureMap(specularMap); } if (specularColorDirty || specularPowerDirty) { if (specularColor != null) { float r = specularColor.getRed(); float g = specularColor.getGreen(); float b = specularColor.getBlue(); material.setSpecularColor(true, r, g, b, specularPower); } else { material.setSpecularColor(false, 1, 1, 1, specularPower); } specularColorDirty = false; specularPowerDirty = false; } }
private void applyBackgroundFillPaint(Graphics g) { isOpaque = true; if (fillPaint != null) { if (fillPaint instanceof Color) { Color fillColor = (Color) fillPaint; isOpaque = (fillColor.getAlpha() >= 1.0); g.clear(fillColor); } else { if (!fillPaint.isOpaque()) { g.clear(); isOpaque = false; } g.setPaint(fillPaint); g.fillRect(0, 0, rtt.getContentWidth(), rtt.getContentHeight()); } } else { isOpaque = false; // Default is transparent g.clear(); } }