public void putBox(Vector3f pos, float size, ColorRGBA color){ putShape(new WireBox(size, size, size), color, 1).setLocalTranslation(pos); }
/** * Create a geometry suitable for visualizing the specified bounding box. * * @param bbox the bounding box (not null) * @return a new Geometry instance in world space */ public static Geometry makeGeometry(BoundingBox bbox) { float xExtent = bbox.getXExtent(); float yExtent = bbox.getYExtent(); float zExtent = bbox.getZExtent(); WireBox mesh = new WireBox(xExtent, yExtent, zExtent); Geometry result = new Geometry("bounding box", mesh); Vector3f center = bbox.getCenter(); result.setLocalTranslation(center); return result; } }
/** * used by attachBoundChildren() */ private void attachBoundingBox(BoundingBox bb, Node parent) { WireBox wb = new WireBox(bb.getXExtent(), bb.getYExtent(), bb.getZExtent()); Geometry g = new Geometry(); g.setMesh(wb); g.setLocalTranslation(bb.getCenter()); parent.attachChild(g); }
WireBox box = new WireBox(bb.getXExtent(), bb.getYExtent(), bb.getZExtent()); Geometry geom = new Geometry(test.name + " bounds", box); geom.setMaterial(new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md")); box = new WireBox(size, size, 0); geom = new Geometry(test.name + " metric", box); geom.setMaterial(new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"));
/** * Create a geometry suitable for visualizing the specified bounding box. * * @param bbox the bounding box (not null) * @return a new Geometry instance in world space */ public static Geometry makeGeometry(BoundingBox bbox) { float xExtent = bbox.getXExtent(); float yExtent = bbox.getYExtent(); float zExtent = bbox.getZExtent(); WireBox mesh = new WireBox(xExtent, yExtent, zExtent); Geometry result = new Geometry("bounding box", mesh); Vector3f center = bbox.getCenter(); result.setLocalTranslation(center); return result; } }
/** * used by attachBoundChildren() */ private void attachBoundingBox(BoundingBox bb, Node parent) { WireBox wb = new WireBox(bb.getXExtent(), bb.getYExtent(), bb.getZExtent()); Geometry g = new Geometry(); g.setMesh(wb); g.setLocalTranslation(bb.getCenter()); parent.attachChild(g); }
private void setupVisualsForSelection() { matWireBox = new Material(this.app.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md"); matWireBox.getAdditionalRenderState().setFaceCullMode(FaceCullMode.Off); matWireBox.setColor("Color", selectionColor.getColor()); matWireBox.getAdditionalRenderState().setLineWidth(6); this.wireBox = new WireBox(MapLoader.TILE_WIDTH, MapLoader.TILE_WIDTH, MapLoader.TILE_WIDTH); this.wireBox.setDynamic(); this.wireBoxGeo = new Geometry("wireBox", wireBox); this.wireBoxGeo.setMaterial(matWireBox); this.wireBoxGeo.setCullHint(CullHint.Never); this.wireBoxGeo.setShadowMode(RenderQueue.ShadowMode.Off); this.app.getRootNode().attachChild(this.wireBoxGeo); }