Renderer: make getLimits() public

cleanup_build_scripts
Kirill Vainer 9 years ago
parent ad129ff498
commit eecca5fa0f
  1. 33
      jme3-core/src/main/java/com/jme3/renderer/Limits.java
  2. 8
      jme3-core/src/main/java/com/jme3/renderer/Renderer.java
  3. 10
      jme3-core/src/main/java/com/jme3/renderer/opengl/GLRenderer.java
  4. 17
      jme3-core/src/main/java/com/jme3/system/NullRenderer.java

@ -32,51 +32,34 @@
package com.jme3.renderer;
/**
* <code>Limits</code> allows querying the limits of certain features in
* <code>Limits</code> allows querying the limits of certain features in
* {@link Renderer}.
* <p>
* For example, maximum texture sizes or number of samples.
*
*
* @author Kirill Vainer
*/
public enum Limits {
/**
* Maximum number of vertex texture units, or number of textures
* that can be used in the vertex shader.
* Maximum number of vertex texture units, or number of textures that can be
* used in the vertex shader.
*/
VertexTextureUnits,
/**
* Maximum number of fragment texture units, or number of textures
* that can be used in the fragment shader.
* Maximum number of fragment texture units, or number of textures that can
* be used in the fragment shader.
*/
FragmentTextureUnits,
FragmentUniforms,
FragmentUniformVectors,
VertexUniformVectors,
VertexAttributes,
FrameBufferSamples,
FrameBufferAttachments,
FrameBufferMrtAttachments,
RenderBufferSize,
TextureSize,
CubemapSize,
VertexCount,
TriangleCount,
ColorTextureSamples,
DepthTextureSamples,
VertexUniformVectors,
TextureAnisotropy,
}

@ -43,6 +43,7 @@ import com.jme3.texture.Image;
import com.jme3.texture.Texture;
import com.jme3.util.NativeObject;
import java.nio.ByteBuffer;
import java.util.EnumMap;
import java.util.EnumSet;
/**
@ -66,6 +67,13 @@ public interface Renderer {
*/
public EnumSet<Caps> getCaps();
/**
* Get the limits of the renderer.
*
* @return The limits of the renderer.
*/
public EnumMap<Limits, Integer> getLimits();
/**
* The statistics allow tracking of how data
* per frame, such as number of objects rendered, number of triangles, etc.

@ -252,18 +252,14 @@ public final class GLRenderer implements Renderer {
limits.put(Limits.FragmentTextureUnits, getInteger(GL.GL_MAX_TEXTURE_IMAGE_UNITS));
// gl.glGetInteger(GL.GL_MAX_VERTEX_UNIFORM_COMPONENTS, intBuf16);
// vertexUniforms = intBuf16.get(0);
// logger.log(Level.FINER, "Vertex Uniforms: {0}", vertexUniforms);
//
// gl.glGetInteger(GL.GL_MAX_FRAGMENT_UNIFORM_COMPONENTS, intBuf16);
// fragUniforms = intBuf16.get(0);
// logger.log(Level.FINER, "Fragment Uniforms: {0}", fragUniforms);
if (caps.contains(Caps.OpenGLES20)) {
limits.put(Limits.FragmentUniformVectors, getInteger(GL.GL_MAX_FRAGMENT_UNIFORM_VECTORS));
limits.put(Limits.VertexUniformVectors, getInteger(GL.GL_MAX_VERTEX_UNIFORM_VECTORS));
} else {
limits.put(Limits.FragmentUniformVectors, getInteger(GL.GL_MAX_FRAGMENT_UNIFORM_COMPONENTS) / 4);
limits.put(Limits.VertexUniformVectors, getInteger(GL.GL_MAX_VERTEX_UNIFORM_COMPONENTS) / 4);
}
limits.put(Limits.VertexAttributes, getInteger(GL.GL_MAX_VERTEX_ATTRIBS));
limits.put(Limits.TextureSize, getInteger(GL.GL_MAX_TEXTURE_SIZE));
limits.put(Limits.CubemapSize, getInteger(GL.GL_MAX_CUBE_MAP_TEXTURE_SIZE));

@ -39,6 +39,7 @@ import com.jme3.material.RenderState;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Matrix4f;
import com.jme3.renderer.Caps;
import com.jme3.renderer.Limits;
import com.jme3.renderer.Renderer;
import com.jme3.renderer.Statistics;
import com.jme3.scene.Mesh;
@ -48,15 +49,25 @@ import com.jme3.shader.Shader.ShaderSource;
import com.jme3.texture.FrameBuffer;
import com.jme3.texture.Image;
import com.jme3.texture.Texture;
import java.util.EnumMap;
public class NullRenderer implements Renderer {
private static final EnumSet<Caps> caps = EnumSet.allOf(Caps.class);
private static final Statistics stats = new Statistics();
private final EnumSet<Caps> caps = EnumSet.allOf(Caps.class);
private final EnumMap<Limits, Integer> limits = new EnumMap<>(Limits.class);
private final Statistics stats = new Statistics();
public void initialize() {
for (Limits limit : Limits.values()) {
limits.put(limit, Integer.MAX_VALUE);
}
}
@Override
public EnumMap<Limits, Integer> getLimits() {
return limits;
}
public EnumSet<Caps> getCaps() {
return caps;
}

Loading…
Cancel
Save