language stringclasses 1 value | owner stringlengths 2 15 | repo stringlengths 2 21 | sha stringlengths 45 45 | message stringlengths 7 36.3k | path stringlengths 1 199 | patch stringlengths 15 102k | is_multipart bool 2 classes |
|---|---|---|---|---|---|---|---|
Other | mrdoob | three.js | 8aeac464bf796f15bd17b46312c3e5436b939d43.json | Remove non-breaking space from code. | examples/jsm/misc/MorphAnimMesh.d.ts | @@ -9,7 +9,7 @@ import {
export class MorphAnimMesh extends Mesh {
- constructor( geometry: BufferGeometry | Geometry, material: Material );
+ constructor( geometry: BufferGeometry | Geometry, material: Material );
mixer: AnimationMixer;
activeAction: AnimationAction | null;
| true |
Other | mrdoob | three.js | 8aeac464bf796f15bd17b46312c3e5436b939d43.json | Remove non-breaking space from code. | examples/jsm/misc/MorphBlendMesh.d.ts | @@ -7,7 +7,7 @@ import {
export class MorphBlendMesh extends Mesh {
- constructor( geometry: BufferGeometry | Geometry, material: Material );
+ constructor( geometry: BufferGeometry | Geometry, material: Material );
animationsMap: object;
animationsList: object[];
| true |
Other | mrdoob | three.js | 8aeac464bf796f15bd17b46312c3e5436b939d43.json | Remove non-breaking space from code. | examples/jsm/nodes/accessors/CameraNode.d.ts | @@ -10,10 +10,10 @@ export class CameraNode extends TempNode {
constructor( scope?: string, camera?: Camera );
scope: string;
- near: FloatNode | undefined;
- far: FloatNode | undefined;
- camera: Camera | undefined;
- updateFrame: boolean | undefined;
+ near: FloatNode | undefined;
+ far: FloatNode | undefined;
+ camera: Camera | undefined;
+ updateFrame: boolean | undefined;
nodeType: string;
setCamera( camera: Camera ): void; | true |
Other | mrdoob | three.js | 8aeac464bf796f15bd17b46312c3e5436b939d43.json | Remove non-breaking space from code. | examples/jsm/nodes/core/FunctionNode.d.ts | @@ -15,15 +15,15 @@ export class FunctionNode extends TempNode {
nodeType: string;
useKeywords: boolean;
- inputs: FunctionNodeInput[] | undefined;
- includes: object[] | undefined;
- extensions: object | undefined;
- keywords: object | undefined;
+ inputs: FunctionNodeInput[] | undefined;
+ includes: object[] | undefined;
+ extensions: object | undefined;
+ keywords: object | undefined;
getShared( builder: NodeBuilder, output: string ): boolean;
getType( builder: NodeBuilder ): string;
getInputByName( name: string ): FunctionNodeInput | undefined;
- getIncludeByName( name: string ): object | undefined;
+ getIncludeByName( name: string ): object | undefined;
parse( src: string, includes?: object[], extensions?: object, keywords?: object ): void;
copy( source: FunctionNode ): this;
| true |
Other | mrdoob | three.js | 8aeac464bf796f15bd17b46312c3e5436b939d43.json | Remove non-breaking space from code. | examples/jsm/nodes/core/Node.d.ts | @@ -6,10 +6,10 @@ export class Node {
uuid: string;
name: string;
- type: string | undefined;
+ type: string | undefined;
userData: object;
isNode: boolean;
- frameId: number | undefined;
+ frameId: number | undefined;
analyze( builder: NodeBuilder, settings?: object ): void;
analyzeAndFlow( builder: NodeBuilder, output: string, settings?: object ): object; | true |
Other | mrdoob | three.js | 8aeac464bf796f15bd17b46312c3e5436b939d43.json | Remove non-breaking space from code. | examples/jsm/nodes/core/NodeFrame.d.ts | @@ -10,9 +10,9 @@ export class NodeFrame {
constructor( time: number );
time: number;
id: number;
- delta: number | undefined;
- renderer: WebGLRenderer | undefined;
- renderTexture: Texture | undefined;
+ delta: number | undefined;
+ renderer: WebGLRenderer | undefined;
+ renderTexture: Texture | undefined;
update( delta: number ): this;
setRenderer( renderer: WebGLRenderer ): this; | true |
Other | mrdoob | three.js | 8aeac464bf796f15bd17b46312c3e5436b939d43.json | Remove non-breaking space from code. | examples/jsm/nodes/core/NodeUniform.d.ts | @@ -10,10 +10,10 @@ export interface NodeUniformParams {
export class NodeUniform {
constructor( params?: NodeUniformParams );
- name: string | undefined;
- type: string | undefined;
- node: Node | undefined;
- needsUpdate: boolean | undefined;
+ name: string | undefined;
+ type: string | undefined;
+ node: Node | undefined;
+ needsUpdate: boolean | undefined;
value: any;
} | true |
Other | mrdoob | three.js | 8aeac464bf796f15bd17b46312c3e5436b939d43.json | Remove non-breaking space from code. | examples/jsm/nodes/effects/ColorAdjustmentNode.d.ts | @@ -8,7 +8,7 @@ export class ColorAdjustmentNode extends TempNode {
constructor( rgb: Node, adjustment?: FloatNode, method?: string );
rgb: Node;
- adjustment: FloatNode | undefined;
+ adjustment: FloatNode | undefined;
method: string;
nodeType: string;
| true |
Other | mrdoob | three.js | 8aeac464bf796f15bd17b46312c3e5436b939d43.json | Remove non-breaking space from code. | examples/jsm/nodes/inputs/ColorNode.d.ts | @@ -5,7 +5,7 @@ import { NodeBuilder } from '../core/NodeBuilder';
export class ColorNode extends InputNode {
- constructor( color: Color | number | string, g?: number, b?: number );
+ constructor( color: Color | number | string, g?: number, b?: number );
value: Color;
nodeType: string; | true |
Other | mrdoob | three.js | 8aeac464bf796f15bd17b46312c3e5436b939d43.json | Remove non-breaking space from code. | examples/jsm/nodes/inputs/CubeTextureNode.d.ts | @@ -9,8 +9,8 @@ export class CubeTextureNode extends InputNode {
constructor( value: CubeTexture, uv?: Node, bias?: Node );
value: CubeTexture;
- uv: Node | undefined;
- bias: Node | undefined;
+ uv: Node | undefined;
+ bias: Node | undefined;
nodeType: string;
getTexture( builder: NodeBuilder, output: string ): string; | true |
Other | mrdoob | three.js | 8aeac464bf796f15bd17b46312c3e5436b939d43.json | Remove non-breaking space from code. | examples/jsm/nodes/inputs/Vector2Node.d.ts | @@ -5,7 +5,7 @@ import { NodeBuilder } from '../core/NodeBuilder';
export class Vector2Node extends InputNode {
- constructor( x: Vector2 | number, y?: number );
+ constructor( x: Vector2 | number, y?: number );
value: Vector2;
nodeType: string; | true |
Other | mrdoob | three.js | 8aeac464bf796f15bd17b46312c3e5436b939d43.json | Remove non-breaking space from code. | examples/jsm/nodes/inputs/Vector3Node.d.ts | @@ -5,7 +5,7 @@ import { NodeBuilder } from '../core/NodeBuilder';
export class Vector3Node extends InputNode {
- constructor( x: Vector3 | number, y?: number, z?: number );
+ constructor( x: Vector3 | number, y?: number, z?: number );
value: Vector3;
nodeType: string; | true |
Other | mrdoob | three.js | 8aeac464bf796f15bd17b46312c3e5436b939d43.json | Remove non-breaking space from code. | examples/jsm/nodes/inputs/Vector4Node.d.ts | @@ -5,7 +5,7 @@ import { NodeBuilder } from '../core/NodeBuilder';
export class Vector4Node extends InputNode {
- constructor( x: Vector4 | number, y?: number, z?: number, w?: number );
+ constructor( x: Vector4 | number, y?: number, z?: number, w?: number );
value: Vector4;
nodeType: string; | true |
Other | mrdoob | three.js | 8aeac464bf796f15bd17b46312c3e5436b939d43.json | Remove non-breaking space from code. | examples/jsm/nodes/math/MathNode.d.ts | @@ -4,11 +4,11 @@ import { Node } from '../core/Node';
export class MathNode extends TempNode {
- constructor( a: Node, bOrMethod: Node | string, cOrMethod?: Node | string, method?: string );
+ constructor( a: Node, bOrMethod: Node | string, cOrMethod?: Node | string, method?: string );
a: Node;
b: Node | string | undefined;
- c: Node | string | undefined;
+ c: Node | string | undefined;
method: string;
nodeType: string;
| true |
Other | mrdoob | three.js | 8aeac464bf796f15bd17b46312c3e5436b939d43.json | Remove non-breaking space from code. | examples/jsm/nodes/utils/BypassNode.d.ts | @@ -5,7 +5,7 @@ export class BypassNode extends Node {
constructor( code: Node, value?: Node );
code: Node;
- value: Node | undefined;
+ value: Node | undefined;
nodeType: string;
copy( source: BypassNode ): this; | true |
Other | mrdoob | three.js | 8aeac464bf796f15bd17b46312c3e5436b939d43.json | Remove non-breaking space from code. | examples/jsm/nodes/utils/ColorSpaceNode.d.ts | @@ -7,7 +7,7 @@ export class ColorSpaceNode extends TempNode {
constructor( input: Node, method?: string );
input: Node;
- method: string | undefined;
+ method: string | undefined;
nodeType: string;
fromEncoding( encoding: number ); | true |
Other | mrdoob | three.js | 8aeac464bf796f15bd17b46312c3e5436b939d43.json | Remove non-breaking space from code. | examples/jsm/nodes/utils/JoinNode.d.ts | @@ -6,8 +6,8 @@ export class JoinNode extends TempNode {
x: Node;
y: Node;
- z: Node | undefined;
- w: Node | undefined;
+ z: Node | undefined;
+ w: Node | undefined;
nodeType: string;
getNumElements(): number; | true |
Other | mrdoob | three.js | 8aeac464bf796f15bd17b46312c3e5436b939d43.json | Remove non-breaking space from code. | examples/jsm/nodes/utils/VelocityNode.d.ts | @@ -17,10 +17,10 @@ export class VelocityNode extends Vector3Node {
constructor( target: Object3D, params?: VelocityNodeParams );
velocity: Vector3;
- moment: Vector3 | undefined;
- speed: Vector3 | undefined;
- springVelocity: Vector3 | undefined;
- lastVelocity: Vector3 | undefined;
+ moment: Vector3 | undefined;
+ speed: Vector3 | undefined;
+ springVelocity: Vector3 | undefined;
+ lastVelocity: Vector3 | undefined;
nodeType: string;
| true |
Other | mrdoob | three.js | 8aeac464bf796f15bd17b46312c3e5436b939d43.json | Remove non-breaking space from code. | examples/jsm/webxr/VRButton.d.ts | @@ -2,10 +2,10 @@ import {
WebGLRenderer
} from '../../../src/Three';
-export interface WebXROptions {
+export interface WebXROptions {
referenceSpaceType: string;
}
export namespace VRButton {
- export function createButton( renderer: WebGLRenderer, options?: WebXROptions ): HTMLElement;
+ export function createButton( renderer: WebGLRenderer, options?: WebXROptions ): HTMLElement;
} | true |
Other | mrdoob | three.js | 8aeac464bf796f15bd17b46312c3e5436b939d43.json | Remove non-breaking space from code. | examples/webgl_shading_physical.html | @@ -68,7 +68,7 @@
// CUBE CAMERA
- cubeCamera = new THREE.CubeCamera( 1, 10000, 128, { encoding: THREE.sRGBEncoding } );
+ cubeCamera = new THREE.CubeCamera( 1, 10000, 128, { encoding: THREE.sRGBEncoding } );
// TEXTURES
var textureLoader = new THREE.TextureLoader(); | true |
Other | mrdoob | three.js | 8aeac464bf796f15bd17b46312c3e5436b939d43.json | Remove non-breaking space from code. | src/audio/Audio.d.ts | @@ -19,7 +19,7 @@ export class Audio extends Object3D {
loopStart: number;
loopEnd: number;
offset: number;
- duration: number | undefined;
+ duration: number | undefined;
playbackRate: number;
isPlaying: boolean;
hasPlaybackControl: boolean; | true |
Other | mrdoob | three.js | 8aeac464bf796f15bd17b46312c3e5436b939d43.json | Remove non-breaking space from code. | src/materials/MeshDepthMaterial.d.ts | @@ -4,9 +4,9 @@ import { Texture } from './../textures/Texture';
export interface MeshDepthMaterialParameters extends MaterialParameters {
map?: Texture | null;
- alphaMap?: Texture | null;
+ alphaMap?: Texture | null;
depthPacking?: DepthPackingStrategies;
- displacementMap?: Texture | null;
+ displacementMap?: Texture | null;
displacementScale?: number;
displacementBias?: number;
wireframe?: boolean;
@@ -18,7 +18,7 @@ export class MeshDepthMaterial extends Material {
constructor( parameters?: MeshDepthMaterialParameters );
map: Texture | null;
- alphaMap: Texture | null;
+ alphaMap: Texture | null;
depthPacking: DepthPackingStrategies;
displacementMap: Texture | null;
displacementScale: number; | true |
Other | mrdoob | three.js | 8aeac464bf796f15bd17b46312c3e5436b939d43.json | Remove non-breaking space from code. | src/materials/MeshDistanceMaterial.d.ts | @@ -4,8 +4,8 @@ import { Texture } from './../textures/Texture';
export interface MeshDistanceMaterialParameters extends MaterialParameters {
map?: Texture | null;
- alphaMap?: Texture | null;
- displacementMap?: Texture | null;
+ alphaMap?: Texture | null;
+ displacementMap?: Texture | null;
displacementScale?: number;
displacementBias?: number;
farDistance?: number;
@@ -18,7 +18,7 @@ export class MeshDistanceMaterial extends Material {
constructor( parameters?: MeshDistanceMaterialParameters );
map: Texture | null;
- alphaMap: Texture | null;
+ alphaMap: Texture | null;
displacementMap: Texture | null;
displacementScale: number;
displacementBias: number; | true |
Other | mrdoob | three.js | 8aeac464bf796f15bd17b46312c3e5436b939d43.json | Remove non-breaking space from code. | src/materials/MeshLambertMaterial.d.ts | @@ -7,15 +7,15 @@ export interface MeshLambertMaterialParameters extends MaterialParameters {
color?: Color | string | number;
emissive?: Color | string | number;
emissiveIntensity?: number;
- emissiveMap?: Texture | null;
- map?: Texture | null;
- lightMap?: Texture | null;
+ emissiveMap?: Texture | null;
+ map?: Texture | null;
+ lightMap?: Texture | null;
lightMapIntensity?: number;
- aoMap?: Texture | null;
+ aoMap?: Texture | null;
aoMapIntensity?: number;
- specularMap?: Texture | null;
- alphaMap?: Texture | null;
- envMap?: Texture | null;
+ specularMap?: Texture | null;
+ alphaMap?: Texture | null;
+ envMap?: Texture | null;
combine?: Combine;
reflectivity?: number;
refractionRatio?: number; | true |
Other | mrdoob | three.js | 8aeac464bf796f15bd17b46312c3e5436b939d43.json | Remove non-breaking space from code. | src/materials/MeshMatcapMaterial.d.ts | @@ -7,17 +7,17 @@ import { NormalMapTypes } from '../constants';
export interface MeshMatcapMaterialParameters extends MaterialParameters {
color?: Color | string | number;
- matcap?: Texture | null;
- map?: Texture | null;
- bumpMap?: Texture | null;
+ matcap?: Texture | null;
+ map?: Texture | null;
+ bumpMap?: Texture | null;
bumpScale?: number;
- normalMap?: Texture | null;
+ normalMap?: Texture | null;
normalMapType?: NormalMapTypes;
normalScale?: Vector2;
- displacementMap?: Texture | null;
+ displacementMap?: Texture | null;
displacementScale?: number;
displacementBias?: number;
- alphaMap?: Texture | null;
+ alphaMap?: Texture | null;
skinning?: boolean;
morphTargets?: boolean;
morphNormals?: boolean; | true |
Other | mrdoob | three.js | 8aeac464bf796f15bd17b46312c3e5436b939d43.json | Remove non-breaking space from code. | src/materials/MeshNormalMaterial.d.ts | @@ -5,12 +5,12 @@ import { NormalMapTypes } from '../constants';
export interface MeshNormalMaterialParameters extends MaterialParameters {
- bumpMap?: Texture | null;
+ bumpMap?: Texture | null;
bumpScale?: number;
- normalMap?: Texture | null;
+ normalMap?: Texture | null;
normalMapType?: NormalMapTypes;
normalScale?: Vector2;
- displacementMap?: Texture | null;
+ displacementMap?: Texture | null;
displacementScale?: number;
displacementBias?: number;
wireframe?: boolean; | true |
Other | mrdoob | three.js | 8aeac464bf796f15bd17b46312c3e5436b939d43.json | Remove non-breaking space from code. | src/materials/MeshPhongMaterial.d.ts | @@ -10,25 +10,25 @@ export interface MeshPhongMaterialParameters extends MaterialParameters {
specular?: Color | string | number;
shininess?: number;
opacity?: number;
- map?: Texture | null;
- lightMap?: Texture | null;
+ map?: Texture | null;
+ lightMap?: Texture | null;
lightMapIntensity?: number;
- aoMap?: Texture | null;
+ aoMap?: Texture | null;
aoMapIntensity?: number;
emissive?: Color | string | number;
emissiveIntensity?: number;
- emissiveMap?: Texture | null;
- bumpMap?: Texture | null;
+ emissiveMap?: Texture | null;
+ bumpMap?: Texture | null;
bumpScale?: number;
- normalMap?: Texture | null;
+ normalMap?: Texture | null;
normalMapType?: NormalMapTypes;
normalScale?: Vector2;
- displacementMap?: Texture | null;
+ displacementMap?: Texture | null;
displacementScale?: number;
displacementBias?: number;
- specularMap?: Texture | null;
- alphaMap?: Texture | null;
- envMap?: Texture | null;
+ specularMap?: Texture | null;
+ alphaMap?: Texture | null;
+ envMap?: Texture | null;
combine?: Combine;
reflectivity?: number;
refractionRatio?: number; | true |
Other | mrdoob | three.js | 8aeac464bf796f15bd17b46312c3e5436b939d43.json | Remove non-breaking space from code. | src/materials/MeshPhysicalMaterial.d.ts | @@ -15,7 +15,7 @@ export interface MeshPhysicalMaterialParameters
sheen?: Color;
clearcoatNormalScale?: Vector2;
- clearcoatNormalMap?: Texture | null;
+ clearcoatNormalMap?: Texture | null;
}
export class MeshPhysicalMaterial extends MeshStandardMaterial { | true |
Other | mrdoob | three.js | 8aeac464bf796f15bd17b46312c3e5436b939d43.json | Remove non-breaking space from code. | src/materials/MeshStandardMaterial.d.ts | @@ -8,26 +8,26 @@ export interface MeshStandardMaterialParameters extends MaterialParameters {
color?: Color | string | number;
roughness?: number;
metalness?: number;
- map?: Texture | null;
- lightMap?: Texture | null;
+ map?: Texture | null;
+ lightMap?: Texture | null;
lightMapIntensity?: number;
- aoMap?: Texture | null;
+ aoMap?: Texture | null;
aoMapIntensity?: number;
emissive?: Color | string | number;
emissiveIntensity?: number;
- emissiveMap?: Texture | null;
- bumpMap?: Texture | null;
+ emissiveMap?: Texture | null;
+ bumpMap?: Texture | null;
bumpScale?: number;
- normalMap?: Texture | null;
+ normalMap?: Texture | null;
normalMapType?: NormalMapTypes;
normalScale?: Vector2;
- displacementMap?: Texture | null;
+ displacementMap?: Texture | null;
displacementScale?: number;
displacementBias?: number;
- roughnessMap?: Texture | null;
- metalnessMap?: Texture | null;
- alphaMap?: Texture | null;
- envMap?: Texture | null;
+ roughnessMap?: Texture | null;
+ metalnessMap?: Texture | null;
+ alphaMap?: Texture | null;
+ envMap?: Texture | null;
envMapIntensity?: number;
refractionRatio?: number;
wireframe?: boolean; | true |
Other | mrdoob | three.js | 8aeac464bf796f15bd17b46312c3e5436b939d43.json | Remove non-breaking space from code. | src/materials/MeshToonMaterial.d.ts | @@ -10,25 +10,25 @@ export interface MeshToonMaterialParameters extends MaterialParameters {
specular?: Color | string | number;
shininess?: number;
opacity?: number;
- gradientMap?: Texture | null;
- map?: Texture | null;
- lightMap?: Texture | null;
+ gradientMap?: Texture | null;
+ map?: Texture | null;
+ lightMap?: Texture | null;
lightMapIntensity?: number;
- aoMap?: Texture | null;
+ aoMap?: Texture | null;
aoMapIntensity?: number;
emissive?: Color | string | number;
emissiveIntensity?: number;
- emissiveMap?: Texture | null;
- bumpMap?: Texture | null;
+ emissiveMap?: Texture | null;
+ bumpMap?: Texture | null;
bumpScale?: number;
- normalMap?: Texture | null;
+ normalMap?: Texture | null;
normalMapType?: NormalMapTypes;
normalScale?: Vector2;
- displacementMap?: Texture | null;
+ displacementMap?: Texture | null;
displacementScale?: number;
displacementBias?: number;
- specularMap?: Texture | null;
- alphaMap?: Texture | null;
+ specularMap?: Texture | null;
+ alphaMap?: Texture | null;
wireframe?: boolean;
wireframeLinewidth?: number;
wireframeLinecap?: string;
@@ -45,7 +45,7 @@ export class MeshToonMaterial extends Material {
color: Color;
specular: Color;
shininess: number;
- gradientMap: Texture | null;
+ gradientMap: Texture | null;
map: Texture | null;
lightMap: Texture | null;
lightMapIntensity: number; | true |
Other | mrdoob | three.js | 8aeac464bf796f15bd17b46312c3e5436b939d43.json | Remove non-breaking space from code. | src/materials/PointsMaterial.d.ts | @@ -26,7 +26,7 @@ export class MultiMaterial extends Material {
export interface PointsMaterialParameters extends MaterialParameters {
color?: Color | string | number;
map?: Texture | null;
- alphaMap?: Texture | null;
+ alphaMap?: Texture | null;
size?: number;
sizeAttenuation?: boolean;
} | true |
Other | mrdoob | three.js | 8aeac464bf796f15bd17b46312c3e5436b939d43.json | Remove non-breaking space from code. | src/materials/SpriteMaterial.d.ts | @@ -4,8 +4,8 @@ import { MaterialParameters, Material } from './Material';
export interface SpriteMaterialParameters extends MaterialParameters {
color?: Color | string | number;
- map?: Texture | null;
- alphaMap?: Texture | null;
+ map?: Texture | null;
+ alphaMap?: Texture | null;
rotation?: number;
sizeAttenuation?: boolean;
} | true |
Other | mrdoob | three.js | 14d2c6f8b07e3ca0b3897f6926e04ccdf99007a3.json | Fix MaterialCreator.setCrossOrigin d.ts signature | examples/jsm/loaders/MTLLoader.d.ts | @@ -87,7 +87,7 @@ export namespace MTLLoader {
wrap : Wrapping;
crossOrigin : string;
- setCrossOrigin( value: string ) : void;
+ setCrossOrigin( value: string ) : this;
setManager( value: LoadingManager ) : void;
setMaterials( materialsInfo: {[key: string]: MaterialInfo} ) : void;
convert( materialsInfo: {[key: string]: MaterialInfo} ) : {[key: string]: MaterialInfo}; | false |
Other | mrdoob | three.js | a9f43b83b9ac50b5eea047fa0c2359f79ef9c2a3.json | Improve readability of computeTangents() | examples/js/utils/BufferGeometryUtils.js | @@ -67,42 +67,20 @@ THREE.BufferGeometryUtils = {
uvB.fromArray( uvs, b * 2 );
uvC.fromArray( uvs, c * 2 );
- var x1 = vB.x - vA.x;
- var x2 = vC.x - vA.x;
+ vB.sub( vA );
+ vC.sub( vA );
- var y1 = vB.y - vA.y;
- var y2 = vC.y - vA.y;
+ uvB.sub( uvA );
+ uvC.sub( uvA );
- var z1 = vB.z - vA.z;
- var z2 = vC.z - vA.z;
+ var r = 1.0 / ( uvB.x * uvC.y - uvC.x * uvB.y );
- var s1 = uvB.x - uvA.x;
- var s2 = uvC.x - uvA.x;
+ // silently ignore degenerate uv triangles having coincident or colinear vertices
- var t1 = uvB.y - uvA.y;
- var t2 = uvC.y - uvA.y;
+ if ( ! isFinite( r ) ) return;
- var r = 1.0 / ( s1 * t2 - s2 * t1 );
-
- sdir.set(
- ( t2 * x1 - t1 * x2 ) * r,
- ( t2 * y1 - t1 * y2 ) * r,
- ( t2 * z1 - t1 * z2 ) * r
- );
-
- tdir.set(
- ( s1 * x2 - s2 * x1 ) * r,
- ( s1 * y2 - s2 * y1 ) * r,
- ( s1 * z2 - s2 * z1 ) * r
- );
-
- // silently ignore degenerate uvs/triangles that yield NaN/Infinite intermediary values
- if ( ! ( isFinite( sdir.x ) && isFinite( sdir.y ) && isFinite( sdir.z ) &&
- isFinite( tdir.x ) && isFinite( tdir.y ) && isFinite( tdir.z ) ) ) {
-
- return;
-
- }
+ sdir.copy( vB ).multiplyScalar( uvC.y ).addScaledVector( vC, - uvB.y ).multiplyScalar( r );
+ tdir.copy( vC ).multiplyScalar( uvB.x ).addScaledVector( vB, - uvC.x ).multiplyScalar( r );
tan1[ a ].add( sdir );
tan1[ b ].add( sdir ); | true |
Other | mrdoob | three.js | a9f43b83b9ac50b5eea047fa0c2359f79ef9c2a3.json | Improve readability of computeTangents() | examples/jsm/utils/BufferGeometryUtils.js | @@ -79,42 +79,20 @@ var BufferGeometryUtils = {
uvB.fromArray( uvs, b * 2 );
uvC.fromArray( uvs, c * 2 );
- var x1 = vB.x - vA.x;
- var x2 = vC.x - vA.x;
+ vB.sub( vA );
+ vC.sub( vA );
- var y1 = vB.y - vA.y;
- var y2 = vC.y - vA.y;
+ uvB.sub( uvA );
+ uvC.sub( uvA );
- var z1 = vB.z - vA.z;
- var z2 = vC.z - vA.z;
+ var r = 1.0 / ( uvB.x * uvC.y - uvC.x * uvB.y );
- var s1 = uvB.x - uvA.x;
- var s2 = uvC.x - uvA.x;
+ // silently ignore degenerate uv triangles having coincident or colinear vertices
- var t1 = uvB.y - uvA.y;
- var t2 = uvC.y - uvA.y;
+ if ( ! isFinite( r ) ) return;
- var r = 1.0 / ( s1 * t2 - s2 * t1 );
-
- sdir.set(
- ( t2 * x1 - t1 * x2 ) * r,
- ( t2 * y1 - t1 * y2 ) * r,
- ( t2 * z1 - t1 * z2 ) * r
- );
-
- tdir.set(
- ( s1 * x2 - s2 * x1 ) * r,
- ( s1 * y2 - s2 * y1 ) * r,
- ( s1 * z2 - s2 * z1 ) * r
- );
-
- // silently ignore degenerate uvs/triangles that yield NaN/Infinite intermediary values
- if ( ! ( isFinite( sdir.x ) && isFinite( sdir.y ) && isFinite( sdir.z ) &&
- isFinite( tdir.x ) && isFinite( tdir.y ) && isFinite( tdir.z ) ) ) {
-
- return;
-
- }
+ sdir.copy( vB ).multiplyScalar( uvC.y ).addScaledVector( vC, - uvB.y ).multiplyScalar( r );
+ tdir.copy( vC ).multiplyScalar( uvB.x ).addScaledVector( vB, - uvC.x ).multiplyScalar( r );
tan1[ a ].add( sdir );
tan1[ b ].add( sdir ); | true |
Other | mrdoob | three.js | c6af18d61f4cec13b40d07a7170d2ec8c170e160.json | Replace non-breaking with regular space | src/renderers/webgl/WebGLProgram.js | @@ -120,7 +120,7 @@ function generateExtensions( extensions, parameters, rendererExtensions ) {
extensions = extensions || {};
var chunks = [
- ( extensions.derivatives || parameters.envMapCubeUV || parameters.bumpMap || parameters.tangentSpaceNormalMap || parameters.clearcoatNormalMap || parameters.flatShading || parameters.shaderID === 'physical' ) ? '#extension GL_OES_standard_derivatives : enable' : '',
+ ( extensions.derivatives || parameters.envMapCubeUV || parameters.bumpMap || parameters.tangentSpaceNormalMap || parameters.clearcoatNormalMap || parameters.flatShading || parameters.shaderID === 'physical' ) ? '#extension GL_OES_standard_derivatives : enable' : '',
( extensions.fragDepth || parameters.logarithmicDepthBuffer ) && rendererExtensions.get( 'EXT_frag_depth' ) ? '#extension GL_EXT_frag_depth : enable' : '',
( extensions.drawBuffers ) && rendererExtensions.get( 'WEBGL_draw_buffers' ) ? '#extension GL_EXT_draw_buffers : require' : '',
( extensions.shaderTextureLOD || parameters.envMap ) && rendererExtensions.get( 'EXT_shader_texture_lod' ) ? '#extension GL_EXT_shader_texture_lod : enable' : '' | false |
Other | mrdoob | three.js | 447d9dd95897527b504ace0b173056a30f3fe59e.json | Remove extra scene parameter from jsm version | examples/jsm/renderers/CSS2DRenderer.js | @@ -109,7 +109,7 @@ var CSS2DRenderer = function () {
for ( var i = 0, l = object.children.length; i < l; i ++ ) {
- renderObject( object.children[ i ], scene, camera );
+ renderObject( object.children[ i ], camera );
}
| false |
Other | mrdoob | three.js | 8d44d2619dd4fe319ab371643e5b4ddd518beded.json | Move changes from jsm to js version | examples/js/renderers/CSS2DRenderer.js | @@ -32,6 +32,8 @@ THREE.CSS2DObject.prototype.constructor = THREE.CSS2DObject;
THREE.CSS2DRenderer = function () {
+ var _this = this;
+
var _width, _height;
var _widthHalf, _heightHalf;
@@ -70,10 +72,12 @@ THREE.CSS2DRenderer = function () {
};
- var renderObject = function ( object, camera ) {
+ var renderObject = function ( object, scene, camera ) {
if ( object instanceof THREE.CSS2DObject ) {
+ object.onBeforeRender( _this, scene, camera );
+
vector.setFromMatrixPosition( object.matrixWorld );
vector.applyMatrix4( viewProjectionMatrix );
@@ -99,6 +103,8 @@ THREE.CSS2DRenderer = function () {
}
+ object.onAfterRender( _this, scene, camera );
+
}
for ( var i = 0, l = object.children.length; i < l; i ++ ) {
@@ -168,7 +174,7 @@ THREE.CSS2DRenderer = function () {
viewMatrix.copy( camera.matrixWorldInverse );
viewProjectionMatrix.multiplyMatrices( camera.projectionMatrix, viewMatrix );
- renderObject( scene, camera );
+ renderObject( scene, scene, camera );
zOrder( scene );
}; | true |
Other | mrdoob | three.js | 8d44d2619dd4fe319ab371643e5b4ddd518beded.json | Move changes from jsm to js version | examples/jsm/renderers/CSS2DRenderer.js | @@ -38,8 +38,6 @@ CSS2DObject.prototype.constructor = CSS2DObject;
var CSS2DRenderer = function () {
- var _this = this;
-
var _width, _height;
var _widthHalf, _heightHalf;
@@ -78,12 +76,10 @@ var CSS2DRenderer = function () {
};
- var renderObject = function ( object, scene, camera ) {
+ var renderObject = function ( object, camera ) {
if ( object instanceof CSS2DObject ) {
- object.onBeforeRender( _this, scene, camera );
-
vector.setFromMatrixPosition( object.matrixWorld );
vector.applyMatrix4( viewProjectionMatrix );
@@ -109,8 +105,6 @@ var CSS2DRenderer = function () {
}
- object.onAfterRender( _this, scene, camera );
-
}
for ( var i = 0, l = object.children.length; i < l; i ++ ) {
@@ -180,7 +174,7 @@ var CSS2DRenderer = function () {
viewMatrix.copy( camera.matrixWorldInverse );
viewProjectionMatrix.multiplyMatrices( camera.projectionMatrix, viewMatrix );
- renderObject( scene, scene, camera );
+ renderObject( scene, camera );
zOrder( scene );
}; | true |
Other | mrdoob | three.js | e66acabfd373d8d296f2bfac05d96112da021c72.json | Remove unused numXxxx members of WebGLLights | src/renderers/webgl/WebGLLights.d.ts | @@ -30,10 +30,6 @@ export class WebGLLights {
pointShadowMap: Array<any>;
pointShadowMatrix: Array<any>;
hemi: Array<any>;
-
- numDirectionalShadows: number;
- numPointShadows: number;
- numSpotShadows: number;
};
get( light: any ): any; | true |
Other | mrdoob | three.js | e66acabfd373d8d296f2bfac05d96112da021c72.json | Remove unused numXxxx members of WebGLLights | src/renderers/webgl/WebGLLights.js | @@ -142,10 +142,6 @@ function WebGLLights() {
pointShadowMatrix: [],
hemi: [],
- numDirectionalShadows: - 1,
- numPointShadows: - 1,
- numSpotShadows: - 1
-
};
for ( var i = 0; i < 9; i ++ ) state.probe.push( new Vector3() ); | true |
Other | mrdoob | three.js | 90b50ac1d846cd06ee41a904039203178e9a5d37.json | Use source files instead of bundle | examples/js/libs/three-csm.module.js | @@ -1,531 +0,0 @@
-import { Vector3, ShaderChunk, DirectionalLight, Vector2, LineBasicMaterial, Object3D, Geometry, Line } from '../../../build/three.module.js';
-
-class FrustumVertex {
- constructor(x, y, z) {
- this.x = x || 0;
- this.y = y || 0;
- this.z = z || 0;
- }
-
- fromLerp(v1, v2, amount) {
- this.x = (1 - amount) * v1.x + amount * v2.x;
- this.y = (1 - amount) * v1.y + amount * v2.y;
- this.z = (1 - amount) * v1.z + amount * v2.z;
-
- return this;
- }
-}
-
-function toRad(degrees) {
- return degrees * Math.PI / 180;
-}
-
-class Frustum {
- constructor(data) {
- data = data || {};
-
- this.fov = data.fov || 70;
- this.near = data.near || 0.1;
- this.far = data.far || 1000;
- this.aspect = data.aspect || 1;
-
- this.vertices = {
- near: [],
- far: []
- };
- }
-
- getViewSpaceVertices() {
- this.nearPlaneY = this.near * Math.tan(toRad(this.fov / 2));
- this.nearPlaneX = this.aspect * this.nearPlaneY;
-
- this.farPlaneY = this.far * Math.tan(toRad(this.fov / 2));
- this.farPlaneX = this.aspect * this.farPlaneY;
-
- // 3 --- 0 vertices.near/far order
- // | |
- // 2 --- 1
-
- this.vertices.near.push(
- new FrustumVertex(this.nearPlaneX, this.nearPlaneY, -this.near),
- new FrustumVertex(this.nearPlaneX, -this.nearPlaneY, -this.near),
- new FrustumVertex(-this.nearPlaneX, -this.nearPlaneY, -this.near),
- new FrustumVertex(-this.nearPlaneX, this.nearPlaneY, -this.near)
- );
-
- this.vertices.far.push(
- new FrustumVertex(this.farPlaneX, this.farPlaneY, -this.far),
- new FrustumVertex(this.farPlaneX, -this.farPlaneY, -this.far),
- new FrustumVertex(-this.farPlaneX, -this.farPlaneY, -this.far),
- new FrustumVertex(-this.farPlaneX, this.farPlaneY, -this.far)
- );
-
- return this.vertices;
- }
-
- split(breaks) {
- const result = [];
-
- for(let i = 0; i < breaks.length; i++) {
- const cascade = new Frustum();
-
- if(i === 0) {
- cascade.vertices.near = this.vertices.near;
- } else {
- for(let j = 0; j < 4; j++) {
- cascade.vertices.near.push(new FrustumVertex().fromLerp(this.vertices.near[j], this.vertices.far[j], breaks[i - 1]));
- }
- }
-
- if(i === breaks - 1) {
- cascade.vertices.far = this.vertices.far;
- } else {
- for(let j = 0; j < 4; j++) {
- cascade.vertices.far.push(new FrustumVertex().fromLerp(this.vertices.near[j], this.vertices.far[j], breaks[i]));
- }
- }
-
- result.push(cascade);
- }
-
- return result;
- }
-
- toSpace(cameraMatrix) {
- const result = new Frustum();
- const point = new Vector3();
-
- for(var i = 0; i < 4; i++) {
- point.set(this.vertices.near[i].x, this.vertices.near[i].y, this.vertices.near[i].z);
- point.applyMatrix4(cameraMatrix);
- result.vertices.near.push(new FrustumVertex(point.x, point.y, point.z));
-
- point.set(this.vertices.far[i].x, this.vertices.far[i].y, this.vertices.far[i].z);
- point.applyMatrix4(cameraMatrix);
- result.vertices.far.push(new FrustumVertex(point.x, point.y, point.z));
- }
-
- return result;
- }
-}
-
-class FrustumBoundingBox {
- constructor() {
- this.min = {
- x: 0,
- y: 0,
- z: 0
- };
- this.max = {
- x: 0,
- y: 0,
- z: 0
- };
- }
-
- fromFrustum(frustum) {
- const vertices = [];
-
- for(let i = 0; i < 4; i++) {
- vertices.push(frustum.vertices.near[i]);
- vertices.push(frustum.vertices.far[i]);
- }
-
- this.min = {
- x: vertices[0].x,
- y: vertices[0].y,
- z: vertices[0].z
- };
- this.max = {
- x: vertices[0].x,
- y: vertices[0].y,
- z: vertices[0].z
- };
-
- for(let i = 1; i < 8; i++) {
- this.min.x = Math.min(this.min.x, vertices[i].x);
- this.min.y = Math.min(this.min.y, vertices[i].y);
- this.min.z = Math.min(this.min.z, vertices[i].z);
- this.max.x = Math.max(this.max.x, vertices[i].x);
- this.max.y = Math.max(this.max.y, vertices[i].y);
- this.max.z = Math.max(this.max.z, vertices[i].z);
- }
-
- return this;
- }
-
- getSize() {
- this.size = {
- x: this.max.x - this.min.x,
- y: this.max.y - this.min.y,
- z: this.max.z - this.min.z
- };
-
- return this.size;
- }
-
- getCenter(margin) {
- this.center = {
- x: (this.max.x + this.min.x) / 2,
- y: (this.max.y + this.min.y) / 2,
- z: this.max.z + margin
- };
-
- return this.center;
- }
-}
-
-var Shader = {
- lights_fragment_begin: `
-GeometricContext geometry;
-geometry.position = - vViewPosition;
-geometry.normal = normal;
-geometry.viewDir = normalize( vViewPosition );
-#ifdef CLEARCOAT
- geometry.clearcoatNormal = clearcoatNormal;
-#endif
-IncidentLight directLight;
-#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )
- PointLight pointLight;
- #pragma unroll_loop
- for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
- pointLight = pointLights[ i ];
- getPointDirectLightIrradiance( pointLight, geometry, directLight );
- #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )
- directLight.color *= all( bvec3( pointLight.shadow, directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
- #endif
- RE_Direct( directLight, geometry, material, reflectedLight );
- }
-#endif
-#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )
- SpotLight spotLight;
- #pragma unroll_loop
- for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
- spotLight = spotLights[ i ];
- getSpotDirectLightIrradiance( spotLight, geometry, directLight );
- #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
- directLight.color *= all( bvec3( spotLight.shadow, directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;
- #endif
- RE_Direct( directLight, geometry, material, reflectedLight );
- }
-#endif
-#if ( NUM_DIR_LIGHTS > 0) && defined( RE_Direct ) && defined( USE_CSM ) && defined( CSM_CASCADES )
- DirectionalLight directionalLight;
- float linearDepth = (vViewPosition.z) / (shadowFar - cameraNear);
-
- #pragma unroll_loop
- for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
- directionalLight = directionalLights[ i ];
- getDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );
- #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
- if(linearDepth >= CSM_cascades[UNROLLED_LOOP_INDEX].x && linearDepth < CSM_cascades[UNROLLED_LOOP_INDEX].y) directLight.color *= all( bvec3( directionalLight.shadow, directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
- #endif
- if(linearDepth >= CSM_cascades[UNROLLED_LOOP_INDEX].x && (linearDepth < CSM_cascades[UNROLLED_LOOP_INDEX].y || UNROLLED_LOOP_INDEX == CSM_CASCADES - 1)) RE_Direct( directLight, geometry, material, reflectedLight );
- }
-#endif
-#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) && !defined( USE_CSM ) && !defined( CSM_CASCADES )
- DirectionalLight directionalLight;
- #pragma unroll_loop
- for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
- directionalLight = directionalLights[ i ];
- getDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );
- #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
- directLight.color *= all( bvec2( directionalLight.shadow, directLight.visible ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
- #endif
- RE_Direct( directLight, geometry, material, reflectedLight );
- }
-#endif
-#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )
- RectAreaLight rectAreaLight;
- #pragma unroll_loop
- for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {
- rectAreaLight = rectAreaLights[ i ];
- RE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );
- }
-#endif
-#if defined( RE_IndirectDiffuse )
- vec3 iblIrradiance = vec3( 0.0 );
- vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
- irradiance += getLightProbeIrradiance( lightProbe, geometry );
- #if ( NUM_HEMI_LIGHTS > 0 )
- #pragma unroll_loop
- for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
- irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );
- }
- #endif
-#endif
-#if defined( RE_IndirectSpecular )
- vec3 radiance = vec3( 0.0 );
- vec3 clearcoatRadiance = vec3( 0.0 );
-#endif
-`,
- lights_pars_begin: `
-#if defined( USE_CSM ) && defined( CSM_CASCADES )
-uniform vec2 CSM_cascades[CSM_CASCADES];
-uniform float cameraNear;
-uniform float shadowFar;
-#endif
- ` + ShaderChunk.lights_pars_begin
-};
-
-class CSM {
- constructor(data) {
- data = data || {};
-
- this.camera = data.camera;
- this.parent = data.parent;
- this.fov = data.fov || this.camera.fov;
- this.near = this.camera.near;
- this.far = data.far || this.camera.far;
- this.aspect = data.aspect || this.camera.aspect;
- this.cascades = data.cascades || 3;
- this.mode = data.mode || 'practical';
- this.shadowMapSize = data.shadowMapSize || 2048;
- this.shadowBias = data.shadowBias || 0.000001;
- this.lightDirection = data.lightDirection || new Vector3(1, -1, 1).normalize();
- this.lightIntensity = data.lightIntensity || 1;
- this.lightNear = data.lightNear || 1;
- this.lightFar = data.lightFar || 2000;
- this.lightMargin = data.lightMargin || 200;
- this.customSplitsCallback = data.customSplitsCallback;
-
- this.lights = [];
- this.materials = [];
- this.createLights();
-
- this.getBreaks();
- this.initCascades();
-
- this.injectInclude();
- }
-
- createLights() {
- for(let i = 0; i < this.cascades; i++) {
- const light = new DirectionalLight(0xffffff, this.lightIntensity);
- light.castShadow = true;
- light.shadow.mapSize.width = this.shadowMapSize;
- light.shadow.mapSize.height = this.shadowMapSize;
-
- light.shadow.camera.near = this.lightNear;
- light.shadow.camera.far = this.lightFar;
- light.shadow.bias = this.shadowBias;
-
- this.parent.add(light);
- this.parent.add(light.target);
- this.lights.push(light);
- }
- }
-
- initCascades() {
- this.mainFrustum = new Frustum({
- fov: this.fov,
- near: this.near,
- far: this.far,
- aspect: this.aspect
- });
-
- this.mainFrustum.getViewSpaceVertices();
-
- this.frustums = this.mainFrustum.split(this.breaks);
- }
-
- getBreaks() {
- this.breaks = [];
-
- switch (this.mode) {
- case 'uniform':
- this.breaks = uniformSplit(this.cascades, this.near, this.far);
- break;
- case 'logarithmic':
- this.breaks = logarithmicSplit(this.cascades, this.near, this.far);
- break;
- case 'practical':
- this.breaks = practicalSplit(this.cascades, this.near, this.far, 0.5);
- break;
- case 'custom':
- if(this.customSplitsCallback === undefined) console.error('CSM: Custom split scheme callback not defined.');
- this.breaks = this.customSplitsCallback(this.cascades, this.near, this.far);
- break;
- }
-
- function uniformSplit(amount, near, far) {
- const r = [];
-
- for(let i = 1; i < amount; i++) {
- r.push((near + (far - near) * i / amount) / far);
- }
-
- r.push(1);
- return r;
- }
-
- function logarithmicSplit(amount, near, far) {
- const r = [];
-
- for(let i = 1; i < amount; i++) {
- r.push((near * (far / near) ** (i / amount)) / far);
- }
-
- r.push(1);
- return r;
- }
-
- function practicalSplit(amount, near, far, lambda) {
- const log = logarithmicSplit(amount, near, far);
- const uni = uniformSplit(amount, near, far);
- const r = [];
-
- for(let i = 1; i < amount; i++) {
- r.push(lambda * log[i - 1] + (1 - lambda) * uni[i - 1]);
- }
-
- r.push(1);
- return r;
- }
- }
-
- update(cameraMatrix) {
- for(let i = 0; i < this.frustums.length; i++) {
- const worldSpaceFrustum = this.frustums[i].toSpace(cameraMatrix);
- const light = this.lights[i];
- const lightSpaceFrustum = worldSpaceFrustum.toSpace(light.shadow.camera.matrixWorldInverse);
-
- light.shadow.camera.updateMatrixWorld(true);
-
- const bbox = new FrustumBoundingBox().fromFrustum(lightSpaceFrustum);
- bbox.getSize();
- bbox.getCenter(this.lightMargin);
-
- const squaredBBWidth = Math.max(bbox.size.x, bbox.size.y);
-
- let center = new Vector3(bbox.center.x, bbox.center.y, bbox.center.z);
- center.applyMatrix4(light.shadow.camera.matrixWorld);
-
- light.shadow.camera.left = -squaredBBWidth / 2;
- light.shadow.camera.right = squaredBBWidth / 2;
- light.shadow.camera.top = squaredBBWidth / 2;
- light.shadow.camera.bottom = -squaredBBWidth / 2;
-
- light.position.copy(center);
- light.target.position.copy(center);
-
- light.target.position.x += this.lightDirection.x;
- light.target.position.y += this.lightDirection.y;
- light.target.position.z += this.lightDirection.z;
-
- light.shadow.camera.updateProjectionMatrix();
- light.shadow.camera.updateMatrixWorld();
- }
- }
-
- injectInclude() {
- ShaderChunk.lights_fragment_begin = Shader.lights_fragment_begin;
- ShaderChunk.lights_pars_begin = Shader.lights_pars_begin;
- }
-
- setupMaterial(material) {
- material.defines = material.defines || {};
- material.defines.USE_CSM = 1;
- material.defines.CSM_CASCADES = this.cascades;
-
- const breaksVec2 = [];
-
- for(let i = 0; i < this.cascades; i++) {
- let amount = this.breaks[i];
- let prev = this.breaks[i - 1] || 0;
- breaksVec2.push(new Vector2(prev, amount));
- }
-
- const self = this;
-
- material.onBeforeCompile = function (shader) {
- shader.uniforms.CSM_cascades = {value: breaksVec2};
- shader.uniforms.cameraNear = {value: self.camera.near};
- shader.uniforms.shadowFar = {value: self.far};
-
- self.materials.push(shader);
- };
- }
-
- updateUniforms() {
- for(let i = 0; i < this.materials.length; i++) {
- this.materials[i].uniforms.CSM_cascades.value = this.getExtendedBreaks();
- this.materials[i].uniforms.cameraNear.value = this.camera.near;
- this.materials[i].uniforms.shadowFar.value = this.far;
- }
- }
-
- getExtendedBreaks() {
- let breaksVec2 = [];
-
- for(let i = 0; i < this.cascades; i++) {
- let amount = this.breaks[i];
- let prev = this.breaks[i - 1] || 0;
- breaksVec2.push(new Vector2(prev, amount));
- }
-
- return breaksVec2;
- }
-
- setAspect(aspect) {
- this.aspect = aspect;
- this.initCascades();
- }
-
- updateFrustums() {
- this.getBreaks();
- this.initCascades();
- this.updateUniforms();
- }
-
- helper(cameraMatrix) {
- let frustum;
- let geometry;
- const material = new LineBasicMaterial({color: 0xffffff});
- const object = new Object3D();
-
- for(let i = 0; i < this.frustums.length; i++) {
- frustum = this.frustums[i].toSpace(cameraMatrix);
-
- geometry = new Geometry();
-
- for(let i = 0; i < 5; i++) {
- const point = frustum.vertices.near[i === 4 ? 0 : i];
- geometry.vertices.push(new Vector3(point.x, point.y, point.z));
- }
-
- object.add(new Line(geometry, material));
-
- geometry = new Geometry();
-
- for(let i = 0; i < 5; i++) {
- const point = frustum.vertices.far[i === 4 ? 0 : i];
- geometry.vertices.push(new Vector3(point.x, point.y, point.z));
- }
-
- object.add(new Line(geometry, material));
-
- for(let i = 0; i < 4; i++) {
- geometry = new Geometry();
-
- const near = frustum.vertices.near[i];
- const far = frustum.vertices.far[i];
-
- geometry.vertices.push(new Vector3(near.x, near.y, near.z));
- geometry.vertices.push(new Vector3(far.x, far.y, far.z));
-
- object.add(new Line(geometry, material));
- }
- }
-
- return object;
- }
-
- remove() {
- for(let i = 0; i < this.lights.length; i++) {
- this.parent.remove(this.lights[i]);
- }
- }
-}
-
-export default CSM; | true |
Other | mrdoob | three.js | 90b50ac1d846cd06ee41a904039203178e9a5d37.json | Use source files instead of bundle | examples/jsm/csm/CSM.js | @@ -0,0 +1,264 @@
+import * as THREE from '../../../build/three.module.js';
+import Frustum from './Frustum.js';
+import FrustumBoundingBox from './FrustumBoundingBox.js';
+import Shader from './Shader.js';
+
+export default class CSM {
+ constructor(data) {
+ data = data || {};
+
+ this.camera = data.camera;
+ this.parent = data.parent;
+ this.fov = data.fov || this.camera.fov;
+ this.near = this.camera.near;
+ this.far = data.far || this.camera.far;
+ this.aspect = data.aspect || this.camera.aspect;
+ this.cascades = data.cascades || 3;
+ this.mode = data.mode || 'practical';
+ this.shadowMapSize = data.shadowMapSize || 2048;
+ this.shadowBias = data.shadowBias || 0.000001;
+ this.lightDirection = data.lightDirection || new THREE.Vector3(1, -1, 1).normalize();
+ this.lightIntensity = data.lightIntensity || 1;
+ this.lightNear = data.lightNear || 1;
+ this.lightFar = data.lightFar || 2000;
+ this.lightMargin = data.lightMargin || 200;
+ this.customSplitsCallback = data.customSplitsCallback;
+
+ this.lights = [];
+ this.materials = [];
+ this.createLights();
+
+ this.getBreaks();
+ this.initCascades();
+
+ this.injectInclude();
+ }
+
+ createLights() {
+ for(let i = 0; i < this.cascades; i++) {
+ const light = new THREE.DirectionalLight(0xffffff, this.lightIntensity);
+ light.castShadow = true;
+ light.shadow.mapSize.width = this.shadowMapSize;
+ light.shadow.mapSize.height = this.shadowMapSize;
+
+ light.shadow.camera.near = this.lightNear;
+ light.shadow.camera.far = this.lightFar;
+ light.shadow.bias = this.shadowBias;
+
+ this.parent.add(light);
+ this.parent.add(light.target);
+ this.lights.push(light);
+ }
+ }
+
+ initCascades() {
+ this.mainFrustum = new Frustum({
+ fov: this.fov,
+ near: this.near,
+ far: this.far,
+ aspect: this.aspect
+ });
+
+ this.mainFrustum.getViewSpaceVertices();
+
+ this.frustums = this.mainFrustum.split(this.breaks);
+ }
+
+ getBreaks() {
+ this.breaks = [];
+
+ switch (this.mode) {
+ case 'uniform':
+ this.breaks = uniformSplit(this.cascades, this.near, this.far);
+ break;
+ case 'logarithmic':
+ this.breaks = logarithmicSplit(this.cascades, this.near, this.far);
+ break;
+ case 'practical':
+ this.breaks = practicalSplit(this.cascades, this.near, this.far, 0.5);
+ break;
+ case 'custom':
+ if(this.customSplitsCallback === undefined) console.error('CSM: Custom split scheme callback not defined.');
+ this.breaks = this.customSplitsCallback(this.cascades, this.near, this.far);
+ break;
+ }
+
+ function uniformSplit(amount, near, far) {
+ const r = [];
+
+ for(let i = 1; i < amount; i++) {
+ r.push((near + (far - near) * i / amount) / far);
+ }
+
+ r.push(1);
+ return r;
+ }
+
+ function logarithmicSplit(amount, near, far) {
+ const r = [];
+
+ for(let i = 1; i < amount; i++) {
+ r.push((near * (far / near) ** (i / amount)) / far);
+ }
+
+ r.push(1);
+ return r;
+ }
+
+ function practicalSplit(amount, near, far, lambda) {
+ const log = logarithmicSplit(amount, near, far);
+ const uni = uniformSplit(amount, near, far);
+ const r = [];
+
+ for(let i = 1; i < amount; i++) {
+ r.push(lambda * log[i - 1] + (1 - lambda) * uni[i - 1]);
+ }
+
+ r.push(1);
+ return r;
+ }
+ }
+
+ update(cameraMatrix) {
+ for(let i = 0; i < this.frustums.length; i++) {
+ const worldSpaceFrustum = this.frustums[i].toSpace(cameraMatrix);
+ const light = this.lights[i];
+ const lightSpaceFrustum = worldSpaceFrustum.toSpace(light.shadow.camera.matrixWorldInverse);
+
+ light.shadow.camera.updateMatrixWorld(true);
+
+ const bbox = new FrustumBoundingBox().fromFrustum(lightSpaceFrustum);
+ bbox.getSize();
+ bbox.getCenter(this.lightMargin);
+
+ const squaredBBWidth = Math.max(bbox.size.x, bbox.size.y);
+
+ let center = new THREE.Vector3(bbox.center.x, bbox.center.y, bbox.center.z);
+ center.applyMatrix4(light.shadow.camera.matrixWorld);
+
+ light.shadow.camera.left = -squaredBBWidth / 2;
+ light.shadow.camera.right = squaredBBWidth / 2;
+ light.shadow.camera.top = squaredBBWidth / 2;
+ light.shadow.camera.bottom = -squaredBBWidth / 2;
+
+ light.position.copy(center);
+ light.target.position.copy(center);
+
+ light.target.position.x += this.lightDirection.x;
+ light.target.position.y += this.lightDirection.y;
+ light.target.position.z += this.lightDirection.z;
+
+ light.shadow.camera.updateProjectionMatrix();
+ light.shadow.camera.updateMatrixWorld();
+ }
+ }
+
+ injectInclude() {
+ THREE.ShaderChunk.lights_fragment_begin = Shader.lights_fragment_begin;
+ THREE.ShaderChunk.lights_pars_begin = Shader.lights_pars_begin;
+ }
+
+ setupMaterial(material) {
+ material.defines = material.defines || {};
+ material.defines.USE_CSM = 1;
+ material.defines.CSM_CASCADES = this.cascades;
+
+ const breaksVec2 = [];
+
+ for(let i = 0; i < this.cascades; i++) {
+ let amount = this.breaks[i];
+ let prev = this.breaks[i - 1] || 0;
+ breaksVec2.push(new THREE.Vector2(prev, amount));
+ }
+
+ const self = this;
+
+ material.onBeforeCompile = function (shader) {
+ shader.uniforms.CSM_cascades = {value: breaksVec2};
+ shader.uniforms.cameraNear = {value: self.camera.near};
+ shader.uniforms.shadowFar = {value: self.far};
+
+ self.materials.push(shader);
+ };
+ }
+
+ updateUniforms() {
+ for(let i = 0; i < this.materials.length; i++) {
+ this.materials[i].uniforms.CSM_cascades.value = this.getExtendedBreaks();
+ this.materials[i].uniforms.cameraNear.value = this.camera.near;
+ this.materials[i].uniforms.shadowFar.value = this.far;
+ }
+ }
+
+ getExtendedBreaks() {
+ let breaksVec2 = [];
+
+ for(let i = 0; i < this.cascades; i++) {
+ let amount = this.breaks[i];
+ let prev = this.breaks[i - 1] || 0;
+ breaksVec2.push(new THREE.Vector2(prev, amount));
+ }
+
+ return breaksVec2;
+ }
+
+ setAspect(aspect) {
+ this.aspect = aspect;
+ this.initCascades();
+ }
+
+ updateFrustums() {
+ this.getBreaks();
+ this.initCascades();
+ this.updateUniforms();
+ }
+
+ helper(cameraMatrix) {
+ let frustum;
+ let geometry;
+ const material = new THREE.LineBasicMaterial({color: 0xffffff});
+ const object = new THREE.Object3D();
+
+ for(let i = 0; i < this.frustums.length; i++) {
+ frustum = this.frustums[i].toSpace(cameraMatrix);
+
+ geometry = new THREE.Geometry();
+
+ for(let i = 0; i < 5; i++) {
+ const point = frustum.vertices.near[i === 4 ? 0 : i];
+ geometry.vertices.push(new THREE.Vector3(point.x, point.y, point.z));
+ }
+
+ object.add(new THREE.Line(geometry, material));
+
+ geometry = new THREE.Geometry();
+
+ for(let i = 0; i < 5; i++) {
+ const point = frustum.vertices.far[i === 4 ? 0 : i];
+ geometry.vertices.push(new THREE.Vector3(point.x, point.y, point.z));
+ }
+
+ object.add(new THREE.Line(geometry, material));
+
+ for(let i = 0; i < 4; i++) {
+ geometry = new THREE.Geometry();
+
+ const near = frustum.vertices.near[i];
+ const far = frustum.vertices.far[i];
+
+ geometry.vertices.push(new THREE.Vector3(near.x, near.y, near.z));
+ geometry.vertices.push(new THREE.Vector3(far.x, far.y, far.z));
+
+ object.add(new THREE.Line(geometry, material));
+ }
+ }
+
+ return object;
+ }
+
+ remove() {
+ for(let i = 0; i < this.lights.length; i++) {
+ this.parent.remove(this.lights[i]);
+ }
+ }
+} | true |
Other | mrdoob | three.js | 90b50ac1d846cd06ee41a904039203178e9a5d37.json | Use source files instead of bundle | examples/jsm/csm/Frustum.js | @@ -0,0 +1,92 @@
+import * as THREE from '../../../build/three.module.js';
+import FrustumVertex from './FrustumVertex.js';
+import {toRad} from './Utils.js';
+
+export default class Frustum {
+ constructor(data) {
+ data = data || {};
+
+ this.fov = data.fov || 70;
+ this.near = data.near || 0.1;
+ this.far = data.far || 1000;
+ this.aspect = data.aspect || 1;
+
+ this.vertices = {
+ near: [],
+ far: []
+ };
+ }
+
+ getViewSpaceVertices() {
+ this.nearPlaneY = this.near * Math.tan(toRad(this.fov / 2));
+ this.nearPlaneX = this.aspect * this.nearPlaneY;
+
+ this.farPlaneY = this.far * Math.tan(toRad(this.fov / 2));
+ this.farPlaneX = this.aspect * this.farPlaneY;
+
+ // 3 --- 0 vertices.near/far order
+ // | |
+ // 2 --- 1
+
+ this.vertices.near.push(
+ new FrustumVertex(this.nearPlaneX, this.nearPlaneY, -this.near),
+ new FrustumVertex(this.nearPlaneX, -this.nearPlaneY, -this.near),
+ new FrustumVertex(-this.nearPlaneX, -this.nearPlaneY, -this.near),
+ new FrustumVertex(-this.nearPlaneX, this.nearPlaneY, -this.near)
+ );
+
+ this.vertices.far.push(
+ new FrustumVertex(this.farPlaneX, this.farPlaneY, -this.far),
+ new FrustumVertex(this.farPlaneX, -this.farPlaneY, -this.far),
+ new FrustumVertex(-this.farPlaneX, -this.farPlaneY, -this.far),
+ new FrustumVertex(-this.farPlaneX, this.farPlaneY, -this.far)
+ );
+
+ return this.vertices;
+ }
+
+ split(breaks) {
+ const result = [];
+
+ for(let i = 0; i < breaks.length; i++) {
+ const cascade = new Frustum();
+
+ if(i === 0) {
+ cascade.vertices.near = this.vertices.near;
+ } else {
+ for(let j = 0; j < 4; j++) {
+ cascade.vertices.near.push(new FrustumVertex().fromLerp(this.vertices.near[j], this.vertices.far[j], breaks[i - 1]));
+ }
+ }
+
+ if(i === breaks - 1) {
+ cascade.vertices.far = this.vertices.far;
+ } else {
+ for(let j = 0; j < 4; j++) {
+ cascade.vertices.far.push(new FrustumVertex().fromLerp(this.vertices.near[j], this.vertices.far[j], breaks[i]))
+ }
+ }
+
+ result.push(cascade);
+ }
+
+ return result;
+ }
+
+ toSpace(cameraMatrix) {
+ const result = new Frustum();
+ const point = new THREE.Vector3();
+
+ for(var i = 0; i < 4; i++) {
+ point.set(this.vertices.near[i].x, this.vertices.near[i].y, this.vertices.near[i].z);
+ point.applyMatrix4(cameraMatrix);
+ result.vertices.near.push(new FrustumVertex(point.x, point.y, point.z));
+
+ point.set(this.vertices.far[i].x, this.vertices.far[i].y, this.vertices.far[i].z);
+ point.applyMatrix4(cameraMatrix);
+ result.vertices.far.push(new FrustumVertex(point.x, point.y, point.z));
+ }
+
+ return result;
+ }
+} | true |
Other | mrdoob | three.js | 90b50ac1d846cd06ee41a904039203178e9a5d37.json | Use source files instead of bundle | examples/jsm/csm/FrustumBoundingBox.js | @@ -0,0 +1,65 @@
+export default class FrustumBoundingBox {
+ constructor() {
+ this.min = {
+ x: 0,
+ y: 0,
+ z: 0
+ };
+ this.max = {
+ x: 0,
+ y: 0,
+ z: 0
+ };
+ }
+
+ fromFrustum(frustum) {
+ const vertices = [];
+
+ for(let i = 0; i < 4; i++) {
+ vertices.push(frustum.vertices.near[i]);
+ vertices.push(frustum.vertices.far[i]);
+ }
+
+ this.min = {
+ x: vertices[0].x,
+ y: vertices[0].y,
+ z: vertices[0].z
+ };
+ this.max = {
+ x: vertices[0].x,
+ y: vertices[0].y,
+ z: vertices[0].z
+ };
+
+ for(let i = 1; i < 8; i++) {
+ this.min.x = Math.min(this.min.x, vertices[i].x);
+ this.min.y = Math.min(this.min.y, vertices[i].y);
+ this.min.z = Math.min(this.min.z, vertices[i].z);
+ this.max.x = Math.max(this.max.x, vertices[i].x);
+ this.max.y = Math.max(this.max.y, vertices[i].y);
+ this.max.z = Math.max(this.max.z, vertices[i].z);
+ }
+
+ return this;
+ }
+
+ getSize() {
+ this.size = {
+ x: this.max.x - this.min.x,
+ y: this.max.y - this.min.y,
+ z: this.max.z - this.min.z
+ };
+
+ return this.size;
+ }
+
+ getCenter(margin) {
+ this.center = {
+ x: (this.max.x + this.min.x) / 2,
+ y: (this.max.y + this.min.y) / 2,
+ z: this.max.z + margin
+ };
+
+ return this.center;
+ }
+}
\ No newline at end of file | true |
Other | mrdoob | three.js | 90b50ac1d846cd06ee41a904039203178e9a5d37.json | Use source files instead of bundle | examples/jsm/csm/FrustumVertex.js | @@ -0,0 +1,15 @@
+export default class FrustumVertex {
+ constructor(x, y, z) {
+ this.x = x || 0;
+ this.y = y || 0;
+ this.z = z || 0;
+ }
+
+ fromLerp(v1, v2, amount) {
+ this.x = (1 - amount) * v1.x + amount * v2.x;
+ this.y = (1 - amount) * v1.y + amount * v2.y;
+ this.z = (1 - amount) * v1.z + amount * v2.z;
+
+ return this;
+ }
+}
\ No newline at end of file | true |
Other | mrdoob | three.js | 90b50ac1d846cd06ee41a904039203178e9a5d37.json | Use source files instead of bundle | examples/jsm/csm/Shader.js | @@ -0,0 +1,94 @@
+import * as THREE from '../../../build/three.module.js';
+
+export default {
+ lights_fragment_begin: `
+GeometricContext geometry;
+geometry.position = - vViewPosition;
+geometry.normal = normal;
+geometry.viewDir = normalize( vViewPosition );
+#ifdef CLEARCOAT
+ geometry.clearcoatNormal = clearcoatNormal;
+#endif
+IncidentLight directLight;
+#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )
+ PointLight pointLight;
+ #pragma unroll_loop
+ for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
+ pointLight = pointLights[ i ];
+ getPointDirectLightIrradiance( pointLight, geometry, directLight );
+ #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )
+ directLight.color *= all( bvec3( pointLight.shadow, directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
+ #endif
+ RE_Direct( directLight, geometry, material, reflectedLight );
+ }
+#endif
+#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )
+ SpotLight spotLight;
+ #pragma unroll_loop
+ for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
+ spotLight = spotLights[ i ];
+ getSpotDirectLightIrradiance( spotLight, geometry, directLight );
+ #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
+ directLight.color *= all( bvec3( spotLight.shadow, directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;
+ #endif
+ RE_Direct( directLight, geometry, material, reflectedLight );
+ }
+#endif
+#if ( NUM_DIR_LIGHTS > 0) && defined( RE_Direct ) && defined( USE_CSM ) && defined( CSM_CASCADES )
+ DirectionalLight directionalLight;
+ float linearDepth = (vViewPosition.z) / (shadowFar - cameraNear);
+
+ #pragma unroll_loop
+ for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
+ directionalLight = directionalLights[ i ];
+ getDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );
+ #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
+ if(linearDepth >= CSM_cascades[UNROLLED_LOOP_INDEX].x && linearDepth < CSM_cascades[UNROLLED_LOOP_INDEX].y) directLight.color *= all( bvec3( directionalLight.shadow, directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
+ #endif
+ if(linearDepth >= CSM_cascades[UNROLLED_LOOP_INDEX].x && (linearDepth < CSM_cascades[UNROLLED_LOOP_INDEX].y || UNROLLED_LOOP_INDEX == CSM_CASCADES - 1)) RE_Direct( directLight, geometry, material, reflectedLight );
+ }
+#endif
+#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) && !defined( USE_CSM ) && !defined( CSM_CASCADES )
+ DirectionalLight directionalLight;
+ #pragma unroll_loop
+ for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
+ directionalLight = directionalLights[ i ];
+ getDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );
+ #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
+ directLight.color *= all( bvec2( directionalLight.shadow, directLight.visible ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
+ #endif
+ RE_Direct( directLight, geometry, material, reflectedLight );
+ }
+#endif
+#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )
+ RectAreaLight rectAreaLight;
+ #pragma unroll_loop
+ for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {
+ rectAreaLight = rectAreaLights[ i ];
+ RE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );
+ }
+#endif
+#if defined( RE_IndirectDiffuse )
+ vec3 iblIrradiance = vec3( 0.0 );
+ vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
+ irradiance += getLightProbeIrradiance( lightProbe, geometry );
+ #if ( NUM_HEMI_LIGHTS > 0 )
+ #pragma unroll_loop
+ for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
+ irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );
+ }
+ #endif
+#endif
+#if defined( RE_IndirectSpecular )
+ vec3 radiance = vec3( 0.0 );
+ vec3 clearcoatRadiance = vec3( 0.0 );
+#endif
+`,
+ lights_pars_begin: `
+#if defined( USE_CSM ) && defined( CSM_CASCADES )
+uniform vec2 CSM_cascades[CSM_CASCADES];
+uniform float cameraNear;
+uniform float shadowFar;
+#endif
+ ` + THREE.ShaderChunk.lights_pars_begin
+} | true |
Other | mrdoob | three.js | 90b50ac1d846cd06ee41a904039203178e9a5d37.json | Use source files instead of bundle | examples/jsm/csm/Utils.js | @@ -0,0 +1,3 @@
+export function toRad(degrees) {
+ return degrees * Math.PI / 180;
+}
\ No newline at end of file | true |
Other | mrdoob | three.js | 90b50ac1d846cd06ee41a904039203178e9a5d37.json | Use source files instead of bundle | examples/webgl_cascadedshadowmaps.html | @@ -20,7 +20,7 @@
import { OrbitControls } from './jsm/controls/OrbitControls.js';
import { GUI } from './jsm/libs/dat.gui.module.js';
- import * as CSM from './js/libs/three-csm.module.js';
+ import * as CSM from './jsm/csm/CSM.js';
var renderer, scene, camera, controls, csm;
| true |
Other | mrdoob | three.js | 90b50ac1d846cd06ee41a904039203178e9a5d37.json | Use source files instead of bundle | utils/modularize.js | @@ -58,8 +58,6 @@ var files = [
{ path: 'interactive/SelectionBox.js', dependencies: [], ignoreList: [] },
{ path: 'interactive/SelectionHelper.js', dependencies: [], ignoreList: [] },
- { path: 'libs/three-csm.module.js', dependencies: [], ignoreList: [] },
-
{ path: 'lights/LightProbeGenerator.js', dependencies: [], ignoreList: [] },
{ path: 'lights/RectAreaLightUniformsLib.js', dependencies: [], ignoreList: [] },
| true |
Other | mrdoob | three.js | 4c7d6f467a2a44ec18612692498932379f10472d.json | add example in file list | examples/files.js | @@ -159,6 +159,7 @@ var files = {
"webgl_materials_envmaps",
"webgl_materials_envmaps_exr",
"webgl_materials_envmaps_hdr",
+ "webgl_materials_envmaps_hdr_nodes",
"webgl_materials_envmaps_parallax",
"webgl_materials_grass",
"webgl_materials_lightmap", | true |
Other | mrdoob | three.js | 4c7d6f467a2a44ec18612692498932379f10472d.json | add example in file list | examples/webgl_materials_envmaps_hdr_nodes.html | @@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
- <title>threejs webgl - materials - hdr environment mapping</title>
+ <title>threejs webgl - node material - hdr environment mapping</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<style> | true |
Other | mrdoob | three.js | 529b619de444a4e5545a40ae675e42b893c31106.json | add euler unittests | test/unit/src/math/Euler.tests.js | @@ -70,34 +70,104 @@ export default QUnit.module( 'Maths', () => {
} );
// STATIC STUFF
- QUnit.todo( "RotationOrders", ( assert ) => {
+ QUnit.test( "RotationOrders", ( assert ) => {
- assert.ok( false, "everything's gonna be alright" );
+ assert.ok( Array.isArray( Euler.RotationOrders ), "Passed!" );
+ assert.deepEqual( Euler.RotationOrders, [ 'XYZ', 'YZX', 'ZXY', 'XZY', 'YXZ', 'ZYX' ], "Passed!" );
} );
- QUnit.todo( "DefaultOrder", ( assert ) => {
+ QUnit.test( "DefaultOrder", ( assert ) => {
+
+ assert.equal( Euler.DefaultOrder, "XYZ", "Passed!" );
- assert.ok( false, "everything's gonna be alright" );
} );
// PROPERTIES STUFF
- QUnit.todo( "x", ( assert ) => {
+ QUnit.test( "x", ( assert ) => {
- assert.ok( false, "everything's gonna be alright" );
+ var a = new Euler();
+ assert.ok( a.x === 0, "Passed!" );
+
+ a = new Euler( 1, 2, 3 );
+ assert.ok( a.x === 1, "Passed!" );
+
+ a = new Euler( 4, 5, 6, "XYZ" );
+ assert.ok( a.x === 4, "Passed!" );
+
+ a = new Euler( 7, 8, 9, "XYZ" );
+ a.x = 10;
+ assert.ok( a.x === 10, "Passed!" );
+
+ a = new Euler( 11, 12, 13, "XYZ" );
+ var b = false;
+ a._onChange( function () {
+
+ b = true;
+
+ } );
+ a.x = 14;
+ assert.ok( b, "Passed!" );
+ assert.ok( a.x === 14, "Passed!" );
} );
- QUnit.todo( "y", ( assert ) => {
+ QUnit.test( "y", ( assert ) => {
- assert.ok( false, "everything's gonna be alright" );
+
+ var a = new Euler();
+ assert.ok( a.y === 0, "Passed!" );
+
+ a = new Euler( 1, 2, 3 );
+ assert.ok( a.y === 2, "Passed!" );
+
+ a = new Euler( 4, 5, 6, "XYZ" );
+ assert.ok( a.y === 5, "Passed!" );
+
+ a = new Euler( 7, 8, 9, "XYZ" );
+ a.y = 10;
+ assert.ok( a.y === 10, "Passed!" );
+
+ a = new Euler( 11, 12, 13, "XYZ" );
+ var b = false;
+ a._onChange( function () {
+
+ b = true;
+
+ } );
+ a.y = 14;
+ assert.ok( b, "Passed!" );
+ assert.ok( a.y === 14, "Passed!" );
} );
- QUnit.todo( "z", ( assert ) => {
+ QUnit.test( "z", ( assert ) => {
- assert.ok( false, "everything's gonna be alright" );
+
+ var a = new Euler();
+ assert.ok( a.z === 0, "Passed!" );
+
+ a = new Euler( 1, 2, 3 );
+ assert.ok( a.z === 3, "Passed!" );
+
+ a = new Euler( 4, 5, 6, "XYZ" );
+ assert.ok( a.z === 6, "Passed!" );
+
+ a = new Euler( 7, 8, 9, "XYZ" );
+ a.z = 10;
+ assert.ok( a.z === 10, "Passed!" );
+
+ a = new Euler( 11, 12, 13, "XYZ" );
+ var b = false;
+ a._onChange( function () {
+
+ b = true;
+
+ } );
+ a.z = 14;
+ assert.ok( b, "Passed!" );
+ assert.ok( a.z === 14, "Passed!" );
} );
| false |
Other | mrdoob | three.js | d254847f7b290e551cdbdaec3fc7020fc6889361.json | fix TextureCubeNode and new features | examples/js/nodes/accessors/ReflectNode.js | @@ -15,6 +15,7 @@ function ReflectNode( scope ) {
ReflectNode.CUBE = 'cube';
ReflectNode.SPHERE = 'sphere';
ReflectNode.VECTOR = 'vector';
+ReflectNode.VECTOR2 = 'vector2';
ReflectNode.prototype = Object.create( TempNode.prototype );
ReflectNode.prototype.constructor = ReflectNode;
@@ -50,6 +51,14 @@ ReflectNode.prototype.generate = function ( builder, output ) {
break;
+ case ReflectNode.VECTOR2:
+
+ builder.addNodeCode( 'vec3 reflectVec2 = vec3( inverseTransformDirection( geometry.normal, viewMatrix ).x, inverseTransformDirection( geometry.normal, viewMatrix ).yz );' );
+
+ result = 'reflectVec2';
+
+ break;
+
case ReflectNode.CUBE:
var reflectVec = new ReflectNode( ReflectNode.VECTOR ).build( builder, 'v3' ); | true |
Other | mrdoob | three.js | d254847f7b290e551cdbdaec3fc7020fc6889361.json | fix TextureCubeNode and new features | examples/js/nodes/core/Node.js | @@ -54,6 +54,7 @@ Node.prototype = {
var data = { result: this.build( builder.addFlow( settings.slot, settings.cache, settings.context ), output ) };
data.code = builder.clearNodeCode();
+ data.extra = builder.context.extra;
builder.removeFlow();
| true |
Other | mrdoob | three.js | d254847f7b290e551cdbdaec3fc7020fc6889361.json | fix TextureCubeNode and new features | examples/js/nodes/core/NodeBuilder.js | @@ -13,6 +13,8 @@ import { Vector3Node } from '../inputs/Vector3Node.js';
import { Vector4Node } from '../inputs/Vector4Node.js';
import { TextureNode } from '../inputs/TextureNode.js';
import { CubeTextureNode } from '../inputs/CubeTextureNode.js';
+import { TextureCubeNode } from '../misc/TextureCubeNode.js';
+
var elements = NodeUtils.elements,
constructors = [ 'float', 'vec2', 'vec3', 'vec4' ],
@@ -278,6 +280,8 @@ NodeBuilder.prototype = {
addContext: function ( context ) {
this.context = Object.assign( {}, this.context, context );
+ this.context.extra = this.context.extra || {};
+
this.contexts.push( this.context );
return this; | true |
Other | mrdoob | three.js | d254847f7b290e551cdbdaec3fc7020fc6889361.json | fix TextureCubeNode and new features | examples/js/nodes/materials/nodes/StandardNode.js | @@ -370,6 +370,12 @@ StandardNode.prototype.build = function ( builder ) {
output.push( "radiance += " + environment.result + ";" );
+ if ( environment.extra.irradiance ) {
+
+ output.push( "irradiance += " + environment.extra.irradiance + ";" );
+
+ }
+
}
output.push( | true |
Other | mrdoob | three.js | d254847f7b290e551cdbdaec3fc7020fc6889361.json | fix TextureCubeNode and new features | examples/js/nodes/misc/TextureCubeNode.js | @@ -3,46 +3,71 @@
*/
import { TempNode } from '../core/TempNode.js';
+import { FloatNode } from '../inputs/FloatNode.js';
+import { ExpressionNode } from '../core/ExpressionNode.js';
import { TextureCubeUVNode } from './TextureCubeUVNode.js';
+import { ReflectNode } from '../accessors/ReflectNode.js';
import { ColorSpaceNode } from '../utils/ColorSpaceNode.js';
-function TextureCubeNode( value, uv ) {
+function TextureCubeNode( value ) {
TempNode.call( this, 'v4' );
this.value = value;
- this.uv = uv || new TextureCubeUVNode();
+
+ this.radianceCache = { uv: new TextureCubeUVNode() };
+ this.irradianceCache = { uv: new TextureCubeUVNode( new ReflectNode( ReflectNode.VECTOR2 ), undefined, new FloatNode( 1 ).setReadonly( true ) ) };
}
TextureCubeNode.prototype = Object.create( TempNode.prototype );
TextureCubeNode.prototype.constructor = TextureCubeNode;
TextureCubeNode.prototype.nodeType = "TextureCube";
-TextureCubeNode.prototype.generate = function ( builder, output ) {
+TextureCubeNode.prototype.generateTextureCubeUV = function ( builder, cache, t ) {
- if ( builder.isShader( 'fragment' ) ) {
+ var uv_10 = cache.uv.build( builder ) + '.uv_10',
+ uv_20 = cache.uv.build( builder ) + '.uv_20',
+ t = cache.uv.build( builder ) + '.t';
+
+ var color10 = 'texture2D( ' + this.value.build( builder, 'sampler2D' ) + ', ' + uv_10 + ' )',
+ color20 = 'texture2D( ' + this.value.build( builder, 'sampler2D' ) + ', ' + uv_20 + ' )';
+
+ // add a custom context for fix incompatibility with the core
+ // include ColorSpace function only if is a vertex shader
+ // for optimization this should be removed in the future
+ var context = { include: builder.isShader( 'vertex' ) };
+
+ builder.addContext( context );
+
+ cache.colorSpace10 = cache.colorSpace10 || new ColorSpaceNode( new ExpressionNode('', this.type ) );
+ cache.colorSpace10.input.eval( color10 );
+ cache.colorSpace10.fromDecoding( builder.getTextureEncodingFromMap( this.value.value ) );
+ color10 = cache.colorSpace10.build( builder, this.type );
+
+ cache.colorSpace20 = cache.colorSpace20 || new ColorSpaceNode( new ExpressionNode('', this.type ) );
+ cache.colorSpace20.input.eval( color20 );
+ cache.colorSpace20.fromDecoding( builder.getTextureEncodingFromMap( this.value.value ) );
+ color20 = cache.colorSpace20.build( builder, this.type );
- var uv_10 = this.uv.build( builder ) + '.uv_10',
- uv_20 = this.uv.build( builder ) + '.uv_20',
- t = this.uv.build( builder ) + '.t';
+ builder.removeContext();
- var texture = this.value && this.value.value;
- var format = texture && texture.encoding || THREE.LinearEncoding;
- var decoding = ColorSpaceNode.prototype.getDecodingMethod(format);
- function decode(input) {
- return decoding[0] + '( ' + input +
- (decoding[1] !== undefined ? ', ' + decoding[1] : '') +
- ' )';
- }
+ // end custom context
- var color10 = 'texture2D( ' + this.value.build( builder, 'sampler2D' ) + ', ' + uv_10 + ' )';
- color10 = decode(color10);
+ return 'mix( ' + color10 + ', ' + color20 + ', ' + t + ' ).rgb';
- var color20 = 'texture2D( ' + this.value.build( builder, 'sampler2D' ) + ', ' + uv_20 + ' )';
- color20 = decode(color20);
+};
+
+TextureCubeNode.prototype.generate = function ( builder, output ) {
+
+ if ( builder.isShader( 'fragment' ) ) {
+
+ var radiance = this.generateTextureCubeUV( builder, this.radianceCache );
+ var irradiance = this.generateTextureCubeUV( builder, this.irradianceCache );
- return builder.format( 'vec4( mix( ' + color10 + ', ' + color20 + ', ' + t + ' ).rgb, 1.0 )', this.getType( builder ), output );
+ builder.context.extra.irradiance = '( PI * ' + irradiance + ' )';
+
+ return builder.format( 'vec4( ' + radiance + ', 1.0 )', this.getType( builder ), output );
} else {
@@ -62,11 +87,7 @@ TextureCubeNode.prototype.toJSON = function ( meta ) {
data = this.createJSONNode( meta );
- data.uv = this.uv.toJSON( meta ).uuid;
- data.textureSize = this.textureSize.toJSON( meta ).uuid;
- data.blinnExponentToRoughness = this.blinnExponentToRoughness.toJSON( meta ).uuid;
-
- if ( this.roughness ) data.roughness = this.roughness.toJSON( meta ).uuid;
+ data.value = this.value.toJSON( meta ).uuid;
}
| true |
Other | mrdoob | three.js | d254847f7b290e551cdbdaec3fc7020fc6889361.json | fix TextureCubeNode and new features | examples/js/nodes/utils/ColorSpaceNode.js | @@ -4,15 +4,17 @@
import { TempNode } from '../core/TempNode.js';
import { ConstNode } from '../core/ConstNode.js';
+import { FloatNode } from '../inputs/FloatNode.js';
import { FunctionNode } from '../core/FunctionNode.js';
+import { ExpressionNode } from '../core/ExpressionNode.js';
function ColorSpaceNode( input, method ) {
TempNode.call( this, 'v4' );
this.input = input;
- this.method = method || ColorSpaceNode.LINEAR;
+ this.method = method || ColorSpaceNode.LINEAR_TO_LINEAR;
}
@@ -203,15 +205,15 @@ ColorSpaceNode.LOG_LUV_TO_LINEAR = 'LogLuvToLinear';
ColorSpaceNode.prototype = Object.create( TempNode.prototype );
ColorSpaceNode.prototype.constructor = ColorSpaceNode;
-ColorSpaceNode.prototype.nodeType = "ColorAdjustment";
+ColorSpaceNode.prototype.nodeType = "ColorSpace";
ColorSpaceNode.prototype.generate = function ( builder, output ) {
- var input = builder.context.input || this.input.build( builder, 'v4' ),
- encodingMethod = builder.context.encoding !== undefined ? this.getEncodingMethod( builder.context.encoding ) : [ this.method ],
- factor = this.factor ? this.factor.build( builder, 'f' ) : encodingMethod[ 1 ];
+ var input = this.input.build( builder, 'v4' );
+ var method = [ this.method ];
+ var factor = this.factor ? this.factor.build( builder, 'f' ) : method[ 1 ];
- var method = builder.include( ColorSpaceNode.Nodes[ encodingMethod[ 0 ] ] );
+ method = builder.include( ColorSpaceNode.Nodes[ method[ 0 ] ] );
if ( factor ) {
@@ -225,17 +227,7 @@ ColorSpaceNode.prototype.generate = function ( builder, output ) {
};
-ColorSpaceNode.prototype.getDecodingMethod = function ( encoding ) {
-
- var components = this.getEncodingComponents( encoding );
-
- components[ 0 ] += 'ToLinear';
-
- return components;
-
-};
-
-ColorSpaceNode.prototype.getEncodingMethod = function ( encoding ) {
+ColorSpaceNode.getEncodingMethodFromEncoding = function ( encoding ) {
var components = this.getEncodingComponents( encoding );
@@ -245,7 +237,7 @@ ColorSpaceNode.prototype.getEncodingMethod = function ( encoding ) {
};
-ColorSpaceNode.prototype.getEncodingComponents = function ( encoding ) {
+ColorSpaceNode.getEncodingComponents = function ( encoding ) {
switch ( encoding ) {
@@ -256,18 +248,29 @@ ColorSpaceNode.prototype.getEncodingComponents = function ( encoding ) {
case THREE.RGBEEncoding:
return [ 'RGBE' ];
case THREE.RGBM7Encoding:
- return [ 'RGBM', '7.0' ];
+ return [ 'RGBM', new FloatNode( 7.0 ).setReadonly( true ) ];
case THREE.RGBM16Encoding:
- return [ 'RGBM', '16.0' ];
+ return [ 'RGBM', new FloatNode( 16.0 ).setReadonly( true ) ];
case THREE.RGBDEncoding:
- return [ 'RGBD', '256.0' ];
+ return [ 'RGBD', new FloatNode( 256.0 ).setReadonly( true ) ];
case THREE.GammaEncoding:
- return [ 'Gamma', 'float( GAMMA_FACTOR )' ];
+ return [ 'Gamma', new ExpressionNode( 'float( GAMMA_FACTOR )' ) ];
}
};
+ColorSpaceNode.prototype.fromDecoding = function ( encoding ) {
+
+ var components = ColorSpaceNode.getEncodingComponents( encoding );
+
+ components[ 0 ] += 'ToLinear';
+
+ this.method = components[ 0 ];
+ this.factor = components[ 1 ];
+
+};
+
ColorSpaceNode.prototype.copy = function ( source ) {
TempNode.prototype.copy.call( this, source ); | true |
Other | mrdoob | three.js | d254847f7b290e551cdbdaec3fc7020fc6889361.json | fix TextureCubeNode and new features | examples/webgl_materials_envmaps_nodes.html | @@ -69,8 +69,7 @@
var container, stats;
var camera, scene, renderer, controls;
- var torusMesh, planeMesh;
- var nodeMaterial;
+ var torusMesh, torusMeshNode, planeMesh;
var ldrCubeRenderTarget, hdrCubeRenderTarget, rgbmCubeRenderTarget;
var ldrCubeMap, hdrCubeMap, rgbmCubeMap;
@@ -94,31 +93,27 @@
//
var geometry = new THREE.TorusKnotBufferGeometry( 18, 8, 150, 20 );
- //geometry = new THREE.SphereBufferGeometry(20, 100, 100);
- var material = new THREE.MeshStandardMaterial( {
- color: 0xffffff,
- metalness: params.metalness,
- roughness: params.roughness
- } );
+ var material;
+
+ material = new THREE.MeshStandardMaterial();
+ material.color = new THREE.Color( 0xffffff );
+ material.roughness = params.metalness;
+ material.metalness = params.roguhness;
torusMesh = new THREE.Mesh( geometry, material );
torusMesh.position.y = 35;
scene.add( torusMesh );
- nodeMaterial = new THREE.StandardNodeMaterial();
- nodeMaterial.color = new THREE.ColorNode(new THREE.Color(1, 1, 1))
- nodeMaterial.roughness = new THREE.FloatNode(params.metalness);
- nodeMaterial.metalness = new THREE.FloatNode(params.roguhness);
+ material = new THREE.MeshStandardNodeMaterial();
+ material.color = new THREE.Color( 0xffffff );
+ material.roughness = params.metalness;
+ material.metalness = params.roguhness;
- var torusMeshNode = new THREE.Mesh( geometry, nodeMaterial );
+ torusMeshNode = new THREE.Mesh( geometry, material );
torusMeshNode.position.y = -35;
scene.add( torusMeshNode );
-
- var geometry = new THREE.PlaneBufferGeometry( 200, 200 );
- var material = new THREE.MeshBasicMaterial();
-
- planeMesh = new THREE.Mesh( geometry, material );
+ planeMesh = new THREE.Mesh( new THREE.PlaneBufferGeometry( 200, 200 ), new THREE.MeshBasicMaterial() );
planeMesh.position.y = - 50;
planeMesh.rotation.x = - Math.PI * 0.5;
scene.add( planeMesh );
@@ -244,8 +239,8 @@
torusMesh.material.roughness = params.roughness;
torusMesh.material.metalness = params.metalness;
- nodeMaterial.roughness.value = params.roughness;
- nodeMaterial.metalness.value = params.metalness;
+ torusMeshNode.material.roughness = params.roughness;
+ torusMeshNode.material.metalness = params.metalness;
var renderTarget, cubeMap;
@@ -272,29 +267,12 @@
torusMesh.material.envMap = newEnvMap;
torusMesh.material.needsUpdate = true;
+ torusMeshNode.material.envMap = newEnvMap;
+ torusMeshNode.material.needsUpdate = true;
+
planeMesh.material.map = newEnvMap;
planeMesh.material.needsUpdate = true;
- var textureNode = new THREE.TextureNode(newEnvMap);
- textureNode.encodingOverride = newEnvMap.encoding;
-
- nodeMaterial.environment = new THREE.TextureCubeNode(
- textureNode
- );
- nodeMaterial.environment.uv.blinnExponentToRoughness = nodeMaterial.roughness;
-
- nodeMaterial.ambient = new THREE.TextureCubeNode(
- textureNode
- );
- nodeMaterial.ambient.uv.blinnExponentToRoughness = new THREE.FloatNode(1);
- nodeMaterial.ambient.uv.uv = new THREE.NormalNode(THREE.NormalNode.WORLD);
- nodeMaterial.ambient = new THREE.OperatorNode(
- nodeMaterial.ambient,
- new THREE.FloatNode(Math.PI),
- THREE.OperatorNode.MUL);
-
- nodeMaterial.needsUpdate = true;
-
}
//torusMesh.rotation.y += 0.005; | true |
Other | mrdoob | three.js | a58f98edd316dfea85cb477071da9362df21ab74.json | remove unneccessary assignement | examples/js/geometries/LightningStrike.js | @@ -831,8 +831,7 @@ THREE.LightningStrike.prototype.createDefaultSubrayCreationCallbacks = function
var childSubraySeed = random1() * ( currentCycle + 1 );
var isActive = phase % period <= dutyCycle * period;
-
- probability = lightningStrike.subrayProbability;
+
var probability = 0;
if ( isActive ) { | true |
Other | mrdoob | three.js | a58f98edd316dfea85cb477071da9362df21ab74.json | remove unneccessary assignement | examples/jsm/geometries/LightningStrike.js | @@ -841,8 +841,7 @@ LightningStrike.prototype.createDefaultSubrayCreationCallbacks = function () {
var childSubraySeed = random1() * ( currentCycle + 1 );
var isActive = phase % period <= dutyCycle * period;
-
- probability = lightningStrike.subrayProbability;
+
var probability = 0;
if ( isActive ) { | true |
Other | mrdoob | three.js | 9d0f2651c22183341fb694f8a4796f7293be0f19.json | remove LGTM Errors | examples/js/loaders/XLoader.js | @@ -204,7 +204,7 @@ THREE.XLoader = ( function () {
classCallCheck( this, XLoader );
this.debug = false;
- this.manager = manager !== undefined ? manager : new THREE.DefaultLoadingManager();
+ this.manager = manager !== undefined ? manager : THREE.DefaultLoadingManager;
this.texloader = new THREE.TextureLoader( this.manager );
this.url = "";
this._putMatLength = 0; | true |
Other | mrdoob | three.js | 9d0f2651c22183341fb694f8a4796f7293be0f19.json | remove LGTM Errors | examples/jsm/loaders/XLoader.js | @@ -226,7 +226,7 @@ var XLoader = ( function () {
classCallCheck( this, XLoader );
this.debug = false;
- this.manager = manager !== undefined ? manager : new DefaultLoadingManager();
+ this.manager = manager !== undefined ? manager : DefaultLoadingManager;
this.texloader = new TextureLoader( this.manager );
this.url = "";
this._putMatLength = 0; | true |
Other | mrdoob | three.js | e1bfbac95bcba147debae2c51d921d7ea0e24833.json | remove functions from closures in Color | src/math/Color.js | @@ -42,6 +42,29 @@ function Color( r, g, b ) {
}
+function hue2rgb( p, q, t ) {
+
+ if ( t < 0 ) t += 1;
+ if ( t > 1 ) t -= 1;
+ if ( t < 1 / 6 ) return p + ( q - p ) * 6 * t;
+ if ( t < 1 / 2 ) return q;
+ if ( t < 2 / 3 ) return p + ( q - p ) * 6 * ( 2 / 3 - t );
+ return p;
+
+}
+
+function SRGBToLinear( c ) {
+
+ return ( c < 0.04045 ) ? c * 0.0773993808 : Math.pow( c * 0.9478672986 + 0.0521327014, 2.4 );
+
+}
+
+function LinearToSRGB( c ) {
+
+ return ( c < 0.0031308 ) ? c * 12.92 : 1.055 * ( Math.pow( c, 0.41666 ) ) - 0.055;
+
+}
+
Object.assign( Color.prototype, {
isColor: true,
@@ -100,46 +123,31 @@ Object.assign( Color.prototype, {
},
- setHSL: function () {
-
- function hue2rgb( p, q, t ) {
+ setHSL: function ( h, s, l ) {
- if ( t < 0 ) t += 1;
- if ( t > 1 ) t -= 1;
- if ( t < 1 / 6 ) return p + ( q - p ) * 6 * t;
- if ( t < 1 / 2 ) return q;
- if ( t < 2 / 3 ) return p + ( q - p ) * 6 * ( 2 / 3 - t );
- return p;
-
- }
-
- return function setHSL( h, s, l ) {
-
- // h,s,l ranges are in 0.0 - 1.0
- h = _Math.euclideanModulo( h, 1 );
- s = _Math.clamp( s, 0, 1 );
- l = _Math.clamp( l, 0, 1 );
-
- if ( s === 0 ) {
+ // h,s,l ranges are in 0.0 - 1.0
+ h = _Math.euclideanModulo( h, 1 );
+ s = _Math.clamp( s, 0, 1 );
+ l = _Math.clamp( l, 0, 1 );
- this.r = this.g = this.b = l;
+ if ( s === 0 ) {
- } else {
+ this.r = this.g = this.b = l;
- var p = l <= 0.5 ? l * ( 1 + s ) : l + s - ( l * s );
- var q = ( 2 * l ) - p;
+ } else {
- this.r = hue2rgb( q, p, h + 1 / 3 );
- this.g = hue2rgb( q, p, h );
- this.b = hue2rgb( q, p, h - 1 / 3 );
+ var p = l <= 0.5 ? l * ( 1 + s ) : l + s - ( l * s );
+ var q = ( 2 * l ) - p;
- }
+ this.r = hue2rgb( q, p, h + 1 / 3 );
+ this.g = hue2rgb( q, p, h );
+ this.b = hue2rgb( q, p, h - 1 / 3 );
- return this;
+ }
- };
+ return this;
- }(),
+ },
setStyle: function ( style ) {
@@ -329,45 +337,25 @@ Object.assign( Color.prototype, {
},
- copySRGBToLinear: function () {
-
- function SRGBToLinear( c ) {
-
- return ( c < 0.04045 ) ? c * 0.0773993808 : Math.pow( c * 0.9478672986 + 0.0521327014, 2.4 );
-
- }
+ copySRGBToLinear: function ( color ) {
- return function copySRGBToLinear( color ) {
+ this.r = SRGBToLinear( color.r );
+ this.g = SRGBToLinear( color.g );
+ this.b = SRGBToLinear( color.b );
- this.r = SRGBToLinear( color.r );
- this.g = SRGBToLinear( color.g );
- this.b = SRGBToLinear( color.b );
-
- return this;
-
- };
-
- }(),
-
- copyLinearToSRGB: function () {
-
- function LinearToSRGB( c ) {
-
- return ( c < 0.0031308 ) ? c * 12.92 : 1.055 * ( Math.pow( c, 0.41666 ) ) - 0.055;
-
- }
+ return this;
- return function copyLinearToSRGB( color ) {
+ },
- this.r = LinearToSRGB( color.r );
- this.g = LinearToSRGB( color.g );
- this.b = LinearToSRGB( color.b );
+ copyLinearToSRGB: function ( color ) {
- return this;
+ this.r = LinearToSRGB( color.r );
+ this.g = LinearToSRGB( color.g );
+ this.b = LinearToSRGB( color.b );
- };
+ return this;
- }(),
+ },
convertSRGBToLinear: function () {
@@ -574,7 +562,7 @@ Object.assign( Color.prototype, {
if ( offset === undefined ) offset = 0;
this.r = array[ offset ];
- this.g = array[ offset + 1 ];
+ this.g = array[ offset + 1 ];
this.b = array[ offset + 2 ];
return this; | false |
Other | mrdoob | three.js | 8f43ad2e7f84e630ee775f960e1f864ca13de3b9.json | add modularized VRMLLoader | examples/jsm/loaders/VRMLLoader.js | @@ -1893,7 +1893,7 @@ var VRMLLoader = ( function () {
// an index of -1 indicates that the current face has ended and the next one begins
- if ( index[ i + 3 ] === - 1 ) {
+ if ( index[ i + 3 ] === - 1 || i + 3 >= l ) {
i += 3;
start = i + 1;
@@ -1924,7 +1924,7 @@ var VRMLLoader = ( function () {
// an index of -1 indicates that the current face has ended and the next one begins
- if ( index[ i + 3 ] === - 1 ) {
+ if ( index[ i + 3 ] === - 1 || i + 3 >= l ) {
i += 3;
start ++;
@@ -1972,7 +1972,7 @@ var VRMLLoader = ( function () {
// an index of -1 indicates that the current line has ended and the next one begins
- if ( index[ i + 2 ] === - 1 ) {
+ if ( index[ i + 2 ] === - 1 || i + 2 >= l ) {
i += 2;
@@ -2002,7 +2002,7 @@ var VRMLLoader = ( function () {
// an index of -1 indicates that the current line has ended and the next one begins
- if ( index[ i + 2 ] === - 1 ) {
+ if ( index[ i + 2 ] === - 1 || i + 2 >= l ) {
i += 2;
start ++; | false |
Other | mrdoob | three.js | 76d1e9d1b95633b52228d595b878052f41e8fed8.json | Fix parsing of CoordIndex when not ending with -1
According to [1](http://www.graphics.stanford.edu/courses/cs248-98-fall/Assignments/Assignment3/VRML2_Specification/spec/part1/nodesRef.html#IndexedFaceSet) 'The last face may (but does not have to be) followed by a -1.' | examples/js/loaders/VRMLLoader.js | @@ -1860,7 +1860,7 @@ THREE.VRMLLoader = ( function () {
// an index of -1 indicates that the current face has ended and the next one begins
- if ( index[ i + 3 ] === - 1 ) {
+ if ( index[ i + 3 ] === - 1 || i + 3 >= l ) {
i += 3;
start = i + 1;
@@ -1891,7 +1891,7 @@ THREE.VRMLLoader = ( function () {
// an index of -1 indicates that the current face has ended and the next one begins
- if ( index[ i + 3 ] === - 1 ) {
+ if ( index[ i + 3 ] === - 1 || i + 3 >= l ) {
i += 3;
start ++;
@@ -1939,7 +1939,7 @@ THREE.VRMLLoader = ( function () {
// an index of -1 indicates that the current line has ended and the next one begins
- if ( index[ i + 2 ] === - 1 ) {
+ if ( index[ i + 2 ] === - 1 || i + 2 >= l ) {
i += 2;
@@ -1969,7 +1969,7 @@ THREE.VRMLLoader = ( function () {
// an index of -1 indicates that the current line has ended and the next one begins
- if ( index[ i + 2 ] === - 1 ) {
+ if ( index[ i + 2 ] === - 1 || i + 2 >= l ) {
i += 2;
start ++; | false |
Other | mrdoob | three.js | 9b7de2df47f49d3c0895039b21ea32750928e587.json | Remove cache from Array of Vectors uniforms | src/renderers/webgl/WebGLUniforms.js | @@ -523,41 +523,26 @@ function setValue1iv( gl, v ) {
function setValueV2a( gl, v ) {
- var cache = this.cache;
var data = flatten( v, this.size, 2 );
- if ( arraysEqual( cache, data ) ) return;
-
gl.uniform2fv( this.addr, data );
- this.updateCache( data );
-
}
function setValueV3a( gl, v ) {
- var cache = this.cache;
var data = flatten( v, this.size, 3 );
- if ( arraysEqual( cache, data ) ) return;
-
gl.uniform3fv( this.addr, data );
- this.updateCache( data );
-
}
function setValueV4a( gl, v ) {
- var cache = this.cache;
var data = flatten( v, this.size, 4 );
- if ( arraysEqual( cache, data ) ) return;
-
gl.uniform4fv( this.addr, data );
- this.updateCache( data );
-
}
// Array of matrices (flat or from THREE clases) | false |
Other | mrdoob | three.js | 92b3f3a6d08be690053ad1689266931ec7278f67.json | Remove cache from Array of Textures uniforms | src/renderers/webgl/WebGLUniforms.js | @@ -590,17 +590,11 @@ function setValueM4a( gl, v ) {
function setValueT1a( gl, v, textures ) {
- var cache = this.cache;
var n = v.length;
var units = allocTexUnits( textures, n );
- if ( arraysEqual( cache, units ) === false ) {
-
- gl.uniform1iv( this.addr, units );
- copyArray( cache, units );
-
- }
+ gl.uniform1iv( this.addr, units );
for ( var i = 0; i !== n; ++ i ) {
@@ -612,17 +606,11 @@ function setValueT1a( gl, v, textures ) {
function setValueT6a( gl, v, textures ) {
- var cache = this.cache;
var n = v.length;
var units = allocTexUnits( textures, n );
- if ( arraysEqual( cache, units ) === false ) {
-
- gl.uniform1iv( this.addr, units );
- copyArray( cache, units );
-
- }
+ gl.uniform1iv( this.addr, units );
for ( var i = 0; i !== n; ++ i ) {
| false |
Other | mrdoob | three.js | 310bd2b38764b33f3c61820b4b7aecef86ad3c74.json | Remove cache from Array of Matrices uniforms | src/renderers/webgl/WebGLUniforms.js | @@ -564,41 +564,26 @@ function setValueV4a( gl, v ) {
function setValueM2a( gl, v ) {
- var cache = this.cache;
var data = flatten( v, this.size, 4 );
- if ( arraysEqual( cache, data ) ) return;
-
gl.uniformMatrix2fv( this.addr, false, data );
- this.updateCache( data );
-
}
function setValueM3a( gl, v ) {
- var cache = this.cache;
var data = flatten( v, this.size, 9 );
- if ( arraysEqual( cache, data ) ) return;
-
gl.uniformMatrix3fv( this.addr, false, data );
- this.updateCache( data );
-
}
function setValueM4a( gl, v ) {
- var cache = this.cache;
var data = flatten( v, this.size, 16 );
- if ( arraysEqual( cache, data ) ) return;
-
gl.uniformMatrix4fv( this.addr, false, data );
- this.updateCache( data );
-
}
// Array of textures (2D / Cube) | false |
Other | mrdoob | three.js | 4ebaeb20e31d0d4109c9999c2acce28b33831d5c.json | Update remaining issues | docs/api/en/helpers/AxesHelper.html | @@ -8,7 +8,7 @@
<link type="text/css" rel="stylesheet" href="page.css" />
</head>
<body>
- [page:LineSegments] →
+ [page:Object3D] → [page:Line] → [page:LineSegments] →
<h1>[name]</h1>
| true |
Other | mrdoob | three.js | 4ebaeb20e31d0d4109c9999c2acce28b33831d5c.json | Update remaining issues | docs/api/en/helpers/Box3Helper.html | @@ -8,7 +8,7 @@
<link type="text/css" rel="stylesheet" href="page.css" />
</head>
<body>
- [page:LineSegments] →
+ [page:Object3D] → [page:Line] → [page:LineSegments] →
<h1>[name]</h1>
| true |
Other | mrdoob | three.js | 4ebaeb20e31d0d4109c9999c2acce28b33831d5c.json | Update remaining issues | docs/api/en/helpers/BoxHelper.html | @@ -8,7 +8,7 @@
<link type="text/css" rel="stylesheet" href="page.css" />
</head>
<body>
- [page:LineSegments] →
+ [page:Object3D] → [page:Line] → [page:LineSegments] →
<h1>[name]</h1>
| true |
Other | mrdoob | three.js | 4ebaeb20e31d0d4109c9999c2acce28b33831d5c.json | Update remaining issues | docs/api/en/helpers/CameraHelper.html | @@ -8,7 +8,7 @@
<link type="text/css" rel="stylesheet" href="page.css" />
</head>
<body>
- [page:LineSegments] →
+ [page:Object3D] → [page:Line] → [page:LineSegments] →
<h1>[name]</h1>
| true |
Other | mrdoob | three.js | 4ebaeb20e31d0d4109c9999c2acce28b33831d5c.json | Update remaining issues | docs/api/en/helpers/FaceNormalsHelper.html | @@ -8,7 +8,7 @@
<link type="text/css" rel="stylesheet" href="page.css" />
</head>
<body>
- [page:LineSegments] →
+ [page:Object3D] → [page:Line] → [page:LineSegments] →
<h1>[name]</h1>
| true |
Other | mrdoob | three.js | 4ebaeb20e31d0d4109c9999c2acce28b33831d5c.json | Update remaining issues | docs/api/en/helpers/GridHelper.html | @@ -8,8 +8,8 @@
<link type="text/css" rel="stylesheet" href="page.css" />
</head>
<body>
- [page:Line] →
-
+ [page:Object3D] → [page:Line] →
+
<h1>[name]</h1>
<p class="desc">The GridHelper is an object to define grids. Grids are two-dimensional arrays of lines.</p> | true |
Other | mrdoob | three.js | 4ebaeb20e31d0d4109c9999c2acce28b33831d5c.json | Update remaining issues | docs/api/en/helpers/PlaneHelper.html | @@ -8,7 +8,7 @@
<link type="text/css" rel="stylesheet" href="page.css" />
</head>
<body>
- [page:LineSegments] →
+ [page:Object3D] → [page:Line] → [page:LineSegments] →
<h1>[name]</h1>
| true |
Other | mrdoob | three.js | 4ebaeb20e31d0d4109c9999c2acce28b33831d5c.json | Update remaining issues | docs/api/en/helpers/PointLightHelper.html | @@ -8,7 +8,7 @@
<link type="text/css" rel="stylesheet" href="page.css" />
</head>
<body>
- [page:Mesh] →
+ [page:Object3D] → [page:Mesh] →
<h1>[name]</h1>
| true |
Other | mrdoob | three.js | 4ebaeb20e31d0d4109c9999c2acce28b33831d5c.json | Update remaining issues | docs/api/en/helpers/PolarGridHelper.html | @@ -8,7 +8,7 @@
<link type="text/css" rel="stylesheet" href="page.css" />
</head>
<body>
- [page:Line] →
+ [page:Object3D] → [page:Line] →
<h1>[name]</h1>
| true |
Other | mrdoob | three.js | 4ebaeb20e31d0d4109c9999c2acce28b33831d5c.json | Update remaining issues | docs/api/en/helpers/VertexNormalsHelper.html | @@ -8,7 +8,7 @@
<link type="text/css" rel="stylesheet" href="page.css" />
</head>
<body>
- [page:Line] →
+ [page:Object3D] → [page:Line] →
<h1>[name]</h1>
| true |
Other | mrdoob | three.js | 4ebaeb20e31d0d4109c9999c2acce28b33831d5c.json | Update remaining issues | docs/api/en/materials/RawShaderMaterial.html | @@ -8,7 +8,7 @@
<link type="text/css" rel="stylesheet" href="page.css" />
</head>
<body>
- [page:ShaderMaterial] →
+ [page:Material] → [page:ShaderMaterial] →
<h1>[name]</h1>
| true |
Other | mrdoob | three.js | c9bf463989f1e27eaac9e558cea66dbdcb2d11e3.json | Fix documentation related to MTLLoader materials
MTLLoader returns materials as MTLLoader.MaterialCreator, not as an array, and this is the type that OBJLoader.setMaterials takes as a parameter. | docs/examples/loaders/MTLLoader.html | @@ -94,7 +94,7 @@ <h3>[method:MTLLoaderMaterialCreator parse]( [param:String text, param:String pa
[page:String path] — The path to the MTL file.
</p>
<p>
- Parse a <em>mtl</em> text structure and return a [page:MTLLoaderMaterialCreator] instance.<br />
+ Parse a <em>mtl</em> text structure and return a [page:MTLLoaderMaterialCreator MTLLoader.MaterialCreator] instance.<br />
</p>
| true |
Other | mrdoob | three.js | c9bf463989f1e27eaac9e558cea66dbdcb2d11e3.json | Fix documentation related to MTLLoader materials
MTLLoader returns materials as MTLLoader.MaterialCreator, not as an array, and this is the type that OBJLoader.setMaterials takes as a parameter. | docs/examples/loaders/OBJLoader.html | @@ -89,12 +89,12 @@ <h3>[method:Object3D parse]( [param:String text] )</h3>
If an <em>obj</em> object or group uses multiple materials while declaring faces, geometry groups and an array of materials are used.
</p>
- <h3>[method:OBJLoader setMaterials]( [param:Array materials] )</h3>
+ <h3>[method:OBJLoader setMaterials]( [param:MTLLoader.MaterialCreator materials] )</h3>
<p>
- [page:Array materials] - Array of [page:Material Materials].
+ [page:MTLLoaderMaterialCreator MTLLoader.MaterialCreator materials] - A MaterialCreator instance.
</p>
<p>
- Sets materials loaded by MTLLoader or any other supplier of an Array of [page:Material Materials].
+ Sets materials loaded by MTLLoader or any other supplier of a [page:MTLLoaderMaterialCreator MTLLoader.MaterialCreator].
</p>
<h3>[method:OBJLoader setPath]( [param:String path] )</h3> | true |
Other | mrdoob | three.js | 789f648d85ba6acef485d6ded83514affc2de31d.json | fix code example | docs/api/en/helpers/BoxHelper.html | @@ -30,23 +30,30 @@ <h2>Example</h2>
<code>
// Creating the object whose bounding box we want to compute
var sphereGeom = new THREE.SphereGeometry();
- var sphereObject = new THREE.Mesh( sphereGeom, new THREE.MeshBasicMaterial( 0xff0000 ) );
+ var sphereObject = new THREE.Mesh(
+ sphereGeom,
+ new THREE.MeshBasicMaterial( 0xff0000 )
+ );
// Creating the helper and displaying it in the scene
var helper = new THREE.BoxHelper( sphereObject, 0xffff00 );
scene.add( helper );
- // Creating the actual bounding box (on which we can test intersection with other Box3 objects)
- var box3 = new THREE.Box3();
- // Shape and position the box after the object
- box3.setFromObject( sphere );
+ // Creating the actual bounding box
+ // (on which we can test intersection with other Box3 objects)
+ sphereObject.geometry.computeBoundingBox();
+ var BBox = new THREE.Box3(
+ sphereObject.geometry.boundingBox.min,
+ sphereObject.geometry.boundingBox.max
+ );
- // Let's move the sphere
+ // Moving the sphere
sphereObject.position.set( 7, 7, 7 );
- // Whenever the object is moved or rotated or scaled, we update both the bounding box and the helper
- helper.update();
- box3.setFromObject( sphereObject );
+ // Updating both the bounding box and the helper
+ // (to repeat each time the object is moved, rotated or scaled)
+ BBox.copy( sphereObject.geometry.boundingBox ).applyMatrix4( sphereObject.matrixWorld );
+ helper.update();
</code>
| false |
Other | mrdoob | three.js | 6dca3f00903117704898a799552b6ffad34f709d.json | Upgrade dev dependencies | package-lock.json | @@ -1,6 +1,6 @@
{
"name": "three",
- "version": "0.102.1",
+ "version": "0.104.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@@ -30,6 +30,12 @@
"integrity": "sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw==",
"dev": true
},
+ "@types/node": {
+ "version": "11.13.8",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-11.13.8.tgz",
+ "integrity": "sha512-szA3x/3miL90ZJxUCzx9haNbK5/zmPieGraZEe4WI+3srN0eGLiT22NXeMHmyhNEopn+IrxqMc7wdVwvPl8meg==",
+ "dev": true
+ },
"acorn": {
"version": "6.1.1",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-6.1.1.tgz",
@@ -43,9 +49,9 @@
"dev": true
},
"ajv": {
- "version": "6.9.2",
- "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.9.2.tgz",
- "integrity": "sha512-4UFy0/LgDo7Oa/+wOAlj44tp9K78u38E5/359eSrqEp1Z5PdVfimCcs7SluXMP755RUQu6d2b4AvF0R1C9RZjg==",
+ "version": "6.10.0",
+ "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.10.0.tgz",
+ "integrity": "sha512-nffhOpkymDECQyR0mnsUtoCE8RlX38G0rYP+wgLWFyZuUyuuojSSvi/+euOiQBIn63whYwYVIIH1TvE3tu4OEg==",
"dev": true,
"requires": {
"fast-deep-equal": "^2.0.1",
@@ -119,9 +125,9 @@
"dev": true
},
"callsites": {
- "version": "3.0.0",
- "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.0.0.tgz",
- "integrity": "sha512-tWnkwu9YEq2uzlBDI4RcLn8jrFvF9AOi8PxDNU3hZZjJcjkcRAq3vCI+vZcg1SuxISDYe86k9VZFwAxDiJGoAw==",
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz",
+ "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==",
"dev": true
},
"camelcase": {
@@ -211,38 +217,6 @@
"inherits": "^2.0.1",
"process-nextick-args": "^2.0.0",
"readable-stream": "^2.3.5"
- },
- "dependencies": {
- "isarray": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
- "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=",
- "dev": true
- },
- "readable-stream": {
- "version": "2.3.6",
- "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz",
- "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==",
- "dev": true,
- "requires": {
- "core-util-is": "~1.0.0",
- "inherits": "~2.0.3",
- "isarray": "~1.0.0",
- "process-nextick-args": "~2.0.0",
- "safe-buffer": "~5.1.1",
- "string_decoder": "~1.1.1",
- "util-deprecate": "~1.0.1"
- }
- },
- "string_decoder": {
- "version": "1.1.1",
- "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
- "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
- "dev": true,
- "requires": {
- "safe-buffer": "~5.1.0"
- }
- }
}
},
"code-point-at": {
@@ -465,9 +439,9 @@
"dev": true
},
"eslint": {
- "version": "5.15.0",
- "resolved": "https://registry.npmjs.org/eslint/-/eslint-5.15.0.tgz",
- "integrity": "sha512-xwG7SS5JLeqkiR3iOmVgtF8Y6xPdtr6AAsN6ph7Q6R/fv+3UlKYoika8SmNzmb35qdRF+RfTY35kMEdtbi+9wg==",
+ "version": "5.16.0",
+ "resolved": "https://registry.npmjs.org/eslint/-/eslint-5.16.0.tgz",
+ "integrity": "sha512-S3Rz11i7c8AA5JPv7xAH+dOyq/Cu/VXHiHXBPOU1k/JAM5dXqQPt3qcrhpHSorXmrpu2g0gkIBVXAqCpzfoZIg==",
"dev": true,
"requires": {
"@babel/code-frame": "^7.0.0",
@@ -476,7 +450,7 @@
"cross-spawn": "^6.0.5",
"debug": "^4.0.1",
"doctrine": "^3.0.0",
- "eslint-scope": "^4.0.2",
+ "eslint-scope": "^4.0.3",
"eslint-utils": "^1.3.1",
"eslint-visitor-keys": "^1.0.0",
"espree": "^5.0.1",
@@ -490,7 +464,7 @@
"import-fresh": "^3.0.0",
"imurmurhash": "^0.1.4",
"inquirer": "^6.2.2",
- "js-yaml": "^3.12.0",
+ "js-yaml": "^3.13.0",
"json-stable-stringify-without-jsonify": "^1.0.1",
"levn": "^0.3.0",
"lodash": "^4.17.11",
@@ -541,9 +515,9 @@
}
},
"eslint-scope": {
- "version": "4.0.2",
- "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-4.0.2.tgz",
- "integrity": "sha512-5q1+B/ogmHl8+paxtOKx38Z8LtWkVGuNt3+GQNErqwLl6ViNp/gdJGMCjZNxZ8j/VYjDNZ2Fo+eQc1TAVPIzbg==",
+ "version": "4.0.3",
+ "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-4.0.3.tgz",
+ "integrity": "sha512-p7VutNr1O/QrxysMo3E45FjYDTeXBy0iTltPFNSqKAIfjDSXC+4dj+qfyuD8bfAXrW/y6lW3O76VaYNPKfpKrg==",
"dev": true,
"requires": {
"esrecurse": "^4.1.0",
@@ -771,16 +745,16 @@
"dev": true
},
"google-closure-compiler": {
- "version": "20190215.0.2",
- "resolved": "https://registry.npmjs.org/google-closure-compiler/-/google-closure-compiler-20190215.0.2.tgz",
- "integrity": "sha512-yhxVcm2bl05IoombIiTs5mRZChjJaOg4riFtrtsJrJL8WR1a2lz3btH6giX4+NgWduD5LNg4joF9BT4xLfzkIQ==",
+ "version": "20190415.0.0",
+ "resolved": "https://registry.npmjs.org/google-closure-compiler/-/google-closure-compiler-20190415.0.0.tgz",
+ "integrity": "sha512-WK4E5aSYZX7YfKR6YfahrioijOjJw7yC0F+gi1a4W3twqWXS4scuRxsmqhrDdTpDwHLMHNFEOHcrwcjr3iqC9w==",
"dev": true,
"requires": {
"chalk": "^1.0.0",
- "google-closure-compiler-java": "^20190215.0.1",
- "google-closure-compiler-js": "^20190215.0.1",
- "google-closure-compiler-linux": "^20190215.0.1",
- "google-closure-compiler-osx": "^20190215.0.1",
+ "google-closure-compiler-java": "^20190415.0.0",
+ "google-closure-compiler-js": "^20190415.0.0",
+ "google-closure-compiler-linux": "^20190415.0.0",
+ "google-closure-compiler-osx": "^20190415.0.0",
"minimist": "^1.2.0",
"vinyl": "^2.0.1",
"vinyl-sourcemaps-apply": "^0.2.0"
@@ -829,28 +803,28 @@
}
},
"google-closure-compiler-java": {
- "version": "20190215.0.2",
- "resolved": "https://registry.npmjs.org/google-closure-compiler-java/-/google-closure-compiler-java-20190215.0.2.tgz",
- "integrity": "sha512-G/H5X47DQ2NqJc47aMQw/8RJ8m4+CDufabEm07Q3K7QHyxA7heHPHzFE/4Z+PZhKa+sGNmBqfsVt6SRfdDYp9A==",
+ "version": "20190415.0.0",
+ "resolved": "https://registry.npmjs.org/google-closure-compiler-java/-/google-closure-compiler-java-20190415.0.0.tgz",
+ "integrity": "sha512-7XpiMW7ltsWbFtPbdGYrTZpgm/hxM9q8uWGwOvPAG0qA2cDFfspuU6L1kauqMvrHZ2ItLH5j6bQXdEmRHC2HwA==",
"dev": true
},
"google-closure-compiler-js": {
- "version": "20190215.0.2",
- "resolved": "https://registry.npmjs.org/google-closure-compiler-js/-/google-closure-compiler-js-20190215.0.2.tgz",
- "integrity": "sha512-tBu+xxFTZxo/SNz0NkZzSaO1L0EblyulCLBxsDtOsohyprXBAmoti8Cp2ZakzTmlnSp7dT8sbCemjehxXMQPfg==",
+ "version": "20190415.0.0",
+ "resolved": "https://registry.npmjs.org/google-closure-compiler-js/-/google-closure-compiler-js-20190415.0.0.tgz",
+ "integrity": "sha512-uAXOsQJ8veDCWCMf4FeVrL0S3K1lpsQD9JLJ91ToyTgFrpDHz3buwnYp5K1PsJDelGqEy6KflspQmdmPH+LSYg==",
"dev": true
},
"google-closure-compiler-linux": {
- "version": "20190215.0.2",
- "resolved": "https://registry.npmjs.org/google-closure-compiler-linux/-/google-closure-compiler-linux-20190215.0.2.tgz",
- "integrity": "sha512-gznwt/wE2GbvsKYSlCVBxGXwLuTuOf2ram12j8SCfdwptjJCCWWv+HupHlqXeDedDYzUWVCvhniSd6zExYOcvQ==",
+ "version": "20190415.0.0",
+ "resolved": "https://registry.npmjs.org/google-closure-compiler-linux/-/google-closure-compiler-linux-20190415.0.0.tgz",
+ "integrity": "sha512-unNvHrvezUTTdVU1SCdM7FIqbr2MH7v9qido9QtnnpM+/leJphl1fv48/8cHWwpUB8pOTOhkRuvdiUBLezD1Xg==",
"dev": true,
"optional": true
},
"google-closure-compiler-osx": {
- "version": "20190215.0.2",
- "resolved": "https://registry.npmjs.org/google-closure-compiler-osx/-/google-closure-compiler-osx-20190215.0.2.tgz",
- "integrity": "sha512-jg3ajI+ZKhfUg7t9W3zvDsZyfkR1zPppjat1i2RYsTBhFzhPWZHmoB0TPGPVI3xJ5/DNUEZ0QwwX0ybgldEE7A==",
+ "version": "20190415.0.0",
+ "resolved": "https://registry.npmjs.org/google-closure-compiler-osx/-/google-closure-compiler-osx-20190415.0.0.tgz",
+ "integrity": "sha512-b7xRDyFbTYnNu1u5SjvAvOs0ngKnMC9SMoSuXlpFrdTxizUJ4np97MAnP8KXKShbh7/1r0EzBq8NTUjgVFigQw==",
"dev": true,
"optional": true
},
@@ -1000,9 +974,9 @@
"dev": true
},
"inquirer": {
- "version": "6.2.2",
- "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-6.2.2.tgz",
- "integrity": "sha512-Z2rREiXA6cHRR9KBOarR3WuLlFzlIfAEIiB45ll5SSadMg7WqOh1MKEjjndfuH5ewXdixWCxqnVfGOQzPeiztA==",
+ "version": "6.3.1",
+ "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-6.3.1.tgz",
+ "integrity": "sha512-MmL624rfkFt4TG9y/Jvmt8vdmOo836U7Y0Hxr2aFk3RelZEGX4Igk0KabWrcaaZaTv9uzglOqWh1Vly+FAWAXA==",
"dev": true,
"requires": {
"ansi-escapes": "^3.2.0",
@@ -1016,14 +990,14 @@
"run-async": "^2.2.0",
"rxjs": "^6.4.0",
"string-width": "^2.1.0",
- "strip-ansi": "^5.0.0",
+ "strip-ansi": "^5.1.0",
"through": "^2.3.6"
},
"dependencies": {
"ansi-regex": {
- "version": "4.0.0",
- "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.0.0.tgz",
- "integrity": "sha512-iB5Dda8t/UqpPI/IjsejXu5jOGDrzn41wJyljwPH65VCIbk6+1BzFIMJGFwTNrYXT1CrD+B4l19U7awiQ8rk7w==",
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz",
+ "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==",
"dev": true
},
"chalk": {
@@ -1038,12 +1012,12 @@
}
},
"strip-ansi": {
- "version": "5.0.0",
- "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.0.0.tgz",
- "integrity": "sha512-Uu7gQyZI7J7gn5qLn1Np3G9vcYGTVqB+lFTytnDJv83dd8T22aGH451P3jueT2/QemInJDfxHB5Tde5OzgG1Ow==",
+ "version": "5.2.0",
+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz",
+ "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==",
"dev": true,
"requires": {
- "ansi-regex": "^4.0.0"
+ "ansi-regex": "^4.1.0"
}
},
"supports-color": {
@@ -1096,6 +1070,12 @@
"integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=",
"dev": true
},
+ "isarray": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
+ "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=",
+ "dev": true
+ },
"isexe": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
@@ -1115,9 +1095,9 @@
"dev": true
},
"js-yaml": {
- "version": "3.12.2",
- "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.12.2.tgz",
- "integrity": "sha512-QHn/Lh/7HhZ/Twc7vJYQTkjuCa0kaCcDcjK5Zlk2rvnUpy7DxMJ23+Jc2dcyvltwQVg1nygAVlB2oRDFHoRS5Q==",
+ "version": "3.13.1",
+ "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz",
+ "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==",
"dev": true,
"requires": {
"argparse": "^1.0.7",
@@ -1274,7 +1254,7 @@
"normalize-package-data": {
"version": "2.4.0",
"resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.4.0.tgz",
- "integrity": "sha512-9jjUFbTPfEy3R/ad/2oNbKtW9Hgovl5O1FvFWKkKblNXoN/Oou6+9+KKohPK13Yc3/TyunyWhJp6gvRNR/PPAw==",
+ "integrity": "sha1-EvlaMH1YNSB1oEkHuErIvpisAS8=",
"dev": true,
"requires": {
"hosted-git-info": "^2.1.4",
@@ -1420,9 +1400,9 @@
"dev": true
},
"parent-module": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.0.tgz",
- "integrity": "sha512-8Mf5juOMmiE4FcmzYc4IaiS9L3+9paz2KOiXzkRviCP6aDmN49Hz6EMWz0lGNp9pX80GvvAuLADtyGfW/Em3TA==",
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz",
+ "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==",
"dev": true,
"requires": {
"callsites": "^3.0.0"
@@ -1543,6 +1523,21 @@
"pify": "^3.0.0"
}
},
+ "readable-stream": {
+ "version": "2.3.6",
+ "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz",
+ "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==",
+ "dev": true,
+ "requires": {
+ "core-util-is": "~1.0.0",
+ "inherits": "~2.0.3",
+ "isarray": "~1.0.0",
+ "process-nextick-args": "~2.0.0",
+ "safe-buffer": "~5.1.1",
+ "string_decoder": "~1.1.1",
+ "util-deprecate": "~1.0.1"
+ }
+ },
"regexpp": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/regexpp/-/regexpp-2.0.1.tgz",
@@ -1614,22 +1609,14 @@
}
},
"rollup": {
- "version": "1.4.0",
- "resolved": "https://registry.npmjs.org/rollup/-/rollup-1.4.0.tgz",
- "integrity": "sha512-E5HP4rgvAqkXQNYfNHgCDnX5HDHwAPDLUVSNp8iTmT49vY34G0DxEfhjPWnqnFi7v0vQtDGkKl2hvLfmsMvmcA==",
+ "version": "1.10.1",
+ "resolved": "https://registry.npmjs.org/rollup/-/rollup-1.10.1.tgz",
+ "integrity": "sha512-pW353tmBE7QP622ITkGxtqF0d5gSRCVPD9xqM+fcPjudeZfoXMFW2sCzsTe2TU/zU1xamIjiS9xuFCPVT9fESw==",
"dev": true,
"requires": {
"@types/estree": "0.0.39",
- "@types/node": "^11.9.5",
+ "@types/node": "^11.13.5",
"acorn": "^6.1.1"
- },
- "dependencies": {
- "@types/node": {
- "version": "11.10.4",
- "resolved": "https://registry.npmjs.org/@types/node/-/node-11.10.4.tgz",
- "integrity": "sha512-wa09itaLE8L705aXd8F80jnFpxz3Y1/KRHfKsYL2bPc0XF+wEWu8sR9n5bmeu8Ba1N9z2GRNzm/YdHcghLkLKg==",
- "dev": true
- }
}
},
"run-async": {
@@ -1642,9 +1629,9 @@
}
},
"rxjs": {
- "version": "6.4.0",
- "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.4.0.tgz",
- "integrity": "sha512-Z9Yfa11F6B9Sg/BK9MnqnQ+aQYicPLtilXBp2yUtDt2JRCE0h26d33EnfO3ZxoNxG0T92OUucP3Ct7cpfkdFfw==",
+ "version": "6.5.1",
+ "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.5.1.tgz",
+ "integrity": "sha512-y0j31WJc83wPu31vS1VlAFW5JGrnGC+j+TtGAa1fRQphy48+fDYiDmX8tjGloToEsMkxnouOg/1IzXGKkJnZMg==",
"dev": true,
"requires": {
"tslib": "^1.9.0"
@@ -1721,7 +1708,7 @@
"spdx-correct": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.0.0.tgz",
- "integrity": "sha512-N19o9z5cEyc8yQQPukRCZ9EUmb4HUpnrmaL/fxS2pBo2jbfcFRVuFZ/oFC+vZz0MNNk0h80iMn5/S6qGZOL5+g==",
+ "integrity": "sha1-BaW01xU6GVvJLDxCW2nzsqlSTII=",
"dev": true,
"requires": {
"spdx-expression-parse": "^3.0.0",
@@ -1731,13 +1718,13 @@
"spdx-exceptions": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.1.0.tgz",
- "integrity": "sha512-4K1NsmrlCU1JJgUrtgEeTVyfx8VaYea9J9LvARxhbHtVtohPs/gFGG5yy49beySjlIMhhXZ4QqujIZEfS4l6Cg==",
+ "integrity": "sha1-LHrmEFbHFKW5ubKyr30xHvXHj+k=",
"dev": true
},
"spdx-expression-parse": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.0.tgz",
- "integrity": "sha512-Yg6D3XpRD4kkOmTpdgbUiEJFKghJH03fiC1OPll5h/0sO6neh2jqRDVHOQ4o/LMea0tgCkbMgea5ip/e+MkWyg==",
+ "integrity": "sha1-meEZt6XaAOBUkcn6M4t5BII7QdA=",
"dev": true,
"requires": {
"spdx-exceptions": "^2.1.0",
@@ -1747,7 +1734,7 @@
"spdx-license-ids": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.0.tgz",
- "integrity": "sha512-2+EPwgbnmOIl8HjGBXXMd9NAu02vLjOO1nWw4kmeRDFyHn+M/ETfHxQUK0oXg8ctgVnl9t3rosNVsZ1jG61nDA==",
+ "integrity": "sha1-enzShHDMbToc/m1miG9rxDDTrIc=",
"dev": true
},
"sprintf-js": {
@@ -1766,6 +1753,15 @@
"strip-ansi": "^4.0.0"
}
},
+ "string_decoder": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
+ "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
+ "dev": true,
+ "requires": {
+ "safe-buffer": "~5.1.0"
+ }
+ },
"strip-ansi": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz",
@@ -1817,29 +1813,29 @@
},
"dependencies": {
"ansi-regex": {
- "version": "4.0.0",
- "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.0.0.tgz",
- "integrity": "sha512-iB5Dda8t/UqpPI/IjsejXu5jOGDrzn41wJyljwPH65VCIbk6+1BzFIMJGFwTNrYXT1CrD+B4l19U7awiQ8rk7w==",
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz",
+ "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==",
"dev": true
},
"string-width": {
- "version": "3.0.0",
- "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.0.0.tgz",
- "integrity": "sha512-rr8CUxBbvOZDUvc5lNIJ+OC1nPVpz+Siw9VBtUjB9b6jZehZLFt0JMCZzShFHIsI8cbhm0EsNIfWJMFV3cu3Ew==",
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz",
+ "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==",
"dev": true,
"requires": {
"emoji-regex": "^7.0.1",
"is-fullwidth-code-point": "^2.0.0",
- "strip-ansi": "^5.0.0"
+ "strip-ansi": "^5.1.0"
}
},
"strip-ansi": {
- "version": "5.0.0",
- "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.0.0.tgz",
- "integrity": "sha512-Uu7gQyZI7J7gn5qLn1Np3G9vcYGTVqB+lFTytnDJv83dd8T22aGH451P3jueT2/QemInJDfxHB5Tde5OzgG1Ow==",
+ "version": "5.2.0",
+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz",
+ "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==",
"dev": true,
"requires": {
- "ansi-regex": "^4.0.0"
+ "ansi-regex": "^4.1.0"
}
}
} | true |
Other | mrdoob | three.js | 6dca3f00903117704898a799552b6ffad34f709d.json | Upgrade dev dependencies | package.json | @@ -56,13 +56,13 @@
"homepage": "https://threejs.org/",
"devDependencies": {
"concurrently": "^4.1.0",
- "eslint": "^5.15.0",
+ "eslint": "^5.16.0",
"eslint-config-mdcs": "^4.2.3",
"eslint-plugin-html": "^5.0.3",
- "google-closure-compiler": "20190215.0.2",
+ "google-closure-compiler": "20190415.0.0",
"http-server": "^0.11.1",
"qunit": "^2.9.2",
- "rollup": "^1.4.0"
+ "rollup": "^1.10.1"
},
"jspm": {
"files": [ | true |
Other | mrdoob | three.js | aed16bcf5b585bad668a23fdca81bcb0322d3017.json | correct box3 description | docs/api/en/math/Box3.html | @@ -12,8 +12,7 @@ <h1>[name]</h1>
<p class="desc">
Represents a box or cube in 3D space. The main purpose of this is to represent
- the [link:https://en.wikipedia.org/wiki/Minimum_bounding_box Minimum Bounding Boxes]
- for objects.
+ the world-axis-aligned bounding boxes for objects, which are used for fast collision detection.
</p>
| false |
Other | mrdoob | three.js | 13bb3315c5b0e74f3b4251b8833f1f04f3c64387.json | change minimum to axis-aligned bounding boxes | docs/api/en/helpers/BoxHelper.html | @@ -14,7 +14,7 @@ <h1>[name]</h1>
<p class="desc">
Helper object to show the world-axis-aligned bounding box around an object.
- It can be used in synergy with [page:Box3] items in order to easily compute the [link:https://en.wikipedia.org/wiki/Minimum_bounding_box Minimum Bounding Boxes] for objects, and use them for fast collision detection. See [page:Box3.intersect].
+ It can be used in synergy with [page:Box3] items in order to easily compute world-axis-aligned bounding boxes for objects, and use them for fast collision detection. See [page:Box3.intersect].
Note that the object must have a [page:Geometry] or [page:BufferGeometry] for this to work,
so it won't work with [page:Sprite Sprites].
</p> | false |
Other | mrdoob | three.js | 469b9679049419329e7d17479875c6db00ee95e8.json | fix typos in code example | docs/api/en/helpers/BoxHelper.html | @@ -34,20 +34,20 @@ <h2>Example</h2>
var sphereObject = new THREE.Mesh( sphereGeom, new THREE.MeshBasicMaterial( 0xff0000 ) );
// Creating the helper and displaying it in the scene
- var helper = new THREE.BoxHelper( object, 0xffff00 );
+ var helper = new THREE.BoxHelper( sphereObject, 0xffff00 );
scene.add( helper );
// Creating the actual bounding box (on which we can test intersection with other Box3 objects)
var box3 = new THREE.Box3();
// Shape and position the box after the helper
- box3.setFromObject(knotBoxHelper);
+ box3.setFromObject( helper );
// Let's move the sphere
- sphereObject.position.set(7, 7, 7);
+ sphereObject.position.set( 7, 7, 7 );
// Whenever the object is moved or rotated or scaled:
helper.update();
- box3.setFromObject(knotBoxHelper);
+ box3.setFromObject( helper );
</code>
| false |
Other | mrdoob | three.js | 11721f4feec1c181380d44e7d8415ff62199ee2a.json | improve docs for BoxHelper | docs/api/en/helpers/BoxHelper.html | @@ -13,7 +13,8 @@
<h1>[name]</h1>
<p class="desc">
- Helper object to show the world-axis-aligned bounding box around an object.
+ Helper object to show the world-axis-aligned bounding box around an object.
+ It can be used to work with [page:Box3] items in order to easily compute the [link:https://en.wikipedia.org/wiki/Minimum_bounding_box Minimum Bounding Boxes] for objects, which are often used for fast collision detection.
Note that the object must have a [page:Geometry] or [page:BufferGeometry] for this to work,
so it won't work with [page:Sprite Sprites].
@@ -28,10 +29,25 @@ <h2>Example</h2>
<code>
- var sphere = new THREE.SphereGeometry();
- var object = new THREE.Mesh( sphere, new THREE.MeshBasicMaterial( 0xff0000 ) );
- var box = new THREE.BoxHelper( object, 0xffff00 );
- scene.add( box );
+ // Creating the object whose bounding box we want to compute
+ var sphereGeom = new THREE.SphereGeometry();
+ var sphereObject = new THREE.Mesh( sphereGeom, new THREE.MeshBasicMaterial( 0xff0000 ) );
+
+ // Creating the helper and displaying it in the scene
+ var helper = new THREE.BoxHelper( object, 0xffff00 );
+ scene.add( helper );
+
+ // Creating the actual bounding box (on which we can test intersection with other Box3 objects)
+ var box3 = new THREE.Box3();
+ // Shape and position the box after the helper
+ box3.setFromObject(knotBoxHelper);
+
+ // Let's move the sphere
+ sphereObject.position.set(7, 7, 7);
+
+ // Whenever the object is moved or rotated or scaled:
+ helper.update();
+ box3.setFromObject(knotBoxHelper);
</code>
| false |
Other | mrdoob | three.js | 11ae6232065d52fb0412172bf1f5014ae5023efc.json | Add comment to WebGLBindingStates | src/renderers/webgl/WebGLBindingStates.js | @@ -162,6 +162,9 @@ function WebGLBindingStates( gl, extensions, attributes, capabilities ) {
}
+ // If we sacrifice some BufferGeometry/Attribute API flexibility
+ // needsUpdate() and saveCache() can be much simpler. See #16287
+
function needsUpdate( geometry ) {
var cachedAttributes = currentState.attributes; | false |
Other | mrdoob | three.js | 7e3c98a138476411472700d48fde3e4a6f7af3d3.json | Update LOD documents | docs/api/en/objects/LOD.html | @@ -55,9 +55,9 @@ <h2>Properties</h2>
<h3>[property:boolean autoUpdate]</h3>
<p>
- Default is true. If set, then the renderer calls [page:.update] every frame.
- When it isn't, then you have to manually call by yourself in the render loop
- for levels of detail to be updated dynamically.
+ Whether the LOD object is updated automatically by the renderer per frame or not.
+ If set to false, you have to call [page:LOD.update]() in the render loop by yourself.
+ Default is true.
</p>
<h3>[property:array levels]</h3> | true |
Other | mrdoob | three.js | 7e3c98a138476411472700d48fde3e4a6f7af3d3.json | Update LOD documents | docs/api/zh/objects/LOD.html | @@ -53,9 +53,9 @@ <h2>属性</h2>
<h3>[property:boolean autoUpdate]</h3>
<p>
- Default is true. If set, then the renderer calls [page:.update] every frame.
- When it isn't, then you have to manually call by yourself in the render loop
- for levels of detail to be updated dynamically.
+ Whether the LOD object is updated automatically by the renderer per frame or not.
+ If set to false, you have to call [page:LOD.update]() in the render loop by yourself.
+ Default is true.
</p>
<h3>[property:array levels]</h3> | true |
Other | mrdoob | three.js | a03fdbedeacb5c39352eae7d90bf529cc8d517b1.json | Improve inline comments | examples/webgl_materials_physical_transparency.html | @@ -96,8 +96,8 @@
envMap: hdrCubeRenderTarget.texture,
envMapIntensity: params.envMapIntensity,
depthWrite: false,
- opacity: 1, // set to 1 when transparency is non-zero
- transparency: params.transparency,
+ transparency: params.transparency, // use material.transparency for glass materials
+ opacity: 1, // set material.opacity to 1 when material.transparency is non-zero
transparent: true
} );
| false |
Other | mrdoob | three.js | 74d0bca4fa8c78ea00b1132f3c5f03b89d3d1887.json | Remove unused FrustumBoundingBox file | examples/jsm/csm/FrustumBoundingBox.js | @@ -1,83 +0,0 @@
-/**
- * @author vHawk / https://github.com/vHawk/
- */
-
-export default class FrustumBoundingBox {
-
- constructor() {
-
- this.min = {
- x: 0,
- y: 0,
- z: 0
- };
- this.max = {
- x: 0,
- y: 0,
- z: 0
- };
-
- }
-
- fromFrustum( frustum ) {
-
- const vertices = [];
-
- for ( let i = 0; i < 4; i ++ ) {
-
- vertices.push( frustum.vertices.near[ i ] );
- vertices.push( frustum.vertices.far[ i ] );
-
- }
-
- this.min = {
- x: vertices[ 0 ].x,
- y: vertices[ 0 ].y,
- z: vertices[ 0 ].z
- };
- this.max = {
- x: vertices[ 0 ].x,
- y: vertices[ 0 ].y,
- z: vertices[ 0 ].z
- };
-
- for ( let i = 1; i < 8; i ++ ) {
-
- this.min.x = Math.min( this.min.x, vertices[ i ].x );
- this.min.y = Math.min( this.min.y, vertices[ i ].y );
- this.min.z = Math.min( this.min.z, vertices[ i ].z );
- this.max.x = Math.max( this.max.x, vertices[ i ].x );
- this.max.y = Math.max( this.max.y, vertices[ i ].y );
- this.max.z = Math.max( this.max.z, vertices[ i ].z );
-
- }
-
- return this;
-
- }
-
- getSize() {
-
- this.size = {
- x: this.max.x - this.min.x,
- y: this.max.y - this.min.y,
- z: this.max.z - this.min.z
- };
-
- return this.size;
-
- }
-
- getCenter( margin ) {
-
- this.center = {
- x: ( this.max.x + this.min.x ) / 2,
- y: ( this.max.y + this.min.y ) / 2,
- z: this.max.z + margin
- };
-
- return this.center;
-
- }
-
-} | false |
Other | mrdoob | three.js | b28423f06196d2dbac84a3653aad8897af8558fc.json | replace use of FrustumBoundingBox with Box3 | examples/jsm/csm/CSM.js | @@ -13,17 +13,18 @@ import {
BufferGeometry,
BufferAttribute,
Line,
- Matrix4
+ Matrix4,
+ Box3
} from '../../../build/three.module.js';
import Frustum from './Frustum.js';
-import FrustumBoundingBox from './FrustumBoundingBox.js';
import Shader from './Shader.js';
const _cameraToLightMatrix = new Matrix4();
const _lightSpaceFrustum = new Frustum();
const _frustum = new Frustum();
const _center = new Vector3();
-const _bbox = new FrustumBoundingBox();
+const _size = new Vector3();
+const _bbox = new Box3();
export default class CSM {
@@ -166,20 +167,25 @@ export default class CSM {
for ( let i = 0; i < this.frustums.length; i ++ ) {
const light = this.lights[ i ];
+ light.shadow.camera.updateMatrixWorld( true );
_cameraToLightMatrix.multiplyMatrices( light.shadow.camera.matrixWorldInverse, cameraMatrix );
this.frustums[ i ].toSpace( _cameraToLightMatrix, _lightSpaceFrustum );
- light.shadow.camera.updateMatrixWorld( true );
+ _bbox.makeEmpty();
+ for ( let j = 0; j < 4; j ++ ) {
- _bbox.fromFrustum( _lightSpaceFrustum );
- _bbox.getSize();
- _bbox.getCenter( this.lightMargin );
+ _bbox.expandByPoint( _lightSpaceFrustum.vertices.near[ j ] );
+ _bbox.expandByPoint( _lightSpaceFrustum.vertices.far[ j ] );
+
+ }
- const squaredBBWidth = Math.max( _bbox.size.x, _bbox.size.y );
+ _bbox.getSize( _size );
+ _bbox.getCenter( _center );
+ _center.z = _bbox.max.z + this.lightMargin;
- _center.copy( _bbox.center );
_center.applyMatrix4( light.shadow.camera.matrixWorld );
+ const squaredBBWidth = Math.max( _size.x, _size.y );
light.shadow.camera.left = - squaredBBWidth / 2;
light.shadow.camera.right = squaredBBWidth / 2;
light.shadow.camera.top = squaredBBWidth / 2; | false |
Other | mrdoob | three.js | 52ef30f65d0ab028c0b24ff60ef3d1ada7b54668.json | Add fade between cascades | examples/jsm/csm/Shader.js | @@ -78,20 +78,30 @@ IncidentLight directLight;
DirectionalLightShadow directionalLightShadow;
#endif
- #pragma unroll_loop
for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
directionalLight = directionalLights[ i ];
getDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );
- #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
- directionalLightShadow = directionalLightShadows[ i ];
- if(linearDepth >= CSM_cascades[UNROLLED_LOOP_INDEX].x && linearDepth < CSM_cascades[UNROLLED_LOOP_INDEX].y) directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
+ float margin = ( 0.25 * ( pow( linearDepth, 2.0 ) ) );
+ float csmx = CSM_cascades[ i ].x - margin;
+ float csmy = CSM_cascades[ i ].y + margin;
+ if(i < NUM_DIR_LIGHT_SHADOWS && linearDepth >=csmx - margin && linearDepth < csmy + margin ) {
- #endif
+ float dist = min( linearDepth -csmx, csmy - linearDepth );
+ dist = min( dist / margin, 1.0 );
+
+ directionalLightShadow = directionalLightShadows[ i ];
+ float mult = all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
- if(linearDepth >= CSM_cascades[UNROLLED_LOOP_INDEX].x && (linearDepth < CSM_cascades[UNROLLED_LOOP_INDEX].y || UNROLLED_LOOP_INDEX == CSM_CASCADES - 1)) RE_Direct( directLight, geometry, material, reflectedLight );
+ directLight.color = mix( directLight.color, directLight.color * mult, dist );
+ }
+ if(linearDepth >= CSM_cascades[ i ].x && (linearDepth < CSM_cascades[ i ].y || i == CSM_CASCADES - 1)) {
+
+ RE_Direct( directLight, geometry, material, reflectedLight );
+
+ }
} | false |
Other | mrdoob | three.js | df1c4369ebe7201eb6e97504b4acc574090450fc.json | Use the same coding style as the other lines | examples/js/postprocessing/RenderPass.js | @@ -29,16 +29,16 @@ THREE.RenderPass.prototype = Object.assign( Object.create( THREE.Pass.prototype
var oldAutoClear = renderer.autoClear;
renderer.autoClear = false;
- var oldOverrideMaterial = this.scene.overrideMaterial;
+ var oldClearColor, oldClearAlpha, oldOverrideMaterial;
if ( this.overrideMaterial !== undefined ) {
+ oldOverrideMaterial = this.scene.overrideMaterial;
+
this.scene.overrideMaterial = this.overrideMaterial;
}
- var oldClearColor, oldClearAlpha;
-
if ( this.clearColor ) {
oldClearColor = renderer.getClearColor().getHex();
@@ -66,7 +66,12 @@ THREE.RenderPass.prototype = Object.assign( Object.create( THREE.Pass.prototype
}
- this.scene.overrideMaterial = oldOverrideMaterial;
+ if ( this.overrideMaterial !== undefined ) {
+
+ this.scene.overrideMaterial = oldOverrideMaterial;
+
+ }
+
renderer.autoClear = oldAutoClear;
} | true |
Other | mrdoob | three.js | df1c4369ebe7201eb6e97504b4acc574090450fc.json | Use the same coding style as the other lines | examples/jsm/postprocessing/RenderPass.js | @@ -32,9 +32,16 @@ RenderPass.prototype = Object.assign( Object.create( Pass.prototype ), {
var oldAutoClear = renderer.autoClear;
renderer.autoClear = false;
- this.scene.overrideMaterial = this.overrideMaterial;
- var oldClearColor, oldClearAlpha;
+ var oldClearColor, oldClearAlpha, oldOverrideMaterial;
+
+ if ( this.overrideMaterial !== undefined ) {
+
+ oldOverrideMaterial = this.scene.overrideMaterial;
+
+ this.scene.overrideMaterial = this.overrideMaterial;
+
+ }
if ( this.clearColor ) {
@@ -63,7 +70,12 @@ RenderPass.prototype = Object.assign( Object.create( Pass.prototype ), {
}
- this.scene.overrideMaterial = null;
+ if ( this.overrideMaterial !== undefined ) {
+
+ this.scene.overrideMaterial = oldOverrideMaterial;
+
+ }
+
renderer.autoClear = oldAutoClear;
} | true |
Other | mrdoob | three.js | 2a52d5246bd82bfe6309f8f538c9b79136affa9f.json | Use .union() instead | src/math/Box3.js | @@ -262,8 +262,7 @@ Object.assign( Box3.prototype, {
_box.copy( geometry.boundingBox );
_box.applyMatrix4( object.matrixWorld );
- this.expandByPoint( _box.min );
- this.expandByPoint( _box.max );
+ this.union( _box );
}
| false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.