コード例 #1
0
 public static HashMap<EffectiveAppearance, U3DTexture> getSphereMapsMap(
     Collection<EffectiveAppearance> apps) {
   HashMap<EffectiveAppearance, U3DTexture> r = new HashMap<EffectiveAppearance, U3DTexture>();
   for (EffectiveAppearance a : apps) {
     if (TextureUtility.hasReflectionMap(a, "polygonShader")) {
       CubeMap tex = TextureUtility.readReflectionMap(a, "polygonShader.reflectionMap");
       r.put(a, new U3DTexture(tex));
     }
   }
   return r;
 }
コード例 #2
0
 public void setFacesReflecting(boolean b) {
   facesReflecting.setSelected(b);
   if (!isFacesReflecting()) {
     if (cmFaces != null) {
       TextureUtility.removeReflectionMap(getAppearance(), CommonAttributes.POLYGON_SHADER);
       cmFaces = null;
     }
   } else {
     cmFaces =
         TextureUtility.createReflectionMap(
             getAppearance(), CommonAttributes.POLYGON_SHADER, cubeMap);
   }
 }
コード例 #3
0
 public void setPointsReflecting(boolean b) {
   pointsReflecting.setSelected(b);
   if (!isPointsReflecting()) {
     if (cmVertices != null) {
       TextureUtility.removeReflectionMap(getAppearance(), CommonAttributes.POINT_SHADER);
       cmVertices = null;
     }
   } else {
     cmVertices =
         TextureUtility.createReflectionMap(
             getAppearance(), CommonAttributes.POINT_SHADER, cubeMap);
   }
 }
コード例 #4
0
  /**
   * *******************************************************************************
   * initializeAppearance
   *
   * <p>This method is used to load each texture from disk the first time it is needed. It should
   * only be called once (and the results stored) which is why this method is private.
   * *******************************************************************************
   */
  private static Appearance initializeAppearance(TextureDescriptor td) {
    Appearance app = new Appearance();
    initializeShaders(app, Color.white);

    ImageData id = null;

    try {
      File ff = null;
      switch (td) {
        case WATER:
          ff = AssetManager.getAssetFile("textures/water.jpg");
          break;
        case GRASS:
          ff = AssetManager.getAssetFile("textures/grass.jpg");
          break;
        case BATHROOMTILE:
          ff = AssetManager.getAssetFile("textures/bathroomtile.jpg");
          break;
        case CHECKER:
          ff = AssetManager.getAssetFile("textures/checker.jpg");
          break;
        case CLAY:
          ff = AssetManager.getAssetFile("textures/clay.jpg");
          break;
        case COBBLESTONE:
          ff = AssetManager.getAssetFile("textures/cobblestone.jpg");
          break;
        case DOTS:
          ff = AssetManager.getAssetFile("textures/dots.jpg");
          break;
        case GRID:
          ff = AssetManager.getAssetFile("textures/grid.jpg");
          break;
        case LIGHTHOUSE:
          ff = AssetManager.getAssetFile("textures/lighthouse.jpg");
          break;
        case MARBLE:
          ff = AssetManager.getAssetFile("textures/marble.jpg");
          break;
        case PLAID:
          ff = AssetManager.getAssetFile("textures/plaid.jpg");
          break;
        case STUCCO:
          ff = AssetManager.getAssetFile("textures/stucco.jpg");
          break;
        case SWIRLS:
          ff = AssetManager.getAssetFile("textures/swirls.jpg");
          break;
        case ZIGZAG:
          ff = AssetManager.getAssetFile("textures/zigzag.jpg");
          break;
        case WORLDCUBE0:
          ff = AssetManager.getAssetFile("textures/worldcube0.png");
          break;
        case WORLDCUBE1:
          ff = AssetManager.getAssetFile("textures/worldcube1.png");
          break;
        case WORLDCUBE2:
          ff = AssetManager.getAssetFile("textures/worldcube2.png");
          break;
        case WORLDCUBE3:
          ff = AssetManager.getAssetFile("textures/worldcube3.png");
          break;
        case WORLDCUBE4:
          ff = AssetManager.getAssetFile("textures/worldcube4.png");
          break;
        case WORLDCUBE5:
          ff = AssetManager.getAssetFile("textures/worldcube5.png");
          break;
        case WORLDCUBE6:
          ff = AssetManager.getAssetFile("textures/worldcube6.png");
          break;
        case WORLDCUBE7:
          ff = AssetManager.getAssetFile("textures/worldcube7.png");
          break;
        case WORLDCUBE8:
          ff = AssetManager.getAssetFile("textures/worldcube8.png");
          break;
        case WORLDCUBE9:
          ff = AssetManager.getAssetFile("textures/worldcube9.png");
          break;
        case WORLDCUBE10:
          ff = AssetManager.getAssetFile("textures/worldcube10.png");
          break;
        case WORLDCUBE11:
          ff = AssetManager.getAssetFile("textures/worldcube11.png");
          break;
      }
      id = ImageData.load(Input.getInput(ff));
    } catch (Exception ee) {
      System.err.println("Error: Unable to load texture " + td);
      ee.printStackTrace();
    }

    Texture2D tex = TextureUtility.createTexture(app, POLYGON_SHADER, id);
    tex.setTextureMatrix(MatrixBuilder.euclidean().scale(0.5).getMatrix());

    return app;
  }