Example #1
0
  /**
   * Called at every frame update.
   *
   * @param frame Frame information
   */
  public void update(FrameInput frame) {

    // Notify to components
    for (Component component : components.values()) {
      component.update(frame);
    }

    // Notify to children
    for (Entity child : children) {
      child.update(frame);
    }

    // Update local model matrix if necessary.
    if (localMatrixUpdateRequired) {
      updateLocalMatrix();
      invalidateWorldModelMatrix();
      localMatrixUpdateRequired = false;
    }

    // Update world model matrix if necessary.
    if (worldMatrixUpdateRequired) {
      updateWorldModelMatrix();
      worldMatrixUpdateRequired = false;

      // Update native side values
      worldModelMatrix.get(matrixValues);
      setWorldModelMatrix(nativePointer.get(), matrixValues);
    }

    // Update opacity if necessary.
    if (updateOpacityRequired) {
      updateOpacity();
      updateOpacityRequired = false;
    }
  }
Example #2
0
  private void updateOpacity() {

    SurfaceRendererComponent surfaceRendererComponent =
        getComponent(SurfaceRendererComponent.class);
    if (surfaceRendererComponent != null) {
      surfaceRendererComponent.setOpacity(getRenderingOpacity());
    }

    for (Entity child : children) {
      child.updateOpacity();
    }
  }