Package org.jwildfire.create.tina.base

Examples of org.jwildfire.create.tina.base.ShadingInfo


    }
    if (pFlame.getResolutionProfile() != null && pFlame.getResolutionProfile().length() > 0)
      attrList.add(xb.createAttr("resolution_profile", pFlame.getResolutionProfile()));
    if (pFlame.getQualityProfile() != null && pFlame.getQualityProfile().length() > 0)
      attrList.add(xb.createAttr("quality_profile", pFlame.getQualityProfile()));
    ShadingInfo shadingInfo = pFlame.getShadingInfo();
    attrList.add(xb.createAttr("shading_shading", shadingInfo.getShading().toString()));
    if (shadingInfo.getShading() == Shading.PSEUDO3D) {
      attrList.add(xb.createAttr("shading_ambient", shadingInfo.getAmbient()));
      attrList.add(xb.createAttr("shading_diffuse", shadingInfo.getDiffuse()));
      attrList.add(xb.createAttr("shading_phong", shadingInfo.getPhong()));
      attrList.add(xb.createAttr("shading_phongSize", shadingInfo.getPhongSize()));
      attrList.add(xb.createAttr("shading_lightCount", shadingInfo.getLightCount()));
      for (int i = 0; i < shadingInfo.getLightCount(); i++) {
        attrList.add(xb.createAttr("shading_lightPosX_" + i, shadingInfo.getLightPosX()[i]));
        attrList.add(xb.createAttr("shading_lightPosY_" + i, shadingInfo.getLightPosY()[i]));
        attrList.add(xb.createAttr("shading_lightPosZ_" + i, shadingInfo.getLightPosZ()[i]));
        attrList.add(xb.createAttr("shading_lightRed_" + i, shadingInfo.getLightRed()[i]));
        attrList.add(xb.createAttr("shading_lightGreen_" + i, shadingInfo.getLightGreen()[i]));
        attrList.add(xb.createAttr("shading_lightBlue_" + i, shadingInfo.getLightBlue()[i]));
      }
    }
    else if (shadingInfo.getShading() == Shading.BLUR) {
      attrList.add(xb.createAttr("shading_blurRadius", shadingInfo.getBlurRadius()));
      attrList.add(xb.createAttr("shading_blurFade", shadingInfo.getBlurFade()));
      attrList.add(xb.createAttr("shading_blurFallOff", shadingInfo.getBlurFallOff()));
    }
    else if (shadingInfo.getShading() == Shading.DISTANCE_COLOR) {
      attrList.add(xb.createAttr(AbstractFlameReader.ATTR_SHADING_DISTANCE_COLOR_RADIUS, shadingInfo.getDistanceColorRadius()));
      attrList.add(xb.createAttr(AbstractFlameReader.ATTR_SHADING_DISTANCE_COLOR_SCALE, shadingInfo.getDistanceColorScale()));
      attrList.add(xb.createAttr(AbstractFlameReader.ATTR_SHADING_DISTANCE_COLOR_EXPONENT, shadingInfo.getDistanceColorExponent()));
      attrList.add(xb.createAttr(AbstractFlameReader.ATTR_SHADING_DISTANCE_COLOR_OFFSETX, shadingInfo.getDistanceColorOffsetX()));
      attrList.add(xb.createAttr(AbstractFlameReader.ATTR_SHADING_DISTANCE_COLOR_OFFSETY, shadingInfo.getDistanceColorOffsetY()));
      attrList.add(xb.createAttr(AbstractFlameReader.ATTR_SHADING_DISTANCE_COLOR_OFFSETZ, shadingInfo.getDistanceColorOffsetZ()));
      attrList.add(xb.createAttr(AbstractFlameReader.ATTR_SHADING_DISTANCE_COLOR_STYLE, shadingInfo.getDistanceColorStyle()));
      attrList.add(xb.createAttr(AbstractFlameReader.ATTR_SHADING_DISTANCE_COLOR_COORDINATE, shadingInfo.getDistanceColorCoordinate()));
      attrList.add(xb.createAttr(AbstractFlameReader.ATTR_SHADING_DISTANCE_COLOR_SHIFT, shadingInfo.getDistanceColorShift()));
    }
    if (pFlame.getAntialiasAmount() > EPSILON) {
      attrList.add(xb.createAttr("antialias_amount", pFlame.getAntialiasAmount()));
      attrList.add(xb.createAttr("antialias_radius", pFlame.getAntialiasRadius()));
    }
View Full Code Here


    enableControl(data.filterRadiusREd, false);
    enableControl(data.filterKernelCmb, false);
  }

  public void enableShadingUI() {
    ShadingInfo shadingInfo = getCurrFlame() != null ? getCurrFlame().getShadingInfo() : null;
    boolean pseudo3DEnabled;
    boolean blurEnabled;
    boolean distanceColorEnabled;
    if (shadingInfo != null) {
      data.shadingCmb.setEnabled(true);
      pseudo3DEnabled = shadingInfo.getShading().equals(Shading.PSEUDO3D);
      blurEnabled = shadingInfo.getShading().equals(Shading.BLUR);
      distanceColorEnabled = shadingInfo.getShading().equals(Shading.DISTANCE_COLOR);
    }
    else {
      data.shadingCmb.setEnabled(false);
      pseudo3DEnabled = false;
      blurEnabled = false;
View Full Code Here

      setNoRefresh(oldNoRefrsh);
    }
  }

  public void refreshShadingUI() {
    ShadingInfo shadingInfo = getCurrFlame() != null ? getCurrFlame().getShadingInfo() : null;
    boolean pseudo3DEnabled;
    boolean blurEnabled;
    boolean distanceColorEnabled;
    if (shadingInfo != null) {
      data.shadingCmb.setSelectedItem(shadingInfo.getShading());
      pseudo3DEnabled = shadingInfo.getShading().equals(Shading.PSEUDO3D);
      blurEnabled = shadingInfo.getShading().equals(Shading.BLUR);
      distanceColorEnabled = shadingInfo.getShading().equals(Shading.DISTANCE_COLOR);
    }
    else {
      data.shadingCmb.setSelectedIndex(0);
      pseudo3DEnabled = false;
      blurEnabled = false;
      distanceColorEnabled = false;
    }
    if (pseudo3DEnabled) {
      data.shadingAmbientREd.setText(Tools.doubleToString(shadingInfo.getAmbient()));
      data.shadingAmbientSlider.setValue(Tools.FTOI(shadingInfo.getAmbient() * TinaController.SLIDER_SCALE_AMBIENT));
      data.shadingDiffuseREd.setText(Tools.doubleToString(shadingInfo.getDiffuse()));
      data.shadingDiffuseSlider.setValue(Tools.FTOI(shadingInfo.getDiffuse() * TinaController.SLIDER_SCALE_AMBIENT));
      data.shadingPhongREd.setText(Tools.doubleToString(shadingInfo.getPhong()));
      data.shadingPhongSlider.setValue(Tools.FTOI(shadingInfo.getPhong() * TinaController.SLIDER_SCALE_AMBIENT));
      data.shadingPhongSizeREd.setText(Tools.doubleToString(shadingInfo.getPhongSize()));
      data.shadingPhongSizeSlider.setValue(Tools.FTOI(shadingInfo.getPhongSize() * TinaController.SLIDER_SCALE_PHONGSIZE));
      int cIdx = data.shadingLightCmb.getSelectedIndex();
      data.shadingLightXREd.setText(Tools.doubleToString(shadingInfo.getLightPosX()[cIdx]));
      data.shadingLightXSlider.setValue(Tools.FTOI(shadingInfo.getLightPosX()[cIdx] * TinaController.SLIDER_SCALE_LIGHTPOS));
      data.shadingLightYREd.setText(Tools.doubleToString(shadingInfo.getLightPosY()[cIdx]));
      data.shadingLightYSlider.setValue(Tools.FTOI(shadingInfo.getLightPosY()[cIdx] * TinaController.SLIDER_SCALE_LIGHTPOS));
      data.shadingLightZREd.setText(Tools.doubleToString(shadingInfo.getLightPosZ()[cIdx]));
      data.shadingLightZSlider.setValue(Tools.FTOI(shadingInfo.getLightPosZ()[cIdx] * TinaController.SLIDER_SCALE_LIGHTPOS));
      data.shadingLightRedREd.setText(String.valueOf(shadingInfo.getLightRed()[cIdx]));
      data.shadingLightRedSlider.setValue(shadingInfo.getLightRed()[cIdx]);
      data.shadingLightGreenREd.setText(String.valueOf(shadingInfo.getLightGreen()[cIdx]));
      data.shadingLightGreenSlider.setValue(shadingInfo.getLightGreen()[cIdx]);
      data.shadingLightBlueREd.setText(String.valueOf(shadingInfo.getLightBlue()[cIdx]));
      data.shadingLightBlueSlider.setValue(shadingInfo.getLightBlue()[cIdx]);
    }
    else {
      data.shadingAmbientREd.setText("");
      data.shadingAmbientSlider.setValue(0);
      data.shadingDiffuseREd.setText("");
      data.shadingDiffuseSlider.setValue(0);
      data.shadingPhongREd.setText("");
      data.shadingPhongSlider.setValue(0);
      data.shadingPhongSizeREd.setText("");
      data.shadingPhongSizeSlider.setValue(0);
      data.shadingLightXREd.setText("");
      data.shadingLightXSlider.setValue(0);
      data.shadingLightYREd.setText("");
      data.shadingLightYSlider.setValue(0);
      data.shadingLightZREd.setText("");
      data.shadingLightZSlider.setValue(0);
      data.shadingLightRedREd.setText("");
      data.shadingLightRedSlider.setValue(0);
      data.shadingLightGreenREd.setText("");
      data.shadingLightGreenSlider.setValue(0);
      data.shadingLightBlueREd.setText("");
      data.shadingLightBlueSlider.setValue(0);
    }
    if (blurEnabled) {
      data.shadingBlurRadiusREd.setText(Tools.doubleToString(shadingInfo.getBlurRadius()));
      data.shadingBlurRadiusSlider.setValue(shadingInfo.getBlurRadius());
      data.shadingBlurFadeREd.setText(Tools.doubleToString(shadingInfo.getBlurFade()));
      data.shadingBlurFadeSlider.setValue(Tools.FTOI(shadingInfo.getBlurFade() * TinaController.SLIDER_SCALE_AMBIENT));
      data.shadingBlurFallOffREd.setText(Tools.doubleToString(shadingInfo.getBlurFallOff()));
      data.shadingBlurFallOffSlider.setValue(Tools.FTOI(shadingInfo.getBlurFallOff() * TinaController.SLIDER_SCALE_BLUR_FALLOFF));
    }
    else {
      data.shadingBlurRadiusREd.setText("");
      data.shadingBlurRadiusSlider.setValue(0);
      data.shadingBlurFadeREd.setText("");
      data.shadingBlurFadeSlider.setValue(0);
      data.shadingBlurFallOffREd.setText("");
      data.shadingBlurFallOffSlider.setValue(0);
    }
    if (distanceColorEnabled) {
      data.shadingDistanceColorRadiusREd.setText(Tools.doubleToString(shadingInfo.getDistanceColorRadius()));
      data.shadingDistanceColorRadiusSlider.setValue(Tools.FTOI(shadingInfo.getDistanceColorRadius() * TinaController.SLIDER_SCALE_AMBIENT));
      data.shadingDistanceColorExponentREd.setText(Tools.doubleToString(shadingInfo.getDistanceColorExponent()));
      data.shadingDistanceColorExponentSlider.setValue(Tools.FTOI(shadingInfo.getDistanceColorExponent() * TinaController.SLIDER_SCALE_AMBIENT));
      data.shadingDistanceColorScaleREd.setText(Tools.doubleToString(shadingInfo.getDistanceColorScale()));
      data.shadingDistanceColorScaleSlider.setValue(Tools.FTOI(shadingInfo.getDistanceColorScale() * TinaController.SLIDER_SCALE_AMBIENT));
      data.shadingDistanceColorOffsetXREd.setText(Tools.doubleToString(shadingInfo.getDistanceColorOffsetX()));
      data.shadingDistanceColorOffsetXSlider.setValue(Tools.FTOI(shadingInfo.getDistanceColorOffsetX() * TinaController.SLIDER_SCALE_AMBIENT));
      data.shadingDistanceColorOffsetYREd.setText(Tools.doubleToString(shadingInfo.getDistanceColorOffsetY()));
      data.shadingDistanceColorOffsetYSlider.setValue(Tools.FTOI(shadingInfo.getDistanceColorOffsetY() * TinaController.SLIDER_SCALE_AMBIENT));
      data.shadingDistanceColorOffsetZREd.setText(Tools.doubleToString(shadingInfo.getDistanceColorOffsetZ()));
      data.shadingDistanceColorOffsetZSlider.setValue(Tools.FTOI(shadingInfo.getDistanceColorOffsetZ() * TinaController.SLIDER_SCALE_AMBIENT));
      data.shadingDistanceColorStyleREd.setText(String.valueOf(shadingInfo.getDistanceColorStyle()));
      data.shadingDistanceColorStyleSlider.setValue(shadingInfo.getDistanceColorStyle());
      data.shadingDistanceColorCoordinateREd.setText(String.valueOf(shadingInfo.getDistanceColorCoordinate()));
      data.shadingDistanceColorCoordinateSlider.setValue(shadingInfo.getDistanceColorCoordinate());
      data.shadingDistanceColorShiftREd.setText(Tools.doubleToString(shadingInfo.getDistanceColorShift()));
      data.shadingDistanceColorShiftSlider.setValue(Tools.FTOI(shadingInfo.getDistanceColorShift() * TinaController.SLIDER_SCALE_AMBIENT));
    }
    else {
      data.shadingDistanceColorRadiusREd.setText("");
      data.shadingDistanceColorRadiusSlider.setValue(0);
      data.shadingDistanceColorExponentREd.setText("");
View Full Code Here

  }

  private void shadingInfoSliderChanged(JSlider pSlider, JWFNumberField pTextField, String pProperty, double pSliderScale, int pIdx) {
    if (isNoRefresh() || getCurrFlame() == null)
      return;
    ShadingInfo shadingInfo = getCurrFlame().getShadingInfo();
    setNoRefresh(true);
    try {
      double propValue = pSlider.getValue() / pSliderScale;
      pTextField.setText(Tools.doubleToString(propValue));
      Class<?> cls = shadingInfo.getClass();
      Field field;
      try {
        field = cls.getDeclaredField(pProperty);
        field.setAccessible(true);
        Class<?> fieldCls = field.getType();
View Full Code Here

  }

  private void shadingInfoTextFieldChanged(JSlider pSlider, JWFNumberField pTextField, String pProperty, double pSliderScale, int pIdx) {
    if (isNoRefresh() || getCurrFlame() == null)
      return;
    ShadingInfo shadingInfo = getCurrFlame().getShadingInfo();
    setNoRefresh(true);
    try {
      double propValue = Tools.stringToDouble(pTextField.getText());
      pSlider.setValue(Tools.FTOI(propValue * pSliderScale));

      Class<?> cls = shadingInfo.getClass();
      Field field;
      try {
        field = cls.getDeclaredField(pProperty);
        field.setAccessible(true);
        Class<?> fieldCls = field.getType();
View Full Code Here

            e.printStackTrace();
          }
        }
        else if (fCls == ShadingInfo.class) {
          try {
            ShadingInfo shadingInfo = (ShadingInfo) field.get(pFlame);
            addShadingInfoToModel(res, shadingInfo, pVisitor, state);
          }
          catch (Exception e) {
            e.printStackTrace();
          }
View Full Code Here

TOP

Related Classes of org.jwildfire.create.tina.base.ShadingInfo

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.