/* */ package NET.worlds.scape; /* */ /* */ import java.awt.Color; /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public class DiskShadow /* */ extends Polygon /* */ implements NonPersister, Shadow /* */ { /* 20 */ private static int numSides = 8; /* 21 */ private static float[] diskVertices = new float[5 * numSides]; /* */ /* */ /* */ /* */ static /* */ { /* 27 */ float radius = 0.5F; /* 28 */ int end = 5 * numSides; /* 29 */ double angle = 0.0D; /* 30 */ double angleInc = (float)(6.283185307179586D / numSides); /* 31 */ for (int i = 0; i < end; angle += angleInc) /* */ { /* 33 */ float x = (float)Math.cos(angle); /* 34 */ float y = (float)Math.sin(angle); /* 35 */ diskVertices[(i + 0)] = (radius * x); /* 36 */ diskVertices[(i + 1)] = (radius * y); /* 37 */ diskVertices[(i + 2)] = 0.0F; /* 38 */ diskVertices[(i + 3)] = (0.5F + 0.5F * x); /* 39 */ diskVertices[(i + 4)] = (0.5F + 0.5F * y);i += 5; /* */ } /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public DiskShadow(WObject caster) /* */ { /* 49 */ super(diskVertices, new Material(0.0F, 0.0F, 0.0F, Color.black, null, 0.5F, false, false)); /* 50 */ setBumpable(false); /* 51 */ adjustShadow(caster); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ public void adjustShadow(WObject caster) /* */ { /* 61 */ Room r = caster.getRoom(); /* 62 */ if ((!caster.getVisible()) || (r == null)) /* */ { /* 64 */ detach(); /* 65 */ return; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* 75 */ float size = caster.getMinXYExtent(); /* */ /* 77 */ BoundBoxTemp box = caster.getBoundBox(); /* */ /* */ /* */ /* 81 */ if ((size <= 0.0F) || (size > 10000.0F) || (box.hi.z < 0.0F) || (box.lo.z >= 250.0F)) /* */ { /* 83 */ detach(); /* 84 */ return; /* */ } /* */ /* */ /* */ /* 89 */ float shadowFrac = 1.0F; /* 90 */ if (box.lo.z > 0.0F) { /* 91 */ shadowFrac = 1.0F - box.lo.z / 250.0F; /* */ } /* 93 */ if ((getOwner() == null) && (r != null)) { /* 94 */ r.getEnvironment().add(this); /* */ } /* 96 */ Point3Temp xyz = caster.getWorldPosition(); /* */ /* 98 */ moveTo(xyz.x, xyz.y, r.floorHeight(xyz.x, xyz.y, xyz.z) + 0.5F); /* 99 */ yaw(getYaw() - caster.getYaw()); /* */ /* 101 */ scale(size * shadowFrac / getScaleX()); /* */ } /* */ } /* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\scape\DiskShadow.class * Java compiler version: 6 (50.0) * JD-Core Version: 0.7.1 */