예제 #1
0
 protected List<HeightInfo> availableSpace(ModelInfo info) {
   List<HeightInfo> list = new LinkedList<>();
   BufferedImage mask = info.getMask();
   if (mask == null) {
     info.parseMask();
     if (mask == null) {
       return list;
     }
   }
   int width = mask.getWidth();
   int height = mask.getHeight();
   double xr = Mediator.getMapWidth() / width;
   double zr = Mediator.getMapHeight() / height;
   for (int i = 0; i < width; i++) {
     for (int j = 0; j < height; j++) {
       double y = PreviewPanel.getColor(mask, i, j);
       if (y >= 128) {
         double x = (width / 2 - i) * xr;
         double z = (height / 2 - j) * zr;
         list.add(new HeightInfo(x, y, z));
       }
     }
   }
   return list;
 }
예제 #2
0
 protected int getCount(ModelInfo obj) {
   int count = 0;
   int max = obj.getMaxCount();
   int min = obj.getMinCount();
   if (max > 0) {
     if (max == min) {
       count = max;
     } else {
       count = rnd.nextInt(max - min) + min + 1;
     }
   }
   return count;
 }
예제 #3
0
 protected void setRotation(ModelInfo objInfo, BasicModelData obj) {
   obj.setRotation(
       randomizeDouble(
           objInfo.getRotationSettings().getMinX(), objInfo.getRotationSettings().getMaxX()),
       randomizeDouble(
           objInfo.getRotationSettings().getMinY(), objInfo.getRotationSettings().getMaxY()),
       randomizeDouble(
           objInfo.getRotationSettings().getMinZ(), objInfo.getRotationSettings().getMaxZ()));
 }
예제 #4
0
 protected void setScale(ModelInfo objInfo, BasicModelData obj) {
   double scaleX =
       randomizeDouble(objInfo.getScaleSettings().getMinX(), objInfo.getScaleSettings().getMaxX());
   if (objInfo.getScaleSettings().isEqual()) {
     obj.setScale(scaleX, scaleX, scaleX);
   } else {
     obj.setScale(
         scaleX,
         randomizeDouble(
             objInfo.getScaleSettings().getMinY(), objInfo.getScaleSettings().getMaxY()),
         randomizeDouble(
             objInfo.getScaleSettings().getMinZ(), objInfo.getScaleSettings().getMaxZ()));
   }
 }