Beispiel #1
0
  public Flame createRenderFlame(Flame pSrc) {
    Flame res = pSrc.makeCopy();

    //    res.setBGTransparency(false);
    //    res.setGamma(1.5);
    //    res.setBrightness(3.36);
    //    res.getPalette().setModRed(90);
    //    res.getPalette().setModRed(60);
    //    res.getPalette().setModBlue(-60);
    //    res.setSampleDensity(2 * prefs.getTinaRenderRealtimeQuality());
    //    res.setSpatialFilterRadius(0.75);

    res.setBGTransparency(false);
    //    res.setGamma(res.getGamma() - 0.5);
    //    res.getPalette().setModSaturation(-24);
    //    res.setGamma(2.5);
    //    res.setBrightness(5.0);
    //    res.getPalette().setModRed(30);
    // res.getPalette().setModSaturation(-160);
    //    res.getPalette().setModRed(20);
    //    res.getPalette().setModBlue(-20);
    if (res.getSolidRenderSettings().isSolidRenderingEnabled()) {
      res.getSolidRenderSettings().setAoEnabled(false);
      res.getSolidRenderSettings().setShadowType(ShadowType.OFF);
      res.setCamDOF(0.0);
      res.setSampleDensity(prefs.getTinaRenderRealtimeQuality());
    } else {
      res.setSampleDensity(2 * prefs.getTinaRenderRealtimeQuality());
    }

    return res;
  }
  public ShadowCalculator(
      int rasterWidth,
      int rasterHeight,
      float[][] originXBuf,
      float[][] originYBuf,
      float[][] originZBuf,
      double imgSize,
      Flame flame) {
    this.rasterWidth = rasterWidth;
    this.rasterHeight = rasterHeight;
    this.originXBuf = originXBuf;
    this.originYBuf = originYBuf;
    this.originZBuf = originZBuf;

    lightCount = flame.getSolidRenderSettings().getLights().size();
    shadowZBuf = new float[lightCount][][];

    pre_shadowIndex = new int[lightCount];
    pre_shadowXBuf = new float[lightCount][];
    pre_shadowYBuf = new float[lightCount][];
    pre_shadowZBuf = new float[lightCount][];
    shadowMapXCentre = new double[lightCount];
    shadowMapYCentre = new double[lightCount];
    shadowMapXScale = new double[lightCount];
    shadowMapYScale = new double[lightCount];

    lightX = new double[lightCount];
    lightY = new double[lightCount];
    shadowIntensity = new double[lightCount];

    shadowMapSize = flame.getSolidRenderSettings().getShadowmapSize();
    if (shadowMapSize < 64) {
      shadowMapSize = 64;
    }
    shadowDistBias = flame.getSolidRenderSettings().getShadowmapBias();

    for (int i = 0; i < lightCount; i++) {
      DistantLight light = flame.getSolidRenderSettings().getLights().get(i);
      if (light.isCastShadows()) {
        shadowZBuf[i] = new float[shadowMapSize][shadowMapSize];
        pre_shadowXBuf[i] = new float[PRE_SHADOWMAP_SIZE];
        pre_shadowYBuf[i] = new float[PRE_SHADOWMAP_SIZE];
        pre_shadowZBuf[i] = new float[PRE_SHADOWMAP_SIZE];
        for (int k = 0; k < shadowZBuf[i].length; k++) {
          for (int l = 0; l < shadowZBuf[i][0].length; l++) {
            shadowZBuf[i][k][l] = NormalsCalculator.ZBUF_ZMIN;
          }
        }
        lightX[i] = light.getAltitude();
        lightY[i] = light.getAzimuth();
        shadowIntensity[i] = 1.0 - GfxMathLib.clamp(light.getShadowIntensity(), 0.0, 1.0);
      } else {
        shadowZBuf[i] = null;
        pre_shadowXBuf[i] = pre_shadowYBuf[i] = pre_shadowZBuf[i] = null;
      }
    }

    shadowSoften = ShadowType.SMOOTH.equals(flame.getSolidRenderSettings().getShadowType());

    double rawSmoothRadius = flame.getSolidRenderSettings().getShadowSmoothRadius();
    if (rawSmoothRadius < MathLib.EPSILON) {
      rawSmoothRadius = 0.0;
    }

    shadowSmoothRadius = clipSmoothRadius(Tools.FTOI(rawSmoothRadius * 6.0 * imgSize / 1000.0));
    if (shadowSmoothRadius < 1.0) {
      shadowSoften = false;
      shadowSmoothKernel = null;
    } else {
      shadowSmoothKernel = getShadowSmoothKernel(shadowSmoothRadius);
    }
  }