targetDir.mkdirs();
// Must deploy textures before models so we have the deployment url mapping
deployTextures(targetDir, textureDeploymentMapping, importedModel);
ModelCellServerState cellSetup = new ModelCellServerState();
ModelCellComponentServerState setup = new ModelCellComponentServerState();
cellSetup.addComponentServerState(setup);
cellSetup.setName(importedModel.getWonderlandName());
BoundingVolume modelBounds = importedModel.getModelBG().getWorldBound();
float scale = scaleBounds(modelBounds);
modelBounds = modelBounds.transform(new Quaternion(), Vector3f.ZERO,
new Vector3f(scale, scale, scale));
cellSetup.setBoundingVolumeHint(new BoundingVolumeHint(false, modelBounds));
deployedModel.setModelBounds(modelBounds);
Vector3f offset = importedModel.getRootBG().getLocalTranslation();
PositionComponentServerState position = new PositionComponentServerState();
Vector3f boundsCenter = modelBounds.getCenter();
offset.subtractLocal(boundsCenter);
deployedModel.setModelTranslation(offset);
deployedModel.setModelRotation(importedModel.getModelBG().getLocalRotation());
deployedModel.setModelScale(importedModel.getModelBG().getLocalScale().multLocal(scale));
// System.err.println("BOUNDS CENTER "+boundsCenter);
// System.err.println("OFfset "+offset);
// System.err.println("Cell origin "+boundsCenter);
position.setTranslation(boundsCenter);
// The cell bounds already have the rotation and scale applied, so these
// values must not go in the Cell transform. Instead they go in the
// deployedModel so that the model is correctly oriented and thus
// matches the bounds in the cell.
// Center the worldBounds on the cell (ie 0,0,0)
BoundingVolume worldBounds = modelBounds.clone(null);
worldBounds.setCenter(new Vector3f(0,0,0));
position.setBounds(worldBounds);
cellSetup.addComponentServerState(position);
deployedModel.addCellServerState(cellSetup);
deployModels(targetDir,
moduleName,