Package org.jwildfire.create.tina.base.raster

Examples of org.jwildfire.create.tina.base.raster.AbstractRasterPoint


    }
  }

  @Override
  protected void plotPoint(int xIdx, int yIdx, double intensity) {
    AbstractRasterPoint rp = raster[yIdx][xIdx];

    double cx, cy, cz;
    switch (style) {
      case 0:
        cx = p.x - p0.x + offsetX;
        cy = p.y - p0.y + offsetY;
        cz = p.z - p0.z + offsetZ;
        break;
      case 1:
        cx = 0.5 * (p1.x - p0.x) / DX + offsetX;
        cy = 0.5 * (p1.y - p0.y) / DX + offsetY;
        cz = 0.5 * (p1.z - p0.z) / DX + offsetZ;
        break;
      case 2: {
        double v1x = 0.5 * (p1.x - p0.x) / DX;
        double v1y = 0.5 * (p1.y - p0.y) / DX;
        double v1z = 0.5 * (p1.z - p0.z) / DX;
        double v2x = 0.5 * (p2.x - p1.x) / DX;
        double v2y = 0.5 * (p2.y - p1.y) / DX;
        double v2z = 0.5 * (p2.z - p1.z) / DX;
        cx = 0.5 * (v2x - v1x) / DX + offsetX;
        cy = 0.5 * (v2y - v1y) / DX + offsetY;
        cz = 0.5 * (v2z - v1z) / DX + offsetZ;
      }
        break;
      default:
        throw new IllegalArgumentException(String.valueOf(style));
    }
    double r;
    switch (coordinate) {
      case 0 /* r */:
        r = radius * pow(scale * (cx * cx + cy * cy + cz * cz), exponent);
        break;
      case 1 /* x */:
        r = radius * pow(scale * (cx * cx), exponent);
        break;
      case 2 /* y */:
        r = radius * pow(scale * (cy * cy), exponent);
        break;
      case 3 /* z */:
        r = radius * pow(scale * (cz * cz), exponent);
        break;
      case 4 /* rho */:
        r = radius * pow(scale * (atan2(cy, cx)), exponent);
        break;
      case 5 /* phi */:
        r = radius * pow(scale * (atan2(cz, cy)), exponent);
        break;
      default:
        throw new IllegalArgumentException(String.valueOf(coordinate));
    }
    if (p.rgbColor) {
      plotRed = p.redColor;
      plotGreen = p.greenColor;
      plotBlue = p.blueColor;
    }
    else {
      p.color = r + shift;
      if (p.color < 0.0)
        p.color = 0.0;
      else if (p.color >= 1)
        p.color = 1;

      int colorIdx = (int) (p.color * paletteIdxScl + 0.5);
      RenderColor color = colorMap[colorIdx];
      plotRed = color.red;
      plotGreen = color.green;
      plotBlue = color.blue;
    }
    transformPlotColor(p);

    rp.setRed(rp.getRed() + plotRed * prj.intensity);
    rp.setGreen(rp.getGreen() + plotGreen * prj.intensity);
    rp.setBlue(rp.getBlue() + plotBlue * prj.intensity);

    rp.incCount();
    if (observers != null && observers.size() > 0) {
      for (IterationObserver observer : observers) {
        observer.notifyIterationFinished(renderThread, xIdx, yIdx);
      }
    }
View Full Code Here


    raster = allocRaster();
  }

  private AbstractRasterPoint[][] allocRaster() {
    Class<? extends AbstractRasterPoint> rpClass = prefs.getTinaRasterPointPrecision().getRasterPointClass();
    AbstractRasterPoint rp;
    try {
      rp = rpClass.newInstance();
    }
    catch (InstantiationException e) {
      throw new RuntimeException(e);
    }
    catch (IllegalAccessException e) {
      throw new RuntimeException(e);
    }
    return rp.allocRaster(rasterWidth, rasterHeight);
  }
View Full Code Here

      for (int k = yIdx - blurRadius, yk = 0; k <= yIdx + blurRadius; k++, yk++) {
        if (k >= 0 && k < rasterHeight) {
          for (int l = xIdx - blurRadius, xk = 0; l <= xIdx + blurRadius; l++, xk++) {
            if (l >= 0 && l < rasterWidth) {
              // y, x
              AbstractRasterPoint rp = raster[k][l];
              double scl = blurKernel[yk][xk];
              rp.setRed(rp.getRed() + plotRed * scl * prj.intensity);
              rp.setGreen(rp.getGreen() + plotGreen * scl * prj.intensity);
              rp.setBlue(rp.getBlue() + plotBlue * scl * prj.intensity);
              rp.incCount();
              if (observers != null && observers.size() > 0) {
                for (IterationObserver observer : observers) {
                  observer.notifyIterationFinished(renderThread, k, l);
                }
              }
            }
          }
        }
      }
    }
    else {
      AbstractRasterPoint rp = raster[yIdx][xIdx];
      rp.setRed(rp.getRed() + plotRed * prj.intensity);
      rp.setGreen(rp.getGreen() + plotGreen * prj.intensity);
      rp.setBlue(rp.getBlue() + plotBlue * prj.intensity);
      rp.incCount();
      if (observers != null && observers.size() > 0) {
        for (IterationObserver observer : observers) {
          observer.notifyIterationFinished(renderThread, xIdx, yIdx);
        }
      }
View Full Code Here

  }

  protected double plotRed, plotGreen, plotBlue, plotContribution;

  protected void plotPoint(int xIdx, int yIdx, double intensity) {
    AbstractRasterPoint rp = raster[yIdx][xIdx];
    if (p.rgbColor) {
      plotRed = p.redColor;
      plotGreen = p.greenColor;
      plotBlue = p.blueColor;
    }
    else if (q.rgbColor) {
      plotRed = q.redColor;
      plotGreen = q.greenColor;
      plotBlue = q.blueColor;
    }
    else {
      int colorIdx = (int) (p.color * paletteIdxScl + 0.5);
      if (colorIdx < 0)
        colorIdx = 0;
      else if (colorIdx > RGBPalette.PALETTE_SIZE)
        colorIdx = RGBPalette.PALETTE_SIZE;
      RenderColor color = colorMap[colorIdx];
      plotRed = color.red;
      plotGreen = color.green;
      plotBlue = color.blue;
    }
    transformPlotColor(p);
    rp.setRed(rp.getRed() + plotRed * intensity);
    rp.setGreen(rp.getGreen() + plotGreen * intensity);
    rp.setBlue(rp.getBlue() + plotBlue * intensity);

    rp.incCount();
    if (observers != null && observers.size() > 0) {
      for (IterationObserver observer : observers) {
        observer.notifyIterationFinished(renderThread, xIdx, yIdx);
      }
    }
View Full Code Here

    xf.transformPoints(ctx, affineTA, varTA, pA, pA);
  }

  @Override
  protected void plotPoint(int xIdx, int yIdx, double intensity) {
    AbstractRasterPoint rp = raster[yIdx][xIdx];
    if (pA[0].rgbColor) {
      plotRed = pA[0].redColor;
      plotGreen = pA[0].greenColor;
      plotBlue = pA[0].blueColor;
    }
    else {
      RenderColor color = colorMap[(int) (pA[0].color * paletteIdxScl + 0.5)];
      plotRed = color.red;
      plotGreen = color.green;
      plotBlue = color.blue;
    }
    transformPlotColor(pA[0]);
    RenderColor color = new RenderColor();
    color.red = plotRed;
    color.green = plotGreen;
    color.blue = plotBlue;

    RenderColor shadedColor = shader.calculateColor(qA, color);
    rp.setRed(rp.getRed() + shadedColor.red * prj.intensity);
    rp.setGreen(rp.getGreen() + shadedColor.green * prj.intensity);
    rp.setBlue(rp.getBlue() + shadedColor.blue * prj.intensity);
    rp.incCount();
    if (observers != null && observers.size() > 0) {
      for (IterationObserver observer : observers) {
        observer.notifyIterationFinished(renderThread, xIdx, yIdx);
      }
    }
View Full Code Here

      precalcLogArray[i] = (k1 * log10(1 + x * k2)) / (flame.getWhiteLevel() * x);
    }
  }

  public void transformPointSimple(LogDensityPoint pFilteredPnt, int pX, int pY) {
    AbstractRasterPoint point = getRasterPoint(pX, pY);
    double logScale;
    long pCount = point.getCount();
    if (pCount < precalcLogArray.length) {
      logScale = precalcLogArray[(int) pCount];
    }
    else {
      logScale = (k1 * log10(1.0 + pCount * motionBlurScl * k2)) / (flame.getWhiteLevel() * pCount * motionBlurScl);
    }
    if (pCount > 0) {
      if (colorFunc == ColorFunc.NULL) {
        pFilteredPnt.red = logScale * point.getRed();
        pFilteredPnt.green = logScale * point.getGreen();
        pFilteredPnt.blue = logScale * point.getBlue();
      }
      else {
        final double scale = ChannelMixerCurves.FILTER_SCALE;
        double rawR = point.getRed() * scale / pCount;
        double rawG = point.getGreen() * scale / pCount;
        double rawB = point.getBlue() * scale / pCount;

        pFilteredPnt.red = logScale * colorFunc.mapRGBToR(rawR, rawG, rawB) * pCount / scale;
        pFilteredPnt.green = logScale * colorFunc.mapRGBToG(rawR, rawG, rawB) * pCount / scale;
        pFilteredPnt.blue = logScale * colorFunc.mapRGBToB(rawR, rawG, rawB) * pCount / scale;
      }
      pFilteredPnt.intensity = logScale * point.getCount() * flame.getWhiteLevel();
    }
    else {
      pFilteredPnt.red = pFilteredPnt.green = pFilteredPnt.blue = 0;
      pFilteredPnt.intensity = 0;
    }
View Full Code Here

    if (noiseFilterSize > 1) {
      if (colorFunc == ColorFunc.NULL) {
        pFilteredPnt.clear();
        for (int i = 0; i < noiseFilterSize; i++) {
          for (int j = 0; j < noiseFilterSize; j++) {
            AbstractRasterPoint point = getRasterPoint(pX + j, pY + i);
            int pIdx = (int) point.getCount();
            if (pIdx > 0) {
              double logScale;
              if (pIdx < precalcLogArray.length) {
                logScale = precalcLogArray[pIdx];
              }
              else {
                logScale = (k1 * log10(1.0 + point.getCount() * motionBlurScl * k2)) / (flame.getWhiteLevel() * point.getCount() * motionBlurScl);
              }
              pFilteredPnt.red += filter[i][j] * logScale * point.getRed();
              pFilteredPnt.green += filter[i][j] * logScale * point.getGreen();
              pFilteredPnt.blue += filter[i][j] * logScale * point.getBlue();
              pFilteredPnt.intensity += filter[i][j] * logScale * point.getCount() * flame.getWhiteLevel();
            }
          }
        }
      }
      else {
        pFilteredPnt.clear();
        double rawR = 0.0, rawG = 0.0, rawB = 0.0;
        double pCount = 0.0, avgLogScale = 0.0;
        for (int i = 0; i < noiseFilterSize; i++) {
          for (int j = 0; j < noiseFilterSize; j++) {
            AbstractRasterPoint point = getRasterPoint(pX + j, pY + i);
            int pIdx = (int) point.getCount();
            if (pIdx > 0) {
              double logScale;
              if (pIdx < precalcLogArray.length) {
                logScale = precalcLogArray[pIdx];
              }
              else {
                logScale = (k1 * log10(1.0 + point.getCount() * motionBlurScl * k2)) / (flame.getWhiteLevel() * point.getCount() * motionBlurScl);
              }
              rawR += filter[i][j] * point.getRed();
              rawG += filter[i][j] * point.getGreen();
              rawB += filter[i][j] * point.getBlue();
              double lPCount = filter[i][j] * point.getCount();
              avgLogScale += filter[i][j] * logScale;
              pCount += lPCount;
              pFilteredPnt.intensity += logScale * lPCount * flame.getWhiteLevel();
            }
          }
        }
        final double scale = ChannelMixerCurves.FILTER_SCALE;
        rawR = rawR * scale / pCount;
        rawG = rawG * scale / pCount;
        rawB = rawB * scale / pCount;
        pFilteredPnt.red = avgLogScale * colorFunc.mapRGBToR(rawR, rawG, rawB) * pCount / scale;
        pFilteredPnt.green = avgLogScale * colorFunc.mapRGBToG(rawR, rawG, rawB) * pCount / scale;
        pFilteredPnt.blue = avgLogScale * colorFunc.mapRGBToB(rawR, rawG, rawB) * pCount / scale;
      }
    }
    else {
      AbstractRasterPoint point = getRasterPoint(pX, pY);
      double logScale;
      long pCount = point.getCount();
      if (pCount < precalcLogArray.length) {
        logScale = precalcLogArray[(int) pCount];
      }
      else {
        logScale = (k1 * log10(1.0 + pCount * motionBlurScl * k2)) / (flame.getWhiteLevel() * pCount * motionBlurScl);
      }
      if (pCount > 0) {
        if (colorFunc == ColorFunc.NULL) {
          pFilteredPnt.red = logScale * point.getRed();
          pFilteredPnt.green = logScale * point.getGreen();
          pFilteredPnt.blue = logScale * point.getBlue();
        }
        else {
          final double scale = ChannelMixerCurves.FILTER_SCALE;
          double rawR = point.getRed() * scale / pCount;
          double rawG = point.getGreen() * scale / pCount;
          double rawB = point.getBlue() * scale / pCount;

          pFilteredPnt.red = logScale * colorFunc.mapRGBToR(rawR, rawG, rawB) * pCount / scale;
          pFilteredPnt.green = logScale * colorFunc.mapRGBToG(rawR, rawG, rawB) * pCount / scale;
          pFilteredPnt.blue = logScale * colorFunc.mapRGBToB(rawR, rawG, rawB) * pCount / scale;
        }
        pFilteredPnt.intensity = logScale * point.getCount() * flame.getWhiteLevel();
      }
      else {
        pFilteredPnt.red = pFilteredPnt.green = pFilteredPnt.blue = 0;
        pFilteredPnt.intensity = 0;
      }
View Full Code Here

TOP

Related Classes of org.jwildfire.create.tina.base.raster.AbstractRasterPoint

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.