Skip to content

Commit

Permalink
feat(system): expose Capabilities class in Main.
Browse files Browse the repository at this point in the history
Added a method to check the maximum texture size in the same time.
  • Loading branch information
zarov committed Jun 24, 2019
1 parent 9680f17 commit e9de7b6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Core/System/Capabilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import SampleTestVS from 'Renderer/Shader/SampleTestVS.glsl';
// default values
let logDepthBufferSupported = false;
let maxTexturesUnits = 8;
let maxTextureSize = 4096;

function _WebGLShader(renderer, type, string) {
const gl = renderer.context;
Expand All @@ -30,9 +31,13 @@ export default {
getMaxTextureUnitsCount() {
return maxTexturesUnits;
},
getMaxTextureSize() {
return maxTextureSize;
},
updateCapabilities(renderer) {
const gl = renderer.context;
maxTexturesUnits = gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS);
maxTextureSize = gl.getParameter(gl.MAX_TEXTURE_SIZE);

const program = gl.createProgram();
const glVertexShader = _WebGLShader(renderer, gl.VERTEX_SHADER, SampleTestVS);
Expand Down
1 change: 1 addition & 0 deletions src/Main.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export { default as CameraUtils } from 'Utils/CameraUtils';
export { default as OrientationUtils } from 'Utils/OrientationUtils';
export { default as ShaderChunk } from 'Renderer/Shader/ShaderChunk';
export { getMaxColorSamplerUnitsCount } from 'Renderer/LayeredMaterial';
export { default as Capabilities } from 'Core/System/Capabilities';

// Layers provided by default in iTowns
// A custom layer should at least implements Layer
Expand Down

0 comments on commit e9de7b6

Please sign in to comment.