/* */ package NET.worlds.scape; /* */ /* */ import java.io.IOException; /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public class PlaneBumpCalc /* */ extends BumpCalc /* */ { /* */ public void detectBump(BumpEventTemp b, WObject owner) /* */ { /* 57 */ WObject source = (WObject)b.source; /* 58 */ Point3Temp sourceStart = source.getWorldPosition(); /* */ /* 60 */ Transform xfrm = owner.getObjectToWorldMatrix(); /* 61 */ Point3Temp start = xfrm.getPosition(); /* 62 */ Point3Temp right = owner.getPlaneExtent().times(xfrm); /* 63 */ Point3Temp d = Point3Temp.make(right).minus(start); /* 64 */ xfrm.recycle(); /* */ /* */ /* */ /* */ /* 69 */ BoundBoxTemp sourceBox = source.getBoundBox(); /* */ Point2 corner; /* 71 */ Point2 corner; if (d.x > 0.0F) { Point2 corner; /* 72 */ if (d.y > 0.0F) { /* 73 */ corner = new Point2(sourceBox.lo.x, sourceBox.hi.y); /* */ } else /* 75 */ corner = new Point2(sourceBox.hi.x, sourceBox.hi.y); /* */ } else { Point2 corner; /* 77 */ if (d.y > 0.0F) { /* 78 */ corner = new Point2(sourceBox.lo.x, sourceBox.lo.y); /* */ } else { /* 80 */ corner = new Point2(sourceBox.hi.x, sourceBox.lo.y); /* */ } /* */ } /* 83 */ Point2 dn = new Point2(-d.y, d.x).normalize(); /* 84 */ corner.x -= sourceStart.x; /* 85 */ corner.y -= sourceStart.y; /* 86 */ float dist = corner.dot(dn); /* */ /* 88 */ Point3Temp extent = Point3Temp.make(dn.x * dist, dn.y * dist, 0.0F); /* */ /* */ /* */ /* */ /* */ /* 94 */ if (b.hitRegion(owner, Point3Temp.make(start).minus(extent), d, extent)) { /* 95 */ return; /* */ } /* */ /* 98 */ Point3Temp ccwNormal = Point3Temp.make(extent.y, -extent.x, 0.0F); /* 99 */ d = Point3Temp.make(ccwNormal).minus(extent); /* 100 */ Point3Temp extentL = Point3Temp.make(-d.y, d.x, 0.0F).normalize() /* 101 */ .times(dist / 1.5F); /* */ /* */ /* 104 */ Point3Temp startL = Point3Temp.make(start).minus(ccwNormal); /* */ /* */ /* */ /* 108 */ if (b.hitRegion(owner, startL, d, extentL)) { /* 109 */ return; /* */ } /* */ /* */ /* */ /* */ /* 115 */ if (b.hitRegion(owner, Point3Temp.make(right).minus(extent), Point3Temp.make(-d.y, d.x, 0.0F), Point3Temp.make(-extentL.y, extentL.x, 0.0F))) {} /* */ } /* */ /* */ /* */ /* */ /* */ /* 122 */ private static Object classCookie = new Object(); /* */ /* */ public void saveState(Saver s) throws IOException /* */ { /* 126 */ s.saveVersion(0, classCookie); /* 127 */ super.saveState(s); /* */ } /* */ /* */ public void restoreState(Restorer r) throws IOException, TooNewException /* */ { /* 132 */ switch (r.restoreVersion(classCookie)) { /* */ case 0: /* 134 */ super.restoreState(r); /* 135 */ break; /* */ default: /* 137 */ throw new TooNewException(); /* */ } /* */ } /* */ } /* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\scape\PlaneBumpCalc.class * Java compiler version: 6 (50.0) * JD-Core Version: 0.7.1 */