예제 #1
0
    public Shape getReflectionClip() {
      if (reflection == null || !getSkinnable().getClipReflections()) {
        return null;
      }

      return new Polygon(
          ulReflection2d.getX(), ulReflection2d.getY(),
          urReflection2d.getX(), urReflection2d.getY(),
          perspectiveTransform.getLrx(), perspectiveTransform.getLry(),
          perspectiveTransform.getLlx(), perspectiveTransform.getLly());
    }
예제 #2
0
  private void setBody() {
    body = new Rectangle(0, 0, 300, 300);

    bodyTransform.llxProperty().bind(speaker.rightHipXProperty());
    bodyTransform.llyProperty().bind(speaker.rightHipYProperty());
    bodyTransform.ulxProperty().bind(speaker.rightShoulderXProperty());
    bodyTransform.ulyProperty().bind(speaker.rightShoulderYProperty());
    bodyTransform.urxProperty().bind(speaker.leftShoulderXProperty());
    bodyTransform.uryProperty().bind(speaker.leftShoulderYProperty());
    bodyTransform.lrxProperty().bind(speaker.leftHipXProperty());
    bodyTransform.lryProperty().bind(speaker.leftHipYProperty());

    body.setEffect(bodyTransform);
    getChildren().add(body);
  }
예제 #3
0
    public PerspectiveTransform build() {
      double w = cell.prefWidth(50);
      double h = cell.prefHeight(50);

      double viewDistance =
          getWidth() * getSkinnable().getViewDistanceRatio()
              + getWidth() * getSkinnable().getRadiusRatio();
      double fov = getSkinnable().getFieldOfViewRatio() * getSkinnable().getWidth();
      double cw = w / 2;
      double ch = h / 2;

      Point2D ul2d = project(ul, viewDistance, fov, cw, ch);
      Point2D ur2d = project(ur, viewDistance, fov, cw, ch);
      Point2D ll2d = project(ll, viewDistance, fov, cw, ch);
      Point2D lr2d = project(lr, viewDistance, fov, cw, ch);

      perspectiveTransform =
          new PerspectiveTransform(
              ul2d.getX(),
              ul2d.getY(),
              ur2d.getX(),
              ur2d.getY(),
              lr2d.getX(),
              lr2d.getY(),
              ll2d.getX(),
              ll2d.getY());

      if (reflection != null) {
        ulReflection2d = project(ulReflection, viewDistance, fov, cw, ch);
        urReflection2d = project(urReflection, viewDistance, fov, cw, ch);

        perspectiveTransform.setInput(reflection);
      }

      return perspectiveTransform;
    }