Renderer: make getLimits() public
This commit is contained in:
parent
ad129ff498
commit
eecca5fa0f
@ -41,42 +41,25 @@ package com.jme3.renderer;
|
|||||||
*/
|
*/
|
||||||
public enum Limits {
|
public enum Limits {
|
||||||
/**
|
/**
|
||||||
* Maximum number of vertex texture units, or number of textures
|
* Maximum number of vertex texture units, or number of textures that can be
|
||||||
* that can be used in the vertex shader.
|
* used in the vertex shader.
|
||||||
*/
|
*/
|
||||||
VertexTextureUnits,
|
VertexTextureUnits,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Maximum number of fragment texture units, or number of textures
|
* Maximum number of fragment texture units, or number of textures that can
|
||||||
* that can be used in the fragment shader.
|
* be used in the fragment shader.
|
||||||
*/
|
*/
|
||||||
FragmentTextureUnits,
|
FragmentTextureUnits,
|
||||||
|
FragmentUniformVectors,
|
||||||
FragmentUniforms,
|
|
||||||
|
|
||||||
VertexAttributes,
|
|
||||||
|
|
||||||
FrameBufferSamples,
|
|
||||||
|
|
||||||
FrameBufferAttachments,
|
|
||||||
|
|
||||||
FrameBufferMrtAttachments,
|
|
||||||
|
|
||||||
RenderBufferSize,
|
|
||||||
|
|
||||||
TextureSize,
|
|
||||||
|
|
||||||
CubemapSize,
|
|
||||||
|
|
||||||
VertexCount,
|
|
||||||
|
|
||||||
TriangleCount,
|
|
||||||
|
|
||||||
ColorTextureSamples,
|
|
||||||
|
|
||||||
DepthTextureSamples,
|
|
||||||
|
|
||||||
VertexUniformVectors,
|
VertexUniformVectors,
|
||||||
|
VertexAttributes,
|
||||||
|
FrameBufferSamples,
|
||||||
|
FrameBufferAttachments,
|
||||||
|
FrameBufferMrtAttachments,
|
||||||
|
RenderBufferSize,
|
||||||
|
TextureSize,
|
||||||
|
CubemapSize,
|
||||||
|
ColorTextureSamples,
|
||||||
|
DepthTextureSamples,
|
||||||
TextureAnisotropy,
|
TextureAnisotropy,
|
||||||
}
|
}
|
||||||
|
@ -43,6 +43,7 @@ import com.jme3.texture.Image;
|
|||||||
import com.jme3.texture.Texture;
|
import com.jme3.texture.Texture;
|
||||||
import com.jme3.util.NativeObject;
|
import com.jme3.util.NativeObject;
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
|
import java.util.EnumMap;
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -66,6 +67,13 @@ public interface Renderer {
|
|||||||
*/
|
*/
|
||||||
public EnumSet<Caps> getCaps();
|
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
|
* The statistics allow tracking of how data
|
||||||
* per frame, such as number of objects rendered, number of triangles, etc.
|
* 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));
|
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)) {
|
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));
|
limits.put(Limits.VertexUniformVectors, getInteger(GL.GL_MAX_VERTEX_UNIFORM_VECTORS));
|
||||||
} else {
|
} 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.VertexUniformVectors, getInteger(GL.GL_MAX_VERTEX_UNIFORM_COMPONENTS) / 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
limits.put(Limits.VertexAttributes, getInteger(GL.GL_MAX_VERTEX_ATTRIBS));
|
limits.put(Limits.VertexAttributes, getInteger(GL.GL_MAX_VERTEX_ATTRIBS));
|
||||||
limits.put(Limits.TextureSize, getInteger(GL.GL_MAX_TEXTURE_SIZE));
|
limits.put(Limits.TextureSize, getInteger(GL.GL_MAX_TEXTURE_SIZE));
|
||||||
limits.put(Limits.CubemapSize, getInteger(GL.GL_MAX_CUBE_MAP_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.ColorRGBA;
|
||||||
import com.jme3.math.Matrix4f;
|
import com.jme3.math.Matrix4f;
|
||||||
import com.jme3.renderer.Caps;
|
import com.jme3.renderer.Caps;
|
||||||
|
import com.jme3.renderer.Limits;
|
||||||
import com.jme3.renderer.Renderer;
|
import com.jme3.renderer.Renderer;
|
||||||
import com.jme3.renderer.Statistics;
|
import com.jme3.renderer.Statistics;
|
||||||
import com.jme3.scene.Mesh;
|
import com.jme3.scene.Mesh;
|
||||||
@ -48,13 +49,23 @@ import com.jme3.shader.Shader.ShaderSource;
|
|||||||
import com.jme3.texture.FrameBuffer;
|
import com.jme3.texture.FrameBuffer;
|
||||||
import com.jme3.texture.Image;
|
import com.jme3.texture.Image;
|
||||||
import com.jme3.texture.Texture;
|
import com.jme3.texture.Texture;
|
||||||
|
import java.util.EnumMap;
|
||||||
|
|
||||||
public class NullRenderer implements Renderer {
|
public class NullRenderer implements Renderer {
|
||||||
|
|
||||||
private static final EnumSet<Caps> caps = EnumSet.allOf(Caps.class);
|
private final EnumSet<Caps> caps = EnumSet.allOf(Caps.class);
|
||||||
private static final Statistics stats = new Statistics();
|
private final EnumMap<Limits, Integer> limits = new EnumMap<>(Limits.class);
|
||||||
|
private final Statistics stats = new Statistics();
|
||||||
|
|
||||||
public void initialize() {
|
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() {
|
public EnumSet<Caps> getCaps() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user