|
2173 | 2173 |
|
2174 | 2174 | angleTo: function ( v ) {
|
2175 | 2175 |
|
2176 |
| - // assumes this and v are not the zero vector |
| 2176 | + var denominator = Math.sqrt( this.lengthSq() * v.lengthSq() ); |
2177 | 2177 |
|
2178 |
| - var theta = this.dot( v ) / ( Math.sqrt( this.lengthSq() * v.lengthSq() ) ); |
| 2178 | + if ( denominator === 0 ) { console.error( 'THREE.Vector3: angleTo() can\'t handle zero length vectors.' ); } |
| 2179 | + |
| 2180 | + var theta = this.dot( v ) / denominator; |
2179 | 2181 |
|
2180 | 2182 | // clamp, to handle numerical problems
|
2181 | 2183 |
|
|
8312 | 8314 | this.type = 'Material';
|
8313 | 8315 |
|
8314 | 8316 | this.fog = true;
|
8315 |
| - this.lights = true; |
8316 | 8317 |
|
8317 | 8318 | this.blending = NormalBlending;
|
8318 | 8319 | this.side = FrontSide;
|
|
8636 | 8637 | this.name = source.name;
|
8637 | 8638 |
|
8638 | 8639 | this.fog = source.fog;
|
8639 |
| - this.lights = source.lights; |
8640 | 8640 |
|
8641 | 8641 | this.blending = source.blending;
|
8642 | 8642 | this.side = source.side;
|
|
8785 | 8785 | this.skinning = false;
|
8786 | 8786 | this.morphTargets = false;
|
8787 | 8787 |
|
8788 |
| - this.lights = false; |
8789 |
| - |
8790 | 8788 | this.setValues( parameters );
|
8791 | 8789 |
|
8792 | 8790 | }
|
|
19319 | 19317 | this.wireframeLinewidth = 1;
|
19320 | 19318 |
|
19321 | 19319 | this.fog = false;
|
19322 |
| - this.lights = false; |
19323 | 19320 |
|
19324 | 19321 | this.setValues( parameters );
|
19325 | 19322 |
|
|
19399 | 19396 | this.displacementBias = 0;
|
19400 | 19397 |
|
19401 | 19398 | this.fog = false;
|
19402 |
| - this.lights = false; |
19403 | 19399 |
|
19404 | 19400 | this.setValues( parameters );
|
19405 | 19401 |
|
|
23059 | 23055 |
|
23060 | 23056 | var session = null;
|
23061 | 23057 |
|
| 23058 | + // var framebufferScaleFactor = 1.0; |
| 23059 | + |
23062 | 23060 | var referenceSpace = null;
|
23063 | 23061 | var referenceSpaceType = 'local-floor';
|
23064 | 23062 |
|
|
23146 | 23144 |
|
23147 | 23145 | }
|
23148 | 23146 |
|
23149 |
| - this.setFramebufferScaleFactor = function ( value ) { |
| 23147 | + this.setFramebufferScaleFactor = function ( /* value */ ) { |
| 23148 | + |
| 23149 | + // framebufferScaleFactor = value; |
23150 | 23150 |
|
23151 | 23151 | };
|
23152 | 23152 |
|
|
23173 | 23173 | session.addEventListener( 'selectend', onSessionEvent );
|
23174 | 23174 | session.addEventListener( 'end', onSessionEnd );
|
23175 | 23175 |
|
| 23176 | + // eslint-disable-next-line no-undef |
23176 | 23177 | session.updateRenderState( { baseLayer: new XRWebGLLayer( session, gl ) } );
|
23177 | 23178 |
|
23178 | 23179 | session.requestReferenceSpace( referenceSpaceType ).then( onRequestReferenceSpace );
|
|
24938 | 24939 |
|
24939 | 24940 | // store the light setup it was created for
|
24940 | 24941 |
|
| 24942 | + materialProperties.needsLights = materialNeedsLights( material ); |
24941 | 24943 | materialProperties.lightsStateVersion = lightsStateVersion;
|
24942 | 24944 |
|
24943 |
| - if ( material.lights ) { |
| 24945 | + if ( materialProperties.needsLights ) { |
24944 | 24946 |
|
24945 | 24947 | // wire up the material to this renderer's lighting state
|
24946 | 24948 |
|
|
25006 | 25008 |
|
25007 | 25009 | material.needsUpdate = true;
|
25008 | 25010 |
|
25009 |
| - } else if ( material.lights && materialProperties.lightsStateVersion !== lights.state.version ) { |
| 25011 | + } else if ( materialProperties.needsLights && ( materialProperties.lightsStateVersion !== lights.state.version ) ) { |
25010 | 25012 |
|
25011 | 25013 | material.needsUpdate = true;
|
25012 | 25014 |
|
|
25190 | 25192 | p_uniforms.setValue( _gl, 'toneMappingExposure', _this.toneMappingExposure );
|
25191 | 25193 | p_uniforms.setValue( _gl, 'toneMappingWhitePoint', _this.toneMappingWhitePoint );
|
25192 | 25194 |
|
25193 |
| - if ( material.lights ) { |
| 25195 | + if ( materialProperties.needsLights ) { |
25194 | 25196 |
|
25195 | 25197 | // the current material requires lighting info
|
25196 | 25198 |
|
|
25797 | 25799 |
|
25798 | 25800 | }
|
25799 | 25801 |
|
| 25802 | + function materialNeedsLights( material ) { |
| 25803 | + |
| 25804 | + return material.isMeshLambertMaterial || material.isMeshPhongMaterial || |
| 25805 | + material.isMeshStandardMaterial || material.isShadowMaterial || |
| 25806 | + ( material.isShaderMaterial && material.lights === true ); |
| 25807 | + |
| 25808 | + } |
| 25809 | + |
25800 | 25810 | //
|
25801 | 25811 | this.setFramebuffer = function ( value ) {
|
25802 | 25812 |
|
|
26340 | 26350 |
|
26341 | 26351 | this.sizeAttenuation = true;
|
26342 | 26352 |
|
26343 |
| - this.lights = false; |
26344 | 26353 | this.transparent = true;
|
26345 | 26354 |
|
26346 | 26355 | this.setValues( parameters );
|
|
27080 | 27089 | this.linecap = 'round';
|
27081 | 27090 | this.linejoin = 'round';
|
27082 | 27091 |
|
27083 |
| - this.lights = false; |
27084 |
| - |
27085 | 27092 | this.setValues( parameters );
|
27086 | 27093 |
|
27087 | 27094 | }
|
|
27467 | 27474 |
|
27468 | 27475 | this.morphTargets = false;
|
27469 | 27476 |
|
27470 |
| - this.lights = false; |
27471 |
| - |
27472 | 27477 | this.setValues( parameters );
|
27473 | 27478 |
|
27474 | 27479 | }
|
|
32874 | 32879 | this.wireframeLinewidth = 1;
|
32875 | 32880 |
|
32876 | 32881 | this.fog = false;
|
32877 |
| - this.lights = false; |
32878 | 32882 |
|
32879 | 32883 | this.skinning = false;
|
32880 | 32884 | this.morphTargets = false;
|
|
33101 | 33105 | this.morphTargets = false;
|
33102 | 33106 | this.morphNormals = false;
|
33103 | 33107 |
|
33104 |
| - this.lights = false; |
33105 |
| - |
33106 | 33108 | this.setValues( parameters );
|
33107 | 33109 |
|
33108 | 33110 | }
|
|
0 commit comments