im porting my environment system to jme2.0 since im about to release it to the community. but i just found out that dynamic texture blending doesnt work with jme2.0. could this be a bug?
heres the code i setup the textures in jme1.0:
/**
* Setup day and night blending textures on the given <code>Geometry</code>.
* @param dayTexture The <code>Texture</code> used for the <code>Geometry</code> during day time.
* @param nightTexture The <code>Texture</code> used for the <code>Geometry</code> during night time.
* @param geometry The <code>Geometry</code> to be setup with the textures.
*/
private void setupTexture(Texture dayTexture, Texture nightTexture, Geometry geometry) {
TextureState texState = this.environment.getRenderer().createTextureState();
geometry.setRenderState(texState);
texState.setTexture(nightTexture, 0);
texState.setTexture(dayTexture, 1);
nightTexture.setApply(Texture.AM_COMBINE);
nightTexture.setCombineFuncRGB(Texture.ACF_INTERPOLATE);
nightTexture.setCombineSrc0RGB(Texture.ACS_TEXTURE1);
nightTexture.setCombineOp0RGB(Texture.ACO_SRC_COLOR);
nightTexture.setCombineSrc1RGB(Texture.ACS_TEXTURE);
nightTexture.setCombineOp1RGB(Texture.ACO_SRC_COLOR);
nightTexture.setCombineSrc2RGB(Texture.ACS_CONSTANT);
nightTexture.setCombineOp2RGB(Texture.ACO_SRC_ALPHA);
nightTexture.setBlendColor(this.fading);
dayTexture.setApply(Texture.AM_COMBINE);
dayTexture.setCombineFuncRGB(Texture.ACF_MODULATE);
dayTexture.setCombineSrc0RGB(Texture.ACS_PREVIOUS);
dayTexture.setCombineOp0RGB(Texture.ACO_SRC_COLOR);
dayTexture.setCombineSrc1RGB(Texture.ACS_PRIMARY_COLOR);
dayTexture.setCombineOp1RGB(Texture.ACO_SRC_COLOR);
// Apply the day texture on the geometry with blending.
geometry.copyTextureCoords(0, 0, 1);
}
and heres the code with jme2.0:
/**
* Setup day and night blending textures on the given <code>Geometry</code>.
* @param dayTexture The <code>Texture</code> used for the <code>Geometry</code> during day time.
* @param nightTexture The <code>Texture</code> used for the <code>Geometry</code> during night time.
* @param geometry The <code>Geometry</code> to be setup with the textures.
*/
private void setupTexture(Texture dayTexture, Texture nightTexture, Geometry geometry) {
TextureState texState = this.environment.getRenderer().createTextureState();
geometry.setRenderState(texState);
texState.setTexture(nightTexture, 0);
texState.setTexture(dayTexture, 1);
nightTexture.setApply(Texture.ApplyMode.Combine);
nightTexture.setCombineFuncRGB(Texture.CombinerFunctionRGB.Interpolate);
nightTexture.setCombineSrc0RGB(Texture.CombinerSource.TextureUnit1);
nightTexture.setCombineOp0RGB(Texture.CombinerOperandRGB.SourceColor);
nightTexture.setCombineSrc1RGB(Texture.CombinerSource.CurrentTexture);
nightTexture.setCombineOp1RGB(Texture.CombinerOperandRGB.SourceColor);
nightTexture.setCombineSrc2RGB(Texture.CombinerSource.Constant);
nightTexture.setCombineOp2RGB(Texture.CombinerOperandRGB.SourceAlpha);
nightTexture.setBlendColor(this.fading);
dayTexture.setApply(Texture.ApplyMode.Combine);
dayTexture.setCombineFuncRGB(Texture.CombinerFunctionRGB.Modulate);
dayTexture.setCombineSrc0RGB(Texture.CombinerSource.Previous);
dayTexture.setCombineOp0RGB(Texture.CombinerOperandRGB.SourceColor);
dayTexture.setCombineSrc1RGB(Texture.CombinerSource.PrimaryColor);
dayTexture.setCombineOp1RGB(Texture.CombinerOperandRGB.SourceColor);
// Apply the day texture on the geometry with blending.
geometry.copyTextureCoordinates(0, 1, 1);
}