@plastic-software/three 0.183.3 → 0.183.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/three.cjs +10 -4
- package/build/three.module.js +10 -4
- package/build/three.module.min.js +1 -1
- package/package.json +1 -1
- package/src/extras/PMREMGenerator.js +1 -1
- package/src/renderers/WebGLRenderer.js +1 -1
- package/src/renderers/shaders/ShaderChunk/batching_pars_vertex.glsl.js +20 -0
- package/src/renderers/shaders/ShaderChunk/beginnormal_vertex.glsl.js +9 -1
- package/src/renderers/webgl/WebGLProgram.js +1 -0
- package/src/renderers/webgl/WebGLPrograms.js +5 -0
package/package.json
CHANGED
|
@@ -2578,7 +2578,7 @@ class WebGLRenderer {
|
|
|
2578
2578
|
if ( object.isBatchedMesh ) {
|
|
2579
2579
|
|
|
2580
2580
|
p_uniforms.setOptional( _gl, object, 'batchingTexture' );
|
|
2581
|
-
if (
|
|
2581
|
+
if ( object._matricesTexture !== null ) {
|
|
2582
2582
|
|
|
2583
2583
|
p_uniforms.setValue( _gl, 'batchingTexture', object._matricesTexture, textures );
|
|
2584
2584
|
|
|
@@ -1,4 +1,24 @@
|
|
|
1
1
|
export default /* glsl */`
|
|
2
|
+
#ifdef USE_OCTAHEDRAL_NORMALS
|
|
3
|
+
|
|
4
|
+
attribute vec2 normalOctahedral;
|
|
5
|
+
|
|
6
|
+
vec3 decodeOctahedralNormal( vec2 value ) {
|
|
7
|
+
|
|
8
|
+
vec3 normal = vec3( value, 1.0 - abs( value.x ) - abs( value.y ) );
|
|
9
|
+
|
|
10
|
+
if ( normal.z < 0.0 ) {
|
|
11
|
+
|
|
12
|
+
normal.xy = ( 1.0 - abs( normal.yx ) ) * vec2( normal.x >= 0.0 ? 1.0 : - 1.0, normal.y >= 0.0 ? 1.0 : - 1.0 );
|
|
13
|
+
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return normalize( normal );
|
|
17
|
+
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
#endif
|
|
21
|
+
|
|
2
22
|
#ifdef USE_BATCHING_MATRIX
|
|
3
23
|
#if ! defined( GL_ANGLE_multi_draw )
|
|
4
24
|
#define gl_DrawID _gl_DrawID
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
export default /* glsl */`
|
|
2
|
-
|
|
2
|
+
#ifdef USE_OCTAHEDRAL_NORMALS
|
|
3
|
+
|
|
4
|
+
vec3 objectNormal = decodeOctahedralNormal( normalOctahedral );
|
|
5
|
+
|
|
6
|
+
#else
|
|
7
|
+
|
|
8
|
+
vec3 objectNormal = vec3( normal );
|
|
9
|
+
|
|
10
|
+
#endif
|
|
3
11
|
|
|
4
12
|
#ifdef USE_TANGENT
|
|
5
13
|
|
|
@@ -483,6 +483,7 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
|
483
483
|
parameters.batching ? '#define USE_BATCHING' : '',
|
|
484
484
|
parameters.batchingMatrix ? '#define USE_BATCHING_MATRIX' : '',
|
|
485
485
|
parameters.batchingColor ? '#define USE_BATCHING_COLOR' : '',
|
|
486
|
+
parameters.normalOctahedral ? '#define USE_OCTAHEDRAL_NORMALS' : '',
|
|
486
487
|
parameters.instancing ? '#define USE_INSTANCING' : '',
|
|
487
488
|
parameters.instancingColor ? '#define USE_INSTANCING_COLOR' : '',
|
|
488
489
|
parameters.instancingMorph ? '#define USE_INSTANCING_MORPH' : '',
|
|
@@ -162,6 +162,8 @@ function WebGLPrograms( renderer, environments, extensions, capabilities, bindin
|
|
|
162
162
|
|
|
163
163
|
const HAS_ALPHAHASH = !! material.alphaHash;
|
|
164
164
|
|
|
165
|
+
const HAS_OCTAHEDRAL_NORMALS = object.geometry.attributes.normalOctahedral !== undefined;
|
|
166
|
+
|
|
165
167
|
const HAS_EXTENSIONS = !! material.extensions;
|
|
166
168
|
|
|
167
169
|
let toneMapping = NoToneMapping;
|
|
@@ -197,6 +199,7 @@ function WebGLPrograms( renderer, environments, extensions, capabilities, bindin
|
|
|
197
199
|
batching: IS_BATCHEDMESH,
|
|
198
200
|
batchingMatrix: IS_BATCHEDMESH && object._matricesTexture !== null,
|
|
199
201
|
batchingColor: IS_BATCHEDMESH && object._colorsTexture !== null,
|
|
202
|
+
normalOctahedral: HAS_OCTAHEDRAL_NORMALS,
|
|
200
203
|
instancing: IS_INSTANCEDMESH,
|
|
201
204
|
instancingColor: IS_INSTANCEDMESH && object.instanceColor !== null,
|
|
202
205
|
instancingMorph: IS_INSTANCEDMESH && object.morphTexture !== null,
|
|
@@ -538,6 +541,8 @@ function WebGLPrograms( renderer, environments, extensions, capabilities, bindin
|
|
|
538
541
|
_programLayers.enable( 21 );
|
|
539
542
|
if ( parameters.batchingMatrix )
|
|
540
543
|
_programLayers.enable( 22 );
|
|
544
|
+
if ( parameters.normalOctahedral )
|
|
545
|
+
_programLayers.enable( 23 );
|
|
541
546
|
|
|
542
547
|
array.push( _programLayers.mask );
|
|
543
548
|
_programLayers.disableAll();
|