diff --git a/build/RayTracingRenderer.es5.js b/build/RayTracingRenderer.es5.js index 6b98dc7..f4521af 100644 --- a/build/RayTracingRenderer.es5.js +++ b/build/RayTracingRenderer.es5.js @@ -618,16 +618,19 @@ uniforms[name] = uniform; } + var failedUnis = new Set(); + function setUniform(name, v0, v1, v2, v3) { // v0 - v4 are the values to be passed to the uniform // v0 can either be a number or an array, and v1-v3 are optional var uni = uniforms[name]; if (!uni) { - // if (!failedUnis.has(name)) { - // console.warn(`Uniform "${name}" does not exist in shader`); - // failedUnis.add(name); - // } + if (!failedUnis.has(name)) { + console.warn("Uniform \"".concat(name, "\" does not exist in shader")); + failedUnis.add(name); + } + return; } @@ -692,8 +695,7 @@ } function makeRenderPass(gl, params) { - var defines = params.defines, - fragment = params.fragment, + var fragment = params.fragment, vertex = params.vertex; var vertexCompiled = vertex instanceof WebGLShader ? vertex : makeVertexShader(gl, params); var fragmentCompiled = fragment instanceof WebGLShader ? fragment : makeFragmentShader(gl, params); @@ -1212,6 +1214,16 @@ }; } + function getFormat(gl, channels) { + var map = { + 1: gl.RED, + 2: gl.RG, + 3: gl.RGB, + 4: gl.RGBA + }; + return map[channels]; + } + function getTextureFormat(gl, channels, storage, data, gammaCorrection) { var type; var internalFormat; @@ -1252,12 +1264,7 @@ type = gl.UNSIGNED_BYTE; } - var format = { - 1: gl.RED, - 2: gl.RG, - 3: gl.RGB, - 4: gl.RGBA - }[channels]; + var format = getFormat(gl, channels); return { format: format, internalFormat: internalFormat, diff --git a/build/RayTracingRenderer.js b/build/RayTracingRenderer.js index 291fc37..f342c5b 100644 --- a/build/RayTracingRenderer.js +++ b/build/RayTracingRenderer.js @@ -275,16 +275,18 @@ uniforms[name] = uniform; } + const failedUnis = new Set(); + function setUniform(name, v0, v1, v2, v3) { // v0 - v4 are the values to be passed to the uniform // v0 can either be a number or an array, and v1-v3 are optional const uni = uniforms[name]; if (!uni) { - // if (!failedUnis.has(name)) { - // console.warn(`Uniform "${name}" does not exist in shader`); - // failedUnis.add(name); - // } + if (!failedUnis.has(name)) { + console.warn(`Uniform "${name}" does not exist in shader`); + failedUnis.add(name); + } return; } @@ -359,7 +361,6 @@ function makeRenderPass(gl, params) { const { - defines, fragment, vertex, } = params; @@ -1057,6 +1058,16 @@ vec3 getMatNormal(int materialIndex, vec2 uv, vec3 normal, vec3 dp1, vec3 dp2, v }; } + function getFormat(gl, channels) { + const map = { + 1: gl.RED, + 2: gl.RG, + 3: gl.RGB, + 4: gl.RGBA + }; + return map[channels]; + } + function getTextureFormat(gl, channels, storage, data, gammaCorrection) { let type; let internalFormat; @@ -1107,12 +1118,7 @@ vec3 getMatNormal(int materialIndex, vec2 uv, vec3 normal, vec3 dp1, vec3 dp2, v type = gl.UNSIGNED_BYTE; } - const format = { - 1: gl.RED, - 2: gl.RG, - 3: gl.RGB, - 4: gl.RGBA - }[channels]; + const format = getFormat(gl, channels); return { format, diff --git a/package-lock.json b/package-lock.json index d751ff8..5436c67 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "ray-tracing-renderer", - "version": "0.10.14", + "version": "0.10.15", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index dedd370..326518b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ray-tracing-renderer", - "version": "0.10.14", + "version": "0.10.15", "description": "A [Three.js](https://github.com/mrdoob/three.js/) renderer which utilizes path tracing to render a scene with true photorealism. The renderer supports global illumination, reflections, soft shadows, and realistic environment lighting.", "main": "build/RayTracingRenderer.js", "scripts": {