public static void setTranslucent(Spatial spatial) {
    MaterialState rs = (MaterialState) doRemoveRenderState(spatial, StateType.Material);
    if (rs != null) {
      materials.put(spatial.getName(), rs);

      MaterialState newState = DisplaySystem.getDisplaySystem().getRenderer().createMaterialState();

      ColorRGBA ambient = rs.getAmbient();
      ambient.a = .5f;
      ColorRGBA diffuse = rs.getDiffuse();
      diffuse.a = .5f;
      ColorRGBA emissive = rs.getEmissive();
      emissive.a = .5f;
      ColorRGBA specular = rs.getSpecular();
      specular.a = .5f;

      newState.setAmbient(ambient);
      newState.setColorMaterial(rs.getColorMaterial());
      newState.setDiffuse(diffuse);
      newState.setEmissive(emissive);
      newState.setMaterialFace(rs.getMaterialFace());
      newState.setShininess(rs.getShininess());
      newState.setSpecular(specular);
    }
    spatial.updateRenderState();
    if (spatial instanceof Node && ((Node) spatial).getChildren() != null) {
      for (int i = 0; i < ((Node) spatial).getChildren().size(); i++) {
        colorStripper(((Node) spatial).getChildren().get(i));
      }
    }
  }
 /**
  * Strips a specified RenderState from a Spatial and all of its children if there are any.
  *
  * @param s The spatial to strip
  * @param state The RenderState to be removed
  * @see RenderState
  */
 public static void removeRenderState(Spatial s, StateType state) {
   doRemoveRenderState(s, state);
   if (s instanceof Node && ((Node) s).getChildren() != null) {
     for (int i = 0; i < ((Node) s).getChildren().size(); i++) {
       removeRenderState(((Node) s).getChildren().get(i), state);
     }
   }
   s.updateRenderState();
 }
 public static void completeColorStripper(Spatial spatial) {
   spatial.clearRenderState(StateType.Material);
   spatial.clearRenderState(StateType.Texture);
   spatial.clearRenderState(StateType.Shade);
   spatial.clearRenderState(StateType.Light);
   spatial.updateRenderState();
   if (spatial instanceof Node && ((Node) spatial).getChildren() != null) {
     for (int i = 0; i < ((Node) spatial).getChildren().size(); i++) {
       colorStripper(((Node) spatial).getChildren().get(i));
     }
   }
 }
  public void frameUpdate(float timePerFrame) {
    // TODO Auto-generated method stub
    // TODO Play Frame, when in the right time => Sync-Playback-rate
    /*
     *
    // Put A Frame according to its Framerate
     * TODO: Declare    private long controller;
      						private long frameWait;
      						private long starttime;
      						private int iteration;

      			 Initialize starttime = System.currentTimeMillis();
    					controller = System.currentTimeMillis();
    					frameWait = 1000 / perf.getFramerate();
    					iteration = 0;

    This one into the update function:

    if (System.currentTimeMillis() >= (controller + frameWait)){
    		controller = System.currentTimeMillis();
    		System.out.println("There you go: " + System.currentTimeMillis());
    		drawFrame();
    		iteration++;
    }

    if (System.currentTimeMillis() > (starttime + (iteration*frameWait)+frameWait)) {
    	// skip Frame

    	iteration += 2;
    	System.out.println("Look ma, no hands: " + iteration);
    }
     */
    // timer.getTimePerFrame();

    if (oggDecoder.isReady()) {
      oggDecoder.readBody();
      TextureManager.releaseTexture(texture.getTextureKey());

      texture =
          TextureManager.loadTexture(
              Toolkit.getDefaultToolkit().createImage(oggDecoder.getYUVBuffer()),
              MinificationFilter.BilinearNearestMipMap,
              MagnificationFilter.Bilinear,
              true);
      if (texture != null) {
        if (textureState != null)
          textureState = DisplaySystem.getDisplaySystem().getRenderer().createTextureState();
        textureState.setTexture(texture);
        quad.setRenderState(textureState);
        quad.updateRenderState();
      }
    }
  }
 public static void replaceMaterials(Spatial s) {
   MaterialState ms = materials.remove(s.getName());
   if (ms != null) {
     s.setRenderState(ms);
   }
   s.updateRenderState();
   if (s instanceof Node) {
     if (((Node) s).getChildren() != null) {
       for (Spatial child : ((Node) s).getChildren()) {
         replaceMaterials(child);
       }
     }
   }
 }
 /**
  * Applies color to a Spatial in the form of a <code>MaterialState</code>.
  *
  * @param spatial
  * @param diffuseColor
  * @param ambientColor
  * @see MaterialState
  */
 public static MaterialState applyColor(
     Spatial spatial, ColorRGBA diffuseColor, ColorRGBA ambientColor) {
   colorStripper(spatial);
   MaterialState targetMaterial =
       DisplaySystem.getDisplaySystem().getRenderer().createMaterialState();
   targetMaterial.setDiffuse(diffuseColor);
   targetMaterial.setAmbient(ambientColor);
   spatial.setRenderState(targetMaterial);
   spatial.updateRenderState();
   if (workingState != null) {
     MaterialState ms = (MaterialState) workingState;
     workingState = null;
     return ms;
   } else return null;
 }
 public static void colorStripper(Spatial spatial) {
   // exception for the nodes used for building edit function
   if (spatial.getName().startsWith("$editorWidget")) {
     // logger.info(spatial.getName() + " is a editor widget");
     return;
   }
   // logger.info(spatial.getName() + " is not editor widget");
   MaterialState rs = (MaterialState) doRemoveRenderState(spatial, StateType.Material);
   if (rs != null) {
     materials.put(spatial.getName(), rs);
   }
   spatial.updateRenderState();
   if (spatial instanceof Node && ((Node) spatial).getChildren() != null) {
     for (int i = 0; i < ((Node) spatial).getChildren().size(); i++) {
       colorStripper(((Node) spatial).getChildren().get(i));
     }
   }
 }
 public static void stripWireframe(Spatial s) {
   doWireframeApplication(s, false, null);
   replaceMaterials(s);
   s.updateRenderState();
 }
 public static void applyWireframe(Spatial s) {
   WireframeState ws = DisplaySystem.getDisplaySystem().getRenderer().createWireframeState();
   colorStripper(s);
   doWireframeApplication(s, true, ws);
   s.updateRenderState();
 }
 public static void applyMaterial(Spatial spatial, MaterialState ms) {
   colorStripper(spatial);
   spatial.setRenderState(ms);
   spatial.updateRenderState();
 }