Klasse PostProcessingVolume

java.lang.Object
net.risingworld.api.worldelements.GameObject
net.risingworld.api.worldelements.PostProcessingVolume

public class PostProcessingVolume extends GameObject
Represents a local (or global) post-processing volume in the scene. This can either be used to create multiple post-processing volumes (with individual settings, like weighting, priority etc), or to create local volumes which are only applied if the player is inside the volume (based on the collider of the element).
Example: Create local volume and change screen color inside the volume
1//Spawn a new post processing volume with size 10x10x10 (box collider)
2PostProcessingVolume volume = new PostProcessingVolume(1f, 2f, new BoxCollider(10f, 10f, 10f, true));
3
4//Set position to player position
5volume.setLocalPosition(player.getPosition());
6
7//Update color tint and blur inside this volume
8volume.profile.colorFilter.set(1f, 0f, 0f, 1f);
9volume.profile.blur.set(5f);
10
11//Add volume to player
12player.addGameObject(volume);
  • Felddetails

  • Konstruktordetails

    • PostProcessingVolume

      public PostProcessingVolume()
      Creates a global post processing volume, i.e affecting the whole world.
    • PostProcessingVolume

      public PostProcessingVolume(float weight)
      Creates a global post processing volume, i.e affecting the whole world.
      Parameter:
      weight - weight of the volume. 1 means that post processing effects are fully applied, 0 means that post processing effects are not applied at all. Default is 1.
    • PostProcessingVolume

      public PostProcessingVolume(float weight, float blendDistance, Collider collider)
      Creates a local post processing volume, i.e only affecting the area inside this volume. The effective area is determined by a collider.
      Parameter:
      weight - weight of the volume. 1 means that post processing effects are fully applied, 0 means that post processing effects are not applied at all. Default is 1.
      blendDistance - determines how smoothly the post-processing effects should be blended if the player moves towards this volume.
      collider - a collider representing the collision area.
  • Methodendetails

    • getBlendDistance

      public float getBlendDistance()
    • setBlendDistance

      public void setBlendDistance(float blendDistance)
      Changes the blend distance for this volume. Only relevant if this is a local volume! Determines how smoothly the post processing effects are interpolated when entering this volume. A value if 0 gives a rough and instant transition. A value of 10, for example, interpolates the post processing effects over a distance of 10 blocks etc. The blend distance is applied outside the collider.
      Parameter:
      blendDistance - the new blend distance.
    • getWeight

      public float getWeight()
    • setWeight

      public void setWeight(float weight)
      Sets the weight for this volume, i.e how much the post processing effects should be applied. 1 means that the post processing effects are fully applied, 0 means that the post processing effects are not applied at all.
      Parameter:
      weight - the weight for this volume. Default value is 1.
    • getPriority

      public int getPriority()
    • setPriority

      public void setPriority(int priority)
      Sets the priority for this volume. This is only relevant if you have multiple post processing volumes which are either global or overlapping. In this case, the priority determines which post processing volume should be used.
      Parameter:
      priority - the priority for this volume. Default value is 0.
    • isLocal

      public boolean isLocal()
      Gets whether or not this is a local volume. If it's a local volume, the post processing profile is only applied while the player is inside the volume (determined by the collider). Otherwise, if it's a global volume, the post processing effects are visible everywhere (based on weight and priority).
      Gibt zurück:
      true if this is a local volume, false if this is a global volume.
    • setLocal

      public void setLocal(boolean set)
    • setCollider

      public final void setCollider(Collider collider)
      Assigns a collider to this volume. In this particular case, the collider is used to determine whether or not the player is inside the volume (if it's a local volume). To prevent the player from actually getting blocked by the collider, it's recommendable to make this a trigger collider. Alternatively don't change the layer of the game object (by default, volumes use the TRANSPARENT_FX layer, which never collides with the player).
      Setzt außer Kraft:
      setCollider in Klasse GameObject
      Parameter:
      collider - the new collider. Set to null to remove the collider.
    • updateProfile

      public void updateProfile()
      Applies all changes which were done to the post processing profile. Always call this method after modifying the profile, so the changes are synced with the players.