Class Statistics

java.lang.Object
com.jme3.renderer.Statistics

public class Statistics extends Object
Allows tracking of real-time rendering statistics.

The Statistics can be retrieved by using Renderer.getStatistics().

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected boolean
    Enables or disables updates.
    protected IntMap<Void>
    IDs of all FBOs in use.
    protected int
    ID of the most recently used shader.
    protected int
    Number of active frame buffers.
    protected int
    Number of active shaders.
    protected int
    Number of active textures.
    protected int
    Number of FBO switches during the current frame.
    protected int
    Number of object used during the current frame.
    protected int
    Number of shader switches during the current frame.
    protected int
    Number of texture binds during the current frame.
    protected int
    Number of mesh primitives rendered during the current frame.
    protected int
    Number of uniforms set during the current frame.
    protected int
    Number of mesh vertices rendered during the current frame.
    protected IntMap<Void>
    IDs of all shaders in use.
    protected IntMap<Void>
    IDs of all textures in use.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Clears all frame-specific statistics such as objects used per frame.
    void
    Called when video memory is cleared.
    void
    getData(int[] data)
    Retrieves the statistics data into the given array.
    Returns a list of labels corresponding to each statistic.
    boolean
    Tests whether updates are enabled.
    void
    Called by the Renderer when it deletes a framebuffer.
    void
    Called by the Renderer when it deletes a shader.
    void
    Called by the Renderer when it deletes a texture.
    void
    onFrameBufferUse(FrameBuffer fb, boolean wasSwitched)
    Called by the Renderer when a framebuffer has been set.
    void
    onMeshDrawn(Mesh mesh, int lod)
    Called by the Renderer when a mesh has been drawn.
    void
    onMeshDrawn(Mesh mesh, int lod, int count)
    Called by the Renderer when a mesh has been drawn.
    void
    Called by the Renderer when it creates a new framebuffer.
    void
    Called by the Renderer when it creates a new shader.
    void
    Called by the Renderer when it creates a new texture.
    void
    onShaderUse(Shader shader, boolean wasSwitched)
    Called by the Renderer when a shader has been utilized.
    void
    onTextureUse(Image image, boolean wasSwitched)
    Called by the Renderer when a texture has been set.
    void
    Called by the Renderer when a uniform was set.
    void
    setEnabled(boolean f)
    Enables or disables updates.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • enabled

      protected boolean enabled
      Enables or disables updates.
    • numObjects

      protected int numObjects
      Number of object used during the current frame.
    • numTriangles

      protected int numTriangles
      Number of mesh primitives rendered during the current frame.
    • numVertices

      protected int numVertices
      Number of mesh vertices rendered during the current frame.
    • numShaderSwitches

      protected int numShaderSwitches
      Number of shader switches during the current frame.
    • numTextureBinds

      protected int numTextureBinds
      Number of texture binds during the current frame.
    • numFboSwitches

      protected int numFboSwitches
      Number of FBO switches during the current frame.
    • numUniformsSet

      protected int numUniformsSet
      Number of uniforms set during the current frame.
    • memoryShaders

      protected int memoryShaders
      Number of active shaders.
    • memoryFrameBuffers

      protected int memoryFrameBuffers
      Number of active frame buffers.
    • memoryTextures

      protected int memoryTextures
      Number of active textures.
    • shadersUsed

      protected IntMap<Void> shadersUsed
      IDs of all shaders in use.
    • texturesUsed

      protected IntMap<Void> texturesUsed
      IDs of all textures in use.
    • fbosUsed

      protected IntMap<Void> fbosUsed
      IDs of all FBOs in use.
    • lastShader

      protected int lastShader
      ID of the most recently used shader.
  • Constructor Details

    • Statistics

      public Statistics()
  • Method Details

    • getLabels

      public String[] getLabels()
      Returns a list of labels corresponding to each statistic.
      Returns:
      a list of labels corresponding to each statistic.
      See Also:
    • getData

      public void getData(int[] data)
      Retrieves the statistics data into the given array. The array should be as large as the array given in getLabels().
      Parameters:
      data - The data array to write to
    • onMeshDrawn

      public void onMeshDrawn(Mesh mesh, int lod, int count)
      Called by the Renderer when a mesh has been drawn.
      Parameters:
      mesh - the Mesh that was drawn (not null)
      lod - which level of detail
      count - multiplier for triangles and vertices
    • onMeshDrawn

      public void onMeshDrawn(Mesh mesh, int lod)
      Called by the Renderer when a mesh has been drawn.
      Parameters:
      mesh - the Mesh that was drawn (not null)
      lod - which level of detail
    • onShaderUse

      public void onShaderUse(Shader shader, boolean wasSwitched)
      Called by the Renderer when a shader has been utilized.
      Parameters:
      shader - The shader that was used
      wasSwitched - If true, the shader has required a state switch
    • onUniformSet

      public void onUniformSet()
      Called by the Renderer when a uniform was set.
    • onTextureUse

      public void onTextureUse(Image image, boolean wasSwitched)
      Called by the Renderer when a texture has been set.
      Parameters:
      image - The image that was set
      wasSwitched - If true, the texture has required a state switch
    • onFrameBufferUse

      public void onFrameBufferUse(FrameBuffer fb, boolean wasSwitched)
      Called by the Renderer when a framebuffer has been set.
      Parameters:
      fb - The framebuffer that was set
      wasSwitched - If true, the framebuffer required a state switch
    • clearFrame

      public void clearFrame()
      Clears all frame-specific statistics such as objects used per frame.
    • onNewShader

      public void onNewShader()
      Called by the Renderer when it creates a new shader.
    • onNewTexture

      public void onNewTexture()
      Called by the Renderer when it creates a new texture.
    • onNewFrameBuffer

      public void onNewFrameBuffer()
      Called by the Renderer when it creates a new framebuffer.
    • onDeleteShader

      public void onDeleteShader()
      Called by the Renderer when it deletes a shader.
    • onDeleteTexture

      public void onDeleteTexture()
      Called by the Renderer when it deletes a texture.
    • onDeleteFrameBuffer

      public void onDeleteFrameBuffer()
      Called by the Renderer when it deletes a framebuffer.
    • clearMemory

      public void clearMemory()
      Called when video memory is cleared.
    • setEnabled

      public void setEnabled(boolean f)
      Enables or disables updates.
      Parameters:
      f - true to enable, false to disable
    • isEnabled

      public boolean isEnabled()
      Tests whether updates are enabled.
      Returns:
      true if enabled, otherwise false