Hi,
The problems seems to be piling up for me now, don't know why.
I added a ShadowHelper and added a Sphere as a receiver and a Primitives.getCube as a caster placed just over the surface of the Sphere, the sphere is made in Blender.
Everything is working and I've made the shadow visible like it should be, but that's only if I'm applying the sphere's texture directly with the following code..
sphere.setTexture("entityTexturePlanet");
From there everything is just fine, but if I'm using the following method to add the texture..
setTexture(sphere);
Calling the following function..
private static void setTexture(Object3D obj) {
TextureManager tm = TextureManager.getInstance();
obj.calcBoundingBox();
float[] bb = obj.getMesh().getBoundingBox();
float minX = bb[0];
float maxX = bb[1];
float minY = bb[2];
float maxY = bb[3];
float dx = maxX - minX;
float dy = maxY - minY;
float dxs = dx;
float dys = dy;
dx /= 20f;
dy /= 20f;
float dxd = dx;
float dyd = dy;
int tid = tm.getTextureID("entityTexturePlanet");
int bid = tm.getTextureID("ice");
PolygonManager pm = obj.getPolygonManager();
for (int i = 0; i < pm.getMaxPolygonID(); i++) {
SimpleVector v0 = pm.getTransformedVertex(i, 0);
SimpleVector v1 = pm.getTransformedVertex(i, 1);
SimpleVector v2 = pm.getTransformedVertex(i, 2);
// Assign textures for the first three layers (the "normal"
// textures)...
TextureInfo ti = new TextureInfo(tid, v0.x / dx, v0.y / dy, v1.x / dx, v1.y / dy, v2.x / dx, v2.y / dy);
// Assign the splatting texture...
ti.add(bid, -(v0.x - minX) / dxs, (v0.y - minY) / dys, -(v1.x - minX) / dxs, (v1.y - minY) / dys, -(v2.x - minX) / dxs, (v2.y - minY) / dys, TextureInfo.MODE_ADD);
pm.setPolygonTexture(i, ti);
}
Then the shadow totally disappears, this also happens if I'm using the bump map example that I've previously found..
TextureManager tm = TextureManager.getInstance();
Texture face = new Texture(res.openRawResource(R.raw.face2));
Texture normals = new Texture(res.openRawResource(R.raw.face_norm), true);
Texture heighty = new Texture(res.openRawResource(R.raw.face_height2));
TexelGrabber grabber = new TexelGrabber();
heighty.setEffect(grabber);
heighty.applyEffect();
int[] heighties = grabber.getAlpha();
AlphaMerger setter = new AlphaMerger(heighties);
normals.setEffect(setter);
normals.applyEffect();
tm.addTexture("face", face);
tm.addTexture("normals", normals);
TextureInfo ti = new TextureInfo(TextureManager.getInstance().getTextureID("face"));
ti.add(TextureManager.getInstance().getTextureID("normals"), TextureInfo.MODE_BLEND);
// Calculate for texturing..
sphere.calcTextureWrapSpherical();
sphere.setTexture(ti);
sphere.compile();
sphere.build();
Must be something that I'm not thinking of here? :/
Is these two later methods overwriting the shadow map? What is going on here?
Regards,