/** @param name */ public GeoMap(String name, int worldSize) { setCollisionFlags((short) (CollisionIntention.ALL.getId() << 8)); for (int x = 0; x < worldSize; x += 256) { for (int y = 0; y < worldSize; y += 256) { Node geoNode = new Node(""); geoNode.setCollisionFlags((short) (CollisionIntention.ALL.getId() << 8)); tmpBox.add(new BoundingBox(new Vector3f(x, y, 0), new Vector3f(x + 256, y + 256, 4000))); super.attachChild(geoNode); } } }
/* * (non-Javadoc) * @see aionjHungary.geoEngine.scene.Spatial#updateModelBound() */ @Override public void updateModelBound() { if (getChildren() != null) { Iterator<Spatial> i = getChildren().iterator(); while (i.hasNext()) { Spatial s = i.next(); if (s instanceof Node && ((Node) s).getChildren().isEmpty()) { i.remove(); } } } super.updateModelBound(); }
/* * (non-Javadoc) * @see aionjHungary.geoEngine.scene.Node#attachChild(aionjHungary.geoEngine.scene.Spatial) */ @Override public int attachChild(Spatial child) { int i = 0; if (child instanceof DoorGeometry) { doors.put(child.getName(), (DoorGeometry) child); } for (Spatial spatial : getChildren()) { if (tmpBox.get(i).intersects(child.getWorldBound())) { ((Node) spatial).attachChild(child); } i++; } return 0; }