diff options
| author | Fuwn <[email protected]> | 2021-05-03 16:38:41 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2021-05-03 16:38:41 -0700 |
| commit | e1e781bb2135ef78592226f1a3eaba4925702f1f (patch) | |
| tree | 8a5b590463ed413e1c6eabb719130e701b95ca63 /NET/worlds/scape/DiskShadow.java | |
| download | worlds.jar-e1e781bb2135ef78592226f1a3eaba4925702f1f.tar.xz worlds.jar-e1e781bb2135ef78592226f1a3eaba4925702f1f.zip | |
Diffstat (limited to 'NET/worlds/scape/DiskShadow.java')
| -rw-r--r-- | NET/worlds/scape/DiskShadow.java | 115 |
1 files changed, 115 insertions, 0 deletions
diff --git a/NET/worlds/scape/DiskShadow.java b/NET/worlds/scape/DiskShadow.java new file mode 100644 index 0000000..b24ab89 --- /dev/null +++ b/NET/worlds/scape/DiskShadow.java @@ -0,0 +1,115 @@ +/* */ 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 + */
\ No newline at end of file |