Example #1
0
 public boolean update(ParameterList pl, SunflowAPI api) {
   ri = pl.getFloat("radiusInner", ri);
   ro = pl.getFloat("radiusOuter", ro);
   ri2 = ri * ri;
   ro2 = ro * ro;
   return true;
 }
Example #2
0
 public boolean update(ParameterList pl, SunflowAPI api) {
   {
     int[] quads = pl.getIntArray("quads");
     if (quads != null) {
       this.quads = quads;
     }
   }
   if (quads == null) {
     UI.printError(Module.GEOM, "Unable to update mesh - quad indices are missing");
     return false;
   }
   if (quads.length % 4 != 0)
     UI.printWarning(
         Module.GEOM, "Quad index data is not a multiple of 4 - some quads may be missing");
   pl.setFaceCount(quads.length / 4);
   {
     FloatParameter pointsP = pl.getPointArray("points");
     if (pointsP != null)
       if (pointsP.interp != InterpolationType.VERTEX)
         UI.printError(
             Module.GEOM,
             "Point interpolation type must be set to \"vertex\" - was \"%s\"",
             pointsP.interp.name().toLowerCase(Locale.ENGLISH));
       else {
         points = pointsP.data;
       }
   }
   if (points == null) {
     UI.printError(Module.GEOM, "Unabled to update mesh - vertices are missing");
     return false;
   }
   pl.setVertexCount(points.length / 3);
   pl.setFaceVertexCount(4 * (quads.length / 4));
   FloatParameter normals = pl.getVectorArray("normals");
   if (normals != null) this.normals = normals;
   FloatParameter uvs = pl.getTexCoordArray("uvs");
   if (uvs != null) this.uvs = uvs;
   int[] faceShaders = pl.getIntArray("faceshaders");
   if (faceShaders != null && faceShaders.length == quads.length / 4) {
     this.faceShaders = new byte[faceShaders.length];
     for (int i = 0; i < faceShaders.length; i++) {
       int v = faceShaders[i];
       if (v > 255) UI.printWarning(Module.GEOM, "Shader index too large on quad %d", i);
       this.faceShaders[i] = (byte) (v & 0xFF);
     }
   }
   return true;
 }
Example #3
0
 public boolean update(ParameterList pl, SunflowAPI api) {
   // get parameters
   fov = pl.getFloat("fov", fov);
   aspect = pl.getFloat("aspect", aspect);
   shiftX = pl.getFloat("shift.x", shiftX);
   shiftY = pl.getFloat("shift.y", shiftY);
   focusDistance = pl.getFloat("focus.distance", focusDistance);
   lensRadius = pl.getFloat("lens.radius", lensRadius);
   lensSides = pl.getInt("lens.sides", lensSides);
   lensRotation = pl.getFloat("lens.rotation", lensRotation);
   update();
   return true;
 }
Example #4
0
 public boolean update(ParameterList pl, SunflowAPI api) {
   c = pl.getColor("color", c);
   return true;
 }