List of usage examples for javax.media.j3d Texture setBoundaryColor
public void setBoundaryColor(float r, float g, float b, float a)
From source file:ExTexture.java
public void checkboxChanged(CheckboxMenu menu, int check) { if (menu == imageMenu) { // Change the texture image currentImage = check;/* w w w . ja va 2 s. c o m*/ Texture tex = textureComponents[currentImage]; int mode = ((Integer) boundaries[currentBoundary].value).intValue(); Color3f color = (Color3f) colors[currentColor].value; int filter = ((Integer) filters[currentFilter].value).intValue(); shape.setAppearance(dummyApp); tex.setEnable(textureOnOff); tex.setBoundaryModeS(mode); tex.setBoundaryModeT(mode); tex.setBoundaryColor(color.x, color.y, color.z, 0.0f); tex.setMagFilter(filter); tex.setMinFilter(filter); app.setTexture(tex); shape.setAppearance(app); return; } if (menu == boundaryMenu) { // Change the texture boundary mode currentBoundary = check; Texture tex = textureComponents[currentImage]; int mode = ((Integer) boundaries[currentBoundary].value).intValue(); shape.setAppearance(dummyApp); tex.setBoundaryModeS(mode); tex.setBoundaryModeT(mode); app.setTexture(tex); shape.setAppearance(app); return; } if (menu == colorMenu) { // Change the boundary color currentColor = check; Color3f color = (Color3f) colors[currentColor].value; Texture tex = textureComponents[currentImage]; shape.setAppearance(dummyApp); tex.setBoundaryColor(color.x, color.y, color.z, 0.0f); app.setTexture(tex); shape.setAppearance(app); return; } if (menu == filterMenu) { // Change the filter mode currentFilter = check; int filter = ((Integer) filters[currentFilter].value).intValue(); Texture tex = textureComponents[currentImage]; shape.setAppearance(dummyApp); tex.setMagFilter(filter); tex.setMinFilter(filter); app.setTexture(tex); shape.setAppearance(app); return; } if (menu == modeMenu) { // Change the texture mode currentMode = check; int mode = ((Integer) modes[currentMode].value).intValue(); app.setTextureAttributes(dummyAtt); texatt.setTextureMode(mode); app.setTextureAttributes(texatt); return; } if (menu == blendColorMenu) { // Change the boundary color currentBlendColor = check; Color3f color = (Color3f) colors[currentBlendColor].value; app.setTextureAttributes(dummyAtt); texatt.setTextureBlendColor(color.x, color.y, color.z, 0.5f); app.setTextureAttributes(texatt); return; } if (menu == xformMenu) { // Change the texture transform currentXform = check; Transform3D tt = new Transform3D(); switch (currentXform) { default: case 0: // Identity texatt.setTextureTransform(tt); return; case 1: // Scale by 2 tt.setScale(2.0); texatt.setTextureTransform(tt); return; case 2: // Scale by 4 tt.setScale(4.0); texatt.setTextureTransform(tt); return; case 3: // Z rotate by 45 degrees tt.rotZ(Math.PI / 4.0); texatt.setTextureTransform(tt); return; case 4: // Translate by 0.25 tt.set(new Vector3f(0.25f, 0.0f, 0.0f)); texatt.setTextureTransform(tt); return; } } // Handle all other checkboxes super.checkboxChanged(menu, check); }