public void loop(float theDeltaTime) { /* change wrap mode */ if (event().keyPressed) { if (event().keyCode == KEYCODE_R) { _myImageTexture.setWrapMode(TEXTURE_WRAPMODE_REPEAT); } else if (event().keyCode == KEYCODE_C) { _myImageTexture.setWrapMode(TEXTURE_WRAPMODE_CLAMP); } } /* change texturescale */ _myImageTexture .rescale() .set( 1 + (float) event().mouseX / (float) displaycapabilities().width * 2, -1 + (float) event().mouseY / (float) displaycapabilities().height * 2); }
public void setup() { /* setup view */ displaycapabilities().backgroundcolor.set(0.2f); camera().position().set(0, -400, 1000); camera().setMode(CAMERA_MODE_LOOK_AT); /* create planes that will act as billboards */ TexturePlugin myImageTexture = drawablefactory().texture(); myImageTexture.load(bitmapfactory().getBitmap(Resource.getStream("demo/common/glow.png"))); _myImagePlane = new Plane[360]; for (int i = 0; i < _myImagePlane.length; i++) { _myImagePlane[i] = drawablefactory().plane(); _myImagePlane[i].material().addPlugin(myImageTexture); _myImagePlane[i].material().blendmode = MATERIAL_BLEND_INVERS_MULTIPLY; _myImagePlane[i].material().color.set(1, 0.1f); _myImagePlane[i].material().depthtest = false; _myImagePlane[i].setPlaneSizeToTextureSize(); final float myPercent = (float) (i + 1) / (float) _myImagePlane.length; _myImagePlane[i].scale().scale(0.5f + 1.5f * myPercent); bin(BIN_3D).add(_myImagePlane[i]); } }
public void setup() { displaycapabilities().backgroundcolor.set(0.2f); /* create a plane that carries the texture. */ _myImagePlane = drawablefactory().plane(); /* create texture and store its ID. */ _myImageTexture = new JoglMaterialPluginNonPowerOfTwoTexture(); /* load texture. */ _myImageTexture.load(bitmapfactory().getBitmap(Resource.getStream("demo/common/police.png"))); /* set the texture in the material of your shape */ _myImagePlane.material().addPlugin(_myImageTexture); /* set plane to texture size. */ _myImagePlane.setPlaneSizeToTextureSize(); _myImagePlane.rotation().z = 0.1f; /* add the plane to the renderer */ bin(BIN_3D).add(_myImagePlane); }