Пример #1
0
  @Override
  void execute(
      Canvas3D cv,
      RenderAtom ra,
      boolean isNonUniformScale,
      boolean updateAlpha,
      float alpha,
      int screen,
      boolean ignoreVertexColors) {

    // Compute the offset position of the raster
    // This has to be done at render time because we need access
    // to the Canvas3D info

    // Check if adjusted position needs to be computed
    Point3d adjPos = new Point3d(); // Position of the Raster after adjusting for dstOffset
    adjPos.set(position);

    Point2d winCoord = new Point2d(); // Position of Raster in window coordinates
    Transform3D localToImagePlate = new Transform3D(); // Local to Image plate transform

    Point3d clipCoord = computeWinCoord(cv, ra, winCoord, adjPos, localToImagePlate);

    // Test raster for out of bounds in Z.
    if (clipCoord == null) {
      return;
    }

    if (clipMode == Raster.CLIP_POSITION) {
      // Do trivial reject test on Raster position.
      if (!isRasterClipPositionInside(clipCoord)) {
        return;
      }
    }

    // Add the destination offset to the Raster position in window coordinates
    winCoord.x += xDstOffset;
    winCoord.y += yDstOffset;

    // System.err.println("Step 2 : adjPos " + adjPos + " winCoord " + winCoord);

    if ((type == Raster.RASTER_COLOR) || (type == Raster.RASTER_COLOR_DEPTH)) {
      float devCoordZ = (float) (clipCoord.z * 0.5 - 0.5);
      // Do textfill stuffs
      if (texture != null) {
        // setup Texture pipe.
        cv.updateTextureForRaster(texture);

        cv.textureFill(this, winCoord, devCoordZ, alpha);

        // Restore texture pipe.
        cv.restoreTextureBin();
      }
    }

    if ((type == Raster.RASTER_DEPTH) || (type == Raster.RASTER_COLOR_DEPTH)) {

      Point2i srcOffset = new Point2i(xSrcOffset, ySrcOffset);

      if (clipMode == Raster.CLIP_IMAGE) {
        clipImage(cv, ra, winCoord, srcOffset);
      }

      computeObjCoord(cv, winCoord, adjPos, localToImagePlate);

      cv.executeRasterDepth(
          cv.ctx,
          (float) adjPos.x,
          (float) adjPos.y,
          (float) adjPos.z,
          srcOffset.x,
          srcOffset.y,
          width,
          height,
          depthComponent.width,
          depthComponent.height,
          depthComponent.type,
          ((DepthComponentIntRetained) depthComponent).depthData);
    }
  }