diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index af7ced635ae43c..7aca5e3fd13538 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -19,7 +19,7 @@ Please also include a live example if possible. You can start from these templat ##### Three.js version - [ ] Dev -- [ ] r96 +- [ ] r97 - [ ] ... ##### Browser diff --git a/.travis.yml b/.travis.yml index 307a937cc1520b..2e53aa5fa7d4f9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ language: node_js node_js: - - "8.9.4" + - node script: - npm run travis diff --git a/build/three.js b/build/three.js index e7262554b82ed9..380dc37ad98d24 100644 --- a/build/three.js +++ b/build/three.js @@ -185,7 +185,7 @@ } ); - var REVISION = '96'; + var REVISION = '97'; var MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2 }; var CullFaceNone = 0; var CullFaceBack = 1; @@ -279,6 +279,7 @@ var RGBEFormat = RGBAFormat; var DepthFormat = 1026; var DepthStencilFormat = 1027; + var RedFormat = 1028; var RGB_S3TC_DXT1_Format = 33776; var RGBA_S3TC_DXT1_Format = 33777; var RGBA_S3TC_DXT3_Format = 33778; @@ -2071,6 +2072,8 @@ Object.assign( Quaternion.prototype, { + isQuaternion: true, + set: function ( x, y, z, w ) { this._x = x; @@ -5148,7 +5151,7 @@ } - return ( min <= plane.constant && max >= plane.constant ); + return ( min <= - plane.constant && max >= - plane.constant ); }, @@ -5993,17 +5996,17 @@ var beginnormal_vertex = "\nvec3 objectNormal = vec3( normal );\n"; - var bsdfs = "float punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\tif( decayExponent > 0.0 ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\tfloat maxDistanceCutoffFactor = pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\treturn distanceFalloff * maxDistanceCutoffFactor;\n#else\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n#endif\n\t}\n\treturn 1.0;\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNL = saturate( dot( geometry.normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\nvec3 BRDF_Specular_GGX_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 AB = vec2( -1.04, 1.04 ) * a004 + r.zw;\n\treturn specularColor * AB.x + AB.y;\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n"; + var bsdfs = "float punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\tif( cutoffDistance > 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n#else\n\tif( cutoffDistance > 0.0 ) {\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t}\n\treturn 1.0;\n#endif\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNL = saturate( dot( geometry.normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\nvec3 BRDF_Specular_GGX_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 AB = vec2( -1.04, 1.04 ) * a004 + r.zw;\n\treturn specularColor * AB.x + AB.y;\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n"; var bumpmap_pars_fragment = "#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\t\tvec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 );\n\t\tfDet *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif\n"; var clipping_planes_fragment = "#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vViewPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vViewPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\tif ( clipped ) discard;\n\t#endif\n#endif\n"; - var clipping_planes_pars_fragment = "#if NUM_CLIPPING_PLANES > 0\n\t#if ! defined( PHYSICAL ) && ! defined( PHONG )\n\t\tvarying vec3 vViewPosition;\n\t#endif\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif\n"; + var clipping_planes_pars_fragment = "#if NUM_CLIPPING_PLANES > 0\n\t#if ! defined( PHYSICAL ) && ! defined( PHONG ) && ! defined( MATCAP )\n\t\tvarying vec3 vViewPosition;\n\t#endif\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif\n"; - var clipping_planes_pars_vertex = "#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n\tvarying vec3 vViewPosition;\n#endif\n"; + var clipping_planes_pars_vertex = "#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG ) && ! defined( MATCAP )\n\tvarying vec3 vViewPosition;\n#endif\n"; - var clipping_planes_vertex = "#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n"; + var clipping_planes_vertex = "#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG ) && ! defined( MATCAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n"; var color_fragment = "#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif"; @@ -6157,6 +6160,10 @@ var worldpos_vertex = "#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP )\n\tvec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );\n#endif\n"; + var background_frag = "uniform sampler2D t2D;\nvarying vec2 vUv;\nvoid main() {\n\tgl_FragColor = texture2D( t2D, vUv );\n}\n"; + + var background_vert = "varying vec2 vUv;\nvoid main() {\n\tvUv = uv;\n\tgl_Position = vec4( position, 1.0 );\n\tgl_Position.z = 1.0;\n}\n"; + var cube_frag = "uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldPosition;\nvoid main() {\n\tgl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );\n\tgl_FragColor.a *= opacity;\n}\n"; var cube_vert = "varying vec3 vWorldPosition;\n#include \nvoid main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n\tgl_Position.z = gl_Position.w;\n}\n"; @@ -6185,6 +6192,10 @@ var meshlambert_vert = "#define LAMBERT\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n"; + var meshmatcap_frag = "#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\tvec4 matcapColor = texture2D( matcap, uv );\n\tmatcapColor = matcapTexelToLinear( matcapColor );\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}\n"; + + var meshmatcap_vert = "#define MATCAP\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifndef FLAT_SHADED\n\t\tvNormal = normalize( transformedNormal );\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n}\n"; + var meshphong_frag = "#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n"; var meshphong_vert = "#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n\t#include \n}\n"; @@ -6300,6 +6311,8 @@ uv2_vertex: uv2_vertex, worldpos_vertex: worldpos_vertex, + background_frag: background_frag, + background_vert: background_vert, cube_frag: cube_frag, cube_vert: cube_vert, depth_frag: depth_frag, @@ -6314,6 +6327,8 @@ meshbasic_vert: meshbasic_vert, meshlambert_frag: meshlambert_frag, meshlambert_vert: meshlambert_vert, + meshmatcap_frag: meshmatcap_frag, + meshmatcap_vert: meshmatcap_vert, meshphong_frag: meshphong_frag, meshphong_vert: meshphong_vert, meshphysical_frag: meshphysical_frag, @@ -7290,6 +7305,24 @@ }, + matcap: { + + uniforms: UniformsUtils.merge( [ + UniformsLib.common, + UniformsLib.bumpmap, + UniformsLib.normalmap, + UniformsLib.displacementmap, + UniformsLib.fog, + { + matcap: { value: null } + } + ] ), + + vertexShader: ShaderChunk.meshmatcap_vert, + fragmentShader: ShaderChunk.meshmatcap_frag + + }, + points: { uniforms: UniformsUtils.merge( [ @@ -7360,6 +7393,16 @@ }, + background: { + + uniforms: { + t2D: { value: null }, + }, + + vertexShader: ShaderChunk.background_vert, + fragmentShader: ShaderChunk.background_frag + + }, /* ------------------------------------------------------------------------- // Cube map shader ------------------------------------------------------------------------- */ @@ -7646,6 +7689,64 @@ } + /** + * @author mrdoob / http://mrdoob.com/ + * @author alteredq / http://alteredqualia.com/ + */ + + function Face3( a, b, c, normal, color, materialIndex ) { + + this.a = a; + this.b = b; + this.c = c; + + this.normal = ( normal && normal.isVector3 ) ? normal : new Vector3(); + this.vertexNormals = Array.isArray( normal ) ? normal : []; + + this.color = ( color && color.isColor ) ? color : new Color(); + this.vertexColors = Array.isArray( color ) ? color : []; + + this.materialIndex = materialIndex !== undefined ? materialIndex : 0; + + } + + Object.assign( Face3.prototype, { + + clone: function () { + + return new this.constructor().copy( this ); + + }, + + copy: function ( source ) { + + this.a = source.a; + this.b = source.b; + this.c = source.c; + + this.normal.copy( source.normal ); + this.color.copy( source.color ); + + this.materialIndex = source.materialIndex; + + for ( var i = 0, il = source.vertexNormals.length; i < il; i ++ ) { + + this.vertexNormals[ i ] = source.vertexNormals[ i ].clone(); + + } + + for ( var i = 0, il = source.vertexColors.length; i < il; i ++ ) { + + this.vertexColors[ i ] = source.vertexColors[ i ].clone(); + + } + + return this; + + } + + } ); + /** * @author mrdoob / http://mrdoob.com/ * @author WestLangley / http://github.com/WestLangley @@ -8913,277 +9014,6 @@ } ); - /** - * @author mrdoob / http://mrdoob.com/ - * @author mikael emtinger / http://gomo.se/ - * @author WestLangley / http://github.com/WestLangley - */ - - function Camera() { - - Object3D.call( this ); - - this.type = 'Camera'; - - this.matrixWorldInverse = new Matrix4(); - - this.projectionMatrix = new Matrix4(); - this.projectionMatrixInverse = new Matrix4(); - - } - - Camera.prototype = Object.assign( Object.create( Object3D.prototype ), { - - constructor: Camera, - - isCamera: true, - - copy: function ( source, recursive ) { - - Object3D.prototype.copy.call( this, source, recursive ); - - this.matrixWorldInverse.copy( source.matrixWorldInverse ); - - this.projectionMatrix.copy( source.projectionMatrix ); - this.projectionMatrixInverse.copy( source.projectionMatrixInverse ); - - return this; - - }, - - getWorldDirection: function ( target ) { - - if ( target === undefined ) { - - console.warn( 'THREE.Camera: .getWorldDirection() target is now required' ); - target = new Vector3(); - - } - - this.updateMatrixWorld( true ); - - var e = this.matrixWorld.elements; - - return target.set( - e[ 8 ], - e[ 9 ], - e[ 10 ] ).normalize(); - - }, - - updateMatrixWorld: function ( force ) { - - Object3D.prototype.updateMatrixWorld.call( this, force ); - - this.matrixWorldInverse.getInverse( this.matrixWorld ); - - }, - - clone: function () { - - return new this.constructor().copy( this ); - - } - - } ); - - /** - * @author alteredq / http://alteredqualia.com/ - * @author arose / http://github.com/arose - */ - - function OrthographicCamera( left, right, top, bottom, near, far ) { - - Camera.call( this ); - - this.type = 'OrthographicCamera'; - - this.zoom = 1; - this.view = null; - - this.left = left; - this.right = right; - this.top = top; - this.bottom = bottom; - - this.near = ( near !== undefined ) ? near : 0.1; - this.far = ( far !== undefined ) ? far : 2000; - - this.updateProjectionMatrix(); - - } - - OrthographicCamera.prototype = Object.assign( Object.create( Camera.prototype ), { - - constructor: OrthographicCamera, - - isOrthographicCamera: true, - - copy: function ( source, recursive ) { - - Camera.prototype.copy.call( this, source, recursive ); - - this.left = source.left; - this.right = source.right; - this.top = source.top; - this.bottom = source.bottom; - this.near = source.near; - this.far = source.far; - - this.zoom = source.zoom; - this.view = source.view === null ? null : Object.assign( {}, source.view ); - - return this; - - }, - - setViewOffset: function ( fullWidth, fullHeight, x, y, width, height ) { - - if ( this.view === null ) { - - this.view = { - enabled: true, - fullWidth: 1, - fullHeight: 1, - offsetX: 0, - offsetY: 0, - width: 1, - height: 1 - }; - - } - - this.view.enabled = true; - this.view.fullWidth = fullWidth; - this.view.fullHeight = fullHeight; - this.view.offsetX = x; - this.view.offsetY = y; - this.view.width = width; - this.view.height = height; - - this.updateProjectionMatrix(); - - }, - - clearViewOffset: function () { - - if ( this.view !== null ) { - - this.view.enabled = false; - - } - - this.updateProjectionMatrix(); - - }, - - updateProjectionMatrix: function () { - - var dx = ( this.right - this.left ) / ( 2 * this.zoom ); - var dy = ( this.top - this.bottom ) / ( 2 * this.zoom ); - var cx = ( this.right + this.left ) / 2; - var cy = ( this.top + this.bottom ) / 2; - - var left = cx - dx; - var right = cx + dx; - var top = cy + dy; - var bottom = cy - dy; - - if ( this.view !== null && this.view.enabled ) { - - var zoomW = this.zoom / ( this.view.width / this.view.fullWidth ); - var zoomH = this.zoom / ( this.view.height / this.view.fullHeight ); - var scaleW = ( this.right - this.left ) / this.view.width; - var scaleH = ( this.top - this.bottom ) / this.view.height; - - left += scaleW * ( this.view.offsetX / zoomW ); - right = left + scaleW * ( this.view.width / zoomW ); - top -= scaleH * ( this.view.offsetY / zoomH ); - bottom = top - scaleH * ( this.view.height / zoomH ); - - } - - this.projectionMatrix.makeOrthographic( left, right, top, bottom, this.near, this.far ); - - this.projectionMatrixInverse.getInverse( this.projectionMatrix ); - - }, - - toJSON: function ( meta ) { - - var data = Object3D.prototype.toJSON.call( this, meta ); - - data.object.zoom = this.zoom; - data.object.left = this.left; - data.object.right = this.right; - data.object.top = this.top; - data.object.bottom = this.bottom; - data.object.near = this.near; - data.object.far = this.far; - - if ( this.view !== null ) data.object.view = Object.assign( {}, this.view ); - - return data; - - } - - } ); - - /** - * @author mrdoob / http://mrdoob.com/ - * @author alteredq / http://alteredqualia.com/ - */ - - function Face3( a, b, c, normal, color, materialIndex ) { - - this.a = a; - this.b = b; - this.c = c; - - this.normal = ( normal && normal.isVector3 ) ? normal : new Vector3(); - this.vertexNormals = Array.isArray( normal ) ? normal : []; - - this.color = ( color && color.isColor ) ? color : new Color(); - this.vertexColors = Array.isArray( color ) ? color : []; - - this.materialIndex = materialIndex !== undefined ? materialIndex : 0; - - } - - Object.assign( Face3.prototype, { - - clone: function () { - - return new this.constructor().copy( this ); - - }, - - copy: function ( source ) { - - this.a = source.a; - this.b = source.b; - this.c = source.c; - - this.normal.copy( source.normal ); - this.color.copy( source.color ); - - this.materialIndex = source.materialIndex; - - for ( var i = 0, il = source.vertexNormals.length; i < il; i ++ ) { - - this.vertexNormals[ i ] = source.vertexNormals[ i ].clone(); - - } - - for ( var i = 0, il = source.vertexColors.length; i < il; i ++ ) { - - this.vertexColors[ i ] = source.vertexColors[ i ].clone(); - - } - - return this; - - } - - } ); - /** * @author mrdoob / http://mrdoob.com/ * @author kile / http://kile.stravaganza.org/ @@ -12959,6 +12789,9 @@ data.envMap = this.envMap.toJSON( meta ).uuid; data.reflectivity = this.reflectivity; // Scale behind envMap + if ( this.combine !== undefined ) data.combine = this.combine; + if ( this.envMapIntensity !== undefined ) data.envMapIntensity = this.envMapIntensity; + } if ( this.gradientMap && this.gradientMap.isTexture ) { @@ -13124,120 +12957,6 @@ } ); - /** - * @author mrdoob / http://mrdoob.com/ - * @author alteredq / http://alteredqualia.com/ - * - * parameters = { - * color: , - * opacity: , - * map: new THREE.Texture( ), - * - * lightMap: new THREE.Texture( ), - * lightMapIntensity: - * - * aoMap: new THREE.Texture( ), - * aoMapIntensity: - * - * specularMap: new THREE.Texture( ), - * - * alphaMap: new THREE.Texture( ), - * - * envMap: new THREE.CubeTexture( [posx, negx, posy, negy, posz, negz] ), - * combine: THREE.Multiply, - * reflectivity: , - * refractionRatio: , - * - * depthTest: , - * depthWrite: , - * - * wireframe: , - * wireframeLinewidth: , - * - * skinning: , - * morphTargets: - * } - */ - - function MeshBasicMaterial( parameters ) { - - Material.call( this ); - - this.type = 'MeshBasicMaterial'; - - this.color = new Color( 0xffffff ); // emissive - - this.map = null; - - this.lightMap = null; - this.lightMapIntensity = 1.0; - - this.aoMap = null; - this.aoMapIntensity = 1.0; - - this.specularMap = null; - - this.alphaMap = null; - - this.envMap = null; - this.combine = MultiplyOperation; - this.reflectivity = 1; - this.refractionRatio = 0.98; - - this.wireframe = false; - this.wireframeLinewidth = 1; - this.wireframeLinecap = 'round'; - this.wireframeLinejoin = 'round'; - - this.skinning = false; - this.morphTargets = false; - - this.lights = false; - - this.setValues( parameters ); - - } - - MeshBasicMaterial.prototype = Object.create( Material.prototype ); - MeshBasicMaterial.prototype.constructor = MeshBasicMaterial; - - MeshBasicMaterial.prototype.isMeshBasicMaterial = true; - - MeshBasicMaterial.prototype.copy = function ( source ) { - - Material.prototype.copy.call( this, source ); - - this.color.copy( source.color ); - - this.map = source.map; - - this.lightMap = source.lightMap; - this.lightMapIntensity = source.lightMapIntensity; - - this.aoMap = source.aoMap; - this.aoMapIntensity = source.aoMapIntensity; - - this.specularMap = source.specularMap; - - this.alphaMap = source.alphaMap; - - this.envMap = source.envMap; - this.combine = source.combine; - this.reflectivity = source.reflectivity; - this.refractionRatio = source.refractionRatio; - - this.wireframe = source.wireframe; - this.wireframeLinewidth = source.wireframeLinewidth; - this.wireframeLinecap = source.wireframeLinecap; - this.wireframeLinejoin = source.wireframeLinejoin; - - this.skinning = source.skinning; - this.morphTargets = source.morphTargets; - - return this; - - }; - /** * @author alteredq / http://alteredqualia.com/ * @@ -14310,6 +14029,120 @@ } ); + /** + * @author mrdoob / http://mrdoob.com/ + * @author alteredq / http://alteredqualia.com/ + * + * parameters = { + * color: , + * opacity: , + * map: new THREE.Texture( ), + * + * lightMap: new THREE.Texture( ), + * lightMapIntensity: + * + * aoMap: new THREE.Texture( ), + * aoMapIntensity: + * + * specularMap: new THREE.Texture( ), + * + * alphaMap: new THREE.Texture( ), + * + * envMap: new THREE.CubeTexture( [posx, negx, posy, negy, posz, negz] ), + * combine: THREE.Multiply, + * reflectivity: , + * refractionRatio: , + * + * depthTest: , + * depthWrite: , + * + * wireframe: , + * wireframeLinewidth: , + * + * skinning: , + * morphTargets: + * } + */ + + function MeshBasicMaterial( parameters ) { + + Material.call( this ); + + this.type = 'MeshBasicMaterial'; + + this.color = new Color( 0xffffff ); // emissive + + this.map = null; + + this.lightMap = null; + this.lightMapIntensity = 1.0; + + this.aoMap = null; + this.aoMapIntensity = 1.0; + + this.specularMap = null; + + this.alphaMap = null; + + this.envMap = null; + this.combine = MultiplyOperation; + this.reflectivity = 1; + this.refractionRatio = 0.98; + + this.wireframe = false; + this.wireframeLinewidth = 1; + this.wireframeLinecap = 'round'; + this.wireframeLinejoin = 'round'; + + this.skinning = false; + this.morphTargets = false; + + this.lights = false; + + this.setValues( parameters ); + + } + + MeshBasicMaterial.prototype = Object.create( Material.prototype ); + MeshBasicMaterial.prototype.constructor = MeshBasicMaterial; + + MeshBasicMaterial.prototype.isMeshBasicMaterial = true; + + MeshBasicMaterial.prototype.copy = function ( source ) { + + Material.prototype.copy.call( this, source ); + + this.color.copy( source.color ); + + this.map = source.map; + + this.lightMap = source.lightMap; + this.lightMapIntensity = source.lightMapIntensity; + + this.aoMap = source.aoMap; + this.aoMapIntensity = source.aoMapIntensity; + + this.specularMap = source.specularMap; + + this.alphaMap = source.alphaMap; + + this.envMap = source.envMap; + this.combine = source.combine; + this.reflectivity = source.reflectivity; + this.refractionRatio = source.refractionRatio; + + this.wireframe = source.wireframe; + this.wireframeLinewidth = source.wireframeLinewidth; + this.wireframeLinecap = source.wireframeLinecap; + this.wireframeLinejoin = source.wireframeLinejoin; + + this.skinning = source.skinning; + this.morphTargets = source.morphTargets; + + return this; + + }; + /** * @author mrdoob / http://mrdoob.com/ * @author alteredq / http://alteredqualia.com/ @@ -14767,7 +14600,7 @@ var clearColor = new Color( 0x000000 ); var clearAlpha = 0; - var planeCamera, planeMesh; + var planeMesh; var boxMesh; function render( renderList, scene, camera, forceClear ) { @@ -14798,7 +14631,7 @@ boxMesh = new Mesh( new BoxBufferGeometry( 1, 1, 1 ), new ShaderMaterial( { - uniforms: ShaderLib.cube.uniforms, + uniforms: UniformsUtils.clone( ShaderLib.cube.uniforms ), vertexShader: ShaderLib.cube.vertexShader, fragmentShader: ShaderLib.cube.fragmentShader, side: BackSide, @@ -14827,24 +14660,30 @@ } else if ( background && background.isTexture ) { - if ( planeCamera === undefined ) { - - planeCamera = new OrthographicCamera( - 1, 1, 1, - 1, 0, 1 ); + if ( planeMesh === undefined ) { planeMesh = new Mesh( new PlaneBufferGeometry( 2, 2 ), - new MeshBasicMaterial( { depthTest: false, depthWrite: false, fog: false } ) + new ShaderMaterial( { + uniforms: UniformsUtils.clone( ShaderLib.background.uniforms ), + vertexShader: ShaderLib.background.vertexShader, + fragmentShader: ShaderLib.background.fragmentShader, + side: FrontSide, + depthTest: true, + depthWrite: false, + fog: false + } ) ); + planeMesh.geometry.removeAttribute( 'normal' ); + objects.update( planeMesh ); } - planeMesh.material.map = background; - - // TODO Push this to renderList + planeMesh.material.uniforms.t2D.value = background; - renderer.renderBufferDirect( planeCamera, null, planeMesh.geometry, planeMesh.material, planeMesh, null ); + renderList.push( planeMesh, planeMesh.geometry, planeMesh.material, 0, null ); } @@ -15797,6 +15636,36 @@ } ); + /** + * @author Artur Trzesiok + */ + + function DataTexture3D( data, width, height, depth ) { + + // We're going to add .setXXX() methods for setting properties later. + // Users can still set in DataTexture3D directly. + // + // var texture = new THREE.DataTexture3D( data, width, height, depth ); + // texture.anisotropy = 16; + // + // See #14839 + + Texture.call( this, null ); + + this.image = { data: data, width: width, height: height, depth: depth }; + + this.magFilter = NearestFilter; + this.minFilter = NearestFilter; + + this.generateMipmaps = false; + this.flipY = false; + + } + + DataTexture3D.prototype = Object.create( Texture.prototype ); + DataTexture3D.prototype.constructor = DataTexture3D; + DataTexture3D.prototype.isDataTexture3D = true; + /** * @author tschw * @author Mugen87 / https://github.com/Mugen87 @@ -15849,6 +15718,7 @@ */ var emptyTexture = new Texture(); + var emptyTexture3d = new DataTexture3D(); var emptyCubeTexture = new CubeTexture(); // --- Base for inner nodes (including the root) --- @@ -16184,6 +16054,22 @@ } + function setValueT3D1( gl, v, renderer ) { + + var cache = this.cache; + var unit = renderer.allocTextureUnit(); + + if ( cache[ 0 ] !== unit ) { + + gl.uniform1i( this.addr, unit ); + cache[ 0 ] = unit; + + } + + renderer.setTexture3D( v || emptyTexture3d, unit ); + + } + function setValueT6( gl, v, renderer ) { var cache = this.cache; @@ -16254,6 +16140,7 @@ case 0x8b5c: return setValue4fm; // _MAT4 case 0x8b5e: case 0x8d66: return setValueT1; // SAMPLER_2D, SAMPLER_EXTERNAL_OES + case 0x8B5F: return setValueT3D1; // SAMPLER_3D case 0x8b60: return setValueT6; // SAMPLER_CUBE case 0x1404: case 0x8b56: return setValue1i; // INT, BOOL @@ -17182,8 +17069,10 @@ parameters.dithering ? '#define DITHERING' : '', - ( parameters.outputEncoding || parameters.mapEncoding || parameters.envMapEncoding || parameters.emissiveMapEncoding ) ? ShaderChunk[ 'encodings_pars_fragment' ] : '', // this code is required here because it is used by the various encoding/decoding function defined below + ( parameters.outputEncoding || parameters.mapEncoding || parameters.matcapEncoding || parameters.envMapEncoding || parameters.emissiveMapEncoding ) ? + ShaderChunk[ 'encodings_pars_fragment' ] : '', // this code is required here because it is used by the various encoding/decoding function defined below parameters.mapEncoding ? getTexelDecodingFunction( 'mapTexelToLinear', parameters.mapEncoding ) : '', + parameters.matcapEncoding ? getTexelDecodingFunction( 'matcapTexelToLinear', parameters.matcapEncoding ) : '', parameters.envMapEncoding ? getTexelDecodingFunction( 'envMapTexelToLinear', parameters.envMapEncoding ) : '', parameters.emissiveMapEncoding ? getTexelDecodingFunction( 'emissiveMapTexelToLinear', parameters.emissiveMapEncoding ) : '', parameters.outputEncoding ? getTexelEncodingFunction( 'linearToOutputTexel', parameters.outputEncoding ) : '', @@ -17434,6 +17323,7 @@ MeshToonMaterial: 'phong', MeshStandardMaterial: 'physical', MeshPhysicalMaterial: 'physical', + MeshMatcapMaterial: 'matcap', LineBasicMaterial: 'basic', LineDashedMaterial: 'dashed', PointsMaterial: 'points', @@ -17442,7 +17332,7 @@ }; var parameterNames = [ - "precision", "supportsVertexTextures", "map", "mapEncoding", "envMap", "envMapMode", "envMapEncoding", + "precision", "supportsVertexTextures", "map", "mapEncoding", "matcapEncoding", "envMap", "envMapMode", "envMapEncoding", "lightMap", "aoMap", "emissiveMap", "emissiveMapEncoding", "bumpMap", "normalMap", "objectSpaceNormalMap", "displacementMap", "specularMap", "roughnessMap", "metalnessMap", "gradientMap", "alphaMap", "combine", "vertexColors", "fog", "useFog", "fogExp", @@ -17554,6 +17444,8 @@ outputEncoding: getTextureEncodingFromMap( ( ! currentRenderTarget ) ? null : currentRenderTarget.texture, renderer.gammaOutput ), map: !! material.map, mapEncoding: getTextureEncodingFromMap( material.map, renderer.gammaInput ), + matcap: !! material.matcap, + matcapEncoding: getTextureEncodingFromMap( material.matcap, renderer.gammaInput ), envMap: !! material.envMap, envMapMode: material.envMap && material.envMap.mapping, envMapEncoding: getTextureEncodingFromMap( material.envMap, renderer.gammaInput ), @@ -18136,7 +18028,7 @@ uniforms.coneCos = Math.cos( light.angle ); uniforms.penumbraCos = Math.cos( light.angle * ( 1 - light.penumbra ) ); - uniforms.decay = ( light.distance === 0 ) ? 0.0 : light.decay; + uniforms.decay = light.decay; uniforms.shadow = light.castShadow; @@ -18197,7 +18089,7 @@ uniforms.color.copy( light.color ).multiplyScalar( light.intensity ); uniforms.distance = light.distance; - uniforms.decay = ( light.distance === 0 ) ? 0.0 : light.decay; + uniforms.decay = light.decay; uniforms.shadow = light.castShadow; @@ -19799,6 +19691,20 @@ } + function texImage3D() { + + try { + + gl.texImage3D.apply( gl, arguments ); + + } catch ( error ) { + + console.error( 'THREE.WebGLState:', error ); + + } + + } + // function scissor( scissor ) { @@ -19891,6 +19797,7 @@ bindTexture: bindTexture, compressedTexImage2D: compressedTexImage2D, texImage2D: texImage2D, + texImage3D: texImage3D, scissor: scissor, viewport: viewport, @@ -20004,6 +19911,14 @@ if ( ! capabilities.isWebGL2 ) return glFormat; + if ( glFormat === _gl.RED ) { + + if ( glType === _gl.FLOAT ) return _gl.R32F; + if ( glType === _gl.HALF_FLOAT ) return _gl.R16F; + if ( glType === _gl.UNSIGNED_BYTE ) return _gl.R8; + + } + if ( glFormat === _gl.RGB ) { if ( glType === _gl.FLOAT ) return _gl.RGB32F; @@ -20173,6 +20088,23 @@ } + function setTexture3D( texture, slot ) { + + var textureProperties = properties.get( texture ); + + if ( texture.version > 0 && textureProperties.__version !== texture.version ) { + + uploadTexture( textureProperties, texture, slot ); + return; + + } + + state.activeTexture( _gl.TEXTURE0 + slot ); + state.bindTexture( _gl.TEXTURE_3D, textureProperties.__webglTexture ); + + } + + function setTextureCube( texture, slot ) { var textureProperties = properties.get( texture ); @@ -20362,6 +20294,19 @@ function uploadTexture( textureProperties, texture, slot ) { + var textureType; + + if ( texture.isDataTexture3D ) { + + textureType = _gl.TEXTURE_3D; + + } else { + + textureType = _gl.TEXTURE_2D; + + } + + if ( textureProperties.__webglInit === undefined ) { textureProperties.__webglInit = true; @@ -20373,9 +20318,12 @@ info.memory.textures ++; } - state.activeTexture( _gl.TEXTURE0 + slot ); - state.bindTexture( _gl.TEXTURE_2D, textureProperties.__webglTexture ); + + + state.bindTexture( textureType, textureProperties.__webglTexture ); + + _gl.pixelStorei( _gl.UNPACK_FLIP_Y_WEBGL, texture.flipY ); _gl.pixelStorei( _gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultiplyAlpha ); @@ -20394,7 +20342,7 @@ glType = utils.convert( texture.type ), glInternalFormat = getInternalFormat( glFormat, glType ); - setTextureParameters( _gl.TEXTURE_2D, texture, isPowerOfTwoImage ); + setTextureParameters( textureType, texture, isPowerOfTwoImage ); var mipmap, mipmaps = texture.mipmaps; @@ -20507,6 +20455,11 @@ textureProperties.__maxMipLevel = mipmaps.length - 1; + } else if ( texture.isDataTexture3D ) { + + state.texImage3D( _gl.TEXTURE_3D, 0, glInternalFormat, image.width, image.height, image.depth, 0, glFormat, glType, image.data ); + textureProperties.__maxMipLevel = 0; + } else { // regular Texture (image, video, canvas) @@ -20790,6 +20743,7 @@ } this.setTexture2D = setTexture2D; + this.setTexture3D = setTexture3D; this.setTextureCube = setTextureCube; this.setTextureCubeDynamic = setTextureCubeDynamic; this.setupRenderTarget = setupRenderTarget; @@ -20848,6 +20802,7 @@ if ( p === LuminanceAlphaFormat ) return gl.LUMINANCE_ALPHA; if ( p === DepthFormat ) return gl.DEPTH_COMPONENT; if ( p === DepthStencilFormat ) return gl.DEPTH_STENCIL; + if ( p === RedFormat ) return gl.RED; if ( p === AddEquation ) return gl.FUNC_ADD; if ( p === SubtractEquation ) return gl.FUNC_SUBTRACT; @@ -20980,6 +20935,77 @@ } ); + /** + * @author mrdoob / http://mrdoob.com/ + * @author mikael emtinger / http://gomo.se/ + * @author WestLangley / http://github.com/WestLangley + */ + + function Camera() { + + Object3D.call( this ); + + this.type = 'Camera'; + + this.matrixWorldInverse = new Matrix4(); + + this.projectionMatrix = new Matrix4(); + this.projectionMatrixInverse = new Matrix4(); + + } + + Camera.prototype = Object.assign( Object.create( Object3D.prototype ), { + + constructor: Camera, + + isCamera: true, + + copy: function ( source, recursive ) { + + Object3D.prototype.copy.call( this, source, recursive ); + + this.matrixWorldInverse.copy( source.matrixWorldInverse ); + + this.projectionMatrix.copy( source.projectionMatrix ); + this.projectionMatrixInverse.copy( source.projectionMatrixInverse ); + + return this; + + }, + + getWorldDirection: function ( target ) { + + if ( target === undefined ) { + + console.warn( 'THREE.Camera: .getWorldDirection() target is now required' ); + target = new Vector3(); + + } + + this.updateMatrixWorld( true ); + + var e = this.matrixWorld.elements; + + return target.set( - e[ 8 ], - e[ 9 ], - e[ 10 ] ).normalize(); + + }, + + updateMatrixWorld: function ( force ) { + + Object3D.prototype.updateMatrixWorld.call( this, force ); + + this.matrixWorldInverse.getInverse( this.matrixWorld ); + + }, + + clone: function () { + + return new this.constructor().copy( this ); + + } + + } ); + /** * @author mrdoob / http://mrdoob.com/ * @author greggman / http://games.greggman.com/ @@ -22178,7 +22204,13 @@ // vr - var vr = ( 'xr' in navigator ) ? new WebXRManager( _this ) : new WebVRManager( _this ); + var vr = null; + + if ( typeof navigator !== 'undefined' ) { + + vr = ( 'xr' in navigator ) ? new WebXRManager( _this ) : new WebVRManager( _this ); + + } this.vr = vr; @@ -22372,13 +22404,6 @@ }; - this.clearTarget = function ( renderTarget, color, depth, stencil ) { - - this.setRenderTarget( renderTarget ); - this.clear( color, depth, stencil ); - - }; - // this.dispose = function () { @@ -23748,6 +23773,12 @@ } + } else if ( material.isMeshMatcapMaterial ) { + + refreshUniformsCommon( m_uniforms, material ); + + refreshUniformsMatcap( m_uniforms, material ); + } else if ( material.isMeshDepthMaterial ) { refreshUniformsCommon( m_uniforms, material ); @@ -24159,6 +24190,40 @@ } + function refreshUniformsMatcap( uniforms, material ) { + + if ( material.matcap ) { + + uniforms.matcap.value = material.matcap; + + } + + if ( material.bumpMap ) { + + uniforms.bumpMap.value = material.bumpMap; + uniforms.bumpScale.value = material.bumpScale; + if ( material.side === BackSide ) uniforms.bumpScale.value *= - 1; + + } + + if ( material.normalMap ) { + + uniforms.normalMap.value = material.normalMap; + uniforms.normalScale.value.copy( material.normalScale ); + if ( material.side === BackSide ) uniforms.normalScale.value.negate(); + + } + + if ( material.displacementMap ) { + + uniforms.displacementMap.value = material.displacementMap; + uniforms.displacementScale.value = material.displacementScale; + uniforms.displacementBias.value = material.displacementBias; + + } + + } + function refreshUniformsDepth( uniforms, material ) { if ( material.displacementMap ) { @@ -24276,6 +24341,17 @@ }() ); + this.setTexture3D = ( function () { + + // backwards compatibility: peel texture.texture + return function setTexture3D( texture, slot ) { + + textures.setTexture3D( texture, slot ); + + }; + + }() ); + this.setTexture = ( function () { var warned = false; @@ -31612,6 +31688,128 @@ }; + /** + * @author WestLangley / http://github.com/WestLangley + * + * parameters = { + * color: , + * opacity: , + * + * matcap: new THREE.Texture( ), + * + * map: new THREE.Texture( ), + * + * bumpMap: new THREE.Texture( ), + * bumpScale: , + * + * normalMap: new THREE.Texture( ), + * normalMapType: THREE.TangentSpaceNormalMap, + * normalScale: , + * + * displacementMap: new THREE.Texture( ), + * displacementScale: , + * displacementBias: , + * + * alphaMap: new THREE.Texture( ), + * + * skinning: , + * morphTargets: , + * morphNormals: + * } + */ + + function MeshMatcapMaterial( parameters ) { + + Material.call( this ); + + this.defines = { 'MATCAP': '' }; + + this.type = 'MeshMatcapMaterial'; + + this.color = new Color( 0xffffff ); // diffuse + + this.matcap = null; + + this.map = null; + + this.bumpMap = null; + this.bumpScale = 1; + + this.normalMap = null; + this.normalMapType = TangentSpaceNormalMap; + this.normalScale = new Vector2( 1, 1 ); + + this.displacementMap = null; + this.displacementScale = 1; + this.displacementBias = 0; + + this.alphaMap = null; + + this.skinning = false; + this.morphTargets = false; + this.morphNormals = false; + + this.lights = false; + + this.setValues( parameters ); + + // a matcap is required + + if ( this.matcap === null ) { + + var canvas = document.createElement( 'canvas' ); + canvas.width = 1; + canvas.height = 1; + + var context = canvas.getContext( '2d' ); + + context.fillStyle = '#fff'; + context.fillRect( 0, 0, 1, 1 ); + + this.matcap = new THREE.CanvasTexture( canvas ); + + } + + } + + MeshMatcapMaterial.prototype = Object.create( Material.prototype ); + MeshMatcapMaterial.prototype.constructor = MeshMatcapMaterial; + + MeshMatcapMaterial.prototype.isMeshMatcapMaterial = true; + + MeshMatcapMaterial.prototype.copy = function ( source ) { + + Material.prototype.copy.call( this, source ); + + this.defines = { 'MATCAP': '' }; + + this.color.copy( source.color ); + + this.matcap = source.matcap; + + this.map = source.map; + + this.bumpMap = source.bumpMap; + this.bumpScale = source.bumpScale; + + this.normalMap = source.normalMap; + this.normalMapType = source.normalMapType; + this.normalScale.copy( source.normalScale ); + + this.displacementMap = source.displacementMap; + this.displacementScale = source.displacementScale; + this.displacementBias = source.displacementBias; + + this.alphaMap = source.alphaMap; + + this.skinning = source.skinning; + this.morphTargets = source.morphTargets; + this.morphNormals = source.morphNormals; + + return this; + + }; + /** * @author alteredq / http://alteredqualia.com/ * @@ -31675,6 +31873,7 @@ MeshDepthMaterial: MeshDepthMaterial, MeshDistanceMaterial: MeshDistanceMaterial, MeshBasicMaterial: MeshBasicMaterial, + MeshMatcapMaterial: MeshMatcapMaterial, LineDashedMaterial: LineDashedMaterial, LineBasicMaterial: LineBasicMaterial, Material: Material @@ -34901,6 +35100,148 @@ } ); + /** + * @author alteredq / http://alteredqualia.com/ + * @author arose / http://github.com/arose + */ + + function OrthographicCamera( left, right, top, bottom, near, far ) { + + Camera.call( this ); + + this.type = 'OrthographicCamera'; + + this.zoom = 1; + this.view = null; + + this.left = left; + this.right = right; + this.top = top; + this.bottom = bottom; + + this.near = ( near !== undefined ) ? near : 0.1; + this.far = ( far !== undefined ) ? far : 2000; + + this.updateProjectionMatrix(); + + } + + OrthographicCamera.prototype = Object.assign( Object.create( Camera.prototype ), { + + constructor: OrthographicCamera, + + isOrthographicCamera: true, + + copy: function ( source, recursive ) { + + Camera.prototype.copy.call( this, source, recursive ); + + this.left = source.left; + this.right = source.right; + this.top = source.top; + this.bottom = source.bottom; + this.near = source.near; + this.far = source.far; + + this.zoom = source.zoom; + this.view = source.view === null ? null : Object.assign( {}, source.view ); + + return this; + + }, + + setViewOffset: function ( fullWidth, fullHeight, x, y, width, height ) { + + if ( this.view === null ) { + + this.view = { + enabled: true, + fullWidth: 1, + fullHeight: 1, + offsetX: 0, + offsetY: 0, + width: 1, + height: 1 + }; + + } + + this.view.enabled = true; + this.view.fullWidth = fullWidth; + this.view.fullHeight = fullHeight; + this.view.offsetX = x; + this.view.offsetY = y; + this.view.width = width; + this.view.height = height; + + this.updateProjectionMatrix(); + + }, + + clearViewOffset: function () { + + if ( this.view !== null ) { + + this.view.enabled = false; + + } + + this.updateProjectionMatrix(); + + }, + + updateProjectionMatrix: function () { + + var dx = ( this.right - this.left ) / ( 2 * this.zoom ); + var dy = ( this.top - this.bottom ) / ( 2 * this.zoom ); + var cx = ( this.right + this.left ) / 2; + var cy = ( this.top + this.bottom ) / 2; + + var left = cx - dx; + var right = cx + dx; + var top = cy + dy; + var bottom = cy - dy; + + if ( this.view !== null && this.view.enabled ) { + + var zoomW = this.zoom / ( this.view.width / this.view.fullWidth ); + var zoomH = this.zoom / ( this.view.height / this.view.fullHeight ); + var scaleW = ( this.right - this.left ) / this.view.width; + var scaleH = ( this.top - this.bottom ) / this.view.height; + + left += scaleW * ( this.view.offsetX / zoomW ); + right = left + scaleW * ( this.view.width / zoomW ); + top -= scaleH * ( this.view.offsetY / zoomH ); + bottom = top - scaleH * ( this.view.height / zoomH ); + + } + + this.projectionMatrix.makeOrthographic( left, right, top, bottom, this.near, this.far ); + + this.projectionMatrixInverse.getInverse( this.projectionMatrix ); + + }, + + toJSON: function ( meta ) { + + var data = Object3D.prototype.toJSON.call( this, meta ); + + data.object.zoom = this.zoom; + data.object.left = this.left; + data.object.right = this.right; + data.object.top = this.top; + data.object.bottom = this.bottom; + data.object.near = this.near; + data.object.far = this.far; + + if ( this.view !== null ) data.object.view = Object.assign( {}, this.view ); + + return data; + + } + + } ); + /** * @author mrdoob / http://mrdoob.com/ */ @@ -36833,6 +37174,7 @@ if ( json.fog !== undefined ) material.fog = json.fog; if ( json.flatShading !== undefined ) material.flatShading = json.flatShading; if ( json.blending !== undefined ) material.blending = json.blending; + if ( json.combine !== undefined ) material.combine = json.combine; if ( json.side !== undefined ) material.side = json.side; if ( json.opacity !== undefined ) material.opacity = json.opacity; if ( json.transparent !== undefined ) material.transparent = json.transparent; @@ -36966,6 +37308,7 @@ if ( json.specularMap !== undefined ) material.specularMap = getTexture( json.specularMap ); if ( json.envMap !== undefined ) material.envMap = getTexture( json.envMap ); + if ( json.envMapIntensity !== undefined ) material.envMapIntensity = json.envMapIntensity; if ( json.reflectivity !== undefined ) material.reflectivity = json.reflectivity; @@ -37471,9 +37814,10 @@ var scope = this; - var texturePath = this.texturePath && ( typeof this.texturePath === 'string' ) ? this.texturePath : LoaderUtils.extractUrlBase( url ); + var path = ( this.path === undefined ) ? LoaderUtils.extractUrlBase( url ) : this.path; var loader = new FileLoader( this.manager ); + loader.setPath( this.path ); loader.setWithCredentials( this.withCredentials ); loader.load( url, function ( text ) { @@ -37497,23 +37841,30 @@ } - var object = scope.parse( json, texturePath ); + var object = scope.parse( json, path ); onLoad( object.geometry, object.materials ); }, onProgress, onError ); }, - setCrossOrigin: function ( value ) { + setPath: function ( value ) { - this.crossOrigin = value; + this.path = value; return this; }, - setTexturePath: function ( value ) { + setResourcePath: function ( value ) { - this.texturePath = value; + this.resourcePath = value; + return this; + + }, + + setCrossOrigin: function ( value ) { + + this.crossOrigin = value; return this; }, @@ -37961,7 +38312,7 @@ } - return function parse( json, texturePath ) { + return function parse( json, path ) { if ( json.data !== undefined ) { @@ -37996,7 +38347,7 @@ } else { - var materials = Loader.prototype.initMaterials( json.materials, texturePath, this.crossOrigin ); + var materials = Loader.prototype.initMaterials( json.materials, this.resourcePath || path, this.crossOrigin ); return { geometry: geometry, materials: materials }; @@ -45806,6 +46157,17 @@ } + Object.assign( JSONLoader.prototype, { + + setTexturePath: function ( value ) { + + console.warn( 'THREE.JSONLoader: .setTexturePath() has been renamed to .setResourcePath().' ); + return this.setResourcePath( value ); + + } + + } ); + // Object.assign( Box2.prototype, { @@ -46701,6 +47063,14 @@ Object.assign( WebGLRenderer.prototype, { + clearTarget: function ( renderTarget, color, depth, stencil ) { + + console.warn( 'THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead.' ); + this.setRenderTarget( renderTarget ); + this.clear( color, depth, stencil ); + + }, + animate: function ( callback ) { console.warn( 'THREE.WebGLRenderer: .animate() is now .setAnimationLoop().' ); @@ -47277,6 +47647,7 @@ exports.Group = Group; exports.VideoTexture = VideoTexture; exports.DataTexture = DataTexture; + exports.DataTexture3D = DataTexture3D; exports.CompressedTexture = CompressedTexture; exports.CubeTexture = CubeTexture; exports.CanvasTexture = CanvasTexture; @@ -47454,6 +47825,7 @@ exports.MeshDepthMaterial = MeshDepthMaterial; exports.MeshDistanceMaterial = MeshDistanceMaterial; exports.MeshBasicMaterial = MeshBasicMaterial; + exports.MeshMatcapMaterial = MeshMatcapMaterial; exports.LineDashedMaterial = LineDashedMaterial; exports.LineBasicMaterial = LineBasicMaterial; exports.Material = Material; @@ -47571,6 +47943,7 @@ exports.RGBEFormat = RGBEFormat; exports.DepthFormat = DepthFormat; exports.DepthStencilFormat = DepthStencilFormat; + exports.RedFormat = RedFormat; exports.RGB_S3TC_DXT1_Format = RGB_S3TC_DXT1_Format; exports.RGBA_S3TC_DXT1_Format = RGBA_S3TC_DXT1_Format; exports.RGBA_S3TC_DXT3_Format = RGBA_S3TC_DXT3_Format; diff --git a/build/three.min.js b/build/three.min.js index 75e5c31713778b..ca9b61105a791f 100644 --- a/build/three.min.js +++ b/build/three.min.js @@ -1,418 +1,423 @@ // threejs.org/license -(function(l,ea){"object"===typeof exports&&"undefined"!==typeof module?ea(exports):"function"===typeof define&&define.amd?define(["exports"],ea):ea(l.THREE={})})(this,function(l){function ea(){}function z(a,b){this.x=a||0;this.y=b||0}function J(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];0b&&(b=a[c]);return b}function I(){Object.defineProperty(this,"id",{value:Hf+=2});this.uuid=K.generateUUID();this.name="";this.type="BufferGeometry";this.index=null;this.attributes={};this.morphAttributes={};this.groups=[];this.boundingSphere=this.boundingBox=null;this.drawRange={start:0,count:Infinity};this.userData={}} -function Kb(a,b,c,d,e,f){M.call(this);this.type="BoxGeometry";this.parameters={width:a,height:b,depth:c,widthSegments:d,heightSegments:e,depthSegments:f};this.fromBufferGeometry(new mb(a,b,c,d,e,f));this.mergeVertices()}function mb(a,b,c,d,e,f){function g(a,b,c,d,e,f,g,l,S,E,If){var r=f/S,O=g/E,v=f/2,y=g/2,w=l/2;g=S+1;var x=E+1,D=f=0,G,z,A=new p;for(z=0;zm;m++){if(n=d[m])if(h=n[0],k=n[1]){t&&e.addAttribute("morphTarget"+m,t[h]);f&&e.addAttribute("morphNormal"+m,f[h]);c[m]=k;continue}c[m]=0}g.getUniforms().setValue(a,"morphTargetInfluences",c)}}}function Uf(a,b){var c={};return{update:function(d){var e=b.render.frame,f=d.geometry,g=a.get(d,f);c[g.id]!==e&&(f.isGeometry&&g.updateFromObject(d),a.update(g),c[g.id]=e);return g},dispose:function(){c={}}}}function Wa(a,b,c,d,e,f,g,h,k,m){a=void 0!==a?a:[];T.call(this,a,void 0!==b?b:301,c,d,e,f, -g,h,k,m);this.flipY=!1}function Lb(a,b,c){var d=a[0];if(0>=d||0/gm,function(a,c){a=U[c];if(void 0===a)throw Error("Can not resolve #include <"+c+">");return Wd(a)})}function We(a){return a.replace(/#pragma unroll_loop[\s]+?for \( int i = (\d+); i < (\d+); i \+\+ \) \{([\s\S]+?)(?=\})\}/g,function(a,c,d,e){a="";for(c=parseInt(c);c< -parseInt(d);c++)a+=e.replace(/\[ i \]/g,"[ "+c+" ]");return a})}function wg(a,b,c,d,e,f,g){var h=a.context,k=d.defines,m=e.vertexShader,t=e.fragmentShader,n="SHADOWMAP_TYPE_BASIC";1===f.shadowMapType?n="SHADOWMAP_TYPE_PCF":2===f.shadowMapType&&(n="SHADOWMAP_TYPE_PCF_SOFT");var q="ENVMAP_TYPE_CUBE",u="ENVMAP_MODE_REFLECTION",r="ENVMAP_BLENDING_MULTIPLY";if(f.envMap){switch(d.envMap.mapping){case 301:case 302:q="ENVMAP_TYPE_CUBE";break;case 306:case 307:q="ENVMAP_TYPE_CUBE_UV";break;case 303:case 304:q= -"ENVMAP_TYPE_EQUIREC";break;case 305:q="ENVMAP_TYPE_SPHERE"}switch(d.envMap.mapping){case 302:case 304:u="ENVMAP_MODE_REFRACTION"}switch(d.combine){case 0:r="ENVMAP_BLENDING_MULTIPLY";break;case 1:r="ENVMAP_BLENDING_MIX";break;case 2:r="ENVMAP_BLENDING_ADD"}}var l=0b&&(b=a[c]);return b}function F(){Object.defineProperty(this,"id",{value:Kf+=2});this.uuid=S.generateUUID();this.name="";this.type="BufferGeometry";this.index=null;this.attributes={};this.morphAttributes= +{};this.groups=[];this.boundingSphere=this.boundingBox=null;this.drawRange={start:0,count:Infinity};this.userData={}}function Kb(a,b,c,d,e,f){M.call(this);this.type="BoxGeometry";this.parameters={width:a,height:b,depth:c,widthSegments:d,heightSegments:e,depthSegments:f};this.fromBufferGeometry(new nb(a,b,c,d,e,f));this.mergeVertices()}function nb(a,b,c,d,e,f){function g(a,b,c,d,e,f,g,l,X,B,Lb){var t=f/X,u=g/B,y=f/2,w=g/2,x=l/2;g=X+1;var R=B+1,J=f=0,D,A,z=new p;for(A=0;Am;m++){if(n=d[m])if(h=n[0],k=n[1]){r&&e.addAttribute("morphTarget"+m,r[h]);f&&e.addAttribute("morphNormal"+m,f[h]);c[m]=k;continue}c[m]=0}g.getUniforms().setValue(a,"morphTargetInfluences",c)}}}function Wf(a,b){var c={};return{update:function(d){var e=b.render.frame,f=d.geometry,g= +a.get(d,f);c[g.id]!==e&&(f.isGeometry&&g.updateFromObject(d),a.update(g),c[g.id]=e);return g},dispose:function(){c={}}}}function Ya(a,b,c,d,e,f,g,h,k,m){a=void 0!==a?a:[];Q.call(this,a,void 0!==b?b:301,c,d,e,f,g,h,k,m);this.flipY=!1}function Mb(a,b,c,d){Q.call(this,null);this.image={data:a,width:b,height:c,depth:d};this.minFilter=this.magFilter=1003;this.flipY=this.generateMipmaps=!1}function Nb(a,b,c){var d=a[0];if(0>=d||0/gm,function(a,c){a=K[c];if(void 0===a)throw Error("Can not resolve #include <"+c+">");return $d(a)})}function Ze(a){return a.replace(/#pragma unroll_loop[\s]+?for \( int i = (\d+); i < (\d+); i \+\+ \) \{([\s\S]+?)(?=\})\}/g,function(a,c,d,e){a="";for(c=parseInt(c);c< +parseInt(d);c++)a+=e.replace(/\[ i \]/g,"[ "+c+" ]");return a})}function Ag(a,b,c,d,e,f,g){var h=a.context,k=d.defines,m=e.vertexShader,r=e.fragmentShader,n="SHADOWMAP_TYPE_BASIC";1===f.shadowMapType?n="SHADOWMAP_TYPE_PCF":2===f.shadowMapType&&(n="SHADOWMAP_TYPE_PCF_SOFT");var q="ENVMAP_TYPE_CUBE",v="ENVMAP_MODE_REFLECTION",t="ENVMAP_BLENDING_MULTIPLY";if(f.envMap){switch(d.envMap.mapping){case 301:case 302:q="ENVMAP_TYPE_CUBE";break;case 306:case 307:q="ENVMAP_TYPE_CUBE_UV";break;case 303:case 304:q= +"ENVMAP_TYPE_EQUIREC";break;case 305:q="ENVMAP_TYPE_SPHERE"}switch(d.envMap.mapping){case 302:case 304:v="ENVMAP_MODE_REFRACTION"}switch(d.combine){case 0:t="ENVMAP_BLENDING_MULTIPLY";break;case 1:t="ENVMAP_BLENDING_MIX";break;case 2:t="ENVMAP_BLENDING_ADD"}}var l=0b||a.height>b){if("data"in a){console.warn("THREE.WebGLRenderer: image in DataTexture is too big ("+a.width+"x"+a.height+").");return}b/=Math.max(a.width,a.height); -var c=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");c.width=Math.floor(a.width*b);c.height=Math.floor(a.height*b);c.getContext("2d").drawImage(a,0,0,a.width,a.height,0,0,c.width,c.height);console.warn("THREE.WebGLRenderer: image is too big ("+a.width+"x"+a.height+"). Resized to "+c.width+"x"+c.height);return c}return a}function k(a){return K.isPowerOfTwo(a.width)&&K.isPowerOfTwo(a.height)}function m(a,b){return a.generateMipmaps&&b&&1003!==a.minFilter&&1006!==a.minFilter}function t(b, -c,e,f){a.generateMipmap(b);d.get(c).__maxMipLevel=Math.log(Math.max(e,f))*Math.LOG2E}function n(b,c){if(!e.isWebGL2)return b;if(b===a.RGB){if(c===a.FLOAT)return a.RGB32F;if(c===a.HALF_FLOAT)return a.RGB16F;if(c===a.UNSIGNED_BYTE)return a.RGB8}if(b===a.RGBA){if(c===a.FLOAT)return a.RGBA32F;if(c===a.HALF_FLOAT)return a.RGBA16F;if(c===a.UNSIGNED_BYTE)return a.RGBA8}return b}function q(b){return 1003===b||1004===b||1005===b?a.NEAREST:a.LINEAR}function u(b){b=b.target;b.removeEventListener("dispose",u); -a:{var c=d.get(b);if(b.image&&c.__image__webglTextureCube)a.deleteTexture(c.__image__webglTextureCube);else{if(void 0===c.__webglInit)break a;a.deleteTexture(c.__webglTexture)}d.remove(b)}b.isVideoTexture&&delete G[b.id];g.memory.textures--}function l(b){b=b.target;b.removeEventListener("dispose",l);var c=d.get(b),e=d.get(b.texture);if(b){void 0!==e.__webglTexture&&a.deleteTexture(e.__webglTexture);b.depthTexture&&b.depthTexture.dispose();if(b.isWebGLRenderTargetCube)for(e=0;6>e;e++)a.deleteFramebuffer(c.__webglFramebuffer[e]), -c.__webglDepthbuffer&&a.deleteRenderbuffer(c.__webglDepthbuffer[e]);else a.deleteFramebuffer(c.__webglFramebuffer),c.__webglDepthbuffer&&a.deleteRenderbuffer(c.__webglDepthbuffer);d.remove(b.texture);d.remove(b)}g.memory.textures--}function v(b,q){var l=d.get(b);if(b.isVideoTexture){var r=b.id,v=g.render.frame;G[r]!==v&&(G[r]=v,b.update())}if(0w;w++)v[w]=q||r?r?b.image[w].image:b.image[w]:h(b.image[w],e.maxCubemapSize);var y=v[0],O=k(y),x=f.convert(b.format),D=f.convert(b.type),G=n(x,D);p(a.TEXTURE_CUBE_MAP,b,O);for(w=0;6>w;w++)if(q)for(var S,z=v[w].mipmaps,A=0,B=z.length;Aq;q++)e.__webglFramebuffer[q]=a.createFramebuffer()}else e.__webglFramebuffer= -a.createFramebuffer();if(h){c.bindTexture(a.TEXTURE_CUBE_MAP,f.__webglTexture);p(a.TEXTURE_CUBE_MAP,b.texture,n);for(q=0;6>q;q++)x(e.__webglFramebuffer[q],b,a.COLOR_ATTACHMENT0,a.TEXTURE_CUBE_MAP_POSITIVE_X+q);m(b.texture,n)&&t(a.TEXTURE_CUBE_MAP,b.texture,b.width,b.height);c.bindTexture(a.TEXTURE_CUBE_MAP,null)}else c.bindTexture(a.TEXTURE_2D,f.__webglTexture),p(a.TEXTURE_2D,b.texture,n),x(e.__webglFramebuffer,b,a.COLOR_ATTACHMENT0,a.TEXTURE_2D),m(b.texture,n)&&t(a.TEXTURE_2D,b.texture,b.width,b.height), -c.bindTexture(a.TEXTURE_2D,null);if(b.depthBuffer){e=d.get(b);f=!0===b.isWebGLRenderTargetCube;if(b.depthTexture){if(f)throw Error("target.depthTexture not supported in Cube render targets");if(b&&b.isWebGLRenderTargetCube)throw Error("Depth Texture with cube render targets is not supported");a.bindFramebuffer(a.FRAMEBUFFER,e.__webglFramebuffer);if(!b.depthTexture||!b.depthTexture.isDepthTexture)throw Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");d.get(b.depthTexture).__webglTexture&& -b.depthTexture.image.width===b.width&&b.depthTexture.image.height===b.height||(b.depthTexture.image.width=b.width,b.depthTexture.image.height=b.height,b.depthTexture.needsUpdate=!0);v(b.depthTexture,0);e=d.get(b.depthTexture).__webglTexture;if(1026===b.depthTexture.format)a.framebufferTexture2D(a.FRAMEBUFFER,a.DEPTH_ATTACHMENT,a.TEXTURE_2D,e,0);else if(1027===b.depthTexture.format)a.framebufferTexture2D(a.FRAMEBUFFER,a.DEPTH_STENCIL_ATTACHMENT,a.TEXTURE_2D,e,0);else throw Error("Unknown depthTexture format"); -}else if(f)for(e.__webglDepthbuffer=[],f=0;6>f;f++)a.bindFramebuffer(a.FRAMEBUFFER,e.__webglFramebuffer[f]),e.__webglDepthbuffer[f]=a.createRenderbuffer(),w(e.__webglDepthbuffer[f],b);else a.bindFramebuffer(a.FRAMEBUFFER,e.__webglFramebuffer),e.__webglDepthbuffer=a.createRenderbuffer(),w(e.__webglDepthbuffer,b);a.bindFramebuffer(a.FRAMEBUFFER,null)}};this.updateRenderTargetMipmap=function(b){var e=b.texture,f=k(b);if(m(e,f)){f=b.isWebGLRenderTargetCube?a.TEXTURE_CUBE_MAP:a.TEXTURE_2D;var g=d.get(e).__webglTexture; -c.bindTexture(f,g);t(f,e,b.width,b.height);c.bindTexture(f,null)}}}function Ze(a,b,c){return{convert:function(d){if(1E3===d)return a.REPEAT;if(1001===d)return a.CLAMP_TO_EDGE;if(1002===d)return a.MIRRORED_REPEAT;if(1003===d)return a.NEAREST;if(1004===d)return a.NEAREST_MIPMAP_NEAREST;if(1005===d)return a.NEAREST_MIPMAP_LINEAR;if(1006===d)return a.LINEAR;if(1007===d)return a.LINEAR_MIPMAP_NEAREST;if(1008===d)return a.LINEAR_MIPMAP_LINEAR;if(1009===d)return a.UNSIGNED_BYTE;if(1017===d)return a.UNSIGNED_SHORT_4_4_4_4; -if(1018===d)return a.UNSIGNED_SHORT_5_5_5_1;if(1019===d)return a.UNSIGNED_SHORT_5_6_5;if(1010===d)return a.BYTE;if(1011===d)return a.SHORT;if(1012===d)return a.UNSIGNED_SHORT;if(1013===d)return a.INT;if(1014===d)return a.UNSIGNED_INT;if(1015===d)return a.FLOAT;if(1016===d){if(c.isWebGL2)return a.HALF_FLOAT;var e=b.get("OES_texture_half_float");if(null!==e)return e.HALF_FLOAT_OES}if(1021===d)return a.ALPHA;if(1022===d)return a.RGB;if(1023===d)return a.RGBA;if(1024===d)return a.LUMINANCE;if(1025=== -d)return a.LUMINANCE_ALPHA;if(1026===d)return a.DEPTH_COMPONENT;if(1027===d)return a.DEPTH_STENCIL;if(100===d)return a.FUNC_ADD;if(101===d)return a.FUNC_SUBTRACT;if(102===d)return a.FUNC_REVERSE_SUBTRACT;if(200===d)return a.ZERO;if(201===d)return a.ONE;if(202===d)return a.SRC_COLOR;if(203===d)return a.ONE_MINUS_SRC_COLOR;if(204===d)return a.SRC_ALPHA;if(205===d)return a.ONE_MINUS_SRC_ALPHA;if(206===d)return a.DST_ALPHA;if(207===d)return a.ONE_MINUS_DST_ALPHA;if(208===d)return a.DST_COLOR;if(209=== -d)return a.ONE_MINUS_DST_COLOR;if(210===d)return a.SRC_ALPHA_SATURATE;if(33776===d||33777===d||33778===d||33779===d)if(e=b.get("WEBGL_compressed_texture_s3tc"),null!==e){if(33776===d)return e.COMPRESSED_RGB_S3TC_DXT1_EXT;if(33777===d)return e.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(33778===d)return e.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(33779===d)return e.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(35840===d||35841===d||35842===d||35843===d)if(e=b.get("WEBGL_compressed_texture_pvrtc"),null!==e){if(35840===d)return e.COMPRESSED_RGB_PVRTC_4BPPV1_IMG; -if(35841===d)return e.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(35842===d)return e.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(35843===d)return e.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(36196===d&&(e=b.get("WEBGL_compressed_texture_etc1"),null!==e))return e.COMPRESSED_RGB_ETC1_WEBGL;if(37808===d||37809===d||37810===d||37811===d||37812===d||37813===d||37814===d||37815===d||37816===d||37817===d||37818===d||37819===d||37820===d||37821===d)if(e=b.get("WEBGL_compressed_texture_astc"),null!==e)return d;if(103===d||104=== -d){if(c.isWebGL2){if(103===d)return a.MIN;if(104===d)return a.MAX}e=b.get("EXT_blend_minmax");if(null!==e){if(103===d)return e.MIN_EXT;if(104===d)return e.MAX_EXT}}if(1020===d){if(c.isWebGL2)return a.UNSIGNED_INT_24_8;e=b.get("WEBGL_depth_texture");if(null!==e)return e.UNSIGNED_INT_24_8_WEBGL}return 0}}}function Mb(){B.call(this);this.type="Group"}function X(a,b,c,d){Pa.call(this);this.type="PerspectiveCamera";this.fov=void 0!==a?a:50;this.zoom=1;this.near=void 0!==c?c:.1;this.far=void 0!==d?d:2E3; -this.focus=10;this.aspect=void 0!==b?b:1;this.view=null;this.filmGauge=35;this.filmOffset=0;this.updateProjectionMatrix()}function Ac(a){X.call(this);this.cameras=a||[]}function $e(a){function b(){return null!==e&&!0===e.isPresenting}function c(){if(b()){var c=e.getEyeParameters("left"),f=c.renderWidth;c=c.renderHeight;w=a.getPixelRatio();x=a.getSize();a.setDrawingBufferSize(2*f,c,1);D.start()}else d.enabled&&a.setDrawingBufferSize(x.width,x.height,w),D.stop()}var d=this,e=null,f=null,g=null,h=[], -k=new J,m=new J,t="stage";"undefined"!==typeof window&&"VRFrameData"in window&&(f=new window.VRFrameData,window.addEventListener("vrdisplaypresentchange",c,!1));var n=new J,q=new ha,u=new p,l=new X;l.bounds=new aa(0,0,.5,1);l.layers.enable(1);var v=new X;v.bounds=new aa(.5,0,.5,1);v.layers.enable(2);var y=new Ac([l,v]);y.layers.enable(1);y.layers.enable(2);var x,w,G=[];this.enabled=!1;this.getController=function(a){var b=h[a];void 0===b&&(b=new Mb,b.matrixAutoUpdate=!1,b.visible=!1,h[a]=b);return b}; -this.getDevice=function(){return e};this.setDevice=function(a){void 0!==a&&(e=a);D.setContext(a)};this.setFrameOfReferenceType=function(a){t=a};this.setPoseTarget=function(a){void 0!==a&&(g=a)};this.getCamera=function(a){var b="stage"===t?1.6:0;if(null===e)return a.position.set(0,b,0),a;e.depthNear=a.near;e.depthFar=a.far;e.getFrameData(f);if("stage"===t){var c=e.stageParameters;c?k.fromArray(c.sittingToStandingTransform):k.makeTranslation(0,b,0)}b=f.pose;c=null!==g?g:a;c.matrix.copy(k);c.matrix.decompose(c.position, -c.quaternion,c.scale);null!==b.orientation&&(q.fromArray(b.orientation),c.quaternion.multiply(q));null!==b.position&&(q.setFromRotationMatrix(k),u.fromArray(b.position),u.applyQuaternion(q),c.position.add(u));c.updateMatrixWorld();if(!1===e.isPresenting)return a;l.near=a.near;v.near=a.near;l.far=a.far;v.far=a.far;y.matrixWorld.copy(a.matrixWorld);y.matrixWorldInverse.copy(a.matrixWorldInverse);l.matrixWorldInverse.fromArray(f.leftViewMatrix);v.matrixWorldInverse.fromArray(f.rightViewMatrix);m.getInverse(k); -"stage"===t&&(l.matrixWorldInverse.multiply(m),v.matrixWorldInverse.multiply(m));a=c.parent;null!==a&&(n.getInverse(a.matrixWorld),l.matrixWorldInverse.multiply(n),v.matrixWorldInverse.multiply(n));l.matrixWorld.getInverse(l.matrixWorldInverse);v.matrixWorld.getInverse(v.matrixWorldInverse);l.projectionMatrix.fromArray(f.leftProjectionMatrix);v.projectionMatrix.fromArray(f.rightProjectionMatrix);y.projectionMatrix.copy(l.projectionMatrix);a=e.getLayers();a.length&&(a=a[0],null!==a.leftBounds&&4=== -a.leftBounds.length&&l.bounds.fromArray(a.leftBounds),null!==a.rightBounds&&4===a.rightBounds.length&&v.bounds.fromArray(a.rightBounds));a:for(a=0;af.normalMatrix.determinant();ca.setMaterial(e,h);var k=q(a,c,e,f),m=!1;if(b!==d.id||H!==k.id||U!==(!0===e.wireframe))b=d.id,H=k.id,U=!0===e.wireframe,m=!0;f.morphTargetInfluences&&(wa.update(f,d,e,k),m=!0);h=d.index;var t= -d.attributes.position;c=1;!0===e.wireframe&&(h=sa.getWireframeAttribute(d),c=2);a=xa;if(null!==h){var n=qa.get(h);a=za;a.setIndex(n)}if(m){if(d&&d.isInstancedBufferGeometry&!va.isWebGL2&&null===ia.get("ANGLE_instanced_arrays"))console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");else{ca.initAttributes();m=d.attributes;k=k.getAttributes();var l=e.defaultAttributeValues;for(O in k){var u=k[O]; -if(0<=u){var r=m[O];if(void 0!==r){var v=r.normalized,p=r.itemSize,w=qa.get(r);if(void 0!==w){var y=w.buffer,x=w.type;w=w.bytesPerElement;if(r.isInterleavedBufferAttribute){var D=r.data,G=D.stride;r=r.offset;D&&D.isInstancedInterleavedBuffer?(ca.enableAttributeAndDivisor(u,D.meshPerAttribute),void 0===d.maxInstancedCount&&(d.maxInstancedCount=D.meshPerAttribute*D.count)):ca.enableAttribute(u);C.bindBuffer(C.ARRAY_BUFFER,y);C.vertexAttribPointer(u,p,x,v,G*w,r*w)}else r.isInstancedBufferAttribute?(ca.enableAttributeAndDivisor(u, -r.meshPerAttribute),void 0===d.maxInstancedCount&&(d.maxInstancedCount=r.meshPerAttribute*r.count)):ca.enableAttribute(u),C.bindBuffer(C.ARRAY_BUFFER,y),C.vertexAttribPointer(u,p,x,v,0,0)}}else if(void 0!==l&&(v=l[O],void 0!==v))switch(v.length){case 2:C.vertexAttrib2fv(u,v);break;case 3:C.vertexAttrib3fv(u,v);break;case 4:C.vertexAttrib4fv(u,v);break;default:C.vertexAttrib1fv(u,v)}}}ca.disableUnusedAttributes()}null!==h&&C.bindBuffer(C.ELEMENT_ARRAY_BUFFER,n.buffer)}n=Infinity;null!==h?n=h.count: -void 0!==t&&(n=t.count);h=d.drawRange.start*c;t=null!==g?g.start*c:0;var O=Math.max(h,t);g=Math.max(0,Math.min(n,h+d.drawRange.count*c,t+(null!==g?g.count*c:Infinity))-1-O+1);if(0!==g){if(f.isMesh)if(!0===e.wireframe)ca.setLineWidth(e.wireframeLinewidth*(null===L?W:1)),a.setMode(C.LINES);else switch(f.drawMode){case 0:a.setMode(C.TRIANGLES);break;case 1:a.setMode(C.TRIANGLE_STRIP);break;case 2:a.setMode(C.TRIANGLE_FAN)}else f.isLine?(e=e.linewidth,void 0===e&&(e=1),ca.setLineWidth(e*(null===L?W:1)), -f.isLineSegments?a.setMode(C.LINES):f.isLineLoop?a.setMode(C.LINE_LOOP):a.setMode(C.LINE_STRIP)):f.isPoints?a.setMode(C.POINTS):f.isSprite&&a.setMode(C.TRIANGLES);d&&d.isInstancedBufferGeometry?0=va.maxTextures&&console.warn("THREE.WebGLRenderer: Trying to use "+a+" texture units while this GPU supports only "+ -va.maxTextures);fa+=1;return a};this.setTexture2D=function(){var a=!1;return function(b,c){b&&b.isWebGLRenderTarget&&(a||(console.warn("THREE.WebGLRenderer.setTexture2D: don't use render targets as textures. Use their .texture property instead."),a=!0),b=b.texture);ja.setTexture2D(b,c)}}();this.setTexture=function(){var a=!1;return function(b,c){a||(console.warn("THREE.WebGLRenderer: .setTexture is deprecated, use setTexture2D instead."),a=!0);ja.setTexture2D(b,c)}}();this.setTextureCube=function(){var a= -!1;return function(b,c){b&&b.isWebGLRenderTargetCube&&(a||(console.warn("THREE.WebGLRenderer.setTextureCube: don't use cube render targets as textures. Use their .texture property instead."),a=!0),b=b.texture);b&&b.isCubeTexture||Array.isArray(b.image)&&6===b.image.length?ja.setTextureCube(b,c):ja.setTextureCubeDynamic(b,c)}}();this.setFramebuffer=function(a){F=a};this.getRenderTarget=function(){return L};this.setRenderTarget=function(a){(L=a)&&void 0===Ca.get(a).__webglFramebuffer&&ja.setupRenderTarget(a); -var b=F,c=!1;a?(b=Ca.get(a).__webglFramebuffer,a.isWebGLRenderTargetCube&&(b=b[a.activeCubeFace],c=!0),T.copy(a.viewport),zc.copy(a.scissor),Y=a.scissorTest):(T.copy(cb).multiplyScalar(W),zc.copy(ha).multiplyScalar(W),Y=ra);M!==b&&(C.bindFramebuffer(C.FRAMEBUFFER,b),M=b);ca.viewport(T);ca.scissor(zc);ca.setScissorTest(Y);c&&(c=Ca.get(a.texture),C.framebufferTexture2D(C.FRAMEBUFFER,C.COLOR_ATTACHMENT0,C.TEXTURE_CUBE_MAP_POSITIVE_X+a.activeCubeFace,c.__webglTexture,a.activeMipMapLevel))};this.readRenderTargetPixels= -function(a,b,c,d,e,f){if(a&&a.isWebGLRenderTarget){var g=Ca.get(a).__webglFramebuffer;if(g){var h=!1;g!==M&&(C.bindFramebuffer(C.FRAMEBUFFER,g),h=!0);try{var k=a.texture,m=k.format,t=k.type;1023!==m&&ea.convert(m)!==C.getParameter(C.IMPLEMENTATION_COLOR_READ_FORMAT)?console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format."):1009===t||ea.convert(t)===C.getParameter(C.IMPLEMENTATION_COLOR_READ_TYPE)||1015===t&&(va.isWebGL2||ia.get("OES_texture_float")|| -ia.get("WEBGL_color_buffer_float"))||1016===t&&(va.isWebGL2?ia.get("EXT_color_buffer_float"):ia.get("EXT_color_buffer_half_float"))?C.checkFramebufferStatus(C.FRAMEBUFFER)===C.FRAMEBUFFER_COMPLETE?0<=b&&b<=a.width-d&&0<=c&&c<=a.height-e&&C.readPixels(b,c,d,e,ea.convert(m),ea.convert(t),f):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete."):console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.")}finally{h&& -C.bindFramebuffer(C.FRAMEBUFFER,M)}}}else console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.")};this.copyFramebufferToTexture=function(a,b,c){var d=b.image.width,e=b.image.height,f=ea.convert(b.format);this.setTexture2D(b,0);C.copyTexImage2D(C.TEXTURE_2D,c||0,f,a.x,a.y,d,e,0)};this.copyTextureToTexture=function(a,b,c,d){var e=b.image.width,f=b.image.height,g=ea.convert(c.format),h=ea.convert(c.type);this.setTexture2D(c,0);b.isDataTexture?C.texSubImage2D(C.TEXTURE_2D, -d||0,a.x,a.y,e,f,g,h,b.image.data):C.texSubImage2D(C.TEXTURE_2D,d||0,a.x,a.y,g,h,b.image)}}function Nb(a,b){this.name="";this.color=new F(a);this.density=void 0!==b?b:2.5E-4}function Ob(a,b,c){this.name="";this.color=new F(a);this.near=void 0!==b?b:1;this.far=void 0!==c?c:1E3}function rd(){B.call(this);this.type="Scene";this.overrideMaterial=this.fog=this.background=null;this.autoUpdate=!0}function qb(a,b){this.array=a;this.stride=b;this.count=void 0!==a?a.length/b:0;this.dynamic=!1;this.updateRange= -{offset:0,count:-1};this.version=0}function Bc(a,b,c,d){this.data=a;this.itemSize=b;this.offset=c;this.normalized=!0===d}function eb(a){H.call(this);this.type="SpriteMaterial";this.color=new F(16777215);this.map=null;this.rotation=0;this.sizeAttenuation=!0;this.lights=!1;this.transparent=!0;this.setValues(a)}function Cc(a){B.call(this);this.type="Sprite";if(void 0===Pb){Pb=new I;var b=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]);b=new qb(b,5);Pb.setIndex([0,1,2,0,2,3]); -Pb.addAttribute("position",new Bc(b,3,0,!1));Pb.addAttribute("uv",new Bc(b,2,3,!1))}this.geometry=Pb;this.material=void 0!==a?a:new eb;this.center=new z(.5,.5)}function Dc(){B.call(this);this.type="LOD";Object.defineProperties(this,{levels:{enumerable:!0,value:[]}})}function Ec(a,b){a=a||[];this.bones=a.slice(0);this.boneMatrices=new Float32Array(16*this.bones.length);if(void 0===b)this.calculateInverses();else if(this.bones.length===b.length)this.boneInverses=b.slice(0);else for(console.warn("THREE.Skeleton boneInverses is the wrong length."), -this.boneInverses=[],a=0,b=this.bones.length;ac;c++){var n=t[h[c]];var q=t[h[(c+1)%3]];f[0]=Math.min(n,q);f[1]=Math.max(n,q);n=f[0]+","+f[1];void 0===g[n]&&(g[n]={index1:f[0],index2:f[1]})}}for(n in g)m=g[n],h=a.vertices[m.index1],b.push(h.x,h.y,h.z),h=a.vertices[m.index2],b.push(h.x,h.y,h.z)}else if(a&&a.isBufferGeometry)if(h=new p,null!==a.index){k=a.attributes.position;t=a.index;var l=a.groups;0===l.length&&(l=[{start:0, -count:t.count,materialIndex:0}]);a=0;for(e=l.length;ac;c++)n=t.getX(m+c),q=t.getX(m+(c+1)%3),f[0]=Math.min(n,q),f[1]=Math.max(n,q),n=f[0]+","+f[1],void 0===g[n]&&(g[n]={index1:f[0],index2:f[1]});for(n in g)m=g[n],h.fromBufferAttribute(k,m.index1),b.push(h.x,h.y,h.z),h.fromBufferAttribute(k,m.index2),b.push(h.x,h.y,h.z)}else for(k=a.attributes.position,m=0,d=k.count/3;mc;c++)g=3*m+c,h.fromBufferAttribute(k,g),b.push(h.x, -h.y,h.z),g=3*m+(c+1)%3,h.fromBufferAttribute(k,g),b.push(h.x,h.y,h.z);this.addAttribute("position",new A(b,3))}function Hc(a,b,c){M.call(this);this.type="ParametricGeometry";this.parameters={func:a,slices:b,stacks:c};this.fromBufferGeometry(new Tb(a,b,c));this.mergeVertices()}function Tb(a,b,c){I.call(this);this.type="ParametricBufferGeometry";this.parameters={func:a,slices:b,stacks:c};var d=[],e=[],f=[],g=[],h=new p,k=new p,m=new p,t=new p,n=new p,q,l;3>a.length&&console.error("THREE.ParametricGeometry: Function must now modify a Vector3 as third parameter."); -var r=b+1;for(q=0;q<=c;q++){var v=q/c;for(l=0;l<=b;l++){var y=l/b;a(y,v,k);e.push(k.x,k.y,k.z);0<=y-1E-5?(a(y-1E-5,v,m),t.subVectors(k,m)):(a(y+1E-5,v,m),t.subVectors(m,k));0<=v-1E-5?(a(y,v-1E-5,m),n.subVectors(k,m)):(a(y,v+1E-5,m),n.subVectors(m,k));h.crossVectors(t,n).normalize();f.push(h.x,h.y,h.z);g.push(y,v)}}for(q=0;qd&&1===a.x&&(k[b]=a.x-1);0===c.x&&0===c.z&&(k[b]=d/2/Math.PI+.5)}I.call(this);this.type="PolyhedronBufferGeometry";this.parameters={vertices:a, -indices:b,radius:c,detail:d};c=c||1;d=d||0;var h=[],k=[];(function(a){for(var c=new p,d=new p,g=new p,h=0;he&&(.2>b&&(k[a+0]+=1),.2>c&&(k[a+2]+=1),.2>d&&(k[a+4]+=1))})();this.addAttribute("position",new A(h,3));this.addAttribute("normal",new A(h.slice(),3));this.addAttribute("uv",new A(k,2));0===d?this.computeVertexNormals():this.normalizeNormals()}function Jc(a, -b){M.call(this);this.type="TetrahedronGeometry";this.parameters={radius:a,detail:b};this.fromBufferGeometry(new Ub(a,b));this.mergeVertices()}function Ub(a,b){la.call(this,[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],a,b);this.type="TetrahedronBufferGeometry";this.parameters={radius:a,detail:b}}function Kc(a,b){M.call(this);this.type="OctahedronGeometry";this.parameters={radius:a,detail:b};this.fromBufferGeometry(new rb(a,b));this.mergeVertices()}function rb(a,b){la.call(this,[1,0,0, --1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],a,b);this.type="OctahedronBufferGeometry";this.parameters={radius:a,detail:b}}function Lc(a,b){M.call(this);this.type="IcosahedronGeometry";this.parameters={radius:a,detail:b};this.fromBufferGeometry(new Vb(a,b));this.mergeVertices()}function Vb(a,b){var c=(1+Math.sqrt(5))/2;la.call(this,[-1,c,0,1,c,0,-1,-c,0,1,-c,0,0,-1,c,0,1,c,0,-1,-c,0,1,-c,c,0,-1,c,0,1,-c,0,-1,-c,0,1],[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5, -11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],a,b);this.type="IcosahedronBufferGeometry";this.parameters={radius:a,detail:b}}function Mc(a,b){M.call(this);this.type="DodecahedronGeometry";this.parameters={radius:a,detail:b};this.fromBufferGeometry(new Wb(a,b));this.mergeVertices()}function Wb(a,b){var c=(1+Math.sqrt(5))/2,d=1/c;la.call(this,[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-d,-c,0,-d,c,0,d,-c,0,d,c,-d,-c,0,-d,c,0,d,-c,0,d,c, -0,-c,0,-d,c,0,-d,-c,0,d,c,0,d],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],a,b);this.type="DodecahedronBufferGeometry";this.parameters={radius:a,detail:b}}function Nc(a,b,c,d,e,f){M.call(this);this.type="TubeGeometry";this.parameters={path:a,tubularSegments:b,radius:c,radialSegments:d, -closed:e};void 0!==f&&console.warn("THREE.TubeGeometry: taper has been removed.");a=new Xb(a,b,c,d,e);this.tangents=a.tangents;this.normals=a.normals;this.binormals=a.binormals;this.fromBufferGeometry(a);this.mergeVertices()}function Xb(a,b,c,d,e){function f(e){t=a.getPointAt(e/b,t);var f=g.normals[e];e=g.binormals[e];for(q=0;q<=d;q++){var m=q/d*Math.PI*2,n=Math.sin(m);m=-Math.cos(m);k.x=m*f.x+n*e.x;k.y=m*f.y+n*e.y;k.z=m*f.z+n*e.z;k.normalize();r.push(k.x,k.y,k.z);h.x=t.x+c*k.x;h.y=t.y+c*k.y;h.z= -t.z+c*k.z;l.push(h.x,h.y,h.z)}}I.call(this);this.type="TubeBufferGeometry";this.parameters={path:a,tubularSegments:b,radius:c,radialSegments:d,closed:e};b=b||64;c=c||1;d=d||8;e=e||!1;var g=a.computeFrenetFrames(b,e);this.tangents=g.tangents;this.normals=g.normals;this.binormals=g.binormals;var h=new p,k=new p,m=new z,t=new p,n,q,l=[],r=[],v=[],y=[];for(n=0;n=b;e-=d)f=bf(e,a[e],a[e+1],f);f&&sb(f,f.next)&&(Qc(f),f=f.next);return f}function Rc(a,b){if(!a)return a;b||(b=a);do{var c=!1;if(a.steiner||!sb(a,a.next)&&0!==ma(a.prev,a,a.next))a=a.next;else{Qc(a);a=b=a.prev;if(a===a.next)break;c=!0}}while(c||a!==b);return b} -function Sc(a,b,c,d,e,f,g){if(a){if(!g&&f){var h=a,k=h;do null===k.z&&(k.z=$d(k.x,k.y,d,e,f)),k.prevZ=k.prev,k=k.nextZ=k.next;while(k!==h);k.prevZ.nextZ=null;k.prevZ=null;h=k;var m,t,n,l,u=1;do{k=h;var r=h=null;for(t=0;k;){t++;var v=k;for(m=n=0;mn.x?t.x>u.x?t.x:u.x:n.x>u.x?n.x:u.x,G=t.y>n.y?t.y>u.y?t.y:u.y:n.y>u.y?n.y:u.y;m=$d(t.x=m;){if(p!==r.prev&&p!==r.next&&vd(t.x,t.y,n.x,n.y,u.x,u.y,p.x,p.y)&&0<=ma(p.prev,p,p.next)){r=!1;break a}p= -p.prevZ}r=!0}}else a:if(r=a,t=r.prev,n=r,u=r.next,0<=ma(t,n,u))r=!1;else{for(m=r.next.next;m!==r.prev;){if(vd(t.x,t.y,n.x,n.y,u.x,u.y,m.x,m.y)&&0<=ma(m.prev,m,m.next)){r=!1;break a}m=m.next}r=!0}if(r)b.push(k.i/c),b.push(a.i/c),b.push(v.i/c),Qc(a),h=a=v.next;else if(a=v,a===h){if(!g)Sc(Rc(a),b,c,d,e,f,1);else if(1===g){g=b;h=c;k=a;do v=k.prev,r=k.next.next,!sb(v,r)&&cf(v,k,k.next,r)&&Tc(v,r)&&Tc(r,v)&&(g.push(v.i/h),g.push(k.i/h),g.push(r.i/h),Qc(k),Qc(k.next),k=a=r),k=k.next;while(k!==a);a=k;Sc(a, -b,c,d,e,f,2)}else if(2===g)a:{g=a;do{for(h=g.next.next;h!==g.prev;){if(k=g.i!==h.i){k=g;v=h;if(r=k.next.i!==v.i&&k.prev.i!==v.i){b:{r=k;do{if(r.i!==k.i&&r.next.i!==k.i&&r.i!==v.i&&r.next.i!==v.i&&cf(r,r.next,k,v)){r=!0;break b}r=r.next}while(r!==k);r=!1}r=!r}if(r=r&&Tc(k,v)&&Tc(v,k)){r=k;t=!1;n=(k.x+v.x)/2;v=(k.y+v.y)/2;do r.y>v!==r.next.y>v&&r.next.y!==r.y&&n<(r.next.x-r.x)*(v-r.y)/(r.next.y-r.y)+r.x&&(t=!t),r=r.next;while(r!==k);r=t}k=r}if(k){a=df(g,h);g=Rc(g,g.next);a=Rc(a,a.next);Sc(g,b,c,d,e, -f);Sc(a,b,c,d,e,f);break a}h=h.next}g=g.next}while(g!==a)}break}}}}function Mg(a,b){return a.x-b.x}function Ng(a,b){var c=b,d=a.x,e=a.y,f=-Infinity;do{if(e<=c.y&&e>=c.next.y&&c.next.y!==c.y){var g=c.x+(e-c.y)*(c.next.x-c.x)/(c.next.y-c.y);if(g<=d&&g>f){f=g;if(g===d){if(e===c.y)return c;if(e===c.next.y)return c.next}var h=c.x=c.x&&c.x>=g&&d!==c.x&&vd(eh.x)&&Tc(c,a)&&(h=c,m=t)}c=c.next}return h}function $d(a,b,c,d,e){a=32767*(a-c)*e;b=32767*(b-d)*e;a=(a|a<<8)&16711935;a=(a|a<<4)&252645135;a=(a|a<<2)&858993459;b=(b|b<<8)&16711935;b=(b|b<<4)&252645135;b=(b|b<<2)&858993459;return(a|a<<1)&1431655765|((b|b<<1)&1431655765)<<1}function Og(a){var b=a,c=a;do b.xma(a.prev,a,a.next)?0<=ma(a,b,a.next)&&0<=ma(a,a.prev,b):0>ma(a,b,a.prev)||0>ma(a,a.next,b)}function df(a,b){var c=new ae(a.i,a.x,a.y),d=new ae(b.i,b.x,b.y),e=a.next,f=b.prev;a.next=b;b.prev=a;c.next=e;e.prev= -c;d.next=c;c.prev=d;f.next=d;d.prev=f;return d}function bf(a,b,c,d){a=new ae(a,b,c);d?(a.next=d.next,a.prev=d,d.next.prev=a,d.next=a):(a.prev=a,a.next=a);return a}function Qc(a){a.next.prev=a.prev;a.prev.next=a.next;a.prevZ&&(a.prevZ.nextZ=a.nextZ);a.nextZ&&(a.nextZ.prevZ=a.prevZ)}function ae(a,b,c){this.i=a;this.x=b;this.y=c;this.nextZ=this.prevZ=this.z=this.next=this.prev=null;this.steiner=!1}function ef(a){var b=a.length;2Number.EPSILON){var k=Math.sqrt(h),m=Math.sqrt(f*f+g*g);h=b.x-e/k;b=b.y+d/k; -g=((c.x-g/m-h)*g-(c.y+f/m-b)*f)/(d*g-e*f);f=h+d*g-a.x;d=b+e*g-a.y;e=f*f+d*d;if(2>=e)return new z(f,d);e=Math.sqrt(e/2)}else a=!1,d>Number.EPSILON?f>Number.EPSILON&&(a=!0):d<-Number.EPSILON?f<-Number.EPSILON&&(a=!0):Math.sign(e)===Math.sign(g)&&(a=!0),a?(f=-e,e=Math.sqrt(h)):(f=d,d=e,e=Math.sqrt(h/2));return new z(f/e,d/e)}function h(a,b){for(N=a.length;0<=--N;){var c=N;var f=N-1;0>f&&(f=a.length-1);var g,h=w+2*E;for(g=0;gt;t++){var n=m[f[t]];var l=m[f[(t+1)%3]];d[0]=Math.min(n,l);d[1]=Math.max(n,l);n=d[0]+","+d[1];void 0===e[n]?e[n]={index1:d[0],index2:d[1],face1:h,face2:void 0}:e[n].face2=h}for(n in e)if(d=e[n],void 0===d.face2||g[d.face1].normal.dot(g[d.face2].normal)<=b)f=a[d.index1],c.push(f.x,f.y,f.z),f=a[d.index2], -c.push(f.x,f.y,f.z);this.addAttribute("position",new A(c,3))}function xb(a,b,c,d,e,f,g,h){M.call(this);this.type="CylinderGeometry";this.parameters={radiusTop:a,radiusBottom:b,height:c,radialSegments:d,heightSegments:e,openEnded:f,thetaStart:g,thetaLength:h};this.fromBufferGeometry(new Ya(a,b,c,d,e,f,g,h));this.mergeVertices()}function Ya(a,b,c,d,e,f,g,h){function k(c){var e,f=new z,k=new p,q=0,v=!0===c?a:b,w=!0===c?1:-1;var A=r;for(e=1;e<=d;e++)n.push(0,y*w,0),l.push(0,w,0),u.push(.5,.5),r++;var B= -r;for(e=0;e<=d;e++){var P=e/d*h+g,I=Math.cos(P);P=Math.sin(P);k.x=v*P;k.y=y*w;k.z=v*I;n.push(k.x,k.y,k.z);l.push(0,w,0);f.x=.5*I+.5;f.y=.5*P*w+.5;u.push(f.x,f.y);r++}for(e=0;ethis.duration&&this.resetDuration()}function Qg(a){switch(a.toLowerCase()){case "scalar":case "double":case "float":case "number":case "integer":return gc;case "vector":case "vector2":case "vector3":case "vector4":return hc; -case "color":return Id;case "quaternion":return ed;case "bool":case "boolean":return Hd;case "string":return Kd}throw Error("THREE.KeyframeTrack: Unsupported typeName: "+a);}function Rg(a){if(void 0===a.type)throw Error("THREE.KeyframeTrack: track type undefined, can not parse");var b=Qg(a.type);if(void 0===a.times){var c=[],d=[];qa.flattenJSON(a.keys,c,d,"value");a.times=c;a.values=d}return void 0!==b.parse?b.parse(a):new b(a.name,a.times,a.values,a.interpolation)}function Ld(a){this.manager=void 0!== -a?a:wa;this.textures={}}function fe(a){this.manager=void 0!==a?a:wa}function ic(){}function ge(a){"boolean"===typeof a&&(console.warn("THREE.JSONLoader: showStatus parameter has been removed from constructor."),a=void 0);this.manager=void 0!==a?a:wa;this.withCredentials=!1}function lf(a){this.manager=void 0!==a?a:wa;this.texturePath=""}function he(a){"undefined"===typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported.");"undefined"===typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."); -this.manager=void 0!==a?a:wa;this.options=void 0}function ie(){this.type="ShapePath";this.color=new F;this.subPaths=[];this.currentPath=null}function je(a){this.type="Font";this.data=a}function mf(a){this.manager=void 0!==a?a:wa}function ke(a){this.manager=void 0!==a?a:wa}function nf(){this.type="StereoCamera";this.aspect=1;this.eyeSep=.064;this.cameraL=new X;this.cameraL.layers.enable(1);this.cameraL.matrixAutoUpdate=!1;this.cameraR=new X;this.cameraR.layers.enable(2);this.cameraR.matrixAutoUpdate= -!1}function fd(a,b,c){B.call(this);this.type="CubeCamera";var d=new X(90,1,a,b);d.up.set(0,-1,0);d.lookAt(new p(1,0,0));this.add(d);var e=new X(90,1,a,b);e.up.set(0,-1,0);e.lookAt(new p(-1,0,0));this.add(e);var f=new X(90,1,a,b);f.up.set(0,0,1);f.lookAt(new p(0,1,0));this.add(f);var g=new X(90,1,a,b);g.up.set(0,0,-1);g.lookAt(new p(0,-1,0));this.add(g);var h=new X(90,1,a,b);h.up.set(0,-1,0);h.lookAt(new p(0,0,1));this.add(h);var k=new X(90,1,a,b);k.up.set(0,-1,0);k.lookAt(new p(0,0,-1));this.add(k); -this.renderTarget=new Ib(c,c,{format:1022,magFilter:1006,minFilter:1006});this.renderTarget.texture.name="CubeCamera";this.update=function(a,b){null===this.parent&&this.updateMatrixWorld();var c=this.renderTarget,m=c.texture.generateMipmaps;c.texture.generateMipmaps=!1;c.activeCubeFace=0;a.render(b,d,c);c.activeCubeFace=1;a.render(b,e,c);c.activeCubeFace=2;a.render(b,f,c);c.activeCubeFace=3;a.render(b,g,c);c.activeCubeFace=4;a.render(b,h,c);c.texture.generateMipmaps=m;c.activeCubeFace=5;a.render(b, -k,c);a.setRenderTarget(null)};this.clear=function(a,b,c,d){for(var e=this.renderTarget,f=0;6>f;f++)e.activeCubeFace=f,a.setRenderTarget(e),a.clear(b,c,d);a.setRenderTarget(null)}}function le(){B.call(this);this.type="AudioListener";this.context=me.getContext();this.gain=this.context.createGain();this.gain.connect(this.context.destination);this.filter=null}function jc(a){B.call(this);this.type="Audio";this.context=a.context;this.gain=this.context.createGain();this.gain.connect(a.getInput());this.autoplay= -!1;this.buffer=null;this.loop=!1;this.offset=this.startTime=0;this.playbackRate=1;this.isPlaying=!1;this.hasPlaybackControl=!0;this.sourceType="empty";this.filters=[]}function ne(a){jc.call(this,a);this.panner=this.context.createPanner();this.panner.connect(this.gain)}function oe(a,b){this.analyser=a.context.createAnalyser();this.analyser.fftSize=void 0!==b?b:2048;this.data=new Uint8Array(this.analyser.frequencyBinCount);a.getOutput().connect(this.analyser)}function pe(a,b,c){this.binding=a;this.valueSize= -c;a=Float64Array;switch(b){case "quaternion":b=this._slerp;break;case "string":case "bool":a=Array;b=this._select;break;default:b=this._lerp}this.buffer=new a(4*c);this._mixBufferRegion=b;this.referenceCount=this.useCount=this.cumulativeWeight=0}function of(a,b,c){c=c||sa.parseTrackName(b);this._targetGroup=a;this._bindings=a.subscribe_(b,c)}function sa(a,b,c){this.path=b;this.parsedPath=c||sa.parseTrackName(b);this.node=sa.findNode(a,this.parsedPath.nodeName)||a;this.rootNode=a}function pf(){this.uuid= -K.generateUUID();this._objects=Array.prototype.slice.call(arguments);this.nCachedObjects_=0;var a={};this._indicesByUUID=a;for(var b=0,c=arguments.length;b!==c;++b)a[arguments[b].uuid]=b;this._paths=[];this._parsedPaths=[];this._bindings=[];this._bindingsIndicesByPath={};var d=this;this.stats={objects:{get total(){return d._objects.length},get inUse(){return this.total-d.nCachedObjects_}},get bindingsPerObject(){return d._bindings.length}}}function qf(a,b,c){this._mixer=a;this._clip=b;this._localRoot= -c||null;a=b.tracks;b=a.length;c=Array(b);for(var d={endingStart:2400,endingEnd:2400},e=0;e!==b;++e){var f=a[e].createInterpolant(null);c[e]=f;f.settings=d}this._interpolantSettings=d;this._interpolants=c;this._propertyBindings=Array(b);this._weightInterpolant=this._timeScaleInterpolant=this._byClipCacheIndex=this._cacheIndex=null;this.loop=2201;this._loopCount=-1;this._startTime=null;this.time=0;this._effectiveWeight=this.weight=this._effectiveTimeScale=this.timeScale=1;this.repetitions=Infinity; -this.paused=!1;this.enabled=!0;this.clampWhenFinished=!1;this.zeroSlopeAtEnd=this.zeroSlopeAtStart=!0}function qe(a){this._root=a;this._initMemoryManager();this.time=this._accuIndex=0;this.timeScale=1}function Md(a,b){"string"===typeof a&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),a=b);this.value=a}function re(){I.call(this);this.type="InstancedBufferGeometry";this.maxInstancedCount=void 0}function se(a,b,c){qb.call(this,a,b);this.meshPerAttribute=c||1}function te(a,b,c,d){"number"=== -typeof c&&(d=c,c=!1,console.error("THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument."));Q.call(this,a,b,c);this.meshPerAttribute=d||1}function rf(a,b,c,d){this.ray=new ob(a,b);this.near=c||0;this.far=d||Infinity;this.params={Mesh:{},Line:{},LOD:{},Points:{threshold:1},Sprite:{}};Object.defineProperties(this.params,{PointCloud:{get:function(){console.warn("THREE.Raycaster: params.PointCloud has been renamed to params.Points.");return this.Points}}})}function sf(a, -b){return a.distance-b.distance}function ue(a,b,c,d){if(!1!==a.visible&&(a.raycast(b,c),!0===d)){a=a.children;d=0;for(var e=a.length;dc;c++,d++){var e=c/32*Math.PI*2,f=d/32*Math.PI*2;b.push(Math.cos(e),Math.sin(e),1,Math.cos(f),Math.sin(f),1)}a.addAttribute("position",new A(b,3));b=new V({fog:!1});this.cone=new Z(a,b);this.add(this.cone); -this.update()}function wf(a){var b=[];a&&a.isBone&&b.push(a);for(var c=0;ca?-1:0b;b++)a[b]=(16>b?"0":"")+b.toString(16); -return function(){var b=4294967295*Math.random()|0,d=4294967295*Math.random()|0,e=4294967295*Math.random()|0,f=4294967295*Math.random()|0;return(a[b&255]+a[b>>8&255]+a[b>>16&255]+a[b>>24&255]+"-"+a[d&255]+a[d>>8&255]+"-"+a[d>>16&15|64]+a[d>>24&255]+"-"+a[e&63|128]+a[e>>8&255]+"-"+a[e>>16&255]+a[e>>24&255]+a[f&255]+a[f>>8&255]+a[f>>16&255]+a[f>>24&255]).toUpperCase()}}(),clamp:function(a,b,c){return Math.max(b,Math.min(c,a))},euclideanModulo:function(a,b){return(a%b+b)%b},mapLinear:function(a,b,c, -d,e){return d+(a-b)*(e-d)/(c-b)},lerp:function(a,b,c){return(1-c)*a+c*b},smoothstep:function(a,b,c){if(a<=b)return 0;if(a>=c)return 1;a=(a-b)/(c-b);return a*a*(3-2*a)},smootherstep:function(a,b,c){if(a<=b)return 0;if(a>=c)return 1;a=(a-b)/(c-b);return a*a*a*(a*(6*a-15)+10)},randInt:function(a,b){return a+Math.floor(Math.random()*(b-a+1))},randFloat:function(a,b){return a+Math.random()*(b-a)},randFloatSpread:function(a){return a*(.5-Math.random())},degToRad:function(a){return a*K.DEG2RAD},radToDeg:function(a){return a* -K.RAD2DEG},isPowerOfTwo:function(a){return 0===(a&a-1)&&0!==a},ceilPowerOfTwo:function(a){return Math.pow(2,Math.ceil(Math.log(a)/Math.LN2))},floorPowerOfTwo:function(a){return Math.pow(2,Math.floor(Math.log(a)/Math.LN2))}};Object.defineProperties(z.prototype,{width:{get:function(){return this.x},set:function(a){this.x=a}},height:{get:function(){return this.y},set:function(a){this.y=a}}});Object.assign(z.prototype,{isVector2:!0,set:function(a,b){this.x=a;this.y=b;return this},setScalar:function(a){this.y= -this.x=a;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setComponent:function(a,b){switch(a){case 0:this.x=b;break;case 1:this.y=b;break;default:throw Error("index is out of range: "+a);}return this},getComponent:function(a){switch(a){case 0:return this.x;case 1:return this.y;default:throw Error("index is out of range: "+a);}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(a){this.x=a.x;this.y=a.y;return this},add:function(a, -b){if(void 0!==b)return console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(a,b);this.x+=a.x;this.y+=a.y;return this},addScalar:function(a){this.x+=a;this.y+=a;return this},addVectors:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;return this},addScaledVector:function(a,b){this.x+=a.x*b;this.y+=a.y*b;return this},sub:function(a,b){if(void 0!==b)return console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."), -this.subVectors(a,b);this.x-=a.x;this.y-=a.y;return this},subScalar:function(a){this.x-=a;this.y-=a;return this},subVectors:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;return this},multiply:function(a){this.x*=a.x;this.y*=a.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this},divide:function(a){this.x/=a.x;this.y/=a.y;return this},divideScalar:function(a){return this.multiplyScalar(1/a)},applyMatrix3:function(a){var b=this.x,c=this.y;a=a.elements;this.x=a[0]*b+a[3]*c+a[6];this.y= -a[1]*b+a[4]*c+a[7];return this},min:function(a){this.x=Math.min(this.x,a.x);this.y=Math.min(this.y,a.y);return this},max:function(a){this.x=Math.max(this.x,a.x);this.y=Math.max(this.y,a.y);return this},clamp:function(a,b){this.x=Math.max(a.x,Math.min(b.x,this.x));this.y=Math.max(a.y,Math.min(b.y,this.y));return this},clampScalar:function(){var a=new z,b=new z;return function(c,d){a.set(c,c);b.set(d,d);return this.clamp(a,b)}}(),clampLength:function(a,b){var c=this.length();return this.divideScalar(c|| -1).multiplyScalar(Math.max(a,Math.min(b,c)))},floor:function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);return this},ceil:function(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);return this},round:function(){this.x=Math.round(this.x);this.y=Math.round(this.y);return this},roundToZero:function(){this.x=0>this.x?Math.ceil(this.x):Math.floor(this.x);this.y=0>this.y?Math.ceil(this.y):Math.floor(this.y);return this},negate:function(){this.x=-this.x;this.y=-this.y;return this},dot:function(a){return this.x* -a.x+this.y*a.y},cross:function(a){return this.x*a.y-this.y*a.x},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length()||1)},angle:function(){var a=Math.atan2(this.y,this.x);0>a&&(a+=2*Math.PI);return a},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b= -this.x-a.x;a=this.y-a.y;return b*b+a*a},manhattanDistanceTo:function(a){return Math.abs(this.x-a.x)+Math.abs(this.y-a.y)},setLength:function(a){return this.normalize().multiplyScalar(a)},lerp:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;return this},lerpVectors:function(a,b,c){return this.subVectors(b,a).multiplyScalar(c).add(a)},equals:function(a){return a.x===this.x&&a.y===this.y},fromArray:function(a,b){void 0===b&&(b=0);this.x=a[b];this.y=a[b+1];return this},toArray:function(a, -b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this.x;a[b+1]=this.y;return a},fromBufferAttribute:function(a,b,c){void 0!==c&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute().");this.x=a.getX(b);this.y=a.getY(b);return this},rotateAround:function(a,b){var c=Math.cos(b);b=Math.sin(b);var d=this.x-a.x,e=this.y-a.y;this.x=d*c-e*b+a.x;this.y=d*b+e*c+a.y;return this}});Object.assign(J.prototype,{isMatrix4:!0,set:function(a,b,c,d,e,f,g,h,k,m,t,n,l,u,r,p){var q=this.elements; -q[0]=a;q[4]=b;q[8]=c;q[12]=d;q[1]=e;q[5]=f;q[9]=g;q[13]=h;q[2]=k;q[6]=m;q[10]=t;q[14]=n;q[3]=l;q[7]=u;q[11]=r;q[15]=p;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},clone:function(){return(new J).fromArray(this.elements)},copy:function(a){var b=this.elements;a=a.elements;b[0]=a[0];b[1]=a[1];b[2]=a[2];b[3]=a[3];b[4]=a[4];b[5]=a[5];b[6]=a[6];b[7]=a[7];b[8]=a[8];b[9]=a[9];b[10]=a[10];b[11]=a[11];b[12]=a[12];b[13]=a[13];b[14]=a[14];b[15]=a[15];return this},copyPosition:function(a){var b= -this.elements;a=a.elements;b[12]=a[12];b[13]=a[13];b[14]=a[14];return this},extractBasis:function(a,b,c){a.setFromMatrixColumn(this,0);b.setFromMatrixColumn(this,1);c.setFromMatrixColumn(this,2);return this},makeBasis:function(a,b,c){this.set(a.x,b.x,c.x,0,a.y,b.y,c.y,0,a.z,b.z,c.z,0,0,0,0,1);return this},extractRotation:function(){var a=new p;return function(b){var c=this.elements,d=b.elements,e=1/a.setFromMatrixColumn(b,0).length(),f=1/a.setFromMatrixColumn(b,1).length();b=1/a.setFromMatrixColumn(b, -2).length();c[0]=d[0]*e;c[1]=d[1]*e;c[2]=d[2]*e;c[3]=0;c[4]=d[4]*f;c[5]=d[5]*f;c[6]=d[6]*f;c[7]=0;c[8]=d[8]*b;c[9]=d[9]*b;c[10]=d[10]*b;c[11]=0;c[12]=0;c[13]=0;c[14]=0;c[15]=1;return this}}(),makeRotationFromEuler:function(a){a&&a.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var b=this.elements,c=a.x,d=a.y,e=a.z,f=Math.cos(c);c=Math.sin(c);var g=Math.cos(d);d=Math.sin(d);var h=Math.cos(e);e=Math.sin(e);if("XYZ"===a.order){a= -f*h;var k=f*e,m=c*h,t=c*e;b[0]=g*h;b[4]=-g*e;b[8]=d;b[1]=k+m*d;b[5]=a-t*d;b[9]=-c*g;b[2]=t-a*d;b[6]=m+k*d;b[10]=f*g}else"YXZ"===a.order?(a=g*h,k=g*e,m=d*h,t=d*e,b[0]=a+t*c,b[4]=m*c-k,b[8]=f*d,b[1]=f*e,b[5]=f*h,b[9]=-c,b[2]=k*c-m,b[6]=t+a*c,b[10]=f*g):"ZXY"===a.order?(a=g*h,k=g*e,m=d*h,t=d*e,b[0]=a-t*c,b[4]=-f*e,b[8]=m+k*c,b[1]=k+m*c,b[5]=f*h,b[9]=t-a*c,b[2]=-f*d,b[6]=c,b[10]=f*g):"ZYX"===a.order?(a=f*h,k=f*e,m=c*h,t=c*e,b[0]=g*h,b[4]=m*d-k,b[8]=a*d+t,b[1]=g*e,b[5]=t*d+a,b[9]=k*d-m,b[2]=-d,b[6]=c* -g,b[10]=f*g):"YZX"===a.order?(a=f*g,k=f*d,m=c*g,t=c*d,b[0]=g*h,b[4]=t-a*e,b[8]=m*e+k,b[1]=e,b[5]=f*h,b[9]=-c*h,b[2]=-d*h,b[6]=k*e+m,b[10]=a-t*e):"XZY"===a.order&&(a=f*g,k=f*d,m=c*g,t=c*d,b[0]=g*h,b[4]=-e,b[8]=d*h,b[1]=a*e+t,b[5]=f*h,b[9]=k*e-m,b[2]=m*e-k,b[6]=c*h,b[10]=t*e+a);b[3]=0;b[7]=0;b[11]=0;b[12]=0;b[13]=0;b[14]=0;b[15]=1;return this},makeRotationFromQuaternion:function(){var a=new p(0,0,0),b=new p(1,1,1);return function(c){return this.compose(a,c,b)}}(),lookAt:function(){var a=new p,b=new p, -c=new p;return function(d,e,f){var g=this.elements;c.subVectors(d,e);0===c.lengthSq()&&(c.z=1);c.normalize();a.crossVectors(f,c);0===a.lengthSq()&&(1===Math.abs(f.z)?c.x+=1E-4:c.z+=1E-4,c.normalize(),a.crossVectors(f,c));a.normalize();b.crossVectors(c,a);g[0]=a.x;g[4]=b.x;g[8]=c.x;g[1]=a.y;g[5]=b.y;g[9]=c.y;g[2]=a.z;g[6]=b.z;g[10]=c.z;return this}}(),multiply:function(a,b){return void 0!==b?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."), -this.multiplyMatrices(a,b)):this.multiplyMatrices(this,a)},premultiply:function(a){return this.multiplyMatrices(a,this)},multiplyMatrices:function(a,b){var c=a.elements,d=b.elements;b=this.elements;a=c[0];var e=c[4],f=c[8],g=c[12],h=c[1],k=c[5],m=c[9],t=c[13],n=c[2],l=c[6],u=c[10],r=c[14],p=c[3],y=c[7],x=c[11];c=c[15];var w=d[0],G=d[4],D=d[8],O=d[12],z=d[1],E=d[5],A=d[9],B=d[13],I=d[2],H=d[6],F=d[10],L=d[14],M=d[3],J=d[7],K=d[11];d=d[15];b[0]=a*w+e*z+f*I+g*M;b[4]=a*G+e*E+f*H+g*J;b[8]=a*D+e*A+f*F+ -g*K;b[12]=a*O+e*B+f*L+g*d;b[1]=h*w+k*z+m*I+t*M;b[5]=h*G+k*E+m*H+t*J;b[9]=h*D+k*A+m*F+t*K;b[13]=h*O+k*B+m*L+t*d;b[2]=n*w+l*z+u*I+r*M;b[6]=n*G+l*E+u*H+r*J;b[10]=n*D+l*A+u*F+r*K;b[14]=n*O+l*B+u*L+r*d;b[3]=p*w+y*z+x*I+c*M;b[7]=p*G+y*E+x*H+c*J;b[11]=p*D+y*A+x*F+c*K;b[15]=p*O+y*B+x*L+c*d;return this},multiplyScalar:function(a){var b=this.elements;b[0]*=a;b[4]*=a;b[8]*=a;b[12]*=a;b[1]*=a;b[5]*=a;b[9]*=a;b[13]*=a;b[2]*=a;b[6]*=a;b[10]*=a;b[14]*=a;b[3]*=a;b[7]*=a;b[11]*=a;b[15]*=a;return this},applyToBufferAttribute:function(){var a= -new p;return function(b){for(var c=0,d=b.count;cthis.determinant()&&(g=-g);c.x=f[12];c.y=f[13];c.z=f[14];b.copy(this);c=1/g;f=1/h;var m=1/k;b.elements[0]*=c;b.elements[1]*=c;b.elements[2]*=c;b.elements[4]*=f;b.elements[5]*=f;b.elements[6]*=f;b.elements[8]*=m;b.elements[9]*=m;b.elements[10]*=m;d.setFromRotationMatrix(b);e.x=g;e.y=h;e.z=k;return this}}(),makePerspective:function(a,b,c,d,e,f){void 0===f&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs."); -var g=this.elements;g[0]=2*e/(b-a);g[4]=0;g[8]=(b+a)/(b-a);g[12]=0;g[1]=0;g[5]=2*e/(c-d);g[9]=(c+d)/(c-d);g[13]=0;g[2]=0;g[6]=0;g[10]=-(f+e)/(f-e);g[14]=-2*f*e/(f-e);g[3]=0;g[7]=0;g[11]=-1;g[15]=0;return this},makeOrthographic:function(a,b,c,d,e,f){var g=this.elements,h=1/(b-a),k=1/(c-d),m=1/(f-e);g[0]=2*h;g[4]=0;g[8]=0;g[12]=-((b+a)*h);g[1]=0;g[5]=2*k;g[9]=0;g[13]=-((c+d)*k);g[2]=0;g[6]=0;g[10]=-2*m;g[14]=-((f+e)*m);g[3]=0;g[7]=0;g[11]=0;g[15]=1;return this},equals:function(a){var b=this.elements; -a=a.elements;for(var c=0;16>c;c++)if(b[c]!==a[c])return!1;return!0},fromArray:function(a,b){void 0===b&&(b=0);for(var c=0;16>c;c++)this.elements[c]=a[c+b];return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);var c=this.elements;a[b]=c[0];a[b+1]=c[1];a[b+2]=c[2];a[b+3]=c[3];a[b+4]=c[4];a[b+5]=c[5];a[b+6]=c[6];a[b+7]=c[7];a[b+8]=c[8];a[b+9]=c[9];a[b+10]=c[10];a[b+11]=c[11];a[b+12]=c[12];a[b+13]=c[13];a[b+14]=c[14];a[b+15]=c[15];return a}});Object.assign(ha,{slerp:function(a,b,c,d){return c.copy(a).slerp(b, -d)},slerpFlat:function(a,b,c,d,e,f,g){var h=c[d+0],k=c[d+1],m=c[d+2];c=c[d+3];d=e[f+0];var l=e[f+1],n=e[f+2];e=e[f+3];if(c!==e||h!==d||k!==l||m!==n){f=1-g;var q=h*d+k*l+m*n+c*e,u=0<=q?1:-1,r=1-q*q;r>Number.EPSILON&&(r=Math.sqrt(r),q=Math.atan2(r,q*u),f=Math.sin(f*q)/r,g=Math.sin(g*q)/r);u*=g;h=h*f+d*u;k=k*f+l*u;m=m*f+n*u;c=c*f+e*u;f===1-g&&(g=1/Math.sqrt(h*h+k*k+m*m+c*c),h*=g,k*=g,m*=g,c*=g)}a[b]=h;a[b+1]=k;a[b+2]=m;a[b+3]=c}});Object.defineProperties(ha.prototype,{x:{get:function(){return this._x}, -set:function(a){this._x=a;this.onChangeCallback()}},y:{get:function(){return this._y},set:function(a){this._y=a;this.onChangeCallback()}},z:{get:function(){return this._z},set:function(a){this._z=a;this.onChangeCallback()}},w:{get:function(){return this._w},set:function(a){this._w=a;this.onChangeCallback()}}});Object.assign(ha.prototype,{set:function(a,b,c,d){this._x=a;this._y=b;this._z=c;this._w=d;this.onChangeCallback();return this},clone:function(){return new this.constructor(this._x,this._y,this._z, -this._w)},copy:function(a){this._x=a.x;this._y=a.y;this._z=a.z;this._w=a.w;this.onChangeCallback();return this},setFromEuler:function(a,b){if(!a||!a.isEuler)throw Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var c=a._x,d=a._y,e=a._z;a=a.order;var f=Math.cos,g=Math.sin,h=f(c/2),k=f(d/2);f=f(e/2);c=g(c/2);d=g(d/2);e=g(e/2);"XYZ"===a?(this._x=c*k*f+h*d*e,this._y=h*d*f-c*k*e,this._z=h*k*e+c*d*f,this._w=h*k*f-c*d*e):"YXZ"===a?(this._x=c*k*f+ -h*d*e,this._y=h*d*f-c*k*e,this._z=h*k*e-c*d*f,this._w=h*k*f+c*d*e):"ZXY"===a?(this._x=c*k*f-h*d*e,this._y=h*d*f+c*k*e,this._z=h*k*e+c*d*f,this._w=h*k*f-c*d*e):"ZYX"===a?(this._x=c*k*f-h*d*e,this._y=h*d*f+c*k*e,this._z=h*k*e-c*d*f,this._w=h*k*f+c*d*e):"YZX"===a?(this._x=c*k*f+h*d*e,this._y=h*d*f+c*k*e,this._z=h*k*e-c*d*f,this._w=h*k*f-c*d*e):"XZY"===a&&(this._x=c*k*f-h*d*e,this._y=h*d*f-c*k*e,this._z=h*k*e+c*d*f,this._w=h*k*f+c*d*e);if(!1!==b)this.onChangeCallback();return this},setFromAxisAngle:function(a, -b){b/=2;var c=Math.sin(b);this._x=a.x*c;this._y=a.y*c;this._z=a.z*c;this._w=Math.cos(b);this.onChangeCallback();return this},setFromRotationMatrix:function(a){var b=a.elements,c=b[0];a=b[4];var d=b[8],e=b[1],f=b[5],g=b[9],h=b[2],k=b[6];b=b[10];var m=c+f+b;0f&&c>b?(c=2*Math.sqrt(1+c-f-b),this._w=(k-g)/c,this._x=.25*c,this._y=(a+e)/c,this._z=(d+h)/c):f>b?(c=2*Math.sqrt(1+f-c-b),this._w=(d-h)/c,this._x=(a+e)/c,this._y= -.25*c,this._z=(g+k)/c):(c=2*Math.sqrt(1+b-c-f),this._w=(e-a)/c,this._x=(d+h)/c,this._y=(g+k)/c,this._z=.25*c);this.onChangeCallback();return this},setFromUnitVectors:function(){var a=new p,b;return function(c,d){void 0===a&&(a=new p);b=c.dot(d)+1;1E-6>b?(b=0,Math.abs(c.x)>Math.abs(c.z)?a.set(-c.y,c.x,0):a.set(0,-c.z,c.y)):a.crossVectors(c,d);this._x=a.x;this._y=a.y;this._z=a.z;this._w=b;return this.normalize()}}(),angleTo:function(a){return 2*Math.acos(Math.abs(K.clamp(this.dot(a),-1,1)))},rotateTowards:function(a, -b){var c=this.angleTo(a);if(0===c)return this;this.slerp(a,Math.min(1,b/c));return this},inverse:function(){return this.conjugate()},conjugate:function(){this._x*=-1;this._y*=-1;this._z*=-1;this.onChangeCallback();return this},dot:function(a){return this._x*a._x+this._y*a._y+this._z*a._z+this._w*a._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var a= -this.length();0===a?(this._z=this._y=this._x=0,this._w=1):(a=1/a,this._x*=a,this._y*=a,this._z*=a,this._w*=a);this.onChangeCallback();return this},multiply:function(a,b){return void 0!==b?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(a,b)):this.multiplyQuaternions(this,a)},premultiply:function(a){return this.multiplyQuaternions(a,this)},multiplyQuaternions:function(a,b){var c=a._x,d=a._y,e=a._z;a=a._w; -var f=b._x,g=b._y,h=b._z;b=b._w;this._x=c*b+a*f+d*h-e*g;this._y=d*b+a*g+e*f-c*h;this._z=e*b+a*h+c*g-d*f;this._w=a*b-c*f-d*g-e*h;this.onChangeCallback();return this},slerp:function(a,b){if(0===b)return this;if(1===b)return this.copy(a);var c=this._x,d=this._y,e=this._z,f=this._w,g=f*a._w+c*a._x+d*a._y+e*a._z;0>g?(this._w=-a._w,this._x=-a._x,this._y=-a._y,this._z=-a._z,g=-g):this.copy(a);if(1<=g)return this._w=f,this._x=c,this._y=d,this._z=e,this;a=1-g*g;if(a<=Number.EPSILON)return g=1-b,this._w=g* -f+b*this._w,this._x=g*c+b*this._x,this._y=g*d+b*this._y,this._z=g*e+b*this._z,this.normalize();a=Math.sqrt(a);var h=Math.atan2(a,g);g=Math.sin((1-b)*h)/a;b=Math.sin(b*h)/a;this._w=f*g+this._w*b;this._x=c*g+this._x*b;this._y=d*g+this._y*b;this._z=e*g+this._z*b;this.onChangeCallback();return this},equals:function(a){return a._x===this._x&&a._y===this._y&&a._z===this._z&&a._w===this._w},fromArray:function(a,b){void 0===b&&(b=0);this._x=a[b];this._y=a[b+1];this._z=a[b+2];this._w=a[b+3];this.onChangeCallback(); -return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this._x;a[b+1]=this._y;a[b+2]=this._z;a[b+3]=this._w;return a},onChange:function(a){this.onChangeCallback=a;return this},onChangeCallback:function(){}});Object.assign(p.prototype,{isVector3:!0,set:function(a,b,c){this.x=a;this.y=b;this.z=c;return this},setScalar:function(a){this.z=this.y=this.x=a;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setZ:function(a){this.z=a;return this}, -setComponent:function(a,b){switch(a){case 0:this.x=b;break;case 1:this.y=b;break;case 2:this.z=b;break;default:throw Error("index is out of range: "+a);}return this},getComponent:function(a){switch(a){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error("index is out of range: "+a);}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},add:function(a,b){if(void 0!==b)return console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."), -this.addVectors(a,b);this.x+=a.x;this.y+=a.y;this.z+=a.z;return this},addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;return this},addVectors:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;return this},addScaledVector:function(a,b){this.x+=a.x*b;this.y+=a.y*b;this.z+=a.z*b;return this},sub:function(a,b){if(void 0!==b)return console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(a,b);this.x-=a.x;this.y-=a.y;this.z-=a.z; -return this},subScalar:function(a){this.x-=a;this.y-=a;this.z-=a;return this},subVectors:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this},multiply:function(a,b){if(void 0!==b)return console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(a,b);this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;return this},multiplyVectors:function(a,b){this.x=a.x* -b.x;this.y=a.y*b.y;this.z=a.z*b.z;return this},applyEuler:function(){var a=new ha;return function(b){b&&b.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order.");return this.applyQuaternion(a.setFromEuler(b))}}(),applyAxisAngle:function(){var a=new ha;return function(b,c){return this.applyQuaternion(a.setFromAxisAngle(b,c))}}(),applyMatrix3:function(a){var b=this.x,c=this.y,d=this.z;a=a.elements;this.x=a[0]*b+a[3]*c+a[6]*d;this.y=a[1]* -b+a[4]*c+a[7]*d;this.z=a[2]*b+a[5]*c+a[8]*d;return this},applyMatrix4:function(a){var b=this.x,c=this.y,d=this.z;a=a.elements;var e=1/(a[3]*b+a[7]*c+a[11]*d+a[15]);this.x=(a[0]*b+a[4]*c+a[8]*d+a[12])*e;this.y=(a[1]*b+a[5]*c+a[9]*d+a[13])*e;this.z=(a[2]*b+a[6]*c+a[10]*d+a[14])*e;return this},applyQuaternion:function(a){var b=this.x,c=this.y,d=this.z,e=a.x,f=a.y,g=a.z;a=a.w;var h=a*b+f*d-g*c,k=a*c+g*b-e*d,m=a*d+e*c-f*b;b=-e*b-f*c-g*d;this.x=h*a+b*-e+k*-g-m*-f;this.y=k*a+b*-f+m*-e-h*-g;this.z=m*a+b* --g+h*-f-k*-e;return this},project:function(a){return this.applyMatrix4(a.matrixWorldInverse).applyMatrix4(a.projectionMatrix)},unproject:function(){var a=new J;return function(b){return this.applyMatrix4(a.getInverse(b.projectionMatrix)).applyMatrix4(b.matrixWorld)}}(),transformDirection:function(a){var b=this.x,c=this.y,d=this.z;a=a.elements;this.x=a[0]*b+a[4]*c+a[8]*d;this.y=a[1]*b+a[5]*c+a[9]*d;this.z=a[2]*b+a[6]*c+a[10]*d;return this.normalize()},divide:function(a){this.x/=a.x;this.y/=a.y;this.z/= -a.z;return this},divideScalar:function(a){return this.multiplyScalar(1/a)},min:function(a){this.x=Math.min(this.x,a.x);this.y=Math.min(this.y,a.y);this.z=Math.min(this.z,a.z);return this},max:function(a){this.x=Math.max(this.x,a.x);this.y=Math.max(this.y,a.y);this.z=Math.max(this.z,a.z);return this},clamp:function(a,b){this.x=Math.max(a.x,Math.min(b.x,this.x));this.y=Math.max(a.y,Math.min(b.y,this.y));this.z=Math.max(a.z,Math.min(b.z,this.z));return this},clampScalar:function(){var a=new p,b=new p; -return function(c,d){a.set(c,c,c);b.set(d,d,d);return this.clamp(a,b)}}(),clampLength:function(a,b){var c=this.length();return this.divideScalar(c||1).multiplyScalar(Math.max(a,Math.min(b,c)))},floor:function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);this.z=Math.floor(this.z);return this},ceil:function(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);this.z=Math.ceil(this.z);return this},round:function(){this.x=Math.round(this.x);this.y=Math.round(this.y);this.z=Math.round(this.z); -return this},roundToZero:function(){this.x=0>this.x?Math.ceil(this.x):Math.floor(this.x);this.y=0>this.y?Math.ceil(this.y):Math.floor(this.y);this.z=0>this.z?Math.ceil(this.z):Math.floor(this.z);return this},negate:function(){this.x=-this.x;this.y=-this.y;this.z=-this.z;return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},manhattanLength:function(){return Math.abs(this.x)+ -Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(a){return this.normalize().multiplyScalar(a)},lerp:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;return this},lerpVectors:function(a,b,c){return this.subVectors(b,a).multiplyScalar(c).add(a)},cross:function(a,b){return void 0!==b?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(a, -b)):this.crossVectors(this,a)},crossVectors:function(a,b){var c=a.x,d=a.y;a=a.z;var e=b.x,f=b.y;b=b.z;this.x=d*b-a*f;this.y=a*e-c*b;this.z=c*f-d*e;return this},projectOnVector:function(a){var b=a.dot(this)/a.lengthSq();return this.copy(a).multiplyScalar(b)},projectOnPlane:function(){var a=new p;return function(b){a.copy(this).projectOnVector(b);return this.sub(a)}}(),reflect:function(){var a=new p;return function(b){return this.sub(a.copy(b).multiplyScalar(2*this.dot(b)))}}(),angleTo:function(a){a= -this.dot(a)/Math.sqrt(this.lengthSq()*a.lengthSq());return Math.acos(K.clamp(a,-1,1))},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x,c=this.y-a.y;a=this.z-a.z;return b*b+c*c+a*a},manhattanDistanceTo:function(a){return Math.abs(this.x-a.x)+Math.abs(this.y-a.y)+Math.abs(this.z-a.z)},setFromSpherical:function(a){return this.setFromSphericalCoords(a.radius,a.phi,a.theta)},setFromSphericalCoords:function(a,b,c){var d=Math.sin(b)*a;this.x= -d*Math.sin(c);this.y=Math.cos(b)*a;this.z=d*Math.cos(c);return this},setFromCylindrical:function(a){return this.setFromCylindricalCoords(a.radius,a.theta,a.y)},setFromCylindricalCoords:function(a,b,c){this.x=a*Math.sin(b);this.y=c;this.z=a*Math.cos(b);return this},setFromMatrixPosition:function(a){a=a.elements;this.x=a[12];this.y=a[13];this.z=a[14];return this},setFromMatrixScale:function(a){var b=this.setFromMatrixColumn(a,0).length(),c=this.setFromMatrixColumn(a,1).length();a=this.setFromMatrixColumn(a, -2).length();this.x=b;this.y=c;this.z=a;return this},setFromMatrixColumn:function(a,b){return this.fromArray(a.elements,4*b)},equals:function(a){return a.x===this.x&&a.y===this.y&&a.z===this.z},fromArray:function(a,b){void 0===b&&(b=0);this.x=a[b];this.y=a[b+1];this.z=a[b+2];return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this.x;a[b+1]=this.y;a[b+2]=this.z;return a},fromBufferAttribute:function(a,b,c){void 0!==c&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."); -this.x=a.getX(b);this.y=a.getY(b);this.z=a.getZ(b);return this}});Object.assign(na.prototype,{isMatrix3:!0,set:function(a,b,c,d,e,f,g,h,k){var m=this.elements;m[0]=a;m[1]=d;m[2]=g;m[3]=b;m[4]=e;m[5]=h;m[6]=c;m[7]=f;m[8]=k;return this},identity:function(){this.set(1,0,0,0,1,0,0,0,1);return this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(a){var b=this.elements;a=a.elements;b[0]=a[0];b[1]=a[1];b[2]=a[2];b[3]=a[3];b[4]=a[4];b[5]=a[5];b[6]=a[6];b[7]=a[7];b[8]= -a[8];return this},setFromMatrix4:function(a){a=a.elements;this.set(a[0],a[4],a[8],a[1],a[5],a[9],a[2],a[6],a[10]);return this},applyToBufferAttribute:function(){var a=new p;return function(b){for(var c=0,d=b.count;cc;c++)if(b[c]!==a[c])return!1;return!0},fromArray:function(a,b){void 0===b&&(b=0);for(var c=0;9>c;c++)this.elements[c]=a[c+b];return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);var c=this.elements;a[b]=c[0];a[b+1]=c[1];a[b+2]=c[2];a[b+3]=c[3];a[b+4]=c[4];a[b+5]=c[5];a[b+6]=c[6];a[b+7]=c[7];a[b+8]=c[8]; -return a}});var gb={getDataURL:function(a){if(a instanceof HTMLCanvasElement)var b=a;else{b=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");b.width=a.width;b.height=a.height;var c=b.getContext("2d");a instanceof ImageData?c.putImageData(a,0,0):c.drawImage(a,0,0,a.width,a.height)}return 2048a.x||1a.x?0:1;break;case 1002:a.x=1===Math.abs(Math.floor(a.x)%2)?Math.ceil(a.x)-a.x:a.x-Math.floor(a.x)}if(0>a.y||1a.y?0:1;break;case 1002:a.y=1===Math.abs(Math.floor(a.y)%2)?Math.ceil(a.y)-a.y:a.y-Math.floor(a.y)}this.flipY&&(a.y=1-a.y);return a}});Object.defineProperty(T.prototype,"needsUpdate",{set:function(a){!0===a&&this.version++}});Object.assign(aa.prototype,{isVector4:!0,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},setScalar:function(a){this.w=this.z=this.y=this.x=a;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y= -a;return this},setZ:function(a){this.z=a;return this},setW:function(a){this.w=a;return this},setComponent:function(a,b){switch(a){case 0:this.x=b;break;case 1:this.y=b;break;case 2:this.z=b;break;case 3:this.w=b;break;default:throw Error("index is out of range: "+a);}return this},getComponent:function(a){switch(a){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error("index is out of range: "+a);}},clone:function(){return new this.constructor(this.x, -this.y,this.z,this.w)},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=void 0!==a.w?a.w:1;return this},add:function(a,b){if(void 0!==b)return console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(a,b);this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;this.w+=a;return this},addVectors:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this}, -addScaledVector:function(a,b){this.x+=a.x*b;this.y+=a.y*b;this.z+=a.z*b;this.w+=a.w*b;return this},sub:function(a,b){if(void 0!==b)return console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(a,b);this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;return this},subScalar:function(a){this.x-=a;this.y-=a;this.z-=a;this.w-=a;return this},subVectors:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;this.w=a.w-b.w;return this},multiplyScalar:function(a){this.x*= -a;this.y*=a;this.z*=a;this.w*=a;return this},applyMatrix4:function(a){var b=this.x,c=this.y,d=this.z,e=this.w;a=a.elements;this.x=a[0]*b+a[4]*c+a[8]*d+a[12]*e;this.y=a[1]*b+a[5]*c+a[9]*d+a[13]*e;this.z=a[2]*b+a[6]*c+a[10]*d+a[14]*e;this.w=a[3]*b+a[7]*c+a[11]*d+a[15]*e;return this},divideScalar:function(a){return this.multiplyScalar(1/a)},setAxisAngleFromQuaternion:function(a){this.w=2*Math.acos(a.w);var b=Math.sqrt(1-a.w*a.w);1E-4>b?(this.x=1,this.z=this.y=0):(this.x=a.x/b,this.y=a.y/b,this.z=a.z/ -b);return this},setAxisAngleFromRotationMatrix:function(a){a=a.elements;var b=a[0];var c=a[4];var d=a[8],e=a[1],f=a[5],g=a[9];var h=a[2];var k=a[6];var m=a[10];if(.01>Math.abs(c-e)&&.01>Math.abs(d-h)&&.01>Math.abs(g-k)){if(.1>Math.abs(c+e)&&.1>Math.abs(d+h)&&.1>Math.abs(g+k)&&.1>Math.abs(b+f+m-3))return this.set(1,0,0,0),this;a=Math.PI;b=(b+1)/2;f=(f+1)/2;m=(m+1)/2;c=(c+e)/4;d=(d+h)/4;g=(g+k)/4;b>f&&b>m?.01>b?(k=0,c=h=.707106781):(k=Math.sqrt(b),h=c/k,c=d/k):f>m?.01>f?(k=.707106781,h=0,c=.707106781): -(h=Math.sqrt(f),k=c/h,c=g/h):.01>m?(h=k=.707106781,c=0):(c=Math.sqrt(m),k=d/c,h=g/c);this.set(k,h,c,a);return this}a=Math.sqrt((k-g)*(k-g)+(d-h)*(d-h)+(e-c)*(e-c));.001>Math.abs(a)&&(a=1);this.x=(k-g)/a;this.y=(d-h)/a;this.z=(e-c)/a;this.w=Math.acos((b+f+m-1)/2);return this},min:function(a){this.x=Math.min(this.x,a.x);this.y=Math.min(this.y,a.y);this.z=Math.min(this.z,a.z);this.w=Math.min(this.w,a.w);return this},max:function(a){this.x=Math.max(this.x,a.x);this.y=Math.max(this.y,a.y);this.z=Math.max(this.z, -a.z);this.w=Math.max(this.w,a.w);return this},clamp:function(a,b){this.x=Math.max(a.x,Math.min(b.x,this.x));this.y=Math.max(a.y,Math.min(b.y,this.y));this.z=Math.max(a.z,Math.min(b.z,this.z));this.w=Math.max(a.w,Math.min(b.w,this.w));return this},clampScalar:function(){var a,b;return function(c,d){void 0===a&&(a=new aa,b=new aa);a.set(c,c,c,c);b.set(d,d,d,d);return this.clamp(a,b)}}(),clampLength:function(a,b){var c=this.length();return this.divideScalar(c||1).multiplyScalar(Math.max(a,Math.min(b, -c)))},floor:function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);this.z=Math.floor(this.z);this.w=Math.floor(this.w);return this},ceil:function(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);this.z=Math.ceil(this.z);this.w=Math.ceil(this.w);return this},round:function(){this.x=Math.round(this.x);this.y=Math.round(this.y);this.z=Math.round(this.z);this.w=Math.round(this.w);return this},roundToZero:function(){this.x=0>this.x?Math.ceil(this.x):Math.floor(this.x);this.y=0>this.y?Math.ceil(this.y): -Math.floor(this.y);this.z=0>this.z?Math.ceil(this.z):Math.floor(this.z);this.w=0>this.w?Math.ceil(this.w):Math.floor(this.w);return this},negate:function(){this.x=-this.x;this.y=-this.y;this.z=-this.z;this.w=-this.w;return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*a.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},manhattanLength:function(){return Math.abs(this.x)+ -Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(a){return this.normalize().multiplyScalar(a)},lerp:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b;return this},lerpVectors:function(a,b,c){return this.subVectors(b,a).multiplyScalar(c).add(a)},equals:function(a){return a.x===this.x&&a.y===this.y&&a.z===this.z&&a.w===this.w},fromArray:function(a,b){void 0=== -b&&(b=0);this.x=a[b];this.y=a[b+1];this.z=a[b+2];this.w=a[b+3];return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this.x;a[b+1]=this.y;a[b+2]=this.z;a[b+3]=this.w;return a},fromBufferAttribute:function(a,b,c){void 0!==c&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute().");this.x=a.getX(b);this.y=a.getY(b);this.z=a.getZ(b);this.w=a.getW(b);return this}});hb.prototype=Object.assign(Object.create(ea.prototype),{constructor:hb,isWebGLRenderTarget:!0, -setSize:function(a,b){if(this.width!==a||this.height!==b)this.width=a,this.height=b,this.dispose();this.viewport.set(0,0,a,b);this.scissor.set(0,0,a,b)},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.width=a.width;this.height=a.height;this.viewport.copy(a.viewport);this.texture=a.texture.clone();this.depthBuffer=a.depthBuffer;this.stencilBuffer=a.stencilBuffer;this.depthTexture=a.depthTexture;return this},dispose:function(){this.dispatchEvent({type:"dispose"})}}); -Ib.prototype=Object.create(hb.prototype);Ib.prototype.constructor=Ib;Ib.prototype.isWebGLRenderTargetCube=!0;ib.prototype=Object.create(T.prototype);ib.prototype.constructor=ib;ib.prototype.isDataTexture=!0;Object.assign(Ua.prototype,{isBox3:!0,set:function(a,b){this.min.copy(a);this.max.copy(b);return this},setFromArray:function(a){for(var b=Infinity,c=Infinity,d=Infinity,e=-Infinity,f=-Infinity,g=-Infinity,h=0,k=a.length;h -e&&(e=m);l>f&&(f=l);n>g&&(g=n)}this.min.set(b,c,d);this.max.set(e,f,g);return this},setFromBufferAttribute:function(a){for(var b=Infinity,c=Infinity,d=Infinity,e=-Infinity,f=-Infinity,g=-Infinity,h=0,k=a.count;he&&(e=m);l>f&&(f=l);n>g&&(g=n)}this.min.set(b,c,d);this.max.set(e,f,g);return this},setFromPoints:function(a){this.makeEmpty();for(var b=0,c=a.length;bthis.max.x||a.ythis.max.y||a.zthis.max.z?!1:!0},containsBox:function(a){return this.min.x<=a.min.x&&a.max.x<=this.max.x&&this.min.y<=a.min.y&&a.max.y<=this.max.y&&this.min.z<=a.min.z&&a.max.z<=this.max.z},getParameter:function(a,b){void 0===b&&(console.warn("THREE.Box3: .getParameter() target is now required"),b=new p);return b.set((a.x-this.min.x)/(this.max.x- -this.min.x),(a.y-this.min.y)/(this.max.y-this.min.y),(a.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(a){return a.max.xthis.max.x||a.max.ythis.max.y||a.max.zthis.max.z?!1:!0},intersectsSphere:function(){var a=new p;return function(b){this.clampPoint(b.center,a);return a.distanceToSquared(b.center)<=b.radius*b.radius}}(),intersectsPlane:function(a){if(0=a.constant},intersectsTriangle:function(){function a(a){var e;var f=0;for(e=a.length-3;f<=e;f+=3){h.fromArray(a,f);var g=m.x*Math.abs(h.x)+m.y*Math.abs(h.y)+m.z*Math.abs(h.z),k=b.dot(h),l=c.dot(h), -n=d.dot(h);if(Math.max(-Math.max(k,l,n),Math.min(k,l,n))>g)return!1}return!0}var b=new p,c=new p,d=new p,e=new p,f=new p,g=new p,h=new p,k=new p,m=new p,l=new p;return function(h){if(this.isEmpty())return!1;this.getCenter(k);m.subVectors(this.max,k);b.subVectors(h.a,k);c.subVectors(h.b,k);d.subVectors(h.c,k);e.subVectors(c,b);f.subVectors(d,c);g.subVectors(b,d);h=[0,-e.z,e.y,0,-f.z,f.y,0,-g.z,g.y,e.z,0,-e.x,f.z,0,-f.x,g.z,0,-g.x,-e.y,e.x,0,-f.y,f.x,0,-g.y,g.x,0];if(!a(h))return!1;h=[1,0,0,0,1,0,0, -0,1];if(!a(h))return!1;l.crossVectors(e,f);h=[l.x,l.y,l.z];return a(h)}}(),clampPoint:function(a,b){void 0===b&&(console.warn("THREE.Box3: .clampPoint() target is now required"),b=new p);return b.copy(a).clamp(this.min,this.max)},distanceToPoint:function(){var a=new p;return function(b){return a.copy(b).clamp(this.min,this.max).sub(b).length()}}(),getBoundingSphere:function(){var a=new p;return function(b){void 0===b&&(console.warn("THREE.Box3: .getBoundingSphere() target is now required"),b=new Ea); -this.getCenter(b.center);b.radius=.5*this.getSize(a).length();return b}}(),intersect:function(a){this.min.max(a.min);this.max.min(a.max);this.isEmpty()&&this.makeEmpty();return this},union:function(a){this.min.min(a.min);this.max.max(a.max);return this},applyMatrix4:function(){var a=[new p,new p,new p,new p,new p,new p,new p,new p];return function(b){if(this.isEmpty())return this;a[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(b);a[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(b); -a[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(b);a[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(b);a[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(b);a[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(b);a[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(b);a[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(b);this.setFromPoints(a);return this}}(),translate:function(a){this.min.add(a);this.max.add(a);return this},equals:function(a){return a.min.equals(this.min)&& -a.max.equals(this.max)}});Object.assign(Ea.prototype,{set:function(a,b){this.center.copy(a);this.radius=b;return this},setFromPoints:function(){var a=new Ua;return function(b,c){var d=this.center;void 0!==c?d.copy(c):a.setFromPoints(b).getCenter(d);for(var e=c=0,f=b.length;e= -this.radius},containsPoint:function(a){return a.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(a){return a.distanceTo(this.center)-this.radius},intersectsSphere:function(a){var b=this.radius+a.radius;return a.center.distanceToSquared(this.center)<=b*b},intersectsBox:function(a){return a.intersectsSphere(this)},intersectsPlane:function(a){return Math.abs(a.distanceToPoint(this.center))<=this.radius},clampPoint:function(a,b){var c=this.center.distanceToSquared(a); -void 0===b&&(console.warn("THREE.Sphere: .clampPoint() target is now required"),b=new p);b.copy(a);c>this.radius*this.radius&&(b.sub(this.center).normalize(),b.multiplyScalar(this.radius).add(this.center));return b},getBoundingBox:function(a){void 0===a&&(console.warn("THREE.Sphere: .getBoundingBox() target is now required"),a=new Ua);a.set(this.center,this.center);a.expandByScalar(this.radius);return a},applyMatrix4:function(a){this.center.applyMatrix4(a);this.radius*=a.getMaxScaleOnAxis();return this}, -translate:function(a){this.center.add(a);return this},equals:function(a){return a.center.equals(this.center)&&a.radius===this.radius}});Object.assign(Oa.prototype,{set:function(a,b){this.normal.copy(a);this.constant=b;return this},setComponents:function(a,b,c,d){this.normal.set(a,b,c);this.constant=d;return this},setFromNormalAndCoplanarPoint:function(a,b){this.normal.copy(a);this.constant=-b.dot(this.normal);return this},setFromCoplanarPoints:function(){var a=new p,b=new p;return function(c,d,e){d= -a.subVectors(e,d).cross(b.subVectors(c,d)).normalize();this.setFromNormalAndCoplanarPoint(d,c);return this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.normal.copy(a.normal);this.constant=a.constant;return this},normalize:function(){var a=1/this.normal.length();this.normal.multiplyScalar(a);this.constant*=a;return this},negate:function(){this.constant*=-1;this.normal.negate();return this},distanceToPoint:function(a){return this.normal.dot(a)+this.constant},distanceToSphere:function(a){return this.distanceToPoint(a.center)- -a.radius},projectPoint:function(a,b){void 0===b&&(console.warn("THREE.Plane: .projectPoint() target is now required"),b=new p);return b.copy(this.normal).multiplyScalar(-this.distanceToPoint(a)).add(a)},intersectLine:function(){var a=new p;return function(b,c){void 0===c&&(console.warn("THREE.Plane: .intersectLine() target is now required"),c=new p);var d=b.delta(a),e=this.normal.dot(d);if(0===e){if(0===this.distanceToPoint(b.start))return c.copy(b.start)}else if(e=-(b.start.dot(this.normal)+this.constant)/ -e,!(0>e||1b&&0a&&0c;c++)b[c].copy(a.planes[c]);return this},setFromMatrix:function(a){var b=this.planes,c=a.elements;a=c[0];var d=c[1],e=c[2],f=c[3],g=c[4],h=c[5],k=c[6],m=c[7],l=c[8],n=c[9],q=c[10],p=c[11],r=c[12],v=c[13],y=c[14];c=c[15];b[0].setComponents(f-a,m-g,p-l,c-r).normalize();b[1].setComponents(f+a,m+g,p+l,c+r).normalize();b[2].setComponents(f+d,m+h,p+n,c+v).normalize();b[3].setComponents(f-d,m-h,p-n,c- -v).normalize();b[4].setComponents(f-e,m-k,p-q,c-y).normalize();b[5].setComponents(f+e,m+k,p+q,c+y).normalize();return this},intersectsObject:function(){var a=new Ea;return function(b){var c=b.geometry;null===c.boundingSphere&&c.computeBoundingSphere();a.copy(c.boundingSphere).applyMatrix4(b.matrixWorld);return this.intersectsSphere(a)}}(),intersectsSprite:function(){var a=new Ea;return function(b){a.center.set(0,0,0);a.radius=.7071067811865476;a.applyMatrix4(b.matrixWorld);return this.intersectsSphere(a)}}(), -intersectsSphere:function(a){var b=this.planes,c=a.center;a=-a.radius;for(var d=0;6>d;d++)if(b[d].distanceToPoint(c)d;d++){var e=c[d];a.x=0e.distanceToPoint(a))return!1}return!0}}(),containsPoint:function(a){for(var b=this.planes,c=0;6>c;c++)if(0>b[c].distanceToPoint(a))return!1;return!0}});var U= +"",f.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",f.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",f.logarithmicDepthBuffer&&(g.isWebGL2||b.get("EXT_frag_depth"))?"#define USE_LOGDEPTHBUF_EXT":"",f.envMap&&(g.isWebGL2||b.get("EXT_shader_texture_lod"))?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;",0!==f.toneMapping?"#define TONE_MAPPING":"",0!==f.toneMapping?K.tonemapping_pars_fragment:"",0!==f.toneMapping?xg("toneMapping",f.toneMapping): +"",f.dithering?"#define DITHERING":"",f.outputEncoding||f.mapEncoding||f.matcapEncoding||f.envMapEncoding||f.emissiveMapEncoding?K.encodings_pars_fragment:"",f.mapEncoding?td("mapTexelToLinear",f.mapEncoding):"",f.matcapEncoding?td("matcapTexelToLinear",f.matcapEncoding):"",f.envMapEncoding?td("envMapTexelToLinear",f.envMapEncoding):"",f.emissiveMapEncoding?td("emissiveMapTexelToLinear",f.emissiveMapEncoding):"",f.outputEncoding?wg("linearToOutputTexel",f.outputEncoding):"",f.depthPacking?"#define DEPTH_PACKING "+ +d.depthPacking:"","\n"].filter(zc).join("\n"));m=$d(m);m=Xe(m,f);m=Ye(m,f);r=$d(r);r=Xe(r,f);r=Ye(r,f);m=Ze(m);r=Ze(r);g.isWebGL2&&!d.isRawShaderMaterial&&(g=!1,n=/^\s*#version\s+300\s+es\s*\n/,d.isShaderMaterial&&null!==m.match(n)&&null!==r.match(n)&&(g=!0,m=m.replace(n,""),r=r.replace(n,"")),k="#version 300 es\n\n#define attribute in\n#define varying out\n#define texture2D texture\n"+k,b=["#version 300 es\n\n#define varying in",g?"":"out highp vec4 pc_fragColor;",g?"":"#define gl_FragColor pc_fragColor", +"#define gl_FragDepthEXT gl_FragDepth\n#define texture2D texture\n#define textureCube texture\n#define texture2DProj textureProj\n#define texture2DLodEXT textureLod\n#define texture2DProjLodEXT textureProjLod\n#define textureCubeLodEXT textureLod\n#define texture2DGradEXT textureGrad\n#define texture2DProjGradEXT textureProjGrad\n#define textureCubeGradEXT textureGrad"].join("\n")+"\n"+b);r=b+r;m=Ve(h,h.VERTEX_SHADER,k+m);r=Ve(h,h.FRAGMENT_SHADER,r);h.attachShader(w,m);h.attachShader(w,r);void 0!== +d.index0AttributeName?h.bindAttribLocation(w,0,d.index0AttributeName):!0===f.morphTargets&&h.bindAttribLocation(w,0,"position");h.linkProgram(w);f=h.getProgramInfoLog(w).trim();g=h.getShaderInfoLog(m).trim();n=h.getShaderInfoLog(r).trim();v=q=!0;if(!1===h.getProgramParameter(w,h.LINK_STATUS))q=!1,console.error("THREE.WebGLProgram: shader error: ",h.getError(),"gl.VALIDATE_STATUS",h.getProgramParameter(w,h.VALIDATE_STATUS),"gl.getProgramInfoLog",f,g,n);else if(""!==f)console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()", +f);else if(""===g||""===n)v=!1;v&&(this.diagnostics={runnable:q,material:d,programLog:f,vertexShader:{log:g,prefix:k},fragmentShader:{log:n,prefix:b}});h.deleteShader(m);h.deleteShader(r);var D;this.getUniforms=function(){void 0===D&&(D=new bb(h,w,a));return D};var J;this.getAttributes=function(){if(void 0===J){for(var a={},b=h.getProgramParameter(w,h.ACTIVE_ATTRIBUTES),c=0;cb||a.height>b){if("data"in a){console.warn("THREE.WebGLRenderer: image in DataTexture is too big ("+a.width+"x"+a.height+").");return}b/=Math.max(a.width,a.height);var c=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");c.width=Math.floor(a.width*b);c.height=Math.floor(a.height*b);c.getContext("2d").drawImage(a,0,0,a.width,a.height,0,0,c.width,c.height);console.warn("THREE.WebGLRenderer: image is too big ("+ +a.width+"x"+a.height+"). Resized to "+c.width+"x"+c.height);return c}return a}function k(a){return S.isPowerOfTwo(a.width)&&S.isPowerOfTwo(a.height)}function m(a,b){return a.generateMipmaps&&b&&1003!==a.minFilter&&1006!==a.minFilter}function r(b,c,e,f){a.generateMipmap(b);d.get(c).__maxMipLevel=Math.log(Math.max(e,f))*Math.LOG2E}function n(b,c){if(!e.isWebGL2)return b;if(b===a.RED){if(c===a.FLOAT)return a.R32F;if(c===a.HALF_FLOAT)return a.R16F;if(c===a.UNSIGNED_BYTE)return a.R8}if(b===a.RGB){if(c=== +a.FLOAT)return a.RGB32F;if(c===a.HALF_FLOAT)return a.RGB16F;if(c===a.UNSIGNED_BYTE)return a.RGB8}if(b===a.RGBA){if(c===a.FLOAT)return a.RGBA32F;if(c===a.HALF_FLOAT)return a.RGBA16F;if(c===a.UNSIGNED_BYTE)return a.RGBA8}return b}function q(b){return 1003===b||1004===b||1005===b?a.NEAREST:a.LINEAR}function v(b){b=b.target;b.removeEventListener("dispose",v);a:{var c=d.get(b);if(b.image&&c.__image__webglTextureCube)a.deleteTexture(c.__image__webglTextureCube);else{if(void 0===c.__webglInit)break a;a.deleteTexture(c.__webglTexture)}d.remove(b)}b.isVideoTexture&& +delete J[b.id];g.memory.textures--}function l(b){b=b.target;b.removeEventListener("dispose",l);var c=d.get(b),e=d.get(b.texture);if(b){void 0!==e.__webglTexture&&a.deleteTexture(e.__webglTexture);b.depthTexture&&b.depthTexture.dispose();if(b.isWebGLRenderTargetCube)for(e=0;6>e;e++)a.deleteFramebuffer(c.__webglFramebuffer[e]),c.__webglDepthbuffer&&a.deleteRenderbuffer(c.__webglDepthbuffer[e]);else a.deleteFramebuffer(c.__webglFramebuffer),c.__webglDepthbuffer&&a.deleteRenderbuffer(c.__webglDepthbuffer); +d.remove(b.texture);d.remove(b)}g.memory.textures--}function u(b,e){var f=d.get(b);if(b.isVideoTexture){var h=b.id,k=g.render.frame;J[h]!==k&&(J[h]=k,b.update())}if(0w;w++)u[w]=q||t?t?b.image[w].image:b.image[w]:h(b.image[w],e.maxCubemapSize);var y=u[0],D=k(y),R=f.convert(b.format),X=f.convert(b.type),B=n(R,X);p(a.TEXTURE_CUBE_MAP,b,D);for(w=0;6>w;w++)if(q)for(var x,J=u[w].mipmaps,A=0,z=J.length;Aq;q++)e.__webglFramebuffer[q]=a.createFramebuffer()}else e.__webglFramebuffer=a.createFramebuffer();if(h){c.bindTexture(a.TEXTURE_CUBE_MAP,f.__webglTexture);p(a.TEXTURE_CUBE_MAP,b.texture,n);for(q=0;6>q;q++)w(e.__webglFramebuffer[q],b,a.COLOR_ATTACHMENT0,a.TEXTURE_CUBE_MAP_POSITIVE_X+q);m(b.texture,n)&&r(a.TEXTURE_CUBE_MAP,b.texture,b.width,b.height);c.bindTexture(a.TEXTURE_CUBE_MAP,null)}else c.bindTexture(a.TEXTURE_2D, +f.__webglTexture),p(a.TEXTURE_2D,b.texture,n),w(e.__webglFramebuffer,b,a.COLOR_ATTACHMENT0,a.TEXTURE_2D),m(b.texture,n)&&r(a.TEXTURE_2D,b.texture,b.width,b.height),c.bindTexture(a.TEXTURE_2D,null);if(b.depthBuffer){e=d.get(b);f=!0===b.isWebGLRenderTargetCube;if(b.depthTexture){if(f)throw Error("target.depthTexture not supported in Cube render targets");if(b&&b.isWebGLRenderTargetCube)throw Error("Depth Texture with cube render targets is not supported");a.bindFramebuffer(a.FRAMEBUFFER,e.__webglFramebuffer); +if(!b.depthTexture||!b.depthTexture.isDepthTexture)throw Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");d.get(b.depthTexture).__webglTexture&&b.depthTexture.image.width===b.width&&b.depthTexture.image.height===b.height||(b.depthTexture.image.width=b.width,b.depthTexture.image.height=b.height,b.depthTexture.needsUpdate=!0);u(b.depthTexture,0);e=d.get(b.depthTexture).__webglTexture;if(1026===b.depthTexture.format)a.framebufferTexture2D(a.FRAMEBUFFER,a.DEPTH_ATTACHMENT, +a.TEXTURE_2D,e,0);else if(1027===b.depthTexture.format)a.framebufferTexture2D(a.FRAMEBUFFER,a.DEPTH_STENCIL_ATTACHMENT,a.TEXTURE_2D,e,0);else throw Error("Unknown depthTexture format");}else if(f)for(e.__webglDepthbuffer=[],f=0;6>f;f++)a.bindFramebuffer(a.FRAMEBUFFER,e.__webglFramebuffer[f]),e.__webglDepthbuffer[f]=a.createRenderbuffer(),D(e.__webglDepthbuffer[f],b);else a.bindFramebuffer(a.FRAMEBUFFER,e.__webglFramebuffer),e.__webglDepthbuffer=a.createRenderbuffer(),D(e.__webglDepthbuffer,b);a.bindFramebuffer(a.FRAMEBUFFER, +null)}};this.updateRenderTargetMipmap=function(b){var e=b.texture,f=k(b);if(m(e,f)){f=b.isWebGLRenderTargetCube?a.TEXTURE_CUBE_MAP:a.TEXTURE_2D;var g=d.get(e).__webglTexture;c.bindTexture(f,g);r(f,e,b.width,b.height);c.bindTexture(f,null)}}}function bf(a,b,c){return{convert:function(d){if(1E3===d)return a.REPEAT;if(1001===d)return a.CLAMP_TO_EDGE;if(1002===d)return a.MIRRORED_REPEAT;if(1003===d)return a.NEAREST;if(1004===d)return a.NEAREST_MIPMAP_NEAREST;if(1005===d)return a.NEAREST_MIPMAP_LINEAR; +if(1006===d)return a.LINEAR;if(1007===d)return a.LINEAR_MIPMAP_NEAREST;if(1008===d)return a.LINEAR_MIPMAP_LINEAR;if(1009===d)return a.UNSIGNED_BYTE;if(1017===d)return a.UNSIGNED_SHORT_4_4_4_4;if(1018===d)return a.UNSIGNED_SHORT_5_5_5_1;if(1019===d)return a.UNSIGNED_SHORT_5_6_5;if(1010===d)return a.BYTE;if(1011===d)return a.SHORT;if(1012===d)return a.UNSIGNED_SHORT;if(1013===d)return a.INT;if(1014===d)return a.UNSIGNED_INT;if(1015===d)return a.FLOAT;if(1016===d){if(c.isWebGL2)return a.HALF_FLOAT;var e= +b.get("OES_texture_half_float");if(null!==e)return e.HALF_FLOAT_OES}if(1021===d)return a.ALPHA;if(1022===d)return a.RGB;if(1023===d)return a.RGBA;if(1024===d)return a.LUMINANCE;if(1025===d)return a.LUMINANCE_ALPHA;if(1026===d)return a.DEPTH_COMPONENT;if(1027===d)return a.DEPTH_STENCIL;if(1028===d)return a.RED;if(100===d)return a.FUNC_ADD;if(101===d)return a.FUNC_SUBTRACT;if(102===d)return a.FUNC_REVERSE_SUBTRACT;if(200===d)return a.ZERO;if(201===d)return a.ONE;if(202===d)return a.SRC_COLOR;if(203=== +d)return a.ONE_MINUS_SRC_COLOR;if(204===d)return a.SRC_ALPHA;if(205===d)return a.ONE_MINUS_SRC_ALPHA;if(206===d)return a.DST_ALPHA;if(207===d)return a.ONE_MINUS_DST_ALPHA;if(208===d)return a.DST_COLOR;if(209===d)return a.ONE_MINUS_DST_COLOR;if(210===d)return a.SRC_ALPHA_SATURATE;if(33776===d||33777===d||33778===d||33779===d)if(e=b.get("WEBGL_compressed_texture_s3tc"),null!==e){if(33776===d)return e.COMPRESSED_RGB_S3TC_DXT1_EXT;if(33777===d)return e.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(33778===d)return e.COMPRESSED_RGBA_S3TC_DXT3_EXT; +if(33779===d)return e.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(35840===d||35841===d||35842===d||35843===d)if(e=b.get("WEBGL_compressed_texture_pvrtc"),null!==e){if(35840===d)return e.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(35841===d)return e.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(35842===d)return e.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(35843===d)return e.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(36196===d&&(e=b.get("WEBGL_compressed_texture_etc1"),null!==e))return e.COMPRESSED_RGB_ETC1_WEBGL;if(37808===d||37809===d||37810=== +d||37811===d||37812===d||37813===d||37814===d||37815===d||37816===d||37817===d||37818===d||37819===d||37820===d||37821===d)if(e=b.get("WEBGL_compressed_texture_astc"),null!==e)return d;if(103===d||104===d){if(c.isWebGL2){if(103===d)return a.MIN;if(104===d)return a.MAX}e=b.get("EXT_blend_minmax");if(null!==e){if(103===d)return e.MIN_EXT;if(104===d)return e.MAX_EXT}}if(1020===d){if(c.isWebGL2)return a.UNSIGNED_INT_24_8;e=b.get("WEBGL_depth_texture");if(null!==e)return e.UNSIGNED_INT_24_8_WEBGL}return 0}}} +function Ob(){C.call(this);this.type="Group"}function Ra(){C.call(this);this.type="Camera";this.matrixWorldInverse=new P;this.projectionMatrix=new P;this.projectionMatrixInverse=new P}function V(a,b,c,d){Ra.call(this);this.type="PerspectiveCamera";this.fov=void 0!==a?a:50;this.zoom=1;this.near=void 0!==c?c:.1;this.far=void 0!==d?d:2E3;this.focus=10;this.aspect=void 0!==b?b:1;this.view=null;this.filmGauge=35;this.filmOffset=0;this.updateProjectionMatrix()}function Cc(a){V.call(this);this.cameras=a|| +[]}function cf(a){function b(){return null!==e&&!0===e.isPresenting}function c(){if(b()){var c=e.getEyeParameters("left"),f=c.renderWidth;c=c.renderHeight;w=a.getPixelRatio();x=a.getSize();a.setDrawingBufferSize(2*f,c,1);J.start()}else d.enabled&&a.setDrawingBufferSize(x.width,x.height,w),J.stop()}var d=this,e=null,f=null,g=null,h=[],k=new P,m=new P,r="stage";"undefined"!==typeof window&&"VRFrameData"in window&&(f=new window.VRFrameData,window.addEventListener("vrdisplaypresentchange",c,!1));var n= +new P,q=new ja,v=new p,l=new V;l.bounds=new Z(0,0,.5,1);l.layers.enable(1);var u=new V;u.bounds=new Z(.5,0,.5,1);u.layers.enable(2);var y=new Cc([l,u]);y.layers.enable(1);y.layers.enable(2);var x,w,D=[];this.enabled=!1;this.getController=function(a){var b=h[a];void 0===b&&(b=new Ob,b.matrixAutoUpdate=!1,b.visible=!1,h[a]=b);return b};this.getDevice=function(){return e};this.setDevice=function(a){void 0!==a&&(e=a);J.setContext(a)};this.setFrameOfReferenceType=function(a){r=a};this.setPoseTarget=function(a){void 0!== +a&&(g=a)};this.getCamera=function(a){var b="stage"===r?1.6:0;if(null===e)return a.position.set(0,b,0),a;e.depthNear=a.near;e.depthFar=a.far;e.getFrameData(f);if("stage"===r){var c=e.stageParameters;c?k.fromArray(c.sittingToStandingTransform):k.makeTranslation(0,b,0)}b=f.pose;c=null!==g?g:a;c.matrix.copy(k);c.matrix.decompose(c.position,c.quaternion,c.scale);null!==b.orientation&&(q.fromArray(b.orientation),c.quaternion.multiply(q));null!==b.position&&(q.setFromRotationMatrix(k),v.fromArray(b.position), +v.applyQuaternion(q),c.position.add(v));c.updateMatrixWorld();if(!1===e.isPresenting)return a;l.near=a.near;u.near=a.near;l.far=a.far;u.far=a.far;y.matrixWorld.copy(a.matrixWorld);y.matrixWorldInverse.copy(a.matrixWorldInverse);l.matrixWorldInverse.fromArray(f.leftViewMatrix);u.matrixWorldInverse.fromArray(f.rightViewMatrix);m.getInverse(k);"stage"===r&&(l.matrixWorldInverse.multiply(m),u.matrixWorldInverse.multiply(m));a=c.parent;null!==a&&(n.getInverse(a.matrixWorld),l.matrixWorldInverse.multiply(n), +u.matrixWorldInverse.multiply(n));l.matrixWorld.getInverse(l.matrixWorldInverse);u.matrixWorld.getInverse(u.matrixWorldInverse);l.projectionMatrix.fromArray(f.leftProjectionMatrix);u.projectionMatrix.fromArray(f.rightProjectionMatrix);y.projectionMatrix.copy(l.projectionMatrix);a=e.getLayers();a.length&&(a=a[0],null!==a.leftBounds&&4===a.leftBounds.length&&l.bounds.fromArray(a.leftBounds),null!==a.rightBounds&&4===a.rightBounds.length&&u.bounds.fromArray(a.rightBounds));a:for(a=0;af.normalMatrix.determinant();ba.setMaterial(e,h);var k=q(a,c,e,f),m=!1;if(b!==d.id||K!==k.id||sd!==(!0===e.wireframe))b=d.id,K=k.id,sd=!0===e.wireframe,m=!0;f.morphTargetInfluences&&(ya.update(f,d,e,k),m=!0);h=d.index;var r=d.attributes.position;c=1;!0===e.wireframe&&(h=ta.getWireframeAttribute(d),c=2);a=za;if(null!==h){var n=ra.get(h);a=Ba;a.setIndex(n)}if(m){if(d&& +d.isInstancedBufferGeometry&!xa.isWebGL2&&null===la.get("ANGLE_instanced_arrays"))console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");else{ba.initAttributes();m=d.attributes;k=k.getAttributes();var l=e.defaultAttributeValues;for(B in k){var v=k[B];if(0<=v){var t=m[B];if(void 0!==t){var u=t.normalized,p=t.itemSize,w=ra.get(t);if(void 0!==w){var y=w.buffer,x=w.type;w=w.bytesPerElement;if(t.isInterleavedBufferAttribute){var J= +t.data,D=J.stride;t=t.offset;J&&J.isInstancedInterleavedBuffer?(ba.enableAttributeAndDivisor(v,J.meshPerAttribute),void 0===d.maxInstancedCount&&(d.maxInstancedCount=J.meshPerAttribute*J.count)):ba.enableAttribute(v);E.bindBuffer(E.ARRAY_BUFFER,y);E.vertexAttribPointer(v,p,x,u,D*w,t*w)}else t.isInstancedBufferAttribute?(ba.enableAttributeAndDivisor(v,t.meshPerAttribute),void 0===d.maxInstancedCount&&(d.maxInstancedCount=t.meshPerAttribute*t.count)):ba.enableAttribute(v),E.bindBuffer(E.ARRAY_BUFFER, +y),E.vertexAttribPointer(v,p,x,u,0,0)}}else if(void 0!==l&&(u=l[B],void 0!==u))switch(u.length){case 2:E.vertexAttrib2fv(v,u);break;case 3:E.vertexAttrib3fv(v,u);break;case 4:E.vertexAttrib4fv(v,u);break;default:E.vertexAttrib1fv(v,u)}}}ba.disableUnusedAttributes()}null!==h&&E.bindBuffer(E.ELEMENT_ARRAY_BUFFER,n.buffer)}n=Infinity;null!==h?n=h.count:void 0!==r&&(n=r.count);h=d.drawRange.start*c;r=null!==g?g.start*c:0;var B=Math.max(h,r);g=Math.max(0,Math.min(n,h+d.drawRange.count*c,r+(null!==g?g.count* +c:Infinity))-1-B+1);if(0!==g){if(f.isMesh)if(!0===e.wireframe)ba.setLineWidth(e.wireframeLinewidth*(null===M?U:1)),a.setMode(E.LINES);else switch(f.drawMode){case 0:a.setMode(E.TRIANGLES);break;case 1:a.setMode(E.TRIANGLE_STRIP);break;case 2:a.setMode(E.TRIANGLE_FAN)}else f.isLine?(e=e.linewidth,void 0===e&&(e=1),ba.setLineWidth(e*(null===M?U:1)),f.isLineSegments?a.setMode(E.LINES):f.isLineLoop?a.setMode(E.LINE_LOOP):a.setMode(E.LINE_STRIP)):f.isPoints?a.setMode(E.POINTS):f.isSprite&&a.setMode(E.TRIANGLES); +d&&d.isInstancedBufferGeometry?0=xa.maxTextures&&console.warn("THREE.WebGLRenderer: Trying to use "+a+" texture units while this GPU supports only "+xa.maxTextures);ca+=1;return a};this.setTexture2D=function(){var a=!1;return function(b,c){b&&b.isWebGLRenderTarget&& +(a||(console.warn("THREE.WebGLRenderer.setTexture2D: don't use render targets as textures. Use their .texture property instead."),a=!0),b=b.texture);ha.setTexture2D(b,c)}}();this.setTexture3D=function(){return function(a,b){ha.setTexture3D(a,b)}}();this.setTexture=function(){var a=!1;return function(b,c){a||(console.warn("THREE.WebGLRenderer: .setTexture is deprecated, use setTexture2D instead."),a=!0);ha.setTexture2D(b,c)}}();this.setTextureCube=function(){var a=!1;return function(b,c){b&&b.isWebGLRenderTargetCube&& +(a||(console.warn("THREE.WebGLRenderer.setTextureCube: don't use cube render targets as textures. Use their .texture property instead."),a=!0),b=b.texture);b&&b.isCubeTexture||Array.isArray(b.image)&&6===b.image.length?ha.setTextureCube(b,c):ha.setTextureCubeDynamic(b,c)}}();this.setFramebuffer=function(a){N=a};this.getRenderTarget=function(){return M};this.setRenderTarget=function(a){(M=a)&&void 0===Da.get(a).__webglFramebuffer&&ha.setupRenderTarget(a);var b=N,c=!1;a?(b=Da.get(a).__webglFramebuffer, +a.isWebGLRenderTargetCube&&(b=b[a.activeCubeFace],c=!0),W.copy(a.viewport),Bc.copy(a.scissor),ea=a.scissorTest):(W.copy(fa).multiplyScalar(U),Bc.copy(ja).multiplyScalar(U),ea=sa);L!==b&&(E.bindFramebuffer(E.FRAMEBUFFER,b),L=b);ba.viewport(W);ba.scissor(Bc);ba.setScissorTest(ea);c&&(c=Da.get(a.texture),E.framebufferTexture2D(E.FRAMEBUFFER,E.COLOR_ATTACHMENT0,E.TEXTURE_CUBE_MAP_POSITIVE_X+a.activeCubeFace,c.__webglTexture,a.activeMipMapLevel))};this.readRenderTargetPixels=function(a,b,c,d,e,f){if(a&& +a.isWebGLRenderTarget){var g=Da.get(a).__webglFramebuffer;if(g){var h=!1;g!==L&&(E.bindFramebuffer(E.FRAMEBUFFER,g),h=!0);try{var k=a.texture,m=k.format,r=k.type;1023!==m&&ia.convert(m)!==E.getParameter(E.IMPLEMENTATION_COLOR_READ_FORMAT)?console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format."):1009===r||ia.convert(r)===E.getParameter(E.IMPLEMENTATION_COLOR_READ_TYPE)||1015===r&&(xa.isWebGL2||la.get("OES_texture_float")||la.get("WEBGL_color_buffer_float"))|| +1016===r&&(xa.isWebGL2?la.get("EXT_color_buffer_float"):la.get("EXT_color_buffer_half_float"))?E.checkFramebufferStatus(E.FRAMEBUFFER)===E.FRAMEBUFFER_COMPLETE?0<=b&&b<=a.width-d&&0<=c&&c<=a.height-e&&E.readPixels(b,c,d,e,ia.convert(m),ia.convert(r),f):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete."):console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.")}finally{h&& +E.bindFramebuffer(E.FRAMEBUFFER,L)}}}else console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.")};this.copyFramebufferToTexture=function(a,b,c){var d=b.image.width,e=b.image.height,f=ia.convert(b.format);this.setTexture2D(b,0);E.copyTexImage2D(E.TEXTURE_2D,c||0,f,a.x,a.y,d,e,0)};this.copyTextureToTexture=function(a,b,c,d){var e=b.image.width,f=b.image.height,g=ia.convert(c.format),h=ia.convert(c.type);this.setTexture2D(c,0);b.isDataTexture?E.texSubImage2D(E.TEXTURE_2D, +d||0,a.x,a.y,e,f,g,h,b.image.data):E.texSubImage2D(E.TEXTURE_2D,d||0,a.x,a.y,g,h,b.image)}}function Pb(a,b){this.name="";this.color=new G(a);this.density=void 0!==b?b:2.5E-4}function Qb(a,b,c){this.name="";this.color=new G(a);this.near=void 0!==b?b:1;this.far=void 0!==c?c:1E3}function vd(){C.call(this);this.type="Scene";this.overrideMaterial=this.fog=this.background=null;this.autoUpdate=!0}function qb(a,b){this.array=a;this.stride=b;this.count=void 0!==a?a.length/b:0;this.dynamic=!1;this.updateRange= +{offset:0,count:-1};this.version=0}function Dc(a,b,c,d){this.data=a;this.itemSize=b;this.offset=c;this.normalized=!0===d}function fb(a){L.call(this);this.type="SpriteMaterial";this.color=new G(16777215);this.map=null;this.rotation=0;this.sizeAttenuation=!0;this.lights=!1;this.transparent=!0;this.setValues(a)}function Ec(a){C.call(this);this.type="Sprite";if(void 0===Rb){Rb=new F;var b=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]);b=new qb(b,5);Rb.setIndex([0,1,2,0,2,3]); +Rb.addAttribute("position",new Dc(b,3,0,!1));Rb.addAttribute("uv",new Dc(b,2,3,!1))}this.geometry=Rb;this.material=void 0!==a?a:new fb;this.center=new A(.5,.5)}function Fc(){C.call(this);this.type="LOD";Object.defineProperties(this,{levels:{enumerable:!0,value:[]}})}function Gc(a,b){a=a||[];this.bones=a.slice(0);this.boneMatrices=new Float32Array(16*this.bones.length);if(void 0===b)this.calculateInverses();else if(this.bones.length===b.length)this.boneInverses=b.slice(0);else for(console.warn("THREE.Skeleton boneInverses is the wrong length."), +this.boneInverses=[],a=0,b=this.bones.length;ac;c++){var n=r[h[c]];var q=r[h[(c+1)%3]];f[0]=Math.min(n,q);f[1]=Math.max(n,q);n=f[0]+","+f[1];void 0===g[n]&&(g[n]={index1:f[0],index2:f[1]})}}for(n in g)m=g[n],h=a.vertices[m.index1],b.push(h.x,h.y,h.z),h=a.vertices[m.index2],b.push(h.x,h.y,h.z)}else if(a&&a.isBufferGeometry)if(h=new p,null!==a.index){k=a.attributes.position;r=a.index;var l=a.groups;0===l.length&&(l=[{start:0, +count:r.count,materialIndex:0}]);a=0;for(e=l.length;ac;c++)n=r.getX(m+c),q=r.getX(m+(c+1)%3),f[0]=Math.min(n,q),f[1]=Math.max(n,q),n=f[0]+","+f[1],void 0===g[n]&&(g[n]={index1:f[0],index2:f[1]});for(n in g)m=g[n],h.fromBufferAttribute(k,m.index1),b.push(h.x,h.y,h.z),h.fromBufferAttribute(k,m.index2),b.push(h.x,h.y,h.z)}else for(k=a.attributes.position,m=0,d=k.count/3;mc;c++)g=3*m+c,h.fromBufferAttribute(k,g),b.push(h.x, +h.y,h.z),g=3*m+(c+1)%3,h.fromBufferAttribute(k,g),b.push(h.x,h.y,h.z);this.addAttribute("position",new z(b,3))}function Jc(a,b,c){M.call(this);this.type="ParametricGeometry";this.parameters={func:a,slices:b,stacks:c};this.fromBufferGeometry(new Vb(a,b,c));this.mergeVertices()}function Vb(a,b,c){F.call(this);this.type="ParametricBufferGeometry";this.parameters={func:a,slices:b,stacks:c};var d=[],e=[],f=[],g=[],h=new p,k=new p,m=new p,r=new p,n=new p,q,l;3>a.length&&console.error("THREE.ParametricGeometry: Function must now modify a Vector3 as third parameter."); +var t=b+1;for(q=0;q<=c;q++){var u=q/c;for(l=0;l<=b;l++){var y=l/b;a(y,u,k);e.push(k.x,k.y,k.z);0<=y-1E-5?(a(y-1E-5,u,m),r.subVectors(k,m)):(a(y+1E-5,u,m),r.subVectors(m,k));0<=u-1E-5?(a(y,u-1E-5,m),n.subVectors(k,m)):(a(y,u+1E-5,m),n.subVectors(m,k));h.crossVectors(r,n).normalize();f.push(h.x,h.y,h.z);g.push(y,u)}}for(q=0;qd&&1===a.x&&(k[b]=a.x-1);0===c.x&&0===c.z&&(k[b]=d/2/Math.PI+.5)}F.call(this);this.type="PolyhedronBufferGeometry";this.parameters={vertices:a, +indices:b,radius:c,detail:d};c=c||1;d=d||0;var h=[],k=[];(function(a){for(var c=new p,d=new p,g=new p,h=0;he&&(.2>b&&(k[a+0]+=1),.2>c&&(k[a+2]+=1),.2>d&&(k[a+4]+=1))})();this.addAttribute("position",new z(h,3));this.addAttribute("normal",new z(h.slice(),3));this.addAttribute("uv",new z(k,2));0===d?this.computeVertexNormals():this.normalizeNormals()}function Lc(a, +b){M.call(this);this.type="TetrahedronGeometry";this.parameters={radius:a,detail:b};this.fromBufferGeometry(new Wb(a,b));this.mergeVertices()}function Wb(a,b){ma.call(this,[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],a,b);this.type="TetrahedronBufferGeometry";this.parameters={radius:a,detail:b}}function Mc(a,b){M.call(this);this.type="OctahedronGeometry";this.parameters={radius:a,detail:b};this.fromBufferGeometry(new rb(a,b));this.mergeVertices()}function rb(a,b){ma.call(this,[1,0,0, +-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],a,b);this.type="OctahedronBufferGeometry";this.parameters={radius:a,detail:b}}function Nc(a,b){M.call(this);this.type="IcosahedronGeometry";this.parameters={radius:a,detail:b};this.fromBufferGeometry(new Xb(a,b));this.mergeVertices()}function Xb(a,b){var c=(1+Math.sqrt(5))/2;ma.call(this,[-1,c,0,1,c,0,-1,-c,0,1,-c,0,0,-1,c,0,1,c,0,-1,-c,0,1,-c,c,0,-1,c,0,1,-c,0,-1,-c,0,1],[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5, +11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],a,b);this.type="IcosahedronBufferGeometry";this.parameters={radius:a,detail:b}}function Oc(a,b){M.call(this);this.type="DodecahedronGeometry";this.parameters={radius:a,detail:b};this.fromBufferGeometry(new Yb(a,b));this.mergeVertices()}function Yb(a,b){var c=(1+Math.sqrt(5))/2,d=1/c;ma.call(this,[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-d,-c,0,-d,c,0,d,-c,0,d,c,-d,-c,0,-d,c,0,d,-c,0,d,c, +0,-c,0,-d,c,0,-d,-c,0,d,c,0,d],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],a,b);this.type="DodecahedronBufferGeometry";this.parameters={radius:a,detail:b}}function Pc(a,b,c,d,e,f){M.call(this);this.type="TubeGeometry";this.parameters={path:a,tubularSegments:b,radius:c,radialSegments:d, +closed:e};void 0!==f&&console.warn("THREE.TubeGeometry: taper has been removed.");a=new Zb(a,b,c,d,e);this.tangents=a.tangents;this.normals=a.normals;this.binormals=a.binormals;this.fromBufferGeometry(a);this.mergeVertices()}function Zb(a,b,c,d,e){function f(e){r=a.getPointAt(e/b,r);var f=g.normals[e];e=g.binormals[e];for(q=0;q<=d;q++){var m=q/d*Math.PI*2,n=Math.sin(m);m=-Math.cos(m);k.x=m*f.x+n*e.x;k.y=m*f.y+n*e.y;k.z=m*f.z+n*e.z;k.normalize();t.push(k.x,k.y,k.z);h.x=r.x+c*k.x;h.y=r.y+c*k.y;h.z= +r.z+c*k.z;l.push(h.x,h.y,h.z)}}F.call(this);this.type="TubeBufferGeometry";this.parameters={path:a,tubularSegments:b,radius:c,radialSegments:d,closed:e};b=b||64;c=c||1;d=d||8;e=e||!1;var g=a.computeFrenetFrames(b,e);this.tangents=g.tangents;this.normals=g.normals;this.binormals=g.binormals;var h=new p,k=new p,m=new A,r=new p,n,q,l=[],t=[],u=[],y=[];for(n=0;n=b;e-=d)f=ef(e,a[e],a[e+1],f);f&&sb(f,f.next)&&(Sc(f),f=f.next);return f}function Tc(a,b){if(!a)return a;b||(b=a);do{var c=!1;if(a.steiner||!sb(a,a.next)&&0!==na(a.prev,a,a.next))a=a.next;else{Sc(a);a=b=a.prev;if(a===a.next)break;c=!0}}while(c||a!==b);return b} +function Uc(a,b,c,d,e,f,g){if(a){if(!g&&f){var h=a,k=h;do null===k.z&&(k.z=de(k.x,k.y,d,e,f)),k.prevZ=k.prev,k=k.nextZ=k.next;while(k!==h);k.prevZ.nextZ=null;k.prevZ=null;h=k;var m,r,n,l,v=1;do{k=h;var t=h=null;for(r=0;k;){r++;var u=k;for(m=n=0;mn.x?r.x>v.x?r.x:v.x:n.x>v.x?n.x:v.x,D=r.y>n.y?r.y>v.y?r.y:v.y:n.y>v.y?n.y:v.y;m=de(r.x=m;){if(p!==t.prev&&p!==t.next&&zd(r.x,r.y,n.x,n.y,v.x,v.y,p.x,p.y)&&0<=na(p.prev,p,p.next)){t=!1;break a}p= +p.prevZ}t=!0}}else a:if(t=a,r=t.prev,n=t,v=t.next,0<=na(r,n,v))t=!1;else{for(m=t.next.next;m!==t.prev;){if(zd(r.x,r.y,n.x,n.y,v.x,v.y,m.x,m.y)&&0<=na(m.prev,m,m.next)){t=!1;break a}m=m.next}t=!0}if(t)b.push(k.i/c),b.push(a.i/c),b.push(u.i/c),Sc(a),h=a=u.next;else if(a=u,a===h){if(!g)Uc(Tc(a),b,c,d,e,f,1);else if(1===g){g=b;h=c;k=a;do u=k.prev,t=k.next.next,!sb(u,t)&&ff(u,k,k.next,t)&&Vc(u,t)&&Vc(t,u)&&(g.push(u.i/h),g.push(k.i/h),g.push(t.i/h),Sc(k),Sc(k.next),k=a=t),k=k.next;while(k!==a);a=k;Uc(a, +b,c,d,e,f,2)}else if(2===g)a:{g=a;do{for(h=g.next.next;h!==g.prev;){if(k=g.i!==h.i){k=g;u=h;if(t=k.next.i!==u.i&&k.prev.i!==u.i){b:{t=k;do{if(t.i!==k.i&&t.next.i!==k.i&&t.i!==u.i&&t.next.i!==u.i&&ff(t,t.next,k,u)){t=!0;break b}t=t.next}while(t!==k);t=!1}t=!t}if(t=t&&Vc(k,u)&&Vc(u,k)){t=k;r=!1;n=(k.x+u.x)/2;u=(k.y+u.y)/2;do t.y>u!==t.next.y>u&&t.next.y!==t.y&&n<(t.next.x-t.x)*(u-t.y)/(t.next.y-t.y)+t.x&&(r=!r),t=t.next;while(t!==k);t=r}k=t}if(k){a=gf(g,h);g=Tc(g,g.next);a=Tc(a,a.next);Uc(g,b,c,d,e, +f);Uc(a,b,c,d,e,f);break a}h=h.next}g=g.next}while(g!==a)}break}}}}function Qg(a,b){return a.x-b.x}function Rg(a,b){var c=b,d=a.x,e=a.y,f=-Infinity;do{if(e<=c.y&&e>=c.next.y&&c.next.y!==c.y){var g=c.x+(e-c.y)*(c.next.x-c.x)/(c.next.y-c.y);if(g<=d&&g>f){f=g;if(g===d){if(e===c.y)return c;if(e===c.next.y)return c.next}var h=c.x=c.x&&c.x>=g&&d!==c.x&&zd(eh.x)&&Vc(c,a)&&(h=c,m=r)}c=c.next}return h}function de(a,b,c,d,e){a=32767*(a-c)*e;b=32767*(b-d)*e;a=(a|a<<8)&16711935;a=(a|a<<4)&252645135;a=(a|a<<2)&858993459;b=(b|b<<8)&16711935;b=(b|b<<4)&252645135;b=(b|b<<2)&858993459;return(a|a<<1)&1431655765|((b|b<<1)&1431655765)<<1}function Sg(a){var b=a,c=a;do b.xna(a.prev,a,a.next)?0<=na(a,b,a.next)&&0<=na(a,a.prev,b):0>na(a,b,a.prev)||0>na(a,a.next,b)}function gf(a,b){var c=new ee(a.i,a.x,a.y),d=new ee(b.i,b.x,b.y),e=a.next,f=b.prev;a.next=b;b.prev=a;c.next=e;e.prev= +c;d.next=c;c.prev=d;f.next=d;d.prev=f;return d}function ef(a,b,c,d){a=new ee(a,b,c);d?(a.next=d.next,a.prev=d,d.next.prev=a,d.next=a):(a.prev=a,a.next=a);return a}function Sc(a){a.next.prev=a.prev;a.prev.next=a.next;a.prevZ&&(a.prevZ.nextZ=a.nextZ);a.nextZ&&(a.nextZ.prevZ=a.prevZ)}function ee(a,b,c){this.i=a;this.x=b;this.y=c;this.nextZ=this.prevZ=this.z=this.next=this.prev=null;this.steiner=!1}function hf(a){var b=a.length;2Number.EPSILON){var k=Math.sqrt(h),m=Math.sqrt(f*f+g*g);h=b.x-e/k;b=b.y+d/k; +g=((c.x-g/m-h)*g-(c.y+f/m-b)*f)/(d*g-e*f);f=h+d*g-a.x;d=b+e*g-a.y;e=f*f+d*d;if(2>=e)return new A(f,d);e=Math.sqrt(e/2)}else a=!1,d>Number.EPSILON?f>Number.EPSILON&&(a=!0):d<-Number.EPSILON?f<-Number.EPSILON&&(a=!0):Math.sign(e)===Math.sign(g)&&(a=!0),a?(f=-e,e=Math.sqrt(h)):(f=d,d=e,e=Math.sqrt(h/2));return new A(f/e,d/e)}function h(a,b){for(O=a.length;0<=--O;){var c=O;var f=O-1;0>f&&(f=a.length-1);var g,h=w+2*B;for(g=0;gr;r++){var n=m[f[r]];var l=m[f[(r+1)%3]];d[0]=Math.min(n,l);d[1]=Math.max(n,l);n=d[0]+","+d[1];void 0===e[n]?e[n]={index1:d[0],index2:d[1],face1:h,face2:void 0}:e[n].face2=h}for(n in e)if(d=e[n],void 0===d.face2||g[d.face1].normal.dot(g[d.face2].normal)<=b)f=a[d.index1], +c.push(f.x,f.y,f.z),f=a[d.index2],c.push(f.x,f.y,f.z);this.addAttribute("position",new z(c,3))}function xb(a,b,c,d,e,f,g,h){M.call(this);this.type="CylinderGeometry";this.parameters={radiusTop:a,radiusBottom:b,height:c,radialSegments:d,heightSegments:e,openEnded:f,thetaStart:g,thetaLength:h};this.fromBufferGeometry(new $a(a,b,c,d,e,f,g,h));this.mergeVertices()}function $a(a,b,c,d,e,f,g,h){function k(c){var e,f=new A,k=new p,q=0,u=!0===c?a:b,w=!0===c?1:-1;var z=t;for(e=1;e<=d;e++)n.push(0,y*w,0),l.push(0, +w,0),v.push(.5,.5),t++;var F=t;for(e=0;e<=d;e++){var C=e/d*h+g,I=Math.cos(C);C=Math.sin(C);k.x=u*C;k.y=y*w;k.z=u*I;n.push(k.x,k.y,k.z);l.push(0,w,0);f.x=.5*I+.5;f.y=.5*C*w+.5;v.push(f.x,f.y);t++}for(e=0;ethis.duration&&this.resetDuration()}function Ug(a){switch(a.toLowerCase()){case "scalar":case "double":case "float":case "number":case "integer":return ic;case "vector":case "vector2":case "vector3":case "vector4":return jc;case "color":return Md;case "quaternion":return hd;case "bool":case "boolean":return Ld;case "string":return Od}throw Error("THREE.KeyframeTrack: Unsupported typeName: "+ +a);}function Vg(a){if(void 0===a.type)throw Error("THREE.KeyframeTrack: track type undefined, can not parse");var b=Ug(a.type);if(void 0===a.times){var c=[],d=[];ra.flattenJSON(a.keys,c,d,"value");a.times=c;a.values=d}return void 0!==b.parse?b.parse(a):new b(a.name,a.times,a.values,a.interpolation)}function Pd(a){this.manager=void 0!==a?a:ya;this.textures={}}function je(a){this.manager=void 0!==a?a:ya}function kc(){}function Qd(a){"boolean"===typeof a&&(console.warn("THREE.JSONLoader: showStatus parameter has been removed from constructor."), +a=void 0);this.manager=void 0!==a?a:ya;this.withCredentials=!1}function of(a){this.manager=void 0!==a?a:ya;this.texturePath=""}function ke(a){"undefined"===typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported.");"undefined"===typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported.");this.manager=void 0!==a?a:ya;this.options=void 0}function le(){this.type="ShapePath";this.color=new G;this.subPaths=[];this.currentPath=null}function me(a){this.type= +"Font";this.data=a}function pf(a){this.manager=void 0!==a?a:ya}function ne(a){this.manager=void 0!==a?a:ya}function qf(){this.type="StereoCamera";this.aspect=1;this.eyeSep=.064;this.cameraL=new V;this.cameraL.layers.enable(1);this.cameraL.matrixAutoUpdate=!1;this.cameraR=new V;this.cameraR.layers.enable(2);this.cameraR.matrixAutoUpdate=!1}function id(a,b,c){C.call(this);this.type="CubeCamera";var d=new V(90,1,a,b);d.up.set(0,-1,0);d.lookAt(new p(1,0,0));this.add(d);var e=new V(90,1,a,b);e.up.set(0, +-1,0);e.lookAt(new p(-1,0,0));this.add(e);var f=new V(90,1,a,b);f.up.set(0,0,1);f.lookAt(new p(0,1,0));this.add(f);var g=new V(90,1,a,b);g.up.set(0,0,-1);g.lookAt(new p(0,-1,0));this.add(g);var h=new V(90,1,a,b);h.up.set(0,-1,0);h.lookAt(new p(0,0,1));this.add(h);var k=new V(90,1,a,b);k.up.set(0,-1,0);k.lookAt(new p(0,0,-1));this.add(k);this.renderTarget=new Jb(c,c,{format:1022,magFilter:1006,minFilter:1006});this.renderTarget.texture.name="CubeCamera";this.update=function(a,b){null===this.parent&& +this.updateMatrixWorld();var c=this.renderTarget,m=c.texture.generateMipmaps;c.texture.generateMipmaps=!1;c.activeCubeFace=0;a.render(b,d,c);c.activeCubeFace=1;a.render(b,e,c);c.activeCubeFace=2;a.render(b,f,c);c.activeCubeFace=3;a.render(b,g,c);c.activeCubeFace=4;a.render(b,h,c);c.texture.generateMipmaps=m;c.activeCubeFace=5;a.render(b,k,c);a.setRenderTarget(null)};this.clear=function(a,b,c,d){for(var e=this.renderTarget,f=0;6>f;f++)e.activeCubeFace=f,a.setRenderTarget(e),a.clear(b,c,d);a.setRenderTarget(null)}} +function oe(){C.call(this);this.type="AudioListener";this.context=pe.getContext();this.gain=this.context.createGain();this.gain.connect(this.context.destination);this.filter=null}function lc(a){C.call(this);this.type="Audio";this.context=a.context;this.gain=this.context.createGain();this.gain.connect(a.getInput());this.autoplay=!1;this.buffer=null;this.loop=!1;this.offset=this.startTime=0;this.playbackRate=1;this.isPlaying=!1;this.hasPlaybackControl=!0;this.sourceType="empty";this.filters=[]}function qe(a){lc.call(this, +a);this.panner=this.context.createPanner();this.panner.connect(this.gain)}function re(a,b){this.analyser=a.context.createAnalyser();this.analyser.fftSize=void 0!==b?b:2048;this.data=new Uint8Array(this.analyser.frequencyBinCount);a.getOutput().connect(this.analyser)}function se(a,b,c){this.binding=a;this.valueSize=c;a=Float64Array;switch(b){case "quaternion":b=this._slerp;break;case "string":case "bool":a=Array;b=this._select;break;default:b=this._lerp}this.buffer=new a(4*c);this._mixBufferRegion= +b;this.referenceCount=this.useCount=this.cumulativeWeight=0}function rf(a,b,c){c=c||ta.parseTrackName(b);this._targetGroup=a;this._bindings=a.subscribe_(b,c)}function ta(a,b,c){this.path=b;this.parsedPath=c||ta.parseTrackName(b);this.node=ta.findNode(a,this.parsedPath.nodeName)||a;this.rootNode=a}function sf(){this.uuid=S.generateUUID();this._objects=Array.prototype.slice.call(arguments);this.nCachedObjects_=0;var a={};this._indicesByUUID=a;for(var b=0,c=arguments.length;b!==c;++b)a[arguments[b].uuid]= +b;this._paths=[];this._parsedPaths=[];this._bindings=[];this._bindingsIndicesByPath={};var d=this;this.stats={objects:{get total(){return d._objects.length},get inUse(){return this.total-d.nCachedObjects_}},get bindingsPerObject(){return d._bindings.length}}}function tf(a,b,c){this._mixer=a;this._clip=b;this._localRoot=c||null;a=b.tracks;b=a.length;c=Array(b);for(var d={endingStart:2400,endingEnd:2400},e=0;e!==b;++e){var f=a[e].createInterpolant(null);c[e]=f;f.settings=d}this._interpolantSettings= +d;this._interpolants=c;this._propertyBindings=Array(b);this._weightInterpolant=this._timeScaleInterpolant=this._byClipCacheIndex=this._cacheIndex=null;this.loop=2201;this._loopCount=-1;this._startTime=null;this.time=0;this._effectiveWeight=this.weight=this._effectiveTimeScale=this.timeScale=1;this.repetitions=Infinity;this.paused=!1;this.enabled=!0;this.clampWhenFinished=!1;this.zeroSlopeAtEnd=this.zeroSlopeAtStart=!0}function te(a){this._root=a;this._initMemoryManager();this.time=this._accuIndex= +0;this.timeScale=1}function Rd(a,b){"string"===typeof a&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),a=b);this.value=a}function ue(){F.call(this);this.type="InstancedBufferGeometry";this.maxInstancedCount=void 0}function ve(a,b,c){qb.call(this,a,b);this.meshPerAttribute=c||1}function we(a,b,c,d){"number"===typeof c&&(d=c,c=!1,console.error("THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument."));I.call(this,a,b,c);this.meshPerAttribute= +d||1}function uf(a,b,c,d){this.ray=new pb(a,b);this.near=c||0;this.far=d||Infinity;this.params={Mesh:{},Line:{},LOD:{},Points:{threshold:1},Sprite:{}};Object.defineProperties(this.params,{PointCloud:{get:function(){console.warn("THREE.Raycaster: params.PointCloud has been renamed to params.Points.");return this.Points}}})}function vf(a,b){return a.distance-b.distance}function xe(a,b,c,d){if(!1!==a.visible&&(a.raycast(b,c),!0===d)){a=a.children;d=0;for(var e=a.length;dc;c++,d++){var e=c/32*Math.PI*2,f=d/32*Math.PI*2;b.push(Math.cos(e),Math.sin(e),1,Math.cos(f),Math.sin(f),1)}a.addAttribute("position",new z(b,3));b=new T({fog:!1});this.cone=new W(a,b);this.add(this.cone);this.update()}function zf(a){var b=[];a&&a.isBone&&b.push(a);for(var c=0;ca?-1:0b;b++)a[b]=(16>b?"0":"")+b.toString(16);return function(){var b=4294967295*Math.random()|0,d=4294967295*Math.random()|0,e=4294967295*Math.random()|0,f=4294967295*Math.random()|0;return(a[b&255]+a[b>>8&255]+a[b>>16&255]+a[b>>24&255]+"-"+a[d&255]+a[d>>8&255]+"-"+a[d>> +16&15|64]+a[d>>24&255]+"-"+a[e&63|128]+a[e>>8&255]+"-"+a[e>>16&255]+a[e>>24&255]+a[f&255]+a[f>>8&255]+a[f>>16&255]+a[f>>24&255]).toUpperCase()}}(),clamp:function(a,b,c){return Math.max(b,Math.min(c,a))},euclideanModulo:function(a,b){return(a%b+b)%b},mapLinear:function(a,b,c,d,e){return d+(a-b)*(e-d)/(c-b)},lerp:function(a,b,c){return(1-c)*a+c*b},smoothstep:function(a,b,c){if(a<=b)return 0;if(a>=c)return 1;a=(a-b)/(c-b);return a*a*(3-2*a)},smootherstep:function(a,b,c){if(a<=b)return 0;if(a>=c)return 1; +a=(a-b)/(c-b);return a*a*a*(a*(6*a-15)+10)},randInt:function(a,b){return a+Math.floor(Math.random()*(b-a+1))},randFloat:function(a,b){return a+Math.random()*(b-a)},randFloatSpread:function(a){return a*(.5-Math.random())},degToRad:function(a){return a*S.DEG2RAD},radToDeg:function(a){return a*S.RAD2DEG},isPowerOfTwo:function(a){return 0===(a&a-1)&&0!==a},ceilPowerOfTwo:function(a){return Math.pow(2,Math.ceil(Math.log(a)/Math.LN2))},floorPowerOfTwo:function(a){return Math.pow(2,Math.floor(Math.log(a)/ +Math.LN2))}};Object.defineProperties(A.prototype,{width:{get:function(){return this.x},set:function(a){this.x=a}},height:{get:function(){return this.y},set:function(a){this.y=a}}});Object.assign(A.prototype,{isVector2:!0,set:function(a,b){this.x=a;this.y=b;return this},setScalar:function(a){this.y=this.x=a;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setComponent:function(a,b){switch(a){case 0:this.x=b;break;case 1:this.y=b;break;default:throw Error("index is out of range: "+ +a);}return this},getComponent:function(a){switch(a){case 0:return this.x;case 1:return this.y;default:throw Error("index is out of range: "+a);}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(a){this.x=a.x;this.y=a.y;return this},add:function(a,b){if(void 0!==b)return console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(a,b);this.x+=a.x;this.y+=a.y;return this},addScalar:function(a){this.x+=a;this.y+=a;return this}, +addVectors:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;return this},addScaledVector:function(a,b){this.x+=a.x*b;this.y+=a.y*b;return this},sub:function(a,b){if(void 0!==b)return console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(a,b);this.x-=a.x;this.y-=a.y;return this},subScalar:function(a){this.x-=a;this.y-=a;return this},subVectors:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;return this},multiply:function(a){this.x*=a.x;this.y*= +a.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this},divide:function(a){this.x/=a.x;this.y/=a.y;return this},divideScalar:function(a){return this.multiplyScalar(1/a)},applyMatrix3:function(a){var b=this.x,c=this.y;a=a.elements;this.x=a[0]*b+a[3]*c+a[6];this.y=a[1]*b+a[4]*c+a[7];return this},min:function(a){this.x=Math.min(this.x,a.x);this.y=Math.min(this.y,a.y);return this},max:function(a){this.x=Math.max(this.x,a.x);this.y=Math.max(this.y,a.y);return this},clamp:function(a, +b){this.x=Math.max(a.x,Math.min(b.x,this.x));this.y=Math.max(a.y,Math.min(b.y,this.y));return this},clampScalar:function(){var a=new A,b=new A;return function(c,d){a.set(c,c);b.set(d,d);return this.clamp(a,b)}}(),clampLength:function(a,b){var c=this.length();return this.divideScalar(c||1).multiplyScalar(Math.max(a,Math.min(b,c)))},floor:function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);return this},ceil:function(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);return this},round:function(){this.x= +Math.round(this.x);this.y=Math.round(this.y);return this},roundToZero:function(){this.x=0>this.x?Math.ceil(this.x):Math.floor(this.x);this.y=0>this.y?Math.ceil(this.y):Math.floor(this.y);return this},negate:function(){this.x=-this.x;this.y=-this.y;return this},dot:function(a){return this.x*a.x+this.y*a.y},cross:function(a){return this.x*a.y-this.y*a.x},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},manhattanLength:function(){return Math.abs(this.x)+ +Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length()||1)},angle:function(){var a=Math.atan2(this.y,this.x);0>a&&(a+=2*Math.PI);return a},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x;a=this.y-a.y;return b*b+a*a},manhattanDistanceTo:function(a){return Math.abs(this.x-a.x)+Math.abs(this.y-a.y)},setLength:function(a){return this.normalize().multiplyScalar(a)},lerp:function(a,b){this.x+=(a.x-this.x)*b;this.y+= +(a.y-this.y)*b;return this},lerpVectors:function(a,b,c){return this.subVectors(b,a).multiplyScalar(c).add(a)},equals:function(a){return a.x===this.x&&a.y===this.y},fromArray:function(a,b){void 0===b&&(b=0);this.x=a[b];this.y=a[b+1];return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this.x;a[b+1]=this.y;return a},fromBufferAttribute:function(a,b,c){void 0!==c&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute().");this.x=a.getX(b);this.y=a.getY(b); +return this},rotateAround:function(a,b){var c=Math.cos(b);b=Math.sin(b);var d=this.x-a.x,e=this.y-a.y;this.x=d*c-e*b+a.x;this.y=d*b+e*c+a.y;return this}});Object.assign(P.prototype,{isMatrix4:!0,set:function(a,b,c,d,e,f,g,h,k,m,r,n,l,v,t,p){var q=this.elements;q[0]=a;q[4]=b;q[8]=c;q[12]=d;q[1]=e;q[5]=f;q[9]=g;q[13]=h;q[2]=k;q[6]=m;q[10]=r;q[14]=n;q[3]=l;q[7]=v;q[11]=t;q[15]=p;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},clone:function(){return(new P).fromArray(this.elements)}, +copy:function(a){var b=this.elements;a=a.elements;b[0]=a[0];b[1]=a[1];b[2]=a[2];b[3]=a[3];b[4]=a[4];b[5]=a[5];b[6]=a[6];b[7]=a[7];b[8]=a[8];b[9]=a[9];b[10]=a[10];b[11]=a[11];b[12]=a[12];b[13]=a[13];b[14]=a[14];b[15]=a[15];return this},copyPosition:function(a){var b=this.elements;a=a.elements;b[12]=a[12];b[13]=a[13];b[14]=a[14];return this},extractBasis:function(a,b,c){a.setFromMatrixColumn(this,0);b.setFromMatrixColumn(this,1);c.setFromMatrixColumn(this,2);return this},makeBasis:function(a,b,c){this.set(a.x, +b.x,c.x,0,a.y,b.y,c.y,0,a.z,b.z,c.z,0,0,0,0,1);return this},extractRotation:function(){var a=new p;return function(b){var c=this.elements,d=b.elements,e=1/a.setFromMatrixColumn(b,0).length(),f=1/a.setFromMatrixColumn(b,1).length();b=1/a.setFromMatrixColumn(b,2).length();c[0]=d[0]*e;c[1]=d[1]*e;c[2]=d[2]*e;c[3]=0;c[4]=d[4]*f;c[5]=d[5]*f;c[6]=d[6]*f;c[7]=0;c[8]=d[8]*b;c[9]=d[9]*b;c[10]=d[10]*b;c[11]=0;c[12]=0;c[13]=0;c[14]=0;c[15]=1;return this}}(),makeRotationFromEuler:function(a){a&&a.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order."); +var b=this.elements,c=a.x,d=a.y,e=a.z,f=Math.cos(c);c=Math.sin(c);var g=Math.cos(d);d=Math.sin(d);var h=Math.cos(e);e=Math.sin(e);if("XYZ"===a.order){a=f*h;var k=f*e,m=c*h,r=c*e;b[0]=g*h;b[4]=-g*e;b[8]=d;b[1]=k+m*d;b[5]=a-r*d;b[9]=-c*g;b[2]=r-a*d;b[6]=m+k*d;b[10]=f*g}else"YXZ"===a.order?(a=g*h,k=g*e,m=d*h,r=d*e,b[0]=a+r*c,b[4]=m*c-k,b[8]=f*d,b[1]=f*e,b[5]=f*h,b[9]=-c,b[2]=k*c-m,b[6]=r+a*c,b[10]=f*g):"ZXY"===a.order?(a=g*h,k=g*e,m=d*h,r=d*e,b[0]=a-r*c,b[4]=-f*e,b[8]=m+k*c,b[1]=k+m*c,b[5]=f*h,b[9]= +r-a*c,b[2]=-f*d,b[6]=c,b[10]=f*g):"ZYX"===a.order?(a=f*h,k=f*e,m=c*h,r=c*e,b[0]=g*h,b[4]=m*d-k,b[8]=a*d+r,b[1]=g*e,b[5]=r*d+a,b[9]=k*d-m,b[2]=-d,b[6]=c*g,b[10]=f*g):"YZX"===a.order?(a=f*g,k=f*d,m=c*g,r=c*d,b[0]=g*h,b[4]=r-a*e,b[8]=m*e+k,b[1]=e,b[5]=f*h,b[9]=-c*h,b[2]=-d*h,b[6]=k*e+m,b[10]=a-r*e):"XZY"===a.order&&(a=f*g,k=f*d,m=c*g,r=c*d,b[0]=g*h,b[4]=-e,b[8]=d*h,b[1]=a*e+r,b[5]=f*h,b[9]=k*e-m,b[2]=m*e-k,b[6]=c*h,b[10]=r*e+a);b[3]=0;b[7]=0;b[11]=0;b[12]=0;b[13]=0;b[14]=0;b[15]=1;return this},makeRotationFromQuaternion:function(){var a= +new p(0,0,0),b=new p(1,1,1);return function(c){return this.compose(a,c,b)}}(),lookAt:function(){var a=new p,b=new p,c=new p;return function(d,e,f){var g=this.elements;c.subVectors(d,e);0===c.lengthSq()&&(c.z=1);c.normalize();a.crossVectors(f,c);0===a.lengthSq()&&(1===Math.abs(f.z)?c.x+=1E-4:c.z+=1E-4,c.normalize(),a.crossVectors(f,c));a.normalize();b.crossVectors(c,a);g[0]=a.x;g[4]=b.x;g[8]=c.x;g[1]=a.y;g[5]=b.y;g[9]=c.y;g[2]=a.z;g[6]=b.z;g[10]=c.z;return this}}(),multiply:function(a,b){return void 0!== +b?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(a,b)):this.multiplyMatrices(this,a)},premultiply:function(a){return this.multiplyMatrices(a,this)},multiplyMatrices:function(a,b){var c=a.elements,d=b.elements;b=this.elements;a=c[0];var e=c[4],f=c[8],g=c[12],h=c[1],k=c[5],m=c[9],r=c[13],n=c[2],l=c[6],v=c[10],t=c[14],p=c[3],y=c[7],x=c[11];c=c[15];var w=d[0],D=d[4],J=d[8],R=d[12],A=d[1],B=d[5],z=d[9],C=d[13],F=d[2], +I=d[6],G=d[10],H=d[14],L=d[3],M=d[7],K=d[11];d=d[15];b[0]=a*w+e*A+f*F+g*L;b[4]=a*D+e*B+f*I+g*M;b[8]=a*J+e*z+f*G+g*K;b[12]=a*R+e*C+f*H+g*d;b[1]=h*w+k*A+m*F+r*L;b[5]=h*D+k*B+m*I+r*M;b[9]=h*J+k*z+m*G+r*K;b[13]=h*R+k*C+m*H+r*d;b[2]=n*w+l*A+v*F+t*L;b[6]=n*D+l*B+v*I+t*M;b[10]=n*J+l*z+v*G+t*K;b[14]=n*R+l*C+v*H+t*d;b[3]=p*w+y*A+x*F+c*L;b[7]=p*D+y*B+x*I+c*M;b[11]=p*J+y*z+x*G+c*K;b[15]=p*R+y*C+x*H+c*d;return this},multiplyScalar:function(a){var b=this.elements;b[0]*=a;b[4]*=a;b[8]*=a;b[12]*=a;b[1]*=a;b[5]*= +a;b[9]*=a;b[13]*=a;b[2]*=a;b[6]*=a;b[10]*=a;b[14]*=a;b[3]*=a;b[7]*=a;b[11]*=a;b[15]*=a;return this},applyToBufferAttribute:function(){var a=new p;return function(b){for(var c=0,d=b.count;cthis.determinant()&&(g=-g);c.x=f[12];c.y=f[13];c.z=f[14];b.copy(this);c=1/g;f=1/h;var m=1/k;b.elements[0]*=c;b.elements[1]*=c;b.elements[2]*=c;b.elements[4]*=f;b.elements[5]*=f;b.elements[6]*=f;b.elements[8]*=m;b.elements[9]*=m;b.elements[10]*=m;d.setFromRotationMatrix(b); +e.x=g;e.y=h;e.z=k;return this}}(),makePerspective:function(a,b,c,d,e,f){void 0===f&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");var g=this.elements;g[0]=2*e/(b-a);g[4]=0;g[8]=(b+a)/(b-a);g[12]=0;g[1]=0;g[5]=2*e/(c-d);g[9]=(c+d)/(c-d);g[13]=0;g[2]=0;g[6]=0;g[10]=-(f+e)/(f-e);g[14]=-2*f*e/(f-e);g[3]=0;g[7]=0;g[11]=-1;g[15]=0;return this},makeOrthographic:function(a,b,c,d,e,f){var g=this.elements,h=1/(b-a),k=1/(c-d),m=1/(f-e);g[0]= +2*h;g[4]=0;g[8]=0;g[12]=-((b+a)*h);g[1]=0;g[5]=2*k;g[9]=0;g[13]=-((c+d)*k);g[2]=0;g[6]=0;g[10]=-2*m;g[14]=-((f+e)*m);g[3]=0;g[7]=0;g[11]=0;g[15]=1;return this},equals:function(a){var b=this.elements;a=a.elements;for(var c=0;16>c;c++)if(b[c]!==a[c])return!1;return!0},fromArray:function(a,b){void 0===b&&(b=0);for(var c=0;16>c;c++)this.elements[c]=a[c+b];return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);var c=this.elements;a[b]=c[0];a[b+1]=c[1];a[b+2]=c[2];a[b+3]=c[3];a[b+4]=c[4]; +a[b+5]=c[5];a[b+6]=c[6];a[b+7]=c[7];a[b+8]=c[8];a[b+9]=c[9];a[b+10]=c[10];a[b+11]=c[11];a[b+12]=c[12];a[b+13]=c[13];a[b+14]=c[14];a[b+15]=c[15];return a}});Object.assign(ja,{slerp:function(a,b,c,d){return c.copy(a).slerp(b,d)},slerpFlat:function(a,b,c,d,e,f,g){var h=c[d+0],k=c[d+1],m=c[d+2];c=c[d+3];d=e[f+0];var l=e[f+1],n=e[f+2];e=e[f+3];if(c!==e||h!==d||k!==l||m!==n){f=1-g;var q=h*d+k*l+m*n+c*e,v=0<=q?1:-1,p=1-q*q;p>Number.EPSILON&&(p=Math.sqrt(p),q=Math.atan2(p,q*v),f=Math.sin(f*q)/p,g=Math.sin(g* +q)/p);v*=g;h=h*f+d*v;k=k*f+l*v;m=m*f+n*v;c=c*f+e*v;f===1-g&&(g=1/Math.sqrt(h*h+k*k+m*m+c*c),h*=g,k*=g,m*=g,c*=g)}a[b]=h;a[b+1]=k;a[b+2]=m;a[b+3]=c}});Object.defineProperties(ja.prototype,{x:{get:function(){return this._x},set:function(a){this._x=a;this.onChangeCallback()}},y:{get:function(){return this._y},set:function(a){this._y=a;this.onChangeCallback()}},z:{get:function(){return this._z},set:function(a){this._z=a;this.onChangeCallback()}},w:{get:function(){return this._w},set:function(a){this._w= +a;this.onChangeCallback()}}});Object.assign(ja.prototype,{isQuaternion:!0,set:function(a,b,c,d){this._x=a;this._y=b;this._z=c;this._w=d;this.onChangeCallback();return this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(a){this._x=a.x;this._y=a.y;this._z=a.z;this._w=a.w;this.onChangeCallback();return this},setFromEuler:function(a,b){if(!a||!a.isEuler)throw Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order."); +var c=a._x,d=a._y,e=a._z;a=a.order;var f=Math.cos,g=Math.sin,h=f(c/2),k=f(d/2);f=f(e/2);c=g(c/2);d=g(d/2);e=g(e/2);"XYZ"===a?(this._x=c*k*f+h*d*e,this._y=h*d*f-c*k*e,this._z=h*k*e+c*d*f,this._w=h*k*f-c*d*e):"YXZ"===a?(this._x=c*k*f+h*d*e,this._y=h*d*f-c*k*e,this._z=h*k*e-c*d*f,this._w=h*k*f+c*d*e):"ZXY"===a?(this._x=c*k*f-h*d*e,this._y=h*d*f+c*k*e,this._z=h*k*e+c*d*f,this._w=h*k*f-c*d*e):"ZYX"===a?(this._x=c*k*f-h*d*e,this._y=h*d*f+c*k*e,this._z=h*k*e-c*d*f,this._w=h*k*f+c*d*e):"YZX"===a?(this._x= +c*k*f+h*d*e,this._y=h*d*f+c*k*e,this._z=h*k*e-c*d*f,this._w=h*k*f-c*d*e):"XZY"===a&&(this._x=c*k*f-h*d*e,this._y=h*d*f-c*k*e,this._z=h*k*e+c*d*f,this._w=h*k*f+c*d*e);if(!1!==b)this.onChangeCallback();return this},setFromAxisAngle:function(a,b){b/=2;var c=Math.sin(b);this._x=a.x*c;this._y=a.y*c;this._z=a.z*c;this._w=Math.cos(b);this.onChangeCallback();return this},setFromRotationMatrix:function(a){var b=a.elements,c=b[0];a=b[4];var d=b[8],e=b[1],f=b[5],g=b[9],h=b[2],k=b[6];b=b[10];var m=c+f+b;0f&&c>b?(c=2*Math.sqrt(1+c-f-b),this._w=(k-g)/c,this._x=.25*c,this._y=(a+e)/c,this._z=(d+h)/c):f>b?(c=2*Math.sqrt(1+f-c-b),this._w=(d-h)/c,this._x=(a+e)/c,this._y=.25*c,this._z=(g+k)/c):(c=2*Math.sqrt(1+b-c-f),this._w=(e-a)/c,this._x=(d+h)/c,this._y=(g+k)/c,this._z=.25*c);this.onChangeCallback();return this},setFromUnitVectors:function(){var a=new p,b;return function(c,d){void 0===a&&(a=new p);b=c.dot(d)+1;1E-6>b? +(b=0,Math.abs(c.x)>Math.abs(c.z)?a.set(-c.y,c.x,0):a.set(0,-c.z,c.y)):a.crossVectors(c,d);this._x=a.x;this._y=a.y;this._z=a.z;this._w=b;return this.normalize()}}(),angleTo:function(a){return 2*Math.acos(Math.abs(S.clamp(this.dot(a),-1,1)))},rotateTowards:function(a,b){var c=this.angleTo(a);if(0===c)return this;this.slerp(a,Math.min(1,b/c));return this},inverse:function(){return this.conjugate()},conjugate:function(){this._x*=-1;this._y*=-1;this._z*=-1;this.onChangeCallback();return this},dot:function(a){return this._x* +a._x+this._y*a._y+this._z*a._z+this._w*a._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var a=this.length();0===a?(this._z=this._y=this._x=0,this._w=1):(a=1/a,this._x*=a,this._y*=a,this._z*=a,this._w*=a);this.onChangeCallback();return this},multiply:function(a,b){return void 0!==b?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."), +this.multiplyQuaternions(a,b)):this.multiplyQuaternions(this,a)},premultiply:function(a){return this.multiplyQuaternions(a,this)},multiplyQuaternions:function(a,b){var c=a._x,d=a._y,e=a._z;a=a._w;var f=b._x,g=b._y,h=b._z;b=b._w;this._x=c*b+a*f+d*h-e*g;this._y=d*b+a*g+e*f-c*h;this._z=e*b+a*h+c*g-d*f;this._w=a*b-c*f-d*g-e*h;this.onChangeCallback();return this},slerp:function(a,b){if(0===b)return this;if(1===b)return this.copy(a);var c=this._x,d=this._y,e=this._z,f=this._w,g=f*a._w+c*a._x+d*a._y+e*a._z; +0>g?(this._w=-a._w,this._x=-a._x,this._y=-a._y,this._z=-a._z,g=-g):this.copy(a);if(1<=g)return this._w=f,this._x=c,this._y=d,this._z=e,this;a=1-g*g;if(a<=Number.EPSILON)return g=1-b,this._w=g*f+b*this._w,this._x=g*c+b*this._x,this._y=g*d+b*this._y,this._z=g*e+b*this._z,this.normalize();a=Math.sqrt(a);var h=Math.atan2(a,g);g=Math.sin((1-b)*h)/a;b=Math.sin(b*h)/a;this._w=f*g+this._w*b;this._x=c*g+this._x*b;this._y=d*g+this._y*b;this._z=e*g+this._z*b;this.onChangeCallback();return this},equals:function(a){return a._x=== +this._x&&a._y===this._y&&a._z===this._z&&a._w===this._w},fromArray:function(a,b){void 0===b&&(b=0);this._x=a[b];this._y=a[b+1];this._z=a[b+2];this._w=a[b+3];this.onChangeCallback();return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this._x;a[b+1]=this._y;a[b+2]=this._z;a[b+3]=this._w;return a},onChange:function(a){this.onChangeCallback=a;return this},onChangeCallback:function(){}});Object.assign(p.prototype,{isVector3:!0,set:function(a,b,c){this.x=a;this.y=b;this.z=c;return this}, +setScalar:function(a){this.z=this.y=this.x=a;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setZ:function(a){this.z=a;return this},setComponent:function(a,b){switch(a){case 0:this.x=b;break;case 1:this.y=b;break;case 2:this.z=b;break;default:throw Error("index is out of range: "+a);}return this},getComponent:function(a){switch(a){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error("index is out of range: "+a);}},clone:function(){return new this.constructor(this.x, +this.y,this.z)},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},add:function(a,b){if(void 0!==b)return console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(a,b);this.x+=a.x;this.y+=a.y;this.z+=a.z;return this},addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;return this},addVectors:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;return this},addScaledVector:function(a,b){this.x+=a.x*b;this.y+=a.y*b;this.z+= +a.z*b;return this},sub:function(a,b){if(void 0!==b)return console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(a,b);this.x-=a.x;this.y-=a.y;this.z-=a.z;return this},subScalar:function(a){this.x-=a;this.y-=a;this.z-=a;return this},subVectors:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this},multiply:function(a,b){if(void 0!==b)return console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."), +this.multiplyVectors(a,b);this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;return this},multiplyVectors:function(a,b){this.x=a.x*b.x;this.y=a.y*b.y;this.z=a.z*b.z;return this},applyEuler:function(){var a=new ja;return function(b){b&&b.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order.");return this.applyQuaternion(a.setFromEuler(b))}}(),applyAxisAngle:function(){var a=new ja;return function(b, +c){return this.applyQuaternion(a.setFromAxisAngle(b,c))}}(),applyMatrix3:function(a){var b=this.x,c=this.y,d=this.z;a=a.elements;this.x=a[0]*b+a[3]*c+a[6]*d;this.y=a[1]*b+a[4]*c+a[7]*d;this.z=a[2]*b+a[5]*c+a[8]*d;return this},applyMatrix4:function(a){var b=this.x,c=this.y,d=this.z;a=a.elements;var e=1/(a[3]*b+a[7]*c+a[11]*d+a[15]);this.x=(a[0]*b+a[4]*c+a[8]*d+a[12])*e;this.y=(a[1]*b+a[5]*c+a[9]*d+a[13])*e;this.z=(a[2]*b+a[6]*c+a[10]*d+a[14])*e;return this},applyQuaternion:function(a){var b=this.x, +c=this.y,d=this.z,e=a.x,f=a.y,g=a.z;a=a.w;var h=a*b+f*d-g*c,k=a*c+g*b-e*d,m=a*d+e*c-f*b;b=-e*b-f*c-g*d;this.x=h*a+b*-e+k*-g-m*-f;this.y=k*a+b*-f+m*-e-h*-g;this.z=m*a+b*-g+h*-f-k*-e;return this},project:function(a){return this.applyMatrix4(a.matrixWorldInverse).applyMatrix4(a.projectionMatrix)},unproject:function(){var a=new P;return function(b){return this.applyMatrix4(a.getInverse(b.projectionMatrix)).applyMatrix4(b.matrixWorld)}}(),transformDirection:function(a){var b=this.x,c=this.y,d=this.z;a= +a.elements;this.x=a[0]*b+a[4]*c+a[8]*d;this.y=a[1]*b+a[5]*c+a[9]*d;this.z=a[2]*b+a[6]*c+a[10]*d;return this.normalize()},divide:function(a){this.x/=a.x;this.y/=a.y;this.z/=a.z;return this},divideScalar:function(a){return this.multiplyScalar(1/a)},min:function(a){this.x=Math.min(this.x,a.x);this.y=Math.min(this.y,a.y);this.z=Math.min(this.z,a.z);return this},max:function(a){this.x=Math.max(this.x,a.x);this.y=Math.max(this.y,a.y);this.z=Math.max(this.z,a.z);return this},clamp:function(a,b){this.x=Math.max(a.x, +Math.min(b.x,this.x));this.y=Math.max(a.y,Math.min(b.y,this.y));this.z=Math.max(a.z,Math.min(b.z,this.z));return this},clampScalar:function(){var a=new p,b=new p;return function(c,d){a.set(c,c,c);b.set(d,d,d);return this.clamp(a,b)}}(),clampLength:function(a,b){var c=this.length();return this.divideScalar(c||1).multiplyScalar(Math.max(a,Math.min(b,c)))},floor:function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);this.z=Math.floor(this.z);return this},ceil:function(){this.x=Math.ceil(this.x); +this.y=Math.ceil(this.y);this.z=Math.ceil(this.z);return this},round:function(){this.x=Math.round(this.x);this.y=Math.round(this.y);this.z=Math.round(this.z);return this},roundToZero:function(){this.x=0>this.x?Math.ceil(this.x):Math.floor(this.x);this.y=0>this.y?Math.ceil(this.y):Math.floor(this.y);this.z=0>this.z?Math.ceil(this.z):Math.floor(this.z);return this},negate:function(){this.x=-this.x;this.y=-this.y;this.z=-this.z;return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},lengthSq:function(){return this.x* +this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(a){return this.normalize().multiplyScalar(a)},lerp:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;return this},lerpVectors:function(a,b,c){return this.subVectors(b,a).multiplyScalar(c).add(a)}, +cross:function(a,b){return void 0!==b?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(a,b)):this.crossVectors(this,a)},crossVectors:function(a,b){var c=a.x,d=a.y;a=a.z;var e=b.x,f=b.y;b=b.z;this.x=d*b-a*f;this.y=a*e-c*b;this.z=c*f-d*e;return this},projectOnVector:function(a){var b=a.dot(this)/a.lengthSq();return this.copy(a).multiplyScalar(b)},projectOnPlane:function(){var a=new p;return function(b){a.copy(this).projectOnVector(b); +return this.sub(a)}}(),reflect:function(){var a=new p;return function(b){return this.sub(a.copy(b).multiplyScalar(2*this.dot(b)))}}(),angleTo:function(a){a=this.dot(a)/Math.sqrt(this.lengthSq()*a.lengthSq());return Math.acos(S.clamp(a,-1,1))},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x,c=this.y-a.y;a=this.z-a.z;return b*b+c*c+a*a},manhattanDistanceTo:function(a){return Math.abs(this.x-a.x)+Math.abs(this.y-a.y)+Math.abs(this.z- +a.z)},setFromSpherical:function(a){return this.setFromSphericalCoords(a.radius,a.phi,a.theta)},setFromSphericalCoords:function(a,b,c){var d=Math.sin(b)*a;this.x=d*Math.sin(c);this.y=Math.cos(b)*a;this.z=d*Math.cos(c);return this},setFromCylindrical:function(a){return this.setFromCylindricalCoords(a.radius,a.theta,a.y)},setFromCylindricalCoords:function(a,b,c){this.x=a*Math.sin(b);this.y=c;this.z=a*Math.cos(b);return this},setFromMatrixPosition:function(a){a=a.elements;this.x=a[12];this.y=a[13];this.z= +a[14];return this},setFromMatrixScale:function(a){var b=this.setFromMatrixColumn(a,0).length(),c=this.setFromMatrixColumn(a,1).length();a=this.setFromMatrixColumn(a,2).length();this.x=b;this.y=c;this.z=a;return this},setFromMatrixColumn:function(a,b){return this.fromArray(a.elements,4*b)},equals:function(a){return a.x===this.x&&a.y===this.y&&a.z===this.z},fromArray:function(a,b){void 0===b&&(b=0);this.x=a[b];this.y=a[b+1];this.z=a[b+2];return this},toArray:function(a,b){void 0===a&&(a=[]);void 0=== +b&&(b=0);a[b]=this.x;a[b+1]=this.y;a[b+2]=this.z;return a},fromBufferAttribute:function(a,b,c){void 0!==c&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute().");this.x=a.getX(b);this.y=a.getY(b);this.z=a.getZ(b);return this}});Object.assign(oa.prototype,{isMatrix3:!0,set:function(a,b,c,d,e,f,g,h,k){var m=this.elements;m[0]=a;m[1]=d;m[2]=g;m[3]=b;m[4]=e;m[5]=h;m[6]=c;m[7]=f;m[8]=k;return this},identity:function(){this.set(1,0,0,0,1,0,0,0,1);return this},clone:function(){return(new this.constructor).fromArray(this.elements)}, +copy:function(a){var b=this.elements;a=a.elements;b[0]=a[0];b[1]=a[1];b[2]=a[2];b[3]=a[3];b[4]=a[4];b[5]=a[5];b[6]=a[6];b[7]=a[7];b[8]=a[8];return this},setFromMatrix4:function(a){a=a.elements;this.set(a[0],a[4],a[8],a[1],a[5],a[9],a[2],a[6],a[10]);return this},applyToBufferAttribute:function(){var a=new p;return function(b){for(var c=0,d=b.count;cc;c++)if(b[c]!==a[c])return!1;return!0},fromArray:function(a,b){void 0===b&&(b=0);for(var c=0;9>c;c++)this.elements[c]=a[c+b];return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);var c= +this.elements;a[b]=c[0];a[b+1]=c[1];a[b+2]=c[2];a[b+3]=c[3];a[b+4]=c[4];a[b+5]=c[5];a[b+6]=c[6];a[b+7]=c[7];a[b+8]=c[8];return a}});var hb={getDataURL:function(a){if(a instanceof HTMLCanvasElement)var b=a;else{b=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");b.width=a.width;b.height=a.height;var c=b.getContext("2d");a instanceof ImageData?c.putImageData(a,0,0):c.drawImage(a,0,0,a.width,a.height)}return 2048a.x||1a.x?0:1;break;case 1002:a.x=1===Math.abs(Math.floor(a.x)%2)?Math.ceil(a.x)-a.x:a.x-Math.floor(a.x)}if(0>a.y||1a.y?0:1;break;case 1002:a.y=1===Math.abs(Math.floor(a.y)%2)?Math.ceil(a.y)-a.y:a.y-Math.floor(a.y)}this.flipY&&(a.y=1-a.y);return a}});Object.defineProperty(Q.prototype,"needsUpdate",{set:function(a){!0===a&&this.version++}});Object.assign(Z.prototype,{isVector4:!0,set:function(a,b,c,d){this.x=a;this.y= +b;this.z=c;this.w=d;return this},setScalar:function(a){this.w=this.z=this.y=this.x=a;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setZ:function(a){this.z=a;return this},setW:function(a){this.w=a;return this},setComponent:function(a,b){switch(a){case 0:this.x=b;break;case 1:this.y=b;break;case 2:this.z=b;break;case 3:this.w=b;break;default:throw Error("index is out of range: "+a);}return this},getComponent:function(a){switch(a){case 0:return this.x;case 1:return this.y; +case 2:return this.z;case 3:return this.w;default:throw Error("index is out of range: "+a);}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=void 0!==a.w?a.w:1;return this},add:function(a,b){if(void 0!==b)return console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(a,b);this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},addScalar:function(a){this.x+= +a;this.y+=a;this.z+=a;this.w+=a;return this},addVectors:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this},addScaledVector:function(a,b){this.x+=a.x*b;this.y+=a.y*b;this.z+=a.z*b;this.w+=a.w*b;return this},sub:function(a,b){if(void 0!==b)return console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(a,b);this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;return this},subScalar:function(a){this.x-=a;this.y-= +a;this.z-=a;this.w-=a;return this},subVectors:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;this.w=a.w-b.w;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},applyMatrix4:function(a){var b=this.x,c=this.y,d=this.z,e=this.w;a=a.elements;this.x=a[0]*b+a[4]*c+a[8]*d+a[12]*e;this.y=a[1]*b+a[5]*c+a[9]*d+a[13]*e;this.z=a[2]*b+a[6]*c+a[10]*d+a[14]*e;this.w=a[3]*b+a[7]*c+a[11]*d+a[15]*e;return this},divideScalar:function(a){return this.multiplyScalar(1/ +a)},setAxisAngleFromQuaternion:function(a){this.w=2*Math.acos(a.w);var b=Math.sqrt(1-a.w*a.w);1E-4>b?(this.x=1,this.z=this.y=0):(this.x=a.x/b,this.y=a.y/b,this.z=a.z/b);return this},setAxisAngleFromRotationMatrix:function(a){a=a.elements;var b=a[0];var c=a[4];var d=a[8],e=a[1],f=a[5],g=a[9];var h=a[2];var k=a[6];var m=a[10];if(.01>Math.abs(c-e)&&.01>Math.abs(d-h)&&.01>Math.abs(g-k)){if(.1>Math.abs(c+e)&&.1>Math.abs(d+h)&&.1>Math.abs(g+k)&&.1>Math.abs(b+f+m-3))return this.set(1,0,0,0),this;a=Math.PI; +b=(b+1)/2;f=(f+1)/2;m=(m+1)/2;c=(c+e)/4;d=(d+h)/4;g=(g+k)/4;b>f&&b>m?.01>b?(k=0,c=h=.707106781):(k=Math.sqrt(b),h=c/k,c=d/k):f>m?.01>f?(k=.707106781,h=0,c=.707106781):(h=Math.sqrt(f),k=c/h,c=g/h):.01>m?(h=k=.707106781,c=0):(c=Math.sqrt(m),k=d/c,h=g/c);this.set(k,h,c,a);return this}a=Math.sqrt((k-g)*(k-g)+(d-h)*(d-h)+(e-c)*(e-c));.001>Math.abs(a)&&(a=1);this.x=(k-g)/a;this.y=(d-h)/a;this.z=(e-c)/a;this.w=Math.acos((b+f+m-1)/2);return this},min:function(a){this.x=Math.min(this.x,a.x);this.y=Math.min(this.y, +a.y);this.z=Math.min(this.z,a.z);this.w=Math.min(this.w,a.w);return this},max:function(a){this.x=Math.max(this.x,a.x);this.y=Math.max(this.y,a.y);this.z=Math.max(this.z,a.z);this.w=Math.max(this.w,a.w);return this},clamp:function(a,b){this.x=Math.max(a.x,Math.min(b.x,this.x));this.y=Math.max(a.y,Math.min(b.y,this.y));this.z=Math.max(a.z,Math.min(b.z,this.z));this.w=Math.max(a.w,Math.min(b.w,this.w));return this},clampScalar:function(){var a,b;return function(c,d){void 0===a&&(a=new Z,b=new Z);a.set(c, +c,c,c);b.set(d,d,d,d);return this.clamp(a,b)}}(),clampLength:function(a,b){var c=this.length();return this.divideScalar(c||1).multiplyScalar(Math.max(a,Math.min(b,c)))},floor:function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);this.z=Math.floor(this.z);this.w=Math.floor(this.w);return this},ceil:function(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);this.z=Math.ceil(this.z);this.w=Math.ceil(this.w);return this},round:function(){this.x=Math.round(this.x);this.y=Math.round(this.y); +this.z=Math.round(this.z);this.w=Math.round(this.w);return this},roundToZero:function(){this.x=0>this.x?Math.ceil(this.x):Math.floor(this.x);this.y=0>this.y?Math.ceil(this.y):Math.floor(this.y);this.z=0>this.z?Math.ceil(this.z):Math.floor(this.z);this.w=0>this.w?Math.ceil(this.w):Math.floor(this.w);return this},negate:function(){this.x=-this.x;this.y=-this.y;this.z=-this.z;this.w=-this.w;return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*a.w},lengthSq:function(){return this.x* +this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(a){return this.normalize().multiplyScalar(a)},lerp:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b;return this},lerpVectors:function(a, +b,c){return this.subVectors(b,a).multiplyScalar(c).add(a)},equals:function(a){return a.x===this.x&&a.y===this.y&&a.z===this.z&&a.w===this.w},fromArray:function(a,b){void 0===b&&(b=0);this.x=a[b];this.y=a[b+1];this.z=a[b+2];this.w=a[b+3];return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this.x;a[b+1]=this.y;a[b+2]=this.z;a[b+3]=this.w;return a},fromBufferAttribute:function(a,b,c){void 0!==c&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."); +this.x=a.getX(b);this.y=a.getY(b);this.z=a.getZ(b);this.w=a.getW(b);return this}});ib.prototype=Object.assign(Object.create(ia.prototype),{constructor:ib,isWebGLRenderTarget:!0,setSize:function(a,b){if(this.width!==a||this.height!==b)this.width=a,this.height=b,this.dispose();this.viewport.set(0,0,a,b);this.scissor.set(0,0,a,b)},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.width=a.width;this.height=a.height;this.viewport.copy(a.viewport);this.texture=a.texture.clone(); +this.depthBuffer=a.depthBuffer;this.stencilBuffer=a.stencilBuffer;this.depthTexture=a.depthTexture;return this},dispose:function(){this.dispatchEvent({type:"dispose"})}});Jb.prototype=Object.create(ib.prototype);Jb.prototype.constructor=Jb;Jb.prototype.isWebGLRenderTargetCube=!0;jb.prototype=Object.create(Q.prototype);jb.prototype.constructor=jb;jb.prototype.isDataTexture=!0;Object.assign(Wa.prototype,{isBox3:!0,set:function(a,b){this.min.copy(a);this.max.copy(b);return this},setFromArray:function(a){for(var b= +Infinity,c=Infinity,d=Infinity,e=-Infinity,f=-Infinity,g=-Infinity,h=0,k=a.length;he&&(e=m);l>f&&(f=l);n>g&&(g=n)}this.min.set(b,c,d);this.max.set(e,f,g);return this},setFromBufferAttribute:function(a){for(var b=Infinity,c=Infinity,d=Infinity,e=-Infinity,f=-Infinity,g=-Infinity,h=0,k=a.count;he&&(e=m);l>f&&(f=l);n>g&&(g=n)}this.min.set(b,c,d); +this.max.set(e,f,g);return this},setFromPoints:function(a){this.makeEmpty();for(var b=0,c=a.length;bthis.max.x||a.ythis.max.y||a.zthis.max.z?!1:!0},containsBox:function(a){return this.min.x<=a.min.x&&a.max.x<=this.max.x&&this.min.y<=a.min.y&&a.max.y<=this.max.y&&this.min.z<=a.min.z&& +a.max.z<=this.max.z},getParameter:function(a,b){void 0===b&&(console.warn("THREE.Box3: .getParameter() target is now required"),b=new p);return b.set((a.x-this.min.x)/(this.max.x-this.min.x),(a.y-this.min.y)/(this.max.y-this.min.y),(a.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(a){return a.max.xthis.max.x||a.max.ythis.max.y||a.max.zthis.max.z?!1:!0},intersectsSphere:function(){var a=new p;return function(b){this.clampPoint(b.center, +a);return a.distanceToSquared(b.center)<=b.radius*b.radius}}(),intersectsPlane:function(a){if(0=-a.constant},intersectsTriangle:function(){function a(a){var e; +var f=0;for(e=a.length-3;f<=e;f+=3){h.fromArray(a,f);var g=m.x*Math.abs(h.x)+m.y*Math.abs(h.y)+m.z*Math.abs(h.z),k=b.dot(h),l=c.dot(h),n=d.dot(h);if(Math.max(-Math.max(k,l,n),Math.min(k,l,n))>g)return!1}return!0}var b=new p,c=new p,d=new p,e=new p,f=new p,g=new p,h=new p,k=new p,m=new p,l=new p;return function(h){if(this.isEmpty())return!1;this.getCenter(k);m.subVectors(this.max,k);b.subVectors(h.a,k);c.subVectors(h.b,k);d.subVectors(h.c,k);e.subVectors(c,b);f.subVectors(d,c);g.subVectors(b,d);h= +[0,-e.z,e.y,0,-f.z,f.y,0,-g.z,g.y,e.z,0,-e.x,f.z,0,-f.x,g.z,0,-g.x,-e.y,e.x,0,-f.y,f.x,0,-g.y,g.x,0];if(!a(h))return!1;h=[1,0,0,0,1,0,0,0,1];if(!a(h))return!1;l.crossVectors(e,f);h=[l.x,l.y,l.z];return a(h)}}(),clampPoint:function(a,b){void 0===b&&(console.warn("THREE.Box3: .clampPoint() target is now required"),b=new p);return b.copy(a).clamp(this.min,this.max)},distanceToPoint:function(){var a=new p;return function(b){return a.copy(b).clamp(this.min,this.max).sub(b).length()}}(),getBoundingSphere:function(){var a= +new p;return function(b){void 0===b&&(console.warn("THREE.Box3: .getBoundingSphere() target is now required"),b=new Fa);this.getCenter(b.center);b.radius=.5*this.getSize(a).length();return b}}(),intersect:function(a){this.min.max(a.min);this.max.min(a.max);this.isEmpty()&&this.makeEmpty();return this},union:function(a){this.min.min(a.min);this.max.max(a.max);return this},applyMatrix4:function(){var a=[new p,new p,new p,new p,new p,new p,new p,new p];return function(b){if(this.isEmpty())return this; +a[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(b);a[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(b);a[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(b);a[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(b);a[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(b);a[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(b);a[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(b);a[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(b);this.setFromPoints(a);return this}}(), +translate:function(a){this.min.add(a);this.max.add(a);return this},equals:function(a){return a.min.equals(this.min)&&a.max.equals(this.max)}});Object.assign(Fa.prototype,{set:function(a,b){this.center.copy(a);this.radius=b;return this},setFromPoints:function(){var a=new Wa;return function(b,c){var d=this.center;void 0!==c?d.copy(c):a.setFromPoints(b).getCenter(d);for(var e=c=0,f=b.length;e=this.radius},containsPoint:function(a){return a.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(a){return a.distanceTo(this.center)-this.radius},intersectsSphere:function(a){var b=this.radius+a.radius;return a.center.distanceToSquared(this.center)<=b*b},intersectsBox:function(a){return a.intersectsSphere(this)},intersectsPlane:function(a){return Math.abs(a.distanceToPoint(this.center))<= +this.radius},clampPoint:function(a,b){var c=this.center.distanceToSquared(a);void 0===b&&(console.warn("THREE.Sphere: .clampPoint() target is now required"),b=new p);b.copy(a);c>this.radius*this.radius&&(b.sub(this.center).normalize(),b.multiplyScalar(this.radius).add(this.center));return b},getBoundingBox:function(a){void 0===a&&(console.warn("THREE.Sphere: .getBoundingBox() target is now required"),a=new Wa);a.set(this.center,this.center);a.expandByScalar(this.radius);return a},applyMatrix4:function(a){this.center.applyMatrix4(a); +this.radius*=a.getMaxScaleOnAxis();return this},translate:function(a){this.center.add(a);return this},equals:function(a){return a.center.equals(this.center)&&a.radius===this.radius}});Object.assign(Pa.prototype,{set:function(a,b){this.normal.copy(a);this.constant=b;return this},setComponents:function(a,b,c,d){this.normal.set(a,b,c);this.constant=d;return this},setFromNormalAndCoplanarPoint:function(a,b){this.normal.copy(a);this.constant=-b.dot(this.normal);return this},setFromCoplanarPoints:function(){var a= +new p,b=new p;return function(c,d,e){d=a.subVectors(e,d).cross(b.subVectors(c,d)).normalize();this.setFromNormalAndCoplanarPoint(d,c);return this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.normal.copy(a.normal);this.constant=a.constant;return this},normalize:function(){var a=1/this.normal.length();this.normal.multiplyScalar(a);this.constant*=a;return this},negate:function(){this.constant*=-1;this.normal.negate();return this},distanceToPoint:function(a){return this.normal.dot(a)+ +this.constant},distanceToSphere:function(a){return this.distanceToPoint(a.center)-a.radius},projectPoint:function(a,b){void 0===b&&(console.warn("THREE.Plane: .projectPoint() target is now required"),b=new p);return b.copy(this.normal).multiplyScalar(-this.distanceToPoint(a)).add(a)},intersectLine:function(){var a=new p;return function(b,c){void 0===c&&(console.warn("THREE.Plane: .intersectLine() target is now required"),c=new p);var d=b.delta(a),e=this.normal.dot(d);if(0===e){if(0===this.distanceToPoint(b.start))return c.copy(b.start)}else if(e= +-(b.start.dot(this.normal)+this.constant)/e,!(0>e||1b&&0a&&0c;c++)b[c].copy(a.planes[c]);return this},setFromMatrix:function(a){var b=this.planes,c=a.elements;a=c[0];var d=c[1],e=c[2],f=c[3],g=c[4],h=c[5],k=c[6],m=c[7],l=c[8],n=c[9],q=c[10],p=c[11],t=c[12],u=c[13],y=c[14];c=c[15];b[0].setComponents(f-a,m-g,p-l,c-t).normalize();b[1].setComponents(f+a,m+g,p+l,c+t).normalize();b[2].setComponents(f+d,m+h,p+n,c+u).normalize();b[3].setComponents(f- +d,m-h,p-n,c-u).normalize();b[4].setComponents(f-e,m-k,p-q,c-y).normalize();b[5].setComponents(f+e,m+k,p+q,c+y).normalize();return this},intersectsObject:function(){var a=new Fa;return function(b){var c=b.geometry;null===c.boundingSphere&&c.computeBoundingSphere();a.copy(c.boundingSphere).applyMatrix4(b.matrixWorld);return this.intersectsSphere(a)}}(),intersectsSprite:function(){var a=new Fa;return function(b){a.center.set(0,0,0);a.radius=.7071067811865476;a.applyMatrix4(b.matrixWorld);return this.intersectsSphere(a)}}(), +intersectsSphere:function(a){var b=this.planes,c=a.center;a=-a.radius;for(var d=0;6>d;d++)if(b[d].distanceToPoint(c)d;d++){var e=c[d];a.x=0e.distanceToPoint(a))return!1}return!0}}(),containsPoint:function(a){for(var b=this.planes,c=0;6>c;c++)if(0>b[c].distanceToPoint(a))return!1;return!0}});var K= {alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif\n",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif\n",alphatest_fragment:"#ifdef ALPHATEST\n\tif ( diffuseColor.a < ALPHATEST ) discard;\n#endif\n",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_ENVMAP ) && defined( PHYSICAL )\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );\n\t#endif\n#endif\n", -aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",begin_vertex:"\nvec3 transformed = vec3( position );\n",beginnormal_vertex:"\nvec3 objectNormal = vec3( normal );\n",bsdfs:"float punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\tif( decayExponent > 0.0 ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\tfloat maxDistanceCutoffFactor = pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\treturn distanceFalloff * maxDistanceCutoffFactor;\n#else\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n#endif\n\t}\n\treturn 1.0;\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNL = saturate( dot( geometry.normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\nvec3 BRDF_Specular_GGX_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 AB = vec2( -1.04, 1.04 ) * a004 + r.zw;\n\treturn specularColor * AB.x + AB.y;\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n", +aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",begin_vertex:"\nvec3 transformed = vec3( position );\n",beginnormal_vertex:"\nvec3 objectNormal = vec3( normal );\n",bsdfs:"float punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\tif( cutoffDistance > 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n#else\n\tif( cutoffDistance > 0.0 ) {\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t}\n\treturn 1.0;\n#endif\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNL = saturate( dot( geometry.normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\nvec3 BRDF_Specular_GGX_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 AB = vec2( -1.04, 1.04 ) * a004 + r.zw;\n\treturn specularColor * AB.x + AB.y;\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n", bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\t\tvec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 );\n\t\tfDet *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif\n", clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vViewPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vViewPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\tif ( clipped ) discard;\n\t#endif\n#endif\n", -clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\t#if ! defined( PHYSICAL ) && ! defined( PHONG )\n\t\tvarying vec3 vViewPosition;\n\t#endif\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif\n",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n\tvarying vec3 vViewPosition;\n#endif\n",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n", +clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\t#if ! defined( PHYSICAL ) && ! defined( PHONG ) && ! defined( MATCAP )\n\t\tvarying vec3 vViewPosition;\n\t#endif\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif\n",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG ) && ! defined( MATCAP )\n\tvarying vec3 vViewPosition;\n#endif\n",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG ) && ! defined( MATCAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n", color_fragment:"#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif\n",color_pars_vertex:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\n\tvColor.xyz = color.xyz;\n#endif",common:"#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI_HALF 1.5707963267949\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#define whiteCompliment(a) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract(sin(sn) * c);\n}\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\treturn - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat linearToRelativeLuminance( const in vec3 color ) {\n\tvec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\n\treturn dot( weights, color.rgb );\n}\n", cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n#define cubeUV_textureSize (1024.0)\nint getFaceFromDirection(vec3 direction) {\n\tvec3 absDirection = abs(direction);\n\tint face = -1;\n\tif( absDirection.x > absDirection.z ) {\n\t\tif(absDirection.x > absDirection.y )\n\t\t\tface = direction.x > 0.0 ? 0 : 3;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\telse {\n\t\tif(absDirection.z > absDirection.y )\n\t\t\tface = direction.z > 0.0 ? 2 : 5;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\treturn face;\n}\n#define cubeUV_maxLods1 (log2(cubeUV_textureSize*0.25) - 1.0)\n#define cubeUV_rangeClamp (exp2((6.0 - 1.0) * 2.0))\nvec2 MipLevelInfo( vec3 vec, float roughnessLevel, float roughness ) {\n\tfloat scale = exp2(cubeUV_maxLods1 - roughnessLevel);\n\tfloat dxRoughness = dFdx(roughness);\n\tfloat dyRoughness = dFdy(roughness);\n\tvec3 dx = dFdx( vec * scale * dxRoughness );\n\tvec3 dy = dFdy( vec * scale * dyRoughness );\n\tfloat d = max( dot( dx, dx ), dot( dy, dy ) );\n\td = clamp(d, 1.0, cubeUV_rangeClamp);\n\tfloat mipLevel = 0.5 * log2(d);\n\treturn vec2(floor(mipLevel), fract(mipLevel));\n}\n#define cubeUV_maxLods2 (log2(cubeUV_textureSize*0.25) - 2.0)\n#define cubeUV_rcpTextureSize (1.0 / cubeUV_textureSize)\nvec2 getCubeUV(vec3 direction, float roughnessLevel, float mipLevel) {\n\tmipLevel = roughnessLevel > cubeUV_maxLods2 - 3.0 ? 0.0 : mipLevel;\n\tfloat a = 16.0 * cubeUV_rcpTextureSize;\n\tvec2 exp2_packed = exp2( vec2( roughnessLevel, mipLevel ) );\n\tvec2 rcp_exp2_packed = vec2( 1.0 ) / exp2_packed;\n\tfloat powScale = exp2_packed.x * exp2_packed.y;\n\tfloat scale = rcp_exp2_packed.x * rcp_exp2_packed.y * 0.25;\n\tfloat mipOffset = 0.75*(1.0 - rcp_exp2_packed.y) * rcp_exp2_packed.x;\n\tbool bRes = mipLevel == 0.0;\n\tscale = bRes && (scale < a) ? a : scale;\n\tvec3 r;\n\tvec2 offset;\n\tint face = getFaceFromDirection(direction);\n\tfloat rcpPowScale = 1.0 / powScale;\n\tif( face == 0) {\n\t\tr = vec3(direction.x, -direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 1) {\n\t\tr = vec3(direction.y, direction.x, direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 2) {\n\t\tr = vec3(direction.z, direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 3) {\n\t\tr = vec3(direction.x, direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse if( face == 4) {\n\t\tr = vec3(direction.y, direction.x, -direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse {\n\t\tr = vec3(direction.z, -direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\tr = normalize(r);\n\tfloat texelOffset = 0.5 * cubeUV_rcpTextureSize;\n\tvec2 s = ( r.yz / abs( r.x ) + vec2( 1.0 ) ) * 0.5;\n\tvec2 base = offset + vec2( texelOffset );\n\treturn base + s * ( scale - 2.0 * texelOffset );\n}\n#define cubeUV_maxLods3 (log2(cubeUV_textureSize*0.25) - 3.0)\nvec4 textureCubeUV( sampler2D envMap, vec3 reflectedDirection, float roughness ) {\n\tfloat roughnessVal = roughness* cubeUV_maxLods3;\n\tfloat r1 = floor(roughnessVal);\n\tfloat r2 = r1 + 1.0;\n\tfloat t = fract(roughnessVal);\n\tvec2 mipInfo = MipLevelInfo(reflectedDirection, r1, roughness);\n\tfloat s = mipInfo.y;\n\tfloat level0 = mipInfo.x;\n\tfloat level1 = level0 + 1.0;\n\tlevel1 = level1 > 5.0 ? 5.0 : level1;\n\tlevel0 += min( floor( s + 0.5 ), 5.0 );\n\tvec2 uv_10 = getCubeUV(reflectedDirection, r1, level0);\n\tvec4 color10 = envMapTexelToLinear(texture2D(envMap, uv_10));\n\tvec2 uv_20 = getCubeUV(reflectedDirection, r2, level0);\n\tvec4 color20 = envMapTexelToLinear(texture2D(envMap, uv_20));\n\tvec4 result = mix(color10, color20, t);\n\treturn vec4(result.rgb, 1.0);\n}\n#endif\n", defaultnormal_vertex:"vec3 transformedNormal = normalMatrix * objectNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif\n",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, uv ).x * displacementScale + displacementBias );\n#endif\n", @@ -448,8 +453,8 @@ skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( tra specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif\n",tonemapping_pars_fragment:"#ifndef saturate\n\t#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nuniform float toneMappingWhitePoint;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\n#define Uncharted2Helper( x ) max( ( ( x * ( 0.15 * x + 0.10 * 0.50 ) + 0.20 * 0.02 ) / ( x * ( 0.15 * x + 0.50 ) + 0.20 * 0.30 ) ) - 0.02 / 0.30, vec3( 0.0 ) )\nvec3 Uncharted2ToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\n", uv_pars_fragment:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n\tuniform mat3 uvTransform;\n#endif\n", uv_vertex:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n#endif",uv2_pars_fragment:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n#endif", -uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = uv2;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP )\n\tvec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );\n#endif\n",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldPosition;\nvoid main() {\n\tgl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );\n\tgl_FragColor.a *= opacity;\n}\n", -cube_vert:"varying vec3 vWorldPosition;\n#include \nvoid main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n\tgl_Position.z = gl_Position.w;\n}\n",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - gl_FragCoord.z ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( gl_FragCoord.z );\n\t#endif\n}\n", +uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = uv2;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP )\n\tvec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );\n#endif\n",background_frag:"uniform sampler2D t2D;\nvarying vec2 vUv;\nvoid main() {\n\tgl_FragColor = texture2D( t2D, vUv );\n}\n",background_vert:"varying vec2 vUv;\nvoid main() {\n\tvUv = uv;\n\tgl_Position = vec4( position, 1.0 );\n\tgl_Position.z = 1.0;\n}\n", +cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldPosition;\nvoid main() {\n\tgl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );\n\tgl_FragColor.a *= opacity;\n}\n",cube_vert:"varying vec3 vWorldPosition;\n#include \nvoid main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n\tgl_Position.z = gl_Position.w;\n}\n",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - gl_FragCoord.z ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( gl_FragCoord.z );\n\t#endif\n}\n", depth_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n", distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main () {\n\t#include \n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include \n\t#include \n\t#include \n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}\n", distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvWorldPosition = worldPosition.xyz;\n}\n", @@ -460,6 +465,8 @@ meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHAD meshbasic_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifdef USE_ENVMAP\n\t#include \n\t#include \n\t#include \n\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n", meshlambert_frag:"uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\treflectedLight.indirectDiffuse = getAmbientLightIrradiance( ambientLightColor );\n\t#include \n\treflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse = vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n", meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n", +meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\tvec4 matcapColor = texture2D( matcap, uv );\n\tmatcapColor = matcapTexelToLinear( matcapColor );\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}\n", +meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifndef FLAT_SHADED\n\t\tvNormal = normalize( transformedNormal );\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n}\n", meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n", meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n\t#include \n}\n", meshphysical_frag:"#define PHYSICAL\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifndef STANDARD\n\tuniform float clearCoat;\n\tuniform float clearCoatRoughness;\n#endif\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n", @@ -471,361 +478,365 @@ points_vert:"uniform float size;\nuniform float scale;\n#include \n#incl shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include \n}\n",shadow_vert:"#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n", sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n}\n", sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include \n\t#include \n\t#include \n}\n"}, -Ba={merge:function(a){for(var b={},c=0;c>16&255)/255;this.g=(a>>8&255)/255;this.b=(a&255)/255;return this},setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;return this},setHSL:function(){function a(a,c,d){0>d&&(d+=1);1d?c:d<2/3?a+6*(c-a)*(2/3-d):a}return function(b, -c,d){b=K.euclideanModulo(b,1);c=K.clamp(c,0,1);d=K.clamp(d,0,1);0===c?this.r=this.g=this.b=d:(c=.5>=d?d*(1+c):d+c-d*c,d=2*d-c,this.r=a(d,c,b+1/3),this.g=a(d,c,b),this.b=a(d,c,b-1/3));return this}}(),setStyle:function(a){function b(b){void 0!==b&&1>parseFloat(b)&&console.warn("THREE.Color: Alpha component of "+a+" will be ignored.")}var c;if(c=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(a)){var d=c[2];switch(c[1]){case "rgb":case "rgba":if(c=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(d))return this.r= +c,d){b=S.euclideanModulo(b,1);c=S.clamp(c,0,1);d=S.clamp(d,0,1);0===c?this.r=this.g=this.b=d:(c=.5>=d?d*(1+c):d+c-d*c,d=2*d-c,this.r=a(d,c,b+1/3),this.g=a(d,c,b),this.b=a(d,c,b-1/3));return this}}(),setStyle:function(a){function b(b){void 0!==b&&1>parseFloat(b)&&console.warn("THREE.Color: Alpha component of "+a+" will be ignored.")}var c;if(c=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(a)){var d=c[2];switch(c[1]){case "rgb":case "rgba":if(c=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(d))return this.r= Math.min(255,parseInt(c[1],10))/255,this.g=Math.min(255,parseInt(c[2],10))/255,this.b=Math.min(255,parseInt(c[3],10))/255,b(c[5]),this;if(c=/^(\d+)%\s*,\s*(\d+)%\s*,\s*(\d+)%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(d))return this.r=Math.min(100,parseInt(c[1],10))/100,this.g=Math.min(100,parseInt(c[2],10))/100,this.b=Math.min(100,parseInt(c[3],10))/100,b(c[5]),this;break;case "hsl":case "hsla":if(c=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)%\s*,\s*(\d+)%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(d)){d=parseFloat(c[1])/ -360;var e=parseInt(c[2],10)/100,f=parseInt(c[3],10)/100;b(c[5]);return this.setHSL(d,e,f)}}}else if(c=/^#([A-Fa-f0-9]+)$/.exec(a)){c=c[1];d=c.length;if(3===d)return this.r=parseInt(c.charAt(0)+c.charAt(0),16)/255,this.g=parseInt(c.charAt(1)+c.charAt(1),16)/255,this.b=parseInt(c.charAt(2)+c.charAt(2),16)/255,this;if(6===d)return this.r=parseInt(c.charAt(0)+c.charAt(1),16)/255,this.g=parseInt(c.charAt(2)+c.charAt(3),16)/255,this.b=parseInt(c.charAt(4)+c.charAt(5),16)/255,this}a&&0a?.0773993808*a:Math.pow(.9478672986*a+.0521327014,2.4)}return function(b){this.r=a(b.r);this.g=a(b.g);this.b=a(b.b);return this}}(),copyLinearToSRGB:function(){function a(a){return.0031308>a?12.92*a:1.055*Math.pow(a,.41666)-.055}return function(b){this.r=a(b.r);this.g=a(b.g);this.b=a(b.b);return this}}(),convertSRGBToLinear:function(){this.copySRGBToLinear(this); return this},convertLinearToSRGB:function(){this.copyLinearToSRGB(this);return this},getHex:function(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(a){void 0===a&&(console.warn("THREE.Color: .getHSL() target is now required"),a={h:0,s:0,l:0});var b=this.r,c=this.g,d=this.b,e=Math.max(b,c,d),f=Math.min(b,c,d),g,h=(f+e)/2;if(f===e)f=g=0;else{var k=e-f;f=.5>=h?k/(e+f):k/(2-e-f);switch(e){case b:g=(c- d)/k+(cMath.abs(g)?(this._x=Math.atan2(-m,e),this._z=Math.atan2(-f,a)):(this._x=Math.atan2(n,k),this._z=0)):"YXZ"===b?(this._x=Math.asin(-d(m,-1,1)),.99999>Math.abs(m)?(this._y=Math.atan2(g,e),this._z=Math.atan2(h,k)):(this._y=Math.atan2(-l,a),this._z=0)):"ZXY"===b?(this._x=Math.asin(d(n,-1,1)),.99999>Math.abs(n)? -(this._y=Math.atan2(-l,e),this._z=Math.atan2(-f,k)):(this._y=0,this._z=Math.atan2(h,a))):"ZYX"===b?(this._y=Math.asin(-d(l,-1,1)),.99999>Math.abs(l)?(this._x=Math.atan2(n,e),this._z=Math.atan2(h,a)):(this._x=0,this._z=Math.atan2(-f,k))):"YZX"===b?(this._z=Math.asin(d(h,-1,1)),.99999>Math.abs(h)?(this._x=Math.atan2(-m,k),this._y=Math.atan2(-l,a)):(this._x=0,this._y=Math.atan2(g,e))):"XZY"===b?(this._z=Math.asin(-d(f,-1,1)),.99999>Math.abs(f)?(this._x=Math.atan2(n,k),this._y=Math.atan2(g,a)):(this._x= -Math.atan2(-m,e),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+b);this._order=b;if(!1!==c)this.onChangeCallback();return this},setFromQuaternion:function(){var a=new J;return function(b,c,d){a.makeRotationFromQuaternion(b);return this.setFromRotationMatrix(a,c,d)}}(),setFromVector3:function(a,b){return this.set(a.x,a.y,a.z,b||this._order)},reorder:function(){var a=new ha;return function(b){a.setFromEuler(this);return this.setFromQuaternion(a,b)}}(),equals:function(a){return a._x=== -this._x&&a._y===this._y&&a._z===this._z&&a._order===this._order},fromArray:function(a){this._x=a[0];this._y=a[1];this._z=a[2];void 0!==a[3]&&(this._order=a[3]);this.onChangeCallback();return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this._x;a[b+1]=this._y;a[b+2]=this._z;a[b+3]=this._order;return a},toVector3:function(a){return a?a.set(this._x,this._y,this._z):new p(this._x,this._y,this._z)},onChange:function(a){this.onChangeCallback=a;return this},onChangeCallback:function(){}}); -Object.assign(Sd.prototype,{set:function(a){this.mask=1<g;g++)if(d[g]===d[(g+1)%3]){a.push(f);break}for(f=a.length-1;0<=f;f--)for(d=a[f],this.faces.splice(d,1),c=0,e=this.faceVertexUvs.length;cthis.opacity&&(d.opacity=this.opacity); -!0===this.transparent&&(d.transparent=this.transparent);d.depthFunc=this.depthFunc;d.depthTest=this.depthTest;d.depthWrite=this.depthWrite;0!==this.rotation&&(d.rotation=this.rotation);!0===this.polygonOffset&&(d.polygonOffset=!0);0!==this.polygonOffsetFactor&&(d.polygonOffsetFactor=this.polygonOffsetFactor);0!==this.polygonOffsetUnits&&(d.polygonOffsetUnits=this.polygonOffsetUnits);1!==this.linewidth&&(d.linewidth=this.linewidth);void 0!==this.dashSize&&(d.dashSize=this.dashSize);void 0!==this.gapSize&& -(d.gapSize=this.gapSize);void 0!==this.scale&&(d.scale=this.scale);!0===this.dithering&&(d.dithering=!0);0a?b.copy(this.origin):b.copy(this.direction).multiplyScalar(a).add(this.origin)},distanceToPoint:function(a){return Math.sqrt(this.distanceSqToPoint(a))},distanceSqToPoint:function(){var a=new p;return function(b){var c=a.subVectors(b,this.origin).dot(this.direction);if(0>c)return this.origin.distanceToSquared(b);a.copy(this.direction).multiplyScalar(c).add(this.origin);return a.distanceToSquared(b)}}(),distanceSqToSegment:function(){var a= -new p,b=new p,c=new p;return function(d,e,f,g){a.copy(d).add(e).multiplyScalar(.5);b.copy(e).sub(d).normalize();c.copy(this.origin).sub(a);var h=.5*d.distanceTo(e),k=-this.direction.dot(b),m=c.dot(this.direction),l=-c.dot(b),n=c.lengthSq(),q=Math.abs(1-k*k);if(0=-p?e<=p?(h=1/q,d*=h,e*=h,k=d*(d+k*e+2*m)+e*(k*d+e+2*l)+n):(e=h,d=Math.max(0,-(k*e+m)),k=-d*d+e*(e+2*l)+n):(e=-h,d=Math.max(0,-(k*e+m)),k=-d*d+e*(e+2*l)+n):e<=-p?(d=Math.max(0,-(-k*h+m)),e=0b)return null; -b=Math.sqrt(b-e);e=d-b;d+=b;return 0>e&&0>d?null:0>e?this.at(d,c):this.at(e,c)}}(),intersectsSphere:function(a){return this.distanceSqToPoint(a.center)<=a.radius*a.radius},distanceToPlane:function(a){var b=a.normal.dot(this.direction);if(0===b)return 0===a.distanceToPoint(this.origin)?0:null;a=-(this.origin.dot(a.normal)+a.constant)/b;return 0<=a?a:null},intersectPlane:function(a,b){a=this.distanceToPlane(a);return null===a?null:this.at(a,b)},intersectsPlane:function(a){var b=a.distanceToPoint(this.origin); -return 0===b||0>a.normal.dot(this.direction)*b?!0:!1},intersectBox:function(a,b){var c=1/this.direction.x;var d=1/this.direction.y;var e=1/this.direction.z,f=this.origin;if(0<=c){var g=(a.min.x-f.x)*c;c*=a.max.x-f.x}else g=(a.max.x-f.x)*c,c*=a.min.x-f.x;if(0<=d){var h=(a.min.y-f.y)*d;d*=a.max.y-f.y}else h=(a.max.y-f.y)*d,d*=a.min.y-f.y;if(g>d||h>c)return null;if(h>g||g!==g)g=h;if(da||h>c)return null; -if(h>g||g!==g)g=h;if(ac?null:this.at(0<=g?g:c,b)},intersectsBox:function(){var a=new p;return function(b){return null!==this.intersectBox(b,a)}}(),intersectTriangle:function(){var a=new p,b=new p,c=new p,d=new p;return function(e,f,g,h,k){b.subVectors(f,e);c.subVectors(g,e);d.crossVectors(b,c);f=this.direction.dot(d);if(0f)h=-1,f=-f;else return null;a.subVectors(this.origin,e);e=h*this.direction.dot(c.crossVectors(a,c));if(0>e)return null; -g=h*this.direction.dot(b.cross(a));if(0>g||e+g>f)return null;e=-h*a.dot(d);return 0>e?null:this.at(e/f,k)}}(),applyMatrix4:function(a){this.origin.applyMatrix4(a);this.direction.transformDirection(a);return this},equals:function(a){return a.origin.equals(this.origin)&&a.direction.equals(this.direction)}});Object.assign(da,{getNormal:function(){var a=new p;return function(b,c,d,e){void 0===e&&(console.warn("THREE.Triangle: .getNormal() target is now required"),e=new p);e.subVectors(d,c);a.subVectors(b, -c);e.cross(a);b=e.lengthSq();return 0=a.x+a.y}}(),getUV:function(){var a=new p;return function(b,c,d,e,f,g,h,k){this.getBarycoord(b,c,d,e,a);k.set(0,0);k.addScaledVector(f,a.x);k.addScaledVector(g,a.y);k.addScaledVector(h,a.z);return k}}()});Object.assign(da.prototype,{set:function(a,b,c){this.a.copy(a);this.b.copy(b);this.c.copy(c);return this},setFromPointsAndIndices:function(a,b,c,d){this.a.copy(a[b]);this.b.copy(a[c]);this.c.copy(a[d]);return this}, -clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.a.copy(a.a);this.b.copy(a.b);this.c.copy(a.c);return this},getArea:function(){var a=new p,b=new p;return function(){a.subVectors(this.c,this.b);b.subVectors(this.a,this.b);return.5*a.cross(b).length()}}(),getMidpoint:function(a){void 0===a&&(console.warn("THREE.Triangle: .getMidpoint() target is now required"),a=new p);return a.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},getNormal:function(a){return da.getNormal(this.a, -this.b,this.c,a)},getPlane:function(a){void 0===a&&(console.warn("THREE.Triangle: .getPlane() target is now required"),a=new p);return a.setFromCoplanarPoints(this.a,this.b,this.c)},getBarycoord:function(a,b){return da.getBarycoord(a,this.a,this.b,this.c,b)},containsPoint:function(a){return da.containsPoint(a,this.a,this.b,this.c)},getUV:function(a,b,c,d,e){return da.getUV(a,this.a,this.b,this.c,b,c,d,e)},intersectsBox:function(a){return a.intersectsTriangle(this)},closestPointToPoint:function(){var a= -new p,b=new p,c=new p,d=new p,e=new p,f=new p;return function(g,h){void 0===h&&(console.warn("THREE.Triangle: .closestPointToPoint() target is now required"),h=new p);var k=this.a,m=this.b,l=this.c;a.subVectors(m,k);b.subVectors(l,k);d.subVectors(g,k);var n=a.dot(d),q=b.dot(d);if(0>=n&&0>=q)return h.copy(k);e.subVectors(g,m);var u=a.dot(e),r=b.dot(e);if(0<=u&&r<=u)return h.copy(m);var v=n*r-u*q;if(0>=v&&0<=n&&0>=u)return m=n/(n-u),h.copy(k).addScaledVector(a,m);f.subVectors(g,l);g=a.dot(f);var y= -b.dot(f);if(0<=y&&g<=y)return h.copy(l);n=g*q-n*y;if(0>=n&&0<=q&&0>=y)return v=q/(q-y),h.copy(k).addScaledVector(b,v);q=u*y-g*r;if(0>=q&&0<=r-u&&0<=g-y)return c.subVectors(l,m),v=(r-u)/(r-u+(g-y)),h.copy(m).addScaledVector(c,v);l=1/(q+n+v);m=n*l;v*=l;return h.copy(k).addScaledVector(a,m).addScaledVector(b,v)}}(),equals:function(a){return a.a.equals(this.a)&&a.b.equals(this.b)&&a.c.equals(this.c)}});ta.prototype=Object.assign(Object.create(B.prototype),{constructor:ta,isMesh:!0,setDrawMode:function(a){this.drawMode= -a},copy:function(a){B.prototype.copy.call(this,a);this.drawMode=a.drawMode;void 0!==a.morphTargetInfluences&&(this.morphTargetInfluences=a.morphTargetInfluences.slice());void 0!==a.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},a.morphTargetDictionary));return this},updateMorphTargets:function(){var a=this.geometry;if(a.isBufferGeometry){a=a.morphAttributes;var b=Object.keys(a);if(0Math.abs(g)?(this._x=Math.atan2(-m,e),this._z=Math.atan2(-f,a)):(this._x=Math.atan2(n,k),this._z= +0)):"YXZ"===b?(this._x=Math.asin(-d(m,-1,1)),.99999>Math.abs(m)?(this._y=Math.atan2(g,e),this._z=Math.atan2(h,k)):(this._y=Math.atan2(-l,a),this._z=0)):"ZXY"===b?(this._x=Math.asin(d(n,-1,1)),.99999>Math.abs(n)?(this._y=Math.atan2(-l,e),this._z=Math.atan2(-f,k)):(this._y=0,this._z=Math.atan2(h,a))):"ZYX"===b?(this._y=Math.asin(-d(l,-1,1)),.99999>Math.abs(l)?(this._x=Math.atan2(n,e),this._z=Math.atan2(h,a)):(this._x=0,this._z=Math.atan2(-f,k))):"YZX"===b?(this._z=Math.asin(d(h,-1,1)),.99999>Math.abs(h)? +(this._x=Math.atan2(-m,k),this._y=Math.atan2(-l,a)):(this._x=0,this._y=Math.atan2(g,e))):"XZY"===b?(this._z=Math.asin(-d(f,-1,1)),.99999>Math.abs(f)?(this._x=Math.atan2(n,k),this._y=Math.atan2(g,a)):(this._x=Math.atan2(-m,e),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+b);this._order=b;if(!1!==c)this.onChangeCallback();return this},setFromQuaternion:function(){var a=new P;return function(b,c,d){a.makeRotationFromQuaternion(b);return this.setFromRotationMatrix(a, +c,d)}}(),setFromVector3:function(a,b){return this.set(a.x,a.y,a.z,b||this._order)},reorder:function(){var a=new ja;return function(b){a.setFromEuler(this);return this.setFromQuaternion(a,b)}}(),equals:function(a){return a._x===this._x&&a._y===this._y&&a._z===this._z&&a._order===this._order},fromArray:function(a){this._x=a[0];this._y=a[1];this._z=a[2];void 0!==a[3]&&(this._order=a[3]);this.onChangeCallback();return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this._x;a[b+1]= +this._y;a[b+2]=this._z;a[b+3]=this._order;return a},toVector3:function(a){return a?a.set(this._x,this._y,this._z):new p(this._x,this._y,this._z)},onChange:function(a){this.onChangeCallback=a;return this},onChangeCallback:function(){}});Object.assign(Xd.prototype,{set:function(a){this.mask=1<g;g++)if(d[g]===d[(g+1)%3]){a.push(f);break}for(f=a.length-1;0<=f;f--)for(d=a[f],this.faces.splice(d,1),c=0,e=this.faceVertexUvs.length;cthis.opacity&&(d.opacity=this.opacity);!0===this.transparent&&(d.transparent=this.transparent);d.depthFunc=this.depthFunc;d.depthTest=this.depthTest;d.depthWrite=this.depthWrite;0!==this.rotation&&(d.rotation=this.rotation);!0===this.polygonOffset&&(d.polygonOffset=!0);0!==this.polygonOffsetFactor&&(d.polygonOffsetFactor=this.polygonOffsetFactor);0!==this.polygonOffsetUnits&&(d.polygonOffsetUnits=this.polygonOffsetUnits);1!==this.linewidth&&(d.linewidth=this.linewidth);void 0!== +this.dashSize&&(d.dashSize=this.dashSize);void 0!==this.gapSize&&(d.gapSize=this.gapSize);void 0!==this.scale&&(d.scale=this.scale);!0===this.dithering&&(d.dithering=!0);0a?b.copy(this.origin):b.copy(this.direction).multiplyScalar(a).add(this.origin)},distanceToPoint:function(a){return Math.sqrt(this.distanceSqToPoint(a))}, +distanceSqToPoint:function(){var a=new p;return function(b){var c=a.subVectors(b,this.origin).dot(this.direction);if(0>c)return this.origin.distanceToSquared(b);a.copy(this.direction).multiplyScalar(c).add(this.origin);return a.distanceToSquared(b)}}(),distanceSqToSegment:function(){var a=new p,b=new p,c=new p;return function(d,e,f,g){a.copy(d).add(e).multiplyScalar(.5);b.copy(e).sub(d).normalize();c.copy(this.origin).sub(a);var h=.5*d.distanceTo(e),k=-this.direction.dot(b),m=c.dot(this.direction), +l=-c.dot(b),n=c.lengthSq(),q=Math.abs(1-k*k);if(0=-p?e<=p?(h=1/q,d*=h,e*=h,k=d*(d+k*e+2*m)+e*(k*d+e+2*l)+n):(e=h,d=Math.max(0,-(k*e+m)),k=-d*d+e*(e+2*l)+n):(e=-h,d=Math.max(0,-(k*e+m)),k=-d*d+e*(e+2*l)+n):e<=-p?(d=Math.max(0,-(-k*h+m)),e=0b)return null;b=Math.sqrt(b-e);e=d-b;d+=b;return 0>e&&0>d?null:0>e?this.at(d,c):this.at(e,c)}}(),intersectsSphere:function(a){return this.distanceSqToPoint(a.center)<=a.radius*a.radius},distanceToPlane:function(a){var b= +a.normal.dot(this.direction);if(0===b)return 0===a.distanceToPoint(this.origin)?0:null;a=-(this.origin.dot(a.normal)+a.constant)/b;return 0<=a?a:null},intersectPlane:function(a,b){a=this.distanceToPlane(a);return null===a?null:this.at(a,b)},intersectsPlane:function(a){var b=a.distanceToPoint(this.origin);return 0===b||0>a.normal.dot(this.direction)*b?!0:!1},intersectBox:function(a,b){var c=1/this.direction.x;var d=1/this.direction.y;var e=1/this.direction.z,f=this.origin;if(0<=c){var g=(a.min.x-f.x)* +c;c*=a.max.x-f.x}else g=(a.max.x-f.x)*c,c*=a.min.x-f.x;if(0<=d){var h=(a.min.y-f.y)*d;d*=a.max.y-f.y}else h=(a.max.y-f.y)*d,d*=a.min.y-f.y;if(g>d||h>c)return null;if(h>g||g!==g)g=h;if(da||h>c)return null;if(h>g||g!==g)g=h;if(ac?null:this.at(0<=g?g:c,b)},intersectsBox:function(){var a=new p;return function(b){return null!==this.intersectBox(b,a)}}(),intersectTriangle:function(){var a= +new p,b=new p,c=new p,d=new p;return function(e,f,g,h,k){b.subVectors(f,e);c.subVectors(g,e);d.crossVectors(b,c);f=this.direction.dot(d);if(0f)h=-1,f=-f;else return null;a.subVectors(this.origin,e);e=h*this.direction.dot(c.crossVectors(a,c));if(0>e)return null;g=h*this.direction.dot(b.cross(a));if(0>g||e+g>f)return null;e=-h*a.dot(d);return 0>e?null:this.at(e/f,k)}}(),applyMatrix4:function(a){this.origin.applyMatrix4(a);this.direction.transformDirection(a);return this}, +equals:function(a){return a.origin.equals(this.origin)&&a.direction.equals(this.direction)}});Object.assign(da,{getNormal:function(){var a=new p;return function(b,c,d,e){void 0===e&&(console.warn("THREE.Triangle: .getNormal() target is now required"),e=new p);e.subVectors(d,c);a.subVectors(b,c);e.cross(a);b=e.lengthSq();return 0=a.x+a.y}}(),getUV:function(){var a=new p;return function(b,c,d,e,f,g,h,k){this.getBarycoord(b,c,d,e,a);k.set(0,0);k.addScaledVector(f, +a.x);k.addScaledVector(g,a.y);k.addScaledVector(h,a.z);return k}}()});Object.assign(da.prototype,{set:function(a,b,c){this.a.copy(a);this.b.copy(b);this.c.copy(c);return this},setFromPointsAndIndices:function(a,b,c,d){this.a.copy(a[b]);this.b.copy(a[c]);this.c.copy(a[d]);return this},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.a.copy(a.a);this.b.copy(a.b);this.c.copy(a.c);return this},getArea:function(){var a=new p,b=new p;return function(){a.subVectors(this.c, +this.b);b.subVectors(this.a,this.b);return.5*a.cross(b).length()}}(),getMidpoint:function(a){void 0===a&&(console.warn("THREE.Triangle: .getMidpoint() target is now required"),a=new p);return a.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},getNormal:function(a){return da.getNormal(this.a,this.b,this.c,a)},getPlane:function(a){void 0===a&&(console.warn("THREE.Triangle: .getPlane() target is now required"),a=new p);return a.setFromCoplanarPoints(this.a,this.b,this.c)},getBarycoord:function(a, +b){return da.getBarycoord(a,this.a,this.b,this.c,b)},containsPoint:function(a){return da.containsPoint(a,this.a,this.b,this.c)},getUV:function(a,b,c,d,e){return da.getUV(a,this.a,this.b,this.c,b,c,d,e)},intersectsBox:function(a){return a.intersectsTriangle(this)},closestPointToPoint:function(){var a=new p,b=new p,c=new p,d=new p,e=new p,f=new p;return function(g,h){void 0===h&&(console.warn("THREE.Triangle: .closestPointToPoint() target is now required"),h=new p);var k=this.a,m=this.b,l=this.c;a.subVectors(m, +k);b.subVectors(l,k);d.subVectors(g,k);var n=a.dot(d),q=b.dot(d);if(0>=n&&0>=q)return h.copy(k);e.subVectors(g,m);var v=a.dot(e),t=b.dot(e);if(0<=v&&t<=v)return h.copy(m);var u=n*t-v*q;if(0>=u&&0<=n&&0>=v)return m=n/(n-v),h.copy(k).addScaledVector(a,m);f.subVectors(g,l);g=a.dot(f);var y=b.dot(f);if(0<=y&&g<=y)return h.copy(l);n=g*q-n*y;if(0>=n&&0<=q&&0>=y)return u=q/(q-y),h.copy(k).addScaledVector(b,u);q=v*y-g*t;if(0>=q&&0<=t-v&&0<=g-y)return c.subVectors(l,m),u=(t-v)/(t-v+(g-y)),h.copy(m).addScaledVector(c, +u);l=1/(q+n+u);m=n*l;u*=l;return h.copy(k).addScaledVector(a,m).addScaledVector(b,u)}}(),equals:function(a){return a.a.equals(this.a)&&a.b.equals(this.b)&&a.c.equals(this.c)}});wa.prototype=Object.create(L.prototype);wa.prototype.constructor=wa;wa.prototype.isMeshBasicMaterial=!0;wa.prototype.copy=function(a){L.prototype.copy.call(this,a);this.color.copy(a.color);this.map=a.map;this.lightMap=a.lightMap;this.lightMapIntensity=a.lightMapIntensity;this.aoMap=a.aoMap;this.aoMapIntensity=a.aoMapIntensity; +this.specularMap=a.specularMap;this.alphaMap=a.alphaMap;this.envMap=a.envMap;this.combine=a.combine;this.reflectivity=a.reflectivity;this.refractionRatio=a.refractionRatio;this.wireframe=a.wireframe;this.wireframeLinewidth=a.wireframeLinewidth;this.wireframeLinecap=a.wireframeLinecap;this.wireframeLinejoin=a.wireframeLinejoin;this.skinning=a.skinning;this.morphTargets=a.morphTargets;return this};ua.prototype=Object.assign(Object.create(C.prototype),{constructor:ua,isMesh:!0,setDrawMode:function(a){this.drawMode= +a},copy:function(a){C.prototype.copy.call(this,a);this.drawMode=a.drawMode;void 0!==a.morphTargetInfluences&&(this.morphTargetInfluences=a.morphTargetInfluences.slice());void 0!==a.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},a.morphTargetDictionary));return this},updateMorphTargets:function(){var a=this.geometry;if(a.isBufferGeometry){a=a.morphAttributes;var b=Object.keys(a);if(0c.far?null:{distance:b,point:v.clone(),object:a}}function b(b,c,d,e,k,m,l,t,p){f.fromBufferAttribute(k,l);g.fromBufferAttribute(k,t);h.fromBufferAttribute(k,p);if(b=a(b,c,d,e,f,g,h,r))m&&(n.fromBufferAttribute(m,l),q.fromBufferAttribute(m,t),u.fromBufferAttribute(m,p),b.uv=da.getUV(r,f,g,h,n,q,u,new z)),m=new Va(l,t,p),da.getNormal(f,g,h,m.normal),b.face=m;return b}var c=new J,d=new ob,e=new Ea,f=new p,g=new p, -h=new p,k=new p,m=new p,l=new p,n=new z,q=new z,u=new z,r=new p,v=new p;return function(t,p){var v=this.geometry,y=this.material,x=this.matrixWorld;if(void 0!==y&&(null===v.boundingSphere&&v.computeBoundingSphere(),e.copy(v.boundingSphere),e.applyMatrix4(x),!1!==t.ray.intersectsSphere(e)&&(c.getInverse(x),d.copy(t.ray).applyMatrix4(c),null===v.boundingBox||!1!==d.intersectsBox(v.boundingBox))))if(v.isBufferGeometry){var A=v.index,B=v.attributes.position,E=v.attributes.uv,I=v.groups;v=v.drawRange; -var H;if(null!==A)if(Array.isArray(y)){var F=0;for(H=I.length;Fe.far||f.push({distance:r,point:b.clone(),uv:da.getUV(b,h,k,m,l,n,q,new z),face:null,object:this})}}(),clone:function(){return(new this.constructor(this.material)).copy(this)},copy:function(a){B.prototype.copy.call(this,a);void 0!==a.center&&this.center.copy(a.center);return this}});Dc.prototype=Object.assign(Object.create(B.prototype),{constructor:Dc, -copy:function(a){B.prototype.copy.call(this,a,!1);a=a.levels;for(var b=0,c=a.length;b=d[e].distance)d[e-1].object.visible=!1,d[e].object.visible=!0;else break;for(;ef||(l.applyMatrix4(this.matrixWorld),v=d.ray.origin.distanceTo(l),vd.far||e.push({distance:v,point:h.clone().applyMatrix4(this.matrixWorld),index:g,face:null,faceIndex:null,object:this}))}}else for(g= -0,r=u.length/3-1;gf||(l.applyMatrix4(this.matrixWorld),v=d.ray.origin.distanceTo(l),vd.far||e.push({distance:v,point:h.clone().applyMatrix4(this.matrixWorld),index:g,face:null,faceIndex:null,object:this}))}else if(g.isGeometry)for(k=g.vertices,m=k.length,g=0;gf||(l.applyMatrix4(this.matrixWorld),v=d.ray.origin.distanceTo(l),vd.far||e.push({distance:v, -point:h.clone().applyMatrix4(this.matrixWorld),index:g,face:null,faceIndex:null,object:this}))}}}(),clone:function(){return(new this.constructor(this.geometry,this.material)).copy(this)}});Z.prototype=Object.assign(Object.create(oa.prototype),{constructor:Z,isLineSegments:!0,computeLineDistances:function(){var a=new p,b=new p;return function(){var c=this.geometry;if(c.isBufferGeometry)if(null===c.index){for(var d=c.attributes.position,e=[],f=0,g=d.count;fd.far||e.push({distance:a,distanceToRay:Math.sqrt(f),point:n.clone(),index:c,face:null,object:g}))}var g=this,h=this.geometry,k=this.matrixWorld,m=d.params.Points.threshold;null===h.boundingSphere&&h.computeBoundingSphere();c.copy(h.boundingSphere);c.applyMatrix4(k);c.radius+=m;if(!1!==d.ray.intersectsSphere(c)){a.getInverse(k);b.copy(d.ray).applyMatrix4(a);m/=(this.scale.x+this.scale.y+this.scale.z)/3;var l=m*m;m=new p;var n=new p;if(h.isBufferGeometry){var q= -h.index;h=h.attributes.position.array;if(null!==q){var u=q.array;q=0;for(var r=u.length;q=a.HAVE_CURRENT_DATA&& -(this.needsUpdate=!0)}});Rb.prototype=Object.create(T.prototype);Rb.prototype.constructor=Rb;Rb.prototype.isCompressedTexture=!0;Fc.prototype=Object.create(T.prototype);Fc.prototype.constructor=Fc;Fc.prototype.isCanvasTexture=!0;Gc.prototype=Object.create(T.prototype);Gc.prototype.constructor=Gc;Gc.prototype.isDepthTexture=!0;Sb.prototype=Object.create(I.prototype);Sb.prototype.constructor=Sb;Hc.prototype=Object.create(M.prototype);Hc.prototype.constructor=Hc;Tb.prototype=Object.create(I.prototype); -Tb.prototype.constructor=Tb;Ic.prototype=Object.create(M.prototype);Ic.prototype.constructor=Ic;la.prototype=Object.create(I.prototype);la.prototype.constructor=la;Jc.prototype=Object.create(M.prototype);Jc.prototype.constructor=Jc;Ub.prototype=Object.create(la.prototype);Ub.prototype.constructor=Ub;Kc.prototype=Object.create(M.prototype);Kc.prototype.constructor=Kc;rb.prototype=Object.create(la.prototype);rb.prototype.constructor=rb;Lc.prototype=Object.create(M.prototype);Lc.prototype.constructor= -Lc;Vb.prototype=Object.create(la.prototype);Vb.prototype.constructor=Vb;Mc.prototype=Object.create(M.prototype);Mc.prototype.constructor=Mc;Wb.prototype=Object.create(la.prototype);Wb.prototype.constructor=Wb;Nc.prototype=Object.create(M.prototype);Nc.prototype.constructor=Nc;Xb.prototype=Object.create(I.prototype);Xb.prototype.constructor=Xb;Oc.prototype=Object.create(M.prototype);Oc.prototype.constructor=Oc;Yb.prototype=Object.create(I.prototype);Yb.prototype.constructor=Yb;Pc.prototype=Object.create(M.prototype); -Pc.prototype.constructor=Pc;Zb.prototype=Object.create(I.prototype);Zb.prototype.constructor=Zb;var Tg={triangulate:function(a,b,c){c=c||2;var d=b&&b.length,e=d?b[0]*c:a.length,f=af(a,0,e,c,!0),g=[];if(!f)return g;var h;if(d){var k=c;d=[];var m;var l=0;for(m=b.length;l80*c){var p=h= -a[0];var r=d=a[1];for(k=c;kh&&(h=l),b>d&&(d=b);h=Math.max(h-p,d-r);h=0!==h?1/h:0}Sc(f,g,c,p,r,h);return g}},Xa={area:function(a){for(var b=a.length,c=0,d=b-1,e=0;eXa.area(a)},triangulateShape:function(a,b){var c=[],d=[],e=[];ef(a);ff(c,a);var f=a.length;b.forEach(ef);for(a=0;aMath.abs(g-k)?[new z(a,1-c),new z(h,1-d),new z(m,1-e),new z(n,1-b)]:[new z(g,1-c),new z(k,1-d),new z(l,1-e),new z(q,1-b)]}};Uc.prototype=Object.create(M.prototype);Uc.prototype.constructor=Uc;$b.prototype=Object.create(Qa.prototype);$b.prototype.constructor= -$b;Vc.prototype=Object.create(M.prototype);Vc.prototype.constructor=Vc;ub.prototype=Object.create(I.prototype);ub.prototype.constructor=ub;Wc.prototype=Object.create(M.prototype);Wc.prototype.constructor=Wc;ac.prototype=Object.create(I.prototype);ac.prototype.constructor=ac;Xc.prototype=Object.create(M.prototype);Xc.prototype.constructor=Xc;bc.prototype=Object.create(I.prototype);bc.prototype.constructor=bc;vb.prototype=Object.create(M.prototype);vb.prototype.constructor=vb;vb.prototype.toJSON=function(){var a= -M.prototype.toJSON.call(this);return hf(this.parameters.shapes,a)};wb.prototype=Object.create(I.prototype);wb.prototype.constructor=wb;wb.prototype.toJSON=function(){var a=I.prototype.toJSON.call(this);return hf(this.parameters.shapes,a)};cc.prototype=Object.create(I.prototype);cc.prototype.constructor=cc;xb.prototype=Object.create(M.prototype);xb.prototype.constructor=xb;Ya.prototype=Object.create(I.prototype);Ya.prototype.constructor=Ya;Yc.prototype=Object.create(xb.prototype);Yc.prototype.constructor= -Yc;Zc.prototype=Object.create(Ya.prototype);Zc.prototype.constructor=Zc;$c.prototype=Object.create(M.prototype);$c.prototype.constructor=$c;dc.prototype=Object.create(I.prototype);dc.prototype.constructor=dc;var za=Object.freeze({WireframeGeometry:Sb,ParametricGeometry:Hc,ParametricBufferGeometry:Tb,TetrahedronGeometry:Jc,TetrahedronBufferGeometry:Ub,OctahedronGeometry:Kc,OctahedronBufferGeometry:rb,IcosahedronGeometry:Lc,IcosahedronBufferGeometry:Vb,DodecahedronGeometry:Mc,DodecahedronBufferGeometry:Wb, -PolyhedronGeometry:Ic,PolyhedronBufferGeometry:la,TubeGeometry:Nc,TubeBufferGeometry:Xb,TorusKnotGeometry:Oc,TorusKnotBufferGeometry:Yb,TorusGeometry:Pc,TorusBufferGeometry:Zb,TextGeometry:Uc,TextBufferGeometry:$b,SphereGeometry:Vc,SphereBufferGeometry:ub,RingGeometry:Wc,RingBufferGeometry:ac,PlaneGeometry:wc,PlaneBufferGeometry:nb,LatheGeometry:Xc,LatheBufferGeometry:bc,ShapeGeometry:vb,ShapeBufferGeometry:wb,ExtrudeGeometry:tb,ExtrudeBufferGeometry:Qa,EdgesGeometry:cc,ConeGeometry:Yc,ConeBufferGeometry:Zc, -CylinderGeometry:xb,CylinderBufferGeometry:Ya,CircleGeometry:$c,CircleBufferGeometry:dc,BoxGeometry:Kb,BoxBufferGeometry:mb});yb.prototype=Object.create(H.prototype);yb.prototype.constructor=yb;yb.prototype.isShadowMaterial=!0;yb.prototype.copy=function(a){H.prototype.copy.call(this,a);this.color.copy(a.color);return this};ec.prototype=Object.create(ua.prototype);ec.prototype.constructor=ec;ec.prototype.isRawShaderMaterial=!0;Ra.prototype=Object.create(H.prototype);Ra.prototype.constructor=Ra;Ra.prototype.isMeshStandardMaterial= -!0;Ra.prototype.copy=function(a){H.prototype.copy.call(this,a);this.defines={STANDARD:""};this.color.copy(a.color);this.roughness=a.roughness;this.metalness=a.metalness;this.map=a.map;this.lightMap=a.lightMap;this.lightMapIntensity=a.lightMapIntensity;this.aoMap=a.aoMap;this.aoMapIntensity=a.aoMapIntensity;this.emissive.copy(a.emissive);this.emissiveMap=a.emissiveMap;this.emissiveIntensity=a.emissiveIntensity;this.bumpMap=a.bumpMap;this.bumpScale=a.bumpScale;this.normalMap=a.normalMap;this.normalMapType= -a.normalMapType;this.normalScale.copy(a.normalScale);this.displacementMap=a.displacementMap;this.displacementScale=a.displacementScale;this.displacementBias=a.displacementBias;this.roughnessMap=a.roughnessMap;this.metalnessMap=a.metalnessMap;this.alphaMap=a.alphaMap;this.envMap=a.envMap;this.envMapIntensity=a.envMapIntensity;this.refractionRatio=a.refractionRatio;this.wireframe=a.wireframe;this.wireframeLinewidth=a.wireframeLinewidth;this.wireframeLinecap=a.wireframeLinecap;this.wireframeLinejoin= -a.wireframeLinejoin;this.skinning=a.skinning;this.morphTargets=a.morphTargets;this.morphNormals=a.morphNormals;return this};zb.prototype=Object.create(Ra.prototype);zb.prototype.constructor=zb;zb.prototype.isMeshPhysicalMaterial=!0;zb.prototype.copy=function(a){Ra.prototype.copy.call(this,a);this.defines={PHYSICAL:""};this.reflectivity=a.reflectivity;this.clearCoat=a.clearCoat;this.clearCoatRoughness=a.clearCoatRoughness;return this};Ga.prototype=Object.create(H.prototype);Ga.prototype.constructor= -Ga;Ga.prototype.isMeshPhongMaterial=!0;Ga.prototype.copy=function(a){H.prototype.copy.call(this,a);this.color.copy(a.color);this.specular.copy(a.specular);this.shininess=a.shininess;this.map=a.map;this.lightMap=a.lightMap;this.lightMapIntensity=a.lightMapIntensity;this.aoMap=a.aoMap;this.aoMapIntensity=a.aoMapIntensity;this.emissive.copy(a.emissive);this.emissiveMap=a.emissiveMap;this.emissiveIntensity=a.emissiveIntensity;this.bumpMap=a.bumpMap;this.bumpScale=a.bumpScale;this.normalMap=a.normalMap; -this.normalMapType=a.normalMapType;this.normalScale.copy(a.normalScale);this.displacementMap=a.displacementMap;this.displacementScale=a.displacementScale;this.displacementBias=a.displacementBias;this.specularMap=a.specularMap;this.alphaMap=a.alphaMap;this.envMap=a.envMap;this.combine=a.combine;this.reflectivity=a.reflectivity;this.refractionRatio=a.refractionRatio;this.wireframe=a.wireframe;this.wireframeLinewidth=a.wireframeLinewidth;this.wireframeLinecap=a.wireframeLinecap;this.wireframeLinejoin= -a.wireframeLinejoin;this.skinning=a.skinning;this.morphTargets=a.morphTargets;this.morphNormals=a.morphNormals;return this};Ab.prototype=Object.create(Ga.prototype);Ab.prototype.constructor=Ab;Ab.prototype.isMeshToonMaterial=!0;Ab.prototype.copy=function(a){Ga.prototype.copy.call(this,a);this.gradientMap=a.gradientMap;return this};Bb.prototype=Object.create(H.prototype);Bb.prototype.constructor=Bb;Bb.prototype.isMeshNormalMaterial=!0;Bb.prototype.copy=function(a){H.prototype.copy.call(this,a);this.bumpMap= -a.bumpMap;this.bumpScale=a.bumpScale;this.normalMap=a.normalMap;this.normalMapType=a.normalMapType;this.normalScale.copy(a.normalScale);this.displacementMap=a.displacementMap;this.displacementScale=a.displacementScale;this.displacementBias=a.displacementBias;this.wireframe=a.wireframe;this.wireframeLinewidth=a.wireframeLinewidth;this.skinning=a.skinning;this.morphTargets=a.morphTargets;this.morphNormals=a.morphNormals;return this};Cb.prototype=Object.create(H.prototype);Cb.prototype.constructor=Cb; -Cb.prototype.isMeshLambertMaterial=!0;Cb.prototype.copy=function(a){H.prototype.copy.call(this,a);this.color.copy(a.color);this.map=a.map;this.lightMap=a.lightMap;this.lightMapIntensity=a.lightMapIntensity;this.aoMap=a.aoMap;this.aoMapIntensity=a.aoMapIntensity;this.emissive.copy(a.emissive);this.emissiveMap=a.emissiveMap;this.emissiveIntensity=a.emissiveIntensity;this.specularMap=a.specularMap;this.alphaMap=a.alphaMap;this.envMap=a.envMap;this.combine=a.combine;this.reflectivity=a.reflectivity;this.refractionRatio= -a.refractionRatio;this.wireframe=a.wireframe;this.wireframeLinewidth=a.wireframeLinewidth;this.wireframeLinecap=a.wireframeLinecap;this.wireframeLinejoin=a.wireframeLinejoin;this.skinning=a.skinning;this.morphTargets=a.morphTargets;this.morphNormals=a.morphNormals;return this};Db.prototype=Object.create(V.prototype);Db.prototype.constructor=Db;Db.prototype.isLineDashedMaterial=!0;Db.prototype.copy=function(a){V.prototype.copy.call(this,a);this.scale=a.scale;this.dashSize=a.dashSize;this.gapSize=a.gapSize; -return this};var Ug=Object.freeze({ShadowMaterial:yb,SpriteMaterial:eb,RawShaderMaterial:ec,ShaderMaterial:ua,PointsMaterial:Fa,MeshPhysicalMaterial:zb,MeshStandardMaterial:Ra,MeshPhongMaterial:Ga,MeshToonMaterial:Ab,MeshNormalMaterial:Bb,MeshLambertMaterial:Cb,MeshDepthMaterial:ab,MeshDistanceMaterial:bb,MeshBasicMaterial:ka,LineDashedMaterial:Db,LineBasicMaterial:V,Material:H}),Hb={enabled:!1,files:{},add:function(a,b){!1!==this.enabled&&(this.files[a]=b)},get:function(a){if(!1!==this.enabled)return this.files[a]}, -remove:function(a){delete this.files[a]},clear:function(){this.files={}}},wa=new be,Na={};Object.assign(Ha.prototype,{load:function(a,b,c,d){void 0===a&&(a="");void 0!==this.path&&(a=this.path+a);a=this.manager.resolveURL(a);var e=this,f=Hb.get(a);if(void 0!==f)return e.manager.itemStart(a),setTimeout(function(){b&&b(f);e.manager.itemEnd(a)},0),f;if(void 0!==Na[a])Na[a].push({onLoad:b,onProgress:c,onError:d});else{var g=a.match(/^data:(.*?)(;base64)?,(.*)$/);if(g){c=g[1];var h=!!g[2];g=g[3];g=window.decodeURIComponent(g); -h&&(g=window.atob(g));try{var k=(this.responseType||"").toLowerCase();switch(k){case "arraybuffer":case "blob":var m=new Uint8Array(g.length);for(h=0;hg)e=a+1;else if(0b&&(b=0);1Number.EPSILON&&(g.normalize(),c=Math.acos(K.clamp(d[k-1].dot(d[k]),-1,1)),e[k].applyMatrix4(h.makeRotationAxis(g,c))),f[k].crossVectors(d[k],e[k]);if(!0===b)for(c=Math.acos(K.clamp(e[0].dot(e[a]),-1,1)),c/=a,0d;)d+=c;for(;d>c;)d-=c;de&&(e=1);1E-4>d&&(d=e);1E-4>k&&(k=e);ze.initNonuniformCatmullRom(f.x,g.x,h.x,c.x,d,e,k);Ae.initNonuniformCatmullRom(f.y,g.y,h.y,c.y,d,e,k);Be.initNonuniformCatmullRom(f.z,g.z,h.z,c.z,d,e,k)}else"catmullrom"===this.curveType&&(ze.initCatmullRom(f.x,g.x,h.x,c.x,this.tension),Ae.initCatmullRom(f.y,g.y,h.y,c.y,this.tension),Be.initCatmullRom(f.z,g.z,h.z,c.z,this.tension));b.set(ze.calc(a), -Ae.calc(a),Be.calc(a));return b};ja.prototype.copy=function(a){L.prototype.copy.call(this,a);this.points=[];for(var b=0,c=a.points.length;bc.length-2?c.length-1:a+1];c=c[a>c.length-3?c.length-1:a+2];b.set(kf(d,e.x,f.x,g.x,c.x),kf(d,e.y,f.y,g.y,c.y));return b};La.prototype.copy=function(a){L.prototype.copy.call(this,a);this.points=[];for(var b=0,c=a.points.length;b=b)return b=c[a]-b,a=this.curves[a],c=a.getLength(),a.getPointAt(0===c?0:1-b/c);a++}return null},getLength:function(){var a=this.getCurveLengths(); -return a[a.length-1]},updateArcLengths:function(){this.needsUpdate=!0;this.cacheLengths=null;this.getCurveLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var a=[],b=0,c=0,d=this.curves.length;c=e)break a;else{f=b[1];a=e)break b}d=c;c= -0}}for(;c>>1,ab;)--f;++f;if(0!==e||f!==d)e>=f&&(f=Math.max(f,1),e=f-1),a=this.getValueSize(),this.times=qa.arraySlice(c,e,f),this.values=qa.arraySlice(this.values,e*a,f*a);return this},validate:function(){var a= -!0,b=this.getValueSize();0!==b-Math.floor(b)&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),a=!1);var c=this.times;b=this.values;var d=c.length;0===d&&(console.error("THREE.KeyframeTrack: Track is empty.",this),a=!1);for(var e=null,f=0;f!==d;f++){var g=c[f];if("number"===typeof g&&isNaN(g)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,f,g);a=!1;break}if(null!==e&&e>g){console.error("THREE.KeyframeTrack: Out of order keys.",this,f,g,e);a=!1;break}e= -g}if(void 0!==b&&qa.isTypedArray(b))for(f=0,c=b.length;f!==c;++f)if(d=b[f],isNaN(d)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,f,d);a=!1;break}return a},optimize:function(){for(var a=this.times,b=this.values,c=this.getValueSize(),d=2302===this.getInterpolation(),e=1,f=a.length-1,g=1;gm.opacity&&(m.transparent=!0);d.setTextures(k);return d.parse(m)}}()});var Ce={decodeText:function(a){if("undefined"!==typeof TextDecoder)return(new TextDecoder).decode(a);for(var b="",c=0,d=a.length;cf;f++){var D=h[u++];var B=A[2*D];D=A[2*D+1];B=new z(B,D);2!==f&&c.faceVertexUvs[e][v].push(B);0!==f&&c.faceVertexUvs[e][v+1].push(B)}}y&&(y=3*h[u++],r.normal.set(m[y++],m[y++],m[y]),w.normal.copy(r.normal));if(x)for(e=0;4>e;e++)y=3*h[u++],x=new p(m[y++], -m[y++],m[y]),2!==e&&r.vertexNormals.push(x),0!==e&&w.vertexNormals.push(x);n&&(n=h[u++],n=l[n],r.color.setHex(n),w.color.setHex(n));if(k)for(e=0;4>e;e++)n=h[u++],n=l[n],2!==e&&r.vertexColors.push(new F(n)),0!==e&&w.vertexColors.push(new F(n));c.faces.push(r);c.faces.push(w)}else{r=new Va;r.a=h[u++];r.b=h[u++];r.c=h[u++];v&&(v=h[u++],r.materialIndex=v);v=c.faces.length;if(e)for(e=0;ef;f++)D=h[u++],B=A[2*D],D=A[2*D+1],B=new z(B,D),c.faceVertexUvs[e][v].push(B); -y&&(y=3*h[u++],r.normal.set(m[y++],m[y++],m[y]));if(x)for(e=0;3>e;e++)y=3*h[u++],x=new p(m[y++],m[y++],m[y]),r.vertexNormals.push(x);n&&(n=h[u++],r.color.setHex(l[n]));if(k)for(e=0;3>e;e++)n=h[u++],r.vertexColors.push(new F(l[n]));c.faces.push(r)}}d=a;u=void 0!==d.influencesPerVertex?d.influencesPerVertex:2;if(d.skinWeights)for(g=0,h=d.skinWeights.length;gc.far?null:{distance:b,point:u.clone(),object:a}}function b(b,c,d,e,k,m,l,r,p){f.fromBufferAttribute(k,l);g.fromBufferAttribute(k,r);h.fromBufferAttribute(k,p);if(b=a(b,c,d,e,f,g,h,t))m&&(n.fromBufferAttribute(m,l),q.fromBufferAttribute(m,r),v.fromBufferAttribute(m,p),b.uv=da.getUV(t,f,g,h,n,q,v,new A)),m=new Xa(l,r,p),da.getNormal(f,g,h,m.normal),b.face=m;return b}var c=new P,d=new pb,e=new Fa,f=new p,g=new p, +h=new p,k=new p,m=new p,l=new p,n=new A,q=new A,v=new A,t=new p,u=new p;return function(r,p){var u=this.geometry,y=this.material,x=this.matrixWorld;if(void 0!==y&&(null===u.boundingSphere&&u.computeBoundingSphere(),e.copy(u.boundingSphere),e.applyMatrix4(x),!1!==r.ray.intersectsSphere(e)&&(c.getInverse(x),d.copy(r.ray).applyMatrix4(c),null===u.boundingBox||!1!==d.intersectsBox(u.boundingBox))))if(u.isBufferGeometry){var z=u.index,C=u.attributes.position,B=u.attributes.uv,F=u.groups;u=u.drawRange; +var I;if(null!==z)if(Array.isArray(y)){var G=0;for(I=F.length;Ge.far||f.push({distance:t,point:b.clone(),uv:da.getUV(b, +h,k,m,l,n,q,new A),face:null,object:this})}}(),clone:function(){return(new this.constructor(this.material)).copy(this)},copy:function(a){C.prototype.copy.call(this,a);void 0!==a.center&&this.center.copy(a.center);return this}});Fc.prototype=Object.assign(Object.create(C.prototype),{constructor:Fc,copy:function(a){C.prototype.copy.call(this,a,!1);a=a.levels;for(var b=0,c=a.length;b=d[e].distance)d[e-1].object.visible=!1,d[e].object.visible=!0;else break;for(;ef||(l.applyMatrix4(this.matrixWorld),u=d.ray.origin.distanceTo(l),ud.far||e.push({distance:u,point:h.clone().applyMatrix4(this.matrixWorld),index:g,face:null,faceIndex:null,object:this}))}}else for(g=0,t=v.length/3-1;gf||(l.applyMatrix4(this.matrixWorld),u=d.ray.origin.distanceTo(l),ud.far||e.push({distance:u,point:h.clone().applyMatrix4(this.matrixWorld),index:g,face:null,faceIndex:null,object:this}))}else if(g.isGeometry)for(k=g.vertices,m=k.length,g=0;gf||(l.applyMatrix4(this.matrixWorld),u=d.ray.origin.distanceTo(l),ud.far||e.push({distance:u,point:h.clone().applyMatrix4(this.matrixWorld), +index:g,face:null,faceIndex:null,object:this}))}}}(),clone:function(){return(new this.constructor(this.geometry,this.material)).copy(this)}});W.prototype=Object.assign(Object.create(pa.prototype),{constructor:W,isLineSegments:!0,computeLineDistances:function(){var a=new p,b=new p;return function(){var c=this.geometry;if(c.isBufferGeometry)if(null===c.index){for(var d=c.attributes.position,e=[],f=0,g=d.count;fd.far||e.push({distance:a,distanceToRay:Math.sqrt(f),point:n.clone(),index:c,face:null,object:g}))}var g=this,h=this.geometry,k=this.matrixWorld,m=d.params.Points.threshold;null===h.boundingSphere&&h.computeBoundingSphere();c.copy(h.boundingSphere);c.applyMatrix4(k);c.radius+=m;if(!1!==d.ray.intersectsSphere(c)){a.getInverse(k);b.copy(d.ray).applyMatrix4(a);m/=(this.scale.x+this.scale.y+this.scale.z)/3;var l=m*m;m=new p;var n=new p;if(h.isBufferGeometry){var q=h.index;h=h.attributes.position.array; +if(null!==q){var v=q.array;q=0;for(var t=v.length;q=a.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}});Tb.prototype= +Object.create(Q.prototype);Tb.prototype.constructor=Tb;Tb.prototype.isCompressedTexture=!0;Hc.prototype=Object.create(Q.prototype);Hc.prototype.constructor=Hc;Hc.prototype.isCanvasTexture=!0;Ic.prototype=Object.create(Q.prototype);Ic.prototype.constructor=Ic;Ic.prototype.isDepthTexture=!0;Ub.prototype=Object.create(F.prototype);Ub.prototype.constructor=Ub;Jc.prototype=Object.create(M.prototype);Jc.prototype.constructor=Jc;Vb.prototype=Object.create(F.prototype);Vb.prototype.constructor=Vb;Kc.prototype= +Object.create(M.prototype);Kc.prototype.constructor=Kc;ma.prototype=Object.create(F.prototype);ma.prototype.constructor=ma;Lc.prototype=Object.create(M.prototype);Lc.prototype.constructor=Lc;Wb.prototype=Object.create(ma.prototype);Wb.prototype.constructor=Wb;Mc.prototype=Object.create(M.prototype);Mc.prototype.constructor=Mc;rb.prototype=Object.create(ma.prototype);rb.prototype.constructor=rb;Nc.prototype=Object.create(M.prototype);Nc.prototype.constructor=Nc;Xb.prototype=Object.create(ma.prototype); +Xb.prototype.constructor=Xb;Oc.prototype=Object.create(M.prototype);Oc.prototype.constructor=Oc;Yb.prototype=Object.create(ma.prototype);Yb.prototype.constructor=Yb;Pc.prototype=Object.create(M.prototype);Pc.prototype.constructor=Pc;Zb.prototype=Object.create(F.prototype);Zb.prototype.constructor=Zb;Qc.prototype=Object.create(M.prototype);Qc.prototype.constructor=Qc;$b.prototype=Object.create(F.prototype);$b.prototype.constructor=$b;Rc.prototype=Object.create(M.prototype);Rc.prototype.constructor= +Rc;ac.prototype=Object.create(F.prototype);ac.prototype.constructor=ac;var Xg={triangulate:function(a,b,c){c=c||2;var d=b&&b.length,e=d?b[0]*c:a.length,f=df(a,0,e,c,!0),g=[];if(!f)return g;var h;if(d){var k=c;d=[];var m;var l=0;for(m=b.length;l80*c){var p=h=a[0];var t=d=a[1];for(k= +c;kh&&(h=l),b>d&&(d=b);h=Math.max(h-p,d-t);h=0!==h?1/h:0}Uc(f,g,c,p,t,h);return g}},Za={area:function(a){for(var b=a.length,c=0,d=b-1,e=0;eZa.area(a)},triangulateShape:function(a,b){var c=[],d=[],e=[];hf(a);jf(c,a);var f=a.length;b.forEach(hf);for(a=0;aMath.abs(g-k)?[new A(a,1-c),new A(h,1-d),new A(m,1-e),new A(n,1-b)]:[new A(g,1-c),new A(k,1-d),new A(l,1-e),new A(q,1-b)]}};Wc.prototype=Object.create(M.prototype);Wc.prototype.constructor=Wc;bc.prototype=Object.create(Sa.prototype);bc.prototype.constructor=bc;Xc.prototype= +Object.create(M.prototype);Xc.prototype.constructor=Xc;ub.prototype=Object.create(F.prototype);ub.prototype.constructor=ub;Yc.prototype=Object.create(M.prototype);Yc.prototype.constructor=Yc;cc.prototype=Object.create(F.prototype);cc.prototype.constructor=cc;Zc.prototype=Object.create(M.prototype);Zc.prototype.constructor=Zc;dc.prototype=Object.create(F.prototype);dc.prototype.constructor=dc;vb.prototype=Object.create(M.prototype);vb.prototype.constructor=vb;vb.prototype.toJSON=function(){var a=M.prototype.toJSON.call(this); +return lf(this.parameters.shapes,a)};wb.prototype=Object.create(F.prototype);wb.prototype.constructor=wb;wb.prototype.toJSON=function(){var a=F.prototype.toJSON.call(this);return lf(this.parameters.shapes,a)};ec.prototype=Object.create(F.prototype);ec.prototype.constructor=ec;xb.prototype=Object.create(M.prototype);xb.prototype.constructor=xb;$a.prototype=Object.create(F.prototype);$a.prototype.constructor=$a;$c.prototype=Object.create(xb.prototype);$c.prototype.constructor=$c;ad.prototype=Object.create($a.prototype); +ad.prototype.constructor=ad;bd.prototype=Object.create(M.prototype);bd.prototype.constructor=bd;fc.prototype=Object.create(F.prototype);fc.prototype.constructor=fc;var Ba=Object.freeze({WireframeGeometry:Ub,ParametricGeometry:Jc,ParametricBufferGeometry:Vb,TetrahedronGeometry:Lc,TetrahedronBufferGeometry:Wb,OctahedronGeometry:Mc,OctahedronBufferGeometry:rb,IcosahedronGeometry:Nc,IcosahedronBufferGeometry:Xb,DodecahedronGeometry:Oc,DodecahedronBufferGeometry:Yb,PolyhedronGeometry:Kc,PolyhedronBufferGeometry:ma, +TubeGeometry:Pc,TubeBufferGeometry:Zb,TorusKnotGeometry:Qc,TorusKnotBufferGeometry:$b,TorusGeometry:Rc,TorusBufferGeometry:ac,TextGeometry:Wc,TextBufferGeometry:bc,SphereGeometry:Xc,SphereBufferGeometry:ub,RingGeometry:Yc,RingBufferGeometry:cc,PlaneGeometry:yc,PlaneBufferGeometry:ob,LatheGeometry:Zc,LatheBufferGeometry:dc,ShapeGeometry:vb,ShapeBufferGeometry:wb,ExtrudeGeometry:tb,ExtrudeBufferGeometry:Sa,EdgesGeometry:ec,ConeGeometry:$c,ConeBufferGeometry:ad,CylinderGeometry:xb,CylinderBufferGeometry:$a, +CircleGeometry:bd,CircleBufferGeometry:fc,BoxGeometry:Kb,BoxBufferGeometry:nb});yb.prototype=Object.create(L.prototype);yb.prototype.constructor=yb;yb.prototype.isShadowMaterial=!0;yb.prototype.copy=function(a){L.prototype.copy.call(this,a);this.color.copy(a.color);return this};gc.prototype=Object.create(ka.prototype);gc.prototype.constructor=gc;gc.prototype.isRawShaderMaterial=!0;Ta.prototype=Object.create(L.prototype);Ta.prototype.constructor=Ta;Ta.prototype.isMeshStandardMaterial=!0;Ta.prototype.copy= +function(a){L.prototype.copy.call(this,a);this.defines={STANDARD:""};this.color.copy(a.color);this.roughness=a.roughness;this.metalness=a.metalness;this.map=a.map;this.lightMap=a.lightMap;this.lightMapIntensity=a.lightMapIntensity;this.aoMap=a.aoMap;this.aoMapIntensity=a.aoMapIntensity;this.emissive.copy(a.emissive);this.emissiveMap=a.emissiveMap;this.emissiveIntensity=a.emissiveIntensity;this.bumpMap=a.bumpMap;this.bumpScale=a.bumpScale;this.normalMap=a.normalMap;this.normalMapType=a.normalMapType; +this.normalScale.copy(a.normalScale);this.displacementMap=a.displacementMap;this.displacementScale=a.displacementScale;this.displacementBias=a.displacementBias;this.roughnessMap=a.roughnessMap;this.metalnessMap=a.metalnessMap;this.alphaMap=a.alphaMap;this.envMap=a.envMap;this.envMapIntensity=a.envMapIntensity;this.refractionRatio=a.refractionRatio;this.wireframe=a.wireframe;this.wireframeLinewidth=a.wireframeLinewidth;this.wireframeLinecap=a.wireframeLinecap;this.wireframeLinejoin=a.wireframeLinejoin; +this.skinning=a.skinning;this.morphTargets=a.morphTargets;this.morphNormals=a.morphNormals;return this};zb.prototype=Object.create(Ta.prototype);zb.prototype.constructor=zb;zb.prototype.isMeshPhysicalMaterial=!0;zb.prototype.copy=function(a){Ta.prototype.copy.call(this,a);this.defines={PHYSICAL:""};this.reflectivity=a.reflectivity;this.clearCoat=a.clearCoat;this.clearCoatRoughness=a.clearCoatRoughness;return this};Ha.prototype=Object.create(L.prototype);Ha.prototype.constructor=Ha;Ha.prototype.isMeshPhongMaterial= +!0;Ha.prototype.copy=function(a){L.prototype.copy.call(this,a);this.color.copy(a.color);this.specular.copy(a.specular);this.shininess=a.shininess;this.map=a.map;this.lightMap=a.lightMap;this.lightMapIntensity=a.lightMapIntensity;this.aoMap=a.aoMap;this.aoMapIntensity=a.aoMapIntensity;this.emissive.copy(a.emissive);this.emissiveMap=a.emissiveMap;this.emissiveIntensity=a.emissiveIntensity;this.bumpMap=a.bumpMap;this.bumpScale=a.bumpScale;this.normalMap=a.normalMap;this.normalMapType=a.normalMapType; +this.normalScale.copy(a.normalScale);this.displacementMap=a.displacementMap;this.displacementScale=a.displacementScale;this.displacementBias=a.displacementBias;this.specularMap=a.specularMap;this.alphaMap=a.alphaMap;this.envMap=a.envMap;this.combine=a.combine;this.reflectivity=a.reflectivity;this.refractionRatio=a.refractionRatio;this.wireframe=a.wireframe;this.wireframeLinewidth=a.wireframeLinewidth;this.wireframeLinecap=a.wireframeLinecap;this.wireframeLinejoin=a.wireframeLinejoin;this.skinning= +a.skinning;this.morphTargets=a.morphTargets;this.morphNormals=a.morphNormals;return this};Ab.prototype=Object.create(Ha.prototype);Ab.prototype.constructor=Ab;Ab.prototype.isMeshToonMaterial=!0;Ab.prototype.copy=function(a){Ha.prototype.copy.call(this,a);this.gradientMap=a.gradientMap;return this};Bb.prototype=Object.create(L.prototype);Bb.prototype.constructor=Bb;Bb.prototype.isMeshNormalMaterial=!0;Bb.prototype.copy=function(a){L.prototype.copy.call(this,a);this.bumpMap=a.bumpMap;this.bumpScale= +a.bumpScale;this.normalMap=a.normalMap;this.normalMapType=a.normalMapType;this.normalScale.copy(a.normalScale);this.displacementMap=a.displacementMap;this.displacementScale=a.displacementScale;this.displacementBias=a.displacementBias;this.wireframe=a.wireframe;this.wireframeLinewidth=a.wireframeLinewidth;this.skinning=a.skinning;this.morphTargets=a.morphTargets;this.morphNormals=a.morphNormals;return this};Cb.prototype=Object.create(L.prototype);Cb.prototype.constructor=Cb;Cb.prototype.isMeshLambertMaterial= +!0;Cb.prototype.copy=function(a){L.prototype.copy.call(this,a);this.color.copy(a.color);this.map=a.map;this.lightMap=a.lightMap;this.lightMapIntensity=a.lightMapIntensity;this.aoMap=a.aoMap;this.aoMapIntensity=a.aoMapIntensity;this.emissive.copy(a.emissive);this.emissiveMap=a.emissiveMap;this.emissiveIntensity=a.emissiveIntensity;this.specularMap=a.specularMap;this.alphaMap=a.alphaMap;this.envMap=a.envMap;this.combine=a.combine;this.reflectivity=a.reflectivity;this.refractionRatio=a.refractionRatio; +this.wireframe=a.wireframe;this.wireframeLinewidth=a.wireframeLinewidth;this.wireframeLinecap=a.wireframeLinecap;this.wireframeLinejoin=a.wireframeLinejoin;this.skinning=a.skinning;this.morphTargets=a.morphTargets;this.morphNormals=a.morphNormals;return this};Db.prototype=Object.create(L.prototype);Db.prototype.constructor=Db;Db.prototype.isMeshMatcapMaterial=!0;Db.prototype.copy=function(a){L.prototype.copy.call(this,a);this.defines={MATCAP:""};this.color.copy(a.color);this.matcap=a.matcap;this.map= +a.map;this.bumpMap=a.bumpMap;this.bumpScale=a.bumpScale;this.normalMap=a.normalMap;this.normalMapType=a.normalMapType;this.normalScale.copy(a.normalScale);this.displacementMap=a.displacementMap;this.displacementScale=a.displacementScale;this.displacementBias=a.displacementBias;this.alphaMap=a.alphaMap;this.skinning=a.skinning;this.morphTargets=a.morphTargets;this.morphNormals=a.morphNormals;return this};Eb.prototype=Object.create(T.prototype);Eb.prototype.constructor=Eb;Eb.prototype.isLineDashedMaterial= +!0;Eb.prototype.copy=function(a){T.prototype.copy.call(this,a);this.scale=a.scale;this.dashSize=a.dashSize;this.gapSize=a.gapSize;return this};var Yg=Object.freeze({ShadowMaterial:yb,SpriteMaterial:fb,RawShaderMaterial:gc,ShaderMaterial:ka,PointsMaterial:Ga,MeshPhysicalMaterial:zb,MeshStandardMaterial:Ta,MeshPhongMaterial:Ha,MeshToonMaterial:Ab,MeshNormalMaterial:Bb,MeshLambertMaterial:Cb,MeshDepthMaterial:cb,MeshDistanceMaterial:db,MeshBasicMaterial:wa,MeshMatcapMaterial:Db,LineDashedMaterial:Eb, +LineBasicMaterial:T,Material:L}),Ib={enabled:!1,files:{},add:function(a,b){!1!==this.enabled&&(this.files[a]=b)},get:function(a){if(!1!==this.enabled)return this.files[a]},remove:function(a){delete this.files[a]},clear:function(){this.files={}}},ya=new fe,Oa={};Object.assign(Ia.prototype,{load:function(a,b,c,d){void 0===a&&(a="");void 0!==this.path&&(a=this.path+a);a=this.manager.resolveURL(a);var e=this,f=Ib.get(a);if(void 0!==f)return e.manager.itemStart(a),setTimeout(function(){b&&b(f);e.manager.itemEnd(a)}, +0),f;if(void 0!==Oa[a])Oa[a].push({onLoad:b,onProgress:c,onError:d});else{var g=a.match(/^data:(.*?)(;base64)?,(.*)$/);if(g){c=g[1];var h=!!g[2];g=g[3];g=window.decodeURIComponent(g);h&&(g=window.atob(g));try{var k=(this.responseType||"").toLowerCase();switch(k){case "arraybuffer":case "blob":var m=new Uint8Array(g.length);for(h=0;hg)e=a+1;else if(0b&&(b=0);1Number.EPSILON&&(g.normalize(), +c=Math.acos(S.clamp(d[k-1].dot(d[k]),-1,1)),e[k].applyMatrix4(h.makeRotationAxis(g,c))),f[k].crossVectors(d[k],e[k]);if(!0===b)for(c=Math.acos(S.clamp(e[0].dot(e[a]),-1,1)),c/=a,0d;)d+=c;for(;d>c;)d-=c;de&&(e=1);1E-4>d&&(d=e);1E-4>k&&(k=e);Ce.initNonuniformCatmullRom(f.x,g.x,h.x, +c.x,d,e,k);De.initNonuniformCatmullRom(f.y,g.y,h.y,c.y,d,e,k);Ee.initNonuniformCatmullRom(f.z,g.z,h.z,c.z,d,e,k)}else"catmullrom"===this.curveType&&(Ce.initCatmullRom(f.x,g.x,h.x,c.x,this.tension),De.initCatmullRom(f.y,g.y,h.y,c.y,this.tension),Ee.initCatmullRom(f.z,g.z,h.z,c.z,this.tension));b.set(Ce.calc(a),De.calc(a),Ee.calc(a));return b};ha.prototype.copy=function(a){N.prototype.copy.call(this,a);this.points=[];for(var b=0,c=a.points.length;bc.length- +2?c.length-1:a+1];c=c[a>c.length-3?c.length-1:a+2];b.set(nf(d,e.x,f.x,g.x,c.x),nf(d,e.y,f.y,g.y,c.y));return b};Ma.prototype.copy=function(a){N.prototype.copy.call(this,a);this.points=[];for(var b=0,c=a.points.length;b=b)return b=c[a]-b,a=this.curves[a],c=a.getLength(),a.getPointAt(0===c?0:1-b/c);a++}return null},getLength:function(){var a=this.getCurveLengths();return a[a.length-1]},updateArcLengths:function(){this.needsUpdate=!0;this.cacheLengths=null;this.getCurveLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths; +for(var a=[],b=0,c=0,d=this.curves.length;c=e)break a;else{f=b[1];a=e)break b}d=c;c=0}}for(;c>>1,ab;)--f;++f;if(0!==e||f!==d)e>=f&&(f=Math.max(f,1),e=f-1),a=this.getValueSize(),this.times=ra.arraySlice(c,e,f),this.values=ra.arraySlice(this.values,e*a,f*a);return this},validate:function(){var a=!0,b=this.getValueSize();0!==b-Math.floor(b)&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),a=!1);var c=this.times; +b=this.values;var d=c.length;0===d&&(console.error("THREE.KeyframeTrack: Track is empty.",this),a=!1);for(var e=null,f=0;f!==d;f++){var g=c[f];if("number"===typeof g&&isNaN(g)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,f,g);a=!1;break}if(null!==e&&e>g){console.error("THREE.KeyframeTrack: Out of order keys.",this,f,g,e);a=!1;break}e=g}if(void 0!==b&&ra.isTypedArray(b))for(f=0,c=b.length;f!==c;++f)if(d=b[f],isNaN(d)){console.error("THREE.KeyframeTrack: Value is not a valid number.", +this,f,d);a=!1;break}return a},optimize:function(){for(var a=this.times,b=this.values,c=this.getValueSize(),d=2302===this.getInterpolation(),e=1,f=a.length-1,g=1;gm.opacity&&(m.transparent=!0);d.setTextures(k);return d.parse(m)}}()});var Fe= +{decodeText:function(a){if("undefined"!==typeof TextDecoder)return(new TextDecoder).decode(a);for(var b="",c=0,d=a.length;cf;f++){var z=h[v++];var C=D[2*z];z=D[2*z+1];C=new A(C,z);2!==f&&c.faceVertexUvs[e][u].push(C);0!==f&&c.faceVertexUvs[e][u+1].push(C)}}y&&(y=3*h[v++],t.normal.set(m[y++],m[y++],m[y]),w.normal.copy(t.normal));if(x)for(e=0;4>e;e++)y=3*h[v++],x=new p(m[y++],m[y++],m[y]),2!==e&&t.vertexNormals.push(x),0!==e&&w.vertexNormals.push(x); +n&&(n=h[v++],n=l[n],t.color.setHex(n),w.color.setHex(n));if(k)for(e=0;4>e;e++)n=h[v++],n=l[n],2!==e&&t.vertexColors.push(new G(n)),0!==e&&w.vertexColors.push(new G(n));c.faces.push(t);c.faces.push(w)}else{t=new Xa;t.a=h[v++];t.b=h[v++];t.c=h[v++];u&&(u=h[v++],t.materialIndex=u);u=c.faces.length;if(e)for(e=0;ef;f++)z=h[v++],C=D[2*z],z=D[2*z+1],C=new A(C,z),c.faceVertexUvs[e][u].push(C);y&&(y=3*h[v++],t.normal.set(m[y++],m[y++],m[y]));if(x)for(e= +0;3>e;e++)y=3*h[v++],x=new p(m[y++],m[y++],m[y]),t.vertexNormals.push(x);n&&(n=h[v++],t.color.setHex(l[n]));if(k)for(e=0;3>e;e++)n=h[v++],t.vertexColors.push(new G(l[n]));c.faces.push(t)}}d=a;v=void 0!==d.influencesPerVertex?d.influencesPerVertex:2;if(d.skinWeights)for(g=0,h=d.skinWeights.length;g -Number.EPSILON){if(0>m&&(g=b[f],k=-k,h=b[e],m=-m),!(a.yh.y))if(a.y===g.y){if(a.x===g.x)return!0}else{e=m*(a.x-g.x)-k*(a.y-g.y);if(0===e)return!0;0>e||(d=!d)}}else if(a.y===g.y&&(h.x<=a.x&&a.x<=g.x||g.x<=a.x&&a.x<=h.x))return!0}return d}var e=Xa.isClockWise,f=this.subPaths;if(0===f.length)return[];if(!0===b)return c(f);b=[];if(1===f.length){var g=f[0];var h=new fb;h.curves=g.curves;b.push(h);return b}var k=!e(f[0].getPoints());k=a?!k:k;h=[];var m=[],l=[],n=0;m[n]=void 0;l[n]=[];for(var p= -0,u=f.length;p +Number.EPSILON){if(0>m&&(g=b[f],k=-k,h=b[e],m=-m),!(a.yh.y))if(a.y===g.y){if(a.x===g.x)return!0}else{e=m*(a.x-g.x)-k*(a.y-g.y);if(0===e)return!0;0>e||(d=!d)}}else if(a.y===g.y&&(h.x<=a.x&&a.x<=g.x||g.x<=a.x&&a.x<=h.x))return!0}return d}var e=Za.isClockWise,f=this.subPaths;if(0===f.length)return[];if(!0===b)return c(f);b=[];if(1===f.length){var g=f[0];var h=new gb;h.curves=g.curves;b.push(h);return b}var k=!e(f[0].getPoints());k=a?!k:k;h=[];var m=[],l=[],n=0;m[n]=void 0;l[n]=[];for(var p= +0,v=f.length;pd&&this._mixBufferRegion(c,a,3*b,1-d,b);d=b;for(var f=b+b;d!==f;++d)if(c[d]!==c[d+b]){e.setValue(c,a);break}},saveOriginalState:function(){var a=this.buffer,b=this.valueSize,c=3*b;this.binding.getValue(a, -c);for(var d=b;d!==c;++d)a[d]=a[c+d%b];this.cumulativeWeight=0},restoreOriginalState:function(){this.binding.setValue(this.buffer,3*this.valueSize)},_select:function(a,b,c,d,e){if(.5<=d)for(d=0;d!==e;++d)a[b+d]=a[c+d]},_slerp:function(a,b,c,d){ha.slerpFlat(a,b,a,b,a,c,d)},_lerp:function(a,b,c,d,e){for(var f=1-d,g=0;g!==e;++g){var h=b+g;a[h]=a[h]*f+a[c+g]*d}}});Object.assign(of.prototype,{getValue:function(a,b){this.bind();var c=this._bindings[this._targetGroup.nCachedObjects_];void 0!==c&&c.getValue(a, -b)},setValue:function(a,b){for(var c=this._bindings,d=this._targetGroup.nCachedObjects_,e=c.length;d!==e;++d)c[d].setValue(a,b)},bind:function(){for(var a=this._bindings,b=this._targetGroup.nCachedObjects_,c=a.length;b!==c;++b)a[b].bind()},unbind:function(){for(var a=this._bindings,b=this._targetGroup.nCachedObjects_,c=a.length;b!==c;++b)a[b].unbind()}});Object.assign(sa,{Composite:of,create:function(a,b,c){return a&&a.isAnimationObjectGroup?new sa.Composite(a,b,c):new sa(a,b,c)},sanitizeNodeName:function(){var a= +c);for(var d=b;d!==c;++d)a[d]=a[c+d%b];this.cumulativeWeight=0},restoreOriginalState:function(){this.binding.setValue(this.buffer,3*this.valueSize)},_select:function(a,b,c,d,e){if(.5<=d)for(d=0;d!==e;++d)a[b+d]=a[c+d]},_slerp:function(a,b,c,d){ja.slerpFlat(a,b,a,b,a,c,d)},_lerp:function(a,b,c,d,e){for(var f=1-d,g=0;g!==e;++g){var h=b+g;a[h]=a[h]*f+a[c+g]*d}}});Object.assign(rf.prototype,{getValue:function(a,b){this.bind();var c=this._bindings[this._targetGroup.nCachedObjects_];void 0!==c&&c.getValue(a, +b)},setValue:function(a,b){for(var c=this._bindings,d=this._targetGroup.nCachedObjects_,e=c.length;d!==e;++d)c[d].setValue(a,b)},bind:function(){for(var a=this._bindings,b=this._targetGroup.nCachedObjects_,c=a.length;b!==c;++b)a[b].bind()},unbind:function(){for(var a=this._bindings,b=this._targetGroup.nCachedObjects_,c=a.length;b!==c;++b)a[b].unbind()}});Object.assign(ta,{Composite:rf,create:function(a,b,c){return a&&a.isAnimationObjectGroup?new ta.Composite(a,b,c):new ta(a,b,c)},sanitizeNodeName:function(){var a= /[\[\]\.:\/]/g;return function(b){return b.replace(/\s/g,"_").replace(a,"")}}(),parseTrackName:function(){var a="[^"+"\\[\\]\\.:\\/".replace("\\.","")+"]",b=/((?:WC+[\/:])*)/.source.replace("WC","[^\\[\\]\\.:\\/]");a=/(WCOD+)?/.source.replace("WCOD",a);var c=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC","[^\\[\\]\\.:\\/]"),d=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC","[^\\[\\]\\.:\\/]"),e=new RegExp("^"+b+a+c+d+"$"),f=["material","materials","bones"];return function(a){var b=e.exec(a);if(!b)throw Error("PropertyBinding: Cannot parse trackName: "+ a);b={nodeName:b[2],objectName:b[3],objectIndex:b[4],propertyName:b[5],propertyIndex:b[6]};var c=b.nodeName&&b.nodeName.lastIndexOf(".");if(void 0!==c&&-1!==c){var d=b.nodeName.substring(c+1);-1!==f.indexOf(d)&&(b.nodeName=b.nodeName.substring(0,c),b.objectName=d)}if(null===b.propertyName||0===b.propertyName.length)throw Error("PropertyBinding: can not parse propertyName from trackName: "+a);return b}}(),findNode:function(a,b){if(!b||""===b||"root"===b||"."===b||-1===b||b===a.name||b===a.uuid)return a; -if(a.skeleton){var c=a.skeleton.getBoneByName(b);if(void 0!==c)return c}if(a.children){var d=function(a){for(var c=0;c=b){var l=b++,n=a[l];c[n.uuid]=m;a[m]=n;c[k]=l;a[l]=h;h=0;for(k=e;h!==k;++h){n=d[h];var p=n[m];n[m]=n[l];n[l]=p}}}this.nCachedObjects_=b},uncache:function(){for(var a=this._objects,b=a.length,c=this.nCachedObjects_,d=this._indicesByUUID,e=this._bindings,f=e.length,g=0,h=arguments.length;g!==h;++g){var k= -arguments[g].uuid,l=d[k];if(void 0!==l)if(delete d[k],l=b){var p=b++,n=a[p];c[n.uuid]=l;a[l]=n;c[k]=p;a[p]=h;h=0;for(k=e;h!==k;++h){n=d[h];var q=n[l];n[l]=n[p];n[p]=q}}}this.nCachedObjects_=b},uncache:function(){for(var a=this._objects,b=a.length,c=this.nCachedObjects_,d=this._indicesByUUID,e=this._bindings,f=e.length,g=0,h=arguments.length;g!==h;++g){var k= +arguments[g].uuid,l=d[k];if(void 0!==l)if(delete d[k],lc.parameterPositions[1]&&(this.stopFading(),0===d&&(this.enabled=!1))}}return this._effectiveWeight=b},_updateTimeScale:function(a){var b=0;if(!this.paused){b=this.timeScale;var c=this._timeScaleInterpolant;if(null!==c){var d=c.evaluate(a)[0];b*=d;a>c.parameterPositions[1]&&(this.stopWarping(),0===b?this.paused=!0:this.timeScale=b)}}return this._effectiveTimeScale=b},_updateTime:function(a){var b=this.time+a,c=this._clip.duration,d=this.loop,e=this._loopCount,f=2202===d;if(0===a)return-1=== e?b:f&&1===(e&1)?c-b:b;if(2200===d)a:{if(-1===e&&(this._loopCount=0,this._setEndings(!0,!0,!1)),b>=c)b=c;else if(0>b)b=0;else break a;this.clampWhenFinished?this.paused=!0:this.enabled=!1;this._mixer.dispatchEvent({type:"finished",action:this,direction:0>a?-1:1})}else{-1===e&&(0<=a?(e=0,this._setEndings(!0,0===this.repetitions,f)):this._setEndings(0===this.repetitions,!0,f));if(b>=c||0>b){d=Math.floor(b/c);b-=c*d;e+=Math.abs(d);var g=this.repetitions-e;0>=g?(this.clampWhenFinished?this.paused=!0: this.enabled=!1,b=0a,this._setEndings(a,!a,f)):this._setEndings(!1,!1,f),this._loopCount=e,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:d}))}if(f&&1===(e&1))return this.time=b,c-b}return this.time=b},_setEndings:function(a,b,c){var d=this._interpolantSettings;c?(d.endingStart=2401,d.endingEnd=2401):(d.endingStart=a?this.zeroSlopeAtStart?2401:2400:2402,d.endingEnd=b?this.zeroSlopeAtEnd?2401: -2400:2402)},_scheduleFading:function(a,b,c){var d=this._mixer,e=d.time,f=this._weightInterpolant;null===f&&(this._weightInterpolant=f=d._lendControlInterpolant());d=f.parameterPositions;f=f.sampleValues;d[0]=e;f[0]=b;d[1]=e+a;f[1]=c;return this}});qe.prototype=Object.assign(Object.create(ea.prototype),{constructor:qe,_bindAction:function(a,b){var c=a._localRoot||this._root,d=a._clip.tracks,e=d.length,f=a._propertyBindings;a=a._interpolants;var g=c.uuid,h=this._bindingsByRootAndName,k=h[g];void 0=== -k&&(k={},h[g]=k);for(h=0;h!==e;++h){var l=d[h],p=l.name,n=k[p];if(void 0===n){n=f[h];if(void 0!==n){null===n._cacheIndex&&(++n.referenceCount,this._addInactiveBinding(n,g,p));continue}n=new pe(sa.create(c,p,b&&b._propertyBindings[h].binding.parsedPath),l.ValueTypeName,l.getValueSize());++n.referenceCount;this._addInactiveBinding(n,g,p)}f[h]=n;a[h].resultBuffer=n.buffer}},_activateAction:function(a){if(!this._isActiveAction(a)){if(null===a._cacheIndex){var b=(a._localRoot||this._root).uuid,c=a._clip.uuid, +2400:2402)},_scheduleFading:function(a,b,c){var d=this._mixer,e=d.time,f=this._weightInterpolant;null===f&&(this._weightInterpolant=f=d._lendControlInterpolant());d=f.parameterPositions;f=f.sampleValues;d[0]=e;f[0]=b;d[1]=e+a;f[1]=c;return this}});te.prototype=Object.assign(Object.create(ia.prototype),{constructor:te,_bindAction:function(a,b){var c=a._localRoot||this._root,d=a._clip.tracks,e=d.length,f=a._propertyBindings;a=a._interpolants;var g=c.uuid,h=this._bindingsByRootAndName,k=h[g];void 0=== +k&&(k={},h[g]=k);for(h=0;h!==e;++h){var l=d[h],p=l.name,n=k[p];if(void 0===n){n=f[h];if(void 0!==n){null===n._cacheIndex&&(++n.referenceCount,this._addInactiveBinding(n,g,p));continue}n=new se(ta.create(c,p,b&&b._propertyBindings[h].binding.parsedPath),l.ValueTypeName,l.getValueSize());++n.referenceCount;this._addInactiveBinding(n,g,p)}f[h]=n;a[h].resultBuffer=n.buffer}},_activateAction:function(a){if(!this._isActiveAction(a)){if(null===a._cacheIndex){var b=(a._localRoot||this._root).uuid,c=a._clip.uuid, d=this._actionsByClip[c];this._bindAction(a,d&&d.knownActions[0]);this._addInactiveAction(a,c,b)}b=a._propertyBindings;c=0;for(d=b.length;c!==d;++c){var e=b[c];0===e.useCount++&&(this._lendBinding(e),e.saveOriginalState())}this._lendAction(a)}},_deactivateAction:function(a){if(this._isActiveAction(a)){for(var b=a._propertyBindings,c=0,d=b.length;c!==d;++c){var e=b[c];0===--e.useCount&&(e.restoreOriginalState(),this._takeBackBinding(e))}this._takeBackAction(a)}},_initMemoryManager:function(){this._actions= [];this._nActiveActions=0;this._actionsByClip={};this._bindings=[];this._nActiveBindings=0;this._bindingsByRootAndName={};this._controlInterpolants=[];this._nActiveControlInterpolants=0;var a=this;this.stats={actions:{get total(){return a._actions.length},get inUse(){return a._nActiveActions}},bindings:{get total(){return a._bindings.length},get inUse(){return a._nActiveBindings}},controlInterpolants:{get total(){return a._controlInterpolants.length},get inUse(){return a._nActiveControlInterpolants}}}}, _isActiveAction:function(a){a=a._cacheIndex;return null!==a&&athis.max.x||a.ythis.max.y?!1:!0},containsBox:function(a){return this.min.x<=a.min.x&&a.max.x<=this.max.x&&this.min.y<=a.min.y&&a.max.y<=this.max.y},getParameter:function(a,b){void 0===b&&(console.warn("THREE.Box2: .getParameter() target is now required"),b=new z);return b.set((a.x-this.min.x)/(this.max.x-this.min.x),(a.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(a){return a.max.xthis.max.x||a.max.ythis.max.y? -!1:!0},clampPoint:function(a,b){void 0===b&&(console.warn("THREE.Box2: .clampPoint() target is now required"),b=new z);return b.copy(a).clamp(this.min,this.max)},distanceToPoint:function(){var a=new z;return function(b){return a.copy(b).clamp(this.min,this.max).sub(b).length()}}(),intersect:function(a){this.min.max(a.min);this.max.min(a.max);return this},union:function(a){this.min.min(a.min);this.max.max(a.max);return this},translate:function(a){this.min.add(a);this.max.add(a);return this},equals:function(a){return a.min.equals(this.min)&& -a.max.equals(this.max)}});Object.assign(we.prototype,{set:function(a,b){this.start.copy(a);this.end.copy(b);return this},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.start.copy(a.start);this.end.copy(a.end);return this},getCenter:function(a){void 0===a&&(console.warn("THREE.Line3: .getCenter() target is now required"),a=new p);return a.addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(a){void 0===a&&(console.warn("THREE.Line3: .delta() target is now required"), +d[e],a.restoreOriginalState(),this._removeInactiveBinding(a)},uncacheAction:function(a,b){a=this.existingAction(a,b);null!==a&&(this._deactivateAction(a),this._removeInactiveAction(a))}});Rd.prototype.clone=function(){return new Rd(void 0===this.value.clone?this.value:this.value.clone())};ue.prototype=Object.assign(Object.create(F.prototype),{constructor:ue,isInstancedBufferGeometry:!0,copy:function(a){F.prototype.copy.call(this,a);this.maxInstancedCount=a.maxInstancedCount;return this},clone:function(){return(new this.constructor).copy(this)}}); +ve.prototype=Object.assign(Object.create(qb.prototype),{constructor:ve,isInstancedInterleavedBuffer:!0,copy:function(a){qb.prototype.copy.call(this,a);this.meshPerAttribute=a.meshPerAttribute;return this}});we.prototype=Object.assign(Object.create(I.prototype),{constructor:we,isInstancedBufferAttribute:!0,copy:function(a){I.prototype.copy.call(this,a);this.meshPerAttribute=a.meshPerAttribute;return this}});Object.assign(uf.prototype,{linePrecision:1,set:function(a,b){this.ray.set(a,b)},setFromCamera:function(a, +b){b&&b.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(b.matrixWorld),this.ray.direction.set(a.x,a.y,.5).unproject(b).sub(this.ray.origin).normalize()):b&&b.isOrthographicCamera?(this.ray.origin.set(a.x,a.y,(b.near+b.far)/(b.near-b.far)).unproject(b),this.ray.direction.set(0,0,-1).transformDirection(b.matrixWorld)):console.error("THREE.Raycaster: Unsupported camera type.")},intersectObject:function(a,b,c){c=c||[];xe(a,this,c,b);c.sort(vf);return c},intersectObjects:function(a,b,c){c=c|| +[];if(!1===Array.isArray(a))return console.warn("THREE.Raycaster.intersectObjects: objects is not an Array."),c;for(var d=0,e=a.length;dthis.max.x||a.ythis.max.y?!1:!0},containsBox:function(a){return this.min.x<=a.min.x&&a.max.x<=this.max.x&&this.min.y<=a.min.y&&a.max.y<=this.max.y},getParameter:function(a,b){void 0===b&&(console.warn("THREE.Box2: .getParameter() target is now required"),b=new A);return b.set((a.x-this.min.x)/(this.max.x-this.min.x),(a.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(a){return a.max.xthis.max.x||a.max.ythis.max.y? +!1:!0},clampPoint:function(a,b){void 0===b&&(console.warn("THREE.Box2: .clampPoint() target is now required"),b=new A);return b.copy(a).clamp(this.min,this.max)},distanceToPoint:function(){var a=new A;return function(b){return a.copy(b).clamp(this.min,this.max).sub(b).length()}}(),intersect:function(a){this.min.max(a.min);this.max.min(a.max);return this},union:function(a){this.min.min(a.min);this.max.max(a.max);return this},translate:function(a){this.min.add(a);this.max.add(a);return this},equals:function(a){return a.min.equals(this.min)&& +a.max.equals(this.max)}});Object.assign(ze.prototype,{set:function(a,b){this.start.copy(a);this.end.copy(b);return this},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.start.copy(a.start);this.end.copy(a.end);return this},getCenter:function(a){void 0===a&&(console.warn("THREE.Line3: .getCenter() target is now required"),a=new p);return a.addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(a){void 0===a&&(console.warn("THREE.Line3: .delta() target is now required"), a=new p);return a.subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(a,b){void 0===b&&(console.warn("THREE.Line3: .at() target is now required"),b=new p);return this.delta(b).multiplyScalar(a).add(this.start)},closestPointToPointParameter:function(){var a=new p,b=new p;return function(c,d){a.subVectors(c,this.start);b.subVectors(this.end,this.start);c=b.dot(b);c=b.dot(a)/c;d&& -(c=K.clamp(c,0,1));return c}}(),closestPointToPoint:function(a,b,c){a=this.closestPointToPointParameter(a,b);void 0===c&&(console.warn("THREE.Line3: .closestPointToPoint() target is now required"),c=new p);return this.delta(c).multiplyScalar(a).add(this.start)},applyMatrix4:function(a){this.start.applyMatrix4(a);this.end.applyMatrix4(a);return this},equals:function(a){return a.start.equals(this.start)&&a.end.equals(this.end)}});gd.prototype=Object.create(B.prototype);gd.prototype.constructor=gd;gd.prototype.isImmediateRenderObject= -!0;hd.prototype=Object.create(Z.prototype);hd.prototype.constructor=hd;hd.prototype.update=function(){var a=new p,b=new p,c=new na;return function(){var d=["a","b","c"];this.object.updateMatrixWorld(!0);c.getNormalMatrix(this.object.matrixWorld);var e=this.object.matrixWorld,f=this.geometry.attributes.position,g=this.object.geometry;if(g&&g.isGeometry)for(var h=g.vertices,k=g.faces,l=g=0,p=k.length;lMath.abs(b)&&(b=1E-8);this.scale.set(.5*this.size,.5*this.size,b);this.children[0].material.side=0>b?1:0;this.lookAt(this.plane.normal);B.prototype.updateMatrixWorld.call(this,a)};var Od,xe;Gb.prototype= -Object.create(B.prototype);Gb.prototype.constructor=Gb;Gb.prototype.setDirection=function(){var a=new p,b;return function(c){.99999c.y?this.quaternion.set(1,0,0,0):(a.set(c.z,0,-c.x).normalize(),b=Math.acos(c.y),this.quaternion.setFromAxisAngle(a,b))}}();Gb.prototype.setLength=function(a,b,c){void 0===b&&(b=.2*a);void 0===c&&(c=.2*b);this.line.scale.set(1,Math.max(0,a-b),1);this.line.updateMatrix();this.cone.scale.set(c,b,c);this.cone.position.y=a;this.cone.updateMatrix()}; -Gb.prototype.setColor=function(a){this.line.material.color.copy(a);this.cone.material.color.copy(a)};nd.prototype=Object.create(Z.prototype);nd.prototype.constructor=nd;L.create=function(a,b){console.log("THREE.Curve.create() has been deprecated");a.prototype=Object.create(L.prototype);a.prototype.constructor=a;a.prototype.getPoint=b;return a};Object.assign(Za.prototype,{createPointsGeometry:function(a){console.warn("THREE.CurvePath: .createPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead."); +(c=S.clamp(c,0,1));return c}}(),closestPointToPoint:function(a,b,c){a=this.closestPointToPointParameter(a,b);void 0===c&&(console.warn("THREE.Line3: .closestPointToPoint() target is now required"),c=new p);return this.delta(c).multiplyScalar(a).add(this.start)},applyMatrix4:function(a){this.start.applyMatrix4(a);this.end.applyMatrix4(a);return this},equals:function(a){return a.start.equals(this.start)&&a.end.equals(this.end)}});jd.prototype=Object.create(C.prototype);jd.prototype.constructor=jd;jd.prototype.isImmediateRenderObject= +!0;kd.prototype=Object.create(W.prototype);kd.prototype.constructor=kd;kd.prototype.update=function(){var a=new p,b=new p,c=new oa;return function(){var d=["a","b","c"];this.object.updateMatrixWorld(!0);c.getNormalMatrix(this.object.matrixWorld);var e=this.object.matrixWorld,f=this.geometry.attributes.position,g=this.object.geometry;if(g&&g.isGeometry)for(var h=g.vertices,k=g.faces,l=g=0,p=k.length;lMath.abs(b)&&(b=1E-8);this.scale.set(.5*this.size,.5*this.size,b);this.children[0].material.side=0>b?1:0;this.lookAt(this.plane.normal);C.prototype.updateMatrixWorld.call(this,a)};var Td,Ae;Hb.prototype= +Object.create(C.prototype);Hb.prototype.constructor=Hb;Hb.prototype.setDirection=function(){var a=new p,b;return function(c){.99999c.y?this.quaternion.set(1,0,0,0):(a.set(c.z,0,-c.x).normalize(),b=Math.acos(c.y),this.quaternion.setFromAxisAngle(a,b))}}();Hb.prototype.setLength=function(a,b,c){void 0===b&&(b=.2*a);void 0===c&&(c=.2*b);this.line.scale.set(1,Math.max(0,a-b),1);this.line.updateMatrix();this.cone.scale.set(c,b,c);this.cone.position.y=a;this.cone.updateMatrix()}; +Hb.prototype.setColor=function(a){this.line.material.color.copy(a);this.cone.material.color.copy(a)};qd.prototype=Object.create(W.prototype);qd.prototype.constructor=qd;N.create=function(a,b){console.log("THREE.Curve.create() has been deprecated");a.prototype=Object.create(N.prototype);a.prototype.constructor=a;a.prototype.getPoint=b;return a};Object.assign(ab.prototype,{createPointsGeometry:function(a){console.warn("THREE.CurvePath: .createPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead."); a=this.getPoints(a);return this.createGeometry(a)},createSpacedPointsGeometry:function(a){console.warn("THREE.CurvePath: .createSpacedPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");a=this.getSpacedPoints(a);return this.createGeometry(a)},createGeometry:function(a){console.warn("THREE.CurvePath: .createGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");for(var b=new M,c=0,d=a.length;c= plane.constant ); + return ( min <= - plane.constant && max >= - plane.constant ); }, @@ -5987,17 +5990,17 @@ var begin_vertex = "\nvec3 transformed = vec3( position );\n"; var beginnormal_vertex = "\nvec3 objectNormal = vec3( normal );\n"; -var bsdfs = "float punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\tif( decayExponent > 0.0 ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\tfloat maxDistanceCutoffFactor = pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\treturn distanceFalloff * maxDistanceCutoffFactor;\n#else\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n#endif\n\t}\n\treturn 1.0;\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNL = saturate( dot( geometry.normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\nvec3 BRDF_Specular_GGX_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 AB = vec2( -1.04, 1.04 ) * a004 + r.zw;\n\treturn specularColor * AB.x + AB.y;\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n"; +var bsdfs = "float punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\tif( cutoffDistance > 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n#else\n\tif( cutoffDistance > 0.0 ) {\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t}\n\treturn 1.0;\n#endif\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNL = saturate( dot( geometry.normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\nvec3 BRDF_Specular_GGX_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 AB = vec2( -1.04, 1.04 ) * a004 + r.zw;\n\treturn specularColor * AB.x + AB.y;\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n"; var bumpmap_pars_fragment = "#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\t\tvec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 );\n\t\tfDet *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif\n"; var clipping_planes_fragment = "#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vViewPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vViewPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\tif ( clipped ) discard;\n\t#endif\n#endif\n"; -var clipping_planes_pars_fragment = "#if NUM_CLIPPING_PLANES > 0\n\t#if ! defined( PHYSICAL ) && ! defined( PHONG )\n\t\tvarying vec3 vViewPosition;\n\t#endif\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif\n"; +var clipping_planes_pars_fragment = "#if NUM_CLIPPING_PLANES > 0\n\t#if ! defined( PHYSICAL ) && ! defined( PHONG ) && ! defined( MATCAP )\n\t\tvarying vec3 vViewPosition;\n\t#endif\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif\n"; -var clipping_planes_pars_vertex = "#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n\tvarying vec3 vViewPosition;\n#endif\n"; +var clipping_planes_pars_vertex = "#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG ) && ! defined( MATCAP )\n\tvarying vec3 vViewPosition;\n#endif\n"; -var clipping_planes_vertex = "#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n"; +var clipping_planes_vertex = "#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG ) && ! defined( MATCAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n"; var color_fragment = "#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif"; @@ -6151,6 +6154,10 @@ var uv2_vertex = "#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = var worldpos_vertex = "#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP )\n\tvec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );\n#endif\n"; +var background_frag = "uniform sampler2D t2D;\nvarying vec2 vUv;\nvoid main() {\n\tgl_FragColor = texture2D( t2D, vUv );\n}\n"; + +var background_vert = "varying vec2 vUv;\nvoid main() {\n\tvUv = uv;\n\tgl_Position = vec4( position, 1.0 );\n\tgl_Position.z = 1.0;\n}\n"; + var cube_frag = "uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldPosition;\nvoid main() {\n\tgl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );\n\tgl_FragColor.a *= opacity;\n}\n"; var cube_vert = "varying vec3 vWorldPosition;\n#include \nvoid main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n\tgl_Position.z = gl_Position.w;\n}\n"; @@ -6179,6 +6186,10 @@ var meshlambert_frag = "uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform f var meshlambert_vert = "#define LAMBERT\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n"; +var meshmatcap_frag = "#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\tvec4 matcapColor = texture2D( matcap, uv );\n\tmatcapColor = matcapTexelToLinear( matcapColor );\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}\n"; + +var meshmatcap_vert = "#define MATCAP\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifndef FLAT_SHADED\n\t\tvNormal = normalize( transformedNormal );\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n}\n"; + var meshphong_frag = "#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n"; var meshphong_vert = "#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n\t#include \n}\n"; @@ -6294,6 +6305,8 @@ var ShaderChunk = { uv2_vertex: uv2_vertex, worldpos_vertex: worldpos_vertex, + background_frag: background_frag, + background_vert: background_vert, cube_frag: cube_frag, cube_vert: cube_vert, depth_frag: depth_frag, @@ -6308,6 +6321,8 @@ var ShaderChunk = { meshbasic_vert: meshbasic_vert, meshlambert_frag: meshlambert_frag, meshlambert_vert: meshlambert_vert, + meshmatcap_frag: meshmatcap_frag, + meshmatcap_vert: meshmatcap_vert, meshphong_frag: meshphong_frag, meshphong_vert: meshphong_vert, meshphysical_frag: meshphysical_frag, @@ -7284,6 +7299,24 @@ var ShaderLib = { }, + matcap: { + + uniforms: UniformsUtils.merge( [ + UniformsLib.common, + UniformsLib.bumpmap, + UniformsLib.normalmap, + UniformsLib.displacementmap, + UniformsLib.fog, + { + matcap: { value: null } + } + ] ), + + vertexShader: ShaderChunk.meshmatcap_vert, + fragmentShader: ShaderChunk.meshmatcap_frag + + }, + points: { uniforms: UniformsUtils.merge( [ @@ -7354,6 +7387,16 @@ var ShaderLib = { }, + background: { + + uniforms: { + t2D: { value: null }, + }, + + vertexShader: ShaderChunk.background_vert, + fragmentShader: ShaderChunk.background_frag + + }, /* ------------------------------------------------------------------------- // Cube map shader ------------------------------------------------------------------------- */ @@ -7640,6 +7683,64 @@ function WebGLAttributes( gl ) { } +/** + * @author mrdoob / http://mrdoob.com/ + * @author alteredq / http://alteredqualia.com/ + */ + +function Face3( a, b, c, normal, color, materialIndex ) { + + this.a = a; + this.b = b; + this.c = c; + + this.normal = ( normal && normal.isVector3 ) ? normal : new Vector3(); + this.vertexNormals = Array.isArray( normal ) ? normal : []; + + this.color = ( color && color.isColor ) ? color : new Color(); + this.vertexColors = Array.isArray( color ) ? color : []; + + this.materialIndex = materialIndex !== undefined ? materialIndex : 0; + +} + +Object.assign( Face3.prototype, { + + clone: function () { + + return new this.constructor().copy( this ); + + }, + + copy: function ( source ) { + + this.a = source.a; + this.b = source.b; + this.c = source.c; + + this.normal.copy( source.normal ); + this.color.copy( source.color ); + + this.materialIndex = source.materialIndex; + + for ( var i = 0, il = source.vertexNormals.length; i < il; i ++ ) { + + this.vertexNormals[ i ] = source.vertexNormals[ i ].clone(); + + } + + for ( var i = 0, il = source.vertexColors.length; i < il; i ++ ) { + + this.vertexColors[ i ] = source.vertexColors[ i ].clone(); + + } + + return this; + + } + +} ); + /** * @author mrdoob / http://mrdoob.com/ * @author WestLangley / http://github.com/WestLangley @@ -8907,277 +9008,6 @@ Object3D.prototype = Object.assign( Object.create( EventDispatcher.prototype ), } ); -/** - * @author mrdoob / http://mrdoob.com/ - * @author mikael emtinger / http://gomo.se/ - * @author WestLangley / http://github.com/WestLangley -*/ - -function Camera() { - - Object3D.call( this ); - - this.type = 'Camera'; - - this.matrixWorldInverse = new Matrix4(); - - this.projectionMatrix = new Matrix4(); - this.projectionMatrixInverse = new Matrix4(); - -} - -Camera.prototype = Object.assign( Object.create( Object3D.prototype ), { - - constructor: Camera, - - isCamera: true, - - copy: function ( source, recursive ) { - - Object3D.prototype.copy.call( this, source, recursive ); - - this.matrixWorldInverse.copy( source.matrixWorldInverse ); - - this.projectionMatrix.copy( source.projectionMatrix ); - this.projectionMatrixInverse.copy( source.projectionMatrixInverse ); - - return this; - - }, - - getWorldDirection: function ( target ) { - - if ( target === undefined ) { - - console.warn( 'THREE.Camera: .getWorldDirection() target is now required' ); - target = new Vector3(); - - } - - this.updateMatrixWorld( true ); - - var e = this.matrixWorld.elements; - - return target.set( - e[ 8 ], - e[ 9 ], - e[ 10 ] ).normalize(); - - }, - - updateMatrixWorld: function ( force ) { - - Object3D.prototype.updateMatrixWorld.call( this, force ); - - this.matrixWorldInverse.getInverse( this.matrixWorld ); - - }, - - clone: function () { - - return new this.constructor().copy( this ); - - } - -} ); - -/** - * @author alteredq / http://alteredqualia.com/ - * @author arose / http://github.com/arose - */ - -function OrthographicCamera( left, right, top, bottom, near, far ) { - - Camera.call( this ); - - this.type = 'OrthographicCamera'; - - this.zoom = 1; - this.view = null; - - this.left = left; - this.right = right; - this.top = top; - this.bottom = bottom; - - this.near = ( near !== undefined ) ? near : 0.1; - this.far = ( far !== undefined ) ? far : 2000; - - this.updateProjectionMatrix(); - -} - -OrthographicCamera.prototype = Object.assign( Object.create( Camera.prototype ), { - - constructor: OrthographicCamera, - - isOrthographicCamera: true, - - copy: function ( source, recursive ) { - - Camera.prototype.copy.call( this, source, recursive ); - - this.left = source.left; - this.right = source.right; - this.top = source.top; - this.bottom = source.bottom; - this.near = source.near; - this.far = source.far; - - this.zoom = source.zoom; - this.view = source.view === null ? null : Object.assign( {}, source.view ); - - return this; - - }, - - setViewOffset: function ( fullWidth, fullHeight, x, y, width, height ) { - - if ( this.view === null ) { - - this.view = { - enabled: true, - fullWidth: 1, - fullHeight: 1, - offsetX: 0, - offsetY: 0, - width: 1, - height: 1 - }; - - } - - this.view.enabled = true; - this.view.fullWidth = fullWidth; - this.view.fullHeight = fullHeight; - this.view.offsetX = x; - this.view.offsetY = y; - this.view.width = width; - this.view.height = height; - - this.updateProjectionMatrix(); - - }, - - clearViewOffset: function () { - - if ( this.view !== null ) { - - this.view.enabled = false; - - } - - this.updateProjectionMatrix(); - - }, - - updateProjectionMatrix: function () { - - var dx = ( this.right - this.left ) / ( 2 * this.zoom ); - var dy = ( this.top - this.bottom ) / ( 2 * this.zoom ); - var cx = ( this.right + this.left ) / 2; - var cy = ( this.top + this.bottom ) / 2; - - var left = cx - dx; - var right = cx + dx; - var top = cy + dy; - var bottom = cy - dy; - - if ( this.view !== null && this.view.enabled ) { - - var zoomW = this.zoom / ( this.view.width / this.view.fullWidth ); - var zoomH = this.zoom / ( this.view.height / this.view.fullHeight ); - var scaleW = ( this.right - this.left ) / this.view.width; - var scaleH = ( this.top - this.bottom ) / this.view.height; - - left += scaleW * ( this.view.offsetX / zoomW ); - right = left + scaleW * ( this.view.width / zoomW ); - top -= scaleH * ( this.view.offsetY / zoomH ); - bottom = top - scaleH * ( this.view.height / zoomH ); - - } - - this.projectionMatrix.makeOrthographic( left, right, top, bottom, this.near, this.far ); - - this.projectionMatrixInverse.getInverse( this.projectionMatrix ); - - }, - - toJSON: function ( meta ) { - - var data = Object3D.prototype.toJSON.call( this, meta ); - - data.object.zoom = this.zoom; - data.object.left = this.left; - data.object.right = this.right; - data.object.top = this.top; - data.object.bottom = this.bottom; - data.object.near = this.near; - data.object.far = this.far; - - if ( this.view !== null ) data.object.view = Object.assign( {}, this.view ); - - return data; - - } - -} ); - -/** - * @author mrdoob / http://mrdoob.com/ - * @author alteredq / http://alteredqualia.com/ - */ - -function Face3( a, b, c, normal, color, materialIndex ) { - - this.a = a; - this.b = b; - this.c = c; - - this.normal = ( normal && normal.isVector3 ) ? normal : new Vector3(); - this.vertexNormals = Array.isArray( normal ) ? normal : []; - - this.color = ( color && color.isColor ) ? color : new Color(); - this.vertexColors = Array.isArray( color ) ? color : []; - - this.materialIndex = materialIndex !== undefined ? materialIndex : 0; - -} - -Object.assign( Face3.prototype, { - - clone: function () { - - return new this.constructor().copy( this ); - - }, - - copy: function ( source ) { - - this.a = source.a; - this.b = source.b; - this.c = source.c; - - this.normal.copy( source.normal ); - this.color.copy( source.color ); - - this.materialIndex = source.materialIndex; - - for ( var i = 0, il = source.vertexNormals.length; i < il; i ++ ) { - - this.vertexNormals[ i ] = source.vertexNormals[ i ].clone(); - - } - - for ( var i = 0, il = source.vertexColors.length; i < il; i ++ ) { - - this.vertexColors[ i ] = source.vertexColors[ i ].clone(); - - } - - return this; - - } - -} ); - /** * @author mrdoob / http://mrdoob.com/ * @author kile / http://kile.stravaganza.org/ @@ -12953,6 +12783,9 @@ Material.prototype = Object.assign( Object.create( EventDispatcher.prototype ), data.envMap = this.envMap.toJSON( meta ).uuid; data.reflectivity = this.reflectivity; // Scale behind envMap + if ( this.combine !== undefined ) data.combine = this.combine; + if ( this.envMapIntensity !== undefined ) data.envMapIntensity = this.envMapIntensity; + } if ( this.gradientMap && this.gradientMap.isTexture ) { @@ -13118,120 +12951,6 @@ Material.prototype = Object.assign( Object.create( EventDispatcher.prototype ), } ); -/** - * @author mrdoob / http://mrdoob.com/ - * @author alteredq / http://alteredqualia.com/ - * - * parameters = { - * color: , - * opacity: , - * map: new THREE.Texture( ), - * - * lightMap: new THREE.Texture( ), - * lightMapIntensity: - * - * aoMap: new THREE.Texture( ), - * aoMapIntensity: - * - * specularMap: new THREE.Texture( ), - * - * alphaMap: new THREE.Texture( ), - * - * envMap: new THREE.CubeTexture( [posx, negx, posy, negy, posz, negz] ), - * combine: THREE.Multiply, - * reflectivity: , - * refractionRatio: , - * - * depthTest: , - * depthWrite: , - * - * wireframe: , - * wireframeLinewidth: , - * - * skinning: , - * morphTargets: - * } - */ - -function MeshBasicMaterial( parameters ) { - - Material.call( this ); - - this.type = 'MeshBasicMaterial'; - - this.color = new Color( 0xffffff ); // emissive - - this.map = null; - - this.lightMap = null; - this.lightMapIntensity = 1.0; - - this.aoMap = null; - this.aoMapIntensity = 1.0; - - this.specularMap = null; - - this.alphaMap = null; - - this.envMap = null; - this.combine = MultiplyOperation; - this.reflectivity = 1; - this.refractionRatio = 0.98; - - this.wireframe = false; - this.wireframeLinewidth = 1; - this.wireframeLinecap = 'round'; - this.wireframeLinejoin = 'round'; - - this.skinning = false; - this.morphTargets = false; - - this.lights = false; - - this.setValues( parameters ); - -} - -MeshBasicMaterial.prototype = Object.create( Material.prototype ); -MeshBasicMaterial.prototype.constructor = MeshBasicMaterial; - -MeshBasicMaterial.prototype.isMeshBasicMaterial = true; - -MeshBasicMaterial.prototype.copy = function ( source ) { - - Material.prototype.copy.call( this, source ); - - this.color.copy( source.color ); - - this.map = source.map; - - this.lightMap = source.lightMap; - this.lightMapIntensity = source.lightMapIntensity; - - this.aoMap = source.aoMap; - this.aoMapIntensity = source.aoMapIntensity; - - this.specularMap = source.specularMap; - - this.alphaMap = source.alphaMap; - - this.envMap = source.envMap; - this.combine = source.combine; - this.reflectivity = source.reflectivity; - this.refractionRatio = source.refractionRatio; - - this.wireframe = source.wireframe; - this.wireframeLinewidth = source.wireframeLinewidth; - this.wireframeLinecap = source.wireframeLinecap; - this.wireframeLinejoin = source.wireframeLinejoin; - - this.skinning = source.skinning; - this.morphTargets = source.morphTargets; - - return this; - -}; - /** * @author alteredq / http://alteredqualia.com/ * @@ -14304,6 +14023,120 @@ Object.assign( Triangle.prototype, { } ); +/** + * @author mrdoob / http://mrdoob.com/ + * @author alteredq / http://alteredqualia.com/ + * + * parameters = { + * color: , + * opacity: , + * map: new THREE.Texture( ), + * + * lightMap: new THREE.Texture( ), + * lightMapIntensity: + * + * aoMap: new THREE.Texture( ), + * aoMapIntensity: + * + * specularMap: new THREE.Texture( ), + * + * alphaMap: new THREE.Texture( ), + * + * envMap: new THREE.CubeTexture( [posx, negx, posy, negy, posz, negz] ), + * combine: THREE.Multiply, + * reflectivity: , + * refractionRatio: , + * + * depthTest: , + * depthWrite: , + * + * wireframe: , + * wireframeLinewidth: , + * + * skinning: , + * morphTargets: + * } + */ + +function MeshBasicMaterial( parameters ) { + + Material.call( this ); + + this.type = 'MeshBasicMaterial'; + + this.color = new Color( 0xffffff ); // emissive + + this.map = null; + + this.lightMap = null; + this.lightMapIntensity = 1.0; + + this.aoMap = null; + this.aoMapIntensity = 1.0; + + this.specularMap = null; + + this.alphaMap = null; + + this.envMap = null; + this.combine = MultiplyOperation; + this.reflectivity = 1; + this.refractionRatio = 0.98; + + this.wireframe = false; + this.wireframeLinewidth = 1; + this.wireframeLinecap = 'round'; + this.wireframeLinejoin = 'round'; + + this.skinning = false; + this.morphTargets = false; + + this.lights = false; + + this.setValues( parameters ); + +} + +MeshBasicMaterial.prototype = Object.create( Material.prototype ); +MeshBasicMaterial.prototype.constructor = MeshBasicMaterial; + +MeshBasicMaterial.prototype.isMeshBasicMaterial = true; + +MeshBasicMaterial.prototype.copy = function ( source ) { + + Material.prototype.copy.call( this, source ); + + this.color.copy( source.color ); + + this.map = source.map; + + this.lightMap = source.lightMap; + this.lightMapIntensity = source.lightMapIntensity; + + this.aoMap = source.aoMap; + this.aoMapIntensity = source.aoMapIntensity; + + this.specularMap = source.specularMap; + + this.alphaMap = source.alphaMap; + + this.envMap = source.envMap; + this.combine = source.combine; + this.reflectivity = source.reflectivity; + this.refractionRatio = source.refractionRatio; + + this.wireframe = source.wireframe; + this.wireframeLinewidth = source.wireframeLinewidth; + this.wireframeLinecap = source.wireframeLinecap; + this.wireframeLinejoin = source.wireframeLinejoin; + + this.skinning = source.skinning; + this.morphTargets = source.morphTargets; + + return this; + +}; + /** * @author mrdoob / http://mrdoob.com/ * @author alteredq / http://alteredqualia.com/ @@ -14761,7 +14594,7 @@ function WebGLBackground( renderer, state, objects, premultipliedAlpha ) { var clearColor = new Color( 0x000000 ); var clearAlpha = 0; - var planeCamera, planeMesh; + var planeMesh; var boxMesh; function render( renderList, scene, camera, forceClear ) { @@ -14792,7 +14625,7 @@ function WebGLBackground( renderer, state, objects, premultipliedAlpha ) { boxMesh = new Mesh( new BoxBufferGeometry( 1, 1, 1 ), new ShaderMaterial( { - uniforms: ShaderLib.cube.uniforms, + uniforms: UniformsUtils.clone( ShaderLib.cube.uniforms ), vertexShader: ShaderLib.cube.vertexShader, fragmentShader: ShaderLib.cube.fragmentShader, side: BackSide, @@ -14821,24 +14654,30 @@ function WebGLBackground( renderer, state, objects, premultipliedAlpha ) { } else if ( background && background.isTexture ) { - if ( planeCamera === undefined ) { - - planeCamera = new OrthographicCamera( - 1, 1, 1, - 1, 0, 1 ); + if ( planeMesh === undefined ) { planeMesh = new Mesh( new PlaneBufferGeometry( 2, 2 ), - new MeshBasicMaterial( { depthTest: false, depthWrite: false, fog: false } ) + new ShaderMaterial( { + uniforms: UniformsUtils.clone( ShaderLib.background.uniforms ), + vertexShader: ShaderLib.background.vertexShader, + fragmentShader: ShaderLib.background.fragmentShader, + side: FrontSide, + depthTest: true, + depthWrite: false, + fog: false + } ) ); + planeMesh.geometry.removeAttribute( 'normal' ); + objects.update( planeMesh ); } - planeMesh.material.map = background; - - // TODO Push this to renderList + planeMesh.material.uniforms.t2D.value = background; - renderer.renderBufferDirect( planeCamera, null, planeMesh.geometry, planeMesh.material, planeMesh, null ); + renderList.push( planeMesh, planeMesh.geometry, planeMesh.material, 0, null ); } @@ -15791,6 +15630,36 @@ Object.defineProperty( CubeTexture.prototype, 'images', { } ); +/** + * @author Artur Trzesiok + */ + +function DataTexture3D( data, width, height, depth ) { + + // We're going to add .setXXX() methods for setting properties later. + // Users can still set in DataTexture3D directly. + // + // var texture = new THREE.DataTexture3D( data, width, height, depth ); + // texture.anisotropy = 16; + // + // See #14839 + + Texture.call( this, null ); + + this.image = { data: data, width: width, height: height, depth: depth }; + + this.magFilter = NearestFilter; + this.minFilter = NearestFilter; + + this.generateMipmaps = false; + this.flipY = false; + +} + +DataTexture3D.prototype = Object.create( Texture.prototype ); +DataTexture3D.prototype.constructor = DataTexture3D; +DataTexture3D.prototype.isDataTexture3D = true; + /** * @author tschw * @author Mugen87 / https://github.com/Mugen87 @@ -15843,6 +15712,7 @@ Object.defineProperty( CubeTexture.prototype, 'images', { */ var emptyTexture = new Texture(); +var emptyTexture3d = new DataTexture3D(); var emptyCubeTexture = new CubeTexture(); // --- Base for inner nodes (including the root) --- @@ -16178,6 +16048,22 @@ function setValueT1( gl, v, renderer ) { } +function setValueT3D1( gl, v, renderer ) { + + var cache = this.cache; + var unit = renderer.allocTextureUnit(); + + if ( cache[ 0 ] !== unit ) { + + gl.uniform1i( this.addr, unit ); + cache[ 0 ] = unit; + + } + + renderer.setTexture3D( v || emptyTexture3d, unit ); + +} + function setValueT6( gl, v, renderer ) { var cache = this.cache; @@ -16248,6 +16134,7 @@ function getSingularSetter( type ) { case 0x8b5c: return setValue4fm; // _MAT4 case 0x8b5e: case 0x8d66: return setValueT1; // SAMPLER_2D, SAMPLER_EXTERNAL_OES + case 0x8B5F: return setValueT3D1; // SAMPLER_3D case 0x8b60: return setValueT6; // SAMPLER_CUBE case 0x1404: case 0x8b56: return setValue1i; // INT, BOOL @@ -17176,8 +17063,10 @@ function WebGLProgram( renderer, extensions, code, material, shader, parameters, parameters.dithering ? '#define DITHERING' : '', - ( parameters.outputEncoding || parameters.mapEncoding || parameters.envMapEncoding || parameters.emissiveMapEncoding ) ? ShaderChunk[ 'encodings_pars_fragment' ] : '', // this code is required here because it is used by the various encoding/decoding function defined below + ( parameters.outputEncoding || parameters.mapEncoding || parameters.matcapEncoding || parameters.envMapEncoding || parameters.emissiveMapEncoding ) ? + ShaderChunk[ 'encodings_pars_fragment' ] : '', // this code is required here because it is used by the various encoding/decoding function defined below parameters.mapEncoding ? getTexelDecodingFunction( 'mapTexelToLinear', parameters.mapEncoding ) : '', + parameters.matcapEncoding ? getTexelDecodingFunction( 'matcapTexelToLinear', parameters.matcapEncoding ) : '', parameters.envMapEncoding ? getTexelDecodingFunction( 'envMapTexelToLinear', parameters.envMapEncoding ) : '', parameters.emissiveMapEncoding ? getTexelDecodingFunction( 'emissiveMapTexelToLinear', parameters.emissiveMapEncoding ) : '', parameters.outputEncoding ? getTexelEncodingFunction( 'linearToOutputTexel', parameters.outputEncoding ) : '', @@ -17428,6 +17317,7 @@ function WebGLPrograms( renderer, extensions, capabilities ) { MeshToonMaterial: 'phong', MeshStandardMaterial: 'physical', MeshPhysicalMaterial: 'physical', + MeshMatcapMaterial: 'matcap', LineBasicMaterial: 'basic', LineDashedMaterial: 'dashed', PointsMaterial: 'points', @@ -17436,7 +17326,7 @@ function WebGLPrograms( renderer, extensions, capabilities ) { }; var parameterNames = [ - "precision", "supportsVertexTextures", "map", "mapEncoding", "envMap", "envMapMode", "envMapEncoding", + "precision", "supportsVertexTextures", "map", "mapEncoding", "matcapEncoding", "envMap", "envMapMode", "envMapEncoding", "lightMap", "aoMap", "emissiveMap", "emissiveMapEncoding", "bumpMap", "normalMap", "objectSpaceNormalMap", "displacementMap", "specularMap", "roughnessMap", "metalnessMap", "gradientMap", "alphaMap", "combine", "vertexColors", "fog", "useFog", "fogExp", @@ -17548,6 +17438,8 @@ function WebGLPrograms( renderer, extensions, capabilities ) { outputEncoding: getTextureEncodingFromMap( ( ! currentRenderTarget ) ? null : currentRenderTarget.texture, renderer.gammaOutput ), map: !! material.map, mapEncoding: getTextureEncodingFromMap( material.map, renderer.gammaInput ), + matcap: !! material.matcap, + matcapEncoding: getTextureEncodingFromMap( material.matcap, renderer.gammaInput ), envMap: !! material.envMap, envMapMode: material.envMap && material.envMap.mapping, envMapEncoding: getTextureEncodingFromMap( material.envMap, renderer.gammaInput ), @@ -18130,7 +18022,7 @@ function WebGLLights() { uniforms.coneCos = Math.cos( light.angle ); uniforms.penumbraCos = Math.cos( light.angle * ( 1 - light.penumbra ) ); - uniforms.decay = ( light.distance === 0 ) ? 0.0 : light.decay; + uniforms.decay = light.decay; uniforms.shadow = light.castShadow; @@ -18191,7 +18083,7 @@ function WebGLLights() { uniforms.color.copy( light.color ).multiplyScalar( light.intensity ); uniforms.distance = light.distance; - uniforms.decay = ( light.distance === 0 ) ? 0.0 : light.decay; + uniforms.decay = light.decay; uniforms.shadow = light.castShadow; @@ -19793,6 +19685,20 @@ function WebGLState( gl, extensions, utils, capabilities ) { } + function texImage3D() { + + try { + + gl.texImage3D.apply( gl, arguments ); + + } catch ( error ) { + + console.error( 'THREE.WebGLState:', error ); + + } + + } + // function scissor( scissor ) { @@ -19885,6 +19791,7 @@ function WebGLState( gl, extensions, utils, capabilities ) { bindTexture: bindTexture, compressedTexImage2D: compressedTexImage2D, texImage2D: texImage2D, + texImage3D: texImage3D, scissor: scissor, viewport: viewport, @@ -19998,6 +19905,14 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils, if ( ! capabilities.isWebGL2 ) return glFormat; + if ( glFormat === _gl.RED ) { + + if ( glType === _gl.FLOAT ) return _gl.R32F; + if ( glType === _gl.HALF_FLOAT ) return _gl.R16F; + if ( glType === _gl.UNSIGNED_BYTE ) return _gl.R8; + + } + if ( glFormat === _gl.RGB ) { if ( glType === _gl.FLOAT ) return _gl.RGB32F; @@ -20167,6 +20082,23 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils, } + function setTexture3D( texture, slot ) { + + var textureProperties = properties.get( texture ); + + if ( texture.version > 0 && textureProperties.__version !== texture.version ) { + + uploadTexture( textureProperties, texture, slot ); + return; + + } + + state.activeTexture( _gl.TEXTURE0 + slot ); + state.bindTexture( _gl.TEXTURE_3D, textureProperties.__webglTexture ); + + } + + function setTextureCube( texture, slot ) { var textureProperties = properties.get( texture ); @@ -20356,6 +20288,19 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils, function uploadTexture( textureProperties, texture, slot ) { + var textureType; + + if ( texture.isDataTexture3D ) { + + textureType = _gl.TEXTURE_3D; + + } else { + + textureType = _gl.TEXTURE_2D; + + } + + if ( textureProperties.__webglInit === undefined ) { textureProperties.__webglInit = true; @@ -20367,9 +20312,12 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils, info.memory.textures ++; } - state.activeTexture( _gl.TEXTURE0 + slot ); - state.bindTexture( _gl.TEXTURE_2D, textureProperties.__webglTexture ); + + + state.bindTexture( textureType, textureProperties.__webglTexture ); + + _gl.pixelStorei( _gl.UNPACK_FLIP_Y_WEBGL, texture.flipY ); _gl.pixelStorei( _gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultiplyAlpha ); @@ -20388,7 +20336,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils, glType = utils.convert( texture.type ), glInternalFormat = getInternalFormat( glFormat, glType ); - setTextureParameters( _gl.TEXTURE_2D, texture, isPowerOfTwoImage ); + setTextureParameters( textureType, texture, isPowerOfTwoImage ); var mipmap, mipmaps = texture.mipmaps; @@ -20501,6 +20449,11 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils, textureProperties.__maxMipLevel = mipmaps.length - 1; + } else if ( texture.isDataTexture3D ) { + + state.texImage3D( _gl.TEXTURE_3D, 0, glInternalFormat, image.width, image.height, image.depth, 0, glFormat, glType, image.data ); + textureProperties.__maxMipLevel = 0; + } else { // regular Texture (image, video, canvas) @@ -20784,6 +20737,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils, } this.setTexture2D = setTexture2D; + this.setTexture3D = setTexture3D; this.setTextureCube = setTextureCube; this.setTextureCubeDynamic = setTextureCubeDynamic; this.setupRenderTarget = setupRenderTarget; @@ -20842,6 +20796,7 @@ function WebGLUtils( gl, extensions, capabilities ) { if ( p === LuminanceAlphaFormat ) return gl.LUMINANCE_ALPHA; if ( p === DepthFormat ) return gl.DEPTH_COMPONENT; if ( p === DepthStencilFormat ) return gl.DEPTH_STENCIL; + if ( p === RedFormat ) return gl.RED; if ( p === AddEquation ) return gl.FUNC_ADD; if ( p === SubtractEquation ) return gl.FUNC_SUBTRACT; @@ -20974,6 +20929,77 @@ Group.prototype = Object.assign( Object.create( Object3D.prototype ), { } ); +/** + * @author mrdoob / http://mrdoob.com/ + * @author mikael emtinger / http://gomo.se/ + * @author WestLangley / http://github.com/WestLangley +*/ + +function Camera() { + + Object3D.call( this ); + + this.type = 'Camera'; + + this.matrixWorldInverse = new Matrix4(); + + this.projectionMatrix = new Matrix4(); + this.projectionMatrixInverse = new Matrix4(); + +} + +Camera.prototype = Object.assign( Object.create( Object3D.prototype ), { + + constructor: Camera, + + isCamera: true, + + copy: function ( source, recursive ) { + + Object3D.prototype.copy.call( this, source, recursive ); + + this.matrixWorldInverse.copy( source.matrixWorldInverse ); + + this.projectionMatrix.copy( source.projectionMatrix ); + this.projectionMatrixInverse.copy( source.projectionMatrixInverse ); + + return this; + + }, + + getWorldDirection: function ( target ) { + + if ( target === undefined ) { + + console.warn( 'THREE.Camera: .getWorldDirection() target is now required' ); + target = new Vector3(); + + } + + this.updateMatrixWorld( true ); + + var e = this.matrixWorld.elements; + + return target.set( - e[ 8 ], - e[ 9 ], - e[ 10 ] ).normalize(); + + }, + + updateMatrixWorld: function ( force ) { + + Object3D.prototype.updateMatrixWorld.call( this, force ); + + this.matrixWorldInverse.getInverse( this.matrixWorld ); + + }, + + clone: function () { + + return new this.constructor().copy( this ); + + } + +} ); + /** * @author mrdoob / http://mrdoob.com/ * @author greggman / http://games.greggman.com/ @@ -22172,7 +22198,13 @@ function WebGLRenderer( parameters ) { // vr - var vr = ( 'xr' in navigator ) ? new WebXRManager( _this ) : new WebVRManager( _this ); + var vr = null; + + if ( typeof navigator !== 'undefined' ) { + + vr = ( 'xr' in navigator ) ? new WebXRManager( _this ) : new WebVRManager( _this ); + + } this.vr = vr; @@ -22366,13 +22398,6 @@ function WebGLRenderer( parameters ) { }; - this.clearTarget = function ( renderTarget, color, depth, stencil ) { - - this.setRenderTarget( renderTarget ); - this.clear( color, depth, stencil ); - - }; - // this.dispose = function () { @@ -23742,6 +23767,12 @@ function WebGLRenderer( parameters ) { } + } else if ( material.isMeshMatcapMaterial ) { + + refreshUniformsCommon( m_uniforms, material ); + + refreshUniformsMatcap( m_uniforms, material ); + } else if ( material.isMeshDepthMaterial ) { refreshUniformsCommon( m_uniforms, material ); @@ -24153,6 +24184,40 @@ function WebGLRenderer( parameters ) { } + function refreshUniformsMatcap( uniforms, material ) { + + if ( material.matcap ) { + + uniforms.matcap.value = material.matcap; + + } + + if ( material.bumpMap ) { + + uniforms.bumpMap.value = material.bumpMap; + uniforms.bumpScale.value = material.bumpScale; + if ( material.side === BackSide ) uniforms.bumpScale.value *= - 1; + + } + + if ( material.normalMap ) { + + uniforms.normalMap.value = material.normalMap; + uniforms.normalScale.value.copy( material.normalScale ); + if ( material.side === BackSide ) uniforms.normalScale.value.negate(); + + } + + if ( material.displacementMap ) { + + uniforms.displacementMap.value = material.displacementMap; + uniforms.displacementScale.value = material.displacementScale; + uniforms.displacementBias.value = material.displacementBias; + + } + + } + function refreshUniformsDepth( uniforms, material ) { if ( material.displacementMap ) { @@ -24270,6 +24335,17 @@ function WebGLRenderer( parameters ) { }() ); + this.setTexture3D = ( function () { + + // backwards compatibility: peel texture.texture + return function setTexture3D( texture, slot ) { + + textures.setTexture3D( texture, slot ); + + }; + + }() ); + this.setTexture = ( function () { var warned = false; @@ -31606,6 +31682,128 @@ MeshLambertMaterial.prototype.copy = function ( source ) { }; +/** + * @author WestLangley / http://github.com/WestLangley + * + * parameters = { + * color: , + * opacity: , + * + * matcap: new THREE.Texture( ), + * + * map: new THREE.Texture( ), + * + * bumpMap: new THREE.Texture( ), + * bumpScale: , + * + * normalMap: new THREE.Texture( ), + * normalMapType: THREE.TangentSpaceNormalMap, + * normalScale: , + * + * displacementMap: new THREE.Texture( ), + * displacementScale: , + * displacementBias: , + * + * alphaMap: new THREE.Texture( ), + * + * skinning: , + * morphTargets: , + * morphNormals: + * } + */ + +function MeshMatcapMaterial( parameters ) { + + Material.call( this ); + + this.defines = { 'MATCAP': '' }; + + this.type = 'MeshMatcapMaterial'; + + this.color = new Color( 0xffffff ); // diffuse + + this.matcap = null; + + this.map = null; + + this.bumpMap = null; + this.bumpScale = 1; + + this.normalMap = null; + this.normalMapType = TangentSpaceNormalMap; + this.normalScale = new Vector2( 1, 1 ); + + this.displacementMap = null; + this.displacementScale = 1; + this.displacementBias = 0; + + this.alphaMap = null; + + this.skinning = false; + this.morphTargets = false; + this.morphNormals = false; + + this.lights = false; + + this.setValues( parameters ); + + // a matcap is required + + if ( this.matcap === null ) { + + var canvas = document.createElement( 'canvas' ); + canvas.width = 1; + canvas.height = 1; + + var context = canvas.getContext( '2d' ); + + context.fillStyle = '#fff'; + context.fillRect( 0, 0, 1, 1 ); + + this.matcap = new THREE.CanvasTexture( canvas ); + + } + +} + +MeshMatcapMaterial.prototype = Object.create( Material.prototype ); +MeshMatcapMaterial.prototype.constructor = MeshMatcapMaterial; + +MeshMatcapMaterial.prototype.isMeshMatcapMaterial = true; + +MeshMatcapMaterial.prototype.copy = function ( source ) { + + Material.prototype.copy.call( this, source ); + + this.defines = { 'MATCAP': '' }; + + this.color.copy( source.color ); + + this.matcap = source.matcap; + + this.map = source.map; + + this.bumpMap = source.bumpMap; + this.bumpScale = source.bumpScale; + + this.normalMap = source.normalMap; + this.normalMapType = source.normalMapType; + this.normalScale.copy( source.normalScale ); + + this.displacementMap = source.displacementMap; + this.displacementScale = source.displacementScale; + this.displacementBias = source.displacementBias; + + this.alphaMap = source.alphaMap; + + this.skinning = source.skinning; + this.morphTargets = source.morphTargets; + this.morphNormals = source.morphNormals; + + return this; + +}; + /** * @author alteredq / http://alteredqualia.com/ * @@ -31669,6 +31867,7 @@ var Materials = /*#__PURE__*/Object.freeze({ MeshDepthMaterial: MeshDepthMaterial, MeshDistanceMaterial: MeshDistanceMaterial, MeshBasicMaterial: MeshBasicMaterial, + MeshMatcapMaterial: MeshMatcapMaterial, LineDashedMaterial: LineDashedMaterial, LineBasicMaterial: LineBasicMaterial, Material: Material @@ -34895,6 +35094,148 @@ PointLight.prototype = Object.assign( Object.create( Light.prototype ), { } ); +/** + * @author alteredq / http://alteredqualia.com/ + * @author arose / http://github.com/arose + */ + +function OrthographicCamera( left, right, top, bottom, near, far ) { + + Camera.call( this ); + + this.type = 'OrthographicCamera'; + + this.zoom = 1; + this.view = null; + + this.left = left; + this.right = right; + this.top = top; + this.bottom = bottom; + + this.near = ( near !== undefined ) ? near : 0.1; + this.far = ( far !== undefined ) ? far : 2000; + + this.updateProjectionMatrix(); + +} + +OrthographicCamera.prototype = Object.assign( Object.create( Camera.prototype ), { + + constructor: OrthographicCamera, + + isOrthographicCamera: true, + + copy: function ( source, recursive ) { + + Camera.prototype.copy.call( this, source, recursive ); + + this.left = source.left; + this.right = source.right; + this.top = source.top; + this.bottom = source.bottom; + this.near = source.near; + this.far = source.far; + + this.zoom = source.zoom; + this.view = source.view === null ? null : Object.assign( {}, source.view ); + + return this; + + }, + + setViewOffset: function ( fullWidth, fullHeight, x, y, width, height ) { + + if ( this.view === null ) { + + this.view = { + enabled: true, + fullWidth: 1, + fullHeight: 1, + offsetX: 0, + offsetY: 0, + width: 1, + height: 1 + }; + + } + + this.view.enabled = true; + this.view.fullWidth = fullWidth; + this.view.fullHeight = fullHeight; + this.view.offsetX = x; + this.view.offsetY = y; + this.view.width = width; + this.view.height = height; + + this.updateProjectionMatrix(); + + }, + + clearViewOffset: function () { + + if ( this.view !== null ) { + + this.view.enabled = false; + + } + + this.updateProjectionMatrix(); + + }, + + updateProjectionMatrix: function () { + + var dx = ( this.right - this.left ) / ( 2 * this.zoom ); + var dy = ( this.top - this.bottom ) / ( 2 * this.zoom ); + var cx = ( this.right + this.left ) / 2; + var cy = ( this.top + this.bottom ) / 2; + + var left = cx - dx; + var right = cx + dx; + var top = cy + dy; + var bottom = cy - dy; + + if ( this.view !== null && this.view.enabled ) { + + var zoomW = this.zoom / ( this.view.width / this.view.fullWidth ); + var zoomH = this.zoom / ( this.view.height / this.view.fullHeight ); + var scaleW = ( this.right - this.left ) / this.view.width; + var scaleH = ( this.top - this.bottom ) / this.view.height; + + left += scaleW * ( this.view.offsetX / zoomW ); + right = left + scaleW * ( this.view.width / zoomW ); + top -= scaleH * ( this.view.offsetY / zoomH ); + bottom = top - scaleH * ( this.view.height / zoomH ); + + } + + this.projectionMatrix.makeOrthographic( left, right, top, bottom, this.near, this.far ); + + this.projectionMatrixInverse.getInverse( this.projectionMatrix ); + + }, + + toJSON: function ( meta ) { + + var data = Object3D.prototype.toJSON.call( this, meta ); + + data.object.zoom = this.zoom; + data.object.left = this.left; + data.object.right = this.right; + data.object.top = this.top; + data.object.bottom = this.bottom; + data.object.near = this.near; + data.object.far = this.far; + + if ( this.view !== null ) data.object.view = Object.assign( {}, this.view ); + + return data; + + } + +} ); + /** * @author mrdoob / http://mrdoob.com/ */ @@ -36827,6 +37168,7 @@ Object.assign( MaterialLoader.prototype, { if ( json.fog !== undefined ) material.fog = json.fog; if ( json.flatShading !== undefined ) material.flatShading = json.flatShading; if ( json.blending !== undefined ) material.blending = json.blending; + if ( json.combine !== undefined ) material.combine = json.combine; if ( json.side !== undefined ) material.side = json.side; if ( json.opacity !== undefined ) material.opacity = json.opacity; if ( json.transparent !== undefined ) material.transparent = json.transparent; @@ -36960,6 +37302,7 @@ Object.assign( MaterialLoader.prototype, { if ( json.specularMap !== undefined ) material.specularMap = getTexture( json.specularMap ); if ( json.envMap !== undefined ) material.envMap = getTexture( json.envMap ); + if ( json.envMapIntensity !== undefined ) material.envMapIntensity = json.envMapIntensity; if ( json.reflectivity !== undefined ) material.reflectivity = json.reflectivity; @@ -37465,9 +37808,10 @@ Object.assign( JSONLoader.prototype, { var scope = this; - var texturePath = this.texturePath && ( typeof this.texturePath === 'string' ) ? this.texturePath : LoaderUtils.extractUrlBase( url ); + var path = ( this.path === undefined ) ? LoaderUtils.extractUrlBase( url ) : this.path; var loader = new FileLoader( this.manager ); + loader.setPath( this.path ); loader.setWithCredentials( this.withCredentials ); loader.load( url, function ( text ) { @@ -37491,23 +37835,30 @@ Object.assign( JSONLoader.prototype, { } - var object = scope.parse( json, texturePath ); + var object = scope.parse( json, path ); onLoad( object.geometry, object.materials ); }, onProgress, onError ); }, - setCrossOrigin: function ( value ) { + setPath: function ( value ) { - this.crossOrigin = value; + this.path = value; return this; }, - setTexturePath: function ( value ) { + setResourcePath: function ( value ) { - this.texturePath = value; + this.resourcePath = value; + return this; + + }, + + setCrossOrigin: function ( value ) { + + this.crossOrigin = value; return this; }, @@ -37955,7 +38306,7 @@ Object.assign( JSONLoader.prototype, { } - return function parse( json, texturePath ) { + return function parse( json, path ) { if ( json.data !== undefined ) { @@ -37990,7 +38341,7 @@ Object.assign( JSONLoader.prototype, { } else { - var materials = Loader.prototype.initMaterials( json.materials, texturePath, this.crossOrigin ); + var materials = Loader.prototype.initMaterials( json.materials, this.resourcePath || path, this.crossOrigin ); return { geometry: geometry, materials: materials }; @@ -45800,6 +46151,17 @@ function BinaryTextureLoader( manager ) { } +Object.assign( JSONLoader.prototype, { + + setTexturePath: function ( value ) { + + console.warn( 'THREE.JSONLoader: .setTexturePath() has been renamed to .setResourcePath().' ); + return this.setResourcePath( value ); + + } + +} ); + // Object.assign( Box2.prototype, { @@ -46695,6 +47057,14 @@ Object.defineProperties( ShaderMaterial.prototype, { Object.assign( WebGLRenderer.prototype, { + clearTarget: function ( renderTarget, color, depth, stencil ) { + + console.warn( 'THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead.' ); + this.setRenderTarget( renderTarget ); + this.clear( color, depth, stencil ); + + }, + animate: function ( callback ) { console.warn( 'THREE.WebGLRenderer: .animate() is now .setAnimationLoop().' ); @@ -47248,4 +47618,4 @@ function LensFlare() { } -export { WebGLRenderTargetCube, WebGLRenderTarget, WebGLRenderer, ShaderLib, UniformsLib, UniformsUtils, ShaderChunk, FogExp2, Fog, Scene, Sprite, LOD, SkinnedMesh, Skeleton, Bone, Mesh, LineSegments, LineLoop, Line, Points, Group, VideoTexture, DataTexture, CompressedTexture, CubeTexture, CanvasTexture, DepthTexture, Texture, CompressedTextureLoader, DataTextureLoader, CubeTextureLoader, TextureLoader, ObjectLoader, MaterialLoader, BufferGeometryLoader, DefaultLoadingManager, LoadingManager, JSONLoader, ImageLoader, ImageBitmapLoader, FontLoader, FileLoader, Loader, LoaderUtils, Cache, AudioLoader, SpotLightShadow, SpotLight, PointLight, RectAreaLight, HemisphereLight, DirectionalLightShadow, DirectionalLight, AmbientLight, LightShadow, Light, StereoCamera, PerspectiveCamera, OrthographicCamera, CubeCamera, ArrayCamera, Camera, AudioListener, PositionalAudio, AudioContext, AudioAnalyser, Audio, VectorKeyframeTrack, StringKeyframeTrack, QuaternionKeyframeTrack, NumberKeyframeTrack, ColorKeyframeTrack, BooleanKeyframeTrack, PropertyMixer, PropertyBinding, KeyframeTrack, AnimationUtils, AnimationObjectGroup, AnimationMixer, AnimationClip, Uniform, InstancedBufferGeometry, BufferGeometry, Geometry, InterleavedBufferAttribute, InstancedInterleavedBuffer, InterleavedBuffer, InstancedBufferAttribute, Face3, Object3D, Raycaster, Layers, EventDispatcher, Clock, QuaternionLinearInterpolant, LinearInterpolant, DiscreteInterpolant, CubicInterpolant, Interpolant, Triangle, _Math as Math, Spherical, Cylindrical, Plane, Frustum, Sphere, Ray, Matrix4, Matrix3, Box3, Box2, Line3, Euler, Vector4, Vector3, Vector2, Quaternion, Color, ImmediateRenderObject, VertexNormalsHelper, SpotLightHelper, SkeletonHelper, PointLightHelper, RectAreaLightHelper, HemisphereLightHelper, GridHelper, PolarGridHelper, FaceNormalsHelper, DirectionalLightHelper, CameraHelper, BoxHelper, Box3Helper, PlaneHelper, ArrowHelper, AxesHelper, Shape, Path, ShapePath, Font, CurvePath, Curve, ImageUtils, ShapeUtils, WebGLUtils, WireframeGeometry, ParametricGeometry, ParametricBufferGeometry, TetrahedronGeometry, TetrahedronBufferGeometry, OctahedronGeometry, OctahedronBufferGeometry, IcosahedronGeometry, IcosahedronBufferGeometry, DodecahedronGeometry, DodecahedronBufferGeometry, PolyhedronGeometry, PolyhedronBufferGeometry, TubeGeometry, TubeBufferGeometry, TorusKnotGeometry, TorusKnotBufferGeometry, TorusGeometry, TorusBufferGeometry, TextGeometry, TextBufferGeometry, SphereGeometry, SphereBufferGeometry, RingGeometry, RingBufferGeometry, PlaneGeometry, PlaneBufferGeometry, LatheGeometry, LatheBufferGeometry, ShapeGeometry, ShapeBufferGeometry, ExtrudeGeometry, ExtrudeBufferGeometry, EdgesGeometry, ConeGeometry, ConeBufferGeometry, CylinderGeometry, CylinderBufferGeometry, CircleGeometry, CircleBufferGeometry, BoxGeometry, BoxBufferGeometry, ShadowMaterial, SpriteMaterial, RawShaderMaterial, ShaderMaterial, PointsMaterial, MeshPhysicalMaterial, MeshStandardMaterial, MeshPhongMaterial, MeshToonMaterial, MeshNormalMaterial, MeshLambertMaterial, MeshDepthMaterial, MeshDistanceMaterial, MeshBasicMaterial, LineDashedMaterial, LineBasicMaterial, Material, Float64BufferAttribute, Float32BufferAttribute, Uint32BufferAttribute, Int32BufferAttribute, Uint16BufferAttribute, Int16BufferAttribute, Uint8ClampedBufferAttribute, Uint8BufferAttribute, Int8BufferAttribute, BufferAttribute, ArcCurve, CatmullRomCurve3, CubicBezierCurve, CubicBezierCurve3, EllipseCurve, LineCurve, LineCurve3, QuadraticBezierCurve, QuadraticBezierCurve3, SplineCurve, REVISION, MOUSE, CullFaceNone, CullFaceBack, CullFaceFront, CullFaceFrontBack, FrontFaceDirectionCW, FrontFaceDirectionCCW, BasicShadowMap, PCFShadowMap, PCFSoftShadowMap, FrontSide, BackSide, DoubleSide, FlatShading, SmoothShading, NoColors, FaceColors, VertexColors, NoBlending, NormalBlending, AdditiveBlending, SubtractiveBlending, MultiplyBlending, CustomBlending, AddEquation, SubtractEquation, ReverseSubtractEquation, MinEquation, MaxEquation, ZeroFactor, OneFactor, SrcColorFactor, OneMinusSrcColorFactor, SrcAlphaFactor, OneMinusSrcAlphaFactor, DstAlphaFactor, OneMinusDstAlphaFactor, DstColorFactor, OneMinusDstColorFactor, SrcAlphaSaturateFactor, NeverDepth, AlwaysDepth, LessDepth, LessEqualDepth, EqualDepth, GreaterEqualDepth, GreaterDepth, NotEqualDepth, MultiplyOperation, MixOperation, AddOperation, NoToneMapping, LinearToneMapping, ReinhardToneMapping, Uncharted2ToneMapping, CineonToneMapping, UVMapping, CubeReflectionMapping, CubeRefractionMapping, EquirectangularReflectionMapping, EquirectangularRefractionMapping, SphericalReflectionMapping, CubeUVReflectionMapping, CubeUVRefractionMapping, RepeatWrapping, ClampToEdgeWrapping, MirroredRepeatWrapping, NearestFilter, NearestMipMapNearestFilter, NearestMipMapLinearFilter, LinearFilter, LinearMipMapNearestFilter, LinearMipMapLinearFilter, UnsignedByteType, ByteType, ShortType, UnsignedShortType, IntType, UnsignedIntType, FloatType, HalfFloatType, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedShort565Type, UnsignedInt248Type, AlphaFormat, RGBFormat, RGBAFormat, LuminanceFormat, LuminanceAlphaFormat, RGBEFormat, DepthFormat, DepthStencilFormat, RGB_S3TC_DXT1_Format, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format, RGB_PVRTC_4BPPV1_Format, RGB_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGBA_PVRTC_2BPPV1_Format, RGB_ETC1_Format, RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_10x10_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, LoopOnce, LoopRepeat, LoopPingPong, InterpolateDiscrete, InterpolateLinear, InterpolateSmooth, ZeroCurvatureEnding, ZeroSlopeEnding, WrapAroundEnding, TrianglesDrawMode, TriangleStripDrawMode, TriangleFanDrawMode, LinearEncoding, sRGBEncoding, GammaEncoding, RGBEEncoding, LogLuvEncoding, RGBM7Encoding, RGBM16Encoding, RGBDEncoding, BasicDepthPacking, RGBADepthPacking, TangentSpaceNormalMap, ObjectSpaceNormalMap, BoxGeometry as CubeGeometry, Face4, LineStrip, LinePieces, MeshFaceMaterial, MultiMaterial, PointCloud, Particle, ParticleSystem, PointCloudMaterial, ParticleBasicMaterial, ParticleSystemMaterial, Vertex, DynamicBufferAttribute, Int8Attribute, Uint8Attribute, Uint8ClampedAttribute, Int16Attribute, Uint16Attribute, Int32Attribute, Uint32Attribute, Float32Attribute, Float64Attribute, ClosedSplineCurve3, SplineCurve3, Spline, AxisHelper, BoundingBoxHelper, EdgesHelper, WireframeHelper, XHRLoader, BinaryTextureLoader, GeometryUtils, Projector, CanvasRenderer, SceneUtils, LensFlare }; +export { WebGLRenderTargetCube, WebGLRenderTarget, WebGLRenderer, ShaderLib, UniformsLib, UniformsUtils, ShaderChunk, FogExp2, Fog, Scene, Sprite, LOD, SkinnedMesh, Skeleton, Bone, Mesh, LineSegments, LineLoop, Line, Points, Group, VideoTexture, DataTexture, DataTexture3D, CompressedTexture, CubeTexture, CanvasTexture, DepthTexture, Texture, CompressedTextureLoader, DataTextureLoader, CubeTextureLoader, TextureLoader, ObjectLoader, MaterialLoader, BufferGeometryLoader, DefaultLoadingManager, LoadingManager, JSONLoader, ImageLoader, ImageBitmapLoader, FontLoader, FileLoader, Loader, LoaderUtils, Cache, AudioLoader, SpotLightShadow, SpotLight, PointLight, RectAreaLight, HemisphereLight, DirectionalLightShadow, DirectionalLight, AmbientLight, LightShadow, Light, StereoCamera, PerspectiveCamera, OrthographicCamera, CubeCamera, ArrayCamera, Camera, AudioListener, PositionalAudio, AudioContext, AudioAnalyser, Audio, VectorKeyframeTrack, StringKeyframeTrack, QuaternionKeyframeTrack, NumberKeyframeTrack, ColorKeyframeTrack, BooleanKeyframeTrack, PropertyMixer, PropertyBinding, KeyframeTrack, AnimationUtils, AnimationObjectGroup, AnimationMixer, AnimationClip, Uniform, InstancedBufferGeometry, BufferGeometry, Geometry, InterleavedBufferAttribute, InstancedInterleavedBuffer, InterleavedBuffer, InstancedBufferAttribute, Face3, Object3D, Raycaster, Layers, EventDispatcher, Clock, QuaternionLinearInterpolant, LinearInterpolant, DiscreteInterpolant, CubicInterpolant, Interpolant, Triangle, _Math as Math, Spherical, Cylindrical, Plane, Frustum, Sphere, Ray, Matrix4, Matrix3, Box3, Box2, Line3, Euler, Vector4, Vector3, Vector2, Quaternion, Color, ImmediateRenderObject, VertexNormalsHelper, SpotLightHelper, SkeletonHelper, PointLightHelper, RectAreaLightHelper, HemisphereLightHelper, GridHelper, PolarGridHelper, FaceNormalsHelper, DirectionalLightHelper, CameraHelper, BoxHelper, Box3Helper, PlaneHelper, ArrowHelper, AxesHelper, Shape, Path, ShapePath, Font, CurvePath, Curve, ImageUtils, ShapeUtils, WebGLUtils, WireframeGeometry, ParametricGeometry, ParametricBufferGeometry, TetrahedronGeometry, TetrahedronBufferGeometry, OctahedronGeometry, OctahedronBufferGeometry, IcosahedronGeometry, IcosahedronBufferGeometry, DodecahedronGeometry, DodecahedronBufferGeometry, PolyhedronGeometry, PolyhedronBufferGeometry, TubeGeometry, TubeBufferGeometry, TorusKnotGeometry, TorusKnotBufferGeometry, TorusGeometry, TorusBufferGeometry, TextGeometry, TextBufferGeometry, SphereGeometry, SphereBufferGeometry, RingGeometry, RingBufferGeometry, PlaneGeometry, PlaneBufferGeometry, LatheGeometry, LatheBufferGeometry, ShapeGeometry, ShapeBufferGeometry, ExtrudeGeometry, ExtrudeBufferGeometry, EdgesGeometry, ConeGeometry, ConeBufferGeometry, CylinderGeometry, CylinderBufferGeometry, CircleGeometry, CircleBufferGeometry, BoxGeometry, BoxBufferGeometry, ShadowMaterial, SpriteMaterial, RawShaderMaterial, ShaderMaterial, PointsMaterial, MeshPhysicalMaterial, MeshStandardMaterial, MeshPhongMaterial, MeshToonMaterial, MeshNormalMaterial, MeshLambertMaterial, MeshDepthMaterial, MeshDistanceMaterial, MeshBasicMaterial, MeshMatcapMaterial, LineDashedMaterial, LineBasicMaterial, Material, Float64BufferAttribute, Float32BufferAttribute, Uint32BufferAttribute, Int32BufferAttribute, Uint16BufferAttribute, Int16BufferAttribute, Uint8ClampedBufferAttribute, Uint8BufferAttribute, Int8BufferAttribute, BufferAttribute, ArcCurve, CatmullRomCurve3, CubicBezierCurve, CubicBezierCurve3, EllipseCurve, LineCurve, LineCurve3, QuadraticBezierCurve, QuadraticBezierCurve3, SplineCurve, REVISION, MOUSE, CullFaceNone, CullFaceBack, CullFaceFront, CullFaceFrontBack, FrontFaceDirectionCW, FrontFaceDirectionCCW, BasicShadowMap, PCFShadowMap, PCFSoftShadowMap, FrontSide, BackSide, DoubleSide, FlatShading, SmoothShading, NoColors, FaceColors, VertexColors, NoBlending, NormalBlending, AdditiveBlending, SubtractiveBlending, MultiplyBlending, CustomBlending, AddEquation, SubtractEquation, ReverseSubtractEquation, MinEquation, MaxEquation, ZeroFactor, OneFactor, SrcColorFactor, OneMinusSrcColorFactor, SrcAlphaFactor, OneMinusSrcAlphaFactor, DstAlphaFactor, OneMinusDstAlphaFactor, DstColorFactor, OneMinusDstColorFactor, SrcAlphaSaturateFactor, NeverDepth, AlwaysDepth, LessDepth, LessEqualDepth, EqualDepth, GreaterEqualDepth, GreaterDepth, NotEqualDepth, MultiplyOperation, MixOperation, AddOperation, NoToneMapping, LinearToneMapping, ReinhardToneMapping, Uncharted2ToneMapping, CineonToneMapping, UVMapping, CubeReflectionMapping, CubeRefractionMapping, EquirectangularReflectionMapping, EquirectangularRefractionMapping, SphericalReflectionMapping, CubeUVReflectionMapping, CubeUVRefractionMapping, RepeatWrapping, ClampToEdgeWrapping, MirroredRepeatWrapping, NearestFilter, NearestMipMapNearestFilter, NearestMipMapLinearFilter, LinearFilter, LinearMipMapNearestFilter, LinearMipMapLinearFilter, UnsignedByteType, ByteType, ShortType, UnsignedShortType, IntType, UnsignedIntType, FloatType, HalfFloatType, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedShort565Type, UnsignedInt248Type, AlphaFormat, RGBFormat, RGBAFormat, LuminanceFormat, LuminanceAlphaFormat, RGBEFormat, DepthFormat, DepthStencilFormat, RedFormat, RGB_S3TC_DXT1_Format, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format, RGB_PVRTC_4BPPV1_Format, RGB_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGBA_PVRTC_2BPPV1_Format, RGB_ETC1_Format, RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_10x10_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, LoopOnce, LoopRepeat, LoopPingPong, InterpolateDiscrete, InterpolateLinear, InterpolateSmooth, ZeroCurvatureEnding, ZeroSlopeEnding, WrapAroundEnding, TrianglesDrawMode, TriangleStripDrawMode, TriangleFanDrawMode, LinearEncoding, sRGBEncoding, GammaEncoding, RGBEEncoding, LogLuvEncoding, RGBM7Encoding, RGBM16Encoding, RGBDEncoding, BasicDepthPacking, RGBADepthPacking, TangentSpaceNormalMap, ObjectSpaceNormalMap, BoxGeometry as CubeGeometry, Face4, LineStrip, LinePieces, MeshFaceMaterial, MultiMaterial, PointCloud, Particle, ParticleSystem, PointCloudMaterial, ParticleBasicMaterial, ParticleSystemMaterial, Vertex, DynamicBufferAttribute, Int8Attribute, Uint8Attribute, Uint8ClampedAttribute, Int16Attribute, Uint16Attribute, Int32Attribute, Uint32Attribute, Float32Attribute, Float64Attribute, ClosedSplineCurve3, SplineCurve3, Spline, AxisHelper, BoundingBoxHelper, EdgesHelper, WireframeHelper, XHRLoader, BinaryTextureLoader, GeometryUtils, Projector, CanvasRenderer, SceneUtils, LensFlare }; diff --git a/docs/api/en/core/BufferAttribute.html b/docs/api/en/core/BufferAttribute.html index 053f0689b254b7..e4c1bcf1bdd590 100644 --- a/docs/api/en/core/BufferAttribute.html +++ b/docs/api/en/core/BufferAttribute.html @@ -35,12 +35,12 @@

[name]( [param:TypedArray array], [param:Integer itemSize], [param:Boolean n attribute is storing a 3-component vector (such as a position, normal, or color), then itemSize should be 3.

- [page:Boolean normalized] -- (optional) Indicates how the underlying data in the buffer maps - to the values in the GLSL code. For instance, if [page:TypedArray array] is an instance of - UInt16Array, and [page:Boolean normalized] is true, the values 0 - +65535 in the array + [page:Boolean normalized] -- (optional) Applies to integer data only. Indicates how the underlying data + in the buffer maps to the values in the GLSL code. For instance, if [page:TypedArray array] is an instance + of UInt16Array, and [page:Boolean normalized] is true, the values 0 - +65535 in the array data will be mapped to 0.0f - +1.0f in the GLSL attribute. An Int16Array (signed) would map from -32767 - +32767 to -1.0f - +1.0f. If [page:Boolean normalized] is false, the values - will be converted to floats which contain the exact value, i.e. 32767 becomes 32767.0f. + will be converted to floats unmodified, i.e. 32767 becomes 32767.0f.

Properties

@@ -99,12 +99,12 @@

[property:Boolean normalized]

[property:Function onUploadCallback]

- A callback function that is executed after the Renderer has transfered the attribute array data to the GPU. + A callback function that is executed after the Renderer has transferred the attribute array data to the GPU.

[property:Object updateRange]

Object containing:
- [page:Integer offset]: Default is *0*. Position at whcih to start update.
+ [page:Integer offset]: Default is *0*. Position at which to start update.
[page:Integer count]: Default is *-1*, which means don't use update ranges.

This can be used to only update some components of stored vectors (for example, just the component @@ -120,6 +120,9 @@

Methods

[method:BufferAttribute clone]()

Return a copy of this bufferAttribute.

+

[method:BufferAttribute copy]( [param:BufferAttribute bufferAttribute] )

+

Copies another BufferAttribute to this BufferAttribute.

+

[method:BufferAttribute copyArray]( array )

Copy the array given here (which can be a normal array or TypedArray) into [page:BufferAttribute.array array].

@@ -160,7 +163,7 @@

[method:null onUpload]( [param:Function callback] )

Sets the value of the onUploadCallback property.

In the [example:webgl_buffergeometry WebGL / Buffergeometry] this is used to free memory - after the buffer has been transfered to the GPU. + after the buffer has been transferred to the GPU.

[method:BufferAttribute set] ( [param:Array value], [param:Integer offset] )

diff --git a/docs/api/en/core/Face3.html b/docs/api/en/core/Face3.html index 887dc6a6aaf038..c641a5d09aa0ab 100644 --- a/docs/api/en/core/Face3.html +++ b/docs/api/en/core/Face3.html @@ -124,7 +124,7 @@

[method:Face3 clone]()

Creates a new clone of the Face3 object.

[method:Face3 copy]( [param:Face3 face3] )

-

Copy the paramaters of another Face3 into this.

+

Copy the parameters of another Face3 into this.

Source

diff --git a/docs/api/en/core/Layers.html b/docs/api/en/core/Layers.html index 39d1e7690a3004..6a83d2b7d9301e 100644 --- a/docs/api/en/core/Layers.html +++ b/docs/api/en/core/Layers.html @@ -21,6 +21,11 @@

[name]

All classes that inherit from [page:Object3D] have an [page:Object3D.layers] property which is an instance of this class.

+

Examples

+ +

+ [example:webgl_layers WebGL / layers] +

Constructor

diff --git a/docs/api/en/core/Raycaster.html b/docs/api/en/core/Raycaster.html index 39ee74fc8c5d07..da504c11ada75c 100644 --- a/docs/api/en/core/Raycaster.html +++ b/docs/api/en/core/Raycaster.html @@ -147,7 +147,7 @@

[method:null setFromCamera]( [param:Vector2 coords], [param:Camera camera] )

[method:Array intersectObject]( [param:Object3D object], [param:Boolean recursive], [param:Array optionalTarget] )

[page:Object3D object] — The object to check for intersection with the ray.
- [page:Boolean recursive] — If true, it also checks all descendants. Otherwise it only checks intersecton with the object. Default is false.
+ [page:Boolean recursive] — If true, it also checks all descendants. Otherwise it only checks intersection with the object. Default is false.
[page:Array optionalTarget] — (optional) target to set the result. Otherwise a new [page:Array] is instantiated. If set, you must clear this array prior to each call (i.e., array.length = 0;).

@@ -174,7 +174,7 @@

[method:Array intersectObject]( [param:Object3D object], [param:Boolean recu

[method:Array intersectObjects]( [param:Array objects], [param:Boolean recursive], [param:Array optionalTarget] )

[page:Array objects] — The objects to check for intersection with the ray.
- [page:Boolean recursive] — If true, it also checks all descendants of the objects. Otherwise it only checks intersecton with the objects. Default is false.
+ [page:Boolean recursive] — If true, it also checks all descendants of the objects. Otherwise it only checks intersection with the objects. Default is false.
[page:Array optionalTarget] — (optional) target to set the result. Otherwise a new [page:Array] is instantiated. If set, you must clear this array prior to each call (i.e., array.length = 0;).

diff --git a/docs/api/en/core/Uniform.html b/docs/api/en/core/Uniform.html index 00c0afbc8e448e..a34ab47136b3df 100644 --- a/docs/api/en/core/Uniform.html +++ b/docs/api/en/core/Uniform.html @@ -201,7 +201,7 @@

Methods

[method:Uniform clone]()

Returns a clone of this uniform.
- If the uniform's value property is an [page:Object] with a clone() method, this is used, otherwise the value is copied by assigment. + If the uniform's value property is an [page:Object] with a clone() method, this is used, otherwise the value is copied by assignment. Array values are shared between cloned [page:Uniform]s.

See [example:webgldeferred_animation WebGL deferred animation] for an example of this method in use.

diff --git a/docs/api/en/lights/PointLight.html b/docs/api/en/lights/PointLight.html index db0ca22d0bb4e5..9308b6f9e9d4ce 100644 --- a/docs/api/en/lights/PointLight.html +++ b/docs/api/en/lights/PointLight.html @@ -45,8 +45,7 @@

[name]( [param:Integer color], [param:Float intensity], [param:Number distan

[page:Integer color] - (optional) hexadecimal color of the light. Default is 0xffffff (white).
[page:Float intensity] - (optional) numeric value of the light's strength/intensity. Default is 1.

- [page:Number distance] - The distance from the light where the intensity is 0. - When set to 0, then the light never stops. Default is 0.
+ [page:Number distance] - Maximum range of the light. Default is 0 (no limit).
[page:Float decay] - The amount the light dims along the distance of the light. Default is 1. For [page:WebGLRenderer.physicallyCorrectLights physically correct] lighting, set this to 2.

@@ -67,8 +66,19 @@

[property:Float decay]

[property:Float distance]

- If non-zero, light will attenuate linearly from maximum intensity at the light's - position down to zero at this distance from the light. Default is *0.0*. + Default mode — When distance is zero, light does not attenuate. When distance is + non-zero, light will attenuate linearly from maximum intensity at the light's position down to + zero at this distance from the light. +

+

+ [page:WebGLRenderer.physicallyCorrectLights Physically correct] mode — When distance + is zero, light will attenuate according to inverse-square law to infinite distance. When + distance is non-zero, light will attenuate according to inverse-square law until near the + distance cutoff, where it will then attenuate quickly and smoothly to 0. Inherently, cutoffs + are not physically correct. +

+

+ Default is *0.0*.

[property:Boolean isPointLight]

diff --git a/docs/api/en/lights/SpotLight.html b/docs/api/en/lights/SpotLight.html index f21fed3d5dd2c9..b276add5943377 100644 --- a/docs/api/en/lights/SpotLight.html +++ b/docs/api/en/lights/SpotLight.html @@ -71,8 +71,7 @@

[name]( [param:Integer color], [param:Float intensity], [param:Float distanc

[page:Integer color] - (optional) hexadecimal color of the light. Default is 0xffffff (white).
[page:Float intensity] - (optional) numeric value of the light's strength/intensity. Default is 1.

- [page:Float distance] - Maximum distance from origin where light will shine whose intensity - is attenuated linearly based on distance from origin.
+ [page:Float distance] - Maximum range of the light. Default is 0 (no limit).
[page:Radians angle] - Maximum angle of light dispersion from its direction whose upper bound is Math.PI/2.
[page:Float penumbra] - Percent of the spotlight cone that is attenuated due to penumbra. @@ -109,8 +108,19 @@

[property:Float decay]

[property:Float distance]

- If non-zero, light will attenuate linearly from maximum intensity at the light's - position down to zero at this distance from the light. Default is *0.0*. + Default mode — When distance is zero, light does not attenuate. When distance is + non-zero, light will attenuate linearly from maximum intensity at the light's position down to + zero at this distance from the light. +

+

+ [page:WebGLRenderer.physicallyCorrectLights Physically correct] mode — When distance + is zero, light will attenuate according to inverse-square law to infinite distance. When + distance is non-zero, light will attenuate according to inverse-square law until near the + distance cutoff, where it will then attenuate quickly and smoothly to 0. Inherently, cutoffs + are not physically correct. +

+

+ Default is *0.0*.

[property:Boolean isSpotLight]

diff --git a/docs/api/en/loaders/JSONLoader.html b/docs/api/en/loaders/JSONLoader.html index c6a0d3c780cfa4..aa76001b16b0f2 100644 --- a/docs/api/en/loaders/JSONLoader.html +++ b/docs/api/en/loaders/JSONLoader.html @@ -93,23 +93,27 @@

[method:null load]( [param:String url], [param:Function onLoad], [param:Func Begin loading from url and pass the JSON to onLoad.

+

[method:Object3D parse]( [param:Object json], [param:String path] )

+

+ [page:String json] — JSON object to parse.
+ [page:String path] — Base path for resources if no resource path is defined.

+ + Parse a JSON structure and return an [page:object] containing the parsed [page:Geometry geometry] and [page:Array materials]. +

+

[method:JSONLoader setCrossOrigin]( [param:String value] )

Set the [page:.crossOrigin] attribute.

-

[method:JSONLoader setTexturePath]( [param:String texturePath] )

+

[method:JSONLoader setPath]( [param:String value] )

- Set the base path or URL from which to load files. This can be useful if - you are loading many files from the same directory. + Set the base path for the original file.

-

[method:Object3D parse]( [param:Object json], [param:String texturePath] )

+

[method:JSONLoader setResourcePath]( [param:String value] )

- [page:String json] — JSON object to parse.
- [page:String texturePath] — Base path for textures.

- - Parse a JSON structure and return an [page:object] containing the parsed [page:Geometry geometry] and [page:Array materials]. + Set the base path for dependent resources like textures.

Source

diff --git a/docs/api/en/renderers/WebGLRenderer.html b/docs/api/en/renderers/WebGLRenderer.html index 37a648184a0f50..17a6c3c7b8c842 100644 --- a/docs/api/en/renderers/WebGLRenderer.html +++ b/docs/api/en/renderers/WebGLRenderer.html @@ -302,17 +302,6 @@

[method:null clearDepth]( )

[method:null clearStencil]( )

Clear the stencil buffers. Equivalent to calling [page:WebGLRenderer.clear .clear]( false, false, true ).

-

[method:null clearTarget]([param:WebGLRenderTarget renderTarget], [param:boolean color], [param:boolean depth], [param:boolean stencil])

-

- renderTarget -- The [page:WebGLRenderTarget renderTarget] that needs to be cleared.
- color -- If set, then the color gets cleared.
- depth -- If set, then the depth gets cleared.
- stencil -- If set, then the stencil gets cleared. -

-

- This method clears a rendertarget. To do this, it activates the rendertarget. -

-

[method:null compile]( [param:Scene scene], [param:Camera camera] )

Compiles all materials in the scene with the camera. This is useful to precompile shaders before the first rendering.

diff --git a/docs/api/en/textures/Texture.html b/docs/api/en/textures/Texture.html index 51e9858f0962b5..73ed49d0201e80 100644 --- a/docs/api/en/textures/Texture.html +++ b/docs/api/en/textures/Texture.html @@ -149,7 +149,7 @@

[property:Vector2 repeat]

[property:number rotation]

- How much the texture is rotated around the center point, in radians. Postive values are counter-clockwise. Default is *0*. + How much the texture is rotated around the center point, in radians. Positive values are counter-clockwise. Default is *0*.

[property:Vector2 center]

diff --git a/docs/api/zh/Polyfills.html b/docs/api/zh/Polyfills.html new file mode 100644 index 00000000000000..32402166cf0833 --- /dev/null +++ b/docs/api/zh/Polyfills.html @@ -0,0 +1,46 @@ + + + + + + + + + + + +

Polyfills

+ +

Three.js includes polyfills for the following functions and constants.

+ +

[page:Number.EPSILON Number.EPSILON]

+

+ The difference between one and the smallest value greater than one that can be represented as a Number. + [link:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/EPSILON MDN reference]. +

+ +

[page:Math.sign Math.sign]( [page:Number x] )

+

+ If the argument is a positive number, negative number, positive zero or negative zero, + the function will return 1, -1, 0 or -0 respectively. Otherwise, NaN is returned. + [link:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/sign MDN reference]. +

+ +

[page:Function.prototype.name Function.prototype.name]( [page:Number x] )

+

+ Returns the name of a function, or (before ES6 implementations) an empty string for anonymous functions. + [link:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/name MDN reference]. +

+ +

[page:Object.assign Object.assign]( [page:Object target], [page:Object ...sources] )

+

+ The Object.assign() method is used to copy the values of all enumerable own properties from one or more source objects to a target object. + It will return the target object. + [link:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign MDN reference]. +

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/polyfills.js src/polyfills.js] + + diff --git a/docs/api/zh/Template.html b/docs/api/zh/Template.html new file mode 100644 index 00000000000000..aa44df9badaaef --- /dev/null +++ b/docs/api/zh/Template.html @@ -0,0 +1,48 @@ + + + + + + + + + + + [page:Geometry] → + +

[name]

+ +

todo

+ + +

Example

+ + todo + + +

Constructor

+ +

[name]([param:Number todo])

+

+ + +

Properties

+ +

[property:Number todo]

+

+ todo +

+ + +

Methods

+ +

[method:null todo]()

+

todo

+

todo

+ + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/animation/AnimationAction.html b/docs/api/zh/animation/AnimationAction.html new file mode 100644 index 00000000000000..c1133f3c1da9b3 --- /dev/null +++ b/docs/api/zh/animation/AnimationAction.html @@ -0,0 +1,317 @@ + + + + + + + + + + +

[name]

+ +

+ AnimationActions 用来调度存储在[page:AnimationClip AnimationClips]中的动画。

+ + 说明: AnimationAction的大多数方法都可以链式调用

+ + 在使用手册的“下一步”章节中,“动画系统”一文对three.js动画系统中的不同元素作出了概述。 +

+ + +

构造器

+ + +

[name]( [param:AnimationMixer mixer], [param:AnimationClip clip], [param:Object3D localRoot] )

+

+ [page:AnimationMixer mixer] - 被此动作控制的 *动画混合器*
+ [page:AnimationClip clip] - *动画剪辑* 保存了此动作当中的动画数据
+ [page:Object3D localRoot] - 动作执行的根对象

+ + 说明: 不要直接调用这个构造函数,而应该先用[page:AnimationMixer.clipAction]实例化一个AnimationAction,因为这个方法提供了缓存以提高性能。 +

+ + +

属性

+ + +

[property:Boolean clampWhenFinished]

+

+ 如果 *clampWhenFinished* 值设为true, 那么动画将在最后一帧之后自动暂停([page:.paused paused])

+ + 如果 *clampWhenFinished* 值为false, [page:.enabled enabled] 属性值将在动作的最后一次循环完成之后自动改为false, 那么这个动作以后就不会再执行。

+ + 默认值为false

+ + 说明: 动作如果被中断了,*clampWhenFinished*将无效 (只有当最后一次循环执行完毕之后才能起效) +

+ +

[property:Boolean enabled]

+

+ *enabled* 值设为*false*会禁用动作, 也就是无效.默认值是*true*

+ + 当*enabled*被重新置为*true*, 动画将从当前时间([page:.time time])继续 + (将 *enabled* 置为 *false* 不会重置此次动作)

+ + 说明: 将*enabled*置为*true*不会让动画自动重新开始。只有满足以下条件时才会马上重新开始: + 暂停([page:.paused paused])值为*false*, 同时动作没有失效 (执行停止([page:.stop stop])命令或重置([page:.reset reset])命令, + 且权重([page:.weight weight])和时间比例([page:.timeScale timeScale])都不能为0 + +

+ +

[property:Number loop]

+

+ 循环模式 (可以通过[page:.setLoop setLoop]改变)。默认值是 + [page:Animation THREE.LoopRepeat] (重复[page:.repetitions repetitions]次数无穷)

+ + 必须是以下值之一:

+ [page:Animation THREE.LoopOnce] - 只执行一次
+ [page:Animation THREE.LoopRepeat] - 重复次数为*repetitions*的值, 且每次循环结束时候将回到起始动作开始下一次循环。
+ [page:Animation THREE.LoopPingPong] - 重复次数为*repetitions*的值, 且像乒乓球一样在起始点与结束点之间来回循环。 +

+ +

[property:Boolean paused]

+

+ *paused*置为*true*会通过将动作的有效时间比例改为0来使动作暂停执行。默认值是*false*

+

+ +

[property:Number repetitions]

+

+ 整个动作过程动画剪辑([page:AnimationClip])执行的次数,可以通过[page:.setLoop setLoop]修改。默认值是*Infinity*

+ 如果循环模式([page:.loop loop mode])值被设置为[page:Animation THREE.LoopOnce],repetitions值将会无效。 + +

+ +

[property:Number time]

+

+ 动作开始的时间点 (单位是秒, 从0开始计时).

+ + 这个值被限定在 0到clip.duration(根据循环状态)范围之内. 可以通过改变时间比例([page:.timeScale timeScale]) (使用 + [page:.setEffectiveTimeScale setEffectiveTimeScale] 或者 [page:.setDuration setDuration])来将它相对于全局的混合器缩放.
+

+ +

[property:Number timeScale]

+

+ 时间([page:.time time])的比例因子. 值为0时会使动画暂停。值为负数时动画会反向执行。默认值是1。

+ 关于*timeScale*属性/方法 (不同于 *time*) 有: + [page:.getEffectiveTimeScale getEffectiveTimeScale], + [page:.halt halt], + [page:.paused paused], + [page:.setDuration setDuration], + [page:.setEffectiveTimeScale setEffectiveTimeScale], + [page:.stopWarping stopWarping], + [page:.syncWith syncWith], + [page:.warp warp]. +

+ +

[property:Number weight]

+

+ 动作的影响程度 (取值范围[0, 1]). 0 (无影响)到1(完全影响)之间的值可以用来混合多个动作。默认值是1

+ 关于*weight*的属性/方法有: + [page:.crossFadeFrom crossFadeFrom], + [page:.crossFadeTo crossFadeTo], + [page:.enabled enabled], + [page:.fadeIn fadeIn], + [page:.fadeOut fadeOut], + [page:.getEffectiveWeight getEffectiveWeight], + [page:.setEffectiveWeight setEffectiveWeight], + [page:.stopFading stopFading]. +

+ +

[property:Boolean zeroSlopeAtEnd]

+

+ 启用平滑插值,无须单独剪辑开始、循环和结束。默认值是*true* +

+ +

[property:Boolean zeroSlopeAtStart]

+

+ 启用平滑插值,无须单独剪辑开始、循环和结束。默认值是*true* +

+ + +

方法

+ + +

[method:AnimationAction crossFadeFrom]( [param:AnimationAction fadeOutAction], [param:Number durationInSeconds], [param:Boolean warpBoolean] )

+

+ 在传入的时间段内,让此动作淡入([page:.fadeIn fade in]),同时让另一个动作淡出。此方法可链式调用。

+ + 如果warpBoolean值是true, 额外的 [page:.warp warping] (时间比例的渐变)将会被应用。

+ + 说明: 与 *fadeIn*/*fadeOut*一样, 淡入淡出动作开始/结束时的权重是1. + +

+ +

[method:AnimationAction crossFadeTo]( [param:AnimationAction fadeInAction], [param:Number durationInSeconds], [param:Boolean warpBoolean] )

+

+ 在传入的时间段内, 让此动作淡出([page:.fadeOut fade out]),同时让另一个动作淡入。此方法可链式调用。

+ 如果warpBoolean值是true, 额外的 [page:.warp warping] (时间比例的渐变)将会被应用。

+ + 说明: 与 *fadeIn*/*fadeOut*一样, 淡入淡出动作开始/结束时的权重是1. +

+ +

[method:AnimationAction fadeIn]( [param:Number durationInSeconds] )

+

+ 在传入的时间间隔内,逐渐将此动作的权重([page:.weight weight])由0升到1。此方法可链式调用。 +

+ +

[method:AnimationAction fadeOut]( [param:Number durationInSeconds] )

+

+ 在传入的时间间隔内,逐渐将此动作的权重([page:.weight weight])由1降至0。此方法可链式调用。 +

+ +

[method:Number getEffectiveTimeScale]()

+

+ 返回有效时间比例(考虑当前的变形状态和[page:.paused paused]值). +

+ +

[method:number getEffectiveWeight]()

+

+ 返回影响权重(考虑当前淡入淡出状态和[page:.enabled enabled]的值). +

+ +

[method:AnimationClip getClip]()

+

+ 返回存有此动作的动画数据的剪辑 +

+ +

[method:AnimationMixer getMixer]()

+

+ 返回负责完成此动作的混合器 +

+ +

[method:Object3D getRoot]()

+

+ 返回执行此动作的根对象 +

+ +

[method:AnimationAction halt]( [param:Number durationInSeconds] )

+

+ 在传入的时间间隔内,通过从当前值开始逐渐降低时间比例([page:.timeScale timeScale])使动画逐渐减速至0。此方法可链式调用。 +

+ +

[method:Boolean isRunning]()

+

+ 返回当前此动作的时间([page:.time time])是否正在流逝

+ + 除了在混合器中被激活之外 (参见[page:.isScheduled isScheduled])必须满足以下条件才会返回true: + [page:.paused paused]值等于false, [page:.enabled enabled]值为true, + [page:.timeScale timeScale]值不为0, 而且没有安排延时启动([page:.startAt startAt]).

+ + 说明 *isRunning* 为true并不意味着此动画一定会切实地被看到。仅当权重([page:.weight weight])被设置为非零值时才是这种情况。 +

+ +

[method:Boolean isScheduled]()

+

+ 如果动作是在混合器中被激活的,返回true。

+ 说明: 这并不意味着动画正在执行中 (需要额外判断[page:.isRunning isRunning]值) +

+ +

[method:AnimationAction play]()

+

+ 让混合器激活动作。此方法可链式调用。

+ + 说明: 激活动作并不意味着动画会立刻开始: 如果动作在此之前已经完成(到达最后一次循环的结尾),或者如果已经设置了延时 + 启动(通过 [page:.startAt startAt]),则必须先执行重置操作([page:.reset reset])。 一些其它的设置项 ([page:.paused paused]=true, [page:.enabled enabled]=false, + [page:.weight weight]=0, [page:.timeScale timeScale]=0) 也可以阻止动画的开始。 +

+ +

[method:AnimationAction reset]()

+

+ 重置动作。此方法可链式调用。

+ + 该方法会将暂停值 [page:.paused paused] 设为false, 启用值[page:.enabled enabled] 设为true,时间值 + [page:.time time]设为0, 中断任何预定的淡入淡出和变形, 以及移除内部循环次数以及延迟启动。

+ + 说明: 停止方法[page:.stop stop]内调用了重置方法(reset), 但是 .*reset*不会调用 .*stop*。 + 这就表示: 如果你想要这两者, 重置并且停止, 不要调用*reset*; 而应该调用*stop*。 +

+ +

[method:AnimationAction setDuration]( [param:Number durationInSeconds] )

+

+ 设置单此循环的持续时间(通过调整时间比例([page:.timeScale timeScale])以及停用所有的变形)。此方法可以链式调用。 +

+ +

[method:AnimationAction setEffectiveTimeScale]( [param:Number timeScale] )

+

+ 设置时间比例([page:.timeScale timeScale])以及停用所有的变形)。 此方法可以链式调用。

+ + 如果暂停 ([page:.paused paused])值为false, 有效的时间比例(一个内部属性) 也会被设为该值; 否则有效时间比例 (直接影响当前动画 + 将会被设为0.

+ + 说明: 如果时间比例.*timeScale* 被此方法设为0,暂停值*paused*不会被自动改为*true*。 +

+ +

[method:AnimationAction setEffectiveWeight]( [param:Number weight] )

+

+ 设置权重([page:.weight weight])以及停止所有淡入淡出。该方法可以链式调用。

+ + 如果启用属性([page:.enabled enabled])为true, 那么有效权重(一个内部属性) 也会被设为该值; 否则有效权重 (直接影响当前动画)将会被设为0.

+ + 说明: 如果该方法将权重*weight*值设为0,启用值*enabled*不会被自动改为*false*。 +

+ +

[method:AnimationAction setLoop]( [param:Number loopMode], [param:Number repetitions] )

+

+ 设置循环([page:.loop loop mode])及循环重复次数([page:.repetitions repetitions])。改方法可被链式调用。 +

+ +

[method:AnimationAction startAt]( [param:Number startTimeInSeconds] )

+

+ 定义延时启动的事件 (通常会传入[page:AnimationMixer.time] + + deltaTimeInSeconds)。 该方法可以链式调用。

+ + 说明: 如果 *startAt*方法是和[page:.play play]方法一起链式调用, 或者动画已经在混合器中被激活 (通过先行调用*play*, 同时没有停止或重置),动画将仅在给定时间开始. +

+ +

[method:AnimationAction stop]()

+

+ 让混合器停止动作。该方法可以被链式调用。

+ + 动作会马上停止以及完全[page:.reset 重置].

+ + 说明: 你可以通过[page:AnimationMixer.stopAllAction mixer.stopAllAction]在一个混合器中一举停止所有处于激活态的动作。 +

+ +

[method:AnimationAction stopFading]()

+

+ 停止动作中所有预定的淡入淡出([page:.fadeIn fading])。该方法可以被链式调用。 +

+ +

[method:AnimationAction stopWarping]()

+

+ 停用动作中所有预定的变形[page:.warp warping]。该方法可被链式调用。 +

+ +

[method:AnimationAction syncWith]( [param:AnimationAction otherAction] )

+

+ 将此动作与传入的其它动作同步。此方法可被链式调用。

+ + 同步是通过将动作的时间([page:.time time])或时间比例([page:.timeScale timeScale])与另一动作设置一致来实现的 + (停用所有预定的变形)。

+ + 说明: 另一动作的 *time* 和 *timeScale*未来变化将不会被检测到. +

+ +

[method:AnimationAction warp]( [param:Number startTimeScale], [param:Number endTimeScale], [param:Number durationInSeconds] )

+

+ 在传入的事件间隔内,通过逐渐将时间比例[page:.timeScale timeScale]由*startTimeScale*修改至*endTimeScale*来改变回放速度。该方法可被链式调用。 +

+ + +

事件

+ + +

+ 有两个事件分别表示了单次循环的结束和全部动作的结束,你可以这样对它们做出响应: +

+ + mixer.addEventListener( 'loop', function( e ) { …} ); // properties of e: type, action and loopDelta + mixer.addEventListener( 'finished', function( e ) { …} ); // properties of e: type, action and direction + + +

源码

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/animation/AnimationClip.html b/docs/api/zh/animation/AnimationClip.html new file mode 100644 index 00000000000000..2f496f0d24e53d --- /dev/null +++ b/docs/api/zh/animation/AnimationClip.html @@ -0,0 +1,134 @@ + + + + + + + + + + +

[name]

+ +

+ 动画剪辑(AnimationClip)是一个可重用的关键帧轨道集,它代表动画。

+ + 在使用手册的“下一步”章节中,“动画系统”一文对three.js动画系统中的不同元素作出了概述 +

+ + +

构造器

+ + +

[name]( [param:String name], [param:Number duration], [param:Array tracks] )

+

+ [page:String name] - 此剪辑的名称
+ [page:Number duration] - 持续时间 (单位秒). 如果传入负数, 持续时间将会从传入的数组中计算得到。
+ [page:Array tracks] - 一个由关键帧轨道([page:KeyframeTrack KeyframeTracks])组成的数组。

+ + 说明: 与其直接调用构造函数实例化一个动画剪辑, 不如使用其静态方法中的一个来创建: + 用JSON ([page:.parse parse]), 用变形目标序列([page:.CreateFromMorphTargetSequence CreateFromMorphTargetSequence], + [page:.CreateClipsFromMorphTargetSequences CreateClipsFromMorphTargetSequences])或者用动画层级 ([page:.parseAnimation parseAnimation])来创建 - 如果你的模型中几何体的动画数组中还没有保存动画剪辑的话。 + +

+ + +

属性

+ + +

[property:Number duration]

+

+ 剪辑的持续时间 (单位秒). 可以通过[page:.resetDuration resetDuration]从轨道数组([page:.tracks tracks])计算出来。 + +

+ +

[property:String name]

+

+ 剪辑的名称. 调用[page:.findByName findByName]根据名称搜索某个剪辑 +

+ +

[property:Array tracks]

+

+ 一个包含该剪辑中有动画的所有属性的关键帧轨道([page:KeyframeTrack])的数组。 +

+ +

[property:String uuid]

+

+ 剪辑实例的[link:http://en.wikipedia.org/wiki/Universally_unique_identifier UUID],自动分配且不可编辑。 + +

+ + +

方法

+ + +

[method:this optimize]()

+

+ 通过移除等效的顺序键(在变形目标序列中很常见)来优化每一个轨道 + +

+ +

[method:this resetDuration]()

+

+ 将剪辑的持续时间([page:.duration duration])设为最长的关键帧轨道([page:KeyframeTrack])的持续时间。 + . +

+ +

[method:this trim]()

+

+ 修剪所有的轨道到该剪辑的持续时间。 +

+ +

[method:Boolean validate]()

+

+ 对剪辑中的每个轨道执行最小验证。如果所有轨道都有效,返回true。 +

+ + +

静态方法

+ + +

[method:Array CreateClipsFromMorphTargetSequences]( [param:String name], [param:Array morphTargetSequence], [param:Number fps], [param:Boolean noLoop] )

+

+ 返回从几何体的变形目标序列([page:Geometry.morphTargets morph + target sequences])创建的新动画剪辑(AnimationClip)数组,并尝试将变形目标名称分类为基于动画组的模式,如“Walk_001、Walk_002、Run_001、Run_002……”。

+ + 该方法被[page:JSONLoader]内部调用, 并且它使用了 + [page:.CreateFromMorphTargetSequence CreateFromMorphTargetSequence]. +

+ +

[method:AnimationClip CreateFromMorphTargetSequence]( [param:String name], [param:Array morphTargetSequence], [param:Number fps], [param:Boolean noLoop] )

+

+ 返回一个由几何体变形目标数组([page:Geometry.morphTargets morph targets array])得到的新动画剪辑,接收名称和帧率参数。

+ + 说明: 帧率是必须参数, 但是动画速度可能会在*AnimationAction*中被[page:AnimationAction.setDuration animationAction.setDuration]方法重写。 + +

+ +

[method:AnimationClip findByName]( [param:Object objectOrClipArray], [param:String name] )

+

+ 根据名称搜索动画剪辑(AnimationClip), 接收一个动画剪辑数组或者一个包含名为"animation"的数组的网格(或几何体)作为第一个参数。 +

+ +

[method:AnimationClip parse]( [param:Object json] )

+

+ 解析剪辑的JSON表示,并返回一个动画剪辑(AnimationClip)。 +

+ +

[method:AnimationClip parseAnimation]( [param:Object animation], [param:Array bones] )

+

+ 解析动画层级格式并返回动画剪辑。 +

+ +

[method:Object toJSON]( [param:AnimationClip clip] )

+

+ 接收一个动画剪辑为参数并返回一个JSON对象. +

+ + +

源码

+ + + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/animation/AnimationMixer.html b/docs/api/zh/animation/AnimationMixer.html new file mode 100644 index 00000000000000..5f7c3b29809e28 --- /dev/null +++ b/docs/api/zh/animation/AnimationMixer.html @@ -0,0 +1,101 @@ + + + + + + + + + + +

[name]

+ +

+ 动画混合器是用于场景中特定对象的动画的播放器。当场景中的多个对象独立动画时,每个对象都可以使用同一个动画混合器。

+ + 在使用手册的“下一步”章节中,“动画系统”一文对three.js动画系统中的不同元素作出了概述 +

+ + +

构造器

+ + +

[name]( [param:Object3D rootObject] )

+

+ [page:Object3D rootObject] - 混合器播放的动画所属的对象
+

+ + +

属性

+ + +

[property:Number time]

+

+ 全局的混合器时间(单位秒; 混合器创建的时刻记作0时刻) +

+ +

[property:Number timeScale]

+

+ 全局时间([page:.time mixer time])的比例因子

+ + 说明: 将混合器的时间比例设为0, 稍后再设置为1,可以暂停/取消暂停由该混合器控制的所有动作。 +

+ + +

方法

+ + +

[method:AnimationAction clipAction]([param:AnimationClip clip], [param:Object3D optionalRoot])

+

+ 返回所传入的剪辑参数的[page:AnimationAction], 根对象参数可选,默认值为混合器的默认根对象。第一个参数可以是动画剪辑([page:AnimationClip])对象或者动画剪辑的名称。

+ + 如果不存在符合传入的剪辑和根对象这两个参数的动作, 该方法将会创建一个。传入相同的参数多次调用将会返回同一个剪辑实例。 +

+ +

[method:AnimationAction existingAction]([param:AnimationClip clip], [param:Object3D optionalRoot])

+

+ 返回传入剪辑的已有[page:AnimationAction], 根对象参数可选,默认值为混合器的默认根对象。

+ + 第一个参数可以是动画剪辑([page:AnimationClip])对象或者动画剪辑的名称。 +

+ +

[method:Object3D getRoot]()

+

+ 返回混合器的根对象 +

+ +

[method:AnimationMixer stopAllAction]()

+

+ 停用混合器上所有预定的动作 +

+ +

[method:AnimationMixer update]([param:Number deltaTimeInSeconds])

+

+ 推进混合器时间并更新动画

+ + 通常在渲染循环中完成, 传入按照混合器的时间比例([page:.timeScale timeScale])缩放过的[page:Clock.getDelta clock.getDelta] +

+ +

[method:null uncacheClip]([param:AnimationClip clip])

+ +

+ 释放剪辑的所有内存资源 +

+ +

[method:null uncacheRoot]([param:Object3D root])

+

+ 释放根对象的所有内存资源 +

+ +

[method:null uncacheAction]([param:AnimationClip clip], [param:Object3D optionalRoot])

+

+ 释放动作的所有内存资源 +

+ + +

源码

+ + + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/animation/AnimationObjectGroup.html b/docs/api/zh/animation/AnimationObjectGroup.html new file mode 100644 index 00000000000000..752cf26920f697 --- /dev/null +++ b/docs/api/zh/animation/AnimationObjectGroup.html @@ -0,0 +1,82 @@ + + + + + + + + + + +

[name]

+ +

接收共享动画状态的一组对象。

+ + 在使用手册的“下一步”章节中,“动画系统”一文对three.js动画系统中的不同元素作出了概述 +

+ +

用法:

+ +

+ 将本来要作为根对象传入构造器或者动画混合器([page:AnimationMixer AnimationMixer])的[page:AnimationMixer.clipAction clipAction]方法中的对象加入组中,并将这个组对象作为根对象传递。 +

+ + 注意,这个类的实例作为混合器中的一个对象,因此,必须对组内的单个对象做缓存控制。 +

+ + +

限制

+

+ 动画属性必须在组中的所有对象之间兼容。

+ + 单个属性可以通过目标组控制或者直接控制,但不能两者同时。 +

+ + +

构造器

+ + +

[name]( [param:object obj1], [param:object obj2], [param:object obj3], ... )

+ [page:object obj] - 共享同一动画状态的任意数量的网格
+ + +

属性

+ + +

[property:object stats]

+

+ 一个包含此动画对象组(AnimationObjectGroup)的一些信息的对象 (总数, 使用中的数量,绑定到每个对象上的数量) + +

+ +

[property:String uuid]

+

+ 这个动画对象组(AnimationObjectGroup)的[link:http://en.wikipedia.org/wiki/Universally_unique_identifier UUID]。它是自动分配的,不可被编辑。 +

+ + +

方法

+ + +

[method:null add]( [param:object obj1], [param:object obj2], [param:object obj3], ... )

+

+ 将任意数量的对象添加到这个动画对象组(AnimationObjectGroup)。 +

+ +

[method:null remove]( [param:object obj1], [param:object obj2], [param:object obj3], ... )

+

+ 将任意数量的对象从这个动画对象组(AnimationObjectGroup)中删除。 +

+ +

[method:null uncache]( [param:object obj1], [param:object obj2], [param:object obj3], ... )

+

+ 释放此动画对象组(AnimationObjectGroup)传递的对象的所有内存资源 +

+ + +

源码

+ + + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/animation/AnimationUtils.html b/docs/api/zh/animation/AnimationUtils.html new file mode 100644 index 00000000000000..0c6880a4fb0a98 --- /dev/null +++ b/docs/api/zh/animation/AnimationUtils.html @@ -0,0 +1,59 @@ + + + + + + + + + + +

[name]

+ +

+ 一个提供各种动画辅助方法的对象,内部使用。 +

+ + +

方法

+ + +

[method:Array arraySlice]( array, from, to )

+

+ 和Array.prototype.slice作用一样, 但也适用于类型化数组. +

+ +

[method:Array convertArray]( array, type, forceClone )

+

+ 将数组转换为某种特定类型。 +

+ +

[method:Array flattenJSON]( jsonKeys, times, values, valuePropertyName )

+

+ 用于解析AOS关键帧格式。 +

+ +

[method:Array getKeyframeOrder]( times )

+

+ 返回一个数组,时间和值可以根据此数组排序。 +

+ +

[method:Boolean isTypedArray]( object )

+

+ 如果该对象是类型化数组,返回*true* + +

+ +

[method:Array sortedArray]( values, stride, order )

+

+ 将[page:AnimationUtils.getKeyframeOrder getKeyframeOrder]方法返回的数组排序。 + +

+ + +

源码

+ + + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/animation/KeyframeTrack.html b/docs/api/zh/animation/KeyframeTrack.html new file mode 100644 index 00000000000000..3586631ee63657 --- /dev/null +++ b/docs/api/zh/animation/KeyframeTrack.html @@ -0,0 +1,231 @@ + + + + + + + + + + + +

[name]

+ +

+ 关键帧轨道(KeyframeTrack)是关键帧([link:https://en.wikipedia.org/wiki/Key_frame keyframes])的定时序列, + 它由时间和相关值的列表组成, 用来让一个对象的某个特定属性动起来。 +

+ +

+ 在使用手册的“下一步”章节中,“动画系统”一文对three.js动画系统中的不同元素作出了概述 +

+ +

+ 和[link:https://github.com/mrdoob/three.js/wiki/JSON-Model-format-3 JSON model format]的动画层级相反, + 关键帧轨道(KeyframeTrack)不会将单帧作为对象存储在“key”数组(一个存有每一帧的时间和值的地方)中。 + +

+ +

+ 关键帧轨道(KeyframeTrack)中总是存在两个数组:[page:.times times]数组按顺序存储该轨道的所有关键帧的时间值,而[page:.values values]数组包含动画属性的相应更改值。 +

+ +

+ 值数组中的每一个成员,属于某一特定时间点,不仅可以是一个简单的数字,还可以是(比如)一个向量(如果是位置动画)或者是一个四元数(如果是旋转动画)。 + 因此,值数组(也是一个平面阵列)的长度可能是时间数组的三四倍。 +

+ +

+ 与不同类型的动画值对应,存在若干关键帧轨道(KeyframeTrack)的子类,继承了它大多数属性和方法: +

+ +
    +
  • [page:BooleanKeyframeTrack]
  • +
  • [page:ColorKeyframeTrack]
  • +
  • [page:NumberKeyframeTrack]
  • +
  • [page:QuaternionKeyframeTrack]
  • +
  • [page:StringKeyframeTrack]
  • +
  • [page:VectorKeyframeTrack]
  • +
+ +

+ 可以在[link:https://threejs.org/examples/js/AnimationClipCreator.js]文件中找到用不同类型的关键帧轨道创建动画剪辑([page:AnimationClip AnimationClips])的示例。 +

+ +

+ 由于显式值仅针对存储在时间数组中的离散时间点指定,因此必须在两个时间点之间进行插值 +

+ +

+ 轨道的名称对于这个轨道与动画节点的特定属性的连接(由[page:PropertyBinding]完成)很重要。 +

+ + +

构造器

+ + +

[name]( [param:String name], [param:Array times], [param:Array values], [param:Constant interpolation] )

+

+ [page:String name] - 关键帧轨道(KeyframeTrack)的标识符.
+ [page:Array times] - 关键帧的时间数组, 被内部转化为 + [link:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float32Array Float32Array].
+ [page:Array values] - 与时间数组中的时间点相关的值组成的数组, 被内部转化为 + [link:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float32Array Float32Array].
+ [page:Constant interpolation] - 使用的插值类型。 参见 + [page:Animation Animation Constants] for possible values. Default is [page:Animation InterpolateLinear]. +

+ + +

属性

+ + +

[property:String name]

+

+ 轨道的名称可以指动画对象中的变形目标([page:Geometry.morphTargets morph targets])、骨骼([page:SkinnedMesh bones])或可能的其他值 + 查看[page:PropertyBinding.parseTrackName]可获知哪些形式的字符串可以解析出绑定的属性: +

+

+ 可以使用节点名称或uuid(尽管它需要位于传递到混合器的场景图节点的子树中)引用到某节点。或者, 如果轨道名称的首字符是点, + 该轨道会应用到传入到混合器的根节点上。 +

+ +

+ 通常,在该节点之后会直接指定一个属性。 但是也可以再指定一个子属性, 例如 如果只是想通过浮动轨道使X组件旋转,可使用 .rotation[x]。 +

+ +

+ 还可以使用对象名称来指定骨骼或多材质,例如:.bones[R_hand].scale;再比如,材料数组中的第四个材料的漫反射颜色的红通道可以通过 .materials[3].diffuse[r]访问到。 +

+ +

+ 属性绑定也会解析变形目标名称, 例如: .morphTargetInfluences[run] +

+ +

+ 说明: 轨道名称不一定得唯一。 多个轨道可驱动统一属性, 此时结果应该基于多个轨道之间根据其各自动作的权重的加权混合。 +

+ +

[property:Float32Array times]

+

+ 一个[link:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float32Array Float32Array]类型的值,由传入构造器中时间数组参数转化而来。 +

+ +

[property:Float32Array values]

+

+ 一个[link:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float32Array Float32Array]类型的值, + 由传入构造器中值数组参数转化而来 +

+ +

[property:Constant DefaultInterpolation]

+

+ 默认的参数插值类型: [page:Animation InterpolateLinear]. +

+ +

[property:Constant TimeBufferType ]

+

+ [link:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float32Array Float32Array], + 内部用于时间数组的缓冲区的类型 +

+ +

[property:Constant ValueBufferType ]

+

+ [link:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float32Array Float32Array], + 内部用于值数组的缓冲区的类型 +

+ + +

方法

+ + +

[method:null createInterpolant]()

+

+ 根据传入构造器中的插值类型参数,创建线性插值([page:LinearInterpolant LinearInterpolant]),立方插值([page:CubicInterpolant CubicInterpolant])或离散插值 + ([page:DiscreteInterpolant DiscreteInterpolant]) +

+ +

[method:null getInterpolation]()

+

+ 返回插值类型 +

+ +

[method:Number getValueSize]()

+

+ 返回每个值的大小(即[page:.values values]数组的长度除以[page:.times times]数组的长度 + +

+ +

[method:DiscreteInterpolant InterpolantFactoryMethodDiscrete]( [link:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float32Array result] )

+

+ 根据时间([page:KeyframeTrack.times times])和值([page:KeyframeTrack.times values])创建一个新的离散插值([page:DiscreteInterpolant DiscreteInterpolant])。 + 可传入一个Float32Array类型的变量来接收结果, 否则会自动创建一个长度适宜的新数组。 +

+ +

[method:null InterpolantFactoryMethodLinear]( [link:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float32Array result] )

+

+ 根据时间([page:KeyframeTrack.times times])和值([page:KeyframeTrack.times values])创建一个新的线性插值([page:LinearInterpolant LinearInterpolant])。 + 可传入一个Float32Array类型的变量来接收结果, 否则会自动创建一个长度适宜的新数组。 +

+ +

[method:null InterpolantFactoryMethodSmooth]( [link:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float32Array result] )

+

+ 根据时间([page:KeyframeTrack.times times])和值([page:KeyframeTrack.times values])创建一个新的立方插值([page:CubicInterpolant CubicInterpolant])。 + 可传入一个Float32Array类型的变量来接收结果, 否则会自动创建一个长度适宜的新数组。 +

+ +

[method:this optimize]()

+

+ 删除等效的顺序键,这些键在变形目标序列中很常见。 +

+ +

[method:this scale]()

+

+ 缩放所有关键帧的时间。

+ + 说明: 这个方法很有用,例如, 可用于转化为某一特定帧率(正如[page:AnimationClip.CreateFromMorphTargetSequence animationClip.CreateFromMorphTargetSequence]内部所做的一样)。 +

+ +

[method:this setInterpolation]( [param:Constant interpolationType] )

+

+ 设置插值类型。 参阅[page:Animation Animation Constants]以供选择。 +

+ +

[method:this shift]( [param:Number timeOffsetInSeconds] )

+

+ 及时删除之前或之后的所有关键帧。 +

+ + +

[method:this trim]( [param:Number startTimeInSeconds], [param:Number endTimeInSeconds] )

+

+ 删除开始时间(startTime)之前以及结束时间(endTime)之后的关键帧,不改变[*startTime*, *endTime*]范围内的任何值。 +

+ +

[method:Boolean validate]()

+

+ 在轨道上执行最小验证,有效则返回true +

+ +

+ 如果出现以下情况,该方法会在控制台输出错误日志: 轨道为空; [page:.valueSize value size]值不可靠; + [page:.times times]数组或[page:.values values]数组中的元素不是数字;*times*数组中的元素乱序。 +

+ +

静态方法

+ +

[method:KeyframeTrack parse]( [param:JSON json] )

+

+ 解析JSON对象并返回一个正确类型的新关键帧轨道。 +

+ +

[method:JSON toJSON]( [param:KeyframeTrack track] )

+

+ 将该轨道转化为JSON +

+ + +

源码

+ + + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/animation/PropertyBinding.html b/docs/api/zh/animation/PropertyBinding.html new file mode 100644 index 00000000000000..fc5b6218577481 --- /dev/null +++ b/docs/api/zh/animation/PropertyBinding.html @@ -0,0 +1,130 @@ + + + + + + + + + + +

[name]

+ +

+ 对场景图中某一真实属性的引用,内部使用。 +

+ + +

构造器

+ + +

[name]( [param:Object3D rootNode], path, parsedPath )

+

+ -- [page:Object3D rootNode]: + -- path + -- parsedPath (可选) + +

+ +

属性

+ +

[property:Number path]

+

+ +

+ +

[property:Number parsedPath]

+

+ +

+ +

[property:Number node]

+

+ +

+ +

[property:Number rootNode]

+

+ +

+ +

[property:Object BindingType]

+

+ +

+ +

[property:Object Versioning]

+

+ +

+ +

[property:Array GetterByBindingType]

+

+ +

+ +

[property:Array SetterByBindingTypeAndVersioning]

+

+ +

+ + + +

方法

+ +

[method:null getValue]( [param:Array targetArray], [param:Number offset] )

+

+

+ +

[method:null setValue]( [param:Array sourceArray], [param:Number offset] )

+

+

+ +

[method:null bind]( )

+

+ 为场景图中的属性创建 getter / setter对。 被[page:PropertyBinding.getValue getValue]和[page:PropertyBinding.setValue setValue]方法内部使用。 +

+ +

[method:null unbind]( )

+

+ 解绑场景图中某属性的getter / setter对。 +

+ +

[method:Constructor Composite]( targetGroup, path, optionalParsedPath )

+

+ 创建一个新的复合属性绑定(Composite PropertyBinding) +

+ +

[method:Constructor create]( root, path, parsedPath )

+

+ 创建一个新的复合属性绑定(Composite PropertyBinding) (如果根对象是[page:AnimationObjectGroup])或普通属性绑定 +

+ +

[method:Constructor parseTrackName]( trackName )

+

+ 匹配以下形式的字符串:
+ -- nodeName.property
+ -- nodeName.property[accessor]
+ -- nodeName.material.property[accessor]
+ -- uuid.property[accessor]
+ -- uuid.objectName[objectIndex].propertyName[propertyIndex]
+ -- parentName/nodeName.property
+ -- parentName/parentName/nodeName.property[index]
+ -- .bone[Armature.DEF_cog].position
+ -- scene:helium_balloon_model:helium_balloon_model.position +

+ +

[method:Constructor findNode]( root, nodeName )

+

+ 从节点树或骨骼([page:Skeleton Skeleton])中找出某节点 +

+ + + + +

源码

+ + + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/animation/PropertyMixer.html b/docs/api/zh/animation/PropertyMixer.html new file mode 100644 index 00000000000000..6759a6620e97a2 --- /dev/null +++ b/docs/api/zh/animation/PropertyMixer.html @@ -0,0 +1,97 @@ + + + + + + + + + + +

[name]

+ +

+ 允许加权累加的缓冲场景图属性,内部使用 +

+ + +

构造器

+ + +

[name]( [param:PropertyBinding binding], [param:String typeName], [param:Number valueSize] )

+

+ -- binding
+ -- typeName
+ -- valueSize
+

+ + +

属性

+ + +

[property:PropertyBinding binding]

+

+ +

+ +

[property:TypedArray buffer]

+

+ 大小为 4 * [page:PropertyMixer valueSize] 的缓冲区

+ 布局为: [ incoming | accu0 | accu1 | orig ]

+ 插值器可使用 .buffer 作为 .result 且数据会进入'incoming'区. + 'accu0'和'accu1'用于按帧交错累加‘incoming’中的数据并进行比较以侦测变化。'orig'存储着属性的原始状态。 +

+ +

[property:Number cumulativeWeight]

+

+ 默认值是0 +

+ +

[property:Number valueSize]

+

+ +

+ +

[property:Number referenceCount]

+

+ 默认值是0 +

+ +

[property:Number useCount]

+

+ 默认值是0 +

+ + +

方法

+ + +

[method:null accumulate]( [param:Number accuIndex], [param:Number weight] )

+

+ 将[page:PropertyMixer.buffer buffer][accuIndex]中'incoming'区的数据累加到'accu[i]'区中。
+ + 如果权值为0,则什么都不做。 +

+ +

[method:null apply]( [param:Number accuIndex] )

+

+ 当累加值不同时,将[page:PropertyMixer.buffer buffer] 'accu[i]区的状态应用于绑定. +

+ +

[method:null saveOriginalState]( )

+

+ 记住绑定属性的状态并复制到两个'accu'区中. +

+ +

[method:null restoreOriginalState]( )

+

+ 将预先通过'saveOriginalState'方法取得的状态应用于绑定。 +

+ + +

方法

+ + + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/animation/tracks/BooleanKeyframeTrack.html b/docs/api/zh/animation/tracks/BooleanKeyframeTrack.html new file mode 100644 index 00000000000000..bde94180807f44 --- /dev/null +++ b/docs/api/zh/animation/tracks/BooleanKeyframeTrack.html @@ -0,0 +1,78 @@ + + + + + + + + + + + + [page:KeyframeTrack] → + +

[name]

+ +

+ A Track of boolean keyframe values. +

+ + +

Constructor

+ + +

[name]( [param:String name], [param:Array times], [param:Array values] )

+

+ [page:String name] - (required) identifier for the KeyframeTrack.
+ [page:Array times] - (required) array of keyframe times.
+ [page:Array values] - values for the keyframes at the times specified.
+

+ + +

Properties

+ + +

+ See [page:KeyframeTrack] for inherited properties. +

+ +

[property:Constant DefaultInterpolation]

+

+ The default interpolation type to use, [page:Animation InterpolateDiscrete]. +

+ +

[property:Array ValueBufferType]

+

+ A normal Array (no Float32Array in this case, unlike *ValueBufferType* of [page:KeyframeTrack]). +

+ +

[property:String ValueTypeName]

+

+ String 'bool'. +

+ + +

Methods

+ + +

+ See [page:KeyframeTrack] for inherited methods. +

+ +

[method:null InterpolantFactoryMethodLinear ]()

+

+ The value of this method here is 'undefined', as it does not make sense for discrete properties. +

+ +

[method:null InterpolantFactoryMethodSmooth ]()

+

+ The value of this method here is 'undefined', as it does not make sense for discrete properties. +

+ + +

Source

+ + + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/animation/tracks/ColorKeyframeTrack.html b/docs/api/zh/animation/tracks/ColorKeyframeTrack.html new file mode 100644 index 00000000000000..898f0b5d7fed80 --- /dev/null +++ b/docs/api/zh/animation/tracks/ColorKeyframeTrack.html @@ -0,0 +1,62 @@ + + + + + + + + + + + + [page:KeyframeTrack] → + +

[name]

+ +

+ A Track of keyframe values that represent color changes.

+ The very basic implementation of this subclass has nothing special yet. However, this is the place + for color space parameterization. +

+ + +

Constructor

+ + +

[name]( [param:String name], [param:Array times], [param:Array values] )

+

+ [page:String name] - (required) identifier for the KeyframeTrack.
+ [page:Array times] - (required) array of keyframe times.
+ [page:Array values] - values for the keyframes at the times specified.
+ [page:Constant interpolation] - the type of interpolation to use. See + [page:Animation Animation Constants] for possible values. Default is + [page:Animation InterpolateLinear]. +

+ + +

Properties

+ + +

+ See [page:KeyframeTrack] for inherited properties. +

+ +

[property:String ValueTypeName]

+

+ String 'color'. +

+ + +

Methods

+ + +

+ See [page:KeyframeTrack] for inherited methods. +

+ +

Source

+ + + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/animation/tracks/NumberKeyframeTrack.html b/docs/api/zh/animation/tracks/NumberKeyframeTrack.html new file mode 100644 index 00000000000000..e17acfdda78496 --- /dev/null +++ b/docs/api/zh/animation/tracks/NumberKeyframeTrack.html @@ -0,0 +1,62 @@ + + + + + + + + + + + + [page:KeyframeTrack] → + +

[name]

+ +

+ A Track of numeric keyframe values. +

+ + +

Constructor

+ + +

[name]( [param:String name], [param:Array times], [param:Array values] )

+

+ [page:String name] - (required) identifier for the KeyframeTrack.
+ [page:Array times] - (required) array of keyframe times.
+ [page:Array values] - values for the keyframes at the times specified.
+ [page:Constant interpolation] - the type of interpolation to use. See + [page:Animation Animation Constants] for possible values. Default is + [page:Animation InterpolateLinear]. +

+ + +

Properties

+ + +

+ See [page:KeyframeTrack] for inherited properties. +

+ + +

[property:String ValueTypeName]

+

+ String 'number'. +

+ + +

Methods

+ + +

+ See [page:KeyframeTrack] for inherited methods. +

+ + +

Source

+ + + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/animation/tracks/QuaternionKeyframeTrack.html b/docs/api/zh/animation/tracks/QuaternionKeyframeTrack.html new file mode 100644 index 00000000000000..ffc56bcdeb4dd9 --- /dev/null +++ b/docs/api/zh/animation/tracks/QuaternionKeyframeTrack.html @@ -0,0 +1,73 @@ + + + + + + + + + + + + [page:KeyframeTrack] → + +

[name]

+ +

+ A Track of quaternion keyframe values. +

+ + +

Constructor

+ + +

[name]( [param:String name], [param:Array times], [param:Array values] )

+

+ [page:String name] (required) identifier for the KeyframeTrack.
+ [page:Array times] (required) array of keyframe times.
+ [page:Array values] values for the keyframes at the times specified.
+ [page:Constant interpolation] the type of interpolation to use. See + [page:Animation Animation Constants] for possible values. Default is + [page:Animation InterpolateLinear]. +

+ + +

Properties

+ + +

+ See [page:KeyframeTrack] for inherited properties. +

+ +

[property:Constant DefaultInterpolation]

+

+ The default interpolation type to use, [page:Animation InterpolateLinear]. +

+ +

[property:String ValueTypeName]

+

+ String 'quaternion'. +

+ + +

Methods

+ + +

+ See [page:KeyframeTrack] for inherited methods. +

+ +

[method:null InterpolantFactoryMethodLinear]()

+

+ Returns a new [page:QuaternionLinearInterpolant QuaternionLinearInterpolant] based on the + [page:KeyframeTrack.values values], [page:KeyframeTrack.times times] and + [page:KeyframeTrack.valueSize valueSize] of the keyframes. +

+ + +

Source

+ + + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/animation/tracks/StringKeyframeTrack.html b/docs/api/zh/animation/tracks/StringKeyframeTrack.html new file mode 100644 index 00000000000000..a34648f6733655 --- /dev/null +++ b/docs/api/zh/animation/tracks/StringKeyframeTrack.html @@ -0,0 +1,81 @@ + + + + + + + + + + + + [page:KeyframeTrack] → + +

[name]

+ +

+ A Track of string keyframe values. +

+ + +

Constructor

+ + +

[name]( [param:String name], [param:Array times], [param:Array values] )

+

+ [page:String name] - (required) identifier for the KeyframeTrack.
+ [page:Array times] - (required) array of keyframe times.
+ [page:Array values] - values for the keyframes at the times specified.
+ [page:Constant interpolation] - the type of interpolation to use. See + [page:Animation Animation Constants] for possible values. Default is + [page:Animation InterpolateDiscrete]. +

+ + +

Properties

+ + +

+ See [page:KeyframeTrack] for inherited properties. +

+ +

[property:Constant DefaultInterpolation]

+

+ The default interpolation type to use, [page:Animation InterpolateDiscrete]. +

+ +

[property:Array ValueBufferType]

+

+ A normal Array (no Float32Array in this case, unlike *ValueBufferType* of [page:KeyframeTrack]). +

+ +

[property:String ValueTypeName]

+

+ String 'string'. +

+ + +

Methods

+ + +

+ See [page:KeyframeTrack] for inherited methods. +

+ +

[method:null InterpolantFactoryMethodLinear]()

+

+ The value of this method here is 'undefined', as it does not make sense for discrete properties. +

+ +

[method:null InterpolantFactoryMethodSmooth]()

+

+ The value of this method here is 'undefined', as it does not make sense for discrete properties. +

+ + +

Source

+ + + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/animation/tracks/VectorKeyframeTrack.html b/docs/api/zh/animation/tracks/VectorKeyframeTrack.html new file mode 100644 index 00000000000000..22d2ce310ff8ff --- /dev/null +++ b/docs/api/zh/animation/tracks/VectorKeyframeTrack.html @@ -0,0 +1,61 @@ + + + + + + + + + + + + [page:KeyframeTrack] → + +

[name]

+ +

+ A Track of vector keyframe values. +

+ + +

Constructor

+ + +

[name]( [param:String name], [param:Array times], [param:Array values] )

+

+ [page:String name] - (required) identifier for the KeyframeTrack.
+ [page:Array times] - (required) array of keyframe times.
+ [page:Array values] - values for the keyframes at the times specified.
+ [page:Constant interpolation] - the type of interpolation to use. See + [page:Animation Animation Constants] for possible values. Default is + [page:Animation InterpolateLinear]. +

+ + +

Properties

+ + +

+ See [page:KeyframeTrack] for inherited properties. +

+ +

[property:String ValueTypeName]

+

+ String 'vector'. +

+ + +

Methods

+ + +

+ See [page:KeyframeTrack] for inherited methods. +

+ + +

Source

+ + + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/audio/Audio.html b/docs/api/zh/audio/Audio.html new file mode 100644 index 00000000000000..c58bf53f056c6f --- /dev/null +++ b/docs/api/zh/audio/Audio.html @@ -0,0 +1,212 @@ + + + + + + + + + + + [page:Object3D] → + +

[name]

+ +

+ 创建一个( 全局 ) audio对象.

+ + 使用 [link:https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API Web Audio API]. +

+ + +

例子

+ +

+ [example:webaudio_sandbox webaudio / sandbox ]
+ [example:webaudio_visualizer webaudio / visualizer ] +

+ + + // create an AudioListener and add it to the camera + var listener = new THREE.AudioListener(); + camera.add( listener ); + + // create a global audio source + var sound = new THREE.Audio( listener ); + + // load a sound and set it as the Audio object's buffer + var audioLoader = new THREE.AudioLoader(); + audioLoader.load( 'sounds/ambient.ogg', function( buffer ) { + sound.setBuffer( buffer ); + sound.setLoop( true ); + sound.setVolume( 0.5 ); + sound.play(); + }); + + + +

构造函数

+ + +

[name]( [param:AudioListener listener] )

+

+ listener — (必须) [page:AudioListener AudioListener] 的实例. +

+ + +

属性

+ +

[property:Boolean autoplay]

+

是否自动开始播放. 默认为 *false*.

+ +

[property:AudioContext context]

+

构造函数中传入[page:AudioListener listener]的[link:https://developer.mozilla.org/en-US/docs/Web/API/AudioContext AudioContext].

+ +

[property:Array filters]

+

表示[link:https://developer.mozilla.org/en-US/docs/Web/API/BiquadFilterNode BiquadFilterNodes]的数组. 可以使用多种不同的低阶filters去创建复杂的音效. filters可以通过 [page:Audio.setFilter] 或者 [page:Audio.setFilters]设置.

+ +

[property:GainNode gain]

+

使用[link:https://developer.mozilla.org/en-US/docs/Web/API/AudioContext/createGain AudioContext.createGain]()创建的[link:https://developer.mozilla.org/en-US/docs/Web/API/GainNode GainNode].

+ +

[property:Boolean hasPlaybackControl]

+

是否可以使用 [page:Audio.play play](), + [page:Audio.pause pause]()等方法控制播放. 默认为 *true*.

+ +

[property:Number playbackRate]

+

播放速率. 默认为 *1*.

+ +

[property:Boolean isPlaying]

+

是否正在播放

+ +

[property:Number startTime]

+

开始播放的时间. 和[link:https://developer.mozilla.org/en-US/docs/Web/API/AudioBufferSourceNode/start AudioBufferSourceNode.start]()的*when*参数一样. 默认为 *0*.

+ +

[property:Number offset]

+

音频开始播放的偏移时间. 和[link:https://developer.mozilla.org/en-US/docs/Web/API/AudioBufferSourceNode/start AudioBufferSourceNode.start]()的*offset*参数一样. 默认为 *0*.

+ +

[property:String source]

+

使用 [link:https://developer.mozilla.org/en-US/docs/Web/API/AudioContext/createBufferSource AudioContext.createBufferSource]()创建的[link:https://developer.mozilla.org/en-US/docs/Web/API/AudioBufferSourceNode AudioBufferSourceNode].

+ +

[property:String sourceType]

+

音源的类型. 默认为 'empty'.

+ +

[property:String type]

+

表示类型的字符串, 设置为'Audio'.

+ + +

方法

+ +

[method:Audio connect]()

+

+ 连接[page:Audio.source]. 在初始化和设置/删除filters时使用. +

+ +

[method:Audio disconnect]()

+

+ 断开连接[page:Audio.source]. 在设置/删除filters时使用. +

+ +

[method:BiquadFilterNode getFilter]()

+

+ 返回 [page:Audio.filters filters] 数组的第一个元素. +

+ +

[method:Array getFilters]()

+

+ 返回[page:Audio.filters filters] 数组. +

+ +

[method:Boolean getLoop]()

+

+ 返回[link:https://developer.mozilla.org/en-US/docs/Web/API/AudioBufferSourceNode/loop source.loop] + (是否循环播放)的值. +

+ +

[method:GainNode getOutput]()

+

+ 返回[page:Audio.gain gainNode]. +

+ +

[method:Float getPlaybackRate]()

+

+ 返回[page:Audio.playbackRate playbackRate]的值. +

+ +

[method:Float getVolume]( value )

+

+ 返回音量. +

+ +

[method:Audio play]()

+

+ 如果[page:Audio.hasPlaybackControl hasPlaybackControl]是true, 开始播放. +

+ +

[method:Audio pause]()

+

+ 如果[page:Audio.hasPlaybackControl hasPlaybackControl]是true, 暂停播放. +

+ +

[method:null onEnded]()

+

+ 播放完成后自动调用. 如果[page:Audio.isPlaying isPlaying]设置为false. +

+ +

[method:Audio setBuffer]( audioBuffer )

+

+ 设置[page:Audio.source source]给audioBuffer, 和设置[page:Audio.sourceType sourceType]给'buffer'.
+ 如果[page:Audio.autoplay autoplay]为true, 也开始播放. +

+ +

[method:Audio setFilter]( filter )

+

+ 设置一个[link:https://developer.mozilla.org/en-US/docs/Web/API/BiquadFilterNode BiquadFilterNode]给Audio. +

+ +

[method:Audio setFilters]( [param:Array value] )

+

+ value--filters数组.
+ 应用[link:https://developer.mozilla.org/en-US/docs/Web/API/BiquadFilterNode BiquadFilterNodes]数组给Audio. +

+ +

[method:Audio setLoop]( [param:Boolean value] )

+

+ 设置[link:https://developer.mozilla.org/en-US/docs/Web/API/AudioBufferSourceNode/loop source.loop] 的值 + (是否循环播放). +

+ +

[method:Audio setMediaElementSource]( mediaElement )

+

+ 应用[link:https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement HTMLMediaElement]类型对象作为音源.
+ 并且设置[page:Audio.hasPlaybackControl hasPlaybackControl]为false. + +

+ +

[method:Audio setNodeSource]( audioNode )

+

+ 设置[page:Audio.source source]给audioBuffer, 和设置[page:Audio.sourceType sourceType]给 'audioNode'.
+ 并且设置[page:Audio.hasPlaybackControl hasPlaybackControl]为false. + +

+ +

[method:Audio setPlaybackRate]( [param:Float value] )

+

+ 如果[page:Audio.hasPlaybackControl hasPlaybackControl]是true, 设置[page:Audio.playbackRate playbackRate](播放速率) 的值. +

+ +

[method:Audio setVolume]( [param:Float value] )

+

+ 设置音量. +

+ +

[method:Audio stop]()

+

+ 如果[page:Audio.hasPlaybackControl hasPlaybackControl]是true, 停止播放, + 重新设置[page:Audio.startTime startTime]为 *0* 和 设置 [page:Audio.isPlaying isPlaying]为false. +

+ +

源码

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/audio/AudioAnalyser.html b/docs/api/zh/audio/AudioAnalyser.html new file mode 100644 index 00000000000000..ce6e0d5d3f5b3b --- /dev/null +++ b/docs/api/zh/audio/AudioAnalyser.html @@ -0,0 +1,99 @@ + + + + + + + + + + +

[name]

+ +

+ 创建AudioAnalyser对象, 使用[link:https://developer.mozilla.org/en-US/docs/Web/API/AnalyserNode AnalyserNode] + 去分析音频数据.

+ + 使用了 [link:https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API Web Audio API]. + +

+ + +

示例

+ +

+ [example:webaudio_sandbox webaudio / sandbox ]
+ [example:webaudio_visualizer webaudio / visualizer ] +

+ + + // create an AudioListener and add it to the camera + var listener = new THREE.AudioListener(); + camera.add( listener ); + + // create an Audio source + var sound = new THREE.Audio( listener ); + + // load a sound and set it as the Audio object's buffer + var audioLoader = new THREE.AudioLoader(); + audioLoader.load( 'sounds/ambient.ogg', function( buffer ) { + sound.setBuffer( buffer ); + sound.setLoop(true); + sound.setVolume(0.5); + sound.play(); + }); + + // create an AudioAnalyser, passing in the sound and desired fftSize + var analyser = new THREE.AudioAnalyser( sound, 32 ); + + // get the average frequency of the sound + var data = analyser.getAverageFrequency(); + + + +

构造函数

+ + +

[name]( audio, [link:https://developer.mozilla.org/en-US/docs/Web/API/AnalyserNode/fftSize fftSize] )

+

+ 创建[page:AudioAnalyser AudioAnalyser]. +

+ + +

属性

+ +

[property:AnalyserNode analyser]

+

[link:https://developer.mozilla.org/en-US/docs/Web/API/AnalyserNode AnalyserNode]用来分析音频数据.

+ +

[property:Integer fftSize]

+

+ 2的幂次方最高为2048, 用来表示确定频域的FFT (傅立叶变换)大小. + 这个[link:https://developer.mozilla.org/en-US/docs/Web/API/AnalyserNode/fftSize page]有详细信息. +

+ +

[property:Uint8Array data]

+

+ 用来分析数据的Uint8Array的大小由[link:https://developer.mozilla.org/en-US/docs/Web/API/AnalyserNode/frequencyBinCount analyser.frequencyBinCount] + 确定. +

+ + +

方法

+ + +

[method:Uint8Array getFrequencyData]()

+

+ 使用网络音频的[link:https://developer.mozilla.org/en-US/docs/Web/API/AnalyserNode/getByteFrequencyData getByteFrequencyData] 方法. + 看这个页面. +

+ +

[method:Number getAverageFrequency]()

+

+ 通过方法[page:AudioAnalyser.getFrequencyData getFrequencyData]获取平均频率. +

+ +

源码

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/audio/AudioContext.html b/docs/api/zh/audio/AudioContext.html new file mode 100644 index 00000000000000..a7557185e94246 --- /dev/null +++ b/docs/api/zh/audio/AudioContext.html @@ -0,0 +1,42 @@ + + + + + + + + + + + +

[name]

+ +

+ 包含用来设置[link:https://developer.mozilla.org/en-US/docs/Web/API/AudioContext AudioContext]的方法.

+ + 在[page:AudioListener AudioListener]和[page:AudioLoader AudioLoader] 类中被使用.

+ + 使用了 [link:https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API Web Audio API]. +

+ + + +

方法

+ +

[method:AudioContext getContext]()

+

+ 如果定义了,返回给外部*context*的值, + 否则创建一个新的[link:https://developer.mozilla.org/en-US/docs/Web/API/AudioContext AudioContext]. +

+ +

[method:AudioContext setContext]( [param:AudioConetxt value] )

+

+ 外部用来设置 *context* 的值. +

+ + +

源码

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/audio/AudioListener.html b/docs/api/zh/audio/AudioListener.html new file mode 100644 index 00000000000000..6b4264bfd9affc --- /dev/null +++ b/docs/api/zh/audio/AudioListener.html @@ -0,0 +1,108 @@ + + + + + + + + + + + [page:Object3D] → + +

[name]

+ +

+ [name] 用一个虚拟的[link:https://developer.mozilla.org/de/docs/Web/API/AudioListener listener]表示在场景中所有的位置和非位置相关的音效.
+ 一个three.js程序通常创建一个[name]. 它是音频实体构造函数的必须参数,比如 [page:Audio Audio] and [page:PositionalAudio PositionalAudio].
+ 大多数情况下, listener对象是camera的子对象. Camera的3D变换表示了listener的3D变换. +

+ + +

示例

+ +

+ [example:webaudio_sandbox webaudio / sandbox ]
+ [example:webaudio_timing webaudio / timing ]
+ [example:webaudio_visualizer webaudio / visualizer ] +

+ + + // create an AudioListener and add it to the camera + var listener = new THREE.AudioListener(); + camera.add( listener ); + + // create a global audio source + var sound = new THREE.Audio( listener ); + + // load a sound and set it as the Audio object's buffer + var audioLoader = new THREE.AudioLoader(); + audioLoader.load( 'sounds/ambient.ogg', function( buffer ) { + sound.setBuffer( buffer ); + sound.setLoop(true); + sound.setVolume(0.5); + sound.play(); + }); + + + +

构造函数

+ + +

[name]( )

+

+ 创建一个新的AudioListener. +

+ + +

属性

+ +

[property:AudioContext context]

+

[page:AudioListener listener]构造函数中的[link:https://developer.mozilla.org/en-US/docs/Web/API/AudioContext AudioContext].

+ +

[property:GainNode gain]

+

使用[link:https://developer.mozilla.org/en-US/docs/Web/API/AudioContext/createGain AudioContext.createGain]()创建 [link:https://developer.mozilla.org/en-US/docs/Web/API/GainNode GainNode].

+ +

[property:AudioNode filter]

+

默认为*null*.

+ + +

方法

+ + +

[method:GainNode getInput]()

+

+ 返回[page:AudioListener.gain gainNode]. +

+ +

[method:AudioListener removeFilter]()

+

+ 设置[page:AudioListener.filter filter]属性为*null*. +

+ +

[method:AudioNode getFilter]()

+

+ 返回[page:AudioListener.filter filter]属性的值. +

+ +

[method:AudioListener setFilter]( [param:AudioNode value] )

+

+ 设置[page:AudioListener.filter filter] 属性的值. +

+ +

[method:Float getMasterVolume]()

+

+ 返回音量. +

+ +

[method:AudioListener setMasterVolume]( [param:Number value] )

+

+ 设置音量. +

+ + +

源码

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/audio/PositionalAudio.html b/docs/api/zh/audio/PositionalAudio.html new file mode 100644 index 00000000000000..aa121999e4d64e --- /dev/null +++ b/docs/api/zh/audio/PositionalAudio.html @@ -0,0 +1,135 @@ + + + + + + + + + + + [page:Object3D] → [page:Audio] → + +

[name]

+ +

+ 创建一个位置相关的音频对象.

+ + 使用了[link:https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API Web Audio API]. +

+ + +

示例

+ +

+ [example:webaudio_orientation webaudio / orientation ]
+ [example:webaudio_sandbox webaudio / sandbox ]
+ [example:webaudio_timing webaudio / timing ] +

+ + + // create an AudioListener and add it to the camera + var listener = new THREE.AudioListener(); + camera.add( listener ); + + // create the PositionalAudio object (passing in the listener) + var sound = new THREE.PositionalAudio( listener ); + + // load a sound and set it as the PositionalAudio object's buffer + var audioLoader = new THREE.AudioLoader(); + audioLoader.load( 'sounds/song.ogg', function( buffer ) { + sound.setBuffer( buffer ); + sound.setRefDistance( 20 ); + sound.play(); + }); + + // create an object for the sound to play from + var sphere = new THREE.SphereGeometry( 20, 32, 16 ); + var material = new THREE.MeshPhongMaterial( { color: 0xff2200 } ); + var mesh = new THREE.Mesh( sphere, material ); + scene.add( mesh ); + + // finally add the sound to the mesh + mesh.add( sound ); + + + +

构造函数

+ +

[name]( [param:AudioListener listener] )

+

+ listener — (必须) [page:AudioListener AudioListener] 实例. +

+ + +

属性

+ +

+ [page:Audio Audio]类的继承属性. +

+ +

[property:PannerNode panner]

+

位置相关音频的[link:https://developer.mozilla.org/en-US/docs/Web/API/PannerNode PannerNode].

+ + +

方法

+ +

+ [page:Audio Audio]类的继承方法. +

+ +

[method:PannerNode getOutput]()

+

+ 返回[page:PositionalAudio.panner panner]. +

+ +

[method:Float getRefDistance]()

+

+ 返回[link:https://developer.mozilla.org/en-US/docs/Web/API/PannerNode/refDistance panner.refDistance]的值. +

+ +

[method:PositionalAudio setRefDistance]( [param:Float value] )

+

+ 设置[link:https://developer.mozilla.org/en-US/docs/Web/API/PannerNode/refDistance panner.refDistance]的值. +

+ +

[method:Float getRolloffFactor]()

+

+ 返回[link:https://developer.mozilla.org/en-US/docs/Web/API/PannerNode/rolloffFactor panner.rolloffFactor]的值. +

+ +

[method:PositionalAudio setRolloffFactor]( [param:Float value] )

+

+ 设置[link:https://developer.mozilla.org/en-US/docs/Web/API/PannerNode/rolloffFactor panner.rolloffFactor]的值. +

+ +

[method:String getDistanceModel]()

+

+ 返回[link:https://developer.mozilla.org/en-US/docs/Web/API/PannerNode/distanceModel panner.distanceModel]的值. +

+ +

[method:PositionalAudio setDistanceModel]( [param:String value] )

+

+ 设置[link:https://developer.mozilla.org/en-US/docs/Web/API/PannerNode/distanceModel panner.distanceModel]的值. +

+ +

[method:Float getMaxDistance]()

+

+ 返回[link:https://developer.mozilla.org/en-US/docs/Web/API/PannerNode/maxDistance panner.maxDistance]的值. +

+ +

[method:PositionalAudio setMaxDistance]( [param:Float value] )

+

+ 设置[link:https://developer.mozilla.org/en-US/docs/Web/API/PannerNode/maxDistance panner.maxDistance]的值. +

+ +

[method:PositionalAudio setDirectionalCone]( [param:Float coneInnerAngle], [param:Float coneOuterAngle], [param:Float coneOuterGain] )

+

+ 这个方法用来把环绕声音转换为定向声音[link:https://developer.mozilla.org/en-US/docs/Web/API/PannerNode directional sound]. +

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/cameras/ArrayCamera.html b/docs/api/zh/cameras/ArrayCamera.html new file mode 100644 index 00000000000000..56740d2b69c4ce --- /dev/null +++ b/docs/api/zh/cameras/ArrayCamera.html @@ -0,0 +1,47 @@ + + + + + + + + + + + [page:PerspectiveCamera] → + +

阵列摄像机([name])

+ +

+ [name] 可以被用来更加高效地用一组已经预定义好的摄像机来渲染一个场景。 这对于VR场景的渲染来说,是非常重要的一个性能体现。
+ 一个 [name] 的实例中总是包含着一组子摄像机,应当为每一个子摄像机定义*bound*(边界)这个属性,该属性决定了由该子摄像机所渲染的视口区域的大小。 +

+ +

示例

+ +

[example:webgl_camera_array camera / array ]

+ +

构造器

+ +

[name]( [param:Array array] )

+

+ 一个包含多个摄像机的数组。 +

+ + +

属性

+

请参阅其基类 [page:PerspectiveCamera] 来查看共有属性。

+ +

[property:Array cameras]

+

+ 一个包含多个摄像机的数组。 +

+ +

方法

+

请参阅其基类 [page:PerspectiveCamera] 来查看共有方法。

+ +

源代码

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/cameras/Camera.html b/docs/api/zh/cameras/Camera.html new file mode 100644 index 00000000000000..3b639dcf7856be --- /dev/null +++ b/docs/api/zh/cameras/Camera.html @@ -0,0 +1,83 @@ + + + + + + + + + + + [page:Object3D] → + +

摄像机([name])

+ +

+ 摄像机的抽象基类,你创建一个摄像机总会继承这个类。 +

+ + +

构造器

+ + +

[name]()

+

+ 创建一个新的[name](摄像机)。注意:这个类并不是被直接调用的;你所想要的或许是一个 [page:PerspectiveCamera](透视摄像机)或者 [page:OrthographicCamera](正交摄像机)。 +

+ + +

属性

+

请参阅其基类[page:Object3D]来查看共有属性。

+ +

[property:Boolean isCamera]

+

+ 用于来检查这个类或者派生的类是否为摄像机,默认为*true*。 +

+ + 你不应当对这个属性进行改变,因为它在内部由渲染器使用,以用于优化。 +

+ +

[property:Layers layers]

+

+ 摄像机是一个[page:Layers layers]的成员. 这是一个从[page:Object3D]继承而来的属性。

+ 当摄像机的视点被渲染的时候,物体必须和当前被看到的摄像机共享至少一个层。 +

+ +

[property:Matrix4 matrixWorldInverse]

+

+ 这是matrixWorld矩阵的逆矩阵。 MatrixWorld包含了相机的世界变换矩阵。 +

+ +

[property:Matrix4 projectionMatrix]

+

这是投影变换矩阵。

+ +

[property:Matrix4 projectionMatrixInverse]

+

这是投影变换矩阵的逆矩阵。

+ + +

方法

+

请参阅其基类[page:Object3D]来查看其共有方法。

+ +

[method:Camera clone]( )

+

+ 返回一个具有和当前相机的属性一样的新的相机。 +

+ +

[method:Camera copy]( [param:Camera source], [param:Boolean recursive] )

+

+ 将源摄像机的属性复制到新摄像机中。 +

+ +

[method:Vector3 getWorldDirection]( [param:Vector3 target] )

+

+ [page:Vector3 target] — 调用该函数的结果将复制给该Vector3对象。

+ + 返回一个能够表示当前摄像机所正视的世界空间方向的[page:Vector3]对象。 + (注意:摄像机俯视时,其Z轴坐标为负。)

+

+ +

源代码

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/cameras/CubeCamera.html b/docs/api/zh/cameras/CubeCamera.html new file mode 100644 index 00000000000000..096f764465b13b --- /dev/null +++ b/docs/api/zh/cameras/CubeCamera.html @@ -0,0 +1,89 @@ + + + + + + + + + + + [page:Object3D] → + +

立方相机([name])

+ +

创建6个摄像机,并将它们所拍摄的场景渲染到[page:WebGLRenderTargetCube]上。

+ +

示例

+ +

[example:webgl_materials_cubemap_dynamic materials / cubemap / dynamic ]

+

[example:webgl_materials_cubemap_dynamic2 materials / cubemap / dynamic2 ]

+

[example:webgl_shading_physical shading / physical ]

+ + // Create cube camera + var cubeCamera = new THREE.CubeCamera( 1, 100000, 128 ); + scene.add( cubeCamera ); + + // Create car + var chromeMaterial = new THREE.MeshLambertMaterial( { color: 0xffffff, envMap: cubeCamera.renderTarget } ); + var car = new Mesh( carGeometry, chromeMaterial ); + scene.add( car ); + + // Update the render target cube + car.setVisible( false ); + cubeCamera.position.copy( car.position ); + cubeCamera.update( renderer, scene ); + + // Render the scene + car.setVisible( true ); + renderer.render( scene, camera ); + + + +

构造器

+ + +

[name]( [param:Number near], [param:Number far], [param:Number cubeResolution] )

+

+ near -- 远剪切面的距离
+ far -- 近剪切面的距离
+ cubeResolution -- 设置立方体边缘的长度 +

+

+ 构造一个包含6个[page:PerspectiveCamera PerspectiveCameras](透视摄像机)的立方摄像机,并将其拍摄的场景渲染到一个[page:WebGLRenderTargetCube]上。 +

+ + +

属性

+

请参阅其基类[page:Object3D]来查看共有属性。

+ +

[property:WebGLRenderTargetCube renderTarget]

+

+ 生成的立方体纹理
+ (译注:生成的立方体纹理保存在其中的.texture对象中,可作为贴图赋值给其他材质) +

+ +

方法

+

请参阅其基类[page:Object3D]来查看其共有方法。

+ + +

[method:null update]( [param:WebGLRenderer renderer], [param:Scene scene] )

+

+ renderer -- 当前的WebGL渲染器
+ scene -- 当前的场景 +

+

+ 这个方法用来更新[page:CubeCamera.renderTarget renderTarget](渲染目标对象)。 +

+ +

[method:null clear]( [param:WebGLRenderer renderer], [param:Boolean color], [param:Boolean depth], [param:Boolean stencil] )

+

+ 这个方法用来来清除[page:CubeCamera.renderTarget renderTarget]的颜色、深度和/或模板缓冲区。 + 颜色缓冲区设置为渲染器当前的“清除”色。参数默认值均为*true*。 +

+ +

源代码

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/cameras/OrthographicCamera.html b/docs/api/zh/cameras/OrthographicCamera.html new file mode 100644 index 00000000000000..6897da019721a0 --- /dev/null +++ b/docs/api/zh/cameras/OrthographicCamera.html @@ -0,0 +1,145 @@ + + + + + + + + + + + [page:Object3D] → [page:Camera] → + +

正交相机([name])

+ +

+ 这一摄像机使用[link:https://en.wikipedia.org/wiki/Orthographic_projection orthographic projection](正交投影)来进行投影。

+ + 在这种投影模式下,无论物体距离相机距离远或者近,在最终渲染的图片中物体的大小都保持不变。 +

+ + + 这对于渲染2D场景或者UI元素是非常有用的。 +

+ + +

示例

+ +

[example:canvas_camera_orthographic camera / orthographic ]

+

[example:webgl_camera camera ]

+

[example:webgl_interactive_cubes_ortho interactive / cubes / ortho ]

+

[example:webgl_materials_cubemap_dynamic materials / cubemap / dynamic ]

+

[example:webgl_postprocessing_advanced postprocessing / advanced ]

+

[example:webgl_postprocessing_dof2 postprocessing / dof2 ]

+

[example:webgl_postprocessing_godrays postprocessing / godrays ]

+

[example:webgl_rtt rtt ]

+

[example:webgl_shaders_tonemapping shaders / tonemapping ]

+

[example:webgl_shadowmap shadowmap ]

+

[example:webgl_terrain_dynamic terrain / dynamic ]

+ + var camera = new THREE.OrthographicCamera( width / - 2, width / 2, height / 2, height / - 2, 1, 1000 ); +scene.add( camera ); + + +

构造器

+ + +

[name]( [param:Number left], [param:Number right], [param:Number top], [param:Number bottom], [param:Number near], [param:Number far] )

+

+ left — 摄像机视锥体左侧面。
+ right — 摄像机视锥体右侧面。
+ top — 摄像机视锥体上侧面。
+ bottom — 摄像机视锥体下侧面。
+ near — 摄像机视锥体近端面。
+ far — 摄像机视锥体远端面。

+ + 这些参数一起定义了摄像机的[link:https://en.wikipedia.org/wiki/Viewing_frustum viewing frustum](视锥体)。 +

+ + +

属性

+

+ 请参阅其基类[page:Camera]来查看其共有属性。 +
+ 请注意,在大多数属性发生改变之后,你将需要调用[page:OrthographicCamera.updateProjectionMatrix .updateProjectionMatrix]来使得这些改变生效。 +

+ +

[property:Float bottom]

+

摄像机视锥体下侧面。

+ +

[property:Float far]

+

+ 摄像机视锥体远端面,其默认值为*2000*。

+ 其值的有效范围介于[page:.near near](摄像机视锥体近端面)和无穷大之间。 +

+ +

[property:Boolean isOrthographicCamera]

+

+ 用于测试这个类或者派生类是否为OrthographicCameras,默认为*true*。

+ 你不应当对这个属性进行改变,因为它在内部由渲染器使用,以用于优化。 +

+ +

[property:Float left]

+

摄像机视锥体左侧面。

+ +

[property:Float near]

+

+ 摄像机视锥体近端面。其默认值为*0.1*.

+ + 其值的有效范围介于0和[page:.far far](摄像机视锥体远端面)之间。 +
+ 请注意,和[page:PerspectiveCamera]不同,*0*对于OrthographicCamera的近端面来说是一个有效值。 + +

+ +

[property:Float right]

+

摄像机视锥体右侧面。

+ +

[property:Float top]

+

摄像机视锥体上侧面。

+ +

[property:Object view]

+

这个值是由[page:OrthographicCamera.setViewOffset setViewOffset]来设置的,其默认值为*null*。

+ +

[property:number zoom]

+

+ 获取或者设置摄像机的缩放倍数,其默认值为*1*。

+ +

方法

+

请参阅其基类[page:Camera]来查看其共有方法。

+ +

[method:null setViewOffset]( [param:Float fullWidth], [param:Float fullHeight], [param:Float x], [param:Float y], [param:Float width], [param:Float height] )

+

+ fullWidth — 多视图的全宽设置
+ fullHeight — 多视图的全高设置
+ x — 副摄像机的水平偏移
+ y — 副摄像机的垂直偏移
+ width — 副摄像机的宽度
+ height — 副摄像机的高度

+ + 在较大的[link:https://en.wikipedia.org/wiki/Viewing_frustum viewing frustum](视锥体)中设置偏移量,对于多窗口或者多显示器的设置是很有用的。 + 对于如何使用它,请查看[page:PerspectiveCamera.setViewOffset PerspectiveCamera]中的示例。 + +

+ +

[method:null clearViewOffset]()

+

+ 清除任何由.setViewOffset设置的偏移量。 +

+ +

[method:null updateProjectionMatrix]()

+

+ 更新摄像机投影矩阵。在任何参数被改变以后必须被调用。 +

+ +

[method:JSON toJSON]()

+

+ 使用JSON格式来返回摄像机数据。 +

+ + +

源代码

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/cameras/PerspectiveCamera.html b/docs/api/zh/cameras/PerspectiveCamera.html new file mode 100644 index 00000000000000..e3ed22dc8893d0 --- /dev/null +++ b/docs/api/zh/cameras/PerspectiveCamera.html @@ -0,0 +1,201 @@ + + + + + + + + + + + [page:Object3D] → [page:Camera] → + +

透视相机([name])

+ +

+ 这一摄像机使用[link:https://en.wikipedia.org/wiki/Perspective_(graphical) perspective projection](透视投影)来进行投影。

+ + 这一投影模式被用来模拟人眼所看到的景象,它是3D场景的渲染中使用得最普遍的投影模式。 + +

+ + +

示例

+ +

[example:canvas_geometry_birds geometry / birds ]

+

[example:canvas_geometry_cube geometry / cube ]

+

[example:webgl_animation_skinning_blending animation / skinning / blending ]

+

[example:webgl_animation_skinning_morph animation / skinning / blending ]

+

[example:webgl_effects_stereo effects / stereo ]

+

[example:webgl_interactive_cubes interactive / cubes ]

+

[example:webgl_loader_collada_skinning loader / collada / skinning ]

+ + var camera = new THREE.PerspectiveCamera( 45, width / height, 1, 1000 ); +scene.add( camera ); + + +

构造器

+ +

[name]( [param:Number fov], [param:Number aspect], [param:Number near], [param:Number far] )

+

+ fov — 摄像机视锥体垂直视野角度
+ aspect — 摄像机视锥体长宽比
+ near — 摄像机视锥体近端面
+ far — 摄像机视锥体远端面

+ + 这些参数一起定义了摄像机的[link:https://en.wikipedia.org/wiki/Viewing_frustum viewing frustum](视锥体)。 +

+ + +

属性

+

+ 请参阅其基类 [page:Camera] 来查看共有属性。
+ 请注意,在大多数属性发生改变之后,你将需要调用[page:PerspectiveCamera.updateProjectionMatrix .updateProjectionMatrix]来使得这些改变生效。 +

+ +

[property:Float aspect]

+

摄像机视锥体的长宽比,通常是使用画布的宽/画布的高。默认值是*1*(正方形画布)。

+ +

[property:Float far]

+

+ 摄像机的远端面,默认值是*2000*。 +

+ 其有效值范围是在当前摄像机[page:.near near] plane(近端面)的值到无穷远之间。 +

+ +

[property:Float filmGauge]

+

胶片尺寸,其默认值为35(毫米)。 + 这个参数不会影响摄像机的投影矩阵,除非.filmOffset被设置为了一个非零的值。

+ +

[property:Float filmOffset]

+

水平偏离中心偏移量,和.filmGauge单位相同。默认值为*0*。

+ +

[property:Float focus]

+

用于立体视觉和景深效果的物体的距离。 + 这个参数不会影响摄像机的投影矩阵,除非使用了[page:StereoCamera]。 + 默认值是*10*。 +

+ +

[property:Float fov]

+

摄像机视锥体垂直视野角度,从视图的底部到顶部,以角度来表示。默认值是*50*。

+ +

[property:Boolean isPerspectiveCamera]

+

+ + 用于测试这个类或者派生类是否为PerspectiveCameras,默认为true。 +

+ + 你不应当对这个属性进行改变,因为它在内部由渲染器使用,以用于优化。 +

+ + +

[property:Float near]

+

+ 摄像机的近端面,默认值是*0.1*。

+ 其有效值范围是0到当前摄像机[page:.far far] plane(远端面)的值之间。 + 请注意,和[page:OrthographicCamera]不同,*0*对于PerspectiveCamera的近端面来说不是一个有效值。 +

+ +

[property:Object view]

+

+ Frustum window specification or null. + 这个值使用[page:PerspectiveCamera.setViewOffset .setViewOffset]方法来进行设置,使用[page:PerspectiveCamera.clearViewOffset .clearViewOffset]方法来进行清除。 +

+ +

[property:number zoom]

+

获取或者设置摄像机的缩放倍数,其默认值为*1*。

+ + +

方法

+

请参阅其基类[page:Camera]来查看共有属性。

+ +

[method:null clearViewOffset]()

+

清除任何由[page:PerspectiveCamera.setViewOffset .setViewOffset]设置的偏移量。

+ +

[method:Float getEffectiveFOV]()

+

结合.zoom(缩放倍数),以角度返回当前垂直视野角度。

+ +

[method:Float getFilmHeight]()

+

+ 返回当前胶片上图像的高,如果.aspect小于或等于1(肖像格式、纵向构图),则结果等于.filmGauge。 + +

+ +

[method:Float getFilmWidth]()

+

+ 返回当前胶片上图像的宽,如果.aspect大于或等于1(景观格式、横向构图),则结果等于.filmGauge。 +

+ +

[method:Float getFocalLength]()

+

返回当前.fov(视野角度)相对于.filmGauge(胶片尺寸)的焦距。 + +

[method:null setFocalLength]( [param:Float focalLength] )

+

+ 通过相对于当前[page:PerspectiveCamera.filmGauge .filmGauge]的焦距,设置FOV。 +

+ 默认情况下,焦距是为35mm(全画幅)摄像机而指定的。

+ +

[method:null setViewOffset]( [param:Float fullWidth], [param:Float fullHeight], [param:Float x], [param:Float y], [param:Float width], [param:Float height] )

+

+ fullWidth — 多视图的全宽设置
+ fullHeight — 多视图的全高设置
+ x — 副摄像机的水平偏移
+ y — 副摄像机的垂直偏移
+ width — 副摄像机的宽度
+ height — 副摄像机的高度 +

+ +

+ 在较大的viewing frustum(视锥体)中设置偏移量,对于多窗口或者多显示器的设置是很有用的。 +

+ +

+ 例如,如果你有一个3x2的显示器阵列,每个显示器分辨率都是1920x1080,且这些显示器排列成像这样的网格:
+ +

++---+---+---+
+| A | B | C |
++---+---+---+
+| D | E | F |
++---+---+---+
+		
+ 那对于每个显示器,你可以这样来设置、调用:
+ + var w = 1920; +var h = 1080; +var fullWidth = w * 3; +var fullHeight = h * 2; + +// A +camera.setViewOffset( fullWidth, fullHeight, w * 0, h * 0, w, h ); +// B +camera.setViewOffset( fullWidth, fullHeight, w * 1, h * 0, w, h ); +// C +camera.setViewOffset( fullWidth, fullHeight, w * 2, h * 0, w, h ); +// D +camera.setViewOffset( fullWidth, fullHeight, w * 0, h * 1, w, h ); +// E +camera.setViewOffset( fullWidth, fullHeight, w * 1, h * 1, w, h ); +// F +camera.setViewOffset( fullWidth, fullHeight, w * 2, h * 1, w, h ); + + 请注意,显示器的不必具有相同的大小,或者不必在网格中。 +

+ +

[method:null updateProjectionMatrix]()

+

+ + 更新摄像机投影矩阵。在任何参数被改变以后必须被调用。 + +

+ +

[method:JSON toJSON]()

+

+ 使用JSON格式来返回摄像机数据。 +

+ +

源代码

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/cameras/StereoCamera.html b/docs/api/zh/cameras/StereoCamera.html new file mode 100644 index 00000000000000..1d0177042b5658 --- /dev/null +++ b/docs/api/zh/cameras/StereoCamera.html @@ -0,0 +1,64 @@ + + + + + + + + + + + +

立体相机([name])

+ +

+ 双透视摄像机(立体相机)常被用于创建[link:https://en.wikipedia.org/wiki/Anaglyph_3D 3D Anaglyph](3D立体影像)或者[link:https://en.wikipedia.org/wiki/parallax_barrier Parallax Barrier](视差效果)。 + +

+ + +

示例

+ +

[example:webgl_effects_anaglyph effects / anaglyph ]

+

[example:webgl_effects_parallaxbarrier effects / parallaxbarrier ]

+

[example:webgl_effects_stereo effects / stereo ]

+ +

+ 这些类在以上示例中的文件内部使用:

+ [link:https://github.com/mrdoob/three.js/blob/master/examples/js/effects/AnaglyphEffect.js examples/js/effects/AnaglyphEffect.js]

+ [link:https://github.com/mrdoob/three.js/blob/master/examples/js/effects/ParallaxBarrierEffect.js examples/js/effects/ParallaxBarrierEffect.js]

+ [link:https://github.com/mrdoob/three.js/blob/master/examples/js/effects/StereoEffect.js examples/js/effects/StereoEffect.js]

+

+ + +

构造器

+ +

[name]( )

+ +

属性

+ +

[property:Float aspect]

+

默认值是*1*.

+ +

[property:Float eyeSep]

+

默认值是*0.064*.

+ +

[property:PerspectiveCamera cameraL]

+

左摄像机,它被加入到了[page:Layers layer 1]中 —— 需要被左摄像机渲染的物体也应当要加入到这一层中。

+ +

[property:PerspectiveCamera cameraR]

+

右摄像机,它被加入到了[page:Layers layer 2]中 —— 需要被右摄像机渲染的物体也应当要加入到这一层中。

+ + +

方法

+ +

[method:null update]( [param:PerspectiveCamera camera] )

+

+ 基于摄像机通过场景,更新立体摄像机。 +

+ +

源代码

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/constants/Animation.html b/docs/api/zh/constants/Animation.html new file mode 100644 index 00000000000000..c87cf01763ce9e --- /dev/null +++ b/docs/api/zh/constants/Animation.html @@ -0,0 +1,39 @@ + + + + + + + + + + +

动画常量(Animation Constants)

+ +

循环模式

+ + +THREE.LoopOnce +THREE.LoopRepeat +THREE.LoopPingPong + + +

插值模式

+ +THREE.InterpolateDiscrete +THREE.InterpolateLinear +THREE.InterpolateSmooth + + +

结束模式

+ +THREE.ZeroCurvatureEnding +THREE.ZeroSlopeEnding +THREE.WrapAroundEnding + + +

源代码

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/constants.js src/constants.js] + + diff --git a/docs/api/zh/constants/Core.html b/docs/api/zh/constants/Core.html new file mode 100644 index 00000000000000..4f097fc50b7190 --- /dev/null +++ b/docs/api/zh/constants/Core.html @@ -0,0 +1,37 @@ + + + + + + + + + + +

核心常量(Core Constants)

+ +

修订版本号

+ + + THREE.REV + + +
+ 当前three.js的修订版本号( [link:https://github.com/mrdoob/three.js/releases revision number])。 +
+ +

鼠标按钮

+ + THREE.MOUSE.LEFT + THREE.MOUSE.MIDDLE + THREE.MOUSE.RIGHT + + +

源代码

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/constants.js src/constants.js] + + + + + diff --git a/docs/api/zh/constants/CustomBlendingEquations.html b/docs/api/zh/constants/CustomBlendingEquations.html new file mode 100644 index 00000000000000..2fcfb79fe36928 --- /dev/null +++ b/docs/api/zh/constants/CustomBlendingEquations.html @@ -0,0 +1,63 @@ + + + + + + + + + + +

自定义混合方程常量(Custom Blending Equation Constants)

+ + +

示例

+

[example:webgl_materials_blending_custom materials / blending / custom ]

+ +

用法

+

+ 这个常量可以用于所有的材质类型。首先将材质的混合模式设置为THREE.CustomBlending,然后设置所需要的混合方程、源因子和目标因子。 +

+ + + var material = new THREE.MeshBasicMaterial( {color: 0x00ff00} ); + material.blending = THREE.CustomBlending; + material.blendEquation = THREE.AddEquation; //default + material.blendSrc = THREE.SrcAlphaFactor; //default + material.blendDst = THREE.OneMinusSrcAlphaFactor; //default + + +

混合方程

+ + THREE.AddEquation + THREE.SubtractEquation + THREE.ReverseSubtractEquation + THREE.MinEquation + THREE.MaxEquation + + +

源因子

+ + THREE.ZeroFactor + THREE.OneFactor + THREE.SrcColorFactor + THREE.OneMinusSrcColorFactor + THREE.SrcAlphaFactor + THREE.OneMinusSrcAlphaFactor + THREE.DstAlphaFactor + THREE.OneMinusDstAlphaFactor + THREE.DstColorFactor + THREE.OneMinusDstColorFactor + THREE.SrcAlphaSaturateFactor + + +

目标因子

+

+ 所有的源因子的值,在目标因子中都是有效的。除了:THREE.SrcAlphaSaturateFactor +

+ +

源代码

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/constants.js src/constants.js] + + diff --git a/docs/api/zh/constants/DrawModes.html b/docs/api/zh/constants/DrawModes.html new file mode 100644 index 00000000000000..3e32e2994b5e6b --- /dev/null +++ b/docs/api/zh/constants/DrawModes.html @@ -0,0 +1,81 @@ + + + + + + + + + + +

绘图模式常量(Draw Mode Constants)

+ +

+ 这些是[page:Mesh.drawMode]的有效值,控制着顶点列表一旦被发送到GPU中将如何被解释。 + 请注意,只有当[page:Mesh.geometry]是一个[page:BufferGeometry]的时候,这些值才会生效。当[page:Mesh.geometry]是一个 + [page:Geometry]的时候,改变这个值不会有任何效果。 +

+ + + +

+ + +

绘图模式

+ + + THREE.TrianglesDrawMode + +

+ 这是默认值,这将使得每三个连续顶点(v0, v1, v2),(v2, v3, v5),……被解释为一个单独的三角形。 +
+ 如果顶点的数量不是3的倍数,那么将会忽略多余的顶点。 +

+ + + THREE.TriangleStripDrawMode + +

+ 这将使得一系列的三角形(由(v0, v1, v2),(v2, v1, v3),(v2, v3, v4),……给定)一个一个地连在一起,每一个连续的三角形将和前一个三角形共享两个顶点。 +

+ + + THREE.TriangleFanDrawMode + +

+这将会使得一个序列中的每一个三角形(由(v0, v1, v2),(v0, v2, v3),(v0, v3, v4),……给定)共享它们的第一个顶点(就像风扇一样)。

+ + 注意:截至[link:https://en.wikipedia.org/wiki/DirectX#DirectX_10 DirectX10]这个模式还没有被支持。 + 由于Chorme和Firefox在Windows上是使用[link:https://en.wikipedia.org/wiki/ANGLE_(software) ANGLE]来渲染WebGL的,所以这种模式将会在内部转换为受支持的模式, + 但可能会导致这些浏览器在性能上降低一些。 +

+ + +

用法

+ + + var geometry = new THREE.Geometry(); + + geometry.vertices.push( + new THREE.Vector3( -10, 10, 0 ), + new THREE.Vector3( -10, -10, 0 ), + new THREE.Vector3( 10, -10, 0 ), + ... + ); + geometry.faces.push( new THREE.Face3( 0, 1, 2 ), ... ); + + var material = new THREE.MeshBasicMaterial( { color: 0xffff00 } ); + + var mesh = new THREE.Mesh( geometry, material ); + mesh.drawMode = THREE.TrianglesDrawMode; //default + + scene.add( mesh ); + + + + +

源代码

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/constants.js src/constants.js] + + diff --git a/docs/api/zh/constants/Materials.html b/docs/api/zh/constants/Materials.html new file mode 100644 index 00000000000000..cf41a27d310e2f --- /dev/null +++ b/docs/api/zh/constants/Materials.html @@ -0,0 +1,102 @@ + + + + + + + + + + +

材质常量(Material Constants)

+ +

+ 由这些常量定义的属性对所有的材质类型都生效,除了Texture Combine Operations只应用于 + [page:MeshBasicMaterial.combine MeshBasicMaterial],[page:MeshLambertMaterial.combine MeshLambertMaterial]和[page:MeshPhongMaterial.combine MeshPhongMaterial]。
+

+ + +

+ + THREE.FrontSide + THREE.BackSide + THREE.DoubleSide + +

+ 定义了哪一边的面将会被渲染 —— 正面,或是反面,还是两个面都渲染。 + 默认值是[page:Constant FrontSide](只渲染正面)。 +

+ + +

颜色

+ + THREE.NoColors + THREE.FaceColors + THREE.VertexColors + +

+ [page:Constant NoColors] 是默认值,且会将材质的颜色应用到所有面。
+ [page:Constant FaceColors] 根据每个[page:Face3 Face3]的[page:Color Color]值来对面进行着色。
+ [page:Constant VertexColors] 根据每个 [page:Face3 Face3]的vertexColors(顶点颜色)值来对面进行着色。 这是一个包含有三个[page:Color Color]的数组,数组中每一项都对应着面中的每一个顶点。
+ 请查看示例:[example:webgl_geometry_colors geometry / colors]。 +

+ +

混合模式

+ + THREE.NoBlending + THREE.NormalBlending + THREE.AdditiveBlending + THREE.SubtractiveBlending + THREE.MultiplyBlending + THREE.CustomBlending + + + +

+ 这些值控制着源和目标材质中,被发送到WebGLRenderer,来给WebGL使用的包含有RGB和Alpha数据的混合方程。
+ 默认值是[page:Constant NormalBlending]。
+ 请注意,[page:Constant CustomBlending]必须被设置为自定义混合方程([page:CustomBlendingEquation Custom Blending Equations])常量中的值。
+ 请查看示例:[example:webgl_materials_blending materials / blending]。
+

+ +

深度模式

+ + THREE.NeverDepth + THREE.AlwaysDepth + THREE.LessDepth + THREE.LessEqualDepth + THREE.GreaterEqualDepth + THREE.GreaterDepth + THREE.NotEqualDepth + +

+ 材质使用这些深度函数来比较输入像素和缓冲器中Z-depth的值。 + 如果比较的结果为true,则将绘制像素。
+ [page:Materials NeverDepth] 永远不返回true。
+ [page:Materials AlwaysDepth] 总是返回true。
+ [page:Materials LessDepth] 当输入像素Z-depth小于当前缓冲器Z-depth时,返回true。
+ [page:Materials LessEqualDepth] 为默认值,当输入像素Z-depth小于或等于当前缓冲器Z-depth时,返回true。
+ [page:Materials GreaterEqualDepth] 当输入像素Z-depth大于或等于当前缓冲器Z-depth时,返回true。
+ [page:Materials GreaterDepth] 当输入像素Z-depth大于当前缓冲器Z-depth时,返回true。
+ [page:Materials NotEqualDepth] 当输入像素Z-depth不等于当前缓冲器Z-depth时,返回true。
+

+ +

纹理结合操作

+ + THREE.MultiplyOperation + THREE.MixOperation + THREE.AddOperation + +

+ 这些常量定义了物体表面颜色与环境贴图(如果存在的话)相结合的结果, + 用在[page:MeshBasicMaterial.combine MeshBasicMaterial]、[page:MeshLambertMaterial.combine MeshLambertMaterial]和[page:MeshPhongMaterial.combine MeshPhongMaterial]当中。
+ [page:Constant MultiplyOperation] 是默认值,它将环境贴图和物体表面颜色进行相乘。
+ [page:Constant MixOperation] 使用反射率来混和两种颜色。uses reflectivity to blend between the two colors.
+ [page:Constant AddOperation] 用于对两种颜色进行相加。

+ + +

源代码

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/constants.js src/constants.js] + + diff --git a/docs/api/zh/constants/Renderer.html b/docs/api/zh/constants/Renderer.html new file mode 100644 index 00000000000000..0d0a6b10700d1b --- /dev/null +++ b/docs/api/zh/constants/Renderer.html @@ -0,0 +1,76 @@ + + + + + + + + + + +

WebGL渲染器常量(WebGLRenderer Constants)

+ +

面剔除模式

+ + THREE.CullFaceNone + THREE.CullFaceBack + THREE.CullFaceFront + THREE.CullFaceFrontBack + +

+ [page:constant CullFaceNone] 禁用面剔除。
+ [page:constant CullFaceBack] 为默认值,剔除背面。
+ [page:constant CullFaceFront] 剔除正面。
+ [page:constant CullFaceFrontBack] 剔除正面和背面。 +

+ +

正面方向

+ + THREE.FrontFaceDirectionCW + THREE.FrontFaceDirectionCCW + +

+ [page:constant FrontFaceDirectionCW] 将多边形的缠绕顺序设置为顺时针方向。
+ [page:constant FrontFaceDirectionCCW] 为默认值,将多边形的缠绕顺序设置为逆时针方向。 +

+ +

阴影类型

+ + THREE.BasicShadowMap + THREE.PCFShadowMap + THREE.PCFSoftShadowMap + +

+ 这些常量定义了WebGLRenderer中[page:WebGLRenderer.shadowMap.type shadowMap.type]的属性。

+ + [page:constant BasicShadowMap] 能够给出没有经过过滤的阴影映射 —— 速度最快,但质量最差。
+ [page:constant PCFShadowMap] 为默认值,使用Percentage-Closer Filtering (PCF)算法来过滤阴影映射。
+ [page:constant PCFSoftShadowMap] 使用Percentage-Closer Soft Shadows (PCSS) 算法来过滤阴影映射。 +

+ +

色调映射

+ + THREE.NoToneMapping + THREE.LinearToneMapping + THREE.ReinhardToneMapping + THREE.Uncharted2ToneMapping + THREE.CineonToneMapping + +

+ 这些常量定义了WebGLRenderer中[page:WebGLRenderer.toneMapping toneMapping]的属性。 + + 这个属性用于在普通计算机显示器或者移动设备屏幕等低动态范围介质上,模拟、逼近高动态范围(HDR)效果。

+ + [page:constant NoToneMapping] 禁用色调映射。
+ [page:constant LinearToneMapping] 为默认值,线性色调映射。

+ + 请查看示例:[example:webgl_tonemapping WebGL / tonemapping]。 + +

+ + +

源代码

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/constants.js src/constants.js] + + diff --git a/docs/api/zh/constants/Textures.html b/docs/api/zh/constants/Textures.html new file mode 100644 index 00000000000000..6fd270f70f2f92 --- /dev/null +++ b/docs/api/zh/constants/Textures.html @@ -0,0 +1,262 @@ + + + + + + + + + + + + +

材质常量(Texture Constants)

+ +

映射模式

+ + THREE.UVMapping + THREE.CubeReflectionMapping + THREE.CubeRefractionMapping + THREE.EquirectangularReflectionMapping + THREE.EquirectangularRefractionMapping + THREE.SphericalReflectionMapping + THREE.CubeUVReflectionMapping + THREE.CubeUVRefractionMapping + + +

+ 这些常量定义了纹理贴图的映射模式。
+ [page:Constant UVMapping]是默认值,纹理使用网格的坐标来进行映射。

+ 其它的值定义了环境映射的类型。

+ + [page:Constant CubeReflectionMapping] 和 [page:Constant CubeRefractionMapping] 用于 [page:CubeTexture CubeTexture] —— + 由6个纹理组合而成,每个纹理都是立方体的一个面。 + + 对于[page:CubeTexture CubeTexture]来说,[page:Constant CubeReflectionMapping]是其默认值。

+ + [page:Constant EquirectangularReflectionMapping] 和 [page:Constant EquirectangularRefractionMapping] + 用于等距圆柱投影的环境贴图,也被叫做经纬线映射贴图。等距圆柱投影贴图表示沿着其水平中线360°的视角,以及沿着其垂直轴向180°的视角。贴图顶部和底部的边缘分别对应于它所映射的球体的北极和南极。 +

+ + [page:Constant SphericalReflectionMapping] 用球形反射贴图,例如它可以通过剪裁镜面球的照片来获得。 + 无论摄像机相对于立方贴图对象或者表面的位置时怎样的,球形贴图被渲染时将会“面朝”摄像机。

+ + 请查看示例:[example:webgl_materials_envmaps materials / envmaps] 。 +

+ + +

包裹模式

+ + THREE.RepeatWrapping + THREE.ClampToEdgeWrapping + THREE.MirroredRepeatWrapping + +

+ 这些常量定义了纹理贴图的 [page:Texture.wrapS wrapS] 和 [page:Texture.wrapT wrapT] 属性,定义了水平和垂直方向上纹理的包裹方式。 +

+ + 使用[page:constant RepeatWrapping],纹理将简单地重复到无穷大。 + With [page:constant RepeatWrapping] the texture will simply repeat to infinity.

+ + [page:constant ClampToEdgeWrapping]是默认值,纹理中的最后一个像素将延伸到网格的边缘。

+ + 使用[page:constant MirroredRepeatWrapping], 纹理将重复到无穷大,在每次重复时将进行镜像。 +

+ +

Magnification Filters + 放大滤镜 +

+ + THREE.NearestFilter + THREE.LinearFilter + + +

+ 这些常量用于纹理的[page:Texture.magFilter magFilter]属性,它们定义了当被纹理化的像素映射到小于或者等于1纹理元素(texel)的区域时,将要使用的纹理放大函数。

+ + [page:constant NearestFilter]返回与指定纹理坐标(在曼哈顿距离之内)最接近的纹理元素的值。

+ [page:constant LinearFilter]是默认值,返回距离指定的纹理坐标最近的四个纹理元素的加权平均值, + 并且可以包含纹理的其他部分中,被包裹或者被重复的项目,具体取决于 [page:Texture.wrapS wrapS] 和 [page:Texture.wrapT wrapT] 的值,and on the exact mapping。 + +

+ +

缩小滤镜 + Minification Filters

+ + THREE.NearestFilter + THREE.NearestMipMapNearestFilter + THREE.NearestMipMapLinearFilter + THREE.LinearFilter + THREE.LinearMipMapNearestFilter + THREE.LinearMipMapLinearFilter + + +

+ 这些常量用于纹理的[page:Texture.minFilter minFilter]属性,它们定义了当被纹理化的像素映射到大于1纹理元素(texel)的区域时,将要使用的纹理缩小函数。

+ + 除了[page:constant NearestFilter] 和 [page:constant LinearFilter], + 下面的四个函数也可以用于缩小:

+ + [page:constant NearestMipMapNearestFilter]选择与被纹理化像素的尺寸最匹配的mipmap,并以[page:constant + NearestFilter](最靠近像素中心的纹理元素)为标准来生成纹理值。 +

+ + [page:constant NearestMipMapLinearFilter]选择与被纹理化像素的尺寸最接近的两个mipmap,并以[page:constant + NearestFilter]为标准来从每个mipmap中生成纹理值。最终的纹理值是这两个值的加权平均值。 +

+ + [page:constant LinearMipMapNearestFilter]选择与被纹理化像素的尺寸最匹配的mipmap,并以[page:constant + LinearFilter](最靠近像素中心的四个纹理元素的加权平均值)为标准来生成纹理值。 +

+ + [page:constant LinearMipMapLinearFilter]是默认值,它选择与被纹理化像素的尺寸最接近的两个mipmap,并以[page:constant + LinearFilter]为标准来从每个mipmap中生成纹理值。最终的纹理值是这两个值的加权平均值。

+ + 请查看示例:[example:webgl_materials_texture_filters materials / texture / filters]。 +

+ +

类型

+ + THREE.UnsignedByteType + THREE.ByteType + THREE.ShortType + THREE.UnsignedShortType + THREE.IntType + THREE.UnsignedIntType + THREE.FloatType + THREE.HalfFloatType + THREE.UnsignedShort4444Type + THREE.UnsignedShort5551Type + THREE.UnsignedShort565Type + THREE.UnsignedInt248Type + +

+ 这些常量用于纹理的[page:Texture.type type]属性,这些属性必须与正确的格式相对应。详情请查看下方。

+ + [page:constant UnsignedByteType] 是默认值。 +

+ +

格式

+ + THREE.AlphaFormat + THREE.RGBFormat + THREE.RGBAFormat + THREE.LuminanceFormat + THREE.LuminanceAlphaFormat + THREE.RGBEFormat + THREE.DepthFormat + THREE.DepthStencilFormat + +

+ 这些常量用于纹理的[page:Texture.format format]属性,它们定义了shader(着色器)将如何读取的2D纹理或者*texels*(纹理元素)的元素。.

+ + [page:constant AlphaFormat] 丢弃红、绿、蓝分量,仅读取Alpha分量。

+ + [page:constant RGBFormat] 丢弃Alpha分量,仅读取红、绿、蓝分量。

+ + [page:constant RGBAFormat] 是默认值,它将读取红、绿、蓝和Alpha分量。

+ + + [page:constant LuminanceFormat] 将每个元素作为单独的亮度分量来读取。 + 将其转换为范围限制在[0,1]区间的浮点数,然后通过将亮度值放入红、绿、蓝通道,并将1.0赋给Alpha通道,来组装成一个RGBA元素。

+ + + [page:constant LuminanceAlphaFormat] 将每个元素同时作为亮度分量和Alpha分量来读取。 + 和上面[page:constant LuminanceFormat]的处理过程是一致的,除了Alpha分量具有除了*1.0*以外的值。

+ + [page:constant RGBEFormat] 与 [page:constant RGBAFormat] 是相同的。

+ + [page:constant DepthFormat]将每个元素作为单独的深度值来读取,将其转换为范围限制在[0,1]区间的浮点数。 + 它是[page:DepthTexture DepthTexture]的默认值。

+ + [page:constant DepthStencilFormat]将每个元素同时作为一对深度值和模板值来读取。 + 其中的深度分量解释为[page:constant DepthFormat]。 + 模板分量基于深度+模板的内部格式来进行解释。 + +

+ 请注意,纹理必须具有正确的[page:Texture.type type]设置,正如上一节所描述的那样。 + 请参阅[link:https://developer.mozilla.org/en/docs/Web/API/WebGLRenderingContext/texImage2D + WebGLRenderingContext.texImage2D]来获得有关详细信息。 +

+ +

DDS / ST3C 压缩纹理格式

+ + THREE.RGB_S3TC_DXT1_Format + THREE.RGBA_S3TC_DXT1_Format + THREE.RGBA_S3TC_DXT3_Format + THREE.RGBA_S3TC_DXT5_Format + +

+ 要使用[page:CompressedTexture CompressedTexture]中的[page:Texture.format + format]属性,需要获得[link:https://www.khronos.org/registry/webgl/extensions/WEBGL_compressed_texture_s3tc/ + WEBGL_compressed_texture_s3tc]扩展的支持。

+ + 通过这个扩展,这里的四种[link:https://en.wikipedia.org/wiki/S3_Texture_Compression S3TC]格式将可以使用:
+ + [page:constant RGB_S3TC_DXT1_Format]:RGB图像格式的DXT1压缩图像。 + [page:constant RGBA_S3TC_DXT1_Format]:RGB图像格式的DXT1压缩图像,Alpha仅具有是/否透明两个值。
+ [page:constant RGBA_S3TC_DXT3_Format]:RGBA图像格式的DXT3压缩图像,和32位RGBA纹理贴图相比,它提供了4:1的压缩比。
+ [page:constant RGBA_S3TC_DXT5_Format]:RGBA图像格式的DXT5压缩图像,它也提供了4:1的压缩比,但与DX3格式的不同之处在于其Alpha是如何被压缩的。
+

+ +

PVRTC 压缩纹理格式 + PVRTC Compressed Texture Formats

+ + THREE.RGB_PVRTC_4BPPV1_Format + THREE.RGB_PVRTC_2BPPV1_Format + THREE.RGBA_PVRTC_4BPPV1_Format + THREE.RGBA_PVRTC_2BPPV1_Format + +

+ 要使用[page:CompressedTexture CompressedTexture]中的[page:Texture.format format]属性,需要获得 + [link:https://www.khronos.org/registry/webgl/extensions/WEBGL_compressed_texture_pvrtc/ + WEBGL_compressed_texture_pvrtc]扩展的支持。
+ PVRTC通常只在具有PowerVR芯片的移动设备上可用,这些设备主要是苹果设备。

+ + + 通过这个扩展,这里的四种[link:https://en.wikipedia.org/wiki/PVRTC PVRTC]格式将可以使用:
+ + [page:constant RGB_PVRTC_4BPPV1_Format]:4位模式下的RGB压缩,每4x4像素一个块。
+ [page:constant RGB_PVRTC_2BPPV1_Format]:2位模式下的RGB压缩,每8x4像素一个块。
+ [page:constant RGBA_PVRTC_4BPPV1_Format]: 4位模式下的RGBA压缩,每4x4像素一个块。
+ [page:constant RGBA_PVRTC_2BPPV1_Format]: 2位模式下的RGB压缩,每8x4像素一个块。
+

+ +

ETC 压缩纹理格式

+ + THREE.RGB_ETC1_Format + +

+ 要使用[page:CompressedTexture CompressedTexture]中的[page:Texture.format format]属性,需要获得 + [link:https://www.khronos.org/registry/webgl/extensions/WEBGL_compressed_texture_etc1/ + WEBGL_compressed_texture_etc1]扩展的支持。

+

+ +

编码

+ + THREE.LinearEncoding + THREE.sRGBEncoding + THREE.GammaEncoding + THREE.RGBEEncoding + THREE.LogLuvEncoding + THREE.RGBM7Encoding + THREE.RGBM16Encoding + THREE.RGBDEncoding + THREE.BasicDepthPacking + THREE.RGBADepthPacking + +

+ 这些常量用于纹理的[page:Texture.encoding encoding]属性。

+ + 如果编码类型在纹理已被一个材质使用之后发生了改变, + 你需要来设置[page:Material.needsUpdate Material.needsUpdate]为*true*来使得材质重新编译。

+ + [page:constant LinearEncoding]是默认值。 + 除此之外的其他值仅在材质的贴图、envMap和emissiveMap中有效。 +

+ +

源代码

+ [link:https://github.com/mrdoob/three.js/blob/master/src/constants.js src/constants.js] + + + \ No newline at end of file diff --git a/docs/api/zh/core/BufferAttribute.html b/docs/api/zh/core/BufferAttribute.html new file mode 100644 index 00000000000000..053f0689b254b7 --- /dev/null +++ b/docs/api/zh/core/BufferAttribute.html @@ -0,0 +1,215 @@ + + + + + + + + + + +

[name]

+ +

+ This class stores data for an attribute (such as vertex positions, face indices, normals, + colors, UVs, and any custom attributes ) associated with a [page:BufferGeometry], which allows + for more efficient passing of data to the GPU. See that page for details and a usage example.

+ + Data is stored as vectors of any length (defined by [page:BufferAttribute.itemSize itemSize]), + and in general in the methods outlined below if passing in an index, this is automatically + multiplied by the vector length. +

+ +

Constructor

+

[name]( [param:TypedArray array], [param:Integer itemSize], [param:Boolean normalized] )

+

+ [page:TypedArray array] -- Must be a [link:https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/TypedArray TypedArray]. + Used to instantiate the buffer.
+ This array should have + itemSize * numVertices + elements, where numVertices is the number of vertices in the associated [page:BufferGeometry BufferGeometry].

+ + + [page:Integer itemSize] -- the number of values of the array that should be associated with + a particular vertex. For instance, if this + attribute is storing a 3-component vector (such as a position, normal, or color), then itemSize should be 3. +

+ + [page:Boolean normalized] -- (optional) Indicates how the underlying data in the buffer maps + to the values in the GLSL code. For instance, if [page:TypedArray array] is an instance of + UInt16Array, and [page:Boolean normalized] is true, the values 0 - +65535 in the array + data will be mapped to 0.0f - +1.0f in the GLSL attribute. An Int16Array (signed) would map + from -32767 - +32767 to -1.0f - +1.0f. If [page:Boolean normalized] is false, the values + will be converted to floats which contain the exact value, i.e. 32767 becomes 32767.0f. +

+ +

Properties

+ +

[property:TypedArray array]

+

+ The [page:TypedArray array] holding data stored in the buffer. +

+ +

[property:Integer count]

+

+ Stores the [page:BufferAttribute.array array]'s length divided by the [page:BufferAttribute.itemSize itemSize].

+ + If the buffer is storing a 3-component vector (such as a position, normal, or color), + then this will count the number of such vectors stored. +

+ +

[property:Boolean dynamic]

+

+ Whether the buffer is dynamic or not. Default is *false*.
+ + If false, the GPU is informed that contents of the buffer are likely to be used often and not change often. + This corresponds to the [link:https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/bufferData gl.STATIC_DRAW] flag.
+ if true, the GPU is informed that contents of the buffer are likely to be used often and change often. + This corresponds to the [link:https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/bufferData gl.DYNAMIC_DRAW] flag. +

+ +

[property:Boolean isBufferAttribute]

+

+ Used to check whether this or derived classes are BufferAttributes. Default is *true*.

+ + You should not change this, as it used internally for optimisation. +

+ +

[property:Integer itemSize]

+

The length of vectors that are being stored in the [page:BufferAttribute.array array].

+ +

[property:String name]

+

+ Optional name for this attribute instance. Default is an empty string. +

+ +

[property:Boolean needsUpdate]

+

+ Flag to indicate that this attribute has changed and should be re-sent to the GPU. + Set this to true when you modify the value of the array.

+ + Setting this to true also increments the [page:BufferAttribute.version version]. +

+ +

[property:Boolean normalized]

+

+ Indicates how the underlying data in the buffer maps to the values in the GLSL shader code. + See the constructor above for details. +

+ +

[property:Function onUploadCallback]

+

+ A callback function that is executed after the Renderer has transfered the attribute array data to the GPU. +

+ +

[property:Object updateRange]

+

Object containing:
+ [page:Integer offset]: Default is *0*. Position at whcih to start update.
+ [page:Integer count]: Default is *-1*, which means don't use update ranges.

+ + This can be used to only update some components of stored vectors (for example, just the component + related to color). +

+ +

[property:Integer version]

+

A version number, incremented every time the [page:BufferAttribute.needsUpdate needsUpdate] property is set to true.

+ + +

Methods

+ +

[method:BufferAttribute clone]()

+

Return a copy of this bufferAttribute.

+ +

[method:BufferAttribute copyArray]( array )

+

Copy the array given here (which can be a normal array or TypedArray) into + [page:BufferAttribute.array array].

+ + See [link:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/set TypedArray.set] + for notes on requirements if copying a TypedArray. +

+ +

[method:null copyAt] ( [param:Integer index1], [param:BufferAttribute bufferAttribute], [param:Integer index2] )

+

Copy a vector from bufferAttribute[index2] to [page:BufferAttribute.array array][index1].

+ +

[method:BufferAttribute copyColorsArray]( [param:Array colors] )

+

Copy an array representing RGB color values into [page:BufferAttribute.array array].

+ +

[method:BufferAttribute copyVector2sArray]( [param:Array vectors] )

+

Copy an array representing [page:Vector2]s into [page:BufferAttribute.array array].

+ +

[method:BufferAttribute copyVector3sArray]( [param:Array vectors] )

+

Copy an array representing [page:Vector3]s into [page:BufferAttribute.array array].

+ +

[method:BufferAttribute copyVector4sArray]( [param:Array vectors] )

+

Copy an array representing [page:Vector4]s into [page:BufferAttribute.array array].

+ +

[method:Number getX]( [param:Integer index] )

+

Returns the x component of the vector at the given index.

+ +

[method:Number getY]( [param:Integer index] )

+

Returns the y component of the vector at the given index.

+ +

[method:Number getZ]( [param:Integer index] )

+

Returns the z component of the vector at the given index.

+ +

[method:Number getW]( [param:Integer index] )

+

Returns the w component of the vector at the given index.

+ +

[method:null onUpload]( [param:Function callback] )

+

+ Sets the value of the onUploadCallback property.

+ + In the [example:webgl_buffergeometry WebGL / Buffergeometry] this is used to free memory + after the buffer has been transfered to the GPU. +

+ +

[method:BufferAttribute set] ( [param:Array value], [param:Integer offset] )

+

+ value -- an [page:Array] or [page:TypedArray] from which to copy values.
+ offset -- (optional) index of the [page:BufferAttribute.array array] at which to start copying.

+ + Calls [link:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/set TypedArray.set]( [page:Array value], [page:Integer offset] ) + on the [page:BufferAttribute.array array].

+ + In particular, see that page for requirements on [page:Array value] + being a [page:TypedArray]. +

+ +

[method:BufferAttribute setArray] ( [param:TypedArray array] )

+

+ [page:BufferAttribute.array array] to the TypedArray passed in here.

+ + After setting the array, [page:BufferAttribute.needsUpdate needsUpdate] should be set to true. +

+ +

[method:BufferAttribute setDynamic] ( [param:Boolean value] )

+

Set [page:BufferAttribute.dynamic dynamic] to value.

+ +

[method:BufferAttribute setX]( [param:Integer index], [param:Float x] )

+

Sets the x component of the vector at the given index.

+ +

[method:BufferAttribute setY]( [param:Integer index], [param:Float y] )

+

Sets the y component of the vector at the given index.

+ +

[method:BufferAttribute setZ]( [param:Integer index], [param:Float z] )

+

Sets the z component of the vector at the given index.

+ +

[method:BufferAttribute setW]( [param:Integer index], [param:Float w] )

+

Sets the w component of the vector at the given index.

+ +

[method:BufferAttribute setXY]( [param:Integer index], [param:Float x], [param:Float y] )

+

Sets the x and y components of the vector at the given index.

+ +

[method:BufferAttribute setXYZ]( [param:Integer index], [param:Float x], [param:Float y], [param:Float z] )

+

Sets the x, y and z components of the vector at the given index.

+ +

[method:BufferAttribute setXYZW]( [param:Integer index], [param:Float x], [param:Float y], [param:Float z], [param:Float w] )

+

Sets the x, y, z and w components of the vector at the given index.

+ + + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/core/BufferGeometry.html b/docs/api/zh/core/BufferGeometry.html new file mode 100644 index 00000000000000..2f361191f4b574 --- /dev/null +++ b/docs/api/zh/core/BufferGeometry.html @@ -0,0 +1,362 @@ + + + + + + + + + + +

[name]

+ +

+ An efficient representation of mesh, line, or point geometry. Includes vertex positions, face + indices, normals, colors, UVs, and custom attributes within buffers, reducing the cost of + passing all this data to the GPU. +

+

+ To read and edit data in BufferGeometry attributes, see [page:BufferAttribute] documentation. +

+

+ For a less efficient but easier-to-use representation of geometry, see [page:Geometry]. +

+ +

Example

+ + var geometry = new THREE.BufferGeometry(); + // create a simple square shape. We duplicate the top left and bottom right + // vertices because each vertex needs to appear once per triangle. + var vertices = new Float32Array( [ + -1.0, -1.0, 1.0, + 1.0, -1.0, 1.0, + 1.0, 1.0, 1.0, + + 1.0, 1.0, 1.0, + -1.0, 1.0, 1.0, + -1.0, -1.0, 1.0 + ] ); + + // itemSize = 3 because there are 3 values (components) per vertex + geometry.addAttribute( 'position', new THREE.BufferAttribute( vertices, 3 ) ); + var material = new THREE.MeshBasicMaterial( { color: 0xff0000 } ); + var mesh = new THREE.Mesh( geometry, material ); + +

+ [example:webgl_buffergeometry Mesh with non-indexed faces]
+ [example:webgl_buffergeometry_indexed Mesh with indexed faces]
+ [example:webgl_buffergeometry_lines Lines]
+ [example:webgl_buffergeometry_lines_indexed Indexed Lines]
+ [example:webgl_buffergeometry_custom_attributes_particles Particles]
+ [example:webgl_buffergeometry_rawshader Raw Shaders] +

+ + +

Accessing Attributes

+

+ WebGL stores data associated with individual vertices of a geometry in attributes. + Examples include the position of the vertex, the normal vector for the vertex, the vertex color, + and so on. When using [page:Geometry], the [page:WebGLRenderer renderer] takes care of wrapping + up this information into typed array buffers and sending this data to the shader. With + BufferGeometry, all of this data is stored in buffers associated with individual attributes. + This means that to get the position data associated with a vertex (for instance), you must call + [page:.getAttribute] to access the 'position' [page:BufferAttribute attribute], then access the individual + x, y, and z coordinates of the position. +

+

+ The following attributes are set by various members of this class: +

+

[page:BufferAttribute position] (itemSize: 3)

+

+ Stores the x, y, and z coordinates of each vertex in this geometry. Set by [page:.fromGeometry](). +

+ +

[page:BufferAttribute normal] (itemSize: 3)

+

+ Stores the x, y, and z components of the vertex normal vector of each vertex in this geometry. + Set by [page:.fromGeometry](). +

+ +

[page:BufferAttribute color] (itemSize: 3)

+

+ Stores the red, green, and blue channels of vertex color of each vertex in this geometry. + Set by [page:.fromGeometry](). +

+ +

+ In addition to the the built-in attributes, you can set your own custom attributes using the addAttribute method. With [page:Geometry], these attributes are set and stored on the [page:Material]. In BufferGeometry, the attributes are stored with the geometry itself. Note that you still need to set the attributes information on the material as well, but the value of each attribute is stored in the BufferGeometry. +

+ + +

Constructor

+ + +

[name]()

+
+ This creates a new [name]. It also sets several properties to a default value. +
+ + +

Properties

+ +

[property:Object attributes]

+

+ This hashmap has as id the name of the attribute to be set and as value the [page:BufferAttribute buffer] to set it to. + Rather than accessing this property directly, use [page:.addAttribute] and [page:.getAttribute] to access attributes of this geometry. +

+ +

[property:Box3 boundingBox]

+

+ Bounding box for the bufferGeometry, which can be calculated with + [page:.computeBoundingBox](). Default is *null*. +

+ +

[property:Sphere boundingSphere]

+

+ Bounding sphere for the bufferGeometry, which can be calculated with + [page:.computeBoundingSphere](). Default is *null*. +

+ +

[property:Object drawRange]

+

+ Used to determine what part of the geometry should be rendered. This should not + be set directly, instead use [page:.setDrawRange].
+ Default is + + { start: 0, count: Infinity } + +

+ +

[property:Array groups]

+

+ Split the geometry into groups, each of which will be rendered in a separate WebGL draw call. + This allows an array of materials to be used with the bufferGeometry.

+ + Each group is an object of the form: + { start: Integer, count: Integer, materialIndex: Integer } + where start specifies the first element in this draw call – the first vertex for non-indexed geometry, + otherwise the first triangle index. Count specifies how many vertices (or indices) are included, and + materialIndex specifies the material array index to use.

+ + Use [page:.addGroup] to add groups, rather than modifying this array directly. +

+ + + + + +

[property:Integer id]

+

Unique number for this bufferGeometry instance.

+ +

[property:BufferAttribute index]

+

+ Allows for vertices to be re-used across multiple triangles; this is called using "indexed triangles" and + works much the same as it does in [page:Geometry]: each triangle is associated with the indices of three vertices. + This attribute therefore stores the index of each vertex for each triangular face. + + If this attribute is not set, the [page:WebGLRenderer renderer] assumes that each three contiguous + positions represent a single triangle. + + Default is *null*. +

+ +

[property:Boolean isBufferGeometry]

+

+ Used to check whether this or derived classes are BufferGeometries. Default is *true*.

+ + You should not change this, as it used internally for optimisation. +

+ +

[property:Object morphAttributes]

+

+ Hashmap of [page:BufferAttribute]s holding details of the geometry's [page:Geometry.morphTargets morphTargets]. +

+ +

[property:String name]

+

+ Optional name for this bufferGeometry instance. Default is an empty string. +

+ +

[property:Object userData]

+

+ An object that can be used to store custom data about the BufferGeometry. It should not hold + references to functions as these will not be cloned. +

+ +

[property:String uuid]

+

+ [link:http://en.wikipedia.org/wiki/Universally_unique_identifier UUID] of this object instance. + This gets automatically assigned and shouldn't be edited. +

+ +

Methods

+ +

[page:EventDispatcher EventDispatcher] methods are available on this class.

+ +

[method:BufferGeometry addAttribute]( [param:String name], [param:BufferAttribute attribute] )

+

+ Adds an attribute to this geometry. Use this rather than the attributes property, + because an internal hashmap of [page:.attributes] is maintained to speed up iterating over + attributes. +

+ +

[method:null addGroup]( [param:Integer start], [param:Integer count], [param:Integer materialIndex] )

+

+ Adds a group to this geometry; see the [page:BufferGeometry.groups groups] + property for details. +

+ + +

[method:null applyMatrix]( [param:Matrix4 matrix] )

+

Bakes matrix transform directly into vertex coordinates.

+ +

[method:BufferGeometry center] ()

+

Center the geometry based on the bounding box.

+ +

[method:BufferGeometry clone]()

+

Creates a clone of this BufferGeometry.

+ +

[method:BufferGeometry copy]( [param:BufferGeometry bufferGeometry] )

+

Copies another BufferGeometry to this BufferGeometry.

+ +

[method:null clearGroups]( )

+

Clears all groups.

+ +

[method:null computeBoundingBox]()

+

+ Computes bounding box of the geometry, updating [param:.boundingBox] attribute.
+ Bounding boxes aren't computed by default. They need to be explicitly computed, otherwise they are *null*. +

+ +

[method:null computeBoundingSphere]()

+

+ Computes bounding sphere of the geometry, updating [page:.boundingSphere] attribute.
+ Bounding spheres aren't computed by default. They need to be explicitly computed, otherwise they are *null*. +

+ +

[method:null computeVertexNormals]()

+

Computes vertex normals by averaging face normals.

+ +

[method:null dispose]()

+

+ Disposes the object from memory.
+ You need to call this when you want the BufferGeometry removed while the application is running. +

+ +

[method:BufferGeometry fromDirectGeometry]( [param:Geometry] )

+

+ Populates this BufferGeometry with data from a [page:DirectGeometry] object containing faces. Not implemented for a line geometry.

+ + Note: [page:DirectGeometry] is mainly used as an intermediary object for converting between [page:Geometry] + and BufferGeometry. +

+ +

[method:BufferGeometry fromGeometry]( [param:Geometry] )

+

Populates this BufferGeometry with data from a [page:Geometry] object containing faces. Not implemented for a line geometry.

+ +

[method:BufferAttribute getAttribute]( [param:String name] )

+

Returns the [page:BufferAttribute attribute] with the specified name.

+ +

[method:BufferAttribute getIndex] ()

+

Return the [page:.index] buffer.

+ +

[method:BufferGeometry lookAt] ( [param:Vector3 vector] )

+

+ vector - A world vector to look at.

+ + Rotates the geometry to face a point in space. This is typically done as a one time operation, and not during a loop. + Use [page:Object3D.lookAt] for typical real-time mesh usage. +

+ +

[method:null merge]( [param:BufferGeometry bufferGeometry], [param:Integer offset] )

+

Merge in another BufferGeometry with an optional offset of where to start merging in.

+ +

[method:null normalizeNormals]()

+

+ Every normal vector in a geometry will have a magnitude of 1. + This will correct lighting on the geometry surfaces. +

+ +

[method:BufferAttribute removeAttribute]( [param:String name] )

+

Removes the [page:BufferAttribute attribute] with the specified name.

+ +

[method:BufferGeometry rotateX] ( [param:Float radians] )

+

+ Rotate the geometry about the X axis. This is typically done as a one time operation, and not during a loop. + Use [page:Object3D.rotation] for typical real-time mesh rotation. +

+ +

[method:BufferGeometry rotateY] ( [param:Float radians] )

+

+ Rotate the geometry about the Y axis. This is typically done as a one time operation, and not during a loop. + Use [page:Object3D.rotation] for typical real-time mesh rotation. +

+ +

[method:BufferGeometry rotateZ] ( [param:Float radians] )

+

+ Rotate the geometry about the Z axis. This is typically done as a one time operation, and not during a loop. + Use [page:Object3D.rotation] for typical real-time mesh rotation. +

+ +

[method:BufferGeometry scale] ( [param:Float x], [param:Float y], [param:Float z] )

+

+ Scale the geometry data. This is typically done as a one time operation, and not during a loop. + Use [page:Object3D.scale] for typical real-time mesh scaling. +

+ +

[method:null setIndex] ( [param:BufferAttribute index] )

+

Set the [page:.index] buffer.

+ +

[method:null setDrawRange] ( [param:Integer start], [param:Integer count] )

+

Set the [page:.drawRange] buffer. See that property for details.

+ +

[method:BufferGeometry setFromObject] ( [param:Object3D object] )

+

Sets the attributes for this BufferGeometry from an [page:Object3D].

+ +

[method:BufferGeometry setFromPoints] ( [param:Array points] )

+

Sets the attributes for this BufferGeometry from an array of points.

+ +

[method:Object toJSON]()

+

Returns a JSON object representation of the BufferGeometry.

+ +

[method:BufferGeometry toNonIndexed]()

+

Return a non-index version of an indexed BufferGeometry.

+ +

[method:BufferGeometry translate] ( [param:Float x], [param:Float y], [param:Float z] )

+

+ Translate the geometry. This is typically done as a one time operation, and not during a loop. + Use [page:Object3D.position] for typical real-time mesh translation. +

+ +

[method:BufferGeometry updateFromObject] ( [param:Object3D object] )

+
Updates the attributes for this BufferGeometry from an [page:Object3D].
+ + + + + + + + + + + + + + + + + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/core/Clock.html b/docs/api/zh/core/Clock.html new file mode 100644 index 00000000000000..9d1b6a7d0a956f --- /dev/null +++ b/docs/api/zh/core/Clock.html @@ -0,0 +1,87 @@ + + + + + + + + + + +

[name]

+ +

+ Object for keeping track of time. This uses performance.now() + if it is available, otherwise it reverts to the less accurate Date.now(). +

+ + +

Constructor

+ + +

[name]( [param:Boolean autoStart] )

+

+ autoStart — (optional) whether to automatically start the clock. Default is true. +

+ +

Properties

+ +

[property:Boolean autoStart]

+

+ If set, starts the clock automatically when the first update is called. Default is true. +

+ +

[property:Float startTime]

+

+ Holds the time at which the clock's [page:Clock.start start] method was last called. +

+ + +

[property:Float oldTime]

+

+ Holds the time at which the clock's [page:Clock.start start], [page:Clock.getElapsedTime getElapsedTime] or [page:Clock.getDelta getDelta] + methods were last called. +

+ +

[property:Float elapsedTime]

+

+ Keeps track of the total time that the clock has been running. +

+ +

[property:Boolean running]

+

+ Whether the clock is running or not. +

+ + +

Methods

+ +

[method:null start]()

+

+ Starts clock. Also sets the [page:Clock.startTime startTime] and [page:Clock.oldTime oldTime] + to the current time, sets [page:Clock.elapsedTime elapsedTime] to *0* and [page:Clock.running running] to *true*. +

+ +

[method:null stop]()

+

+ Stops clock and sets [page:Clock.oldTime oldTime] to the current time. +

+ +

[method:Float getElapsedTime]()

+

+ Get the seconds passed since the clock started and sets [page:Clock.oldTime oldTime] to the current time.
+ If [page:Clock.autoStart autoStart] is *true* and the clock is not running, also starts the clock. +

+ +

[method:Float getDelta]()

+

+ Get the seconds passed since the time [page:Clock.oldTime oldTime] was set and sets [page:Clock.oldTime oldTime] to the current time.
+ If [page:Clock.autoStart autoStart] is *true* and the clock is not running, also starts the clock. +

+ + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/core/DirectGeometry.html b/docs/api/zh/core/DirectGeometry.html new file mode 100644 index 00000000000000..c94f455079ed4c --- /dev/null +++ b/docs/api/zh/core/DirectGeometry.html @@ -0,0 +1,108 @@ + + + + + + + + + + +

[name]

+ +

+ This class is used internally to convert from [page:Geometry] to [page:BufferGeometry]. +

+ + + +

Constructor

+ + +

[name]()

+

This creates a new [name].

+ + +

Properties

+ +

[property:Integer id]

+

Unique number for this [name] instance.

+ +

[property:String name]

+

Optional name. Default is the empty string.

+ +

[property:Array type]

+

String 'DirectGeometry'.

+ +

[property:Array vertices]

+

Initialiased as an empty array, this is populated by [page:.fromGeometry]().

+ +

[property:Array normals]

+

Initialiased as an empty array, this is populated by [page:.fromGeometry]().

+ +

[property:Array colors]

+

Initialiased as an empty array, this is populated by [page:.fromGeometry]().

+ +

[property:Array uvs]

+

Initialiased as an empty array, this is populated by [page:.fromGeometry]().

+ +

[property:Array uvs2]

+

Initialiased as an empty array, this is populated by [page:.fromGeometry]().

+ +

[property:Array groups]

+

Initialiased as an empty array, this is populated by [page:.fromGeometry]().

+ +

[property:Array morphTargets]

+

Initialiased as an empty array, this is populated by [page:.fromGeometry]().

+ +

[property:Array skinWeights]

+

Initialiased as an empty array, this is populated by [page:.fromGeometry]().

+ +

[property:Array skinIndices]

+

Initialiased as an empty array, this is populated by [page:.fromGeometry]().

+ +

[property:Box3 boundingBox]

+

+ Bounding box for the bufferGeometry, which can be calculated with + [page:.computeBoundingBox](). Default is *null*. +

+ +

[property:Sphere boundingSphere]

+

+ Bounding sphere for the bufferGeometry, which can be calculated with + [page:.computeBoundingSphere](). Default is *null*. +

+ +

[property:Boolean verticesNeedUpdate]

+

Default is false.

+ +

[property:Boolean normalsNeedUpdate]

+

Default is false.

+ +

[property:Boolean colorsNeedUpdate]

+

Default is false.

+ +

[property:Boolean uvsNeedUpdate]

+

Default is false.

+ +

[property:Boolean groupsNeedUpdate]

+

Default is false.

+ + +

Methods

+ +

[property:null computeGroups]( [param:Geometry geometry] )

+

+ Compute the parts of the geometry that have different materialIndex. + See [page:BufferGeometry.groups]. +

+ +

[property:null fromGeometry]( [param:Geometry geometry] )

+

Pass in a [page:Geometry] instance for conversion.

+ + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/core/EventDispatcher.html b/docs/api/zh/core/EventDispatcher.html new file mode 100644 index 00000000000000..f276946c431a02 --- /dev/null +++ b/docs/api/zh/core/EventDispatcher.html @@ -0,0 +1,100 @@ + + + + + + + + + + +

[name]

+ +

+ JavaScript events for custom objects.
+ [link:https://github.com/mrdoob/eventdispatcher.js Eventdispatcher on GitHub] +

+ +

Example

+ + +// Adding events to a custom object + +var Car = function () { + + this.start = function () { + + this.dispatchEvent( { type: 'start', message: 'vroom vroom!' } ); + + }; + +}; + +// Mixing the EventDispatcher.prototype with the custom object prototype + +Object.assign( Car.prototype, EventDispatcher.prototype ); + +// Using events with the custom object + +var car = new Car(); + +car.addEventListener( 'start', function ( event ) { + + alert( event.message ); + +} ); + +car.start(); + + +

Constructor

+ +

[name]()

+

+ Creates EventDispatcher object. +

+ + +

Methods

+ +

[method:null addEventListener]( [param:String type], [param:Function listener] )

+

+ type - The type of event to listen to.
+ listener - The function that gets called when the event is fired. +

+

+ Adds a listener to an event type. +

+ +

[method:Boolean hasEventListener]( [param:String type], [param:Function listener] )

+

+ type - The type of event to listen to.
+ listener - The function that gets called when the event is fired. +

+

+ Checks if listener is added to an event type. +

+ +

[method:null removeEventListener]( [param:String type], [param:Function listener] )

+

+ type - The type of the listener that gets removed.
+ listener - The listener function that gets removed. +

+

+ Removes a listener from an event type. +

+ +

[method:null dispatchEvent]( [param:object event] )

+

+ event - The event that gets fired. +

+

+ Fire an event type. +

+ + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/core/Face3.html b/docs/api/zh/core/Face3.html new file mode 100644 index 00000000000000..887dc6a6aaf038 --- /dev/null +++ b/docs/api/zh/core/Face3.html @@ -0,0 +1,134 @@ + + + + + + + + + + +

[name]

+ +

+ Triangular face used in [page:Geometry]. These are created automatically for all + standard geometry types, however if you are building a custom geometry you will have to + create them manually. +

+ + +

Examples

+ +

[example:misc_ubiquity_test ubiquity / test ]

+

[example:svg_sandbox svg / sandbox ]

+

[example:misc_exporter_obj exporter / obj ]

+

[example:webgl_shaders_vector WebGL / shaders / vector ]

+ + + +var material = new THREE.MeshStandardMaterial( { color : 0x00cc00 } ); + +//create a triangular geometry +var geometry = new THREE.Geometry(); +geometry.vertices.push( new THREE.Vector3( -50, -50, 0 ) ); +geometry.vertices.push( new THREE.Vector3( 50, -50, 0 ) ); +geometry.vertices.push( new THREE.Vector3( 50, 50, 0 ) ); + +//create a new face using vertices 0, 1, 2 +var normal = new THREE.Vector3( 0, 1, 0 ); //optional +var color = new THREE.Color( 0xffaa00 ); //optional +var materialIndex = 0; //optional +var face = new THREE.Face3( 0, 1, 2, normal, color, materialIndex ); + +//add the face to the geometry's faces array +geometry.faces.push( face ); + +//the face normals and vertex normals can be calculated automatically if not supplied above +geometry.computeFaceNormals(); +geometry.computeVertexNormals(); + +scene.add( new THREE.Mesh( geometry, material ) ); + + + +

Constructor

+ +

[name]( [param:Integer a], [param:Integer b], [param:Integer c], [param:Vector3 normal], [param:Color color], [param:Integer materialIndex] )

+

+ a — Vertex A index.
+ b — Vertex B index.
+ c — Vertex C index.

+ + normal — (optional) Face normal ([page:Vector3 Vector3]) or array of vertex normals. + If a single vector is passed in, this sets [page:.normal], otherwise if an array of three + vectors is passed in this sets [page:.vertexNormals]

+ + color — (optional) Face [page:Color color] or array of vertex [page:Color colors]. + If a single vector is passed in, this sets [page:.color], otherwise if an array of three + vectors is passed in this sets [page:.vertexColors]

+ + materialIndex — (optional) which index of an array of materials to associate + with the face. +

+ +

Properties

+ +

[property:Integer a]

+

+ Vertex A index. +

+ +

[property:Integer b]

+

+ Vertex B index. +

+ +

[property:Integer c]

+

+ Vertex C index. +

+ +

[property:Vector3 normal]

+

+ Face normal - vector showing the direction of the Face3. If calculated automatically + (using [page:Geometry.computeFaceNormals]), this is the normalized cross product of two edges of the + triangle. Default is *(0, 0, 0)*. +

+ +

[property:Color color]

+

+ Face color - for this to be used a material's [page:Material.vertexColors vertexColors] property + must be set to [page:Materials THREE.FaceColors]. +

+ +

[property:Array vertexNormals]

+

+ Array of 3 [page:Vector3 vertex normals]. +

+ +

[property:Array vertexColors]

+

+ Array of 3 vertex colors - for these to be used a material's [page:Material.vertexColors vertexColors] property + must be set to [page:Materials THREE.VertexColors]. +

+ + +

[property:Integer materialIndex]

+

+ Material index (points to an index in the associated array of materials). Default is *0*. +

+ +

Methods

+ +

[method:Face3 clone]()

+

Creates a new clone of the Face3 object.

+ +

[method:Face3 copy]( [param:Face3 face3] )

+

Copy the paramaters of another Face3 into this.

+ + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/core/Geometry.html b/docs/api/zh/core/Geometry.html new file mode 100644 index 00000000000000..697a24c0455b89 --- /dev/null +++ b/docs/api/zh/core/Geometry.html @@ -0,0 +1,345 @@ + + + + + + + + + + +

[name]

+ +
+

+ Geometry is a user-friendly alternative to [page:BufferGeometry]. Geometries store attributes + (vertex positions, faces, colors, etc.) using objects like [page:Vector3] or [page:Color] that + are easier to read and edit, but less efficient than typed arrays. +

+

+ Prefer [page:BufferGeometry] for large or serious projects. +

+
+ + +

Example

+ +
[example:webgl_geometry_minecraft WebGL / geometry / minecraft ]
+
[example:webgl_geometry_minecraft_ao WebGL / geometry / minecraft / ao ]
+
[example:webgl_geometry_nurbs WebGL / geometry / nurbs ]
+
[example:webgl_geometry_spline_editor WebGL / geometry / spline / editor ]
+
[example:webgl_interactive_cubes_gpu WebGL / interactive / cubes / gpu ]
+
[example:webgl_interactive_lines WebGL / interactive / lines ]
+
[example:webgl_interactive_raycasting_points WebGL / interactive / raycasting / points ]
+
[example:webgl_interactive_voxelpainter WebGL / interactive / voxelpainter ]
+
[example:webgl_morphnormals WebGL / morphNormals ]
+ + + var geometry = new THREE.Geometry(); + + geometry.vertices.push( + new THREE.Vector3( -10, 10, 0 ), + new THREE.Vector3( -10, -10, 0 ), + new THREE.Vector3( 10, -10, 0 ) + ); + + geometry.faces.push( new THREE.Face3( 0, 1, 2 ) ); + + geometry.computeBoundingSphere(); + + +

Constructor

+ + +

[name]()

+

+ The constructor takes no arguments. +

+ + +

Properties

+ +

[property:Box3 boundingBox]

+

+ Bounding box for the Geometry, which can be calculated with + [page:.computeBoundingBox](). Default is *null*. +

+ +

[property:Sphere boundingSphere]

+

+ Bounding sphere for the Geometry, which can be calculated with + [page:.computeBoundingSphere](). Default is *null*. +

+ +

[property:Array colors]

+

+ Array of vertex [page:Color colors], matching number and order of vertices.

+ + This is used by [page:Points] and [page:Line] and any classes derived from those such as [page:LineSegments] and various helpers. + [page:Mesh Meshes] use [page:Face3.vertexColors] instead of this.

+ + To signal an update in this array, [page:Geometry Geometry.colorsNeedUpdate] needs to be set to true. +

+ +

[property:Array faces]

+

+ Array of [page:Face3 faces].
+ The array of faces describe how each vertex in the model is connected to form faces. + Additionally it holds information about face and vertex normals and colors.

+ To signal an update in this array, [page:Geometry Geometry.elementsNeedUpdate] needs to be set to true. +

+ +

[property:Array faceVertexUvs]

+

+ Array of face [link:https://en.wikipedia.org/wiki/UV_mapping UV] layers, used for mapping textures onto the geometry.
+ Each UV layer is an array of [page:UV]s matching the order and number of vertices in faces.

+ To signal an update in this array, [page:Geometry Geometry.uvsNeedUpdate] needs to be set to true. +

+ +

[property:Integer id]

+

Unique number for this geometry instance.

+ +

[property:Boolean isGeometry]

+

+ Used to check whether this or derived classes are Geometries. Default is *true*.

+ + You should not change this, as it used internally for optimisation. +

+ +

[property:array lineDistances]

+

+ An array containing distances between vertices for Line geometries. + This is required for [page:LineDashedMaterial] to render correctly. +

+ +

[property:Array morphTargets]

+

+ Array of [link:https://en.wikipedia.org/wiki/Morph_target_animation morph targets]. Each morph target is a Javascript object: + { name: "targetName", vertices: [ new THREE.Vector3(), ... ] } + Morph vertices match number and order of primary vertices. +

+ +

[property:Array morphNormals]

+

+ Array of morph normals. Morph normals have similar structure as morph targets, each normal set is a Javascript object: + morphNormal = { name: "NormalName", normals: [ new THREE.Vector3(), ... ] } + + See the [example:webgl_morphnormals WebGL / morphNormals] example. +

+ +

[property:String name]

+

Optional name for this geometry. Default is an empty string.

+ +

[property:Array skinWeights]

+

+ When working with a [page:SkinnedMesh], each vertex can have up to 4 [page:Bone bones] affecting it. + The skinWeights property is an array of weight values that correspond to the order of the vertices in + the geometry. So for instance, the first skinWeight would correspond to the first vertex in the geometry. + Since each vertex can be modified by 4 bones, a [page:Vector4] is used to represent the skin weights + for that vertex. +

+

+ The values of the vector should typically be between 0 and 1. For instance when set to 0 the bone + transformation will have no affect. When set to 0.5 it will have 50% affect. When set to 100%, it will + have 100% affect. If there is only 1 bone associated with the vertex then you only need to worry about + the first component of the vector, the rest can be ignored and set to 0. +

+ +

[property:Array skinIndices]

+

+ Just like the skinWeights property, the skinIndices' values correspond to the geometry's vertices. + Each vertex can have up to 4 bones associated with it. So if you look at the first vertex, and the + first skinIndex, this will tell you the bones associated with that vertex. For example the first vertex + could have a value of ( 10.05, 30.10, 12.12 ). Then the first skin index could have the + value of ( 10, 2, 0, 0 ). The first skin weight could have the value of + ( 0.8, 0.2, 0, 0 ). In affect this would take the first vertex, and then the bone + mesh.bones[10] and apply it 80% of the way. Then it would take the bone skeleton.bones[2] + and apply it 20% of the way. The next two values have a weight of 0, so they would have no affect. +

+

+ In code another example could look like this: + + // e.g. + geometry.skinIndices[15] = new THREE.Vector4( 0, 5, 9, 10 ); + geometry.skinWeights[15] = new THREE.Vector4( 0.2, 0.5, 0.3, 0 ); + + // corresponds with the following vertex + geometry.vertices[15]; + + // these bones will be used like so: + skeleton.bones[0]; // weight of 0.2 + skeleton.bones[5]; // weight of 0.5 + skeleton.bones[9]; // weight of 0.3 + skeleton.bones[10]; // weight of 0 + +

+ +

[property:String uuid]

+

+ [link:http://en.wikipedia.org/wiki/Universally_unique_identifier UUID] of this object instance. + This gets automatically assigned and shouldn't be edited. +

+ +

[property:Array vertices]

+

+ Array of [page:Vector3 vertices].
+ The array of vertices holds the position of every vertex in the model.
+ To signal an update in this array, [page:.verticesNeedUpdate] needs to be set to true. +

+ +

[property:Boolean verticesNeedUpdate]

+

Set to *true* if the vertices array has been updated.

+ +

[property:Boolean elementsNeedUpdate]

+

Set to *true* if the faces array has been updated.

+ +

[property:Boolean uvsNeedUpdate]

+

Set to *true* if the uvs array has been updated.

+ +

[property:Boolean normalsNeedUpdate]

+

Set to *true* if the normals array has been updated.

+ +

[property:Boolean colorsNeedUpdate]

+

Set to *true* if the colors array or a face3 color has been updated.

+ +

[property:Boolean groupsNeedUpdate]

+

Set to *true* if a face3 materialIndex has been updated.

+ +

[property:Boolean lineDistancesNeedUpdate]

+

Set to *true* if the linedistances array has been updated.

+ + +

Methods

+ +

[page:EventDispatcher EventDispatcher] methods are available on this class.

+ +

[method:null applyMatrix]( [param:Matrix4 matrix] )

+

Bakes matrix transform directly into vertex coordinates.

+ +

[method:Geometry center] ()

+

Center the geometry based on the bounding box.

+ +

[method:Geometry clone]()

+

+ Creates a new clone of the Geometry.

+ + This method copies only vertices, faces and uvs. It does not copy any other properties of the geometry. +

+ +

[method:null computeBoundingBox]()

+

Computes bounding box of the geometry, updating [page:Geometry Geometry.boundingBox] attribute.

+ +

[method:null computeBoundingSphere]()

+

Computes bounding sphere of the geometry, updating [page:Geometry Geometry.boundingSphere] attribute.

+ +

+ Neither bounding boxes or bounding spheres are computed by default. They need to be explicitly computed, + otherwise they are *null*. +

+ +

[method:null computeFaceNormals]()

+

Computes [page:Face3.normal face normals].

+ +

[method:null computeFlatVertexNormals]()

+

Computes flat [page:Face3.vertexNormals vertex normals]. Sets the vertex normal of each vertex of each face to be the same as the face's normal.

+ +

[method:null computeMorphNormals]()

+

Computes [page:.morphNormals].

+ +

[method:null computeVertexNormals]( [param:Boolean areaWeighted] )

+

+ areaWeighted - If true the contribution of each face normal to the vertex normal is + weighted by the area of the face. Default is true.

+ + Computes vertex normals by averaging face normals. +

+ +

[method:Geometry copy]( [param:Geometry geometry] )

+

+ Copies vertices, faces and uvs into this geometry. It does not copy any other properties of the geometry. +

+ +

[method:null dispose]()

+

+ Removes The object from memory.
+ Don't forget to call this method when you remove a geometry because it can cause memory leaks. +

+ +

[method:Geometry fromBufferGeometry]( [param:BufferGeometry geometry] )

+

Convert a [page:BufferGeometry] to a Geometry.

+ +

[method:Geometry lookAt] ( [param:Vector3 vector] )

+

+ vector - A world vector to look at.

+ + Rotates the geometry to face point in space. This is typically done as a one time operation but not during the render loop.
+ Use [page:Object3D.lookAt] for typical real-time mesh usage. +

+ +

[method:null merge]( [param:Geometry geometry], [param:Matrix4 matrix], [param:Integer materialIndexOffset] )

+

Merge two geometries or geometry and geometry from object (using object's transform)

+ +

[method:null mergeMesh]( [param:Mesh mesh] )

+

Merge the mesh's geometry with this, also applying the mesh's transform.

+ + +

[method:null mergeVertices]()

+

+ Checks for duplicate vertices using hashmap.
+ Duplicated vertices are removed and faces' vertices are updated. +

+ +

[method:null normalize]()

+

+ Normalize the geometry.
+ Make the geometry centered and have a bounding sphere of radius *1.0*. +

+ +

[method:Geometry rotateX] ( [param:Float radians] )

+

+ Rotate the geometry about the X axis. This is typically done as a one time operation but not during the render loop.
+ Use [page:Object3D.rotation] for typical real-time mesh rotation. +

+ +

[method:Geometry rotateY] ( [param:Float radians] )

+

+ Rotate the geometry about the Y axis. This is typically done as a one time operation but not during the render loop.
+ Use [page:Object3D.rotation] for typical real-time mesh rotation. +

+ +

[method:Geometry rotateZ] ( [param:Float radians] )

+

+ Rotate the geometry about the Z axis. This is typically done as a one time operation but not during the render loop.
+ Use [page:Object3D.rotation] for typical real-time mesh rotation. +

+ +

[method:Geometry setFromPoints] ( [param:Array points] )

+

Sets the vertices for this Geometry from an array of points.

+ +

[method:null sortFacesByMaterialIndex] ( )

+

+ Sorts the faces array according to material index. For complex geometries with several materials, + this can result in reduced draw calls and improved performance. +

+ +

[method:Geometry scale] ( [param:Float x], [param:Float y], [param:Float z] )

+

+ Scale the geometry data. This is typically done as a one time operation but not during the render loop.
+ Use [page:Object3D.scale] for typical real-time mesh scaling. +

+ +

[method:JSON toJSON] ( )

+

Convert the geometry to JSON format.

+ +

[method:Geometry translate] ( [param:Float x], [param:Float y], [param:Float z] )

+

+ Translate the geometry. This is typically done as a one time operation but not during the render loop.
+ Use [page:Object3D.position] for typical real-time mesh translation. +

+ + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/core/InstancedBufferAttribute.html b/docs/api/zh/core/InstancedBufferAttribute.html new file mode 100644 index 00000000000000..2dafbce0b43667 --- /dev/null +++ b/docs/api/zh/core/InstancedBufferAttribute.html @@ -0,0 +1,44 @@ + + + + + + + + + + + [page:BufferAttribute] → + +

[name]

+ +

+ An instanced version of [page:BufferAttribute]. +

+ +

Constructor

+

[name]( [param:TypedArray array], [param:Integer itemSize], [param:Number meshPerAttribute] )

+

+

+ +

Properties

+ See [page:BufferAttribute] for inherited properties. + +

[property:Number meshPerAttribute]

+

+ Default is *1*. +

+ +

[property:Boolean isInstancedBufferAttribute]

+

+ Default is *true*. +

+ +

Methods

+

See [page:BufferAttribute] for inherited methods.

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/core/InstancedBufferGeometry.html b/docs/api/zh/core/InstancedBufferGeometry.html new file mode 100644 index 00000000000000..f0d901c344f5ab --- /dev/null +++ b/docs/api/zh/core/InstancedBufferGeometry.html @@ -0,0 +1,50 @@ + + + + + + + + + + + [page:BufferGeometry] → + +

[name]

+ +

+ An instanced version of [page:BufferGeometry]. +

+ +

Constructor

+

[name]( )

+

+

+ +

Properties

+ See [page:BufferGeometry] for inherited properties. + +

[property:Number maxInstancedCount]

+

+ Default is *undefined*. +

+ +

[property:Boolean isInstancedBufferGeometry]

+

+ Default is *true*. +

+ +

Methods

+

See [page:BufferAttribute] for inherited methods.

+ +

[property:Number addGroup]( start, count, materialIndex )

+

+ +

+ + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/core/InstancedInterleavedBuffer.html b/docs/api/zh/core/InstancedInterleavedBuffer.html new file mode 100644 index 00000000000000..f375a9e6bab14a --- /dev/null +++ b/docs/api/zh/core/InstancedInterleavedBuffer.html @@ -0,0 +1,48 @@ + + + + + + + + + + + [page:InterleavedBuffer] → + +

[name]

+ +

+ An instanced version of [page:InterleavedBuffer]. +

+ +

Constructor

+

[name]( [param:TypedArray array], [param:Integer itemSize], [param:Number meshPerAttribute] )

+

+

+ +

Properties

+

+ See [page:InterleavedBuffer] for inherited properties. +

+ +

[property:Number meshPerAttribute]

+

+ Default is *1*. +

+ +

[property:Boolean isInstancedInterleavedBuffer]

+

+ Default is *true*. +

+ +

Methods

+

+ See [page:InterleavedBuffer] for inherited methods. +

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/core/InterleavedBuffer.html b/docs/api/zh/core/InterleavedBuffer.html new file mode 100644 index 00000000000000..dcdabed6da95ac --- /dev/null +++ b/docs/api/zh/core/InterleavedBuffer.html @@ -0,0 +1,119 @@ + + + + + + + + + + +

[name]

+ +

+ "Interleaved" means that multiple attributes, possibly of different types, (e.g., position, normal, uv, color) are packed into a single array buffer. +

+ An introduction into interleaved arrays can be found here: [link:https://blog.tojicode.com/2011/05/interleaved-array-basics.html Interleaved array basics] +

+ +

Example

+ +

[example:webgl_buffergeometry_points_interleaved webgl / buffergeometry / points / interleaved]

+ +

Constructor

+

[name]( [param:TypedArray array], [param:Integer stride] )

+

+ [page:TypedArray array] -- A typed array with a shared buffer. Stores the geometry data.
+ [page:Integer stride] -- The number of typed-array elements per vertex. +

+ +

Properties

+ +

[property:Array array]

+

+ A typed array with a shared buffer. Stores the geometry data. +

+ +

[property:Integer stride]

+

+ The number of typed-array elements per vertex. +

+ +

[property:Integer count]

+

+ Gives the total number of elements in the array. +

+ +

[property:Boolean dynamic]

+

+ Default is *false*. +

+ +

[property:Object updateRange]

+

+ Object containing offset and count. +

+ +

[property:Number updateRange.offset]

+

+ Default is *0*. +

+ +

[property:Number updateRange.count]

+

+ Default is *-1*. +

+ +

[property:Integer version]

+

+ A version number, incremented every time the needsUpdate property is set to true. +

+ +

[property:Integer isInterleavedBuffer]

+

+ Default is *true*. +

+ +

[property:Integer needsUpdate]

+

+ Default is *false*. Setting this to true increments [page:InterleavedBuffer.version version]. +

+ +

Methods

+ +

[method:InterleavedBuffer setArray] ( [param:TypedArray array] )

+

+ array - must be a Typed Array. +

+ +

[method:InterleavedBuffer setDynamic] ( [param:Boolean value] )

+

+ Set [page:InterleavedBuffer.dynamic dynamic] to value. +

+ +

[method:InterleavedBuffer copy]( [param:InterleavedBuffer source] )

+

+ Copies another [name] to this [name]. +

+ +

[method:InterleavedBuffer copyAt]( [param:Integer index1], [param:InterleavedBuffer attribute], [param:Integer index2] )

+

Copies data from attribute[index2] to [page:InterleavedBuffer.array array][index1].

+ +

[method:InterleavedBuffer set]( [param:TypedArray value], [param:Integer offset] )

+

+ value - The source (typed) array.
+ offset - The offset into the target array at which to begin writing values from the source array. Default is *0*.

+ + Stores multiple values in the buffer, reading input values from a specified array. +

+ +

[method:InterleavedBuffer clone]()

+

+ Creates a clone of this [name]. +

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/core/InterleavedBufferAttribute.html b/docs/api/zh/core/InterleavedBufferAttribute.html new file mode 100644 index 00000000000000..b390c9fbc928f6 --- /dev/null +++ b/docs/api/zh/core/InterleavedBufferAttribute.html @@ -0,0 +1,104 @@ + + + + + + + + + + + +

[name]

+ +

+ +

+ +

Constructor

+

[name]( [param:InterleavedBuffer interleavedBuffer], [param:Integer itemSize], [param:Integer offset], [param:Boolean normalized] )

+

+

+ +

Properties

+ +

[property:InterleavedBuffer data]

+

+ The [page:InterleavedBuffer InterleavedBuffer] instance passed in the constructor. +

+ +

[property:TypedArray array]

+

+ The value of [page:InterleavedBufferAttribute.data data].array. +

+ +

[property:Integer count]

+

+ The value of [page:InterleavedBufferAttribute.data data].count. + + If the buffer is storing a 3-component item (such as a position, normal, or color), + then this will count the number of such items stored. +

+ +

[property:Integer itemSize]

+

+ How many values make up each item. +

+ +

[property:Integer offset]

+

+ The offset in the underlying array buffer where an item starts. +

+ +

[property:Boolean normalized]

+

+ Default is *true*. +

+ +

[property:Boolean isInterleavedBufferAttribute]

+

+ Default is *true*. +

+ +

Methods

+ +

[method:Number getX]( [param:Integer index] )

+

Returns the x component of the item at the given index.

+ +

[method:Number getY]( [param:Integer index] )

+

Returns the y component of the item at the given index.

+ +

[method:Number getZ]( [param:Integer index] )

+

Returns the z component of the item at the given index.

+ +

[method:Number getW]( [param:Integer index] )

+

Returns the w component of the item at the given index.

+ +

[method:null setX]( [param:Integer index], [param:Float x] )

+

Sets the x component of the item at the given index.

+ +

[method:null setY]( [param:Integer index], [param:Float y] )

+

Sets the y component of the item at the given index.

+ +

[method:null setZ]( [param:Integer index], [param:Float z] )

+

Sets the z component of the item at the given index.

+ +

[method:null setW]( [param:Integer index], [param:Float w] )

+

Sets the w component of the item at the given index.

+ +

[method:null setXY]( [param:Integer index], [param:Float x], [param:Float y] )

+

Sets the x and y components of the item at the given index.

+ +

[method:null setXYZ]( [param:Integer index], [param:Float x], [param:Float y], [param:Float z] )

+

Sets the x, y and z components of the item at the given index.

+ +

[method:null setXYZW]( [param:Integer index], [param:Float x], [param:Float y], [param:Float z], [param:Float w] )

+

Sets the x, y, z and w components of the item at the given index.

+ + + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/core/Layers.html b/docs/api/zh/core/Layers.html new file mode 100644 index 00000000000000..39d1e7690a3004 --- /dev/null +++ b/docs/api/zh/core/Layers.html @@ -0,0 +1,82 @@ + + + + + + + + + + +

[name]

+ +

+ A [page:Layers] object assigns an [page:Object3D] to 1 or more of 32 layers numbered 0 to 31 + - internally the layers are stored as a [link:https://en.wikipedia.org/wiki/Mask_(computing) bit mask], and by default all + Object3Ds are a member of layer 0.

+ + This can be used to control visibility - an object must share a layer with a [page:Camera camera] to be visible when that camera's + view is renderered.

+ + All classes that inherit from [page:Object3D] have an [page:Object3D.layers] property which is an instance of this class. +

+ + +

Constructor

+ + +

[name]()

+

+ Create a new Layers object, with membership initially set to layer 0. +

+ +

Properties

+ +

[property:Integer mask]

+

+ A bit mask storing which of the 32 layers this layers object is currently a member of. +

+ + +

Methods

+ +

[method:null disable]( [param:Integer layer] )

+

+ layer - an integer from 0 to 31.

+ + Remove membership of this *layer*. +

+ +

[method:null enable]( [param:Integer layer] )

+

+ layer - an integer from 0 to 31.

+ + Add membership of this *layer*. +

+ +

[method:null set]( [param:Integer layer] )

+

+ layer - an integer from 0 to 31.

+ + Set membership to *layer*, and remove membership all other layers. +

+ +

[method:Boolean test]( [param:Layers layers] )

+

+ layers - a Layers object

+ + Returns true if this and the passed *layers* object are members of the same set of layers. +

+ +

[method:null toggle]( [param:Integer layer] )

+

+ layer - an integer from 0 to 31.

+ + Toggle membership of *layer*. +

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/core/Object3D.html b/docs/api/zh/core/Object3D.html new file mode 100644 index 00000000000000..90aa29614700e9 --- /dev/null +++ b/docs/api/zh/core/Object3D.html @@ -0,0 +1,438 @@ + + + + + + + + + + +

[name]

+ +

+ This is the base class for most objects in three.js and provides a set of properties and methods + for manipulating objects in 3D space.

+ + Note that this can be used for grouping objects via the [page:.add]( object ) method + which adds the object as a child, however it is better to use [page:Group] for this. +

+ + +

Constructor

+ + +

[name]()

+

+ The constructor takes no arguments. +

+ + +

Properties

+ +

[property:Boolean castShadow]

+

Whether the object gets rendered into shadow map. Default is *false*.

+ +

[property:Object3D children]

+

Array with object's children. See [page:Group] for info on manually grouping objects.

+ +

[property:Boolean frustumCulled]

+

+ When this is set, it checks every frame if the object is in the frustum of the camera before rendering the object. + Otherwise the object gets rendered every frame even if it isn't visible. Default is *true*. +

+ +

[property:Integer id]

+

readonly – Unique number for this object instance.

+ +

[property:Boolean isObject3D]

+

+ Used to check whether this or derived classes are Object3Ds. Default is *true*.

+ + You should not change this, as it is used internally for optimisation. +

+ +

[property:Layers layers]

+

+ The layer membership of the object. The object is only visible if it has at least one + layer in common with the [page:Camera] in use. +

+ +

[property:Matrix4 matrix]

+

The local transform matrix.

+ +

[property:Boolean matrixAutoUpdate]

+

+ When this is set, it calculates the matrix of position, (rotation or quaternion) and + scale every frame and also recalculates the matrixWorld property. Default is [page:Object3D.DefaultMatrixAutoUpdate] (true). +

+ +

[property:Matrix4 matrixWorld]

+

+ The global transform of the object. If the Object3D has no parent, then it's identical to + the local transform [page:.matrix]. +

+ +

[property:Boolean matrixWorldNeedsUpdate]

+

+ When this is set, it calculates the matrixWorld in that frame and resets this property + to false. Default is *false*. +

+ +

[property:Matrix4 modelViewMatrix]

+

This is passed to the shader and used to calculate the position of the object.

+ +

[property:String name]

+

Optional name of the object (doesn't need to be unique). Default is an empty string.

+ +

[property:Matrix3 normalMatrix]

+

+ This is passed to the shader and used to calculate lighting for the object. It is the transpose of the inverse of the upper left 3x3 sub-matrix of this object's modelViewMatrix.

+ + The reason for this special matrix is that simply using the modelViewMatrix could result in a non-unit length of normals (on scaling) or in a non-perpendicular direction (on non-uniform scaling).

+ + On the other hand the translation part of the modelViewMatrix is not relevant for the calculation of normals. Thus a Matrix3 is sufficient. +

+ +

[property:function onAfterRender]

+

+ An optional callback that is executed immediately after the Object3D is rendered. + This function is called with the following parameters: renderer, scene, camera, geometry, + material, group. +

+ +

[property:function onBeforeRender]

+

+ An optional callback that is executed immediately before the Object3D is rendered. + This function is called with the following parameters: renderer, scene, camera, geometry, + material, group. +

+ +

[property:Object3D parent]

+

Object's parent in the [link:https://en.wikipedia.org/wiki/Scene_graph scene graph]. An object can have at most + one parent.

+ +

[property:Vector3 position]

+

A [page:Vector3] representing the object's local position. Default is (0, 0, 0).

+ +

[property:Quaternion quaternion]

+

Object's local rotation as a [page:Quaternion Quaternion].

+ +

[property:Boolean receiveShadow]

+

Whether the material receives shadows. Default is *false*.

+ +

[property:Number renderOrder]

+

+ This value allows the default rendering order of [link:https://en.wikipedia.org/wiki/Scene_graph scene graph] + objects to be overridden although opaque and transparent objects remain sorted independently. + Sorting is from lowest to highest renderOrder. Default value is *0*. +

+ +

[property:Euler rotation]

+

+ Object's local rotation (see [link:https://en.wikipedia.org/wiki/Euler_angles Euler angles]), in radians. +

+ +

[property:Vector3 scale]

+

+ The object's local scale. Default is [page:Vector3]( 1, 1, 1 ). +

+ +

[property:Vector3 up]

+

+ This is used by the [page:.lookAt lookAt] method, for example, to determine the orientation of the result.
+ Default is [page:Object3D.DefaultUp] - that is, ( 0, 1, 0 ). +

+ +

[property:object userData]

+

+ An object that can be used to store custom data about the Object3D. It should not hold + references to functions as these will not be cloned. +

+ +

[property:String uuid]

+

+ [link:http://en.wikipedia.org/wiki/Universally_unique_identifier UUID] of this object instance. + This gets automatically assigned, so this shouldn't be edited. +

+ +

[property:Boolean visible]

+

Object gets rendered if *true*. Default is *true*.

+ + + + +

Static Properties

+

+ Static properties and methods are defined per class rather than per instance of that class. + This means that changing [page:Object3D.DefaultUp] or [page:Object3D.DefaultMatrixAutoUpdate] + will change the values of [page:.up up] and [page:.matrixAutoUpdate matrixAutoUpdate] for + every instance of Object3D (or derived classes) created after the change has + been made (already created Object3Ds will not be affected). +

+ +

[property:Vector3 DefaultUp]

+

+ The default [page:.up up] direction for objects, also used as the default position for [page:DirectionalLight], + [page:HemisphereLight] and [page:Spotlight] (which creates lights shining from the top down).
+ Set to ( 0, 1, 0 ) by default. +

+ +

[property:Vector3 DefaultMatrixAutoUpdate]

+

+ The default setting for [page:.matrixAutoUpdate matrixAutoUpdate] for newly created Object3Ds.
+ +

+ + +

Methods

+ +

[page:EventDispatcher EventDispatcher] methods are available on this class.

+ +

[method:null add]( [param:Object3D object], ... )

+

+ Adds *object* as child of this object. An arbitrary number of objects may be added. Any current parent on an + object passed in here will be removed, since an object can have at most one parent.

+ + See [page:Group] for info on manually grouping objects. +

+ +

[method:null applyMatrix]( [param:Matrix4 matrix] )

+

Applies the matrix transform to the object and updates the object's position, rotation and scale.

+ +

[method:Object3D applyQuaternion]( [param:Quaternion quaternion] )

+

Applies the rotation represented by the quaternion to the object.

+ +

[method:Object3D clone]( [param:Boolean recursive] )

+

+ recursive -- if true, descendants of the object are also cloned. Default is true.

+ + Returns a clone of this object and optionally all descendants. +

+ +

[method:this copy]( [param:Object3D object], [param:Boolean recursive] )

+

+ recursive -- if true, descendants of the object are also copied. Default is true.

+ + Copy the given object into this object. +

+ +

[method:Object3D getObjectById]( [param:Integer id] )

+

+ id -- Unique number of the object instance

+ + Searches through the object's children and returns the first with a matching id.
+ Note that ids are assigned in chronological order: 1, 2, 3, ..., incrementing by one for each new object. +

+ +

[method:Object3D getObjectByName]( [param:String name] )

+

+ name -- String to match to the children's Object3D.name property.

+ + Searches through the object's children and returns the first with a matching name.
+ Note that for most objects the name is an empty string by default. You will + have to set it manually to make use of this method. +

+ +

[method:Object3D getObjectByProperty]( [param:String name], [param:Float value] )

+

+ name -- the property name to search for.
+ value -- value of the given property.

+ + Searches through the object's children and returns the first with a property that matches the value given. +

+ +

[method:Vector3 getWorldPosition]( [param:Vector3 target] )

+

+ [page:Vector3 target] — the result will be copied into this Vector3.

+ + Returns a vector representing the position of the object in world space. +

+ +

[method:Quaternion getWorldQuaternion]( [param:Quaternion target] )

+

+ [page:Quaternion target] — the result will be copied into this Quaternion.

+ + Returns a quaternion representing the rotation of the object in world space. +

+ +

[method:Vector3 getWorldScale]( [param:Vector3 target] )

+

+ [page:Vector3 target] — the result will be copied into this Vector3.

+ + Returns a vector of the scaling factors applied to the object for each axis in world space. +

+ +

[method:Vector3 getWorldDirection]( [param:Vector3 target] )

+

+ [page:Vector3 target] — the result will be copied into this Vector3.

+ + Returns a vector representing the direction of object's positive z-axis in world space. +

+ + +

[method:Vector3 localToWorld]( [param:Vector3 vector] )

+

+ vector - A vector representing a position in local (object) space.

+ + Converts the vector from local space to world space. +

+ +

[method:null lookAt]( [param:Vector3 vector] )
+ [method:null lookAt]( [param:Float x], [param:Float y], [param:Float z] )

+

+ vector - A vector representing a position in world space.

+ Optionally, the [page:.x x], [page:.y y] and [page:.z z] components of the world space position.

+ + Rotates the object to face a point in world space.

+ + This method does not support objects with rotated and/or translated parent(s). +

+ +

[method:Array raycast]( [param:Raycaster raycaster], [param:Array intersects] )

+

+ Abstract (empty) method to get intersections between a casted ray and this object. + Subclasses such as [page:Mesh], [page:Line], and [page:Points] implement this method in order + to use raycasting. +

+ +

[method:null remove]( [param:Object3D object], ... )

+

+ Removes *object* as child of this object. An arbitrary number of objects may be removed. +

+ +

[method:this rotateOnAxis]( [param:Vector3 axis], [param:Float angle] )

+

+ axis -- A normalized vector in object space.
+ angle -- The angle in radians.

+ + Rotate an object along an axis in object space. The axis is assumed to be normalized. +

+ +

[method:this rotateOnWorldAxis]( [param:Vector3 axis], [param:Float angle] )

+

+ axis -- A normalized vector in world space.
+ angle -- The angle in radians.

+ + Rotate an object along an axis in world space. The axis is assumed to be normalized. + Method Assumes no rotated parent. +

+ +

[method:this rotateX]( [param:Float rad] )

+

+ rad - the angle to rotate in radians.

+ + Rotates the object around x axis in local space. +

+ +

[method:this rotateY]( [param:Float rad] )

+

+ rad - the angle to rotate in radians.

+ + Rotates the object around y axis in local space. +

+ +

[method:this rotateZ]( [param:Float rad] )

+

+ rad - the angle to rotate in radians.

+ + Rotates the object around z axis in local space. +

+ +

[method:null setRotationFromAxisAngle]( [param:Vector3 axis], [param:Float angle] )

+

+ axis -- A normalized vector in object space.
+ angle -- angle in radians

+ + Calls [page:Quaternion.setFromAxisAngle setFromAxisAngle]( [page:Float axis], [page:Float angle] ) + on the [page:.quaternion]. +

+ +

[method:null setRotationFromEuler]( [param:Euler euler] )

+

+ euler -- Euler angle specifying rotation amount.
+ + Calls [page:Quaternion.setRotationFromEuler setRotationFromEuler]( [page:Euler euler]) + on the [page:.quaternion]. +

+ +

[method:null setRotationFromMatrix]( [param:Matrix4 m] )

+

+ m -- rotate the quaternion by the rotation component of the matrix.
+ + Calls [page:Quaternion.setFromRotationMatrix setFromRotationMatrix]( [page:Matrix4 m]) + on the [page:.quaternion].

+ + Note that this assumes that the upper 3x3 of m is a pure rotation matrix (i.e, unscaled). +

+ +

[method:null setRotationFromQuaternion]( [param:Quaternion q] )

+

+ q -- normalized Quaternion.

+ + Copy the given quaternion into [page:.quaternion]. +

+ +

[method:null toJSON]( [param:Quaternion q] )

+

+ Convert the object to JSON format. +

+ +

[method:this translateOnAxis]( [param:Vector3 axis], [param:Float distance] )

+

+ axis -- A normalized vector in object space.
+ distance -- The distance to translate.

+ + Translate an object by distance along an axis in object space. The axis is assumed to be normalized. +

+ +

[method:this translateX]( [param:Float distance] )

+

Translates object along x axis in object space by *distance* units.

+ +

[method:this translateY]( [param:Float distance] )

+

Translates object along y axis in object space by *distance* units.

+ +

[method:this translateZ]( [param:Float distance] )

+

Translates object along z axis in object space by *distance* units.

+ +

[method:null traverse]( [param:Function callback] )

+

+ callback - A function with as first argument an object3D object.

+ + Executes the callback on this object and all descendants. +

+ +

[method:null traverseVisible]( [param:Function callback] )

+

+ callback - A function with as first argument an object3D object.

+ + Like traverse, but the callback will only be executed for visible objects. + Descendants of invisible objects are not traversed. +

+ +

[method:null traverseAncestors]( [param:Function callback] )

+

+ callback - A function with as first argument an object3D object.

+ + Executes the callback on all ancestors. +

+ +

[method:null updateMatrix]()

+

Update the local transform.

+ +

[method:null updateMatrixWorld]( [param:Boolean force] )

+

Update the global transform of the object and its children.

+ + +

[method:Vector3 worldToLocal]( [param:Vector3 vector] )

+

+ vector - A world vector.

+ + Updates the vector from world space to local space. +

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/core/Raycaster.html b/docs/api/zh/core/Raycaster.html new file mode 100644 index 00000000000000..39ee74fc8c5d07 --- /dev/null +++ b/docs/api/zh/core/Raycaster.html @@ -0,0 +1,189 @@ + + + + + + + + + + +

[name]

+ +

+ This class is designed to assist with [link:https://en.wikipedia.org/wiki/Ray_casting raycasting]. + Raycasting is used for mouse picking (working out what objects in the 3d space the mouse is over) amongst + other things. +

+ +

Example

+ + var raycaster = new THREE.Raycaster(); + var mouse = new THREE.Vector2(); + + function onMouseMove( event ) { + + // calculate mouse position in normalized device coordinates + // (-1 to +1) for both components + + mouse.x = ( event.clientX / window.innerWidth ) * 2 - 1; + mouse.y = - ( event.clientY / window.innerHeight ) * 2 + 1; + + } + + function render() { + + // update the picking ray with the camera and mouse position + raycaster.setFromCamera( mouse, camera ); + + // calculate objects intersecting the picking ray + var intersects = raycaster.intersectObjects( scene.children ); + + for ( var i = 0; i < intersects.length; i++ ) { + + intersects[ i ].object.material.color.set( 0xff0000 ); + + } + + renderer.render( scene, camera ); + + } + + window.addEventListener( 'mousemove', onMouseMove, false ); + + window.requestAnimationFrame(render); + + +
+ Examples: [example:webgl_interactive_cubes Raycasting to a Mesh]
+ [example:webgl_interactive_cubes_ortho Raycasting to a Mesh in using an OrthographicCamera]
+ [example:webgl_interactive_buffergeometry Raycasting to a Mesh with BufferGeometry]
+ [example:webgl_interactive_lines Raycasting to a Line]
+ [example:webgl_interactive_raycasting_points Raycasting to Points]
+ [example:webgl_geometry_terrain_raycast Terrain raycasting]
+ [example:webgl_octree_raycasting Raycasting using an octree]
+ [example:webgl_interactive_voxelpainter Raycasting to paint voxels]
+ [example:webgl_raycast_texture Raycast to a Texture] +
+ + +

+

+ + +

Constructor

+ +

[name]( [param:Vector3 origin], [param:Vector3 direction], [param:Float near], [param:Float far] ) {

+

+ [page:Vector3 origin] — The origin vector where the ray casts from.
+ [page:Vector3 direction] — The direction vector that gives direction to the ray. Should be normalized.
+ [page:Float near] — All results returned are further away than near. Near can't be negative. Default value is 0.
+ [page:Float far] — All results returned are closer than far. Far can't be lower than near. Default value is Infinity. +

+

+ This creates a new raycaster object.
+

+ + +

Properties

+ +

[property:float far]

+

+ The far factor of the raycaster. This value indicates which objects can be discarded based on the distance. + This value shouldn't be negative and should be larger than the near property. +

+ +

[property:float linePrecision]

+

+ The precision factor of the raycaster when intersecting [page:Line] objects. +

+ +

[property:float near]

+

+ The near factor of the raycaster. This value indicates which objects can be discarded based on the distance. + This value shouldn't be negative and should be smaller than the far property. +

+ +

[property:Object params]

+

+ An object with the following properties: + + +{ + Mesh: {}, + Line: {}, + LOD: {}, + Points: { threshold: 1 }, + Sprite: {} +} + + +

+ +

[property:Ray ray]

+

The [Page:Ray] used for the raycasting.

+ + +

Methods

+ +

[method:null set]( [param:Vector3 origin], [param:Vector3 direction] )

+

+ [page:Vector3 origin] — The origin vector where the ray casts from.
+ [page:Vector3 direction] — The normalized direction vector that gives direction to the ray. +

+

+ Updates the ray with a new origin and direction. +

+ +

[method:null setFromCamera]( [param:Vector2 coords], [param:Camera camera] )

+

+ [page:Vector2 coords] — 2D coordinates of the mouse, in normalized device coordinates (NDC)---X and Y components should be between -1 and 1.
+ [page:Camera camera] — camera from which the ray should originate +

+

+ Updates the ray with a new origin and direction. +

+ +

[method:Array intersectObject]( [param:Object3D object], [param:Boolean recursive], [param:Array optionalTarget] )

+

+ [page:Object3D object] — The object to check for intersection with the ray.
+ [page:Boolean recursive] — If true, it also checks all descendants. Otherwise it only checks intersecton with the object. Default is false.
+ [page:Array optionalTarget] — (optional) target to set the result. Otherwise a new [page:Array] is instantiated. If set, you must clear this array prior to each call (i.e., array.length = 0;). +

+

+ Checks all intersection between the ray and the object with or without the descendants. Intersections are returned sorted by distance, closest first. An array of intersections is returned... +

+ + [ { distance, point, face, faceIndex, object }, ... ] + +

+ [page:Float distance] – distance between the origin of the ray and the intersection
+ [page:Vector3 point] – point of intersection, in world coordinates
+ [page:Face3 face] – intersected face
+ [page:Integer faceIndex] – index of the intersected face
+ [page:Object3D object] – the intersected object
+ [page:Vector2 uv] - U,V coordinates at point of intersection +

+

+ *Raycaster* delegates to the [page:Object3D.raycast raycast] method of the passed object, when evaluating whether the ray intersects the object or not. This allows [page:Mesh meshes] to respond differently to ray casting than [page:Line lines] and [page:Points pointclouds]. +

+

+ *Note* that for meshes, faces must be pointed towards the origin of the [page:.ray ray] in order to be detected; intersections of the ray passing through the back of a face will not be detected. To raycast against both faces of an object, you'll want to set the [page:Mesh.material material]'s [page:Material.side side] property to *THREE.DoubleSide*. +

+ +

[method:Array intersectObjects]( [param:Array objects], [param:Boolean recursive], [param:Array optionalTarget] )

+

+ [page:Array objects] — The objects to check for intersection with the ray.
+ [page:Boolean recursive] — If true, it also checks all descendants of the objects. Otherwise it only checks intersecton with the objects. Default is false.
+ [page:Array optionalTarget] — (optional) target to set the result. Otherwise a new [page:Array] is instantiated. If set, you must clear this array prior to each call (i.e., array.length = 0;). +

+

+ Checks all intersection between the ray and the objects with or without the descendants. Intersections are returned sorted by distance, closest first. Intersections are of the same form as those returned by [page:.intersectObject]. +

+ + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/core/Uniform.html b/docs/api/zh/core/Uniform.html new file mode 100644 index 00000000000000..00c0afbc8e448e --- /dev/null +++ b/docs/api/zh/core/Uniform.html @@ -0,0 +1,213 @@ + + + + + + + + + + +

[name]

+ +

Uniforms are global [link:https://www.opengl.org/documentation/glsl/ GLSL] variables. They are passed to shader programs. +

+ +

Example

+

+ When declaring a uniform of a [page:ShaderMaterial], it is declared by value or by object. +

+ + uniforms: { + time: { value: 1.0 }, + resolution: new THREE.Uniform(new THREE.Vector2()) + } + + +

Uniform types

+ +

+ Each uniform must have a *value* property. The type of the value must correspond to the + type of the uniform variable in the GLSL code as specified for the primitive GLSL types + in the table below. Uniform structures and arrays are also supported. GLSL arrays of primitive + type must either be specified as an array of the corresponding THREE objects or as a flat + array containing the data of all the objects. In other words; GLSL primitives in arrays + must not be represented by arrays. This rule does not apply transitively. + An array of *vec2* arrays, each with a length of five vectors, must be an array of arrays, + of either five [page:Vector2] objects or ten *number*s. +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Uniform types
GLSL typeJavaScript type
int[page:Number]
float[page:Number]
bool[page:Boolean]
bool[page:Number]
vec2[page:Vector2 THREE.Vector2]
vec2[page:Float32Array Float32Array] (*)
vec2[page:Array Array] (*)
vec3[page:Vector3 THREE.Vector3]
vec3[page:Color THREE.Color]
vec3[page:Float32Array Float32Array] (*)
vec3[page:Array Array] (*)
vec4[page:Vector4 THREE.Vector4]
vec4[page:Quaternion THREE.Quaternion]
vec4[page:Float32Array Float32Array] (*)
vec4[page:Array Array] (*)
mat2[page:Float32Array Float32Array] (*)
mat2[page:Array Array] (*)
mat3[page:Matrix3 THREE.Matrix3]
mat3[page:Float32Array Float32Array] (*)
mat3[page:Array Array] (*)
mat4[page:Matrix3 THREE.Matrix4]
mat4[page:Float32Array Float32Array] (*)
mat4[page:Array Array] (*)
ivec2, bvec2[page:Float32Array Float32Array] (*)
ivec2, bvec2[page:Array Array] (*)
ivec3, bvec3[page:Int32Array Int32Array] (*)
ivec3, bvec3[page:Array Array] (*)
ivec4, bvec4[page:Int32Array Int32Array] (*)
ivec4, bvec4[page:Array Array] (*)
sampler2D[page:Texture THREE.Texture]
samplerCube[page:CubeTexture THREE.CubeTexture]
+ +

+ (*) Same for an (innermost) array (dimension) of the same GLSL type, containing the components of all vectors or matrices in the array. +

+ +

Constructor

+ +

[name]( [param:Object value] )

+

+ value -- An object containing the value to set up the uniform. It's type must be one of the Uniform Types described above. +

+ +

Properties

+ +

[property:Object value]

+

+ Current value of the uniform. +

+ +

Methods

+ +

[method:Uniform clone]()

+

+ Returns a clone of this uniform.
+ If the uniform's value property is an [page:Object] with a clone() method, this is used, otherwise the value is copied by assigment. + Array values are shared between cloned [page:Uniform]s.

+ See [example:webgldeferred_animation WebGL deferred animation] for an example of this method in use. +

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/core/bufferAttributeTypes/BufferAttributeTypes.html b/docs/api/zh/core/bufferAttributeTypes/BufferAttributeTypes.html new file mode 100644 index 00000000000000..9843484a968c86 --- /dev/null +++ b/docs/api/zh/core/bufferAttributeTypes/BufferAttributeTypes.html @@ -0,0 +1,56 @@ + + + + + + + + + + + [page:BufferAttribute] → + +

BufferAttribute Types

+ +

+ There are nine types of [page:BufferAttribute] available in three.js. These correspond to the JavaScript + [link:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray#Syntax Typed Arrays]. +

+ + + THREE.Float64BufferAttribute + THREE.Float32BufferAttribute + THREE.Uint32BufferAttribute + THREE.Int32BufferAttribute + THREE.Uint16BufferAttribute + THREE.Int16BufferAttribute + THREE.Uint8ClampedBufferAttribute + THREE.Uint8BufferAttribute + THREE.Int8BufferAttribute + + +

Constructor

+ + All of the above are called in the same way. +

TypedBufferAttribute( [param:Array array], [param:Integer itemSize], [param:Boolean normalized] )

+

+ array -- this can be a typed or untyped (normal) array. It will be converted to the Type specified.

+ + itemSize -- the number of values of the array that should be associated with a particular vertex.

+ + normalized -- (optional) indicates how the underlying data in the buffer maps to the values in the GLSL code. +

+ +

Properties

+ + See the [page:BufferAttribute] page for inherited properties. + +

Methods

+ + See the [page:BufferAttribute] page for inherited methods. + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/core/BufferAttribute.js src/core/BufferAttribute.js] + + diff --git a/docs/api/zh/deprecated/DeprecatedList.html b/docs/api/zh/deprecated/DeprecatedList.html new file mode 100644 index 00000000000000..7e28376cbdeeaa --- /dev/null +++ b/docs/api/zh/deprecated/DeprecatedList.html @@ -0,0 +1,607 @@ + + + + + + + + + + +

已被弃用API列表(Deprecated API List)

+ +

+ 由于three.js具有一个快速发展的接口,你可能会遇上类似“提示你当前所调用的API元素不再是Three.js核心的一部分”的提示。

+ 下面就列举出了这些API元素,以及一些关于他们的替代信息。 +

+ + + + + +

音频(Audio)

+ +

[page:Audio]

+

Audio.load 已被弃用。 请使用 [page:AudioLoader]。

+ +

[page:AudioAnalyser]

+

AudioAnalyser.getData() 已被重命名为 [page:AudioAnalyser.getFrequencyData]()。

+ +

[page:BinaryTextureLoader]

+

BinaryTextureLoader 已被重命名为 [page:DataTextureLoader]。

+ + + + + +

缓冲器(Buffers)

+ +

[page:BufferAttribute]

+

BufferAttribute.length 已被重命名为 [page:BufferAttribute.count]。

+

BufferAttribute.copyIndicesArray() 已被删除。

+ + +

[page:DynamicBufferAttribute]

+

DynamicBufferAttribute 已被删除。 请使用[page:BufferAttribute.setDynamic]( true )。

+ +

[page:Int8Attribute]

+

Int8Attribute 已被删除。 请使用[page:BufferAttributeTypes Int8BufferAttribute]。

+ +

[page:Uint8Attribute]

+

Uint8Attribute 已被删除。 请使用[page:BufferAttributeTypes Uint8BufferAttribute]。

+ +

[page:Uint8ClampedAttribute]

+

Uint8ClampedAttribute 已被删除。 请使用[page:BufferAttributeTypes Uint8ClampedBufferAttribute]。

+ +

[page:Int16Attribute]

+

Int16Attribute 已被删除。 请使用[page:BufferAttributeTypes Int16BufferAttribute]。

+ +

[page:Uint16Attribute]

+

Uint16Attribute 已被删除。 请使用[page:BufferAttributeTypes Uint16BufferAttribute]。

+ +

[page:Int32Attribute]

+

Int32Attribute 已被删除。 请使用[page:BufferAttributeTypes Int32BufferAttribute]。

+ +

[page:Uint32Attribute]

+

Uint32Attribute 已被删除。 请使用[page:BufferAttributeTypes Uint32BufferAttribute]。

+ +

[page:Float32Attribute]

+

Float32Attribute 已被删除。 请使用[page:BufferAttributeTypes Float32BufferAttribute]。

+ +

[page:Float64Attribute]

+

Float64Attribute 已被删除。 请使用[page:BufferAttributeTypes Float64BufferAttribute]。

+ + + + + + + +

摄像机(Cameras)

+ +

[page:PerspectiveCamera]

+

+ PerspectiveCamera.setLens() 已被弃用。 请使用[page:PerspectiveCamera.setFocalLength]() + 和 [page:PerspectiveCamera.filmGauge]() 来对摄像机拍摄进行设置。 +

+ + + + + + + +

常量(Constants)

+ +

[page:LineStrip]

+ +

[page:LinePieces]

+

+ LinePieces mode 已经不再对 [page:Line]s 进行支持。 请创建一个 [page:LineSegments] 。 +

+ + + + + +

核心(Core)

+ +

[page:EventDispatcher]

+

EventDispatcher.apply 已被删除。 请继承或者Object.assign其原型来“混合”。Inherit or Object.assign the prototype to mix-in。

+ +

[page:Raycaster]

+

Raycaster.params.PointCloud 已被重命名为 [page:Raycaster.params.Points]。

+ + +

[page:Uniform]

+

+ Uniform.dynamic 已被删除。 请使用object.onBeforeRender()。

+ + Uniform.onUpdate 已被删除。 请使用object.onBeforeRender() 。 +

+ + + + + + +

附件(Extras)

+ +

[page:ClosedSplineCurve3]

+

ClosedSplineCurve3 已被弃用。 请使用[page:CatmullRomCurve3]。

+ +

[page:SplineCurve3]

+

SplineCurve3 已被弃用。 请使用[page:CatmullRomCurve3]。

+ + + + + + + +

几何体(Geometry)

+ +

+ Geometry.computeTangents() 已被删除。

+ + Geometry.computeLineDistances() 已被删除。 请使用[page:Line.computeLineDistances]。

+

+ +

[page:BufferGeometry]

+

+ BufferGeometry.addIndex 已被重命名为 [page:BufferGeometry.setIndex]。

+ + BufferGeometry.addDrawCall 现在是 [page:BufferGeometry.addGroup]。

+ + BufferGeometry.clearDrawCalls 现在是 [page:BufferGeometry.clearGroups]。

+ + BufferGeometry.computeTangents 已被删除。

+ + BufferGeometry.computeOffsets 已被删除。

+ + BufferGeometry.drawcalls 已被重命名为 [page:BufferGeometry.groups]。

+ + BufferGeometry.offsets 已被重命名为 [page:BufferGeometry.groups]。

+ +

+ +

[page:CubeGeometry]

+

CubeGeometry 已被重命名为 [page:BoxGeometry]。

+ +

[page:Geometry]

+

Geometry.computeTangents() 已被删除。

+ +

[page:GeometryUtils]

+

+ GeometryUtils.merge 已被移动到了 [page:Geometry],请使用[page:Geometry.merge]( geometry2, matrix, materialIndexOffset )。

+ + GeometryUtils.center 已被移动到了 [page:Geometry],请使用[page:Geometry.center]( ) 。 +

+ +

[page:Plane]

+

+ Plane.isIntersectionLine() 已被重命名为 [page:Plane.intersectsLine]()。 +

+ + + + + + + + +

辅助工具(Helpers)

+ +

[page:BoundingBoxHelper]

+

BoundingBoxHelper 已被弃用。 请使用[page:BoxHelper]。

+ +

[page:EdgesHelper]

+

EdgesHelper 已被删除。 请使用[page:EdgesGeometry]。

+ +

[page:GridHelper]

+

GridHelper.setColors() 已被弃用,请在构造器中传递它们。

+ +

[page:WireframeHelper WireframeHelper]

+

WireframeHelper 已被删除。 请使用[page:WireframeGeometry]。

+ + + + +

灯光(Lights)

+ +

[page:Light]

+

+ Light.onlyShadow 已被删除。

+ + Light.shadowCameraLeft 现在是 [page:Light.shadow.camera.left]。

+ + Light.shadowCameraRight 现在是 [page:Light.shadow.camera.right]。

+ + Light.shadowCameraTop 现在是 [page:Light.shadow.camera.top]。

+ + Light.shadowCameraBottom 现在是 [page:Light.shadow.camera.bottom]。

+ + Light.shadowCameraNear 现在是 [page:Light.shadow.camera.near]。

+ + Light.shadowCameraFar 现在是 [page:Light.shadow.camera.far]。

+ + Light.shadowCameraVisible 已被删除。 请使用[page:CameraHelper] ( light.shadow.camera )。

+ + Light.shadowMapWidth 现在是 [page:Light.shadow.mapSize.width]。

+ + Light.shadowMapHeight 现在是 [page:Light.shadow.mapSize.height]。 +

+ + + + + + + + +

加载器(Loaders)

+ +

[page:XHRLoader]

+

XHRLoader 已被重命名为 [page:FileLoader]。

+ + + + + + + + +

数学(Maths)

+ +

[page:Box2]

+

+ Box2.center 已被重命名为 [page:Box2.getCenter]()。

+ + Box2.empty 已被重命名为 [page:Box2.isEmpty]()。

+ + Box2.isIntersectionBox 已被重命名为 [page:Box2.intersectsBox]()。

+ + Box2.size 已被重命名为 [page:Box2.getSize]()。 + +

+ +

[page:Box3]

+

+ Box3.center 已被重命名为 [page:Box3.getCenter]()。

+ + Box3.empty 已被重命名为 [page:Box3.isEmpty]()。

+ + Box3.isIntersectionBox 已被重命名为 [page:Box3.intersectsBox]()。

+ + Box3.isIntersectionSphere 已被重命名为 [page:Box3.intersectsSphere]()。

+ + Box3.size 已被重命名为 [page:Box3.getSize]()。 +

+ +

[page:Face4]

+

Face4 已被删除。 请使用[page:Face3]。

+ +

[page:Line3]

+

Line3.center 已被重命名为 [page:Line3.getCenter]()。

+ +

[page:Math]

+

+ Math.random16() 已被弃用。 请使用Math.random() 。 +

+ +

[page:Matrix3]

+

+ Matrix3.flattenToArrayOffset 已被弃用。请使用[page:Matrix3.toArray]()。

+ + Matrix3.multiplyVector3 已被删除。 请使用vector.applyMatrix3( matrix )。

+ + Matrix3.multiplyVector3Array 已被重命名为 [page:Matrix3.applyToVector3Array]( array )。

+ + Matrix3.applyToBuffer 已被删除。 请使用matrix.applyToBufferAttribute( attribute )。

+ + Matrix3.applyToVector3Array 已被删除。 +

+ +

[page:Matrix4]

+

+ Matrix4.flattenToArrayOffset() 已被弃用。请使用[page:Matrix4.toArray]()。

+ + Matrix4.extractPosition() 已被重命名为 [page:Matrix4.copyPosition]( matrix )。

+ + Matrix4.getPosition() 已被删除。 请使用[page:Vector3.setFromMatrixPosition]( matrix )。

+ + Matrix4.setRotationFromQuaternion() 已被重命名为 [page:Matrix4.makeRotationFromQuaternion]( quaternion )。

+ + Matrix4.multiplyVector3() 已被删除。 请使用vector.applyMatrix4( matrix )。

+ + Matrix4.multiplyVector4() 已被删除。 请使用vector.applyMatrix4( matrix )。

+ + Matrix4.multiplyVector3Array() 已被重命名为 [page:Matrix4.applyToVector3Array] ( array )。

+ + Matrix4.rotateAxis() 已被删除。 请使用[page:Matrix4.transformDirection]( matrix )。

+ + Matrix4.crossVector() 已被删除。 请使用vector.applyMatrix4( matrix )。

+ + Matrix4.rotateX() 已被删除。

+ + Matrix4.rotateY() 已被删除。

+ + Matrix4.rotateZ() 已被删除。

+ + Matrix4.rotateByAxis() 已被删除。

+ + Matrix4.applyToBuffer() 已被删除。 请使用matrix.applyToBufferAttribute()。

+ + Matrix4.applyToVector3Array() 已被删除。

+ + Matrix4.makeFrustum() 已被删除。 请使用[page:Matrix4.makePerspective]( left, right, top, bottom, near, far ) 。 +

+ + +

[page:Quaternion.multiplyVector3]

+

Quaternion.multiplyVector3() 已被删除。 请使用vector.applyQuaternion( quaternion )。

+ +

[page:Ray]

+

+ Ray.isIntersectionBox() 已被重命名为 [page:Ray.intersectsBox]()。

+ + Ray.isIntersectionPlane 已被重命名为 [page:Ray.intersectsPlane]。

+ + Ray.isIntersectionSphere 已被重命名为 [page:Ray.intersectsSphere]。 +

+ +

[page:Triangle]

+

+ Triangle.area() 已被重命名为 [page:Triangle.getArea]()。

+ Triangle.barycoordFromPoint() 已被重命名为 [page:Triangle.getBarycoord]()。

+ Triangle.midpoint() 已被重命名为 [page:Triangle.getMidpoint]()。

+ Triangle.normal() 已被重命名为 [page:Triangle.getNormal]()。

+ Triangle.plane() 已被重命名为 [page:Triangle.getPlane]()。 +

+ +

[page:Vector2]

+

+ Vector2.fromAttribute() 已被重命名为 [page:Vector2.fromBufferAttribute]()。 +

+ +

[page:Vector3]

+

+ Vector3.setEulerFromRotationMatrix() 已被删除。 请使用[page:Euler.setFromRotationMatrix]()。

+ + Vector3.setEulerFromQuaternion() 已被删除。 请使用[page:Euler.setFromQuaternion]()。

+ + Vector3.getPositionFromMatrix() 已被重命名为 [page:Vector3.setFromMatrixPosition]()。

+ + Vector3.getScaleFromMatrix() 已被重命名为 [page:Vector3.setFromMatrixScale]()。

+ + Vector3.getColumnFromMatrix() 已被重命名为 [page:Vector3.setFromMatrixColumn]()。

+ + Vector3.applyProjection() 已被删除。 请使用[page:Vector3.applyMatrix4]()。

+ + Vector3.fromAttribute() 已被重命名为 [page:Vector3.fromBufferAttribute]()。 +

+ +

[page:Vector4]

+

+ Vector4.fromAttribute() 已被重命名为 [page:Vector4.fromBufferAttribute](). +

+ +

[page:Vertex]

+

Vertex 已被删除。 请使用[page:Vector3]。

+ +

[page:Spline]

+

Spline 已被删除。 请使用[page:CatmullRomCurve3]。

+ + + + + + + + + + + + +

材质(Materials)

+ +

[page:Material]

+

+ Material.wrapAround 已被删除。

+ + Material.wrapRGB 已被删除。 + +

+ +

[page:MeshFaceMaterial]

+

MeshFaceMaterial 已被删除。 请使用一个材质数组。

+ +

[page:MultiMaterial]

+

MultiMaterial 已被删除。 请使用一个材质数组。

+ +

[page:MeshPhongMaterial]

+

MeshPhongMaterial.metal 已被删除。 请使用[page:MeshStandardMaterial]。

+ +

[page:ParticleBasicMaterial]

+

ParticleBasicMaterial 已被重命名为 [page:PointsMaterial]。

+ +

[page:ParticleSystemMaterial]

+

ParticleBasicMaterial 已被重命名为 [page:PointsMaterial]。

+ +

[page:PointCloudMaterial]

+

PointCloudMaterial 已被重命名为 [page:PointsMaterial]。

+ +

[page:ShaderMaterial.derivatives]

+

ShaderMaterial.derivatives 已被移动到了 [page:ShaderMaterial.extensions.derivatives]。

+ + + + + + + + +

物体(Objects)

+ +

[page:LOD.objects]

+

LOD.objects 已被重命名为 [page:LOD.levels]。

+ +

[page:Object3D]

+

+ Object3D.eulerOrder 现在是 [page:Object3D.rotation.order]。

+ + Object3D.getChildByName() 已被重命名为 [page:Object3D.getObjectByName]()。

+ + Object3D.renderDepth 已被删除。 请使用[page:Object3D.renderOrder]。

+ + Object3D.translate() 已被删除。 请使用[page:Object3D.translateOnAxis]( axis, distance )。

+ + Object3D.useQuaternion 已被删除。 默认情况下,Three.js库是使用quaternions(四元数)的。 +

+ +

[page:LensFlare]

+

+ LensFlare 已被移动到了 [link:https://github.com/mrdoob/three.js/blob/master/examples/js/objects/Lensflare.js /examples/js/objects/Lensflare.js]. +

+ + +

[page:Particle]

+

Particle 已被重命名为 [page:Sprite]。

+ +

[page:ParticleSystem]

+

ParticleSystem 已被重命名为 [page:Points]。

+ +

[page:PointCloud]

+

PointCloud 已被重命名为 [page:Points]。

+ +

[page:Shape]

+

+ Shape.extrude 已被删除。 请使用[page:ExtrudeGeometry]。

+ + Shape.makeGeometry 已被删除。 请使用[page:ShapeGeometry] 。 +

+ + + + + + + + +

渲染器(Renderer)

+ +

[page:Projector]

+

+ CanvasRenderer 已被移动到了 [link:https://github.com/mrdoob/three.js/blob/master/examples/js/renderers/CanvasRenderer.js /examples/js/renderers/CanvasRenderer.js]. +

+ +

[page:Projector]

+

+ Projector 已被移动到了 + [link:https://github.com/mrdoob/three.js/blob/master/examples/js/renderers/Projector.js /examples/js/renderers/Projector.js]。

+ + Projector.projectVector() 现在是 [page:Vector.project]()。

+ + Projector.unprojectVector() 现在是 [page:Vector.unproject]()。

+ + Projector:.pickingRay() 现在是 [page:Raycaster.setFromCamera]()。 +

+ +

[page:WebGLProgram]

+

+ WebGLProgram.uniforms 现在是 [page:WebGLProgram.getUniforms]()。

+ + WebGLProgram.attributes 现在是 [page:WebGLProgram.getAttributes]()。 +

+ +

[page:WebGLRenderer]

+

+ WebGLRenderer.supportsFloatTextures() 现在是 [page:WebGLRenderer.extensions.get]( 'OES_texture_float' )。

+ + WebGLRenderer.supportsHalfFloatTextures() 现在是 [page:WebGLRenderer.extensions.get]( 'OES_texture_half_float' )。

+ + WebGLRenderer.supportsStandardDerivatives() 现在是 [page:WebGLRenderer.extensions.get]( 'OES_standard_derivatives' )。

+ + WebGLRenderer.supportsCompressedTextureS3TC() 现在是 [page:WebGLRenderer.extensions.get]( 'WEBGL_compressed_texture_s3tc' )。

+ + WebGLRenderer.supportsCompressedTexturePVRTC() 现在是 [page:WebGLRenderer.extensions.get]( 'WEBGL_compressed_texture_pvrtc' )。

+ + WebGLRenderer.supportsBlendMinMax() 现在是 [page:WebGLRenderer.extensions.get]( 'EXT_blend_minmax' )。

+ + WebGLRenderer.supportsVertexTextures() 现在是 [page:WebGLRenderer.capabilities.vertexTextures]。

+ + WebGLRenderer.supportsInstancedArrays() 现在是 [page:WebGLRenderer.extensions.get]( 'ANGLE_instanced_arrays' )。

+ + WebGLRenderer.enableScissorTest() 现在是 [page:WebGLRenderer.setScissorTest]()。

+ + WebGLRenderer.initMaterial() 已被删除。

+ + WebGLRenderer.addPrePlugin() 已被删除。

+ + WebGLRenderer.addPostPlugin() 已被删除。

+ + WebGLRenderer.updateShadowMap() 已被删除。

+ + WebGLRenderer.setFaceCulling() 已被删除。

+ + WebGLRenderer.setTexture is deprecated, 请使用[page:WebGLRenderer.setTexture2D]()。

+ + WebGLRenderer.shadowMapEnabled 现在是 [page:WebGLRenderer.shadowMap.enabled]。

+ + WebGLRenderer.shadowMapType 现在是 [page:WebGLRenderer.shadowMap.type]。

+ + WebGLRenderer.shadowMapCullFace 已被删除。请设置[page:Material.shadowSide]。

+ + WebGLRenderer.shadowMap.cullFace 已被删除。请设置[page:Material.shadowSide]。

+ + WebGLRenderer.shadowMap.renderReverseSided 已被删除。请设置[page:Material.shadowSide]。

+ + WebGLRenderer.shadowMap.renderSingleSided 已被删除。请设置[page:Material.shadowSide]。 + +

+ +

[page:WebGLRenderTarget]

+

+ WebGLRenderTarget.wrapS 现在是 [page:WebGLRenderTarget.texture.wrapS]。

+ + WebGLRenderTarget.wrapT 现在是 [page:WebGLRenderTarget.texture.wrapT]。

+ + WebGLRenderTarget.magFilter 现在是 [page:WebGLRenderTarget.texture.magFilter]。

+ + WebGLRenderTarget.minFilter 现在是 [page:WebGLRenderTarget.texture.minFilter]。

+ + WebGLRenderTarget.anisotropy 现在是 [page:WebGLRenderTarget.texture.anisotropy]。

+ + WebGLRenderTarget.offset 现在是 [page:WebGLRenderTarget.texture.offset]。

+ + WebGLRenderTarget.repeat 现在是 [page:WebGLRenderTarget.texture.repeat]。

+ + WebGLRenderTarget.format 现在是 [page:WebGLRenderTarget.texture.format]。

+ + WebGLRenderTarget.type 现在是 [page:WebGLRenderTarget.texture.type]。

+ + WebGLRenderTarget.generateMipmaps 现在是 [page:WebGLRenderTarget.texture.generateMipmaps]. +

+ + +

纹理(Textures)

+ +

[page:ImageUtils]

+

+ ImageUtils.loadTexture 已被弃用。 请使用[page:TextureLoader]。

+ + ImageUtils.loadTextureCube 已被弃用。 请使用[page:CubeTextureLoader]。

+ + ImageUtils.loadCompressedTexture 已被删除。 请使用[page:DDSLoader]。

+ + ImageUtils.loadCompressedTextureCube 已被删除。 请使用[page:DDSLoader] 。 +

+ + +

源代码

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/Three.Legacy.js src/Three.Legacy.js] + + + + diff --git a/docs/api/zh/extras/Earcut.html b/docs/api/zh/extras/Earcut.html new file mode 100644 index 00000000000000..66bb67d2890b9f --- /dev/null +++ b/docs/api/zh/extras/Earcut.html @@ -0,0 +1,31 @@ + + + + + + + + + + +

[name]

+ +

+ An implementation of the earcut polygon triangulation algorithm. The code is a port of [link:https://github.com/mapbox/earcut mapbox/earcut]. +

+ +

Methods

+ +

[method:Array triangulate]( data, holeIndices, dim )

+

+ data -- A flat array of vertice coordinates.

+ holeIndices -- An array of hole indices if any.

+ dim -- The number of coordinates per vertice in the input array.

+ +

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/extras/ShapeUtils.html b/docs/api/zh/extras/ShapeUtils.html new file mode 100644 index 00000000000000..f6c9e63b06f47c --- /dev/null +++ b/docs/api/zh/extras/ShapeUtils.html @@ -0,0 +1,54 @@ + + + + + + + + + + +

[name]

+ +

+ A class containing utility functions for shapes.

+ + Note that these are all linear functions so it is neccessary to calculate separately for + x, y (and z, w if present) components of a vector. +

+ + +

Methods

+ +

[method:Number area]( contour )

+

+ contour -- 2D polygon.

+ + Calculate area of a ( 2D ) contour polygon.

+ +

+ +

[method:Boolean isClockwise]( pts )

+

+ pts -- points defining a 2D polygon

+ + Note that this is a linear function so it is neccessary to calculate separately for + x, y components of a polygon.

+ + Used internally by [page:Path Path], + [page:ExtrudeGeometry ExtrudeGeometry] and [page:ShapeGeometry ShapeGeometry]. +

+ +

[method:Array triangulateShape]( contour, holes )

+

+ contour -- 2D polygon.
+ holes -- array of holes

+ + Used internally by [page:ExtrudeGeometry ExtrudeGeometry] and [page:ShapeGeometry ShapeGeometry] to calculate faces in shapes with holes. +

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/extras/core/Curve.html b/docs/api/zh/extras/core/Curve.html new file mode 100644 index 00000000000000..ee3a07713aa2ab --- /dev/null +++ b/docs/api/zh/extras/core/Curve.html @@ -0,0 +1,116 @@ + + + + + + + + + + +

[name]

+ +

+ An abstract base class for creating a [name] object that contains methods for interpolation. + For an array of [name]s see [page:CurvePath]. +

+ +

Constructor

+ + +

[name]()

+

+ This constructor creates a new [name]. +

+ +

Properties

+ +

[property:Integer arcLengthDivisions]

+

This value determines the amount of divisions when calculating the cumulative segment lengths of a curve via [page:.getLengths]. + To ensure precision when using methods like [page:.getSpacedPoints], it is recommended to increase [page:.arcLengthDivisions] if the curve is very large. Default is 200.

+ +

Methods

+ +

[method:Vector getPoint]( [param:Float t], [param:Vector optionalTarget] )

+

+ [page:Float t] - A position on the curve. Must be in the range [ 0, 1 ].
+ [page:Vector optionalTarget] — (optional) If specified, the result will be copied into this Vector, + otherwise a new Vector will be created.

+ + Returns a vector for a given position on the curve. +

+ +

[method:Vector getPointAt]( [param:Float u], [param:Vector optionalTarget] )

+

+ [page:Float u] - A position on the curve according to the arc length. Must be in the range [ 0, 1 ].
+ [page:Vector optionalTarget] — (optional) If specified, the result will be copied into this Vector, + otherwise a new Vector will be created.

+ + Returns a vector for a given position on the curve according to the arc length. +

+ +

[method:Array getPoints]( [param:Integer divisions] )

+

+ divisions -- number of pieces to divide the curve into. Default is *5*.

+ + Returns a set of divisions + 1 points using getPoint( t ). +

+ +

[method:Array getSpacedPoints]( [param:Integer divisions] )

+

+ divisions -- number of pieces to divide the curve into. Default is *5*.

+ + Returns a set of divisions + 1 equi-spaced points using getPointAt( u ). +

+ +

[method:Float getLength]()

+

Get total curve arc length.

+ +

[method:Array getLengths]( [param:Integer divisions] )

+

Get list of cumulative segment lengths.

+ +

[method:null updateArcLengths]()

+

Update the cumlative segment distance cache.

+ +

[method:Float getUtoTmapping]( [param:Float u], [param:Float distance] )

+

+ Given u in the range ( 0 .. 1 ), returns [page:Float t] also in the range ( 0 .. 1 ). + u and t can then be used to give you points which are equidistant from the ends of the curve, + using [page:.getPoint]. +

+ +

[method:Vector getTangent]( [param:Float t] )

+

+ Returns a unit vector tangent at t. If the derived curve does not implement its + tangent derivation, two points a small delta apart will be used to find its gradient + which seems to give a reasonable approximation. +

+ +

[method:Vector getTangentAt]( [param:Float u] )

+

+ Returns tangent at a point which is equidistant to the ends of the curve from the + point given in [page:.getTangent]. +

+ +

[method:Object computeFrenetFrames]( [param:Integer segments], [param:Boolean closed] )

+

+ Generates the Frenet Frames. Used in geometries like [page:TubeGeometry] or [page:ExtrudeGeometry]. +

+ +

[method:Curve clone]()

+

Creates a clone of this instance.

+ +

[method:Curve copy]( [param:Curve source] )

+

Copies another [name] object to this instance.

+ +

[method:Object toJSON]()

+

Returns a JSON object representation of this instance.

+ +

[method:Curve fromJSON]( [param:Object json] )

+

Copies the data from the given JSON object to this instance.

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/extras/core/CurvePath.html b/docs/api/zh/extras/core/CurvePath.html new file mode 100644 index 00000000000000..54c6c8ef6e48c9 --- /dev/null +++ b/docs/api/zh/extras/core/CurvePath.html @@ -0,0 +1,60 @@ + + + + + + + + + + + [page:Curve] → + +

[name]

+ +

+ An abstract base class extending [page:Curve]. A CurvePath is simply an array of connected curves, + but retains the api of a curve. +

+ + +

Constructor

+ + +

[name]()

+

+ The constructor take no parameters. +

+ + +

Properties

+

See the base [page:Curve] class for common properties.

+ +

[property:array curves]

+

The array of [page:Curve Curves].

+ +

[property:boolean autoClose]

+

Whether or not to automatically close the path.

+ + + + + +

Methods

+

See the base [page:Curve] class for common methods.

+ +

[method:null add]( [param:Curve curve] )

+

Add a curve to the [page:.curves] array.

+ +

[method:null closePath]()

+

Adds a [page:LineCurve lineCurve] to close the path.

+ +

[method:Float getCurveLengths]()

+

Adds together the lengths of the curves in the [page:.curves] array.

+ + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/extras/core/Font.html b/docs/api/zh/extras/core/Font.html new file mode 100644 index 00000000000000..724e2af643c40c --- /dev/null +++ b/docs/api/zh/extras/core/Font.html @@ -0,0 +1,61 @@ + + + + + + + + + + +

[name]

+ +

+ Create a set of [page:Shape Shapes] representing a font loaded in JSON format.

+ + This is used internally by the [page:FontLoader]. +

+ +

Examples

+ +

+ [example:webgl_geometry_text_shapes geometry / text / shapes ]
+ [example:webgl_shaders_vector vector / text ]
+

+ +

Constructor

+ +

[name]( data )

+

+ data -- JSON data representing the font.

+ + This constructor creates a new [name], which is an array of [page:Shape Shapes]. +

+ +

Properties

+ +

[property:array data]

+

The JSON data passed in the constructor.

+ +

[property:Boolean isFont]

+

+ Used to check whether this or derived classes are fonts. Default is *true*.

+ + You should not change this, as it used internally by the renderer for optimisation. +

+ +

Methods

+ +

[method:null generateShapes]( [param:String text], [param:Float size] )

+

+ [page:String text] -- string of text.
+ [page:Float size] -- (optional) scale for the [page:Shape Shapes]. Default is *100*.
+ + Creates an array of [page:Shape Shapes] representing the text in the font. +

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/extras/core/Interpolations.html b/docs/api/zh/extras/core/Interpolations.html new file mode 100644 index 00000000000000..c31ba66b943d87 --- /dev/null +++ b/docs/api/zh/extras/core/Interpolations.html @@ -0,0 +1,47 @@ + + + + + + + + + + +

[name]

+ +

+ TODO +

+ +

Methods

+ +

[method:Float CatmullRom]( [param:Float t], [param:Float p0], [param:Float p1], [param:Float p2], [param:Float p3] )

+

+ t -- interpolation weight.
+ p0, p1, p2, p3 -- the points defining the spline curve.

+ + Used internally by [page:SplineCurve SplineCurve]. +

+ +

[method:Float QuadraticBezier]( [param:Float t], [param:Float p0], [param:Float p1], [param:Float p2] )

+

+ t -- interpolation weight.
+ p0, p1, p2 -- the starting, control and end points defining the curve.

+ + Used internally by [page:QuadraticBezierCurve3 QuadraticBezierCurve3], [page:QuadraticBezierCurve QuadraticBezierCurve] and [page:Font Font]. +

+ +

[method:Float CubicBezier]( [param:Float t], [param:Float p0], [param:Float p1], [param:Float p2], [param:Float p3] )

+

+ t -- interpolation weight.
+ p0, p1, p2, p3 -- the starting, control(twice) and end points defining the curve.

+ + Used internally by [page:CubicBezierCurve3 CubicBezierCurve3], [page:CubicBezierCurve CubicBezierCurve] and [page:Font Font]. +

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/extras/core/Path.html b/docs/api/zh/extras/core/Path.html new file mode 100644 index 00000000000000..5adbe97c226225 --- /dev/null +++ b/docs/api/zh/extras/core/Path.html @@ -0,0 +1,145 @@ + + + + + + + + + + + [page:CurvePath] → + +

[name]

+ +

+ A 2D path representation. The class provides methods for creating paths and contours of 2D shapes similar to the 2D Canvas API. +

+ +

Example

+ + + var path = new THREE.Path(); + + path.lineTo( 0, 0.8 ); + path.quadraticCurveTo( 0, 1, 0.2, 1 ); + path.lineTo( 1, 1 ); + + var points = path.getPoints(); + + var geometry = new THREE.BufferGeometry().setFromPoints( points ); + var material = new THREE.LineBasicMaterial( { color: 0xffffff } ); + + var line = new THREE.Line( geometry, material ); + scene.add( line ); + + + +

Constructor

+ + +

[name]( [param:Array points] )

+

+ points -- (optional) array of [page:Vector2 Vector2s].

+ + Creates a Path from the points. The first point defines the offset, then successive points + are added to the [page:CurvePath.curves curves] array as [page:LineCurve LineCurves].

+ + If no points are specified, an empty path is created and the [page:.currentPoint] is set to + the origin. +

+ + +

Properties

+

See the base [page:CurvePath] class for common properties.

+ +

[property:array currentPoint]

+

The current offset of the path. Any new [page:Curve] added will start here.

+ + +

Methods

+

See the base [page:CurvePath] class for common methods.

+ +

[method:null absarc]( [param:Float x], [param:Float y], [param:Float radius], [param:Float startAngle], [param:Float endAngle], [param:Float clockwise] )

+

+ x, y -- The absolute center of the arc.
+ radius -- The radius of the arc.
+ startAngle -- The start angle in radians.
+ endAngle -- The end angle in radians.
+ clockwise -- Sweep the arc clockwise. Defaults to *false*.

+ + Adds an absolutely positioned [page:EllipseCurve EllipseCurve] to the path. +

+ +

[method:null absellipse]( [param:Float x], [param:Float y], [param:Float xRadius], [param:Float yRadius], [param:Float startAngle], [param:Float endAngle], [param:Float clockwise], [param:Float rotation] )

+

+ x, y -- The absolute center of the ellipse.
+ xRadius -- The radius of the ellipse in the x axis.
+ yRadius -- The radius of the ellipse in the y axis.
+ startAngle -- The start angle in radians.
+ endAngle -- The end angle in radians.
+ clockwise -- Sweep the ellipse clockwise. Defaults to false.
+ rotation -- The rotation angle of the ellipse in radians, counterclockwise from the positive X axis. Optional, defaults to 0.

+ + Adds an absolutely positioned [page:EllipseCurve EllipseCurve] to the path. +

+ +

[method:null arc]( [param:Float x], [param:Float y], [param:Float radius], [param:Float startAngle], [param:Float endAngle], [param:Float clockwise] )

+

+ x, y -- The center of the arc offset from the last call.
+ radius -- The radius of the arc.
+ startAngle -- The start angle in radians.
+ endAngle -- The end angle in radians.
+ clockwise -- Sweep the arc clockwise. Defaults to *false*.

+ + Adds an [page:EllipseCurve EllipseCurve] to the path, positioned relative to [page:.currentPoint]. +

+ + +

[method:null bezierCurveTo]( [param:Float cp1X], [param:Float cp1Y], [param:Float cp2X], [param:Float cp2Y], [param:Float x], [param:Float y] )

+

This creates a bezier curve from [page:.currentPoint] with (cp1X, cp1Y) and (cp2X, cp2Y) as control points and updates [page:.currentPoint] to x and y.

+ +

[method:null ellipse]( [param:Float x], [param:Float y], [param:Float xRadius], [param:Float yRadius], [param:Float startAngle], [param:Float endAngle], [param:Float clockwise], [param:Float rotation] )

+

+ x, y -- The center of the ellipse offset from the last call.
+ xRadius -- The radius of the ellipse in the x axis.
+ yRadius -- The radius of the ellipse in the y axis.
+ startAngle -- The start angle in radians.
+ endAngle -- The end angle in radians.
+ clockwise -- Sweep the ellipse clockwise. Defaults to *false*.
+ rotation -- The rotation angle of the ellipse in radians, counterclockwise from the positive X axis. Optional, defaults to *0*.

+ + Adds an [page:EllipseCurve EllipseCurve] to the path, positioned relative to [page:.currentPoint]. +

+ +

[method:null lineTo]( [param:Float x], [param:Float y] )

+

Connects a [page:LineCurve] from [page:.currentPoint] to x, y onto the path.

+ + +

[method:null moveTo]( [param:Float x], [param:Float y] )

+

Move the [page:.currentPoint] to x, y.

+ + +

[method:null quadraticCurveTo]( [param:Float cpX], [param:Float cpY], [param:Float x], [param:Float y] )

+

Creates a quadratic curve from [page:.currentPoint] with cpX and cpY as control point and updates [page:.currentPoint] to x and y.

+ +

[method:null setFromPoints]( [param:Array vector2s] )

+

+ points -- array of [page:Vector2 Vector2s].

+ + Points are added to the [page:CurvePath.curves curves] + array as [page:LineCurve LineCurves]. +

+ +

[method:null splineThru] ( [param:Array points] )

+

+ points - An array of [page:Vector2 Vector2s]

+ + Connects a new [page:SplineCurve] onto the path. +

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/extras/core/Shape.html b/docs/api/zh/extras/core/Shape.html new file mode 100644 index 00000000000000..8815769f02ed8d --- /dev/null +++ b/docs/api/zh/extras/core/Shape.html @@ -0,0 +1,101 @@ + + + + + + + + + + + [page:Path] → + +

[name]

+ +

+ Defines an arbitrary 2d shape plane using paths with optional holes. It can be used with [page:ExtrudeGeometry], + [page:ShapeGeometry], to get points, or to get triangulated faces. +

+ + + var heartShape = new THREE.Shape(); + + heartShape.moveTo( 25, 25 ); + heartShape.bezierCurveTo( 25, 25, 20, 0, 0, 0 ); + heartShape.bezierCurveTo( 30, 0, 30, 35,30,35 ); + heartShape.bezierCurveTo( 30, 55, 10, 77, 25, 95 ); + heartShape.bezierCurveTo( 60, 77, 80, 55, 80, 35 ); + heartShape.bezierCurveTo( 80, 35, 80, 0, 50, 0 ); + heartShape.bezierCurveTo( 35, 0, 25, 25, 25, 25 ); + + var extrudeSettings = { amount: 8, bevelEnabled: true, bevelSegments: 2, steps: 2, bevelSize: 1, bevelThickness: 1 }; + + var geometry = new THREE.ExtrudeGeometry( heartShape, extrudeSettings ); + + var mesh = new THREE.Mesh( geometry, new THREE.MeshPhongMaterial() ); + + +

Examples

+ +

+ [example:webgl_geometry_shapes geometry / shapes ]
+ [example:webgl_geometry_extrude_shapes geometry / extrude / shapes ]
+ [example:webgl_geometry_extrude_shapes2 geometry / extrude / shapes2 ]
+

+ + +

Constructor

+ + +

[name]( [param:Array points] )

+

+ points -- (optional) array of [page:Vector2 Vector2s].

+ + Creates a Shape from the points. The first point defines the offset, then successive points + are added to the [page:CurvePath.curves curves] array as [page:LineCurve LineCurves].

+ + If no points are specified, an empty shape is created and the [page:.currentPoint] is set to + the origin. +

+ + +

Properties

+

See the base [page:Path] class for common properties.

+ +

[property:String uuid]

+

+ [link:http://en.wikipedia.org/wiki/Universally_unique_identifier UUID] of this instance. This gets automatically assigned, so this shouldn't be edited. +

+ +

[property:array holes]

+

An array of [page:Path paths] that define the holes in the shape.

+ +

Methods

+

See the base [page:Path] class for common methods.

+ +

[method:Array extractPoints]( [param:Integer divisions] )

+

+ divisions -- The fineness of the result.

+ + Call [page:Curve.getPoints getPoints] on the shape and the [page:.holes] array, and return an object of the form: + +{ + shape + holes +} + + where shape and holes are arrays of [page:Vector2 Vector2s]. +

+ +

[method:Array getPointsHoles]( [param:Integer divisions] )

+

+ divisions -- The fineness of the result.

+ + Get an array of [page:Vector2 Vector2s] that represent the holes in the shape. +

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/extras/core/ShapePath.html b/docs/api/zh/extras/core/ShapePath.html new file mode 100644 index 00000000000000..89a3fae2fa7b6e --- /dev/null +++ b/docs/api/zh/extras/core/ShapePath.html @@ -0,0 +1,91 @@ + + + + + + + + + + + [page:CurvePath] → + +

[name]

+ +

+ This class is used to convert a series of shapes to an array of [page:Path]s, for example an SVG shape to a + path (see the example below). It is used internally by [page:Font] to convert a font in JSON format to a + series of paths. +

+ +

Example

+ + [example:webgl_geometry_extrude_shapes2 geometry / extrude / shapes2] + +

Constructor

+ + +

[name]( )

+

+ Creates a new ShapePath. Unlike a [page:Path], no points are passed in as the ShapePath is designed to + be generated after creation. +

+ + +

Properties

+ +

[property:array subPaths]

+

+ Array of [page:Path]s. +

+ +

[property:array currentPath]

+

+ The current [page:Path] that is being generated. +

+ +

Methods

+ +

[method:null moveTo]( [param:Float x], [param:Float y] )

+

+ Starts a new [page:Path] and calls [page:Path.moveTo]( x, y ) on that [page:Path]. + Also points [page:ShapePath.currentPath currentPath] to that [page:Path]. +

+ +

[method:null lineTo]( [param:Float x], [param:Float y] )

+

This creates a line from the [page:ShapePath.currentPath currentPath]'s + offset to X and Y and updates the offset to X and Y.

+ +

[method:null quadraticCurveTo]( [param:Float cpX], [param:Float cpY], [param:Float x], [param:Float y] )

+

This creates a quadratic curve from the [page:ShapePath.currentPath currentPath]'s + offset to x and y with cpX and cpY as control point and updates the [page:ShapePath.currentPath currentPath]'s + offset to x and y.

+ +

[method:null bezierCurveTo]( [param:Float cp1X], [param:Float cp1Y], [param:Float cp2X], [param:Float cp2Y], [param:Float x], [param:Float y] )

+

This creates a bezier curve from the [page:ShapePath.currentPath currentPath]'s + offset to x and y with cp1X, cp1Y and cp1X, cp1Y as control points and updates the + [page:ShapePath.currentPath currentPath]'s offset to x and y.

+ +

[method:null splineThru] ( [param:Array points] )

+

points - An array of [page:Vector2]s

+

Connects a new [page:SplineCurve] onto the [page:ShapePath.currentPath currentPath].

+ + +

[method:Array toShapes]( [param:Boolean isCCW], [param:Boolean noHoles] )

+

+ isCCW -- Changes how solids and holes are generated
+ noHoles -- Whether or not to generate holes +

+

+ Converts the [page:ShapePath.subPaths subPaths] array into an array of Shapes. By default solid shapes are defined clockwise (CW) and holes are defined counterclockwise (CCW). If isCCW is set to true, + then those are flipped. If the parameter noHoles is set to true then all paths are set as solid shapes and isCCW is ignored. +
+ +

+ + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/extras/core/Path.js src/extras/core/Path.js] + + diff --git a/docs/api/zh/extras/curves/ArcCurve.html b/docs/api/zh/extras/curves/ArcCurve.html new file mode 100644 index 00000000000000..4643f854c7eb3d --- /dev/null +++ b/docs/api/zh/extras/curves/ArcCurve.html @@ -0,0 +1,32 @@ + + + + + + + + + + + [page:EllipseCurve] → + +

[name]

+ +

Alias for [page:EllipseCurve]

+ +

Properties

+

See the [page:EllipseCurve] class for common properties.

+ +

[property:Boolean isArcCurve]

+

+ Used to check whether this or derived classes are ArcCurves. Default is *true*.

+ + You should not change this, as it used internally for optimisation. +

+ + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/extras/curves/CatmullRomCurve3.html b/docs/api/zh/extras/curves/CatmullRomCurve3.html new file mode 100644 index 00000000000000..cc485f46bf4267 --- /dev/null +++ b/docs/api/zh/extras/curves/CatmullRomCurve3.html @@ -0,0 +1,81 @@ + + + + + + + + + + + [page:Curve] → + +

[name]

+ +

Create a smooth 3d spline curve from a series of points using the + [link:https://en.wikipedia.org/wiki/Centripetal_Catmull-Rom_spline Catmull-Rom] algorithm.

+ +

Example

+ + +//Create a closed wavey loop +var curve = new THREE.CatmullRomCurve3( [ + new THREE.Vector3( -10, 0, 10 ), + new THREE.Vector3( -5, 5, 5 ), + new THREE.Vector3( 0, 0, 0 ), + new THREE.Vector3( 5, -5, 5 ), + new THREE.Vector3( 10, 0, 10 ) +] ); + +var points = curve.getPoints( 50 ); +var geometry = new THREE.BufferGeometry().setFromPoints( points ); + +var material = new THREE.LineBasicMaterial( { color : 0xff0000 } ); + +// Create the final object to add to the scene +var curveObject = new THREE.Line( geometry, material ); + + +

[example:webgl_geometry_extrude_splines geometry / extrude / splines]

+ + +

Constructor

+ +

[name]( [param:Array points], [param:Boolean closed], [param:String curveType], [param:Float tension] )

+

+ points – An array of [page:Vector3] points
+ closed – Whether the curve is closed. Default is *false*.
+ curveType – Type of the curve. Default is *centripetal*.
+ tension – Tension of the curve. Default is *0.5*. +

+ + +

Properties

+

See the base [page:Curve] class for common properties.

+ +

[property:Boolean isCatmullRomCurve3]

+

+ Used to check whether this or derived classes are CatmullRomCurve3s. Default is *true*.

+ + You should not change this, as it used internally for optimisation. +

+ +

[property:Array points]

+

The array of [page:Vector3] points that define the curve. It needs at least two entries.

+ +

[property:Boolean closed]

+

The curve will loop back onto itself when this is true.

+ +

[property:String curveType]

+

Possible values are *centripetal*, *chordal* and *catmullrom*.

+ +

[property:float tension]

+

When [page:.type] is *catmullrom*, defines catmullrom's tension.

+ + +

Methods

+

See the base [page:Curve] class for common methods.

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/extras/curves/CubicBezierCurve.html b/docs/api/zh/extras/curves/CubicBezierCurve.html new file mode 100644 index 00000000000000..6462fc5e657e47 --- /dev/null +++ b/docs/api/zh/extras/curves/CubicBezierCurve.html @@ -0,0 +1,81 @@ + + + + + + + + + + + [page:Curve] → + +

[name]

+ +

+ Create a smooth 2d + cubic bezier curve, + defined by a start point, endpoint and two control points. +

+ +

Example

+ + +var curve = new THREE.CubicBezierCurve( + new THREE.Vector2( -10, 0 ), + new THREE.Vector2( -5, 15 ), + new THREE.Vector2( 20, 15 ), + new THREE.Vector2( 10, 0 ) +); + +var points = curve.getPoints( 50 ); +var geometry = new THREE.BufferGeometry().setFromPoints( points ); + +var material = new THREE.LineBasicMaterial( { color : 0xff0000 } ); + +// Create the final object to add to the scene +var curveObject = new THREE.Line( geometry, material ); + + +

Constructor

+ + +

[name] ( [param:Vector2 v0], [param:Vector2 v1], [param:Vector2 v2], [param:Vector2 v3] )

+

+ [page:Vector2 v0] – The starting point.
+ [page:Vector2 v1] – The first control point.
+ [page:Vector2 v2] – The second control point.
+ [page:Vector2 v3] – The ending point. +

+ +

Properties

+

See the base [page:Curve] class for common properties.

+ +

[property:Boolean isCubicBezierCurve]

+

+ Used to check whether this or derived classes are CubicBezierCurves. Default is *true*.

+ + You should not change this, as it used internally for optimisation. +

+ +

[property:Vector2 v0]

+

The starting point.

+ +

[property:Vector2 v1]

+

The first control point.

+ +

[property:Vector2 v2]

+

The second control point.

+ +

[property:Vector2 v3]

+

The ending point.

+ + +

Methods

+

See the base [page:Curve] class for common Methods.

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/extras/curves/CubicBezierCurve3.html b/docs/api/zh/extras/curves/CubicBezierCurve3.html new file mode 100644 index 00000000000000..77d01a9839828b --- /dev/null +++ b/docs/api/zh/extras/curves/CubicBezierCurve3.html @@ -0,0 +1,82 @@ + + + + + + + + + + + [page:Curve] → + +

[name]

+ +

+ Create a smooth 3d + cubic bezier curve, + defined by a start point, endpoint and two control points. +

+ +

Example

+ + +var curve = new THREE.CubicBezierCurve3( + new THREE.Vector3( -10, 0, 0 ), + new THREE.Vector3( -5, 15, 0 ), + new THREE.Vector3( 20, 15, 0 ), + new THREE.Vector3( 10, 0, 0 ) +); + +var points = curve.getPoints( 50 ); +var geometry = new THREE.BufferGeometry().setFromPoints( points ); + +var material = new THREE.LineBasicMaterial( { color : 0xff0000 } ); + +// Create the final object to add to the scene +var curveObject = new THREE.Line( geometry, material ); + + + +

Constructor

+ + +

[name]( [param:Vector3 v0], [param:Vector3 v1], [param:Vector3 v2], [param:Vector3 v3] )

+

+ [page:Vector3 v0] – The starting point.
+ [page:Vector3 v1] – The first control point.
+ [page:Vector3 v2] – The second control point.
+ [page:Vector3 v3] – The ending point. +

+ +

Properties

+

See the base [page:Curve] class for common properties.

+ +

[property:Boolean isCubicBezierCurve3]

+

+ Used to check whether this or derived classes are CubicBezierCurve3s. Default is *true*.

+ + You should not change this, as it used internally for optimisation. +

+ +

[property:Vector2 v0]

+

The starting point.

+ +

[property:Vector2 v1]

+

The first control point.

+ +

[property:Vector2 v2]

+

The second control point.

+ +

[property:Vector2 v3]

+

The ending point.

+ + +

Methods

+

See the base [page:Curve] class for common Methods.

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/extras/curves/EllipseCurve.html b/docs/api/zh/extras/curves/EllipseCurve.html new file mode 100644 index 00000000000000..c4859dbb70880c --- /dev/null +++ b/docs/api/zh/extras/curves/EllipseCurve.html @@ -0,0 +1,105 @@ + + + + + + + + + + + [page:Curve] → + +

[name]

+ +

+ Creates a 2d curve in the shape of an ellipse. Setting the + [page:Number xRadius] equal to the [page:Number yRadius] will result in a circle. +

+ +

Example

+ + +var curve = new THREE.EllipseCurve( + 0, 0, // ax, aY + 10, 10, // xRadius, yRadius + 0, 2 * Math.PI, // aStartAngle, aEndAngle + false, // aClockwise + 0 // aRotation +); + +var points = curve.getPoints( 50 ); +var geometry = new THREE.BufferGeometry().setFromPoints( points ); + +var material = new THREE.LineBasicMaterial( { color : 0xff0000 } ); + +// Create the final object to add to the scene +var ellipse = new THREE.Line( geometry, material ); + + +

Constructor

+ + +

[name]( [param:Float aX], [param:Float aY], [param:Float xRadius], [param:Float yRadius], [param:Radians aStartAngle], [param:Radians aEndAngle], [param:Boolean aClockwise], [param:Radians aRotation] )

+

+ [page:Float aX] – The X center of the ellipse. Default is *0*.
+ [page:Float aY] – The Y center of the ellipse. Default is *0*.
+ [page:Float xRadius] – The radius of the ellipse in the x direction. Default is *1*.
+ [page:Float yRadius] – The radius of the ellipse in the y direction. Default is *1*.
+ [page:Radians aStartAngle] – The start angle of the curve in radians starting from the middle right side. Default is *0*.
+ [page:Radians aEndAngle] – The end angle of the curve in radians starting from the middle right side. Default is *2 x Math.PI*.
+ [page:Boolean aClockwise] – Whether the ellipse is drawn clockwise. Default is *false*.
+ [page:Radians aRotation] – The rotation angle of the ellipse in radians, counterclockwise from the positive X axis (optional). Default is *0*.

+ + Note: When going clockwise it's best to set the start angle to (Math.PI * 2) and then work towards lower numbers. +

+ +

Properties

+

See the base [page:Curve] class for common properties.

+ +

[property:Boolean isEllipseCurve]

+

+ Used to check whether this or derived classes are EllipseCurves. Default is *true*.

+ + You should not change this, as it used internally for optimisation. +

+ +

[property:Float aX]

+

The X center of the ellipse.

+ +

[property:Float aY]

+

The Y center of the ellipse.

+ +

[property:Radians xRadius]

+

The radius of the ellipse in the x direction.

+ +

[property:Radians yRadius]

+

The radius of the ellipse in the y direction.

+ +

[property:Float aStartAngle]

+

The start angle of the curve in radians starting from the middle right side.

+ +

[property:Float aEndAngle]

+

The end angle of the curve in radians starting from the middle right side.

+ +

[property:Boolean aClockwise]

+

Whether the ellipse is drawn clockwise.

+ +

[property:Float aRotation]

+

The rotation angle of the ellipse in radians, counterclockwise from the positive X axis (optional). Default is *0*.

+ +

[property:Boolean isEllipseCurve]

+

+ Used to check whether this or derived classes are ellipses. Default is *true*.

+ + You should not change this, as it used internally for optimisation. +

+ +

Methods

+

See the base [page:Curve] class for common methods.

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/extras/curves/LineCurve.html b/docs/api/zh/extras/curves/LineCurve.html new file mode 100644 index 00000000000000..cad8ffa2d63018 --- /dev/null +++ b/docs/api/zh/extras/curves/LineCurve.html @@ -0,0 +1,51 @@ + + + + + + + + + + + [page:Curve] → + +

[name]

+ +

A curve representing a 2d line segment.

+ +

Constructor

+ + +

[name]( [param:Vector2 v1], [param:Vector2 v2] )

+

+ [page:Vector2 v1] – The start point.
+ [page:Vector2 v2] - The end point. +

+ + +

Properties

+

See the base [page:Curve] class for common properties.

+ +

[property:Boolean isLineCurve]

+

+ Used to check whether this or derived classes are LineCurves. Default is *true*.

+ + You should not change this, as it used internally for optimisation. +

+ +

[property:Vector2 v1]

+

The start point.

+ +

[property:Vector2 v2]

+

The end point

+ +

Methods

+

See the base [page:Curve] class for common methods.

+ + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/extras/curves/LineCurve3.html b/docs/api/zh/extras/curves/LineCurve3.html new file mode 100644 index 00000000000000..d9952ea8972b87 --- /dev/null +++ b/docs/api/zh/extras/curves/LineCurve3.html @@ -0,0 +1,50 @@ + + + + + + + + + + + [page:Curve] → + +

[name]

+ +

A curve representing a 3d line segment.

+ +

Constructor

+ + +

[name]( [param:Vector3 v1], [param:Vector3 v2] )

+

+ [page:Vector3 v1] – The start point.
+ [page:Vector3 v2] - The end point. +

+ + +

Properties

+

See the base [page:Curve] class for common properties.

+ +

[property:Boolean isLineCurve3]

+

+ Used to check whether this or derived classes are LineCurve3s. Default is *true*.

+ + You should not change this, as it used internally for optimisation. +

+ +

[property:Vector3 v1]

+

The start point.

+ +

[property:Vector3 v2]

+

The end point.

+ +

Methods

+

See the base [page:Curve] class for common methods.

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/extras/curves/QuadraticBezierCurve.html b/docs/api/zh/extras/curves/QuadraticBezierCurve.html new file mode 100644 index 00000000000000..f20c947bd81d7d --- /dev/null +++ b/docs/api/zh/extras/curves/QuadraticBezierCurve.html @@ -0,0 +1,77 @@ + + + + + + + + + + + [page:Curve] → + +

[name]

+ +

+ Create a smooth 2d + quadratic bezier curve, + defined by a startpoint, endpoint and a single control point. +

+ +

Example

+ + +var curve = new THREE.QuadraticBezierCurve( + new THREE.Vector2( -10, 0 ), + new THREE.Vector2( 20, 15 ), + new THREE.Vector2( 10, 0 ) +); + +var points = curve.getPoints( 50 ); +var geometry = new THREE.BufferGeometry().setFromPoints( points ); + +var material = new THREE.LineBasicMaterial( { color : 0xff0000 } ); + +//Create the final object to add to the scene +var curveObject = new THREE.Line( geometry, material ); + + +

Constructor

+ + +

[name]( [param:Vector2 v0], [param:Vector2 v1], [param:Vector2 v2] )

+

+ [page:Vector2 v0] – The startpoint.
+ [page:Vector2 v1] – The control point.
+ [page:Vector2 v2] – The endpoint. +

+ + +

Properties

+

See the base [page:Curve] class for common properties.

+ +

[property:Boolean isQuadraticBezierCurve]

+

+ Used to check whether this or derived classes are QuadraticBezierCurves. Default is *true*.

+ + You should not change this, as it used internally for optimisation. +

+ + +

[property:Vector2 v0]

+

The startpoint.

+ +

[property:Vector2 v1]

+

The control point.

+ +

[property:Vector2 v2]

+

The endpoint.

+ +

Methods

+

See the base [page:Curve] class for common methods.

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/extras/curves/QuadraticBezierCurve3.html b/docs/api/zh/extras/curves/QuadraticBezierCurve3.html new file mode 100644 index 00000000000000..74070efb5bd309 --- /dev/null +++ b/docs/api/zh/extras/curves/QuadraticBezierCurve3.html @@ -0,0 +1,77 @@ + + + + + + + + + + + [page:Curve] → + +

[name]

+ +

+ Create a smooth 3d + quadratic bezier curve, + defined by a startpoint, endpoint and a single control point. +

+ +

Example

+ + +var curve = new THREE.QuadraticBezierCurve3( + new THREE.Vector3( -10, 0, 0 ), + new THREE.Vector3( 20, 15, 0 ), + new THREE.Vector3( 10, 0, 0 ) +); + +var points = curve.getPoints( 50 ); +var geometry = new THREE.BufferGeometry().setFromPoints( points ); + +var material = new THREE.LineBasicMaterial( { color : 0xff0000 } ); + +// Create the final object to add to the scene +var curveObject = new THREE.Line( geometry, material ); + + +

Constructor

+ + +

[name]( [param:Vector3 v0], [param:Vector3 v1], [param:Vector3 v2] )

+

+ [page:Vector3 v0] – The starting point
+ [page:Vector3 v1] – The middle control point
+ [page:Vector3 v2] – The ending point
+

+ + + +

Properties

+

See the base [page:Curve] class for common properties.

+ +

[property:Boolean isQuadraticBezierCurve3]

+

+ Used to check whether this or derived classes are QuadraticBezierCurve3s. Default is *true*.

+ + You should not change this, as it used internally for optimisation. +

+ +

[property:Vector3 v0]

+

The startpoint.

+ +

[property:Vector3 v1]

+

The control point.

+ +

[property:Vector3 v2]

+

The endpoint.

+ +

Methods

+

See the base [page:Curve] class for common methods.

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/extras/curves/SplineCurve.html b/docs/api/zh/extras/curves/SplineCurve.html new file mode 100644 index 00000000000000..0ec633793ee1c9 --- /dev/null +++ b/docs/api/zh/extras/curves/SplineCurve.html @@ -0,0 +1,72 @@ + + + + + + + + + + + [page:Curve] → + +

[name]

+ +

+ Create a smooth 2d spline curve from a series of points. Internally this uses + [page:Interpolations.CatmullRom] to create the curve. +

+ +

Example

+ + +// Create a sine-like wave +var curve = new THREE.SplineCurve( [ + new THREE.Vector2( -10, 0 ), + new THREE.Vector2( -5, 5 ), + new THREE.Vector2( 0, 0 ), + new THREE.Vector2( 5, -5 ), + new THREE.Vector2( 10, 0 ) +] ); + +var points = curve.getPoints( 50 ); +var geometry = new THREE.BufferGeometry().setFromPoints( points ); + +var material = new THREE.LineBasicMaterial( { color : 0xff0000 } ); + +// Create the final object to add to the scene +var splineObject = new THREE.Line( geometry, material ); + + +

Constructor

+ + +

[name]( [param:Array points] )

+

points – An array of [page:Vector2] points that define the curve.

+ + +

Properties

+

See the base [page:Curve] class for common properties.

+ +

[property:Boolean isSplineCurve]

+

+ Used to check whether this or derived classes are SplineCurves. Default is *true*.

+ + You should not change this, as it used internally for optimisation. +

+ +

[property:Array points]

+

The array of [page:Vector2] points that define the curve.

+ + + +

Methods

+

See the base [page:Curve] class for common methods.

+ + + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/extras/objects/ImmediateRenderObject.html b/docs/api/zh/extras/objects/ImmediateRenderObject.html new file mode 100644 index 00000000000000..c2f8f8d5034f46 --- /dev/null +++ b/docs/api/zh/extras/objects/ImmediateRenderObject.html @@ -0,0 +1,42 @@ + + + + + + + + + + + [page:Object3D] → + +

及时渲染对象([name])

+ +

及时渲染对象的基类。

+ + +

构造函数(Constructor)

+ + +

[name]()

+

+ 这会创建一个新的 [name]。 +

+ + +

方法(Methods)

+ + +

[method:null render]([param:Function renderCallback])

+

+ renderCallback -- 生成对象的渲染函数。 +

+

+ 需要重写此函数以开始创建对象,并在完成时调用renderCallback。 +

+ +

源码(Source)

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/geometries/BoxBufferGeometry.html b/docs/api/zh/geometries/BoxBufferGeometry.html new file mode 100644 index 00000000000000..00e742692641ee --- /dev/null +++ b/docs/api/zh/geometries/BoxBufferGeometry.html @@ -0,0 +1,75 @@ + + + + + + + + + + + [page:BufferGeometry] → + +

[name]

+ +

This is the [page:BufferGeometry] port of [page:BoxGeometry].

+ + + + + +

Example

+ + var geometry = new THREE.BoxBufferGeometry( 1, 1, 1 ); + var material = new THREE.MeshBasicMaterial( {color: 0x00ff00} ); + var cube = new THREE.Mesh( geometry, material ); + scene.add( cube ); + + +

Constructor

+ +

[name]([param:Float width], [param:Float height], [param:Float depth], [param:Integer widthSegments], [param:Integer heightSegments], [param:Integer depthSegments])

+

+ width — Width of the sides on the X axis. Default is 1.
+ height — Height of the sides on the Y axis. Default is 1.
+ depth — Depth of the sides on the Z axis. Default is 1.
+ widthSegments — Optional. Number of segmented faces along the width of the sides. Default is 1.
+ heightSegments — Optional. Number of segmented faces along the height of the sides. Default is 1.
+ depthSegments — Optional. Number of segmented faces along the depth of the sides. Default is 1. +

+ +

Properties

+ +

[property:Object parameters]

+

+ An object with a property for each of the constructor parameters. Any modification after instantiation does not change the geometry. +

+

+ Using the above example code above as our basis: + + geometry.parameters; // outputs an object {width: 1, height: 1, depth: 1, widthSegments: undefined, heightSegments: undefined} + cube.geometry.parameters; // as above + cube.geometry.parameters.width; // === 1 + cube.geometry.parameters.widthSegments // === undefined. + +

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/geometries/BoxGeometry.js src/geometries/BoxGeometry.js] + + diff --git a/docs/api/zh/geometries/BoxGeometry.html b/docs/api/zh/geometries/BoxGeometry.html new file mode 100644 index 00000000000000..80cb7efa431a86 --- /dev/null +++ b/docs/api/zh/geometries/BoxGeometry.html @@ -0,0 +1,75 @@ + + + + + + + + + + + [page:Geometry] → + +

[name]

+ +

BoxGeometry is the quadrilateral primitive geometry class. It is typically used for creating a cube or irregular quadrilateral of the dimensions provided with the 'width', 'height', and 'depth' constructor arguments.

+ + + + + +

Example

+ + var geometry = new THREE.BoxGeometry( 1, 1, 1 ); + var material = new THREE.MeshBasicMaterial( {color: 0x00ff00} ); + var cube = new THREE.Mesh( geometry, material ); + scene.add( cube ); + + +

Constructor

+ +

[name]([param:Float width], [param:Float height], [param:Float depth], [param:Integer widthSegments], [param:Integer heightSegments], [param:Integer depthSegments])

+

+ width — Width of the sides on the X axis. Default is 1.
+ height — Height of the sides on the Y axis. Default is 1.
+ depth — Depth of the sides on the Z axis. Default is 1.
+ widthSegments — Optional. Number of segmented faces along the width of the sides. Default is 1.
+ heightSegments — Optional. Number of segmented faces along the height of the sides. Default is 1.
+ depthSegments — Optional. Number of segmented faces along the depth of the sides. Default is 1. +

+ +

Properties

+ +

[property:Object parameters]

+

+ An object with a property for each of the constructor parameters. Any modification after instantiation does not change the geometry. +

+

+ Using the above example code above as our basis: + + geometry.parameters; // outputs an object {width: 1, height: 1, depth: 1, widthSegments: undefined, heightSegments: undefined} + cube.geometry.parameters; // as above + cube.geometry.parameters.width; // === 1 + cube.geometry.parameters.widthSegments // === undefined. + +

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/geometries/CircleBufferGeometry.html b/docs/api/zh/geometries/CircleBufferGeometry.html new file mode 100644 index 00000000000000..dec69f33d7c4eb --- /dev/null +++ b/docs/api/zh/geometries/CircleBufferGeometry.html @@ -0,0 +1,65 @@ + + + + + + + + + + + [page:BufferGeometry] → + +

[name]

+ +

This is the [page:BufferGeometry] port of [page:CircleGeometry].

+ + + + + +

Example

+ + + var geometry = new THREE.CircleBufferGeometry( 5, 32 ); + var material = new THREE.MeshBasicMaterial( { color: 0xffff00 } ); + var circle = new THREE.Mesh( geometry, material ); + scene.add( circle ); + + +

Constructor

+ +

[name]([param:Float radius], [param:Integer segments], [param:Float thetaStart], [param:Float thetaLength])

+

+ radius — Radius of the circle, default = 1.
+ segments — Number of segments (triangles), minimum = 3, default = 8.
+ thetaStart — Start angle for first segment, default = 0 (three o'clock position).
+ thetaLength — The central angle, often called theta, of the circular sector. The default is 2*Pi, which makes for a complete circle. +

+ +

Properties

+ +

[property:Object parameters]

+

+ An object with a property for each of the constructor parameters. Any modification after instantiation does not change the geometry. +

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/geometries/CircleGeometry.js src/geometries/CircleGeometry.js] + + diff --git a/docs/api/zh/geometries/CircleGeometry.html b/docs/api/zh/geometries/CircleGeometry.html new file mode 100644 index 00000000000000..6cec70194c64f6 --- /dev/null +++ b/docs/api/zh/geometries/CircleGeometry.html @@ -0,0 +1,66 @@ + + + + + + + + + + + [page:Geometry] → + +

[name]

+ +

CircleGeometry is a simple shape of Euclidean geometry. It is contructed from a number of triangular segments that are oriented around a central point and extend as far out as a given radius. It is built counter-clockwise from a start angle and a given central angle. It can also be used to create regular polygons, where the number of segments determines the number of sides. +

+ + + + + +

Example

+ + + var geometry = new THREE.CircleGeometry( 5, 32 ); + var material = new THREE.MeshBasicMaterial( { color: 0xffff00 } ); + var circle = new THREE.Mesh( geometry, material ); + scene.add( circle ); + + +

Constructor

+ +

[name]([param:Float radius], [param:Integer segments], [param:Float thetaStart], [param:Float thetaLength])

+

+ radius — Radius of the circle, default = 1.
+ segments — Number of segments (triangles), minimum = 3, default = 8.
+ thetaStart — Start angle for first segment, default = 0 (three o'clock position).
+ thetaLength — The central angle, often called theta, of the circular sector. The default is 2*Pi, which makes for a complete circle. +

+ +

Properties

+ +

[property:Object parameters]

+

+ An object with a property for each of the constructor parameters. Any modification after instantiation does not change the geometry. +

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/geometries/ConeBufferGeometry.html b/docs/api/zh/geometries/ConeBufferGeometry.html new file mode 100644 index 00000000000000..ee0c18ec00b906 --- /dev/null +++ b/docs/api/zh/geometries/ConeBufferGeometry.html @@ -0,0 +1,67 @@ + + + + + + + + + + + [page:CylinderBufferGeometry] → + +

[name]

+ +

This is the [page:BufferGeometry] port of [page:ConeGeometry].

+ + + + + +

Example

+ + var geometry = new THREE.ConeBufferGeometry( 5, 20, 32 ); + var material = new THREE.MeshBasicMaterial( {color: 0xffff00} ); + var cone = new THREE.Mesh( geometry, material ); + scene.add( cone ); + + +

Constructor

+ +

[name]([param:Float radius], [param:Float height], [param:Integer radialSegments], [param:Integer heightSegments], [param:Boolean openEnded], [param:Float thetaStart], [param:Float thetaLength])

+

+ radius — Radius of the cone base. Default is 1.
+ height — Height of the cone. Default is 1.
+ radialSegments — Number of segmented faces around the circumference of the cone. Default is 8
+ heightSegments — Number of rows of faces along the height of the cone. Default is 1.
+ openEnded — A Boolean indicating whether the base of the cone is open or capped. Default is false, meaning capped.
+ thetaStart — Start angle for first segment, default = 0 (three o'clock position).
+ thetaLength — The central angle, often called theta, of the circular sector. The default is 2*Pi, which makes for a complete cone. +

+ +

Properties

+ +

[property:Object parameters]

+

+ An object with a property for each of the constructor parameters. Any modification after instantiation does not change the geometry. +

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/geometries/ConeGeometry.js src/geometries/ConeGeometry.js] + + diff --git a/docs/api/zh/geometries/ConeGeometry.html b/docs/api/zh/geometries/ConeGeometry.html new file mode 100644 index 00000000000000..cc94cfba427b67 --- /dev/null +++ b/docs/api/zh/geometries/ConeGeometry.html @@ -0,0 +1,67 @@ + + + + + + + + + + + [page:CylinderGeometry] → + +

[name]

+ +

A class for generating cone geometries

+ + + + + +

Example

+ + var geometry = new THREE.ConeGeometry( 5, 20, 32 ); + var material = new THREE.MeshBasicMaterial( {color: 0xffff00} ); + var cone = new THREE.Mesh( geometry, material ); + scene.add( cone ); + + +

Constructor

+ +

[name]([param:Float radius], [param:Float height], [param:Integer radialSegments], [param:Integer heightSegments], [param:Boolean openEnded], [param:Float thetaStart], [param:Float thetaLength])

+

+ radius — Radius of the cone at the base. Default is 1.
+ height — Height of the cone. Default is 1.
+ radialSegments — Number of segmented faces around the circumference of the cone. Default is 8
+ heightSegments — Number of rows of faces along the height of the cone. Default is 1.
+ openEnded — A Boolean indicating whether the base of the cone is open or capped. Default is false, meaning capped.
+ thetaStart — Start angle for first segment, default = 0 (three o'clock position).
+ thetaLength — The central angle, often called theta, of the circular sector. The default is 2*Pi, which makes for a complete cone. +

+ +

Properties

+ +

[property:Object parameters]

+

+ An object with a property for each of the constructor parameters. Any modification after instantiation does not change the geometry. +

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/geometries/CylinderBufferGeometry.html b/docs/api/zh/geometries/CylinderBufferGeometry.html new file mode 100644 index 00000000000000..62655410227edf --- /dev/null +++ b/docs/api/zh/geometries/CylinderBufferGeometry.html @@ -0,0 +1,68 @@ + + + + + + + + + + + [page:BufferGeometry] → + +

[name]

+ +

This is the [page:BufferGeometry] port of [page:CylinderGeometry].

+ + + + + +

Example

+ + var geometry = new THREE.CylinderBufferGeometry( 5, 5, 20, 32 ); + var material = new THREE.MeshBasicMaterial( {color: 0xffff00} ); + var cylinder = new THREE.Mesh( geometry, material ); + scene.add( cylinder ); + + +

Constructor

+ +

[name]([param:Float radiusTop], [param:Float radiusBottom], [param:Float height], [param:Integer radialSegments], [param:Integer heightSegments], [param:Boolean openEnded], [param:Float thetaStart], [param:Float thetaLength])

+

+ radiusTop — Radius of the cylinder at the top. Default is 1.
+ radiusBottom — Radius of the cylinder at the bottom. Default is 1.
+ height — Height of the cylinder. Default is 1.
+ radialSegments — Number of segmented faces around the circumference of the cylinder. Default is 8
+ heightSegments — Number of rows of faces along the height of the cylinder. Default is 1.
+ openEnded — A Boolean indicating whether the ends of the cylinder are open or capped. Default is false, meaning capped.
+ thetaStart — Start angle for first segment, default = 0 (three o'clock position).
+ thetaLength — The central angle, often called theta, of the circular sector. The default is 2*Pi, which makes for a complete cylinder. +

+ +

Properties

+ +

[property:Object parameters]

+

+ An object with a property for each of the constructor parameters. Any modification after instantiation does not change the geometry. +

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/geometries/CylinderGeometry.js src/geometries/CylinderGeometry.js] + + diff --git a/docs/api/zh/geometries/CylinderGeometry.html b/docs/api/zh/geometries/CylinderGeometry.html new file mode 100644 index 00000000000000..b5001eae340009 --- /dev/null +++ b/docs/api/zh/geometries/CylinderGeometry.html @@ -0,0 +1,68 @@ + + + + + + + + + + + [page:Geometry] → + +

[name]

+ +

A class for generating cylinder geometries

+ + + + + +

Example

+ + var geometry = new THREE.CylinderGeometry( 5, 5, 20, 32 ); + var material = new THREE.MeshBasicMaterial( {color: 0xffff00} ); + var cylinder = new THREE.Mesh( geometry, material ); + scene.add( cylinder ); + + +

Constructor

+ +

[name]([param:Float radiusTop], [param:Float radiusBottom], [param:Float height], [param:Integer radialSegments], [param:Integer heightSegments], [param:Boolean openEnded], [param:Float thetaStart], [param:Float thetaLength])

+

+ radiusTop — Radius of the cylinder at the top. Default is 1.
+ radiusBottom — Radius of the cylinder at the bottom. Default is 1.
+ height — Height of the cylinder. Default is 1.
+ radialSegments — Number of segmented faces around the circumference of the cylinder. Default is 8
+ heightSegments — Number of rows of faces along the height of the cylinder. Default is 1.
+ openEnded — A Boolean indicating whether the ends of the cylinder are open or capped. Default is false, meaning capped.
+ thetaStart — Start angle for first segment, default = 0 (three o'clock position).
+ thetaLength — The central angle, often called theta, of the circular sector. The default is 2*Pi, which makes for a complete cylinder. +

+ +

Properties

+ +

[property:Object parameters]

+

+ An object with a property for each of the constructor parameters. Any modification after instantiation does not change the geometry. +

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/geometries/DodecahedronBufferGeometry.html b/docs/api/zh/geometries/DodecahedronBufferGeometry.html new file mode 100644 index 00000000000000..c4663e6eda5ef2 --- /dev/null +++ b/docs/api/zh/geometries/DodecahedronBufferGeometry.html @@ -0,0 +1,54 @@ + + + + + + + + + + + [page:PolyhedronBufferGeometry] → + +

[name]

+ +

A class for generating a dodecahedron geometries.

+ + + + + +

Constructor

+ +

[name]([param:Float radius], [param:Integer detail])

+

+ radius — Radius of the dodecahedron. Default is 1.
+ detail — Default is 0. Setting this to a value greater than 0 adds vertices making it no longer a dodecahedron. +

+ +

Properties

+ +

[property:Object parameters]

+

+ An object with a property for each of the constructor parameters. Any modification after instantiation does not change the geometry. +

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/geometries/DodecahedronGeometry.js src/geometries/DodecahedronGeometry.js] + + diff --git a/docs/api/zh/geometries/DodecahedronGeometry.html b/docs/api/zh/geometries/DodecahedronGeometry.html new file mode 100644 index 00000000000000..18fadf8288cbde --- /dev/null +++ b/docs/api/zh/geometries/DodecahedronGeometry.html @@ -0,0 +1,54 @@ + + + + + + + + + + + [page:Geometry] → + +

[name]

+ +

A class for generating a dodecahedron geometries.

+ + + + + +

Constructor

+ +

[name]([param:Float radius], [param:Integer detail])

+

+ radius — Radius of the dodecahedron. Default is 1.
+ detail — Default is 0. Setting this to a value greater than 0 adds vertices making it no longer a dodecahedron. +

+ +

Properties

+ +

[property:Object parameters]

+

+ An object with a property for each of the constructor parameters. Any modification after instantiation does not change the geometry. +

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/geometries/EdgesGeometry.html b/docs/api/zh/geometries/EdgesGeometry.html new file mode 100644 index 00000000000000..9e5049ee2ab09b --- /dev/null +++ b/docs/api/zh/geometries/EdgesGeometry.html @@ -0,0 +1,47 @@ + + + + + + + + + + + [page:BufferGeometry] → + +

[name]

+ +

This can be used as a helper object to view the edges of a [page:Geometry Geometry] object.

+ +

Example

+ + [example:webgl_helpers helpers] + + +var geometry = new THREE.BoxBufferGeometry( 100, 100, 100 ); +var edges = new THREE.EdgesGeometry( geometry ); +var line = new THREE.LineSegments( edges, new THREE.LineBasicMaterial( { color: 0xffffff } ) ); +scene.add( line ); + + +

Constructor

+ +

[name]( [param:Geometry geometry], [param:Integer thresholdAngle] )

+

+ geometry — Any geometry object.
+ thresholdAngle — An edge is only rendered if the angle (in degrees) between the face normals of the adjoining faces exceeds this value. default = 1 degree. +

+ +

Properties

+ +

[property:Object parameters]

+

+ An object with a property for each of the constructor parameters. Any modification after instantiation does not change the geometry. +

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/geometries/ExtrudeBufferGeometry.html b/docs/api/zh/geometries/ExtrudeBufferGeometry.html new file mode 100644 index 00000000000000..0fe4ddb24cb88f --- /dev/null +++ b/docs/api/zh/geometries/ExtrudeBufferGeometry.html @@ -0,0 +1,106 @@ + + + + + + + + + + + [page:BufferGeometry] → + +

[name]

+ +

Creates extruded BufferGeometry from a path shape.

+ + + + + +

Example

+ + + + var length = 12, width = 8; + + var shape = new THREE.Shape(); + shape.moveTo( 0,0 ); + shape.lineTo( 0, width ); + shape.lineTo( length, width ); + shape.lineTo( length, 0 ); + shape.lineTo( 0, 0 ); + + var extrudeSettings = { + steps: 2, + depth: 16, + bevelEnabled: true, + bevelThickness: 1, + bevelSize: 1, + bevelSegments: 1 + }; + + var geometry = new THREE.ExtrudeBufferGeometry( shape, extrudeSettings ); + var material = new THREE.MeshBasicMaterial( { color: 0x00ff00 } ); + var mesh = new THREE.Mesh( geometry, material ) ; + scene.add( mesh ); + + + +

Constructor

+ + +

[name]([param:Array shapes], [param:Object options])

+

+ shapes — Shape or an array of shapes.
+ options — Object that can contain the following parameters. + +

    +
  • curveSegments — int. Number of points on the curves. Default is 12.
  • +
  • steps — int. Number of points used for subdividing segments along the depth of the extruded spline. Default is 1.
  • +
  • depth — float. Depth to extrude the shape. Default is 100.
  • +
  • bevelEnabled — bool. Apply beveling to the shape. Default is true.
  • +
  • bevelThickness — float. How deep into the original shape the bevel goes. Default is 6.
  • +
  • bevelSize — float. Distance from the shape outline that the bevel extends. Default is bevelThickness - 2.
  • +
  • bevelSegments — int. Number of bevel layers. Default is 3.
  • +
  • extrudePath — THREE.CurvePath. A 3D spline path along which the shape should be extruded.
  • +
  • UVGenerator — Object. object that provides UV generator functions
  • +
+ +

+

+ This object extrudes a 2D shape to a 3D geometry. +

+ +

+ When creating a Mesh with this geometry, if you'd like to have a separate material used for its face + and its extruded sides, you can use an array of materials. The first material will be + applied to the face; the second material will be applied to the sides. +

+ +

Properties

+ +

[property:Object parameters]

+

+ An object with a property for each of the constructor parameters. Any modification after instantiation does not change the geometry. +

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/geometries/ExtrudeGeometry.js src/geometries/ExtrudeGeometry.js] + + diff --git a/docs/api/zh/geometries/ExtrudeGeometry.html b/docs/api/zh/geometries/ExtrudeGeometry.html new file mode 100644 index 00000000000000..fca5e2f8c03f1b --- /dev/null +++ b/docs/api/zh/geometries/ExtrudeGeometry.html @@ -0,0 +1,106 @@ + + + + + + + + + + + [page:Geometry] → + +

[name]

+ +

Creates extruded geometry from a path shape.

+ + + + + +

Example

+ + + + var length = 12, width = 8; + + var shape = new THREE.Shape(); + shape.moveTo( 0,0 ); + shape.lineTo( 0, width ); + shape.lineTo( length, width ); + shape.lineTo( length, 0 ); + shape.lineTo( 0, 0 ); + + var extrudeSettings = { + steps: 2, + depth: 16, + bevelEnabled: true, + bevelThickness: 1, + bevelSize: 1, + bevelSegments: 1 + }; + + var geometry = new THREE.ExtrudeGeometry( shape, extrudeSettings ); + var material = new THREE.MeshBasicMaterial( { color: 0x00ff00 } ); + var mesh = new THREE.Mesh( geometry, material ) ; + scene.add( mesh ); + + + +

Constructor

+ + +

[name]([param:Array shapes], [param:Object options])

+

+ shapes — Shape or an array of shapes.
+ options — Object that can contain the following parameters. + +

    +
  • curveSegments — int. Number of points on the curves. Default is 12.
  • +
  • steps — int. Number of points used for subdividing segments along the depth of the extruded spline. Default is 1.
  • +
  • depth — float. Depth to extrude the shape. Default is 100.
  • +
  • bevelEnabled — bool. Apply beveling to the shape. Default is true.
  • +
  • bevelThickness — float. How deep into the original shape the bevel goes. Default is 6.
  • +
  • bevelSize — float. Distance from the shape outline that the bevel extends. Default is bevelThickness - 2.
  • +
  • bevelSegments — int. Number of bevel layers. Default is 3.
  • +
  • extrudePath — THREE.CurvePath. A 3D spline path along which the shape should be extruded.
  • +
  • UVGenerator — Object. object that provides UV generator functions
  • +
+ +

+

+ This object extrudes a 2D shape to a 3D geometry. +

+ +

+ When creating a Mesh with this geometry, if you'd like to have a separate material used for its face + and its extruded sides, you can use an array of materials. The first material will be + applied to the face; the second material will be applied to the sides. +

+ +

Properties

+ +

[property:Object parameters]

+

+ An object with a property for each of the constructor parameters. Any modification after instantiation does not change the geometry. +

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/geometries/IcosahedronBufferGeometry.html b/docs/api/zh/geometries/IcosahedronBufferGeometry.html new file mode 100644 index 00000000000000..91aedc3347ee60 --- /dev/null +++ b/docs/api/zh/geometries/IcosahedronBufferGeometry.html @@ -0,0 +1,53 @@ + + + + + + + + + + + [page:PolyhedronBufferGeometry] → +

[name]

+ +

A class for generating an icosahedron geometry.

+ + + + + +

Constructor

+ +

[name]([param:Float radius], [param:Integer detail])

+

+ radius — Default is 1.
+ detail — Default is 0. Setting this to a value greater than 0 adds more vertices making it no longer an icosahedron. When detail is greater than 1, it's effectively a sphere. +

+ +

Properties

+ +

[property:Object parameters]

+

+ An object with a property for each of the constructor parameters. Any modification after instantiation does not change the geometry. +

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/geometries/IcosahedronGeometry.js src/geometries/IcosahedronGeometry.js] + + diff --git a/docs/api/zh/geometries/IcosahedronGeometry.html b/docs/api/zh/geometries/IcosahedronGeometry.html new file mode 100644 index 00000000000000..e19c05d676dd4e --- /dev/null +++ b/docs/api/zh/geometries/IcosahedronGeometry.html @@ -0,0 +1,54 @@ + + + + + + + + + + + [page:Geometry] → + +

[name]

+ +

A class for generating an icosahedron geometry.

+ + + + + +

Constructor

+ +

[name]([param:Float radius], [param:Integer detail])

+

+ radius — Default is 1.
+ detail — Default is 0. Setting this to a value greater than 0 adds more vertices making it no longer an icosahedron. When detail is greater than 1, it's effectively a sphere. +

+ +

Properties

+ +

[property:Object parameters]

+

+ An object with a property for each of the constructor parameters. Any modification after instantiation does not change the geometry. +

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/geometries/LatheBufferGeometry.html b/docs/api/zh/geometries/LatheBufferGeometry.html new file mode 100644 index 00000000000000..af6d2a48eea265 --- /dev/null +++ b/docs/api/zh/geometries/LatheBufferGeometry.html @@ -0,0 +1,72 @@ + + + + + + + + + + + [page:BufferGeometry] → + +

[name]

+ +

This is the [page:BufferGeometry] port of [page:LatheGeometry].

+ + + + + +

Example

+ + + var points = []; + for ( var i = 0; i < 10; i ++ ) { + points.push( new THREE.Vector2( Math.sin( i * 0.2 ) * 10 + 5, ( i - 5 ) * 2 ) ); + } + var geometry = new THREE.LatheBufferGeometry( points ); + var material = new THREE.MeshBasicMaterial( { color: 0xffff00 } ); + var lathe = new THREE.Mesh( geometry, material ); + scene.add( lathe ); + + +

Constructor

+ +

[name]([param:Array points], [param:Integer segments], [param:Float phiStart], [param:Float phiLength])

+

+ points — Array of Vector2s. The x-coordinate of each point must be greater than zero.
+ segments — the number of circumference segments to generate. Default is 12.
+ phiStart — the starting angle in radians. Default is 0.
+ phiLength — the radian (0 to 2PI) range of the lathed section 2PI is a closed lathe, less than 2PI is a portion. Default is 2PI. +

+

+ This creates a LatheBufferGeometry based on the parameters. +

+ +

Properties

+ +

[property:Object parameters]

+

+ An object with a property for each of the constructor parameters. Any modification after instantiation does not change the geometry. +

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/geometries/LatheGeometry.js src/geometries/LatheGeometry.js] + + diff --git a/docs/api/zh/geometries/LatheGeometry.html b/docs/api/zh/geometries/LatheGeometry.html new file mode 100644 index 00000000000000..04c5c726f30e8f --- /dev/null +++ b/docs/api/zh/geometries/LatheGeometry.html @@ -0,0 +1,72 @@ + + + + + + + + + + + [page:Geometry] → + +

[name]

+ +

Creates meshes with axial symmetry like vases. The lathe rotates around the Y axis.

+ + + + + +

Example

+ + + var points = []; + for ( var i = 0; i < 10; i ++ ) { + points.push( new THREE.Vector2( Math.sin( i * 0.2 ) * 10 + 5, ( i - 5 ) * 2 ) ); + } + var geometry = new THREE.LatheGeometry( points ); + var material = new THREE.MeshBasicMaterial( { color: 0xffff00 } ); + var lathe = new THREE.Mesh( geometry, material ); + scene.add( lathe ); + + +

Constructor

+ +

[name]([param:Array points], [param:Integer segments], [param:Float phiStart], [param:Float phiLength])

+

+ points — Array of Vector2s. The x-coordinate of each point must be greater than zero.
+ segments — the number of circumference segments to generate. Default is 12.
+ phiStart — the starting angle in radians. Default is 0.
+ phiLength — the radian (0 to 2PI) range of the lathed section 2PI is a closed lathe, less than 2PI is a portion. Default is 2PI. +

+

+ This creates a LatheGeometry based on the parameters. +

+ +

Properties

+ +

[property:Object parameters]

+

+ An object with a property for each of the constructor parameters. Any modification after instantiation does not change the geometry. +

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/geometries/OctahedronBufferGeometry.html b/docs/api/zh/geometries/OctahedronBufferGeometry.html new file mode 100644 index 00000000000000..d4f58934919cb0 --- /dev/null +++ b/docs/api/zh/geometries/OctahedronBufferGeometry.html @@ -0,0 +1,53 @@ + + + + + + + + + + + [page:PolyhedronBufferGeometry] → +

[name]

+ +

A class for generating an octahedron geometry.

+ + + + + +

Constructor

+ +

[name]([param:Float radius], [param:Integer detail])

+

+ radius — Radius of the octahedron. Default is 1.
+ detail — Default is 0. Setting this to a value greater than zero add vertices making it no longer an octahedron. +

+ +

Properties

+ +

[property:Object parameters]

+

+ An object with a property for each of the constructor parameters. Any modification after instantiation does not change the geometry. +

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/geometries/OctahedronGeometry.js src/geometries/OctahedronGeometry.js] + + diff --git a/docs/api/zh/geometries/OctahedronGeometry.html b/docs/api/zh/geometries/OctahedronGeometry.html new file mode 100644 index 00000000000000..78f1c0c03e3a5a --- /dev/null +++ b/docs/api/zh/geometries/OctahedronGeometry.html @@ -0,0 +1,54 @@ + + + + + + + + + + + [page:Geometry] → + +

[name]

+ +

A class for generating an octahedron geometry.

+ + + + + +

Constructor

+ +

[name]([param:Float radius], [param:Integer detail])

+

+ radius — Radius of the octahedron. Default is 1.
+ detail — Default is 0. Setting this to a value greater than zero add vertices making it no longer an octahedron. +

+ +

Properties

+ +

[property:Object parameters]

+

+ An object with a property for each of the constructor parameters. Any modification after instantiation does not change the geometry. +

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/geometries/ParametricBufferGeometry.html b/docs/api/zh/geometries/ParametricBufferGeometry.html new file mode 100644 index 00000000000000..fa7e678d1cc2d1 --- /dev/null +++ b/docs/api/zh/geometries/ParametricBufferGeometry.html @@ -0,0 +1,67 @@ + + + + + + + + + + + [page:BufferGeometry] → + +

[name]

+ +

Generate geometry representing a parametric surface.

+ + + + + +

Example

+ + + var geometry = new THREE.ParametricBufferGeometry( THREE.ParametricGeometries.klein, 25, 25 ); + var material = new THREE.MeshBasicMaterial( { color: 0x00ff00 } ); + var klein = new THREE.Mesh( geometry, material ); + scene.add( klein ); + + + +

Constructor

+ + +

[name]([param:Function func], [param:Integer slices], [param:Integer stacks])

+

+ func — A function that takes in a [page:Float u] and [page:Float v] value each between 0 and 1 and modifies a third [page:Vector3] argument
+ slices — The count of slices to use for the parametric function
+ stacks — The count of stacks to use for the parametric function +

+ +

Properties

+ +

[property:Object parameters]

+

+ An object with a property for each of the constructor parameters. Any modification after instantiation does not change the geometry. +

+ + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/geometries/ParametricGeometry.js src/geometries/ParametricGeometry.js] + + diff --git a/docs/api/zh/geometries/ParametricGeometry.html b/docs/api/zh/geometries/ParametricGeometry.html new file mode 100644 index 00000000000000..d54758331a8c85 --- /dev/null +++ b/docs/api/zh/geometries/ParametricGeometry.html @@ -0,0 +1,68 @@ + + + + + + + + + + + [page:Geometry] → + +

[name]

+ +

Generate geometry representing a parametric surface.

+ + + + + +

Example

+ + + var geometry = new THREE.ParametricGeometry( THREE.ParametricGeometries.klein, 25, 25 ); + var material = new THREE.MeshBasicMaterial( { color: 0x00ff00 } ); + var klein = new THREE.Mesh( geometry, material ); + scene.add( klein ); + + + +

Constructor

+ + +

[name]([param:Function func], [param:Integer slices], [param:Integer stacks])

+

+ func — A function that takes in a [page:Float u] and [page:Float v] value each between 0 and 1 and modifies a third [page:Vector3] argument
+ slices — The count of slices to use for the parametric function
+ stacks — The count of stacks to use for the parametric function +

+ + +

Properties

+ +

[property:Object parameters]

+

+ An object with a property for each of the constructor parameters. Any modification after instantiation does not change the geometry. +

+ + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/geometries/PlaneBufferGeometry.html b/docs/api/zh/geometries/PlaneBufferGeometry.html new file mode 100644 index 00000000000000..6323e5a86ce1ad --- /dev/null +++ b/docs/api/zh/geometries/PlaneBufferGeometry.html @@ -0,0 +1,64 @@ + + + + + + + + + + + [page:BufferGeometry] → + +

[name]

+ +

This is the [page:BufferGeometry] port of [page:PlaneGeometry].

+ + + + + +

Example

+ + var geometry = new THREE.PlaneBufferGeometry( 5, 20, 32 ); + var material = new THREE.MeshBasicMaterial( {color: 0xffff00, side: THREE.DoubleSide} ); + var plane = new THREE.Mesh( geometry, material ); + scene.add( plane ); + + +

Constructor

+ +

[name]([param:Float width], [param:Float height], [param:Integer widthSegments], [param:Integer heightSegments])

+

+ width — Width along the X axis. Default is 1.
+ height — Height along the Y axis. Default is 1.
+ widthSegments — Optional. Default is 1.
+ heightSegments — Optional. Default is 1. +

+ +

Properties

+ +

.parameters

+

+ An object with a property for each of the constructor parameters. Any modification after instantiation does not change the geometry. +

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/geometries/PlaneGeometry.js src/geometries/PlaneGeometry.js] + + diff --git a/docs/api/zh/geometries/PlaneGeometry.html b/docs/api/zh/geometries/PlaneGeometry.html new file mode 100644 index 00000000000000..b7889472804e59 --- /dev/null +++ b/docs/api/zh/geometries/PlaneGeometry.html @@ -0,0 +1,64 @@ + + + + + + + + + + + [page:Geometry] → + +

[name]

+ +

A class for generating plane geometries

+ + + + + +

Example

+ + var geometry = new THREE.PlaneGeometry( 5, 20, 32 ); + var material = new THREE.MeshBasicMaterial( {color: 0xffff00, side: THREE.DoubleSide} ); + var plane = new THREE.Mesh( geometry, material ); + scene.add( plane ); + + +

Constructor

+ +

[name]([param:Float width], [param:Float height], [param:Integer widthSegments], [param:Integer heightSegments])

+

+ width — Width along the X axis. Default is 1.
+ height — Height along the Y axis. Default is 1.
+ widthSegments — Optional. Default is 1.
+ heightSegments — Optional. Default is 1. +

+ +

Properties

+ +

.parameters

+

+ An object with a property for each of the constructor parameters. Any modification after instantiation does not change the geometry. +

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/geometries/PolyhedronBufferGeometry.html b/docs/api/zh/geometries/PolyhedronBufferGeometry.html new file mode 100644 index 00000000000000..018353d897c738 --- /dev/null +++ b/docs/api/zh/geometries/PolyhedronBufferGeometry.html @@ -0,0 +1,64 @@ + + + + + + + + + + + [page:BufferGeometry] → + +

[name]

+ +

+ A polyhedron is a solid in three dimensions with flat faces. This class will take an array of vertices, + project them onto a sphere, and then divide them up to the desired level of detail. This class is used + by [page:DodecahedronBufferGeometry], [page:IcosahedronBufferGeometry], [page:OctahedronBufferGeometry], + and [page:TetrahedronBufferGeometry] to generate their respective geometries. +

+ +

Example

+ +var verticesOfCube = [ + -1,-1,-1, 1,-1,-1, 1, 1,-1, -1, 1,-1, + -1,-1, 1, 1,-1, 1, 1, 1, 1, -1, 1, 1, +]; + +var indicesOfFaces = [ + 2,1,0, 0,3,2, + 0,4,7, 7,3,0, + 0,1,5, 5,4,0, + 1,2,6, 6,5,1, + 2,3,7, 7,6,2, + 4,5,6, 6,7,4 +]; + +var geometry = new THREE.PolyhedronBufferGeometry( verticesOfCube, indicesOfFaces, 6, 2 ); + + +

Constructor

+ + +

[name]([param:Array vertices], [param:Array indices], [param:Float radius], [param:Integer detail])

+

+ vertices — [page:Array] of points of the form [1,1,1, -1,-1,-1, ... ]
+ indices — [page:Array] of indices that make up the faces of the form [0,1,2, 2,3,0, ... ]
+ radius — [page:Float] - The radius of the final shape
+ detail — [page:Integer] - How many levels to subdivide the geometry. The more detail, the smoother the shape. +

+ +

Properties

+ +

[property:Object parameters]

+

+ An object with a property for each of the constructor parameters. Any modification after instantiation does not change the geometry. +

+ + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/geometries/PolyhedronGeometry.js src/geometries/PolyhedronGeometry.js] + + diff --git a/docs/api/zh/geometries/PolyhedronGeometry.html b/docs/api/zh/geometries/PolyhedronGeometry.html new file mode 100644 index 00000000000000..50e3f121504ff5 --- /dev/null +++ b/docs/api/zh/geometries/PolyhedronGeometry.html @@ -0,0 +1,62 @@ + + + + + + + + + + + [page:Geometry] → + +

[name]

+ +

+ A polyhedron is a solid in three dimensions with flat faces. This class will take an array of vertices, + project them onto a sphere, and then divide them up to the desired level of detail. +

+ +

Example

+ +var verticesOfCube = [ + -1,-1,-1, 1,-1,-1, 1, 1,-1, -1, 1,-1, + -1,-1, 1, 1,-1, 1, 1, 1, 1, -1, 1, 1, +]; + +var indicesOfFaces = [ + 2,1,0, 0,3,2, + 0,4,7, 7,3,0, + 0,1,5, 5,4,0, + 1,2,6, 6,5,1, + 2,3,7, 7,6,2, + 4,5,6, 6,7,4 +]; + +var geometry = new THREE.PolyhedronGeometry( verticesOfCube, indicesOfFaces, 6, 2 ); + + +

Constructor

+ + +

[name]([param:Array vertices], [param:Array indices], [param:Float radius], [param:Integer detail])

+

+ vertices — [page:Array] of points of the form [1,1,1, -1,-1,-1, ... ]
+ indices — [page:Array] of indices that make up the faces of the form [0,1,2, 2,3,0, ... ]
+ radius — [page:Float] - The radius of the final shape
+ detail — [page:Integer] - How many levels to subdivide the geometry. The more detail, the smoother the shape. +

+ +

Properties

+ +

[property:Object parameters]

+

+ An object with a property for each of the constructor parameters. Any modification after instantiation does not change the geometry. +

+ + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/geometries/RingBufferGeometry.html b/docs/api/zh/geometries/RingBufferGeometry.html new file mode 100644 index 00000000000000..7bc2ffa50c1d5c --- /dev/null +++ b/docs/api/zh/geometries/RingBufferGeometry.html @@ -0,0 +1,68 @@ + + + + + + + + + + + [page:BufferGeometry] → + +

[name]

+ +

This is the [page:BufferGeometry] port of [page:RingGeometry].

+ + + + + +

Example

+ + var geometry = new THREE.RingBufferGeometry( 1, 5, 32 ); + var material = new THREE.MeshBasicMaterial( { color: 0xffff00, side: THREE.DoubleSide } ); + var mesh = new THREE.Mesh( geometry, material ); + scene.add( mesh ); + + +

Constructor

+ +

[name]([param:Float innerRadius], [param:Float outerRadius], [param:Integer thetaSegments], [param:Integer phiSegments], [param:Float thetaStart], [param:Float thetaLength])

+

+ innerRadius — Default is 0.5.
+ outerRadius — Default is 1.
+ thetaSegments — Number of segments. A higher number means the ring will be more round. Minimum is 3. Default is 8.
+ phiSegments — Minimum is 1. Default is 1.
+ thetaStart — Starting angle. Default is 0.
+ thetaLength — Central angle. Default is Math.PI * 2. +

+ + +

Properties

+ +

[property:Object parameters]

+

+ An object with a property for each of the constructor parameters. Any modification after instantiation does not change the geometry. +

+ + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/geometries/RingGeometry.js src/geometries/RingGeometry.js] + + diff --git a/docs/api/zh/geometries/RingGeometry.html b/docs/api/zh/geometries/RingGeometry.html new file mode 100644 index 00000000000000..010f6b0c6487e9 --- /dev/null +++ b/docs/api/zh/geometries/RingGeometry.html @@ -0,0 +1,67 @@ + + + + + + + + + + + [page:Geometry] → + +

[name]

+ +

A class for generating a two-dimensional ring geometry.

+ + + + + +

Example

+ + var geometry = new THREE.RingGeometry( 1, 5, 32 ); + var material = new THREE.MeshBasicMaterial( { color: 0xffff00, side: THREE.DoubleSide } ); + var mesh = new THREE.Mesh( geometry, material ); + scene.add( mesh ); + + +

Constructor

+ +

[name]([param:Float innerRadius], [param:Float outerRadius], [param:Integer thetaSegments], [param:Integer phiSegments], [param:Float thetaStart], [param:Float thetaLength])

+

+ innerRadius — Default is 0.5.
+ outerRadius — Default is 1.
+ thetaSegments — Number of segments. A higher number means the ring will be more round. Minimum is 3. Default is 8.
+ phiSegments — Minimum is 1. Default is 8.
+ thetaStart — Starting angle. Default is 0.
+ thetaLength — Central angle. Default is Math.PI * 2. +

+ +

Properties

+ +

[property:Object parameters]

+

+ An object with a property for each of the constructor parameters. Any modification after instantiation does not change the geometry. +

+ + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/geometries/ShapeBufferGeometry.html b/docs/api/zh/geometries/ShapeBufferGeometry.html new file mode 100644 index 00000000000000..b391d71e88489f --- /dev/null +++ b/docs/api/zh/geometries/ShapeBufferGeometry.html @@ -0,0 +1,78 @@ + + + + + + + + + + + [page:BufferGeometry] → + +

[name]

+ +

Creates an one-sided polygonal geometry from one or more path shapes.

+ + + + + + +

Example

+ + + + var x = 0, y = 0; + + var heartShape = new THREE.Shape(); + + heartShape.moveTo( x + 5, y + 5 ); + heartShape.bezierCurveTo( x + 5, y + 5, x + 4, y, x, y ); + heartShape.bezierCurveTo( x - 6, y, x - 6, y + 7,x - 6, y + 7 ); + heartShape.bezierCurveTo( x - 6, y + 11, x - 3, y + 15.4, x + 5, y + 19 ); + heartShape.bezierCurveTo( x + 12, y + 15.4, x + 16, y + 11, x + 16, y + 7 ); + heartShape.bezierCurveTo( x + 16, y + 7, x + 16, y, x + 10, y ); + heartShape.bezierCurveTo( x + 7, y, x + 5, y + 5, x + 5, y + 5 ); + + var geometry = new THREE.ShapeBufferGeometry( heartShape ); + var material = new THREE.MeshBasicMaterial( { color: 0x00ff00 } ); + var mesh = new THREE.Mesh( geometry, material ) ; + scene.add( mesh ); + + +

Constructor

+ + +

[name]([param:Array shapes], [param:Integer curveSegments])

+

+ shapes — [page:Array] of shapes or a single [page:Shape shape].
+ curveSegments - [page:Integer] - Number of segments per shape. Default is 12. +

+ +

Properties

+ +

[property:Object parameters]

+

+ An object with a property for each of the constructor parameters. Any modification after instantiation does not change the geometry. +

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/geometries/ShapeGeometry.js src/geometries/ShapeGeometry.js] + + diff --git a/docs/api/zh/geometries/ShapeGeometry.html b/docs/api/zh/geometries/ShapeGeometry.html new file mode 100644 index 00000000000000..b6a4dc14df7737 --- /dev/null +++ b/docs/api/zh/geometries/ShapeGeometry.html @@ -0,0 +1,79 @@ + + + + + + + + + + + [page:Geometry] → + +

[name]

+ +

Creates an one-sided polygonal geometry from one or more path shapes.

+ + + + + + +

Example

+ + + + var x = 0, y = 0; + + var heartShape = new THREE.Shape(); + + heartShape.moveTo( x + 5, y + 5 ); + heartShape.bezierCurveTo( x + 5, y + 5, x + 4, y, x, y ); + heartShape.bezierCurveTo( x - 6, y, x - 6, y + 7,x - 6, y + 7 ); + heartShape.bezierCurveTo( x - 6, y + 11, x - 3, y + 15.4, x + 5, y + 19 ); + heartShape.bezierCurveTo( x + 12, y + 15.4, x + 16, y + 11, x + 16, y + 7 ); + heartShape.bezierCurveTo( x + 16, y + 7, x + 16, y, x + 10, y ); + heartShape.bezierCurveTo( x + 7, y, x + 5, y + 5, x + 5, y + 5 ); + + var geometry = new THREE.ShapeGeometry( heartShape ); + var material = new THREE.MeshBasicMaterial( { color: 0x00ff00 } ); + var mesh = new THREE.Mesh( geometry, material ) ; + scene.add( mesh ); + + +

Constructor

+ + +

[name]([param:Array shapes], [param:Integer curveSegments])

+

+ shapes — [page:Array] of shapes or a single [page:Shape shape].
+ curveSegments - [page:Integer] - Number of segments per shape. Default is 12. +

+ +

Properties

+ +

[property:Object parameters]

+

+ An object with a property for each of the constructor parameters. Any modification after instantiation does not change the geometry. +

+ + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/geometries/SphereBufferGeometry.html b/docs/api/zh/geometries/SphereBufferGeometry.html new file mode 100644 index 00000000000000..48196f0ac690d4 --- /dev/null +++ b/docs/api/zh/geometries/SphereBufferGeometry.html @@ -0,0 +1,72 @@ + + + + + + + + + + + [page:BufferGeometry] → + +

[name]

+ +

This is the [page:BufferGeometry] port of [page:SphereGeometry].

+ + + + + +

Example

+ + var geometry = new THREE.SphereBufferGeometry( 5, 32, 32 ); + var material = new THREE.MeshBasicMaterial( {color: 0xffff00} ); + var sphere = new THREE.Mesh( geometry, material ); + scene.add( sphere ); + + +

Constructor

+ +

[name]([param:Float radius], [param:Integer widthSegments], [param:Integer heightSegments], [param:Float phiStart], [param:Float phiLength], [param:Float thetaStart], [param:Float thetaLength])

+ +

+ radius — sphere radius. Default is 1.
+ widthSegments — number of horizontal segments. Minimum value is 3, and the default is 8.
+ heightSegments — number of vertical segments. Minimum value is 2, and the default is 6.
+ phiStart — specify horizontal starting angle. Default is 0.
+ phiLength — specify horizontal sweep angle size. Default is Math.PI * 2.
+ thetaStart — specify vertical starting angle. Default is 0.
+ thetaLength — specify vertical sweep angle size. Default is Math.PI.
+

+ +

+ The geometry is created by sweeping and calculating vertexes around the Y axis (horizontal sweep) and the Z axis (vertical sweep). Thus, incomplete spheres (akin to 'sphere slices') can be created through the use of different values of phiStart, phiLength, thetaStart and thetaLength, in order to define the points in which we start (or end) calculating those vertices. +

+ +

Properties

+ +

.parameters

+

+ An object with a property for each of the constructor parameters. Any modification after instantiation does not change the geometry. +

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/geometries/SphereGeometry.js src/geometries/SphereGeometry.js] + + diff --git a/docs/api/zh/geometries/SphereGeometry.html b/docs/api/zh/geometries/SphereGeometry.html new file mode 100644 index 00000000000000..a13ff1efec820f --- /dev/null +++ b/docs/api/zh/geometries/SphereGeometry.html @@ -0,0 +1,72 @@ + + + + + + + + + + + [page:Geometry] → + +

[name]

+ +

A class for generating sphere geometries

+ + + + + +

Example

+ + var geometry = new THREE.SphereGeometry( 5, 32, 32 ); + var material = new THREE.MeshBasicMaterial( {color: 0xffff00} ); + var sphere = new THREE.Mesh( geometry, material ); + scene.add( sphere ); + + +

Constructor

+ +

[name]([param:Float radius], [param:Integer widthSegments], [param:Integer heightSegments], [param:Float phiStart], [param:Float phiLength], [param:Float thetaStart], [param:Float thetaLength])

+ +

+ radius — sphere radius. Default is 1.
+ widthSegments — number of horizontal segments. Minimum value is 3, and the default is 8.
+ heightSegments — number of vertical segments. Minimum value is 2, and the default is 6.
+ phiStart — specify horizontal starting angle. Default is 0.
+ phiLength — specify horizontal sweep angle size. Default is Math.PI * 2.
+ thetaStart — specify vertical starting angle. Default is 0.
+ thetaLength — specify vertical sweep angle size. Default is Math.PI.
+

+ +

+ The geometry is created by sweeping and calculating vertexes around the Y axis (horizontal sweep) and the Z axis (vertical sweep). Thus, incomplete spheres (akin to 'sphere slices') can be created through the use of different values of phiStart, phiLength, thetaStart and thetaLength, in order to define the points in which we start (or end) calculating those vertices. +

+ +

Properties

+ +

.parameters

+

+ An object with a property for each of the constructor parameters. Any modification after instantiation does not change the geometry. +

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/geometries/TetrahedronBufferGeometry.html b/docs/api/zh/geometries/TetrahedronBufferGeometry.html new file mode 100644 index 00000000000000..c114db6ab461dd --- /dev/null +++ b/docs/api/zh/geometries/TetrahedronBufferGeometry.html @@ -0,0 +1,56 @@ + + + + + + + + + + + [page:PolyhedronBufferGeometry] → + +

[name]

+ +

A class for generating a tetrahedron geometries.

+ + + + + +

Constructor

+ +

[name]([param:Float radius], [param:Integer detail])

+

+ radius — Radius of the tetrahedron. Default is 1.
+ detail — Default is 0. Setting this to a value greater than 0 adds vertices making it no longer a tetrahedron. +

+ +

Properties

+ +

[property:Object parameters]

+

+ An object with a property for each of the constructor parameters. Any modification after instantiation does not change the geometry. +

+ + + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/geometries/TetrahedronGeometry.js src/geometries/TetrahedronGeometry.js] + + diff --git a/docs/api/zh/geometries/TetrahedronGeometry.html b/docs/api/zh/geometries/TetrahedronGeometry.html new file mode 100644 index 00000000000000..c69734b314f393 --- /dev/null +++ b/docs/api/zh/geometries/TetrahedronGeometry.html @@ -0,0 +1,54 @@ + + + + + + + + + + + [page:Geometry] → + +

[name]

+ +

A class for generating a tetrahedron geometries.

+ + + + + +

Constructor

+ +

[name]([param:Float radius], [param:Integer detail])

+

+ radius — Radius of the tetrahedron. Default is 1.
+ detail — Default is 0. Setting this to a value greater than 0 adds vertices making it no longer a tetrahedron. +

+ +

Properties

+ +

[property:Object parameters]

+

+ An object with a property for each of the constructor parameters. Any modification after instantiation does not change the geometry. +

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/geometries/TextBufferGeometry.html b/docs/api/zh/geometries/TextBufferGeometry.html new file mode 100644 index 00000000000000..4dfbb373d53bc8 --- /dev/null +++ b/docs/api/zh/geometries/TextBufferGeometry.html @@ -0,0 +1,167 @@ + + + + + + + + + + + [page:ExtrudeBufferGeometry] → + +

[name]

+ +

+ A class for generating text as a single geometry. It is constructed by providing a string of text, and a hash of + parameters consisting of a loaded [page:Font] and settings for the geometry's parent [page:ExtrudeBufferGeometry]. + See the [page:Font], [page:FontLoader] and [page:Creating_Text] pages for additional details. +

+ + + + + +

Examples

+ +

+ [example:webgl_geometry_text geometry / text ] +

+ + + var loader = new THREE.FontLoader(); + + loader.load( 'fonts/helvetiker_regular.typeface.json', function ( font ) { + + var geometry = new THREE.TextBufferGeometry( 'Hello three.js!', { + font: font, + size: 80, + height: 5, + curveSegments: 12, + bevelEnabled: true, + bevelThickness: 10, + bevelSize: 8, + bevelSegments: 5 + } ); + } ); + + +

Constructor

+ +

[name]([param:String text], [param:Object parameters])

+

+ text — The text that needs to be shown.
+ parameters — Object that can contains the following parameters. +

    +
  • font — an instance of THREE.Font.
  • +
  • size — Float. Size of the text. Default is 100.
  • +
  • height — Float. Thickness to extrude text. Default is 50.
  • +
  • curveSegments — Integer. Number of points on the curves. Default is 12.
  • +
  • bevelEnabled — Boolean. Turn on bevel. Default is False.
  • +
  • bevelThickness — Float. How deep into text bevel goes. Default is 10.
  • +
  • bevelSize — Float. How far from text outline is bevel. Default is 8.
  • +
  • bevelSegments — Integer. Number of bevel segments. Default is 3.
  • +
+

+ +

Available Fonts

+ +

+ TextGeometry uses typeface.json generated fonts. + Some existing fonts can be found located in /examples/fonts and must be included in the page. +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FontWeightStyleFile Path
helvetikernormalnormal/examples/fonts/helvetiker_regular.typeface.json
helvetikerboldnormal/examples/fonts/helvetiker_bold.typeface.json
optimernormalnormal/examples/fonts/optimer_regular.typeface.json
optimerboldnormal/examples/fonts/optimer_bold.typeface.json
gentilisnormalnormal/examples/fonts/gentilis_regular.typeface.json
gentilisboldnormal/examples/fonts/gentilis_bold.typeface.json
droid sansnormalnormal/examples/fonts/droid/droid_sans_regular.typeface.json
droid sansboldnormal/examples/fonts/droid/droid_sans_bold.typeface.json
droid serifnormalnormal/examples/fonts/droid/droid_serif_regular.typeface.json
droid serifboldnormal/examples/fonts/droid/droid_serif_bold.typeface.json
+ +

Properties

+ +

[property:Object parameters]

+

+ An object with a property for each of the constructor parameters. Any modification after instantiation does not change the geometry. +

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/geometries/TextGeometry.js src/geometries/TextGeometry.js] + + diff --git a/docs/api/zh/geometries/TextGeometry.html b/docs/api/zh/geometries/TextGeometry.html new file mode 100644 index 00000000000000..02395f94ff7abf --- /dev/null +++ b/docs/api/zh/geometries/TextGeometry.html @@ -0,0 +1,167 @@ + + + + + + + + + + + [page:ExtrudeGeometry] → + +

[name]

+ +

+ A class for generating text as a single geometry. It is constructed by providing a string of text, and a hash of + parameters consisting of a loaded [page:Font] and settings for the geometry's parent [page:ExtrudeGeometry]. + See the [page:Font], [page:FontLoader] and [page:Creating_Text] pages for additional details. +

+ + + + + +

Examples

+ +

+ [example:webgl_geometry_text geometry / text ] +

+ + + var loader = new THREE.FontLoader(); + + loader.load( 'fonts/helvetiker_regular.typeface.json', function ( font ) { + + var geometry = new THREE.TextGeometry( 'Hello three.js!', { + font: font, + size: 80, + height: 5, + curveSegments: 12, + bevelEnabled: true, + bevelThickness: 10, + bevelSize: 8, + bevelSegments: 5 + } ); + } ); + + +

Constructor

+ +

[name]([param:String text], [param:Object parameters])

+

+ text — The text that needs to be shown.
+ parameters — Object that can contains the following parameters. +

    +
  • font — an instance of THREE.Font.
  • +
  • size — Float. Size of the text. Default is 100.
  • +
  • height — Float. Thickness to extrude text. Default is 50.
  • +
  • curveSegments — Integer. Number of points on the curves. Default is 12.
  • +
  • bevelEnabled — Boolean. Turn on bevel. Default is False.
  • +
  • bevelThickness — Float. How deep into text bevel goes. Default is 10.
  • +
  • bevelSize — Float. How far from text outline is bevel. Default is 8.
  • +
  • bevelSegments — Integer. Number of bevel segments. Default is 3.
  • +
+

+ +

Available Fonts

+ +

+ TextGeometry uses typeface.json generated fonts. + Some existing fonts can be found located in /examples/fonts and must be included in the page. +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FontWeightStyleFile Path
helvetikernormalnormal/examples/fonts/helvetiker_regular.typeface.json
helvetikerboldnormal/examples/fonts/helvetiker_bold.typeface.json
optimernormalnormal/examples/fonts/optimer_regular.typeface.json
optimerboldnormal/examples/fonts/optimer_bold.typeface.json
gentilisnormalnormal/examples/fonts/gentilis_regular.typeface.json
gentilisboldnormal/examples/fonts/gentilis_bold.typeface.json
droid sansnormalnormal/examples/fonts/droid/droid_sans_regular.typeface.json
droid sansboldnormal/examples/fonts/droid/droid_sans_bold.typeface.json
droid serifnormalnormal/examples/fonts/droid/droid_serif_regular.typeface.json
droid serifboldnormal/examples/fonts/droid/droid_serif_bold.typeface.json
+ +

Properties

+ +

[property:Object parameters]

+

+ An object with a property for each of the constructor parameters. Any modification after instantiation does not change the geometry. +

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/geometries/TorusBufferGeometry.html b/docs/api/zh/geometries/TorusBufferGeometry.html new file mode 100644 index 00000000000000..6fb5a9d94b629d --- /dev/null +++ b/docs/api/zh/geometries/TorusBufferGeometry.html @@ -0,0 +1,65 @@ + + + + + + + + + + + [page:BufferGeometry] → + +

[name]

+ +

This is the [page:BufferGeometry] port of [page:TorusGeometry].

+ + + + + +

Example

+ + var geometry = new THREE.TorusBufferGeometry( 10, 3, 16, 100 ); + var material = new THREE.MeshBasicMaterial( { color: 0xffff00 } ); + var torus = new THREE.Mesh( geometry, material ); + scene.add( torus ); + + +

Constructor

+ +

[name]([param:Float radius], [param:Float tube], [param:Integer radialSegments], [param:Integer tubularSegments], [param:Float arc])

+

+ radius - Radius of the torus, from the center of the torus to the center of the tube. Default is 1.
+ tube — Radius of the tube. Default is 0.4.
+ radialSegments — Default is 8
+ tubularSegments — Default is 6.
+ arc — Central angle. Default is Math.PI * 2. +

+ +

Properties

+ +

.parameters

+

+ An object with a property for each of the constructor parameters. Any modification after instantiation does not change the geometry. +

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/geometries/TorusGeometry.js src/geometries/TorusGeometry.js] + + diff --git a/docs/api/zh/geometries/TorusGeometry.html b/docs/api/zh/geometries/TorusGeometry.html new file mode 100644 index 00000000000000..5e2d5bc5922208 --- /dev/null +++ b/docs/api/zh/geometries/TorusGeometry.html @@ -0,0 +1,65 @@ + + + + + + + + + + + [page:Geometry] → + +

[name]

+ +

A class for generating torus geometries

+ + + + + +

Example

+ + var geometry = new THREE.TorusGeometry( 10, 3, 16, 100 ); + var material = new THREE.MeshBasicMaterial( { color: 0xffff00 } ); + var torus = new THREE.Mesh( geometry, material ); + scene.add( torus ); + + +

Constructor

+ +

[name]([param:Float radius], [param:Float tube], [param:Integer radialSegments], [param:Integer tubularSegments], [param:Float arc])

+

+ radius - Radius of the torus, from the center of the torus to the center of the tube. Default is 1.
+ tube — Radius of the tube. Default is 0.4.
+ radialSegments — Default is 8
+ tubularSegments — Default is 6.
+ arc — Central angle. Default is Math.PI * 2. +

+ +

Properties

+ +

.parameters

+

+ An object with a property for each of the constructor parameters. Any modification after instantiation does not change the geometry. +

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/geometries/TorusKnotBufferGeometry.html b/docs/api/zh/geometries/TorusKnotBufferGeometry.html new file mode 100644 index 00000000000000..9fbadb7964f60e --- /dev/null +++ b/docs/api/zh/geometries/TorusKnotBufferGeometry.html @@ -0,0 +1,68 @@ + + + + + + + + + + + [page:BufferGeometry] → + +

[name]

+ +

This is the [page:BufferGeometry] port of [page:TorusKnotGeometry].

+ + + + + +

Example

+ + var geometry = new THREE.TorusKnotBufferGeometry( 10, 3, 100, 16 ); + var material = new THREE.MeshBasicMaterial( { color: 0xffff00 } ); + var torusKnot = new THREE.Mesh( geometry, material ); + scene.add( torusKnot ); + + +

Constructor

+ +

[name]([param:Float radius], [param:Float tube], [param:Integer tubularSegments], [param:Integer radialSegments], [param:Integer p], [param:Integer q])

+

+

    +
  • radius - Radius of the torus. Default is 1.
  • +
  • tube — Radius of the tube. Default is 0.4.
  • +
  • tubularSegments — Default is 64.
  • +
  • radialSegments — Default is 8.
  • +
  • p — This value determines, how many times the geometry winds around its axis of rotational symmetry. Default is 2.
  • +
  • q — This value determines, how many times the geometry winds around a circle in the interior of the torus. Default is 3.
  • +
+

+ +

Properties

+ +

.parameters

+

+ An object with a property for each of the constructor parameters. Any modification after instantiation does not change the geometry. +

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/geometries/TorusKnotGeometry.js src/geometries/TorusKnotGeometry.js] + + diff --git a/docs/api/zh/geometries/TorusKnotGeometry.html b/docs/api/zh/geometries/TorusKnotGeometry.html new file mode 100644 index 00000000000000..97f23b458bf910 --- /dev/null +++ b/docs/api/zh/geometries/TorusKnotGeometry.html @@ -0,0 +1,68 @@ + + + + + + + + + + + [page:Geometry] → + +

[name]

+ +

Creates a torus knot, the particular shape of which is defined by a pair of coprime integers, p and q. If p and q are not coprime, the result will be a torus link.

+ + + + + +

Example

+ + var geometry = new THREE.TorusKnotGeometry( 10, 3, 100, 16 ); + var material = new THREE.MeshBasicMaterial( { color: 0xffff00 } ); + var torusKnot = new THREE.Mesh( geometry, material ); + scene.add( torusKnot ); + + +

Constructor

+ +

[name]([param:Float radius], [param:Float tube], [param:Integer tubularSegments], [param:Integer radialSegments], [param:Integer p], [param:Integer q])

+

+

    +
  • radius - Radius of the torus. Default is 1.
  • +
  • tube — Radius of the tube. Default is 0.4.
  • +
  • tubularSegments — Default is 64.
  • +
  • radialSegments — Default is 8.
  • +
  • p — This value determines, how many times the geometry winds around its axis of rotational symmetry. Default is 2.
  • +
  • q — This value determines, how many times the geometry winds around a circle in the interior of the torus. Default is 3.
  • +
+

+ +

Properties

+ +

.parameters

+

+ An object with a property for each of the constructor parameters. Any modification after instantiation does not change the geometry. +

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/geometries/TubeBufferGeometry.html b/docs/api/zh/geometries/TubeBufferGeometry.html new file mode 100644 index 00000000000000..7f5e1267be5cc0 --- /dev/null +++ b/docs/api/zh/geometries/TubeBufferGeometry.html @@ -0,0 +1,105 @@ + + + + + + + + + + + [page:BufferGeometry] → + +

[name]

+ +

Creates a tube that extrudes along a 3d curve.

+ + + + + +

Example

+ + + function CustomSinCurve( scale ) { + + THREE.Curve.call( this ); + + this.scale = ( scale === undefined ) ? 1 : scale; + + } + + CustomSinCurve.prototype = Object.create( THREE.Curve.prototype ); + CustomSinCurve.prototype.constructor = CustomSinCurve; + + CustomSinCurve.prototype.getPoint = function ( t ) { + + var tx = t * 3 - 1.5; + var ty = Math.sin( 2 * Math.PI * t ); + var tz = 0; + + return new THREE.Vector3( tx, ty, tz ).multiplyScalar( this.scale ); + + }; + + var path = new CustomSinCurve( 10 ); + var geometry = new THREE.TubeBufferGeometry( path, 20, 2, 8, false ); + var material = new THREE.MeshBasicMaterial( { color: 0x00ff00 } ); + var mesh = new THREE.Mesh( geometry, material ); + scene.add( mesh ); + + +

Constructor

+ + +

[name]([param:Curve path], [param:Integer tubularSegments], [param:Float radius], [param:Integer radialSegments], [param:Boolean closed])

+

+ path — [page:Curve] - A path that inherits from the [page:Curve] base class
+ tubularSegments — [page:Integer] - The number of segments that make up the tube, default is 64
+ radius — [page:Float] - The radius of the tube, default is 1
+ radialSegments — [page:Integer] - The number of segments that make up the cross-section, default is 8
+ closed — [page:Boolean] Is the tube open or closed, default is false
+

+ + +

Properties

+ +

[property:Object parameters]

+

+ An object with a property for each of the constructor parameters. Any modification after instantiation does not change the geometry. +

+ +

[property:Array tangents]

+

+ An array of [page:Vector3] tangents +

+ +

[property:Array normals]

+

+ An array of [page:Vector3] normals +

+ +

[property:Array binormals]

+

+ An array of [page:Vector3] binormals +

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/geometries/TubeGeometry.js src/geometries/TubeGeometry.js] + + diff --git a/docs/api/zh/geometries/TubeGeometry.html b/docs/api/zh/geometries/TubeGeometry.html new file mode 100644 index 00000000000000..487c5dcb3f151f --- /dev/null +++ b/docs/api/zh/geometries/TubeGeometry.html @@ -0,0 +1,105 @@ + + + + + + + + + + + [page:Geometry] → + +

[name]

+ +

Creates a tube that extrudes along a 3d curve.

+ + + + + +

Example

+ + + function CustomSinCurve( scale ) { + + THREE.Curve.call( this ); + + this.scale = ( scale === undefined ) ? 1 : scale; + + } + + CustomSinCurve.prototype = Object.create( THREE.Curve.prototype ); + CustomSinCurve.prototype.constructor = CustomSinCurve; + + CustomSinCurve.prototype.getPoint = function ( t ) { + + var tx = t * 3 - 1.5; + var ty = Math.sin( 2 * Math.PI * t ); + var tz = 0; + + return new THREE.Vector3( tx, ty, tz ).multiplyScalar( this.scale ); + + }; + + var path = new CustomSinCurve( 10 ); + var geometry = new THREE.TubeGeometry( path, 20, 2, 8, false ); + var material = new THREE.MeshBasicMaterial( { color: 0x00ff00 } ); + var mesh = new THREE.Mesh( geometry, material ); + scene.add( mesh ); + + +

Constructor

+ + +

[name]([param:Curve path], [param:Integer tubularSegments], [param:Float radius], [param:Integer radialSegments], [param:Boolean closed])

+

+ path — [page:Curve] - A path that inherits from the [page:Curve] base class
+ tubularSegments — [page:Integer] - The number of segments that make up the tube, default is 64
+ radius — [page:Float] - The radius of the tube, default is 1
+ radialSegments — [page:Integer] - The number of segments that make up the cross-section, default is 8
+ closed — [page:Boolean] Is the tube open or closed, default is false
+

+ + +

Properties

+ +

[property:Object parameters]

+

+ An object with a property for each of the constructor parameters. Any modification after instantiation does not change the geometry. +

+ +

[property:Array tangents]

+

+ An array of [page:Vector3] tangents +

+ +

[property:Array normals]

+

+ An array of [page:Vector3] normals +

+ +

[property:Array binormals]

+

+ An array of [page:Vector3] binormals +

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/geometries/WireframeGeometry.html b/docs/api/zh/geometries/WireframeGeometry.html new file mode 100644 index 00000000000000..0fc253ddd276cf --- /dev/null +++ b/docs/api/zh/geometries/WireframeGeometry.html @@ -0,0 +1,63 @@ + + + + + + + + + + + [page:BufferGeometry] → + +

[name]

+ +

This can be used as a helper object to view a [page:Geometry Geometry] object as a wireframe.

+ + + +

Example

+ + [example:webgl_helpers helpers] + + +var geometry = new THREE.SphereBufferGeometry( 100, 100, 100 ); + +var wireframe = new THREE.WireframeGeometry( geometry ); + +var line = new THREE.LineSegments( wireframe ); +line.material.depthTest = false; +line.material.opacity = 0.25; +line.material.transparent = true; + +scene.add( line ); + + +

Constructor

+ +

[name]( [param:Geometry geometry] )

+

+ geometry — any geometry object. +

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/helpers/ArrowHelper.html b/docs/api/zh/helpers/ArrowHelper.html new file mode 100644 index 00000000000000..53534da5be8f3a --- /dev/null +++ b/docs/api/zh/helpers/ArrowHelper.html @@ -0,0 +1,98 @@ + + + + + + + + + + + [page:Object3D] → + +

[name]

+ +

An 3D arrow object for visualizing directions.

+ + +

Example

+ +
[example:webgl_geometries WebGL / geometries]
+
[example:webgl_geometry_normals WebGL / geometry / normals]
+
[example:webgl_shadowmesh WebGL / shadowmesh]
+ + + var dir = new THREE.Vector3( 1, 2, 0 ); + + //normalize the direction vector (convert to vector of length 1) + dir.normalize(); + + var origin = new THREE.Vector3( 0, 0, 0 ); + var length = 1; + var hex = 0xffff00; + + var arrowHelper = new THREE.ArrowHelper( dir, origin, length, hex ); + scene.add( arrowHelper ); + + + + +

Constructor

+ + +

[name]([param:Vector3 dir], [param:Vector3 origin], [param:Number length], [param:Number hex], [param:Number headLength], [param:Number headWidth] )

+

+ [page:Vector3 dir] -- direction from origin. Must be a unit vector.
+ [page:Vector3 origin] -- Point at which the arrow starts.
+ [page:Number length] -- length of the arrow. Default is *1*.
+ [page:Number hex] -- hexadecimal value to define color. Default is 0xffff00.
+ [page:Number headLength] -- The length of the head of the arrow. Default is 0.2 * length.
+ [page:Number headWidth] -- The length of the width of the arrow. Default is 0.2 * headLength. +

+ +

Properties

+

See the base [page:Object3D] class for common properties.

+ + +

[property:Line line]

+

Contains the line part of the arrowHelper.

+ +

[property:Mesh cone]

+

Contains the cone part of the arrowHelper.

+ + + + +

Methods

+

See the base [page:Object3D] class for common methods.

+ + + +

[method:null setColor]([param:Number hex])

+

+ hex -- The hexadecimal value of the color.

+ + Sets the color of the arrowHelper. +

+ +

[method:null setLength]([param:Number length], [param:Number headLength], [param:Number headWidth])

+

+ length -- The desired length.
+ headLength -- The length of the head of the arrow.
+ headWidth -- The length of the width of the arrow.

+ + Sets the length of the arrowhelper. +

+ +

[method:null setDirection]([param:Vector3 dir])

+

+ dir -- The desired direction. Must be a unit vector.

+ + Sets the direction of the arrowhelper. +

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/helpers/AxesHelper.html b/docs/api/zh/helpers/AxesHelper.html new file mode 100644 index 00000000000000..5cf6611205f0b2 --- /dev/null +++ b/docs/api/zh/helpers/AxesHelper.html @@ -0,0 +1,51 @@ + + + + + + + + + + + [page:LineSegments] → + +

[name]

+ +

An axis object to visualize the 3 axes in a simple way.
+ The X axis is red. The Y axis is green. The Z axis is blue.

+ + +

Example

+ +
[example:webgl_geometries WebGL / geometries]
+
[example:webgl_geometries2 WebGL / geometries2]
+
[example:webgl_geometry_convex WebGL / geometry / convex]
+
[example:webgl_geometry_spline_editor WebGL / geometry / spline / editor]
+ + + + +var axesHelper = new THREE.AxesHelper( 5 ); +scene.add( axesHelper ); + + +

Constructor

+ + +

[name]( [param:Number size] )

+

+ [page:Number size] -- (optional) size of the lines representing the axes. Default is *1*. +

+ +

Properties

+

See the base [page:LineSegments] class for common properties.

+ +

Methods

+

See the base [page:LineSegments] class for common methods.

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/helpers/Box3Helper.html b/docs/api/zh/helpers/Box3Helper.html new file mode 100644 index 00000000000000..ccb95f0cfe20d0 --- /dev/null +++ b/docs/api/zh/helpers/Box3Helper.html @@ -0,0 +1,64 @@ + + + + + + + + + + + [page:LineSegments] → + +

[name]

+ +

+ Helper object to visualize a [page:Box3]. +

+ + +

Example

+ + + var box = new THREE.Box3(); + box.setFromCenterAndSize( new THREE.Vector3( 1, 1, 1 ), new THREE.Vector3( 2, 1, 3 ) ); + + var helper = new THREE.Box3Helper( box, 0xffff00 ); + scene.add( helper ); + + + +

Constructor

+ + +

[name]( [param:Box3 box], [param:Color color] )

+

+ [page:Box3 box] -- the Box3 to show.
+ [page:Color color] -- (optional) the box's color. Default is 0xffff00.

+ + Creates a new wireframe box that represents the passed Box3. +

+ +

Properties

+

See the base [page:LineSegments] class for common properties.

+ +

[property:Box3 box]

+

The Box3 being visualized.

+ + +

Methods

+

See the base [page:LineSegments] class for common methods.

+ + +

[method:void updateMatrixWorld]( [param:Boolean force] )

+

+ This overrides the method in the base [page:Object3D] class so that it + also updates the wireframe box to the extent of the [page:Box3Helper.box .box] + property. +

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/helpers/BoxHelper.html b/docs/api/zh/helpers/BoxHelper.html new file mode 100644 index 00000000000000..e139654f4bac4c --- /dev/null +++ b/docs/api/zh/helpers/BoxHelper.html @@ -0,0 +1,74 @@ + + + + + + + + + + + [page:LineSegments] → + +

[name]

+ +

+ Helper object to show the world-axis-aligned bounding box around an object. + + 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]. +

+ + +

Example

+ +
[example:webgl_helpers WebGL / helpers]
+
[example:webgl_loader_nrrd WebGL / loader / nrrd]
+
[example:webgl_buffergeometry_drawcalls advanced / buffergeometry / drawcalls]
+ + + + 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 ); + + + +

Constructor

+ + +

[name]( [param:Object3D object], [param:Color color] )

+

+ [page:Object3D object] -- (optional) the object3D to show the world-axis-aligned boundingbox.
+ [page:Color color] -- (optional) hexadecimal value that defines the box's color. Default is 0xffff00.

+ + Creates a new wireframe box that bounds the passed object. Internally this uses [page:Box3.setFromObject] + to calculate the dimensions. Note that this includes any children. +

+ +

Properties

+

See the base [page:LineSegments] class for common properties.

+ + +

Methods

+

See the base [page:LineSegments] class for common methods.

+ +

[method:null update]()

+

+ Updates the helper's geometry to match the dimensions + of the object, including any children. See [page:Box3.setFromObject]. +

+ +

[method:BoxHelper setFromObject]( [param:Object3D object] )

+

+ [page:Object3D object] - [page:Object3D] to create the helper of.

+ + Updates the wireframe box for the passed object. +

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/helpers/CameraHelper.html b/docs/api/zh/helpers/CameraHelper.html new file mode 100644 index 00000000000000..c277c5e77a195c --- /dev/null +++ b/docs/api/zh/helpers/CameraHelper.html @@ -0,0 +1,79 @@ + + + + + + + + + + + [page:LineSegments] → + +

[name]

+ +

+ This helps with visualizing what a camera contains in its frustum.
+ It visualizes the frustum of a camera using a [page:LineSegments]. +

+ +

Example

+ +
[example:webgl_camera WebGL / camera]
+
[example:webgl_geometry_extrude_splines WebGL / extrude / splines]
+ + +var camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 0.1, 1000 ); +var helper = new THREE.CameraHelper( camera ); +scene.add( helper ); + + + +

Constructor

+ + +

[name]( [param:Camera camera] )

+

+ [page:Camera camera] -- The camera to visualize.

+ + This create a new [Name] for the specified camera. +

+ + + +

Properties

+

See the base [page:LineSegments] class for common properties.

+ + + +

[property:Camera camera]

+

The camera being visualized.

+ +

[property:object pointMap]

+

This contains the points used to visualize the camera.

+ +

[property:object matrix]

+

Reference to the [page:Object3D.matrixWorld camera.matrixWorld].

+ +

[property:object matrixAutoUpdate]

+

+ See [page:Object3D.matrixAutoUpdate]. Set to *false* here as the helper is using the + camera's [page:Object3D.matrixWorld matrixWorld]. +

+ + + + + +

Methods

+

See the base [page:LineSegments] class for common methods.

+ + +

[method:null update]()

+

Updates the helper based on the projectionMatrix of the camera.

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/helpers/DirectionalLightHelper.html b/docs/api/zh/helpers/DirectionalLightHelper.html new file mode 100644 index 00000000000000..b46dd06dd92be1 --- /dev/null +++ b/docs/api/zh/helpers/DirectionalLightHelper.html @@ -0,0 +1,85 @@ + + + + + + + + + + + [page:Object3D] → + +

[name]

+ +

+ Helper object to assist with visualizing a [page:DirectionalLight]'s effect on the scene. + + This consists of plane and a line representing the light's position and direction. +

+ +

Example

+ + + var light = new THREE.DirectionalLight( 0xFFFFFF ); + + var helper = new THREE.DirectionalLightHelper( light, 5 ); + + scene.add( helper ); + + + +

Constructor

+ + +

[name]( [param:DirectionalLight light], [param:Number size], [param:Hex color] )

+

+ [page:DirectionalLight light]-- The light to be visualized.

+ + [page:Number size] -- (optional) dimensions of the plane. Default is *1*.

+ + [page:Hex color] -- (optional) if this is not the set the helper will take the color of the light. +

+ + +

Properties

+

See the base [page:Object3D] class for common properties.

+ + +

[property:Line lightPlane]

+

Contains the line mesh showing the location of the directional light.

+ +

[property:DirectionalLight light]

+

Reference to the [page:DirectionalLight directionalLight] being visualized.

+ +

[property:object matrix]

+

Reference to the light's [page:Object3D.matrixWorld matrixWorld].

+ +

[property:object matrixAutoUpdate]

+

+ See [page:Object3D.matrixAutoUpdate]. Set to *false* here as the helper is using the + light's [page:Object3D.matrixWorld matrixWorld]. +

+ +

[property:hex color]

+

+ The color parameter passed in the constructor. Default is *undefined*. If this is changed, + the helper's color will update the next time [page:.update update] is called. +

+ + +

Methods

+

See the base [page:Object3D] class for common properties.

+ +

[method:null dispose]()

+

Dispose of the directionalLightHelper.

+ + +

[method:null update]()

+

Updates the helper to match the position and direction of the [page:.light directionalLight] being visualized.

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/helpers/FaceNormalsHelper.html b/docs/api/zh/helpers/FaceNormalsHelper.html new file mode 100644 index 00000000000000..3f52ac004ab0e4 --- /dev/null +++ b/docs/api/zh/helpers/FaceNormalsHelper.html @@ -0,0 +1,81 @@ + + + + + + + + + + + [page:LineSegments] → + +

[name]

+ +

+ Renders [page:ArrowHelper arrows] to visualize an object's [page:Face3 face] normals. + Requires that face normals have been specified on all [page:Face3 faces] or calculated + with [page:Geometry.computeFaceNormals computeFaceNormals].

+ + Note that this only works with the objects whose geometry is an instance of [page:Geometry]. + For [page:BufferGeometry] use a [page:VertexNormalsHelper] instead. +

+ + +

Example

+ +
[example:webgl_helpers WebGL / helpers]
+ + + geometry = new THREE.BoxGeometry( 10, 10, 10, 2, 2, 2 ); + material = new THREE.MeshBasicMaterial( { color: 0xff0000 } ); + box = new THREE.Mesh( geometry, material ); + + helper = new THREE.FaceNormalsHelper( box, 2, 0x00ff00, 1 ); + + scene.add( box ); + scene.add( helper ); + + +

Constructor

+ + +

[name]( [param:Object3D object], [param:Number size], [param:Color color], [param:Number linewidth] )

+

+ [page:Object3D object] -- object for which to render face normals.
+ [page:Number size] -- (optional) length of the arrows. Default is *1*.
+ [page:Hex color] -- (optional) hex color of the arrows. Default is *0xffff00*.
+ [page:Number linewidth] -- (optional) width of the arrow lines. Default is *1*. +

+ + +

Properties

+

See the base [page:LineSegments] class for common properties.

+ +

[property:object matrixAutoUpdate]

+

+ See [page:Object3D.matrixAutoUpdate]. Set to *false* here as the helper is using the + objects's [page:Object3D.matrixWorld matrixWorld]. +

+ +

[property:Object3D object]

+

The object for which the face normals are being visualized.

+ +

[property:Number size]

+

Length of the arrows. Default is *1*.

+ + + +

Methods

+

See the base [page:LineSegments] class for common methods.

+ + +

[method:null update]()

+

Updates the face normal preview based on movement of the object.

+ + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/helpers/GridHelper.html b/docs/api/zh/helpers/GridHelper.html new file mode 100644 index 00000000000000..a394e910b48c09 --- /dev/null +++ b/docs/api/zh/helpers/GridHelper.html @@ -0,0 +1,46 @@ + + + + + + + + + + + [page:Line] → + +

[name]

+ +

The GridHelper is an object to define grids. Grids are two-dimensional arrays of lines.

+ + +

Example

+ + var size = 10; + var divisions = 10; + + var gridHelper = new THREE.GridHelper( size, divisions ); + scene.add( gridHelper ); + + [example:webgl_helpers Example using various helpers] + + +

Constructor

+ +

[name]( [param:number size], [param:Number divisions], [param:Color colorCenterLine], [param:Color colorGrid] )

+

+ size -- The size of the grid. Default is 10.
+ divisions -- The number of divisions across the grid. Default is 10.
+ colorCenterLine -- The color of the centerline. This can be a [page:Color], a hexadecimal value and an CSS-Color name. Default is 0x444444
+ colorGrid -- The color of the lines of the grid. This can be a [page:Color], a hexadecimal value and an CSS-Color name. Default is 0x888888 +

+

+ Creates a new [name] of size 'size' and divided into 'divisions' segments per side. Colors are optional. +

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/helpers/HemisphereLightHelper.html b/docs/api/zh/helpers/HemisphereLightHelper.html new file mode 100644 index 00000000000000..b0e2460935a7f7 --- /dev/null +++ b/docs/api/zh/helpers/HemisphereLightHelper.html @@ -0,0 +1,78 @@ + + + + + + + + + + + [page:Object3D] → + +

[name]

+ +

+ Creates a visual aid consisting of a spherical [page:Mesh] for a [page:HemisphereLight HemisphereLight]. +

+ +

Example

+ + +var light = new THREE.HemisphereLight( 0xffffbb, 0x080820, 1 ); + +var helper = new THREE.HemisphereLightHelper( light, 5 ); + +scene.add( helper ); + + + +

Constructor

+ +

[name]( [param:HemisphereLight light], [param:Number sphereSize], [param:Hex color] )

+

+ [page:HemisphereLight light] -- The light being visualized.

+ + [page:Number size] -- The size of the mesh used to visualize the light.

+ + [page:Hex color] -- (optional) if this is not the set the helper will take the color of the light. +

+ + +

Properties

+

See the base [page:Object3D] class for common properties.

+ +

[property:HemisphereLight light]

+

Reference to the HemisphereLight being visualized.

+ +

[property:object matrix]

+

Reference to the hemisphereLight's [page:Object3D.matrixWorld matrixWorld].

+ +

[property:object matrixAutoUpdate]

+

+ See [page:Object3D.matrixAutoUpdate]. Set to *false* here as the helper is using the + hemisphereLight's [page:Object3D.matrixWorld matrixWorld]. +

+ +

[property:hex color]

+

+ The color parameter passed in the constructor. Default is *undefined*. If this is changed, the helper's color will update + the next time [page:.update update] is called. +

+ + +

Methods

+

See the base [page:Object3D] class for common methods.

+ +

[method:null dispose]()

+

Dispose of the hemisphereLightHelper.

+ +

[method:null update]()

+

Updates the helper to match the position and direction of the [page:.light].

+ + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/helpers/PlaneHelper.html b/docs/api/zh/helpers/PlaneHelper.html new file mode 100644 index 00000000000000..ef4325e84881f0 --- /dev/null +++ b/docs/api/zh/helpers/PlaneHelper.html @@ -0,0 +1,65 @@ + + + + + + + + + + + [page:LineSegments] → + +

[name]

+ +

+ Helper object to visualize a [page:Plane]. +

+ + +

Example

+ + + var plane = new THREE.Plane( new THREE.Vector3( 1, 1, 0.2 ), 3 ); + var helper = new THREE.PlaneHelper( plane, 1, 0xffff00 ); + scene.add( helper ); + + + +

Constructor

+ + +

[name]( [param:Plane plane], [param:Float size], [param:Color hex] )

+

+ [page:Plane plane] -- the plane to visualize.
+ [page:Float size] -- (optional) side length of plane helper. Default is 1.
+ [page:Color color] -- (optional) the color of the helper. Default is 0xffff00.

+ + Creates a new wireframe representation of the passed plane. +

+ +

Properties

+

See the base [page:LineSegments] class for common properties.

+ +

[property:Plane plane]

+

The [page:Plane plane] being visualized.

+ +

[property:Float size]

+

The side lengths of plane helper.

+ + +

Methods

+

See the base [page:LineSegments] class for common methods.

+ +

[method:void updateMatrixWorld]( [param:Boolean force] )

+

+ This overrides the method in the base [page:Object3D] class so that it also + updates the helper object according to the [page:PlaneHelper.plane .plane] and + [page:PlaneHelper.size .size] properties. +

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/helpers/PointLightHelper.html b/docs/api/zh/helpers/PointLightHelper.html new file mode 100644 index 00000000000000..13c122f3506128 --- /dev/null +++ b/docs/api/zh/helpers/PointLightHelper.html @@ -0,0 +1,84 @@ + + + + + + + + + + + [page:Mesh] → + +

[name]

+ +

+ This displays a helper object consisting of a spherical [page:Mesh] for visualizing + a [page:PointLight]. +

+ + +

Example

+ + [example:webgl_helpers WebGL / helpers] + + + var pointLight = new THREE.PointLight( 0xff0000, 1, 100 ); + pointLight.position.set( 10, 10, 10 ); + scene.add( pointLight ); + + var sphereSize = 1; + var pointLightHelper = new THREE.PointLightHelper( pointLight, sphereSize ); + scene.add( pointLightHelper ); + + + + + +

Constructor

+ +

[name]( [param:PointLight light], [param:Float sphereSize], [param:Hex color] )

+

+ [page:PointLight light] -- The light to be visualized.

+ + [page:Float sphereSize] -- (optional) The size of the sphere helper. Default is *1*.

+ + [page:Hex color] -- (optional) if this is not the set the helper will take the color of the light. +

+ +

Properties

+

See the base [page:Mesh] class for common properties.

+ +

[property:PointLight light]

+

The [page:PointLight] that is being visualized.

+ +

[property:object matrix]

+

Reference to the pointLight's [page:Object3D.matrixWorld matrixWorld].

+ +

[property:object matrixAutoUpdate]

+

+ See [page:Object3D.matrixAutoUpdate]. Set to *false* here as the helper is using the + pointLight's [page:Object3D.matrixWorld matrixWorld]. +

+ +

[property:hex color]

+

+ The color parameter passed in the constructor. Default is *undefined*. If this is changed, the helper's color will update + the next time [page:.update update] is called. +

+ +

Methods

+

See the base [page:Mesh] class for common methods.

+ +

[method:null dispose]()

+

Dispose of the pointLightHelper.

+ + +

[method:null update]()

+

Updates the helper to match the position of the [page:.light].

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/helpers/PolarGridHelper.html b/docs/api/zh/helpers/PolarGridHelper.html new file mode 100644 index 00000000000000..cac1727117a7fa --- /dev/null +++ b/docs/api/zh/helpers/PolarGridHelper.html @@ -0,0 +1,50 @@ + + + + + + + + + + + [page:Line] → + +

[name]

+ +

The PolarGridHelper is an object to define polar grids. Grids are two-dimensional arrays of lines.

+ + +

Example

+ + var radius = 10; + var radials = 16; + var circles = 8; + var divisions = 64; + + var helper = new THREE.PolarGridHelper( radius, radials, circles, divisions ); + scene.add( helper ); + + [example:webgl_helpers Example using various helpers] + + +

Constructor

+ +

[name]( [param:Number radius], [param:Number radials], [param:Number circles], [param:Number divisions], [param:Color color1], [param:Color color2] )

+

+ radius -- The radius of the polar grid. This can be any positive number. Default is 10.
+ radials -- The number of radial lines. This can be any positive integer. Default is 16.
+ circles -- The number of circles. This can be any positive integer. Default is 8.
+ divisions -- The number of line segments used for each circle. This can be any positive integer that is 3 or greater. Default is 64.
+ color1 -- The first color used for grid elements. This can be a [page:Color], a hexadecimal value and an CSS-Color name. Default is 0x444444
+ color2 -- The second color used for grid elements. This can be a [page:Color], a hexadecimal value and an CSS-Color name. Default is 0x888888 +

+

+ Creates a new [name] of radius 'radius' with 'radials' number of radials and 'circles' number of circles, where each circle is smoothed into 'divisions' number of line segments. Colors are optional. +

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/helpers/RectAreaLightHelper.html b/docs/api/zh/helpers/RectAreaLightHelper.html new file mode 100644 index 00000000000000..87aad7ab9542c5 --- /dev/null +++ b/docs/api/zh/helpers/RectAreaLightHelper.html @@ -0,0 +1,67 @@ + + + + + + + + + + + [page:Object3D] → + +

[name]

+ +

+ Creates a visual aid for a [page:RectAreaLight]. +

+ +

Example

+ + +var light = new THREE.RectAreaLight( 0xffffbb, 1.0, 5, 5 ); + +var helper = new THREE.RectAreaLightHelper( light ); + +scene.add( helper ); + + + +

Constructor

+ +

[name]( [param:RectAreaLight light], [param:Hex color] )

+

+ [page:RectAreaLight light] -- The light being visualized.

+ + [page:Hex color] -- (optional) if this is not the set the helper will take the color of the light. +

+ + +

Properties

+

See the base [page:Object3D] class for common properties.

+ +

[property:RectAreaLight light]

+

Reference to the RectAreaLight being visualized.

+ +

[property:hex color]

+

+ The color parameter passed in the constructor. Default is *undefined*. If this is changed, the helper's color will update + the next time [page:.update update] is called. +

+ + +

Methods

+

See the base [page:Object3D] class for common methods.

+ +

[method:null dispose]()

+

Dispose of the rectAreaLightHelper.

+ +

[method:null update]()

+

Updates the helper to match the position and direction of the [page:.light].

+ + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/helpers/SkeletonHelper.html b/docs/api/zh/helpers/SkeletonHelper.html new file mode 100644 index 00000000000000..bab2b55680622f --- /dev/null +++ b/docs/api/zh/helpers/SkeletonHelper.html @@ -0,0 +1,62 @@ + + + + + + + + + + + [page:Object3D] → [page:Line] → [page:LineSegments] → + +

[name]

+ +

+ A helper object to assist with visualizing a [page:Skeleton Skeleton]. + The helper is renderered using a [page:LineBasicMaterial LineBasicMaterial]. +

+ + +

Example

+ + [example:webgl_animation_skinning_blending animation / skinning / blending]
+ [example:webgl_animation_skinning_morph animation / skinning / morph]
+ [example:webgl_loader_bvh loader / bvh ] + + +var helper = new THREE.SkeletonHelper( mesh ); +helper.material.linewidth = 3; +scene.add( helper ); + + + + +

Constructor

+ + +

[name]( object )

+

+ object -- can be any object that has an array of [page:Bone Bone]s as a sub object.
+ For example, a [page:Skeleton Skeleton] or a [page:SkinnedMesh SkinnedMesh]. +

+ + +

Properties

+ +

[property:Array bones]

+

+ The list of bones that the helper renders as [page:Line Lines]. +

+ +

[property:Object root]

+

+ The object passed in the constructor. +

+ + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/helpers/SpotLightHelper.html b/docs/api/zh/helpers/SpotLightHelper.html new file mode 100644 index 00000000000000..f385c80f3885ed --- /dev/null +++ b/docs/api/zh/helpers/SpotLightHelper.html @@ -0,0 +1,83 @@ + + + + + + + + + + + [page:Object3D] → + +

[name]

+ +

This displays a cone shaped helper object for a [page:SpotLight].

+ +

Example

+ + View in Examples
+

Other Examples

+ +
[example:webgl_lights_spotlights lights / spotlights ]
+ +

Code Example

+ + var spotLight = new THREE.SpotLight( 0xffffff ); + spotLight.position.set( 10, 10, 10 ); + scene.add( spotLight ); + + var spotLightHelper = new THREE.SpotLightHelper( spotLight ); + scene.add( spotLightHelper ); + + + +

Constructor

+ + +

[name]( [param:SpotLight light], [param:Hex color] )

+

+ [page:SpotLight light] -- The [page:SpotLight] to be visualized.

+ + [page:Hex color] -- (optional) if this is not the set the helper will take the color of the light. +

+ + +

Properties

+

See the base [page:Object3D] class for common properties.

+ +

[property:LineSegments cone]

+

[page:LineSegments] used to visualize the light.

+ +

[property:SpotLight light]

+

Reference to the [page:SpotLight] being visualized.

+ +

[property:object matrix]

+

Reference to the spotLight's [page:Object3D.matrixWorld matrixWorld].

+ +

[property:object matrixAutoUpdate]

+

+ See [page:Object3D.matrixAutoUpdate]. Set to *false* here as the helper is using the + spotLight's [page:Object3D.matrixWorld matrixWorld]. +

+ +

[property:hex color]

+

+ The color parameter passed in the constructor. Default is *undefined*. If this is changed, the helper's color will update + the next time [page:.update update] is called. +

+ +

Methods

+

See the base [page:Object3D] class for common methods.

+ +

[method:null dispose]()

+

Disposes of the light helper.

+ +

[method:null update]()

+

Updates the light helper.

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/helpers/VertexNormalsHelper.html b/docs/api/zh/helpers/VertexNormalsHelper.html new file mode 100644 index 00000000000000..583ef31f074a8d --- /dev/null +++ b/docs/api/zh/helpers/VertexNormalsHelper.html @@ -0,0 +1,79 @@ + + + + + + + + + + + [page:Line] → + +

[name]

+ +

+ Renders [page:ArrowHelper arrows] to visualize an object's vertex normal vectors. + Requires that normals have been specified in a [page:BufferAttribute custom attribute] or + have been calculated using [page:Geometry.computeVertexNormals computeVertexNormals].

+ + Unlike [page:FaceNormalsHelper], this works with [page:BufferGeometry]. +

+ +

Example

+ + [example:webgl_helpers WebGL / helpers] + + + var geometry = new THREE.BoxGeometry( 10, 10, 10, 2, 2, 2 ); + var material = new THREE.MeshBasicMaterial( { color: 0xff0000 } ); + var box = new THREE.Mesh( geometry, material ); + + var helper = new THREE.VertexNormalsHelper( box, 2, 0x00ff00, 1 ); + + scene.add( box ); + scene.add( helper ); + + + +

Constructor

+ + +

[name]( [param:Object3D object], [param:Number size], [param:Hex color], [param:Number linewidth] )

+

+ [page:Object3D object] -- object for which to render vertex normals.
+ [page:Number size] -- (optional) length of the arrows. Default is 1.
+ [page:Hex color] -- hex color of the arrows. Default is 0xff0000.
+ [page:Number linewidth] -- (optional) width of the arrow lines. Default is 1. +

+ + +

Properties

+

See the base [page:LineSegments] class for common properties.

+ +

[property:object matrixAutoUpdate]

+

+ See [page:Object3D.matrixAutoUpdate]. Set to *false* here as the helper is using the + objects's [page:Object3D.matrixWorld matrixWorld]. +

+ +

[property:Object3D object]

+

The object for which the vertex normals are being visualized.

+ +

[property:Number size]

+

Length of the arrows. Default is *1*.

+ + +

Methods

+

See the base [page:LineSegments] class for common methods.

+ + +

[method:null update]()

+

Updates the vertex normal preview based on movement of the object.

+ + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/lights/AmbientLight.html b/docs/api/zh/lights/AmbientLight.html new file mode 100644 index 00000000000000..c10f92983cf06d --- /dev/null +++ b/docs/api/zh/lights/AmbientLight.html @@ -0,0 +1,73 @@ + + + + + + + + + + + [page:Object3D] → [page:Light] → + +

[name]

+ +

+ This light globally illuminates all objects in the scene equally.

+ + This light cannot be used to cast shadows as it does not have a direction. +

+ + +

Example

+

+ [example:canvas_camera_orthographic camera / orthographic ]
+ [example:canvas_interactive_voxelpainter interactive / voxelpainter ]
+ [example:canvas_materials materials ]
+ [example:canvas_sandbox sandbox ]
+ [example:webgl_animation_cloth animation / cloth ]
+ [example:webgl_animation_skinning_blending animation / skinning / blending ] +

+ +var light = new THREE.AmbientLight( 0x404040 ); // soft white light +scene.add( light ); + +

Constructor

+ +

[name]( [param:Integer color], [param:Float intensity] )

+

+ [page:Integer color] - (optional) Numeric value of the RGB component of the color. Default is 0xffffff.
+ [page:Float intensity] - (optional) Numeric value of the light's strength/intensity. Default is 1.

+ + Creates a new [name]. +

+ +

Properties

+

+ See the base [page:Light Light] class for common properties. +

+ +

[property:Boolean castShadow]

+

+ This is set to *undefined* in the constructor as ambient lights cannot cast shadows. +

+ + +

[property:Boolean isAmbientLight]

+

+ Used to check whether this or derived classes are ambient lights. Default is *true*.

+ + You should not change this, as it used internally for optimisation. +

+ + + +

Methods

+

+ See the base [page:Light Light] class for common methods. +

+

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/lights/DirectionalLight.html b/docs/api/zh/lights/DirectionalLight.html new file mode 100644 index 00000000000000..5c5a4cfa3c2f62 --- /dev/null +++ b/docs/api/zh/lights/DirectionalLight.html @@ -0,0 +1,143 @@ + + + + + + + + + + + [page:Object3D] → [page:Light] → + +

[name]

+ +

+ A light that gets emitted in a specific direction. This light will behave as though it is + infinitely far away and the rays produced from it are all parallel. The common use case + for this is to simulate daylight; the sun is far enough away that its position can be + considered to be infinite, and all light rays coming from it are parallel.

+ + This light can cast shadows - see the [page:DirectionalLightShadow] page for details. +

+ +

A Note about Position, Target and rotation

+

+ A common point of confusion for directional lights is that setting the rotation has no effect. + This is because three.js's DirectionalLight is the equivalent to what is often called a 'Target + Direct Light' in other applications.

+ + This means that its direction is calculated as pointing + from the light's [page:Object3D.position position] to the [page:.target target]'s position + (as opposed to a 'Free Direct Light' that just has a rotation component).

+ + The reason for this is to allow the light to cast shadows - the [page:.shadow shadow] + camera needs a position to calculate shadows from.

+ + See the [page:.target target] property below for details on updating the target. +

+ + +

Example

+

+ [example:canvas_morphtargets_horse morphtargets / horse ]
+ [example:misc_controls_fly controls / fly ]
+ [example:misc_lights_test lights / test ]
+ [example:webvr_cubes cubes ]
+ [example:webgl_effects_parallaxbarrier effects / parallaxbarrier ]
+ [example:webgl_effects_stereo effects / stereo ]
+ [example:webgl_geometry_extrude_splines geometry / extrude / splines ]
+ [example:webgl_materials_bumpmap materials / bumpmap ]
+ [example:webgl_materials_cubemap_balls_reflection materials / cubemap / balls / reflection ] +

+ + + // White directional light at half intensity shining from the top. + var directionalLight = new THREE.DirectionalLight( 0xffffff, 0.5 ); + scene.add( directionalLight ); + + + +

Constructor

+ +

[name]( [param:Integer color], [param:Float intensity] )

+

+ [page:Integer color] - (optional) hexadecimal color of the light. Default is 0xffffff (white).
+ [page:Float intensity] - (optional) numeric value of the light's strength/intensity. Default is 1.

+ + Creates a new [name]. +

+ +

Properties

+ + See the base [page:Light Light] class for common properties. + +

[property:Boolean castShadow]

+

+ If set to *true* light will cast dynamic shadows. *Warning*: This is expensive and + requires tweaking to get shadows looking right. See the [page:DirectionalLightShadow] for details. + The default is *false*. +

+ +

[property:Boolean isDirectionalLight]

+

+ Used to check whether this or derived classes are directional lights. Default is *true*.

+ + You should not change this, as it is used internally for optimisation. +

+ + +

[property:Vector3 position]

+

+ This is set equal to [page:Object3D.DefaultUp] (0, 1, 0), so that the light shines from the top down. +

+ +

[property:DirectionalLightShadow shadow]

+

+ A [page:DirectionalLightShadow] used to calculate shadows for this light. +

+ +

[property:Object3D target]

+

+ The DirectionalLight points from its [page:.position position] to target.position. The default + position of the target is *(0, 0, 0)*.
+ + *Note*: For the target's position to be changed to anything other than the default, + it must be added to the [page:Scene scene] using +

+ + scene.add( light.target ); + +

+ This is so that the target's [page:Object3D.matrixWorld matrixWorld] gets automatically + updated each frame.

+ + It is also possible to set the target to be another object in the scene (anything with a + [page:Object3D.position position] property), like so: +

+ + var targetObject = new THREE.Object3D(); + scene.add(targetObject); + + light.target = targetObject; + +

+ The directionalLight will now track the target object. +

+ + +

Methods

+ + See the base [page:Light Light] class for common methods. + +

[method:DirectionalLight copy]( [param:DirectionalLight source] )

+

+ Copies value of all the properties from the [page:DirectionalLight source] to this + DirectionalLight. +

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/lights/HemisphereLight.html b/docs/api/zh/lights/HemisphereLight.html new file mode 100644 index 00000000000000..2cd77b8037ba4f --- /dev/null +++ b/docs/api/zh/lights/HemisphereLight.html @@ -0,0 +1,99 @@ + + + + + + + + + + + [page:Object3D] → [page:Light] → + +

[name]

+ +

+ A light source positioned directly above the scene, with color fading from the + sky color to the ground color.

+ + This light cannot be used to cast shadows. +

+ +

Example

+ +
+ [example:webgl_lights_hemisphere lights / hemisphere ]
+ [example:misc_controls_pointerlock controls / pointerlock ]
+ [example:webgl_decals decals ]
+ [example:webgl_loader_collada_kinematics loader / collada / kinematics ]
+ [example:webgl_materials_lightmap materials / lightmap ]
+ [example:webgl_shaders_ocean shaders / ocean ] +
+ + +var light = new THREE.HemisphereLight( 0xffffbb, 0x080820, 1 ); +scene.add( light ); + + +

Constructor

+

[name]( [param:Integer skyColor], [param:Integer groundColor], [param:Float intensity] )

+

+ [page:Integer skyColor] - (optional) hexadecimal color of the sky. Default is 0xffffff.
+ [page:Integer groundColor] - (optional) hexadecimal color of the ground. Default is 0xffffff.
+ [page:Float intensity] - (optional) numeric value of the light's strength/intensity. Default is 1.

+ + Creates a new [name]. +

+ +

Properties

+

+ See the base [page:Light Light] class for common properties. +

+ +

[property:Boolean castShadow]

+

+ This is set to *undefined* in the constructor as hemisphere lights cannot cast shadows. +

+ + +

[property:Float color]

+

+ The light's sky color, as passed in the constructor. + Default is a new [page:Color] set to white (0xffffff). +

+ +

[property:Float groundColor]

+

+ The light's ground color, as passed in the constructor. + Default is a new [page:Color] set to white (0xffffff). +

+ +

[property:Boolean isHemisphereLight]

+

+ Used to check whether this or derived classes are hemisphere lights. Default is *true*.

+ + You should not change this, as it used internally for optimisation. +

+ +

[property:Vector3 position]

+

+ This is set equal to [page:Object3D.DefaultUp] (0, 1, 0), so that the light shines from the top down. +

+ + + +

Methods

+ + See the base [page:Light Light] class for common methods. + +

[method:HemisphereLight copy]( [param:HemisphereLight source] )

+

+ Copies the value of [page:.color color], [page:.intensity intensity] and + [page:.groundColor groundColor] from the [page:Light source] light into this one. +

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/lights/Light.html b/docs/api/zh/lights/Light.html new file mode 100644 index 00000000000000..70e673e4b2415d --- /dev/null +++ b/docs/api/zh/lights/Light.html @@ -0,0 +1,79 @@ + + + + + + + + + + + [page:Object3D] → + +

[name]

+ +

+ Abstract base class for lights - all other light types inherit the properties and methods + described here. +

+ + +

Constructor

+ + +

[name]( [param:Integer color], [param:float intensity] )

+

+ [page:Integer color] - (optional) hexadecimal color of the light. Default is 0xffffff (white).
+ [page:Float intensity] - (optional) numeric value of the light's strength/intensity. Default is 1.

+ + Creates a new [name]. Note that this is not intended to be called directly (use one of derived classes instead). +

+ +

Properties

+

+ See the base [page:Object3D Object3D] class for common properties. +

+ +

[property:Color color]

+

+ Color of the light. Defaults to a new [page:Color] set to white, if not passed in the constructor.
+

+ +

[property:Float intensity]

+

+ The light's intensity, or strength.
+ In [page:WebGLRenderer.physicallyCorrectLights physically correct] mode, the product of + [page:.color color] * intensity is interpreted as luminous intensity measured in candela.
+ Default - *1.0*. +

+ +

[property:Boolean isLight]

+

+ Used to check whether this or derived classes are lights. Default is *true*.

+ + You should not change this, as it used internally for optimisation. +

+ + +

Methods

+

+ See the base [page:Object3D Object3D] class for common methods. +

+ + +

[method:Light copy]( [param:Light source] )

+

+ Copies the value of [page:.color color] and [page:.intensity intensity] from the + [page:Light source] light into this one. +

+ +

[method:JSON toJSON]( [param:String meta] )

+

+ Return Light data in JSON format. +

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/lights/PointLight.html b/docs/api/zh/lights/PointLight.html new file mode 100644 index 00000000000000..db0ca22d0bb4e5 --- /dev/null +++ b/docs/api/zh/lights/PointLight.html @@ -0,0 +1,119 @@ + + + + + + + + + + + [page:Object3D] → [page:Light] → + +

[name]

+ +

+ A light that gets emitted from a single point in all directions. A common use case for this + is to replicate the light emitted from a bare lightbulb.

+ + This light can cast shadows - see [page:LightShadow] page for details. +

+ + +

Example

+ +

+ [example:canvas_lights_pointlights lights / pointlights ]
+ [example:webgl_lights_pointlights lights / pointlights ]
+ [example:webgl_lights_pointlights2 lights / pointlights2 ]
+ [example:webgldeferred_animation animation ]
+ [example:webgl_effects_anaglyph effects / anaglyph ]
+ [example:webgl_geometry_text geometry / text ]
+ [example:webgl_lensflares lensflares ] +

+ + +var light = new THREE.PointLight( 0xff0000, 1, 100 ); +light.position.set( 50, 50, 50 ); +scene.add( light ); + + + +

Constructor

+ +

[name]( [param:Integer color], [param:Float intensity], [param:Number distance], [param:Float decay] )

+

+ [page:Integer color] - (optional) hexadecimal color of the light. Default is 0xffffff (white).
+ [page:Float intensity] - (optional) numeric value of the light's strength/intensity. Default is 1.

+ [page:Number distance] - The distance from the light where the intensity is 0. + When set to 0, then the light never stops. Default is 0.
+ [page:Float decay] - The amount the light dims along the distance of the light. Default is 1. + For [page:WebGLRenderer.physicallyCorrectLights physically correct] lighting, set this to 2.

+ + Creates a new [name]. +

+ +

Properties

+

+ See the base [page:Light Light] class for common properties. +

+ +

[property:Float decay]

+

+ The amount the light dims along the distance of the light
+ In [page:WebGLRenderer.physicallyCorrectLights physically correct] mode, decay = 2 leads to physically realistic light falloff.
+ Default is *1*. +

+ +

[property:Float distance]

+

+ If non-zero, light will attenuate linearly from maximum intensity at the light's + position down to zero at this distance from the light. Default is *0.0*. +

+ +

[property:Boolean isPointLight]

+

+ Used to check whether this or derived classes are point lights. Default is *true*.

+ + You should not change this, as it used internally for optimisation. +

+ +

[property:Float power]

+

+ The light's power.
+ In [page:WebGLRenderer.physicallyCorrectLights physically correct] mode, the luminous + power of the light measured in lumens. Default is *4Math.PI*.

+ + This is directly related to the [page:.intensity intensity] in the ratio + + power = intensity * 4π + + and changing this will also change the intensity. +

+ +

[property:LightShadow shadow]

+

+ A [page:LightShadow] used to calculate shadows for this light.

+ + The lightShadow's [page:LightShadow.camera camera] + is set to a [page:PerspectiveCamera] with [page:PerspectiveCamera.fov fov] of 90, + [page:PerspectiveCamera.aspect aspect] of 1, [page:PerspectiveCamera.near near] + clipping plane at 0.5 and [page:PerspectiveCamera.far far] clipping plane at 500. +

+ +

Methods

+

+ See the base [page:Light Light] class for common methods. +

+ +

[method:PointLight copy]( [param:PointLight source] )

+

+ Copies value of all the properties from the [page:PointLight source] to this + PointLight. +

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/lights/RectAreaLight.html b/docs/api/zh/lights/RectAreaLight.html new file mode 100644 index 00000000000000..4f188f540cc04c --- /dev/null +++ b/docs/api/zh/lights/RectAreaLight.html @@ -0,0 +1,89 @@ + + + + + + + + + + + [page:Object3D] → [page:Light] → + +

[name]

+ +

+ RectAreaLight emits light uniformly across the face a rectangular plane. This light type can be + used to simulate light sources such as bright windows or strip lighting.

+ + Important Notes: +

    +
  • There is no shadow support.
  • +
  • Only [page:MeshStandardMaterial MeshStandardMaterial] and [page:MeshPhysicalMaterial MeshPhysicalMaterial] are supported.
  • +
  • You have to include [link:https://threejs.org/examples/js/lights/RectAreaLightUniformsLib.js RectAreaLightUniformsLib] into your scene.
  • +
+

+ + + +

Examples

+ +

+ [example:webgl_lights_rectarealight WebGL / rectarealight ] + + +var width = 10; +var height = 10; +var intensity = 1; +var rectLight = new THREE.RectAreaLight( 0xffffff, intensity, width, height ); +rectLight.position.set( 5, 5, 0 ); +rectLight.lookAt( 0, 0, 0 ); +scene.add( rectLight ) + +rectLightHelper = new THREE.RectAreaLightHelper( rectLight ); +scene.add( rectLightHelper ); + + +

+ + +

Constructor

+ + +

[name]( [param:Integer color], [param:Float intensity], [param:Float width], [param:Float height] )

+

+ [page:Integer color] - (optional) hexadecimal color of the light. Default is 0xffffff (white).
+ [page:Float intensity] - (optional) the light's intensity, or brightness. Default is 1.
+ [page:Float width] - (optional) width of the light. Default is 10.
+ [page:Float height] - (optional) height of the light. Default is 10.

+ + Creates a new [name]. +

+ +

Properties

+

+ See the base [page:Light Light] class for common properties. +

+ +

[property:Boolean isRectAreaLight]

+

+ Used to check whether this or derived classes are RectAreaLights. Default is *true*.

+ + You should not change this, as it used internally for optimisation. +

+ +

Methods

+

+ See the base [page:Light Light] class for common methods. +

+ + +

[method:RectAreaLight copy]( [param:RectAreaLight source] )

+

+ Copies value of all the properties from the [page:RectAreaLight source] to this + RectAreaLight. +

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/lights/SpotLight.html b/docs/api/zh/lights/SpotLight.html new file mode 100644 index 00000000000000..f21fed3d5dd2c9 --- /dev/null +++ b/docs/api/zh/lights/SpotLight.html @@ -0,0 +1,191 @@ + + + + + + + + + + + [page:Object3D] → [page:Light] → + +

[name]

+ +

+ This light gets emitted from a single point in one direction, along a cone that increases in size + the further from the light it gets.

+ + This light can cast shadows - see the [page:SpotLightShadow] page for details. +

+ + + + +

Example

+ + +

+ [example:webgl_lights_spotlight View in Examples ] +

+ +

Other Examples

+ +

+ [example:webgl_interactive_cubes_gpu interactive / cubes / gpu ]
+ [example:webgl_interactive_draggablecubes interactive / draggablecubes ]
+ [example:webgl_materials_bumpmap_skin materials / bumpmap / skin ]
+ [example:webgl_materials_cubemap_dynamic materials / cubemap / dynamic ]
+ [example:webgl_loader_md2 loader / md2 ]
+ [example:webgl_shading_physical shading / physical ]
+ [example:webgl_materials_bumpmap materials / bumpmap]
+ [example:webgl_shading_physical shading / physical]
+ [example:webgl_shadowmap shadowmap]
+ [example:webgl_shadowmap_performance shadowmap / performance]
+ [example:webgl_shadowmap_viewer shadowmap / viewer] +

+ +

Code Example

+ + // white spotlight shining from the side, casting a shadow + + var spotLight = new THREE.SpotLight( 0xffffff ); + spotLight.position.set( 100, 1000, 100 ); + + spotLight.castShadow = true; + + spotLight.shadow.mapSize.width = 1024; + spotLight.shadow.mapSize.height = 1024; + + spotLight.shadow.camera.near = 500; + spotLight.shadow.camera.far = 4000; + spotLight.shadow.camera.fov = 30; + + scene.add( spotLight ); + + +

Constructor

+ + +

[name]( [param:Integer color], [param:Float intensity], [param:Float distance], [param:Radians angle], [param:Float penumbra], [param:Float decay] )

+

+ [page:Integer color] - (optional) hexadecimal color of the light. Default is 0xffffff (white).
+ [page:Float intensity] - (optional) numeric value of the light's strength/intensity. Default is 1.

+ [page:Float distance] - Maximum distance from origin where light will shine whose intensity + is attenuated linearly based on distance from origin.
+ [page:Radians angle] - Maximum angle of light dispersion from its direction whose upper + bound is Math.PI/2.
+ [page:Float penumbra] - Percent of the spotlight cone that is attenuated due to penumbra. + Takes values between zero and 1. Default is zero.
+ [page:Float decay] - The amount the light dims along the distance of the light.

+ + Creates a new [name]. +

+ +

Properties

+ + See the base [page:Light Light] class for common properties. + +

[property:Float angle]

+

+ Maximum extent of the spotlight, in radians, from its direction. Should be no more than + *Math.PI/2*. The default is *Math.PI/3*. +

+ + +

[property:Boolean castShadow]

+

+ If set to *true* light will cast dynamic shadows. *Warning*: This is expensive and + requires tweaking to get shadows looking right. See the [page:SpotLightShadow] for details. + The default is *false*. +

+ +

[property:Float decay]

+

+ The amount the light dims along the distance of the light.
+ In [page:WebGLRenderer.physicallyCorrectLights physically correct] mode, decay = 2 leads to + physically realistic light falloff. The default is *1*. +

+ +

[property:Float distance]

+

+ If non-zero, light will attenuate linearly from maximum intensity at the light's + position down to zero at this distance from the light. Default is *0.0*. +

+ +

[property:Boolean isSpotLight]

+

+ Used to check whether this or derived classes are spot lights. Default is *true*.

+ + You should not change this, as it used internally for optimisation. +

+ +

[property:Float penumbra]

+

+ Percent of the spotlight cone that is attenuated due to penumbra. Takes values between + zero and 1. The default is *0.0*. +

+ +

[property:Vector3 position]

+

+ This is set equal to [page:Object3D.DefaultUp] (0, 1, 0), so that the light shines from the top down. +

+ +

[property:Float power]

+

+ The light's power.
+ In [page:WebGLRenderer.physicallyCorrectLights physically correct] mode, the luminous + power of the light measured in lumens. Default is *4Math.PI*.

+ + This is directly related to the [page:.intensity intensity] in the ratio + + power = intensity * π + + and changing this will also change the intensity. +

+ +

[property:SpotLightShadow shadow]

+

+ A [page:SpotLightShadow] used to calculate shadows for this light. +

+ + +

[property:Object3D target]

+

+ The Spotlight points from its [page:.position position] to target.position. The default + position of the target is *(0, 0, 0)*.
+ + *Note*: For the target's position to be changed to anything other than the default, + it must be added to the [page:Scene scene] using + + scene.add( light.target ); + + + This is so that the target's [page:Object3D.matrixWorld matrixWorld] gets automatically + updated each frame.

+ + It is also possible to set the target to be another object in the scene (anything with a + [page:Object3D.position position] property), like so: + +var targetObject = new THREE.Object3D(); +scene.add(targetObject); + +light.target = targetObject; + + The spotlight will now track the target object. +

+ + +

Methods

+ + See the base [page:Light Light] class for common methods. + +

[method:SpotLight copy]( [param:SpotLight source] )

+

+ Copies value of all the properties from the [page:SpotLight source] to this + SpotLight. +

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/lights/shadows/DirectionalLightShadow.html b/docs/api/zh/lights/shadows/DirectionalLightShadow.html new file mode 100644 index 00000000000000..6992201b9daa6f --- /dev/null +++ b/docs/api/zh/lights/shadows/DirectionalLightShadow.html @@ -0,0 +1,89 @@ + + + + + + + + + + + [page:LightShadow] → + +

[name]

+ +

+ 这是用于在[page:DirectionalLight DirectionalLights]内部计算阴影

+ + 与其他阴影类不同,它是使用OrthographicCamera来计算阴影,而不是PerspectiveCamera。这是因为来自DirectionalLight的光线是平行的。 +

+ +

例子

+

+ +//Create a WebGLRenderer and turn on shadows in the renderer +var renderer = new THREE.WebGLRenderer(); +renderer.shadowMap.enabled = true; +renderer.shadowMap.type = THREE.PCFSoftShadowMap; // default THREE.PCFShadowMap + +//Create a DirectionalLight and turn on shadows for the light +var light = new THREE.DirectionalLight( 0xffffff, 1, 100 ); +light.position.set( 0, 1, 0 ); //default; light shining from top +light.castShadow = true; // default false +scene.add( light ); + +//Set up shadow properties for the light +light.shadow.mapSize.width = 512; // default +light.shadow.mapSize.height = 512; // default +light.shadow.camera.near = 0.5; // default +light.shadow.camera.far = 500; // default + +//Create a sphere that cast shadows (but does not receive them) +var sphereGeometry = new THREE.SphereBufferGeometry( 5, 32, 32 ); +var sphereMaterial = new THREE.MeshStandardMaterial( { color: 0xff0000 } ); +var sphere = new THREE.Mesh( sphereGeometry, sphereMaterial ); +sphere.castShadow = true; //default is false +sphere.receiveShadow = false; //default +scene.add( sphere ); + +//Create a plane that receives shadows (but does not cast them) +var planeGeometry = new THREE.PlaneBufferGeometry( 20, 20, 32, 32 ); +var planeMaterial = new THREE.MeshStandardMaterial( { color: 0x00ff00 } ) +var plane = new THREE.Mesh( planeGeometry, planeMaterial ); +plane.receiveShadow = true; +scene.add( plane ); + +//Create a helper for the shadow camera (optional) +var helper = new THREE.CameraHelper( light.shadow.camera ); +scene.add( helper ); + +

+ +

构造函数

+

[name]( )

+

+ 创建一个新的[name],不能直接调用-它是在[page:DirectionalLight DirectionalLights]内部调用使用 + +

+ +

属性

+

+ 参阅[page:LightShadow LightShadow]类来了解常用的基本属性 +

+ +

[property:Camera camera]

+

+ 在光的世界里。这用于生成场景的深度图;从光的角度来看,其他物体背后的物体将处于阴影中。

+

+ + +

方法

+

+ 有关常用方法,请参阅基础[page:LightShadow LightShadow]类。 +

+ +

源码

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/lights/[name].js src/lights/[name].js] + + diff --git a/docs/api/zh/lights/shadows/LightShadow.html b/docs/api/zh/lights/shadows/LightShadow.html new file mode 100644 index 00000000000000..b20431bc480469 --- /dev/null +++ b/docs/api/zh/lights/shadows/LightShadow.html @@ -0,0 +1,135 @@ + + + + + + + + + + + +

[name]

+ +

+ 这在 [page:PointLight PointLights] 内部用于计算阴影,也可用作其他阴影类的基类。 +

+ + +

例子

+

+ +//Create a WebGLRenderer and turn on shadows in the renderer +var renderer = new THREE.WebGLRenderer(); +renderer.shadowMap.enabled = true; +renderer.shadowMap.type = THREE.PCFSoftShadowMap; // default THREE.PCFShadowMap + +//Create a PointLight and turn on shadows for the light +var light = new THREE.PointLight( 0xffffff, 1, 100 ); +light.position.set( 0, 10, 0 ); +light.castShadow = true; // default false +scene.add( light ); + +//Set up shadow properties for the light +light.shadow.mapSize.width = 512; // default +light.shadow.mapSize.height = 512; // default +light.shadow.camera.near = 0.5; // default +light.shadow.camera.far = 500 // default + +//Create a sphere that cast shadows (but does not receive them) +var sphereGeometry = new THREE.SphereBufferGeometry( 5, 32, 32 ); +var sphereMaterial = new THREE.MeshStandardMaterial( { color: 0xff0000 } ); +var sphere = new THREE.Mesh( sphereGeometry, sphereMaterial ); +sphere.castShadow = true; //default is false +sphere.receiveShadow = false; //default +scene.add( sphere ); + +//Create a plane that receives shadows (but does not cast them) +var planeGeometry = new THREE.PlaneBufferGeometry( 20, 20, 32, 32 ); +var planeMaterial = new THREE.MeshStandardMaterial( { color: 0x00ff00 } ) +var plane = new THREE.Mesh( planeGeometry, planeMaterial ); +plane.receiveShadow = true; +scene.add( plane ); + +//Create a helper for the shadow camera (optional) +var helper = new THREE.CameraHelper( light.shadow.camera ); +scene.add( helper ); + +

+ +

构造函数

+ +

[name]( [param:Camera camera] )

+

+ [page:Camera camera] - 在光的世界里

+ + 创建一个新的[name]。这不能直接调用的 - 它由[page:PointLight]在内部调用,或者由其他阴影用作基类。 +

+ +

属性

+ +

[property:Camera camera]

+

+ 光的世界里。这用于生成场景的深度图;从光的角度来看,其他物体背后的物体将处于阴影中。 +

+ +

[property:Float bias]

+

+ 阴影贴图偏差,在确定曲面是否在阴影中时,从标准化深度添加或减去多少。
+ 默认值为0.此处非常小的调整(大约0.0001)可能有助于减少阴影中的伪影 +

+ +

[property:WebGLRenderTarget map]

+

+ 使用内置摄像头生成的深度图;超出像素深度的位置在阴影中。在渲染期间内部计算。 +

+ + +

[property:Vector2 mapSize]

+

+ 一个[Page:Vector2]定义阴影贴图的宽度和高度。

+ + 较高的值会以计算时间为代价提供更好的阴影质量。值必须是2的幂,直到给定设备的[page:WebGLRenderer.capabilities].maxTextureSize, + 虽然宽度和高度不必相同(例如,(512,1024)有效)。 + 默认值为*(512,512)*。 +

+ + +

[property:Matrix4 matrix]

+

+ 模拟阴影相机空间,计算阴影贴图中的位置和深度。存储在[page:Matrix4 Matrix4]中。这是在渲染期间内部计算的。 +

+ +

[property:Float radius]

+

+ 将此值设置为大于1的值将模糊阴影的边缘。
+ + + 较高的值会在阴影中产生不必要的条带效果 - 更大的[page:.mapSize mapSize]将允许在这些效果变得可见之前使用更高的值。

+ + 请注意,如果[page:WebGLRenderer.shadowMap.type]设置为[page:Renderer BasicShadowMap],将会无效。 + +

+ + +

方法

+

[method:LightShadow copy]( [param:LightShadow source] )

+

+ 将[page:LightShadow]中的所有属性的值复制到 SpotLight。 +

+ +

[method:LightShadow clone]()

+

+ 克隆与此相同属性的新LightShadow。 +

+ +

[method:Object toJSON]()

+

+ 序列化这个LightShadow。 +

+ +

源码

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/lights/[name].js src/lights/[name].js] + + diff --git a/docs/api/zh/lights/shadows/SpotLightShadow.html b/docs/api/zh/lights/shadows/SpotLightShadow.html new file mode 100644 index 00000000000000..da851e75cb633f --- /dev/null +++ b/docs/api/zh/lights/shadows/SpotLightShadow.html @@ -0,0 +1,90 @@ + + + + + + + + + + + [page:LightShadow] → + +

[name]

+ +

+ 这在SpotLights内部用于计算阴影。 +

+ +

例子

+

+ +//Create a WebGLRenderer and turn on shadows in the renderer +var renderer = new THREE.WebGLRenderer(); +renderer.shadowMap.enabled = true; +renderer.shadowMap.type = THREE.PCFSoftShadowMap; // default THREE.PCFShadowMap + +//Create a SpotLight and turn on shadows for the light +var light = new THREE.SpotLight( 0xffffff ); +light.castShadow = true; // default false +scene.add( light ); + +//Set up shadow properties for the light +light.shadow.mapSize.width = 512; // default +light.shadow.mapSize.height = 512; // default +light.shadow.camera.near = 0.5; // default +light.shadow.camera.far = 500 // default + +//Create a sphere that cast shadows (but does not receive them) +var sphereGeometry = new THREE.SphereBufferGeometry( 5, 32, 32 ); +var sphereMaterial = new THREE.MeshStandardMaterial( { color: 0xff0000 } ); +var sphere = new THREE.Mesh( sphereGeometry, sphereMaterial ); +sphere.castShadow = true; //default is false +sphere.receiveShadow = false; //default +scene.add( sphere ); + +//Create a plane that receives shadows (but does not cast them) +var planeGeometry = new THREE.PlaneBufferGeometry( 20, 20, 32, 32 ); +var planeMaterial = new THREE.MeshStandardMaterial( { color: 0x00ff00 } ) +var plane = new THREE.Mesh( planeGeometry, planeMaterial ); +plane.receiveShadow = true; +scene.add( plane ); + +//Create a helper for the shadow camera (optional) +var helper = new THREE.CameraHelper( light.shadow.camera ); +scene.add( helper ); + +

+ + +

构造函数

+ 构造函数创建一个 [param:PerspectiveCamera PerspectiveCamera] 来管理阴影的世界视图 +

属性

+ 有关常用属性,请参阅基础LightShadow类。 +

[property:Camera camera]

+

+ 在光的世界里。这用于生成场景的深度图;从光的角度来看,其他物体背后的物体将处于阴影中。

+ + 默认值为PerspectiveCamera,近剪裁平面为0.5。 fov将通过更新方法跟踪拥有SpotLight的角度属性。同样,aspect属性将跟踪mapSize的方面。如果设置了灯光的距离属性,则远剪裁平面将跟踪该值,否则默认为500。 + +

+ +

[property:Boolean isSpotLightShadow]

+

+ + 用于检查此类或派生类是否为聚光灯阴影。默认为true。

+ 您不应该更改它,因为它在内部用于优化。 +

+ +

方法

+ 有关常用方法,请参阅基础LightShadow类。 +

[method:SpotLightShadow update]( [param:SpotLight light] )

+

+ 根据传入的[page:SpotLight light]更新内部透视[page:.camera camera]。 +

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/lights/[name].js src/lights/[name].js] + + diff --git a/docs/api/zh/loaders/AnimationLoader.html b/docs/api/zh/loaders/AnimationLoader.html new file mode 100644 index 00000000000000..7fea709445d99c --- /dev/null +++ b/docs/api/zh/loaders/AnimationLoader.html @@ -0,0 +1,88 @@ + + + + + + + + + + +

[name]

+ +

+ Class for loading [page:AnimationClip AnimationClips] in JSON format. + This uses the [page:FileLoader] internally for loading files. +

+ +

Example

+ + + // instantiate a loader + var loader = new THREE.AnimationLoader(); + + // load a resource + loader.load( + // resource URL + 'animations/animation.js', + + // onLoad callback + function ( animations ) { + // animations is an array of AnimationClips + }, + + // onProgress callback + function ( xhr ) { + console.log( (xhr.loaded / xhr.total * 100) + '% loaded' ); + }, + + // onError callback + function ( err ) { + console.log( 'An error happened' ); + } + ); + + +

Constructor

+ +

[name]( [param:LoadingManager manager] )

+

+ [page:LoadingManager manager] — The [page:LoadingManager loadingManager] for the loader to use. Default is [page:LoadingManager THREE.DefaultLoadingManager].

+ + Creates a new [name]. +

+ +

Properties

+ +

[property:LoadingManager manager]

+

+ The [page:LoadingManager loadingManager] the loader is using. Default is [page:DefaultLoadingManager]. +

+ +

Methods

+ +

[method:null load]( [param:String url], [param:Function onLoad], [param:Function onProgress], [param:Function onError] )

+

+ [page:String url] — the path or URL to the file. This can also be a + [link:https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs Data URI].
+ [page:Function onLoad] — Will be called when load completes. The argument will be the loaded [page:Animation animation].
+ [page:Function onProgress] — Will be called while load progresses. The argument will be the XMLHttpRequest instance, which contains .[page:Integer total] and .[page:Integer loaded] bytes.
+ [page:Function onError] — Will be called if load errors.

+ + Begin loading from url and pass the loaded animation to onLoad. +

+ +

[method:null parse]( [param:JSON json], [param:Function onLoad] )

+

+ [page:JSON json] — required
+ [page:Function onLoad] — Will be called when parsing completes.

+ + Parse the JSON object and pass the result to onLoad. Individual clips in the object will + be parsed with [page:AnimationClip.parse]. +

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/loaders/AudioLoader.html b/docs/api/zh/loaders/AudioLoader.html new file mode 100644 index 00000000000000..be2dad7b3f8b86 --- /dev/null +++ b/docs/api/zh/loaders/AudioLoader.html @@ -0,0 +1,99 @@ + + + + + + + + + + +

[name]

+ +

+ Class for loading an + [link:https://developer.mozilla.org/en-US/docs/Web/API/AudioBuffer AudioBuffer]. + This uses the [page:FileLoader] internally for loading files. +

+ +

Example

+ + + // instantiate a listener + var audioListener = new THREE.AudioListener(); + + // add the listener to the camera + camera.add( audioListener ); + + // instantiate audio object + var oceanAmbientSound = new THREE.Audio( audioListener ); + + // add the audio object to the scene + scene.add( oceanAmbientSound ); + + // instantiate a loader + var loader = new THREE.AudioLoader(); + + // load a resource + loader.load( + // resource URL + 'audio/ambient_ocean.ogg', + + // onLoad callback + function ( audioBuffer ) { + // set the audio object buffer to the loaded object + oceanAmbientSound.setBuffer( audioBuffer ); + + // play the audio + oceanAmbientSound.play(); + }, + + // onProgress callback + function ( xhr ) { + console.log( (xhr.loaded / xhr.total * 100) + '% loaded' ); + }, + + // onError callback + function ( err ) { + console.log( 'An error happened' ); + } + ); + + +

Constructor

+ +

[name]( [param:String context], [param:LoadingManager manager] )

+

+ [page:String context] — The [page:String AudioContext] for the loader to use. Default is [page:String window.AudioContext].
+ [page:LoadingManager manager] — The [page:LoadingManager loadingManager] for the loader to use. Default is [page:LoadingManager THREE.DefaultLoadingManager].

+ + Creates a new [name]. +

+ +

Properties

+ +

[property:LoadingManager manager]

+

+ The [page:LoadingManager loadingManager] the loader is using. Default is [page:DefaultLoadingManager]. +

+ + +

Methods

+ +

[method:null load]( [param:String url], [param:Function onLoad], [param:Function onProgress], [param:Function onError] )

+

+ [page:String url] — the path or URL to the file. This can also be a + [link:https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs Data URI].
+ [page:Function onLoad] — Will be called when load completes. The argument will be the loaded text response.
+ [page:Function onProgress] — Will be called while load progresses. The argument will be the XMLHttpRequest instance, which contains .[page:Integer total] and .[page:Integer loaded] bytes.
+ [page:Function onError] — Will be called when load errors.
+

+

+ Begin loading from url and pass the loaded [page:String AudioBuffer] to onLoad. +

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/loaders/BufferGeometryLoader.html b/docs/api/zh/loaders/BufferGeometryLoader.html new file mode 100644 index 00000000000000..848b06bf4a7d11 --- /dev/null +++ b/docs/api/zh/loaders/BufferGeometryLoader.html @@ -0,0 +1,92 @@ + + + + + + + + + + +

[name]

+ +

+ A loader for loading a [page:BufferGeometry]. + This uses the [page:FileLoader] internally for loading files. +

+ +

Example

+ + [example:webgl_geometry_colors_lookuptable WebGL / geometry / colors / lookuptable] + + + // instantiate a loader + var loader = new THREE.BufferGeometryLoader(); + + // load a resource + loader.load( + // resource URL + 'models/json/pressure.json', + + // onLoad callback + function ( geometry ) { + var material = new THREE.MeshLambertMaterial( { color: 0xF5F5F5 } ); + var object = new THREE.Mesh( geometry, material ); + scene.add( object ); + }, + + // onProgress callback + function ( xhr ) { + console.log( (xhr.loaded / xhr.total * 100) + '% loaded' ); + }, + + // onError callback + function ( err ) { + console.log( 'An error happened' ); + } + ); + + +

Constructor

+ +

[name]( [param:LoadingManager manager] )

+

+ [page:LoadingManager manager] — The [page:LoadingManager loadingManager] for the loader to use. Default is [page:LoadingManager THREE.DefaultLoadingManager]. +

+

+ Creates a new [name]. +

+ + +

Properties

+ +

[property:LoadingManager manager]

+

+ The [page:LoadingManager loadingManager] the loader is using. Default is [page:DefaultLoadingManager]. +

+ +

Methods

+ +

[method:null load]( [param:String url], [param:Function onLoad], [param:Function onProgress], [param:Function onError] )

+

+ [page:String url] — the path or URL to the file. This can also be a + [link:https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs Data URI].d
+ [page:Function onLoad] — Will be called when load completes. The argument will be the loaded [page:BufferGeometry].
+ [page:Function onProgress] — Will be called while load progresses. The argument will be the XMLHttpRequest instance, which contains .[page:Integer total] and .[page:Integer loaded] bytes.
+ [page:Function onError] — Will be called when load errors.
+

+

+ Begin loading from url and call onLoad with the parsed response content. +

+ +

[method:BufferGeometry parse]( [param:Object json] )

+

+ [page:Object json] — The JSON structure to parse.

+ Parse a JSON structure and return a [page:BufferGeometry]. +

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/loaders/Cache.html b/docs/api/zh/loaders/Cache.html new file mode 100644 index 00000000000000..f0f9d81ff19a6d --- /dev/null +++ b/docs/api/zh/loaders/Cache.html @@ -0,0 +1,75 @@ + + + + + + + + + + +

[name]

+ +

+ A simple caching system, used internally by [page:FileLoader]. +

+ +

Examples

+ +

+ [example:webgl_geometry_text WebGL / geometry / text ]
+ [example:webgl_interactive_instances_gpu WebGL / interactive / instances / gpu]
+ [example:webgl_loader_ttf WebGL / loader / ttf] +

+ +

Usage

+ +

To enable caching across all loaders that use [page:FileLoader], set

+ +THREE.Cache.enabled = true. + + + +

Properties

+ +

[property:Boolean enabled]

+

Whether caching is enabled. Default is *false*.

+ +

[property:Object files]

+

An [page:Object object] that holds cached files.

+ + +

Methods

+ +

[method:null add]( [param:String key], file )

+

+ [page:String key] — the [page:String key] to reference the cached file by.
+ [page:Object file] — The file to be cached.

+ + Adds a cache entry with a key to reference the file. If this key already holds a file, + it is overwritten. +

+ +

[method:null get]( [param:String key] )

+

+ [page:String key] — A string key

+ + Get the value of [page:String key]. If the key does not exist *undefined* is returned. +

+ +

[method:null remove]( [param:String key] )

+

+ [page:String key] — A string key that references a cached file.

+ + Remove the cached file associated with the key. +

+ +

[method:null clear]()

+

Remove all values from the cache.

+ + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/loaders/CompressedTextureLoader.html b/docs/api/zh/loaders/CompressedTextureLoader.html new file mode 100644 index 00000000000000..ab1b1f51706d4b --- /dev/null +++ b/docs/api/zh/loaders/CompressedTextureLoader.html @@ -0,0 +1,73 @@ + + + + + + + + + + +

[name]

+ +

+ Abstract base class for block based textures loader (dds, pvr, ...). + This uses the [page:FileLoader] internally for loading files. +

+ +

Examples

+ +

+ See the [link:https://github.com/mrdoob/three.js/blob/master/examples/js/loaders/DDSLoader.js DDSLoader] + and [link:https://github.com/mrdoob/three.js/blob/master/examples/js/loaders/PVRLoader.js PVRLoader] + for examples of derived classes. +

+ +

Constructor

+ +

[name]( [param:LoadingManager manager] )

+

+ [page:LoadingManager manager] — The [page:LoadingManager loadingManager] for the loader to use. + Default is [page:LoadingManager THREE.DefaultLoadingManager].

+ + Creates a new [name]. +

+ + +

Properties

+ +

[property:LoadingManager manager]

+

+ The [page:LoadingManager loadingManager] the loader is using. Default is [page:DefaultLoadingManager]. +

+ +

[property:String path]

+

The base path from which files will be loaded. See [page:.setPath]. Default is *undefined*.

+ + + +

Methods

+ +

[method:null load]( [param:String url], [param:Function onLoad], [param:Function onProgress], [param:Function onError] )

+

+ [page:String url] — the path or URL to the file. This can also be a + [link:https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs Data URI].
+ [page:Function onLoad] — Will be called when load completes. The argument will be the loaded texture.
+ [page:Function onProgress] — Will be called while load progresses. The argument will be the XMLHttpRequest instance, which contains .[page:Integer total] and .[page:Integer loaded] bytes.
+ [page:Function onError] — Will be called when load errors.
+

+

+ Begin loading from url and pass the loaded texture to onLoad. +

+ +

[method:FileLoader setPath]( [param:String path] )

+

+ Set the base path or URL from which to load files. This can be useful if + you are loading many textures from the same directory. +

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/loaders/CubeTextureLoader.html b/docs/api/zh/loaders/CubeTextureLoader.html new file mode 100644 index 00000000000000..532382d5a34199 --- /dev/null +++ b/docs/api/zh/loaders/CubeTextureLoader.html @@ -0,0 +1,103 @@ + + + + + + + + + + +

[name]

+ +

+ Class for loading a [page:CubeTexture CubeTexture]. + This uses the [page:ImageLoader] internally for loading files. +

+ +

Example

+ +

+ [example:webgl_materials_cubemap materials / cubemap]
+ [example:webgl_materials_cubemap_balls_reflection materials / cubemap / balls / reflection]
+ [example:webgl_materials_cubemap_balls_refraction materials / cubemap / balls / refraction]
+ [example:webgl_materials_cubemap_dynamic materials / cubemap / dynamic]
+ [example:webgl_materials_cubemap_dynamic2 materials / cubemap / dynamic2]
+ [example:webgl_materials_cubemap_refraction materials / cubemap / refraction] +

+ + +var scene = new THREE.Scene(); +scene.background = new THREE.CubeTextureLoader() + .setPath( 'textures/cubeMaps/' ) + .load( [ + 'px.png', + 'nx.png', + 'py.png', + 'ny.png', + 'pz.png', + 'nz.png' + ] ); + + +

Constructor

+ +

[name]( [param:LoadingManager manager] )

+

+ [page:LoadingManager manager] — The [page:LoadingManager loadingManager] for the loader to use. Default is [page:LoadingManager THREE.DefaultLoadingManager].

+ + Creates a new [name]. +

+ + +

Properties

+ +

[property:String crossOrigin]

+

+ If set, assigns the [link:https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes crossOrigin] + attribute of the image to the value of *crossOrigin*, + prior to starting the load. Default is *"anonymous"*. +

+ +

[property:LoadingManager manager]

+

+ The [page:LoadingManager loadingManager] the loader is using. Default is [page:DefaultLoadingManager]. +

+ +

[property:String path]

+

The base path from which files will be loaded. See [page:.setPath]. Default is *undefined*.

+ + + +

Methods

+ +

[method:null load]( [param:String urls], [param:Function onLoad], [param:Function onProgress], [param:Function onError] )

+

+ [page:String urls] — array of 6 urls to images, one for each side of the CubeTexture. + The urls should be specified in the following order: pos-x, neg-x, pos-y, neg-y, pos-z, neg-z. + They can also be [link:https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs Data URIs].
+ Note that, by convention, cube maps are specified in a coordinate system in which positive-x is to the right + when looking up the positive-z axis -- in other words, using a left-handed coordinate system. + Since three.js uses a right-handed coordinate system, environment maps used in three.js will have pos-x and neg-x swapped.
+ [page:Function onLoad] — Will be called when load completes. The argument will be the loaded [page:Texture texture].
+ [page:Function onProgress] — Will be called while load progresses. The argument will be the XMLHttpRequest instance, which contains .[page:Integer total] and .[page:Integer loaded] bytes.
+ [page:Function onError] — Will be called when load errors.
+

+

+ Begin loading from url and pass the loaded [page:Texture texture] to onLoad. +

+ +

[method:null setCrossOrigin]( [param:String value] )

+

Set the [page:.crossOrigin] attribute.

+ +

[method:FileLoader setPath]( [param:String path] )

+

+ Set the base path or URL from which to load files. This can be useful if + you are loading many textures from the same directory. +

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/loaders/DataTextureLoader.html b/docs/api/zh/loaders/DataTextureLoader.html new file mode 100644 index 00000000000000..af83b27fec5d82 --- /dev/null +++ b/docs/api/zh/loaders/DataTextureLoader.html @@ -0,0 +1,63 @@ + + + + + + + + + + +

[name]

+ +

+ Abstract base class to load generic binary textures formats (rgbe, hdr, ...). + This uses the [page:FileLoader] internally for loading files, and creates a new + [page:DataTexture]. +

+ +

Examples

+ +

+ See the [link:https://github.com/mrdoob/three.js/blob/master/examples/js/loaders/RGBELoader.js RGBELoader] + for an example of a derived class. +

+ +

Constructor

+ +

[name]( [param:LoadingManager manager] )

+

+ [page:LoadingManager manager] — The [page:LoadingManager loadingManager] for the loader to use. + Default is [page:LoadingManager THREE.DefaultLoadingManager].

+ + Creates a new [name]. +

+ + +

Properties

+ +

[property:LoadingManager manager]

+

+ The [page:LoadingManager loadingManager] the loader is using. Default is [page:DefaultLoadingManager]. +

+ + +

Methods

+ +

[method:null load]( [param:String url], [param:Function onLoad], [param:Function onProgress], [param:Function onError] )

+

+ [page:String url] — the path or URL to the file. This can also be a + [link:https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs Data URI].
+ [page:Function onLoad] — Will be called when load completes. The argument will be the loaded texture.
+ [page:Function onProgress] — Will be called while load progresses. The argument will be the XMLHttpRequest instance, which contains .[page:Integer total] and .[page:Integer loaded] bytes.
+ [page:Function onError] — Will be called when load errors.
+

+

+ Begin loading from url and pass the loaded texture to onLoad. +

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/loaders/FileLoader.html b/docs/api/zh/loaders/FileLoader.html new file mode 100644 index 00000000000000..abe92be14ac57a --- /dev/null +++ b/docs/api/zh/loaders/FileLoader.html @@ -0,0 +1,151 @@ + + + + + + + + + + + +

[name]

+ +

+ A low level class for loading resources with XMLHttpRequest, used internaly by most loaders. + It can also be used directly to load any file type that does not have a loader. +

+ +

Example

+

+ [example:webgl_loader_msgpack WebGL / loader / msgpack]
+ [example:webgl_morphtargets_human WebGL / morphtargets / human]
+

+ + var loader = new THREE.FileLoader(); + + //load a text file and output the result to the console + loader.load( + // resource URL + 'example.txt', + + // onLoad callback + function ( data ) { + // output the text to the console + console.log( data ) + }, + + // onProgress callback + function ( xhr ) { + console.log( (xhr.loaded / xhr.total * 100) + '% loaded' ); + }, + + // onError callback + function ( err ) { + console.error( 'An error happened' ); + } + ); + + +

+ Note: The cache must be enabled using + THREE.Cache.enabled = true; + This is a global property and only needs to be set once to be used by all loaders that use FileLoader internally. + [page:Cache Cache] is a cache module that holds the response from each request made through this loader, so each file is requested once. +

+ + +

Constructor

+ +

[name] ( [param:LoadingManager manager] )

+

+ [page:LoadingManager manager] — The [page:LoadingManager loadingManager] for the loader to use. + Default is [page:DefaultLoadingManager]. +

+ + +

Properties

+ +

[property:LoadingManager manager]

+

+ The [page:LoadingManager loadingManager] the loader is using. Default is [page:DefaultLoadingManager]. +

+ +

[property:String mimeType]

+

+ The expected [link:https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types mimeType]. + See [page:.setMimeType]. Default is *undefined*. +

+ +

[property:String path]

+

The base path from which files will be loaded. See [page:.setPath]. Default is *undefined*.

+ +

[property:object requestHeader]

+

The [link:https://developer.mozilla.org/en-US/docs/Glossary/Request_header request header] used in HTTP request. See [page:.setRequestHeader]. Default is *undefined*.

+ +

[property:String responseType]

+

The expected response type. See [page:.setResponseType]. Default is *undefined*.

+ +

[property:String withCredentials]

+

+ Whether the XMLHttpRequest uses credentials. See [page:.setWithCredentials]. + Default is *undefined*. +

+ + +

Methods

+ +

[method:null load]( [param:String url], [param:Function onLoad], [param:Function onProgress], [param:Function onError] )

+

+ [page:String url] — the path or URL to the file. This can also be a + [link:https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs Data URI].
+ [page:Function onLoad] (optional) — Will be called when loading completes. The argument will be the loaded response.
+ [page:Function onProgress] (optional) — Will be called while load progresses. The argument will be the XMLHttpRequest instance, + which contains .[page:Integer total] and .[page:Integer loaded] bytes.
+ [page:Function onError] (optional) — Will be called if an error occurs.

+ + Load the URL and pass the response to the onLoad function. +

+ +

[method:FileLoader setMimeType]( [param:String mimeType] )

+

+ Set the expected [link:https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types mimeType] + of the file being loaded. Note that in many cases this will be determined automatically, so by default it is *undefined*. +

+ +

[method:FileLoader setPath]( [param:String path] )

+

+ Set the base path or URL from which to load files. This can be useful if + you are loading many models from the same directory. +

+ +

[method:FileLoader setRequestHeader]( [param:object requestHeader] )

+

+ [page:object requestHeader] - key: The name of the header whose value is to be set. value: The value to set as the body of the header.

+ + Set the [link:https://developer.mozilla.org/en-US/docs/Glossary/Request_header request header] used in HTTP request. +

+ +

[method:FileLoader setResponseType]( [param:String responseType] )

+

+ Change the response type. Valid values are:
+ [page:String text] or empty string (default) - returns the data as [page:String string].
+ [page:String arraybuffer] - loads the data into a [link:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer ArrayBuffer] and returns that.
+ [page:String blob] - returns the data as a [link:https://developer.mozilla.org/en/docs/Web/API/Blob Blob].
+ [page:String document] - parses the file using the [link:https://developer.mozilla.org/en-US/docs/Web/API/DOMParser DOMParser].
+ [page:String json] - parses the file using [link:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse JSON.parse].
+

+ +

[method:FileLoader setWithCredentials]( [param:Boolean value] )

+

+ Whether the XMLHttpRequest uses credentials such as cookies, authorization headers or + TLS client certificates. See [link:https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/withCredentials XMLHttpRequest.withCredentials].
+ Note that this has no effect if you are loading files locally or from the same domain. +

+ + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/loaders/FontLoader.html b/docs/api/zh/loaders/FontLoader.html new file mode 100644 index 00000000000000..4dcc23843c8c41 --- /dev/null +++ b/docs/api/zh/loaders/FontLoader.html @@ -0,0 +1,99 @@ + + + + + + + + + + +

[name]

+ +

+ Class for loading a font in JSON format. Returns a [page:Font Font], which is an + array of [page:Shape Shape]s representing the font. + This uses the [page:FileLoader] internally for loading files.

+ + You can convert fonts online using [link:https://gero3.github.io/facetype.js/ facetype.js] +

+ +

Examples

+ +

+ [example:webgl_geometry_text_shapes geometry / text / shapes ]
+ [example:webgl_geometry_text geometry / text ] +

+ + + var loader = new THREE.FontLoader(); + var font = loader.load( + // resource URL + 'fonts/helvetiker_bold.typeface.json', + + // onLoad callback + function ( font ) { + // do something with the font + scene.add( font ); + }, + + // onProgress callback + function ( xhr ) { + console.log( (xhr.loaded / xhr.total * 100) + '% loaded' ); + }, + + // onError callback + function ( err ) { + console.log( 'An error happened' ); + } + ); + + +

Constructor

+ +

[name]( [param:LoadingManager manager] )

+

+ [page:LoadingManager manager] — The [page:LoadingManager loadingManager] for the loader to use. Default is [page:LoadingManager THREE.DefaultLoadingManager].

+ Creates a new [name]. +

+ +

Properties

+ +

[property:LoadingManager manager]

+

+ The [page:LoadingManager loadingManager] the loader is using. Default is [page:DefaultLoadingManager]. +

+ +

[property:String path]

+

The base path from which fonts will be loaded. See [page:.setPath]. Default is *undefined*.

+ +

Methods

+ +

[method:null load]( [param:String url], [param:Function onLoad], [param:Function onProgress], [param:Function onError] )

+

+ [page:String url] — the path or URL to the file. This can also be a + [link:https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs Data URI].
+ [page:Function onLoad] — Will be called when load completes. The argument will be the loaded [page:Texture texture].
+ [page:Function onProgress] — Will be called while load progresses. The argument will be the XMLHttpRequest instance, which contains .[page:Integer total] and .[page:Integer loaded] bytes.
+ [page:Function onError] — Will be called when load errors.

+ + Begin loading from url and pass the loaded [page:Texture texture] to onLoad. +

+ +

[method:Font parse]( [param:Object json] )

+

+ [page:Object json] — The JSON structure to parse.

+ Parse a JSON structure and return a [page:Font]. +

+ +

[method:FontLoader setPath]( [param:String path] )

+

+ Set the base path or URL from which to load fonts. This can be useful if + you are loading many fonts from the same directory. +

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/loaders/ImageBitmapLoader.html b/docs/api/zh/loaders/ImageBitmapLoader.html new file mode 100644 index 00000000000000..d54fc9f84660f0 --- /dev/null +++ b/docs/api/zh/loaders/ImageBitmapLoader.html @@ -0,0 +1,106 @@ + + + + + + + + + + +

[name]

+ +

+ A loader for loading an [page:Image] as an [link:https://developer.mozilla.org/de/docs/Web/API/ImageBitmap ImageBitmap]. + An ImageBitmap provides an asynchronous and resource efficient pathway to prepare textures for rendering in WebGL.
+ Unlike [page:FileLoader], [name] does not avoid multiple concurrent requests to the same URL. +

+ +

Example

+ +

+ [example:webgl_loader_imagebitmap WebGL / loader / ImageBitmap] +

+ + + // instantiate a loader + var loader = new THREE.ImageBitmapLoader(); + + // load a image resource + loader.load( + // resource URL + 'textures/skyboxsun25degtest.png', + + // onLoad callback + function ( imageBitmap ) { + var texture = new THREE.CanvasTexture( imageBitmap ); + var material = new THREE.MeshBasicMaterial( { map: texture } ); + }, + + // onProgress callback currently not supported + undefined, + + // onError callback + function ( err ) { + console.log( 'An error happened' ); + } + ); + + + +

Constructor

+ +

[name]( [param:LoadingManager manager] )

+

+ [page:LoadingManager manager] — The [page:LoadingManager loadingManager] for the loader to use. Default is [page:LoadingManager THREE.DefaultLoadingManager].

+ + Creates a new [name]. +

+ +

Properties

+ +

[property:LoadingManager manager]

+

+ The [page:LoadingManager loadingManager] the loader is using. Default is [page:DefaultLoadingManager]. +

+ +

[property:String options]

+

An optional object that sets options for the internally used [link:https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/createImageBitmap createImageBitmap] factory method. Default is *undefined*.

+ +

[property:String path]

+

The base path from which files will be loaded. See [page:.setPath]. Default is *undefined*.

+ +

Methods

+ +

[method:null load]( [param:String url], [param:Function onLoad], [param:Function onProgress], [param:Function onError] )

+

+ [page:String url] — the path or URL to the file. This can also be a + [link:https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs Data URI].
+ [page:Function onLoad] — Will be called when load completes. The argument will be the loaded [page:Image image].
+ [page:Function onProgress] — This callback function is currently not supported.
+ [page:Function onError] — Will be called when load errors.
+

+

+ Begin loading from url and return the [page:ImageBitmap image] object that will contain the data. +

+ +

[method:ImageBitmapLoader setCrossOrigin]()

+

This method exists for compatibility reasons and implements no logic. It ensures that [name] has a similar interface like [page:ImageLoader].

+ +

[method:ImageBitmapLoader setOptions]( [param:Object options] )

+

+ Sets the options object for [link:https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/createImageBitmap createImageBitmap]. +

+ +

[method:ImageBitmapLoader setPath]( [param:String path] )

+

+ Sets the base path or URL from which to load files. This can be useful if + you are loading many images from the same directory. +

+ + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/loaders/ImageLoader.html b/docs/api/zh/loaders/ImageLoader.html new file mode 100644 index 00000000000000..eecf34bb76e46d --- /dev/null +++ b/docs/api/zh/loaders/ImageLoader.html @@ -0,0 +1,110 @@ + + + + + + + + + + +

[name]

+ +

+ A loader for loading an [page:Image]. + This uses the [page:FileLoader] internally for loading files, and is used internally by the + [page:CubeTextureLoader], [page:ObjectLoader] and [page:TextureLoader]. +

+ +

Example

+ +

+ [example:webgl_loader_obj WebGL / loader / obj]
+ [example:webgl_shaders_ocean WebGL / shaders / ocean] +

+ + + // instantiate a loader + var loader = new THREE.ImageLoader(); + + // load a image resource + loader.load( + // resource URL + 'textures/skyboxsun25degtest.png', + + // onLoad callback + function ( image ) { + // use the image, e.g. draw part of it on a canvas + var canvas = document.createElement( 'canvas' ); + var context = canvas.getContext( '2d' ); + context.drawImage( image, 100, 100 ); + }, + + // onProgress callback currently not supported + undefined, + + // onError callback + function () { + console.error( 'An error happened.' ); + } + ); + + +

+ Please note three.js r84 dropped support for ImageLoader progress events. For an ImageLoader + that supports progress events, see [link:https://github.com/mrdoob/three.js/issues/10439#issuecomment-275785639 this thread]. +

+ +

Constructor

+ +

[name]( [param:LoadingManager manager] )

+

+ [page:LoadingManager manager] — The [page:LoadingManager loadingManager] for the loader to use. Default is [page:LoadingManager THREE.DefaultLoadingManager].

+ + Creates a new [name]. +

+ +

Properties

+ +

[property:String crossOrigin]

+

+ If set, assigns the [link:https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes crossOrigin] + attribute of the image to the value of *crossOrigin*, prior to starting the load. Default is *"anonymous"*. +

+ +

[property:LoadingManager manager]

+

+ The [page:LoadingManager loadingManager] the loader is using. Default is [page:DefaultLoadingManager]. +

+ +

[property:String path]

+

The base path from which files will be loaded. See [page:.setPath]. Default is *undefined*.

+ +

Methods

+ +

[method:null load]( [param:String url], [param:Function onLoad], [param:Function onProgress], [param:Function onError] )

+

+ [page:String url] — the path or URL to the file. This can also be a + [link:https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs Data URI].
+ [page:Function onLoad] — Will be called when load completes. The argument will be the loaded [page:Image image].
+ [page:Function onProgress] — This callback function is currently not supported.
+ [page:Function onError] — Will be called when load errors.
+

+

+ Begin loading from url and return the [page:Image image] object that will contain the data. +

+ +

[method:null setCrossOrigin]( [param:String value] )

+

Set the [page:.crossOrigin] attribute.

+ +

[method:FileLoader setPath]( [param:String path] )

+

+ Set the base path or URL from which to load files. This can be useful if + you are loading many images from the same directory. +

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/loaders/JSONLoader.html b/docs/api/zh/loaders/JSONLoader.html new file mode 100644 index 00000000000000..c6a0d3c780cfa4 --- /dev/null +++ b/docs/api/zh/loaders/JSONLoader.html @@ -0,0 +1,119 @@ + + + + + + + + + + +

[name]

+ +

+ A loader for loading objects in JSON format. + This uses the [page:FileLoader] internally for loading files. +

+ +

Example

+ +

+ [example:webgl_loader_json WebGL / loader / json]
+ [example:webgl_loader_json_objconverter WebGL / loader / json / objconverter] +

+ + + // instantiate a loader + var loader = new THREE.JSONLoader(); + + // load a resource + loader.load( + // resource URL + 'models/animated/monster/monster.js', + + // onLoad callback + function ( geometry, materials ) { + var material = materials[ 0 ]; + var object = new THREE.Mesh( geometry, material ); + scene.add( object ); + }, + + // onProgress callback + function ( xhr ) { + console.log( (xhr.loaded / xhr.total * 100) + '% loaded' ); + }, + + // onError callback + function( err ) { + console.log( 'An error happened' ); + } + ); + + +

Constructor

+ +

[name]( [param:LoadingManager manager] )

+

+ [page:LoadingManager manager] — The [page:LoadingManager loadingManager] for the loader to use. Default is [page:LoadingManager THREE.DefaultLoadingManager]. +

+

+ Creates a new [name]. +

+ +

Properties

+ +

[property:String crossOrigin]

+

+ If set, assigns the [link:https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes crossOrigin] + attribute of the image to the value of *crossOrigin*, prior to starting the load. Default is *"anonymous"*. +

+ +

[property:LoadingManager manager]

+

+ The [page:LoadingManager loadingManager] the loader is using. Default is [page:DefaultLoadingManager]. +

+ +

[property:String withCredentials]

+

+ Whether the XMLHttpRequest uses credentials. + Default is *false*. +

+ +

Methods

+ +

[method:null load]( [param:String url], [param:Function onLoad], [param:Function onProgress], [param:Function onError] )

+

+ [page:String url] — the path or URL to the file. This can also be a + [link:https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs Data URI]..
+ [page:Function onLoad] — Will be called when load completes. The argument will be the loaded text response.
+ [page:Function onProgress] — Will be called while load progresses. The argument will be the XMLHttpRequest instance, which contains .[page:Integer total] and .[page:Integer loaded] bytes.
+ [page:Function onError] — Will be called when load errors.
+

+

+ Begin loading from url and pass the JSON to onLoad. +

+ +

[method:JSONLoader setCrossOrigin]( [param:String value] )

+

+ Set the [page:.crossOrigin] attribute. +

+ +

[method:JSONLoader setTexturePath]( [param:String texturePath] )

+

+ Set the base path or URL from which to load files. This can be useful if + you are loading many files from the same directory. +

+ +

[method:Object3D parse]( [param:Object json], [param:String texturePath] )

+

+ [page:String json] — JSON object to parse.
+ [page:String texturePath] — Base path for textures.

+ + Parse a JSON structure and return an [page:object] containing the parsed [page:Geometry geometry] and [page:Array materials]. +

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/loaders/Loader.html b/docs/api/zh/loaders/Loader.html new file mode 100644 index 00000000000000..21c8482ffb2982 --- /dev/null +++ b/docs/api/zh/loaders/Loader.html @@ -0,0 +1,70 @@ + + + + + + + + + + +

[name]

+ +

Base class for implementing loaders.

+ + +

Constructor

+ + +

[name]()

+

+ Creates a new [name]. This should be called as base class. +

+ + +

Properties

+ +

[property:Function onLoadStart]

+

Will be called when load starts.

+

The default is a function with empty body.

+ +

[property:Function onLoadProgress]

+

Will be called while load progresses.

+

The default is a function with empty body.

+ +

[property:Function onLoadComplete]

+

Will be called when load completes.

+

The default is a function with empty body.

+ +

[property:string crossOrigin]

+

+ The crossOrigin string to implement CORS for loading the url from a different domain that allows CORS. + Default is *"anonymous"*. +

+ +

Methods

+ +

[method:Material createMaterial]( [param:object m], [param:string texturePath] )

+

+ [page:Object m] — The parameters to create the material.
+ [page:String texturePath] — The base path of the textures. +

+

+ Creates the Material based on the parameters m. +

+ +

[method:Array initMaterials]( [param:Array materials], [param:string texturePath] )

+

+ [page:Array materials] — an array of parameters to create materials.
+ [page:String texturePath] — The base path of the textures. +

+

+ Creates an array of [page:Material] based on the array of parameters m. The index of the parameters decide the correct index of the materials. +

+ + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/loaders/LoaderUtils.html b/docs/api/zh/loaders/LoaderUtils.html new file mode 100644 index 00000000000000..05df4cf0888d82 --- /dev/null +++ b/docs/api/zh/loaders/LoaderUtils.html @@ -0,0 +1,38 @@ + + + + + + + + + + +

[name]

+ +

An object with several loader utility functions.

+ +

Functions

+ +

[method:String decodeText]( [param:TypedArray array] )

+

+ [page:TypedArray array] — A stream of bytes as a typed array. +

+

+ The function takes a stream of bytes as input and returns a string representation. +

+ +

[method:String extractUrlBase]( [param:string url] )

+

+ [page:String url] — The url to extract the base url from. +

+

+ Extract the base from the URL. +

+ + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/loaders/MaterialLoader.html b/docs/api/zh/loaders/MaterialLoader.html new file mode 100644 index 00000000000000..b931c50591b351 --- /dev/null +++ b/docs/api/zh/loaders/MaterialLoader.html @@ -0,0 +1,98 @@ + + + + + + + + + + +

[name]

+ +

+ A loader for loading a [page:Material] in JSON format. + This uses the [page:FileLoader] internally for loading files. +

+ +

Example

+ + + + // instantiate a loader + var loader = new THREE.MaterialLoader(); + + // load a resource + loader.load( + // resource URL + 'path/to/material.json', + + // onLoad callback + function ( material ) { + object.material = material; + }, + + // onProgress callback + function ( xhr ) { + console.log( (xhr.loaded / xhr.total * 100) + '% loaded' ); + }, + + // onError callback + function ( err ) { + console.log( 'An error happened' ); + } + ); + + + +

Constructor

+ +

[name]( [param:LoadingManager manager] )

+

+ [page:LoadingManager manager] — The [page:LoadingManager loadingManager] for the loader to use. Default is [page:LoadingManager THREE.DefaultLoadingManager].

+ Creates a new [name]. +

+ +

Properties

+ +

[property:LoadingManager manager]

+

+ The [page:LoadingManager loadingManager] the loader is using. Default is [page:DefaultLoadingManager]. +

+ +

[property:Object textures]

+

Object holding any textures used by the material. See [page:.setTextures].

+ + +

Methods

+ +

[method:null load]( [param:String url], [param:Function onLoad], [param:Function onProgress], [param:Function onError] )

+

+ [page:String url] — the path or URL to the file. This can also be a + [link:https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs Data URI].
+ [page:Function onLoad] — Will be called when load completes. The argument will be the loaded [page:Material].
+ [page:Function onProgress] — Will be called while load progresses. The argument will be the progress event.
+ [page:Function onError] — Will be called when load errors.

+ + Begin loading from url and return the [page:Material] object that will contain the data. +

+ +

[method:Material parse]( [param:Object json] )

+

+ [page:Object json] — The json object containing the parameters of the Material.

+ + Parse a JSON structure and create a new [page:Material] of the type [page:String json.type] with parameters defined in the json object. +

+ +

[method:null setTextures]( [param:Object textures] )

+

+ [page:Object textures] — object containing any textures used by the material. +

+ + + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/loaders/ObjectLoader.html b/docs/api/zh/loaders/ObjectLoader.html new file mode 100644 index 00000000000000..95a7c0f2e40262 --- /dev/null +++ b/docs/api/zh/loaders/ObjectLoader.html @@ -0,0 +1,231 @@ + + + + + + + + + + +

[name]

+ +

+ A loader for loading a JSON resource. Unlike the [page:JSONLoader], this one make use of the + .type attributes of objects to map them to their original classes.

+ + Note that this loader can't load [page:Geometries]. Use [page:JSONLoader] instead for that.

+ + This uses the [page:FileLoader] internally for loading files. +

+ +

Example

+ +

+ + [example:webgl_animation_scene WebGL / animation / scene]
+ [example:webgl_loader_json_claraio WebGL / loader / json / claraio]
+ [example:webgl_loader_msgpack WebGL / loader / msgpack] +

+ + + var loader = new THREE.ObjectLoader(); + + loader.load( + // resource URL + "models/json/example.json", + + // onLoad callback + // Here the loaded data is assumed to be an object + function ( obj ) { + // Add the loaded object to the scene + scene.add( obj ); + }, + + // onProgress callback + function ( xhr ) { + console.log( (xhr.loaded / xhr.total * 100) + '% loaded' ); + }, + + // onError callback + function ( err ) { + console.error( 'An error happened' ); + } + ); + + + // Alternatively, to parse a previously loaded JSON structure + var object = loader.parse( a_json_object ); + + scene.add( object ); + + + + +

Constructor

+ +

[name]( [param:LoadingManager manager] )

+

+ [page:LoadingManager manager] — The [page:LoadingManager loadingManager] for the loader to use. Default is [page:LoadingManager THREE.DefaultLoadingManager].

+ + Creates a new [name]. +

+ + +

Properties

+ +

[property:String crossOrigin]

+

+ If set, assigns the [link:https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes crossOrigin] + attribute of the image to the value of *crossOrigin*, prior to starting the load. Default is *"anonymous"*. +

+ +

[property:LoadingManager manager]

+

+ The [page:LoadingManager loadingManager] the loader is using. Default is [page:DefaultLoadingManager]. +

+ +

[property:String texturePath]

+

+ The base path or URL from which textures will be loaded. See [page:.setTexturePath]. + Default is the empty string. +

+ +

Methods

+ +

[method:null load]( [param:String url], [param:Function onLoad], [param:Function onProgress], [param:Function onError] )

+

+ [page:String url] — the path or URL to the file. This can also be a + [link:https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs Data URI].
+ [page:Function onLoad] — Will be called when load completes. The argument will be the loaded [page:Object3D object].
+ [page:Function onProgress] — Will be called while load progresses. The argument will be the XMLHttpRequest instance, which contains .[page:Integer total] and .[page:Integer loaded] bytes.
+ [page:Function onError] — Will be called when load errors.
+

+

+ Begin loading from url and call onLoad with the parsed response content. +

+ + +

[method:Object3D parse]( [param:Object json], [param:Function onLoad] )

+

+ [page:Object json] — required. The JSON source to parse.

+ [page:Function onLoad] — Will be called when parsed completes. The argument will be the parsed [page:Object3D object].

+ + Parse a JSON structure and return a threejs object. + This is used internally by [page:.load], but can also be used directly to parse + a previously loaded JSON structure. +

+ +

[method:Object3D parseGeometries]( [param:Object json] )

+

+ [page:Object json] — required. The JSON source to parse.

+ + This is used [page:.parse] to parse any [page:Geometry geometries] or [page:BufferGeometry buffer geometries] in the JSON structure. + Internally it uses [page:JSONLoader] for geometries and [page:BufferGeometryLoader] for buffer geometries. +

+ +

[method:Object3D parseMaterials]( [param:Object json] )

+

+ [page:Object json] — required. The JSON source to parse.

+ + This is used [page:.parse] to parse any materials in the JSON structure using [page:MaterialLoader]. +

+ +

[method:Object3D parseAnimations]( [param:Object json] )

+

+ [page:Object json] — required. The JSON source to parse.

+ + This is used [page:.parse] to parse any animations in the JSON structure, using [page:AnimationClip.parse]. +

+ +

[method:Object3D parseImages]( [param:Object json] )

+

+ [page:Object json] — required. The JSON source to parse.

+ + This is used [page:.parse] to parse any images in the JSON structure, using [page:ImageLoader]. +

+ +

[method:Object3D parseTextures]( [param:Object json] )

+

+ [page:Object json] — required. The JSON source to parse.

+ + This is used [page:.parse] to parse any textures in the JSON structure. +

+ +

[method:Object3D parseObject]( [param:Object json] )

+

+ [page:Object json] — required. The JSON source to parse.

+ + This is used [page:.parse] to parse any objects in the JSON structure. + Objects can be of the following types: + +

    +
  • + [page:Scene] +
  • +
  • + [page:PerspectiveCamera] +
  • +
  • + [page:OrthographicCamera] +
  • +
  • + [page:AmbientLight] +
  • +
  • + [page:DirectionalLight] +
  • +
  • + [page:PointLight] +
  • +
  • + [page:SpotLight] +
  • +
  • + [page:HemisphereLight] +
  • +
  • + [page:Mesh] +
  • +
  • + [page:LOD] +
  • +
  • + [page:Line] +
  • +
  • + [page:LineSegments] +
  • +
  • + [page:Points] +
  • +
  • + [page:Sprite] +
  • +
  • + [page:Group] +
  • +
  • + [page:Object3D] +
  • + +
+

+ +

[method:ObjectLoader setCrossOrigin]( [param:String value] )

+

+ [page:String value] — The crossOrigin string to implement CORS for loading the url from a different domain that allows CORS. +

+ +

[method:ObjectLoader setTexturePath]( [param:String value] )

+

+ [page:String value] — The base path or URL from which textures will be loaded.

+ + +

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/loaders/TextureLoader.html b/docs/api/zh/loaders/TextureLoader.html new file mode 100644 index 00000000000000..867ef79a351491 --- /dev/null +++ b/docs/api/zh/loaders/TextureLoader.html @@ -0,0 +1,116 @@ + + + + + + + + + + +

[name]

+ +

+ Class for loading a [page:Texture texture]. + This uses the [page:ImageLoader] internally for loading files. +

+ +

Example

+ + + var texture = new THREE.TextureLoader().load( 'textures/land_ocean_ice_cloud_2048.jpg' ); + + // immediately use the texture for material creation + var material = new THREE.MeshBasicMaterial( { map: texture } ); + + + [example:webgl_geometry_cube geometry / cube] + +

Example with Callbacks

+ + + // instantiate a loader + var loader = new THREE.TextureLoader(); + + // load a resource + loader.load( + // resource URL + 'textures/land_ocean_ice_cloud_2048.jpg', + + // onLoad callback + function ( texture ) { + // in this example we create the material when the texture is loaded + var material = new THREE.MeshBasicMaterial( { + map: texture + } ); + }, + + // onProgress callback currently not supported + undefined, + + // onError callback + function ( err ) { + console.error( 'An error happened.' ); + } + ); + + + Please note three.js r84 dropped support for TextureLoader progress events. For a TextureLoader that supports progress events, see [link:https://github.com/mrdoob/three.js/issues/10439#issuecomment-293260145 this thread]. + +

Constructor

+ +

[name]( [param:LoadingManager manager] )

+

+ [page:LoadingManager manager] — The [page:LoadingManager loadingManager] for the loader to use. Default is [page:LoadingManager THREE.DefaultLoadingManager].

+ + Creates a new [name]. +

+ + +

Properties

+ +

[property:String crossOrigin]

+

+ If set, assigns the [link:https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes crossOrigin] + attribute of the image to the value of *crossOrigin*, prior to starting the load. Default is *"anonymous"*. +

+ + +

[property:LoadingManager manager]

+

+ The [page:LoadingManager loadingManager] the loader is using. Default is [page:DefaultLoadingManager]. +

+ +

[property:String path]

+

The base path from which files will be loaded. See [page:.setPath]. Default is *undefined*.

+ + +

Methods

+ +

[method:Texture load]( [param:String url], [param:Function onLoad], [param:Function onProgress], [param:Function onError] )

+

+ [page:String url] — the path or URL to the file. This can also be a + [link:https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs Data URI].
+ [page:Function onLoad] — Will be called when load completes. The argument will be the loaded [page:Texture texture].
+ [page:Function onProgress] — Will be called while load progresses. The argument will be the XMLHttpRequest instance, which contains .[page:Integer total] and .[page:Integer loaded] bytes.
+ [page:Function onError] — Will be called when load errors.

+ + Begin loading from the given URL and pass the fully loaded [page:Texture texture] to onLoad. The method also returns a new texture object which can directly be used for material creation. + If you do it this way, the texture may pop up in your scene once the respective loading process is finished. +

+ +

[method:null setCrossOrigin]( [param:String value] )

+

Set the [page:.crossOrigin] attribute.

+ +

[method:FileLoader setPath]( [param:String path] )

+

+ Set the base path or URL from which to load files. This can be useful if + you are loading many models from the same directory. +

+ + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/loaders/managers/DefaultLoadingManager.html b/docs/api/zh/loaders/managers/DefaultLoadingManager.html new file mode 100644 index 00000000000000..f608c7e1ec04b2 --- /dev/null +++ b/docs/api/zh/loaders/managers/DefaultLoadingManager.html @@ -0,0 +1,71 @@ + + + + + + + + + + +

[name]

+ +

A global instance of the [page:LoadingManager LoadingManager], used by most loaders + when no custom manager has been specified.

+ + This will be sufficient for most purposes, however there may be times when you desire seperate loading managers + for say, textures and models. +

+ +

Example

+ +

+ You can optionally set the [page:LoadingManager.onStart onStart], [page:LoadingManager.onLoad onLoad], + [page:LoadingManager.onProgress onProgress], [page:LoadingManager.onStart onError] functions for the manager. + These will then apply to any loaders using the DefaultLoadingManager.

+ + Note that these shouldn't be confused with the similarly named functions of individual loaders, + as they are intended for displaying information about the overall status of loading, + rather than dealing with the data that has been loaded. +

+ +THREE.DefaultLoadingManager.onStart = function ( url, itemsLoaded, itemsTotal ) { + + console.log( 'Started loading file: ' + url + '.\nLoaded ' + itemsLoaded + ' of ' + itemsTotal + ' files.' ); + +}; + +THREE.DefaultLoadingManager.onLoad = function ( ) { + + console.log( 'Loading Complete!'); + +}; + + +THREE.DefaultLoadingManager.onProgress = function ( url, itemsLoaded, itemsTotal ) { + + console.log( 'Loading file: ' + url + '.\nLoaded ' + itemsLoaded + ' of ' + itemsTotal + ' files.' ); + +}; + +THREE.DefaultLoadingManager.onError = function ( url ) { + + console.log( 'There was an error loading ' + url ); + +}; + + + +

Properties

+ +

See the [page:LoadingManager LoadingManager] page for details of properties.

+ +

Methods

+ +

See the [page:LoadingManager LoadingManager] page for details of methods.

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/loaders/LoadingManager.js src/loaders/LoadingManager.js] + + diff --git a/docs/api/zh/loaders/managers/LoadingManager.html b/docs/api/zh/loaders/managers/LoadingManager.html new file mode 100644 index 00000000000000..034baa13a21c34 --- /dev/null +++ b/docs/api/zh/loaders/managers/LoadingManager.html @@ -0,0 +1,213 @@ + + + + + + + + + + +

[name]

+ +

+ Handles and keeps track of loaded and pending data. A default global instance of this class + is created and used by loaders if not supplied manually - see [page:DefaultLoadingManager].

+ + In general that should be sufficient, however there are times when it can be useful to have seperate loaders - + for example if you want to show seperate loading bars for objects and textures. + +

+ + +

Example

+ +

+ [example:webgl_loader_babylon WebGL / loader / babylon]
+ [example:webgl_loader_fbx WebGL / loader / fbx]
+ [example:webgl_loader_obj WebGL / loader / obj]
+ [example:webgl_materials_reflectivity WebGL / materials / reflectivity]
+ [example:webgl_postprocessing_outline WebGL / postprocesing / outline]
+ [example:webgl_terrain_dynamic WebGL / terrain / dynamic] +

+ +

+ This example shows how to use LoadingManager to track the progress of + [page:OBJLoader]. +

+ + + var manager = new THREE.LoadingManager(); + manager.onStart = function ( url, itemsLoaded, itemsTotal ) { + + console.log( 'Started loading file: ' + url + '.\nLoaded ' + itemsLoaded + ' of ' + itemsTotal + ' files.' ); + + }; + + manager.onLoad = function ( ) { + + console.log( 'Loading complete!'); + + }; + + + manager.onProgress = function ( url, itemsLoaded, itemsTotal ) { + + console.log( 'Loading file: ' + url + '.\nLoaded ' + itemsLoaded + ' of ' + itemsTotal + ' files.' ); + + }; + + manager.onError = function ( url ) { + + console.log( 'There was an error loading ' + url ); + + }; + + var loader = new THREE.OBJLoader( manager ); + loader.load( 'file.obj', function ( object ) { + + // + + } ); + + +

+ In addition to observing progress, a LoadingManager can be used to + override resource URLs during loading. This may be helpful for assets + coming from drag-and-drop events, WebSockets, WebRTC, or other APIs. An + example showing how to load an in-memory model using Blob URLs is below. +

+ + + // Blob or File objects created when dragging files into the webpage. + var blobs = {'fish.gltf': blob1, 'diffuse.png': blob2, 'normal.png': blob3}; + + var manager = new THREE.LoadingManager(); + + // Initialize loading manager with URL callback. + var objectURLs = []; + manager.setURLModifier( ( url ) => { + + url = URL.createObjectURL( blobs[ url ] ); + + objectURLs.push( url ); + + return url; + + } ); + + // Load as usual, then revoke the blob URLs. + var loader = new THREE.GLTFLoader( manager ); + loader.load( 'fish.gltf', (gltf) => { + + scene.add( gltf.scene ); + + objectURLs.forEach( ( url ) => URL.revokeObjectURL( url ) ); + + }); + + +

Constructor

+ +

[name]( [param:Function onLoad], [param:Function onProgress], [param:Function onError] )

+

+ [page:Function onLoad] — (optional) this function will be called when all loaders are done.
+ [page:Function onProgress] — (optional) this function will be called when an item is complete.
+ [page:Function onError] — (optional) this function will be called a loader encounters errors.
+ + Creates a new [name]. +

+ + +

Properties

+ +

[property:Function onStart]

+

+ This function will be called when loading starts. + The arguments are:
+ [page:String url] — The url of the item just loaded.
+ [page:Integer itemsLoaded] — the number of items already loaded so far.
+ [page:Iteger itemsTotal] — the total amount of items to be loaded.

+ + By default this is undefined. +

+ +

[property:Function onLoad]

+

+ This function will be called when all loading is completed. By default this is undefined, + unless passed in the constructor. +

+ +

[property:Function onProgress]

+

+ This function will be called when an item is complete. + The arguments are:
+ [page:String url] — The url of the item just loaded.
+ [page:Integer itemsLoaded] — the number of items already loaded so far.
+ [page:Iteger itemsTotal] — the total amount of items to be loaded.

+ + By default this is undefined, unless passed in the constructor. +

+ +

[property:Function onError]

+

+ This function will be called when any item errors, with the argument:
+ [page:String url] — The url of the item that errored.

+ + By default this is undefined, unless passed in the constructor. +

+ + +

Methods

+ +

[method:null setURLModifier]( [param:Function callback] )

+

+ [page:Function callback] — URL modifier callback. Called with [page:String url] argument, and + must return [page:String resolvedURL].

+ + If provided, the callback will be passed each resource URL before a request is sent. The + callback may return the original URL, or a new URL to override loading behavior. This + behavior can be used to load assets from .ZIP files, drag-and-drop APIs, and Data URIs. +

+ +

[method:String resolveURL]( [param:String url] )

+

+ [page:String url] — the url to load

+ + Given a URL, uses the URL modifier callback (if any) and returns a resolved URL. If no + URL modifier is set, returns the original URL. +

+ +

+

+ Note: The following methods are designed to be called internally by loaders. You shouldn't call + them directly. +

+ +

[method:null itemStart]( [param:String url] )

+

+ [page:String url] — the url to load

+ + This should be called by any loader using the manager when the loader starts loading an url. +

+ +

[method:null itemEnd]( [param:String url] )

+

+ [page:String url] — the loaded url

+ + This should be called by any loader using the manager when the loader ended loading an url. +

+ + +

[method:null itemError]( [param:String url] )

+

+ [page:String url] — the loaded url

+ + This should be called by any loader using the manager when the loader errors loading an url. +

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/loaders/LoadingManager.js src/loaders/LoadingManager.js] + + diff --git a/docs/api/zh/materials/LineBasicMaterial.html b/docs/api/zh/materials/LineBasicMaterial.html new file mode 100644 index 00000000000000..23ecb4dfd0bae5 --- /dev/null +++ b/docs/api/zh/materials/LineBasicMaterial.html @@ -0,0 +1,95 @@ + + + + + + + + + + + [page:Material] → + +

基础线条材质([name])

+ +

一种用于绘制线框样式几何体的材质。

+ +

例子(Examples)

+ +

+ [example:webgl_buffergeometry_drawcalls WebGL / buffergeometry / drawcalls]
+ [example:webgl_buffergeometry_lines WebGL / buffergeometry / lines]
+ [example:webgl_buffergeometry_lines_indexed WebGL / buffergeometry / lines / indexed]
+ [example:webgl_decals WebGL / decals]
+ [example:webgl_geometry_nurbs WebGL / geometry / nurbs]
+ [example:webgl_geometry_shapes WebGL / geometry / shapes]
+ [example:webgl_geometry_spline_editor WebGL / geometry / spline / editor]
+ [example:webgl_interactive_buffergeometry WebGL / interactive / buffergeometry]
+ [example:webgl_interactive_voxelpainter WebGL / interactive / voxelpainter]
+ [example:webgl_lines_colors WebGL / lines / colors]
+ [example:webgl_lines_dashed WebGL / lines / dashed]
+ [example:webgl_lines_sphere WebGL / lines / sphere]
+ [example:webgl_lines_splines WebGL / lines / splines]
+ [example:webgl_materials WebGL / materials]
+ [example:webgl_physics_rope WebGL / phyics / rope] +

+ + +var material = new THREE.LineBasicMaterial( { + color: 0xffffff, + linewidth: 1, + linecap: 'round', //ignored by WebGLRenderer + linejoin: 'round' //ignored by WebGLRenderer +} ); + + +

构造函数(Constructor)

+ +

[name]( [param:Object parameters] )

+ +

+ [page:Object parameters] - (可选)用于定义材质外观的对象,具有一个或多个属性。材质的任何属性都可以从此处传入(包括从[page:Material]继承的任何属性)。

+ 属性[page:Hexadecimal color]例外,其可以作为十六进制字符串传递,默认情况下为 *0xffffff*(白色),内部调用[page:Color.set](color)。 +

+ +

属性(Properties)

+

常用属性请参见基类[page:Material]。

+ +

[property:Color color]

+

材质的颜色([page:Color]),默认值为白色 (0xffffff)。

+ +

[property:Boolean isLineBasicMaterial]

+

用于检查此类或派生类是否为基础线条材质。默认值为 *true*。

+ 因为其通常用在内部优化,所以不应该更改该属性值。 +

+ +

[property:Boolean lights]

+

材质是否受到光照的影响。默认值为 *false*。

+ +

[property:Float linewidth]

+

控制线宽。默认值为 *1*。

+ 由于[link:https://www.khronos.org/registry/OpenGL/specs/gl/glspec46.core.pdf OpenGL Core Profile]与 + 大多数平台上[page:WebGLRenderer WebGL]渲染器的限制,无论如何设置该值,线宽始终为1。 +

+ +

[property:String linecap]

+

定义线两端的样式。可选值为 'butt', 'round' 和 'square'。默认值为 'round'。

+ 该属性对应[link:https://developer.mozilla.org/en/docs/Web/API/CanvasRenderingContext2D/lineCap 2D Canvas lineCap]属性, + 并且会被[page:WebGLRenderer WebGL]渲染器忽略。 +

+ +

[property:String linejoin]

+

定义线连接节点的样式。可选值为 'round', 'bevel' 和 'miter'。默认值为 'round'。

+ 该属性对应[link:https://developer.mozilla.org/en/docs/Web/API/CanvasRenderingContext2D/lineJoin 2D Canvas lineJoin]属性, + 并且会被[page:WebGLRenderer WebGL]渲染器忽略。 +

+ + +

方法(Methods)

+

常用方法请参见基类[page:Material]。

+ +

源码(Source)

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/materials/LineDashedMaterial.html b/docs/api/zh/materials/LineDashedMaterial.html new file mode 100644 index 00000000000000..f52d630b150f07 --- /dev/null +++ b/docs/api/zh/materials/LineDashedMaterial.html @@ -0,0 +1,85 @@ + + + + + + + + + + + [page:Material] → + +

虚线材质([name])

+ +

一种用于绘制虚线样式几何体的材质。

+ +

例子(Examples)

+ +

+ [example:webgl_lines_dashed WebGL / lines / dashed]
+ [example:canvas_lines_dashed Canvas / lines /dashed] +

+ + +var material = new THREE.LineDashedMaterial( { + color: 0xffffff, + linewidth: 1, + scale: 1, + dashSize: 3, + gapSize: 1, +} ); + + +

构造函数(Constructor)

+ + +

[name]( [param:Object parameters] )

+

+ [page:Object parameters] - (可选)用于定义材质外观的对象,具有一个或多个属性。材质的任何属性都可以从此处传入(包括从[page:Material]继承的任何属性)。

+ 属性[page:Hexadecimal color]例外,其可以作为十六进制字符串传递,默认情况下为 *0xffffff*(白色),内部调用[page:Color.set](color)。 +

+ + +

属性(Properties)

+

常用属性请参见基类[page:Material]。

+ +

[property:Color color]

+

材质的颜色([page:Color]),默认值为白色 (0xffffff)。

+ +

[property:number dashSize]

+

虚线的大小,是指破折号和间隙之和。默认值为 *3*。

+ +

[property:number gapSize]

+

间隙的大小,默认值为 *1*。

+ +

[property:Boolean isLineDashedMaterial]

+

用于检查此类或派生类是否为虚线材质。默认值为 *true*。

+ + 因为其通常用在内部优化,所以不应该更改该属性值。 +

+ +

[property:Boolean lights]

+

材质是否受到光照的影响。默认值为 *false*。

+ +

[property:Float linewidth]

+

+ 控制线宽。默认值为 *1*。

+ + 由于[link:https://www.khronos.org/registry/OpenGL/specs/gl/glspec46.core.pdf OpenGL Core Profile]与 + 大多数平台上[page:WebGLRenderer WebGL]渲染器的限制,无论如何设置该值,线宽始终为1。 +

+ +

[property:number scale]

+

线条中虚线部分的占比。默认值为 *1*。

+ +

方法(Methods)

+

常用方法请参见基类[page:Material]。

+ + + +

源码(Source)

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/materials/Material.html b/docs/api/zh/materials/Material.html new file mode 100644 index 00000000000000..f78dfafd0a62b3 --- /dev/null +++ b/docs/api/zh/materials/Material.html @@ -0,0 +1,276 @@ + + + + + + + + + + +

材质([name])

+ +

材质的抽象基类。

+ 材质描述了对象[page:Object objects]的外观。它们的定义方式与渲染器无关, + 因此,如果您决定使用不同的渲染器,不必重写材质。

+ 所有其他材质类型都继承了以下属性和方法(尽管它们可能具有不同的默认值)。 +

+ +

构造函数(Constructor)

+ + +

[name]()

+

该方法创建一个通用材质。

+ + +

属性(Properties)

+ +

[property:Float alphaTest]

+

设置运行alphaTest时要使用的alpha值。如果不透明度低于此值,则不会渲染材质。默认值为*0*。 +

+ +

[property:Integer blendDst]

+

混合目标。默认值为[page:CustomBlendingEquation OneMinusSrcAlphaFactor]。 + 目标因子所有可能的取值请参阅[page:CustomBlendingEquation constants]。 + 必须将材质的[page:Constant blending]设置为[page:Materials CustomBlending]才能生效。
+

+ +

[property:Integer blendDstAlpha]

+

[page:.blendDst]的透明度。 默认值为 *null*.

+ +

[property:Integer blendEquation]

+

使用混合时所采用的混合方程式。默认值为[page:CustomBlendingEquation AddEquation]。 + 混合方程式所有可能的取值请参阅[page:CustomBlendingEquation constants]。 + 必须将材质的[page:Constant blending]设置为[page:Materials CustomBlending]才能生效。
+

+ +

[property:Integer blendEquationAlpha]

+

[page:.blendEquation] 的透明度. 默认值为 *null*.

+ +

[property:Blending blending]

+

在使用此材质显示对象时要使用何种混合。
+ 必须将其设置为[page:Materials CustomBlending]才能使用自定义[page:Constant blendSrc], [page:Constant blendDst] 或者 [page:Constant + blendEquation]。 + 混合模式所有可能的取值请参阅[page:Materials constants]。默认值为[page:Materials NormalBlending]。 +

+ +

[property:Integer blendSrc]

+

混合源。默认值为[page:CustomBlendingEquation SrcAlphaFactor]。 + 源因子所有可能的取值请参阅[page:CustomBlendingEquation constants]。
+ 必须将材质的[page:Constant blending]设置为[page:Materials CustomBlending]才能生效。 +

+ +

[property:Integer blendSrcAlpha]

+

[page:.blendSrc]的透明度。 默认值为 *null*.

+ +

[property:Boolean clipIntersection]

+

更改剪裁平面的行为,以便仅剪切其交叉点,而不是它们的并集。默认值为 *false*。 +

+ +

[property:Array clippingPlanes]

+

+ 用户定义的剪裁平面,在世界空间中指定为THREE.Plane对象。这些平面适用于所有使用此材质的对象。空间中与平面的有符号距离为负的点被剪裁(未渲染)。 + 这需要[page:WebGLRenderer.localClippingEnabled]为*true*。 + 示例请参阅[example:webgl_clipping_intersection WebGL / clipping /intersection]。默认值为 *null*。 +

+ +

[property:Boolean clipShadows]

+

定义是否根据此材质上指定的剪裁平面剪切阴影。默认值为 *false*。 +

+ +

[property:Boolean colorWrite]

+

是否渲染材质的颜色。 + 这可以与网格的[page:Integer renderOrder]属性结合使用,以创建遮挡其他对象的不可见对象。默认值为*true*。 +

+ +

[property:Material customDepthMaterial]

+

渲染到深度贴图时此材质要使用的自定义深度材质。 + 当使用[page:DirectionalLight]或[page:SpotLight]进行阴影投射时,如果您正在(a)修改顶点着色器中的顶点位置, + (b)使用位移贴图,(c)alphaTest中使用alpha贴图,或(d)alphaTest中使用透明纹理, + 您必须指定customDepthMaterial以得到合适的阴影。默认值*undefined*。 +

+ +

[property:Material customDistanceMaterial]

+

与customDepthMaterial相同,但与[page:PointLight]一起使用。默认值为*undefined*。 +

+ +

[property:Object defines]

+

注入shader的自定义对象。 以键值对形式的对象传递,{ MY_CUSTOM_DEFINE: '' , PI2: Math.PI * 2 }。 + 这些键值对在顶点和片元着色器中定义。默认值为*undefined*。 +

+ +

[property:Integer depthFunc]

+

使用何种深度函数。默认为[page:Materials LessEqualDepth]。 + 深度模式所有可能的取值请查阅[page:Materials constants]。 +

+ +

[property:Boolean depthTest]

+

是否在渲染此材质时启用深度测试。默认为 *true*。 +

+ +

[property:Boolean depthWrite]

+

渲染此材质是否对深度缓冲区有任何影响。默认为*true*。

+ 在绘制2D叠加时,将多个事物分层在一起而不创建z-index时,禁用深度写入会很有用。 +

+ +

[property:Boolean flatShading]

+

定义材质是否使用平面着色进行渲染。默认值为false。 +

+ +

[property:Boolean fog]

+

材质是否受雾影响。默认为*true*。

+ +

[property:Integer id]

+

此材质实例的唯一编号。

+ +

[property:Boolean isMaterial]

+

用于检查此类或派生类是否为材质。默认值为 *true*。

+ + 因为其通常用在内部优化,所以不应该更改该属性值。 +

+ +

[property:Boolean lights]

+

材质是否受到光照的影响。默认为*true*。

+ +

[property:String name]

+

对象的可选名称(不必是唯一的)。默认值为空字符串。

+ +

[property:Boolean needsUpdate]

+

指定需要重新编译材质。
+ 实例化新材质时,此属性自动设置为true。 +

+ +

[property:Float opacity]

+

在0.0 - 1.0的范围内的浮点数,表明材质的透明度。值*0.0*表示完全透明,*1.0*表示完全不透明。
+ 如果材质的[page:Boolean transparent]属性未设置为*true*,则材质将保持完全不透明,此值仅影响其颜色。 + 默认值为*1.0*。
+ +

+ +

[property:Float overdraw]

+

绘制时的三角形扩展量。对于使用[page:CanvasRenderer]时三角形之间出现间隙的情况,这是一种解决方法。 + *0.5*往往会在浏览器中有良好的结果。默认值为*0*。 +

+ +

[property:Boolean polygonOffset]

+

是否使用多边形偏移。默认值为*false*。这对应于WebGL的*GL_POLYGON_OFFSET_FILL*功能。 +

+ +

[property:Integer polygonOffsetFactor]

+

设置多边形偏移系数。默认值为*0*。

+ +

[property:Integer polygonOffsetUnits]

+

设置多边形偏移单位。默认值为*0*。

+ +

[property:String precision]

+

重写此材质渲染器的默认精度。可以是"*highp*", "*mediump*" 或 "*lowp*"。默认值为*null*。 +

+ +

[property:Boolean premultipliedAlpha]

+

是否预乘alpha(透明度)值。有关差异的示例,请参阅[Example:webgl_materials_transparency WebGL / Materials / Transparency]。 + 默认值为*false*。 +

+ +

[property:Boolean dithering]

+

是否对颜色应用抖动以消除条带的外观。默认值为 *false*。 +

+ +

[property:Integer shadowSide]

+

定义投影的面。设置时,可以是[page:Materials THREE.FrontSide], [page:Materials THREE.BackSide], 或[page:Materials]。默认值为 *null*。 +
+ 如果为*null*, 则面投射阴影确定如下:
+ + + + + + + + + + + + + + + + + + + + + + + +
[page:Material.side]Side casting shadows
THREE.FrontSide背面
THREE.BackSide前面
THREE.DoubleSide双面
+ + +

+ +

[property:Integer side]

+

定义将要渲染哪一面 - 正面,背面或两者。 + 默认为[page:Materials THREE.FrontSide]。其他选项有[page:Materials THREE.BackSide]和[page:Materials THREE.DoubleSide]。 +

+ +

[property:Boolean transparent]

+

+ 定义此材质是否透明。这对渲染有影响,因为透明对象需要特殊处理,并在非透明对象之后渲染。 +
+ 设置为true时,通过设置材质的[page:Float opacity]属性来控制材质透明的程度。
+ 默认值为*false*。 +

+ +

[property:String type]

+

值是字符串'Material'。不应该被更改,并且可以用于在场景中查找此类型的所有对象。 +

+ +

[property:String uuid]

+

此材质实例的[link:http://en.wikipedia.org/wiki/Universally_unique_identifier UUID],会自动分配,不应该被更改。 +

+ +

[property:Integer vertexColors]

+

是否使用顶点着色。默认值为[page:Materials THREE.NoColors]。 + 其他选项有[page:Materials THREE.VertexColors] 和 [page:Materials THREE.FaceColors]。 +

+ +

[property:Boolean visible]

+

此材质是否可见。默认为*true*。 +

+ +

[property:object userData]

+

一个对象,可用于存储有关Material的自定义数据。它不应该包含对函数的引用,因为这些函数不会被克隆。 +

+ +

方法(Methods)

+ +

[page:EventDispatcher EventDispatcher] 方法在此类中可用。

+ +

[method:Material clone]( )

+

返回与此材质具有相同参数的新材质。

+ +

[method:Material copy]( [param:material material] )

+

将被传入材质中的参数复制到此材质中。

+ +

[method:null dispose]()

+

处理材质。材质的纹理不会被处理。需要通过[page:Texture Texture]处理。 +

+ +

[method:null onBeforeCompile]( [param:Object shader], [param:WebGLRenderer renderer] )

+

在编译shader程序之前立即执行的可选回调。此函数使用shader源码作为参数。用于修改内置材质。 +

+ +

[method:null setValues]( [param:object values] )

+

values -- 具有参数的容器。 + 根据*values*设置属性。
+

+ +

[method:null toJSON]( [param:object meta] )

+

meta -- 包含元素,例如材质的纹理或图像。 + 将材质转换为three.js JSON格式。
+

+ +

源码(Source)

+ +[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/materials/MeshBasicMaterial.html b/docs/api/zh/materials/MeshBasicMaterial.html new file mode 100644 index 00000000000000..1c74d04cac4956 --- /dev/null +++ b/docs/api/zh/materials/MeshBasicMaterial.html @@ -0,0 +1,140 @@ + + + + + + + + + + + [page:Material] → + +

基础网格材质([name])

+ +

+ 一个以简单着色(平面或线框)方式来绘制几何体的材质。

+ 这种材质不受光照的影响。 +

+ + + + + + +

构造函数(Constructor)

+ +

[name]( [param:Object parameters] )

+

[page:Object parameters] - (可选)用于定义材质外观的对象,具有一个或多个属性。材质的任何属性都可以从此处传入(包括从[page:Material]继承的任何属性)。

+ 属性[page:Hexadecimal color]例外,其可以作为十六进制字符串传递,默认情况下为 *0xffffff*(白色),内部调用[page:Color.set](color)。 +

+ +

属性(Properties)

+

常用属性请参见基类[page:Material]。

+ +

[property:Texture alphaMap]

+

alpha贴图是一种灰度纹理,用于控制整个表面的不透明度(黑色:完全透明;白色:完全不透明)。默认值为null。

+ 仅使用纹理的颜色,忽略alpha通道(如果存在)。对于RGB和RGBA纹理,[page:WebGLRenderer WebGL]渲染器在采样此纹理时将使用绿色通道, + 因为在DXT压缩和未压缩RGB 565格式中为绿色提供了额外的精度。Luminance-only以及luminance/alpha纹理也仍然有效。 +

+ +

[property:Texture aoMap]

+

该纹理的红色通道用作环境遮挡贴图。默认值为null。aoMap需要第二组UVs,因此将忽略[page:Texture repeat]和[page:Texture offset]属性。

+ +

[property:Float aoMapIntensity]

+

环境遮挡效果的强度。默认值为1。零是不遮挡效果。

+ +

[property:Color color]

+

材质的颜色([page:Color]),默认值为白色 (0xffffff)。

+ +

[property:Integer combine]

+

如何将表面颜色的结果与环境贴图(如果有)结合起来。

+ 选项为[page:Materials THREE.Multiply](默认值),[page:Materials THREE.MixOperation], + [page:Materials THREE.AddOperation]。如果选择多个,则使用[page:.reflectivity]在两种颜色之间进行混合。 +

+ +

[property:Boolean isMeshBasicMaterial]

+

用于检查此类或派生类是否为网格基础材质。默认值为 *true*。

+ + 因为其通常用在内部优化,所以不应该更改该属性值。 +

+ +

[property:TextureCube envMap]

+

环境贴图。默认值为null。

+ +

[property:Texture lightMap]

+

光照贴图。默认值为null。lightMap需要第二组UVs,因此将忽略[page:Texture repeat]和[page:Texture offset]纹理属性。

+ +

[property:Float lightMapIntensity]

+

烘焙光的强度。默认值为1。

+ +

[property:Boolean lights]

+

材质是否受到光照的影响。默认值为 *false*。

+ +

[property:Texture map]

+

颜色贴图。默认为null。

+ +

[property:Boolean morphTargets]

+

材质是否使用morphTargets。默认值为false。

+ + +

[property:Float reflectivity]

+

环境贴图对表面的影响程度; 见[page:.combine]。默认值为1,有效范围介于0(无反射)和1(完全反射)之间。 +

+ +

[property:Float refractionRatio]

+

空气的折射率(IOR)(约为1)除以材质的折射率。它与环境映射模式[page:Textures THREE.CubeRefractionMapping] + 和[page:Textures THREE.EquirectangularRefractionMapping]一起使用。 + 折射率不应超过1。默认值为*0.98*。 +

+ +

[property:Boolean skinning]

+

材质是否使用蒙皮。默认值为false。

+ +

[property:Texture specularMap]

+

材质使用的高光贴图。默认值为null。

+ +

[property:Boolean wireframe]

+

将几何体渲染为线框。默认值为*false*(即渲染为平面多边形)。

+ +

[property:String wireframeLinecap]

+

定义线两端的外观。可选值为 'butt','round' 和 'square'。默认为'round'。

+ 该属性对应[link:https://developer.mozilla.org/en/docs/Web/API/CanvasRenderingContext2D/lineJoin 2D Canvas lineJoin]属性, + 并且会被[page:WebGLRenderer WebGL]渲染器忽略。 +

+ +

[property:String wireframeLinejoin]

+

+ 定义线连接节点的样式。可选值为 'round', 'bevel' 和 'miter'。默认值为 'round'。

+ 该属性对应[link:https://developer.mozilla.org/en/docs/Web/API/CanvasRenderingContext2D/lineJoin 2D Canvas lineJoin]属性, + 并且会被[page:WebGLRenderer WebGL]渲染器忽略。 +

+ +

[property:Float wireframeLinewidth]

+

控制线框宽度。默认值为1。

+ 由于[link:https://www.khronos.org/registry/OpenGL/specs/gl/glspec46.core.pdf OpenGL Core Profile]与大多数平台上[page:WebGLRenderer WebGL]渲染器的限制, + 无论如何设置该值,线宽始终为1。 +

+ +

方法(Methods)

+

常用方法请参见基类[page:Material]。

+ +

源码(Source)

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/materials/MeshDepthMaterial.html b/docs/api/zh/materials/MeshDepthMaterial.html new file mode 100644 index 00000000000000..47c0ecb2a43607 --- /dev/null +++ b/docs/api/zh/materials/MeshDepthMaterial.html @@ -0,0 +1,105 @@ + + + + + + + + + + + [page:Material] → + +

深度网格材质([name])

+ +

一种按深度绘制几何体的材质。深度基于相机远近平面。白色最近,黑色最远。

+ + + + + +

构造函数(Constructor)

+ +

[name]( [param:Object parameters] )

+

[page:Object parameters] - (可选)用于定义材质外观的对象,具有一个或多个属性。 + 材质的任何属性都可以从此处传入(包括从[page:Material]继承的任何属性)。 +

+ +

属性(Properties)

+

常用属性请参见基类[page:Material]。

+ +

[property:Texture alphaMap]

+

alpha贴图是一种灰度纹理,用于控制整个表面的不透明度(黑色:完全透明;白色:完全不透明)。默认值为null。

+ 仅使用纹理的颜色,忽略alpha通道(如果存在)。对于RGB和RGBA纹理,[page:WebGLRenderer WebGL]渲染器在采样此纹理时将使用绿色通道, + 因为在DXT压缩和未压缩RGB 565格式中为绿色提供了额外的精度。Luminance-only以及luminance/alpha纹理也仍然有效。 +

+ +

[property:Constant depthPacking]

+

depth packing的编码。默认为[page:Textures BasicDepthPacking]。

+ +

[property:Texture displacementMap]

+

位移贴图会影响网格顶点的位置,与仅影响材质的光照和阴影的其他贴图不同,移位的顶点可以投射阴影,阻挡其他对象,以及充当真实的几何体。 + 位移纹理是指:网格的所有顶点被映射为图像中每个像素的值(白色是最高的),并且被重定位。 +

+ +

[property:Float displacementScale]

+

位移贴图对网格的影响程度(黑色是无位移,白色是最大位移)。如果没有设置位移贴图,则不会应用此值。默认值为1。 +

+ +

[property:Float displacementBias]

+

位移贴图在网格顶点上的偏移量。如果没有设置位移贴图,则不会应用此值。默认值为0。 +

+ +

[property:Boolean fog]

+

材质是否受雾影响。默认值为*false*。

+ +

[property:Boolean isMeshDepthMaterial]

+

用于检查此类或派生类是否为深度网格材质。默认值为 *true*。

+ + 因为其通常用在内部优化,所以不应该更改该属性值。 +

+ +

[property:Boolean lights]

+

材质是否受到光照的影响。默认值为 *false*。

+ +

[property:Texture map]

+

颜色贴图。默认为null。

+ +

[property:boolean morphTargets]

+

材质是否使用morphTargets。默认值为false。

+ +

[property:Boolean skinning]

+

材质是否使用蒙皮。默认值为false。

+ +

[property:boolean wireframe]

+

将几何体渲染为线框。默认值为*false*(即渲染为平滑着色)。

+ +

[property:Float wireframeLinewidth]

+

控制线框宽度。默认值为1。

+ 由于[link:https://www.khronos.org/registry/OpenGL/specs/gl/glspec46.core.pdf OpenGL Core Profile] + 与大多数平台上[page:WebGLRenderer WebGL]渲染器限制,无论如何设置该值,线宽始终为1。 +

+ +

方法(Methods)

+

常用方法请参见基类[page:Material]。

+ + +

源码(Source)

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/materials/MeshLambertMaterial.html b/docs/api/zh/materials/MeshLambertMaterial.html new file mode 100644 index 00000000000000..7eeee3d559347e --- /dev/null +++ b/docs/api/zh/materials/MeshLambertMaterial.html @@ -0,0 +1,159 @@ + + + + + + + + + + + [page:Material] → + +

Lambert网格材质([name])

+ +

一种非光泽表面的材质,没有镜面高光。

+ 该材质使用基于非物理的[link:https://en.wikipedia.org/wiki/Lambertian_reflectance Lambertian]模型来计算反射率。 + 这可以很好地模拟一些表面(例如未经处理的木材或石材),但不能模拟具有镜面高光的光泽表面(例如涂漆木材)。

+ + + 使用[link:https://en.wikipedia.org/wiki/Gouraud_shading Gouraud]着色模型计算着色。这将计算每个顶点的着色 + (即在[link:https://en.wikipedia.org/wiki/Shader#Vertex_shaders vertex shader]中)并在多边形的面上插入结果。

+ 由于反射率和光照模型的简单性,[page:MeshPhongMaterial],[page:MeshStandardMaterial]或者[page:MeshPhysicalMaterial] + 上使用这种材质时会以一些图形精度为代价,得到更高的性能。 +

+ + + + + +

构造函数(Constructor)

+ +

[name]( [param:Object parameters] )

+

[page:Object parameters] - (可选)用于定义材质外观的对象,具有一个或多个属性。 + 材质的任何属性都可以从此处传入(包括从[page:Material]继承的任何属性)。

+ 属性[page:Hexadecimal color]例外,其可以作为十六进制字符串传递,默认情况下为 *0xffffff*(白色),内部调用[page:Color.set](color)。 +

+ +

属性(Properties)

+

常用属性请参见基类[page:Material]。

+ +

[property:Texture alphaMap]

+

alpha贴图是一种灰度纹理,用于控制整个表面的不透明度(黑色:完全透明;白色:完全不透明)。默认值为null。

+ + 仅使用纹理的颜色,忽略alpha通道(如果存在)。对于RGB和RGBA纹理,[page:WebGLRenderer WebGL]渲染器在采样此纹理时将使用绿色通道, + 因为在DXT压缩和未压缩RGB 565格式中为绿色提供了额外的精度。Luminance-only以及luminance/alpha纹理也仍然有效。 +

+ +

[property:Texture aoMap]

+

该纹理的红色通道用作环境遮挡贴图。默认值为null。aoMap需要第二组UVs,因此将忽略[page:Texture repeat]和[page:Texture offset]纹理属性。

+ +

[property:Float aoMapIntensity]

+

环境遮挡效果的强度。默认值为1。零是不遮挡效果。

+ +

[property:Color color]

+

材质的颜色([page:Color]),默认值为白色 (0xffffff)。

+ +

[property:Integer combine]

+

如何将表面颜色的结果与环境贴图(如果有)结合起来。

+ + 选项为[page:Materials THREE.Multiply](默认值),[page:Materials THREE.MixOperation], + [page:Materials THREE.AddOperation]。如果选择多个,则使用[page:.reflectivity]在两种颜色之间进行混合。 +

+ +

[property:Color emissive]

+

材质的放射(光)颜色,基本上是不受其他光照影响的固有颜色。默认为黑色。 +

+ +

[property:Texture emissiveMap]

+

设置放射(发光)贴图。默认值为null。放射贴图颜色由放射颜色和强度所调节。 + 如果你有一个放射贴图,请务必将放射颜色设置为黑色以外的其他颜色。 +

+ +

[property:Float emissiveIntensity]

+

放射光强度。调节发光颜色。默认为1。

+ +

[property:TextureCube envMap]

+

环境贴图。默认值为null。

+ +

[property:Boolean isMeshLambertMaterial]

+

用于检查此类或派生类是否为Lambert网格材质。默认值为 *true*。

+ + 因为其通常用在内部优化,所以不应该更改该属性值。 +

+ +

[property:Texture lightMap]

+

光照贴图。默认值为null。lightMap需要第二组UVs,因此将忽略[page:Texture repeat]和[page:Texture offset]纹理属性。

+ +

[property:Float lightMapIntensity]

+

烘焙光的强度。默认值为1。

+ +

[property:Texture map]

+

颜色贴图。默认为null。

+ +

[property:boolean morphNormals]

+

定义是否使用morphNormals。设置为true可将morphNormal属性从[page:Geometry]传递到shader。默认值为*false*。 +

+ +

[property:Boolean morphTargets]

+

定义材质是否使用morphTargets。默认值为false。

+ +

[property:Float reflectivity]

+

环境贴图对表面的影响程度; 见[page:.combine]。默认值为1,有效范围介于0(无反射)和1(完全反射)之间。

+ +

[property:Float refractionRatio]

+

空气的折射率(IOR)(约为1)除以材质的折射率。它与环境映射模式[page:Textures THREE.CubeRefractionMapping] + 和[page:Textures THREE.EquirectangularRefractionMapping]一起使用。 + 折射率不应超过1。默认值为*0.98*。 +

+ +

[property:Boolean skinning]

+

材质是否使用蒙皮。默认值为false。

+ +

[property:Texture specularMap]

+

材质使用的高光贴图。默认值为null。

+ +

[property:Boolean wireframe]

+

将几何体渲染为线框。默认值为*false*(即渲染为平面多边形)。

+ +

[property:String wireframeLinecap]

+

定义线两端的外观。可选值为 'butt','round' 和 'square'。默认为'round'。

+ 该属性对应[link:https://developer.mozilla.org/en/docs/Web/API/CanvasRenderingContext2D/lineJoin 2D Canvas lineJoin]属性, + 并且会被[page:WebGLRenderer WebGL]渲染器忽略。 +

+ +

[property:String wireframeLinejoin]

+

+ 定义线连接节点的样式。可选值为 'round', 'bevel' 和 'miter'。默认值为 'round'。

+ 该属性对应[link:https://developer.mozilla.org/en/docs/Web/API/CanvasRenderingContext2D/lineJoin 2D Canvas lineJoin]属性, + 并且会被[page:WebGLRenderer WebGL]渲染器忽略。 +

+ +

[property:Float wireframeLinewidth]

+

控制线框宽度。默认值为1。

+ 由于[link:https://www.khronos.org/registry/OpenGL/specs/gl/glspec46.core.pdf OpenGL Core Profile]与 + 大多数平台上[page:WebGLRenderer WebGL]渲染器的限制,无论如何设置该值,线宽始终为1。 +

+ +

方法(Methods)

+

常用方法请参见基类[page:Material]。

+ +

源码(Source)

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/materials/MeshNormalMaterial.html b/docs/api/zh/materials/MeshNormalMaterial.html new file mode 100644 index 00000000000000..14d8d2e9ee2fbe --- /dev/null +++ b/docs/api/zh/materials/MeshNormalMaterial.html @@ -0,0 +1,79 @@ + + + + + + + + + + + [page:Material] → + +

法线网格材质([name])

+ +

一种把法向量映射到RGB颜色的材质。

+ + + + + +

构造函数(Constructor)

+ +

[name]( [param:Object parameters] )

+

[page:Object parameters] - (可选)用于定义材质外观的对象,具有一个或多个属性。材质的任何属性都可以从此处传入(包括从[page:Material]继承的任何属性)。 +

+ + +

属性(Properties)

+

常用属性请参见基类[page:Material]。

+ +

[property:Boolean fog]

+

材质是否受雾影响。默认值为*false*。

+ +

[property:Boolean isMeshNormalMaterial]

+

用于检查此类或派生类是否为法线网格材质。默认值为 *true*。

+ + 因为其通常用在内部优化,所以不应该更改该属性值。 +

+ +

[property:Boolean lights]

+

材质是否受到光照的影响。默认值为 *false*。

+ +

[property:boolean morphTargets]

+

定义材质是否使用morphTargets。默认值为false。

+ +

[property:boolean wireframe]

+

+ 将几何体渲染为线框。默认值为*false*(即渲染为平滑着色)。 +

+ +

[property:Float wireframeLinewidth]

+

控制线框宽度。默认值为1。

+ 由于[link:https://www.khronos.org/registry/OpenGL/specs/gl/glspec46.core.pdf OpenGL Core Profile]与大多数平台上[page:WebGLRenderer WebGL]渲染器的限制,无论如何设置该值,线宽始终为1。 +

+ +

方法(Methods)

+

常用方法请参见基类[page:Material]。

+ + + +

源码(Source)

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/materials/MeshPhongMaterial.html b/docs/api/zh/materials/MeshPhongMaterial.html new file mode 100644 index 00000000000000..9ddb420bd88ad3 --- /dev/null +++ b/docs/api/zh/materials/MeshPhongMaterial.html @@ -0,0 +1,205 @@ + + + + + + + + + + + [page:Material] → + +

Phong网格材质([name])

+ +

一种用于具有镜面高光的光泽表面的材质。

+ 该材质使用非物理的[link:https://en.wikipedia.org/wiki/Blinn-Phong_shading_model Blinn-Phong]模型来计算反射率。 + 与[page:MeshLambertMaterial]中使用的Lambertian模型不同,该材质可以模拟具有镜面高光的光泽表面(例如涂漆木材)。

+ 使用[link:https://en.wikipedia.org/wiki/Phong_shading Phong]着色模型计算着色时,会计算每个像素的阴影(在[link:https://en.wikipedia.org/wiki/Shader#Pixel_shaders fragment shader], + AKA pixel shader中),与[page:MeshLambertMaterial]使用的Gouraud模型相比,该模型的结果更准确,但代价是牺牲一些性能。 + [page:MeshStandardMaterial]和[page:MeshPhysicalMaterial]也使用这个着色模型。

+ 在[page:MeshStandardMaterial]或[page:MeshPhysicalMaterial]上使用此材质时,性能通常会更高 ,但会牺牲一些图形精度。 +

+ + + + + +

构造函数(Constructor)

+ +

[name]( [param:Object parameters] )

+

[page:Object parameters] - (可选)用于定义材质外观的对象,具有一个或多个属性。 + 材质的任何属性都可以从此处传入(包括从[page:Material]继承的任何属性)。

+ 属性[page:Hexadecimal color]例外,其可以作为十六进制字符串传递,默认情况下为 *0xffffff*(白色),内部调用[page:Color.set](color)。 +

+ +

属性(Properties)

+

常用属性请参见基类[page:Material]。

+ +

[property:Texture alphaMap]

+

Talpha贴图是一种灰度纹理,用于控制整个表面的不透明度(黑色:完全透明;白色:完全不透明)。默认值为null。

+ 仅使用纹理的颜色,忽略alpha通道(如果存在)。对于RGB和RGBA纹理,[page:WebGLRenderer WebGL]渲染器在采样此纹理时将使用绿色通道, + 因为在DXT压缩和未压缩RGB 565格式中为绿色提供了额外的精度。Luminance-only以及luminance/alpha纹理也仍然有效。 +

+ +

[property:Texture aoMap]

+

该纹理的红色通道用作环境遮挡贴图。默认值为null。aoMap需要第二组UVs,因此将忽略[page:Texture repeat]和[page:Texture offset]属性。

+ +

[property:Float aoMapIntensity]

+

环境遮挡效果的强度。默认值为1。零是不遮挡效果。

+ +

[property:Texture bumpMap]

+

用于创建凹凸贴图的纹理。黑色和白色值映射到与光照相关的感知深度。凹凸实际上不会影响对象的几何形状,只影响光照。如果定义了法线贴图,则将忽略该贴图。 +

+ +

[property:Float bumpScale]

+

凹凸贴图会对材质产生多大影响。典型范围是0-1。默认值为1。

+ + +

[property:Color color]

+

材质的颜色([page:Color]),默认值为白色 (0xffffff)。

+ +

[property:Integer combine]

+

如何将表面颜色的结果与环境贴图(如果有)结合起来。

+ + 选项为[page:Materials THREE.Multiply](默认值),[page:Materials THREE.MixOperation], + [page:Materials THREE.AddOperation]。如果选择多个,则使用[page:.reflectivity]在两种颜色之间进行混合。 +

+ +

[property:Texture displacementMap]

+

位移贴图会影响网格顶点的位置,与仅影响材质的光照和阴影的其他贴图不同,移位的顶点可以投射阴影,阻挡其他对象, + 以及充当真实的几何体。位移纹理是指:网格的所有顶点被映射为图像中每个像素的值(白色是最高的),并且被重定位。 +

+ +

[property:Float displacementScale]

+

位移贴图对网格的影响程度(黑色是无位移,白色是最大位移)。如果没有设置位移贴图,则不会应用此值。默认值为1。 +

+ +

[property:Float displacementBias]

+

+ 位移贴图在网格顶点上的偏移量。如果没有设置位移贴图,则不会应用此值。默认值为0。 +

+ +

[property:Color emissive]

+

材质的放射(光)颜色,基本上是不受其他光照影响的固有颜色。默认为黑色。 +

+ +

[property:Texture emissiveMap]

+

设置放射(发光)贴图。默认值为null。放射贴图颜色由放射颜色和强度所调节。 + 如果你有一个放射贴图,请务必将放射颜色设置为黑色以外的其他颜色。 +

+ +

[property:Float emissiveIntensity]

+

放射光强度。调节发光颜色。默认为1。

+ +

[property:TextureCube envMap]

+

环境贴图。默认值为null。

+ +

[property:Boolean isMeshPhongMaterial]

+

用于检查此类或派生类是否为Phong网格材质。默认值为 *true*。

+ + 因为其通常用在内部优化,所以不应该更改该属性值。 +

+ + +

[property:Texture lightMap]

+

光照贴图。默认值为null。lightMap需要第二组UVs,因此将忽略[page:Texture repeat]和[page:Texture offset]纹理属性。

+ +

[property:Float lightMapIntensity]

+

烘焙光的强度。默认值为1。

+ +

[property:Texture map]

+

颜色贴图。默认为null。纹理贴图颜色由漫反射颜色[page:.color]调节。

+ +

[property:boolean morphNormals]

+

定义是否使用morphNormals。设置为true可将morphNormal属性从[page:Geometry]传递到shader。默认值为*false*。 +

+ +

[property:Boolean morphTargets]

+

定义材质是否使用morphTargets。默认值为false。

+ +

[property:Texture normalMap]

+

用于创建法线贴图的纹理。RGB值会影响每个像素片段的曲面法线,并更改颜色照亮的方式。法线贴图不会改变曲面的实际形状,只会改变光照。 +

+ +

[property:Integer normalMapType]

+

法线贴图的类型。

+ 选项为[page:constant THREE.TangentSpaceNormalMap](默认)和[page:constant THREE.ObjectSpaceNormalMap]。 +

+ +

[property:Vector2 normalScale]

+

法线贴图对材质的影响程度。典型范围是0-1。默认值是[page:Vector2]设置为(1,1)。 +

+ + +

[property:Float reflectivity]

+

环境贴图对表面的影响程度; 见[page:.combine]。默认值为1,有效范围介于0(无反射)和1(完全反射)之间。 +

+ +

[property:Float refractionRatio]

+

空气的折射率(IOR)(约为1)除以材质的折射率。它与环境映射模式[page:Textures THREE.CubeRefractionMapping] + 和[page:Textures THREE.EquirectangularRefractionMapping]一起使用。 + 折射率不应超过1。默认值为*0.98*。 +

+ +

[property:Float shininess]

+

[page:.specular]高亮的程度,越高的值越闪亮。默认值为 *30*。

+ + +

[property:Boolean skinning]

+

材质是否使用蒙皮。默认值为false。

+ +

[property:Color specular]

+

材质的高光颜色。默认值为*0x111111*(深灰色)的颜色[page:Color]。

+ 这定义了材质的光泽度和光泽的颜色。 +

+ +

[property:Texture specularMap]

+

镜面反射贴图值会影响镜面高光以及环境贴图对表面的影响程度。默认值为null。 +

+ +

[property:Boolean wireframe]

+

将几何体渲染为线框。默认值为*false*(即渲染为平面多边形)。

+ +

[property:String wireframeLinecap]

+

定义线两端的外观。可选值为 'butt','round' 和 'square'。默认为'round'。

+ + 该属性对应[link:https://developer.mozilla.org/en/docs/Web/API/CanvasRenderingContext2D/lineJoin 2D Canvas lineJoin]属性, + 并且会被[page:WebGLRenderer WebGL]渲染器忽略。 +

+ +

[property:String wireframeLinejoin]

+

+ 定义线连接节点的样式。可选值为 'round', 'bevel' 和 'miter'。默认值为 'round'。

+ 该属性对应[link:https://developer.mozilla.org/en/docs/Web/API/CanvasRenderingContext2D/lineJoin 2D Canvas lineJoin]属性, + 并且会被[page:WebGLRenderer WebGL]渲染器忽略。 +

+ +

[property:Float wireframeLinewidth]

+

控制线框宽度。默认值为1。

+ 由于[link:https://www.khronos.org/registry/OpenGL/specs/gl/glspec46.core.pdf OpenGL Core Profile]与 + 大多数平台上[page:WebGLRenderer WebGL]渲染器的限制,无论如何设置该值,线宽始终为1。 +

+ +

方法(Methods)

+

常用方法请参见基类[page:Material]。

+ +

源码(Source)

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/materials/MeshPhysicalMaterial.html b/docs/api/zh/materials/MeshPhysicalMaterial.html new file mode 100644 index 00000000000000..ea70f65d4b1081 --- /dev/null +++ b/docs/api/zh/materials/MeshPhysicalMaterial.html @@ -0,0 +1,88 @@ + + + + + + + + + + + [page:Material] → [page:MeshStandardMaterial] → + +

物理网格材质([name])

+ +

[page:MeshStandardMaterial]的扩展,能够更好地控制反射率。

+ 请注意,为了获得最佳效果,您在使用此材质时应始终指定环境贴图。 +

+ + + + + +

例子(Examples)

+ [example:webgl_materials_variations_physical materials / variations / physical]
+ [example:webgl_materials_reflectivity materials / reflectivity] + +

构造函数(Constructor)

+ +

[name]( [param:Object parameters] )

+

[page:Object parameters] - (可选)用于定义材质外观的对象,具有一个或多个属性。 + 材质的任何属性都可以从此处传入(包括从[page:Material]继承的任何属性)

+ 属性[page:Hexadecimal color]例外,其可以作为十六进制字符串传递,默认情况下为 *0xffffff*(白色),内部调用[page:Color.set](color)。 +

+ + +

属性(Properties)

+

常用属性请参见基类[page:Material]。

+ +

[property:Float clearCoat]

+

+ ClearCoat级别,从*0.0*到*1.0*。默认值为*0.0*。 +

+ +

[property:Float clearCoatRoughness]

+

clearCoat看起来的粗糙程度,从*0.0*到*1.0*。默认值为*0.0*。

+ +

[property:Boolean isMeshPhysicalMaterial]

+

用于检查此类或派生类是否为Lambert网格材质。默认值为 *true*。

+ + 因为其通常用在内部优化,所以不应该更改该属性值。 +

+ +

[property:Object defines]

+

如下形式的对象: + + { 'PHYSICAL': '' }; + + [page:WebGLRenderer]使用它来选择shaders。 +

+ +

[property:Float reflectivity]

+

反射度,从*0.0*到*1.0*。默认值为*0.5*。
+ 这模拟了非金属材质的反射率。当[page:MeshStandardMaterial]为*1.0*时,此属性无效。 +

+ +

方法(Methods)

+

常用方法请参见基类[page:Material] 和[page:MeshStandardMaterial]。

+ + +

源码(Source)

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/materials/MeshStandardMaterial.html b/docs/api/zh/materials/MeshStandardMaterial.html new file mode 100644 index 00000000000000..6516e50c539993 --- /dev/null +++ b/docs/api/zh/materials/MeshStandardMaterial.html @@ -0,0 +1,235 @@ + + + + + + + + + + + [page:Material] → + +

标准网格材质([name])

+ +

一种基于物理的标准材质,使用Metallic-Roughness工作流程。

+ 基于物理的渲染(PBR)最近已成为许多3D应用程序的标准,例如[link:https://blogs.unity3d.com/2014/10/29/physically-based-shading-in-unity-5-a-primer/ Unity], + [link:https://docs.unrealengine.com/latest/INT/Engine/Rendering/Materials/PhysicallyBased/ Unreal]和 + [link:http://area.autodesk.com/blogs/the-3ds-max-blog/what039s-new-for-rendering-in-3ds-max-2017 3D Studio Max]。

+ 这种方法与旧方法的不同之处在于,不使用近似值来表示光与表面的相互作用,而是使用物理上正确的模型。 + 我们的想法是,不是在特定照明下调整材质以使其看起来很好,而是可以创建一种材质,能够“正确”地应对所有光照场景。

+ + 在实践中,该材质提供了比[page:MeshLambertMaterial] 或[page:MeshPhongMaterial] 更精确和逼真的结果,代价是计算成本更高。

+ + + 计算着色的方式与[page:MeshPhongMaterial]相同,都使用[link:https://en.wikipedia.org/wiki/Phong_shading Phong]着色模型, + 这会计算每个像素的阴影(即在[link:https://en.wikipedia.org/wiki/Shader#Pixel_shaders fragment shader], + AKA pixel shader中), 与[page:MeshLambertMaterial]使用的Gouraud模型相比,该模型的结果更准确,但代价是牺牲一些性能。

+ + 请注意,为获得最佳效果,您在使用此材质时应始终指定[page:.envMap environment map]。

+ 有关PBR概念的非技术性介绍以及如何设置PBR材质,请查看[link:https://www.marmoset.co marmoset]成员的这些文章: +

    +
  • + [link:https://www.marmoset.co/posts/basic-theory-of-physically-based-rendering/ Basic Theory of Physically Based Rendering] +
  • +
  • + [link:https://www.marmoset.co/posts/physically-based-rendering-and-you-can-too/ Physically Based Rendering and You Can Too] +
  • +
+

+

在 three.js(以及其他大多数PBR系统)中使用方法的技术细节, + 可以在Brent Burley撰写的[link:https://disney-animation.s3.amazonaws.com/library/s2012_pbs_disney_brdf_notes_v2.pdf paper from Disney] (pdf) + 中查看。 +

+ + + + + +

构造函数(Constructor)

+ +

[name]( [param:Object parameters] )

+

[page:Object parameters] - (可选)用于定义材质外观的对象,具有一个或多个属性。 + 材质的任何属性都可以从此处传入(包括从[page:Material]继承的任何属性)。

+ 属性[page:Hexadecimal color]例外,其可以作为十六进制字符串传递,默认情况下为 *0xffffff*(白色),内部调用[page:Color.set](color)。 +

+ +

属性(Properties)

+

常用属性请参见基类[page:Material]。

+ +

[property:Texture alphaMap]

+

alpha贴图是一种灰度纹理,用于控制整个表面的不透明度(黑色:完全透明;白色:完全不透明)。默认值为null。

+ 仅使用纹理的颜色,忽略alpha通道(如果存在)。对于RGB和RGBA纹理,[page:WebGLRenderer WebGL]渲染器在采样此纹理时将使用绿色通道, + 因为在DXT压缩和未压缩RGB 565格式中为绿色提供了额外的精度。Luminance-only以及luminance/alpha纹理也仍然有效。 +

+ +

[property:Texture aoMap]

+

该纹理的红色通道用作环境遮挡贴图。默认值为null。aoMap需要第二组UVs,因此将忽略[page:Texture repeat]和[page:Texture offset]属性。

+ +

[property:Float aoMapIntensity]

+

环境遮挡效果的强度。默认值为1。零是不遮挡效果。

+ +

[property:Texture bumpMap]

+

用于创建凹凸贴图的纹理。黑色和白色值映射到与光照相关的感知深度。凹凸实际上不会影响对象的几何形状,只影响光照。如果定义了法线贴图,则将忽略该贴图。 +

+ +

[property:Float bumpScale]

+

凹凸贴图会对材质产生多大影响。典型范围是0-1。默认值为1。

+ + +

[property:Color color]

+

材质的颜色([page:Color]),默认值为白色 (0xffffff)。

+ +

[property:Object defines]

+

如下形式的对象: + + { 'STANDARD': '' }; + + [page:WebGLRenderer]使用它来选择shaders。 +

+ +

[property:Texture displacementMap]

+

位移贴图会影响网格顶点的位置,与仅影响材质的光照和阴影的其他贴图不同,移位的顶点可以投射阴影,阻挡其他对象, + 以及充当真实的几何体。位移纹理是指:网格的所有顶点被映射为图像中每个像素的值(白色是最高的),并且被重定位。 +

+ +

[property:Float displacementScale]

+

+ 位移贴图对网格的影响程度(黑色是无位移,白色是最大位移)。如果没有设置位移贴图,则不会应用此值。默认值为1。 +

+ +

[property:Float displacementBias]

+

+ 位移贴图在网格顶点上的偏移量。如果没有设置位移贴图,则不会应用此值。默认值为0。 +

+ +

[property:Color emissive]

+

材质的放射(光)颜色,基本上是不受其他光照影响的固有颜色。默认为黑色。 +

+ +

[property:Texture emissiveMap]

+

设置放射(发光)贴图。默认值为null。放射贴图颜色由放射颜色和强度所调节。 + 如果你有一个放射贴图,请务必将放射颜色设置为黑色以外的其他颜色。 +

+ +

[property:Float emissiveIntensity]

+

放射光强度。调节发光颜色。默认为1。

+ +

[property:TextureCube envMap]

+

环境贴图。默认值为null。 + 请注意,为了使材质粗糙度属性能够正确地模糊环境贴图,shader必须能够访问环境纹理的mipmaps。 + 使用默认设置创建的TextureCubes已正确配置; 如果手动调整纹理参数, + 请确保将minFilter设置为其中一个MipMap选项,并且未强制禁用mip贴图。

+

+ 注意:MeshStandardMaterial 仅支持[link:https://threejs.org/docs/#api/textures/CubeTexture cube environment maps]。 + 如果要使用equirectangular贴图,则需要使用 [link:https://github.com/mrdoob/three.js/blob/dev/examples/js/loaders/EquirectangularToCubeGenerator.js EquirectangularToCubeGenerator]。 + 详细信息请参阅此示例[link:https://threejs.org/examples/webgl_materials_envmaps_exr.html example]。 +

+ +

[property:Float envMapIntensity]

+

通过乘以环境贴图的颜色来缩放环境贴图的效果。

+ +

[property:Boolean isMeshStandardMaterial]

+

用于检查此类或派生类是否为标准网格材质。默认值为 *true*。

+ 因为其通常用在内部优化,所以不应该更改该属性值。 +

+ + +

[property:Texture lightMap]

+

光照贴图。默认值为null。lightMap需要第二组UVs,因此将忽略[page:Texture repeat]和[page:Texture offset]纹理属性。

+ +

[property:Float lightMapIntensity]

+

烘焙光的强度。默认值为1。

+ +

[property:Texture map]

+

颜色贴图。默认为null。纹理贴图颜色由漫反射颜色[page:.color]调节。

+ +

[property:Float metalness]

+

材质与金属的相似度。非金属材质,如木材或石材,使用0.0,金属使用1.0,通常没有中间值。 + 默认值为0.5。0.0到1.0之间的值可用于生锈金属的外观。如果还提供了metalnessMap,则两个值相乘。 +

+ +

[property:Texture metalnessMap]

+

该纹理的蓝色通道用于改变材质的金属度。

+ +

[property:boolean morphNormals]

+

定义是否使用morphNormals。设置为true可将morphNormal属性从[page:Geometry]传递到shader。默认值为*false*。 +

+ +

[property:Boolean morphTargets]

+

定义材质是否使用morphTargets。默认值为false。

+ +

[property:Texture normalMap]

+

用于创建法线贴图的纹理。RGB值会影响每个像素片段的曲面法线,并更改颜色照亮的方式。法线贴图不会改变曲面的实际形状,只会改变光照。 +

+ +

[property:Integer normalMapType]

+

法线贴图的类型。

+ 选项为[page:constant THREE.TangentSpaceNormalMap](默认)和[page:constant THREE.ObjectSpaceNormalMap]。 +

+ +

[property:Vector2 normalScale]

+

法线贴图对材质的影响程度。典型范围是0-1。默认值是[page:Vector2]设置为(1,1)。 +

+ +

[property:Float refractionRatio]

+

空气的折射率(IOR)(约为1)除以材质的折射率。它与环境映射模式[page:Textures THREE.CubeRefractionMapping] + 和[page:Textures THREE.EquirectangularRefractionMapping]一起使用。 + 折射率不应超过1。默认值为*0.98*。 +

+ +

[property:Float roughness]

+

材质的粗糙程度。0.0表示平滑的镜面反射,1.0表示完全漫反射。默认值为0.5。如果还提供roughnessMap,则两个值相乘。 +

+ +

[property:Texture roughnessMap]

+

该纹理的绿色通道用于改变材质的粗糙度。

+ +

[property:Boolean skinning]

+

材质是否使用蒙皮。默认值为false。

+ +

[property:Boolean wireframe]

+

将几何体渲染为线框。默认值为*false*(即渲染为平面多边形)。

+ +

[property:String wireframeLinecap]

+

定义线两端的外观。可选值为 'butt','round' 和 'square'。默认为'round'。

+ 该属性对应[link:https://developer.mozilla.org/en/docs/Web/API/CanvasRenderingContext2D/lineJoin 2D Canvas lineJoin]属性, + 并且会被[page:WebGLRenderer WebGL]渲染器忽略。 +

+ +

[property:String wireframeLinejoin]

+

+ 定义线连接节点的样式。可选值为 'round', 'bevel' 和 'miter'。默认值为 'round'。

+ + 该属性对应[link:https://developer.mozilla.org/en/docs/Web/API/CanvasRenderingContext2D/lineJoin 2D Canvas lineJoin]属性, + 并且会被[page:WebGLRenderer WebGL]渲染器忽略。 +

+ +

[property:Float wireframeLinewidth]

+

控制线框宽度。默认值为1。

+ 由于[link:https://www.khronos.org/registry/OpenGL/specs/gl/glspec46.core.pdf OpenGL Core Profile]与大多数平台上[page:WebGLRenderer WebGL]渲染器的限制,无论如何设置该值,线宽始终为1。 +

+ +

方法(Methods)

+

常用方法请参见基类[page:Material]。

+ + +

源码(Source)

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/materials/MeshToonMaterial.html b/docs/api/zh/materials/MeshToonMaterial.html new file mode 100644 index 00000000000000..1eb0433e5d1d4d --- /dev/null +++ b/docs/api/zh/materials/MeshToonMaterial.html @@ -0,0 +1,77 @@ + + + + + + + + + + + [page:Material] → [page:MeshPhongMaterial] → + +

卡通网格材质([name])

+ +
[page:MeshPhongMaterial]卡通着色的扩展。
+ + + +

例子(Examples)

+ [example:webgl_materials_variations_toon materials / variations / toon]
+ +

构造函数(Constructor)

+ +

[name]( [param:Object parameters] )

+

[page:Object parameters] - (可选)用于定义材质外观的对象,具有一个或多个属性。 + 材质的任何属性都可以从此处传入(包括从[page:Material]和[page:MeshStandardMaterial]继承的任何属性)。

+ 属性[page:Hexadecimal color]例外,其可以作为十六进制字符串传递,默认情况下为 *0xffffff*(白色),内部调用[page:Color.set](color)。 +

+ + +

属性(Properties)

+

常用属性请参见基类[page:Material]和[page:MeshPhongMaterial]。

+ +

[property:Texture gradientMap]

+

卡通着色的渐变贴图,默认值为*null*。

+ +

[property:Boolean isMeshToonMaterial]

+

用于检查此类或派生类是否为卡通网格材质。默认值为 *true*。

+ + 因为其通常用在内部优化,所以不应该更改该属性值。 +

+ +

[property:Object defines]

+

如下形式的对象: + + { 'TOON': '' }; + + + [page:WebGLRenderer]使用它来选择shaders。 +

+ + +

方法(Methods)

+

常用方法请参见基类[page:Material]和[page:MeshPhongMaterial]。

+ + +

源码(Source)

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/materials/PointsMaterial.html b/docs/api/zh/materials/PointsMaterial.html new file mode 100644 index 00000000000000..398fff3bd19802 --- /dev/null +++ b/docs/api/zh/materials/PointsMaterial.html @@ -0,0 +1,97 @@ + + + + + + + + + + + [page:Material] → + +

点材质([name])

+ +

[page:Points]使用的默认材质。

+ +

例子(Examples)

+

+ [example:misc_controls_fly misc / controls / fly]
+ [example:webgl_buffergeometry_drawcalls WebGL / BufferGeometry / drawcalls]
+ [example:webgl_buffergeometry_points WebGL / BufferGeometry / points]
+ [example:webgl_buffergeometry_points_interleaved WebGL / BufferGeometry / points / interleaved]
+ [example:webgl_camera WebGL / camera ]
+ [example:webgl_geometry_convex WebGL / geometry / convex]
+ [example:webgl_geometry_shapes WebGL / geometry / shapes]
+ [example:webgl_interactive_raycasting_points WebGL / interactive / raycasting / points]
+ [example:webgl_multiple_elements_text WebGL / multiple / elements / text]
+ [example:webgl_points_billboards WebGL / points / billboards]
+ [example:webgl_points_billboards_colors WebGL / points / billboards / colors]
+ [example:webgl_points_dynamic WebGL / points / dynamic]
+ [example:webgl_points_random WebGL / points / random]
+ [example:webgl_points_sprites WebGL / points / sprites]
+ [example:webgl_trails WebGL / trails] +

+ + +//This will add a starfield to the background of a scene +var starsGeometry = new THREE.Geometry(); + +for ( var i = 0; i < 10000; i ++ ) { + + var star = new THREE.Vector3(); + star.x = THREE.Math.randFloatSpread( 2000 ); + star.y = THREE.Math.randFloatSpread( 2000 ); + star.z = THREE.Math.randFloatSpread( 2000 ); + + starsGeometry.vertices.push( star ); + +} + +var starsMaterial = new THREE.PointsMaterial( { color: 0x888888 } ); + +var starField = new THREE.Points( starsGeometry, starsMaterial ); + +scene.add( starField ); + + +

[name]( [param:Object parameters] )

+

[page:Object parameters] - (可选)用于定义材质外观的对象,具有一个或多个属性。 + 材质的任何属性都可以从此处传入(包括从[page:Material]继承的任何属性)。

+ + 属性[page:Hexadecimal color]例外,其可以作为十六进制字符串传递,默认情况下为 *0xffffff*(白色),内部调用[page:Color.set](color)。 +

+ +

属性(Properties)

+

常用属性请参见基类[page:Material]。

+ +

[property:Color color]

+

材质的颜色([page:Color]),默认值为白色 (0xffffff)。

+ +

[property:Boolean isPointsMaterial]

+

用于检查此类或派生类是否为点材质。默认值为 *true*。

+ + 因为其通常用在内部优化,所以不应该更改该属性值。 +

+ +

[property:Texture map]

+ +

使用[page:Texture]中的数据设置点的颜色。

+ +

[property:Boolean morphTargets]

+

材质是否使用morphTargets。默认值为false。

+ +

[property:Number size]

+

设置点的大小。默认值为1.0。

+ +

[property:Boolean sizeAttenuation]

+

指定点的大小是否因相机深度而衰减。(仅限透视摄像头。)默认为true。

+ + +

方法(Methods)

+ +

源码(Source)

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/materials/RawShaderMaterial.html b/docs/api/zh/materials/RawShaderMaterial.html new file mode 100644 index 00000000000000..119fdbf25485d1 --- /dev/null +++ b/docs/api/zh/materials/RawShaderMaterial.html @@ -0,0 +1,66 @@ + + + + + + + + + + + [page:ShaderMaterial] → + +

原始着色器材质([name])

+ +

此类的工作方式与[page:ShaderMaterial]类似,不同之处在于内置的uniforms和attributes的定义不会自动添加到GLSL shader代码中。 +

+ +

例子(Examples)

+

+ [example:webgl_buffergeometry_rawshader WebGL / buffergeometry / rawshader]
+ [example:webgl_buffergeometry_instancing_billboards WebGL / buffergeometry / instancing / billboards]
+ [example:webgl_buffergeometry_instancing_dynamic WebGL / buffergeometry / instancing / dynamic]
+ [example:webgl_buffergeometry_instancing_interleaved_dynamic WebGL / buffergeometry / instancing / interleaved / dynamic]
+ [example:webgl_buffergeometry_instancing WebGL / buffergeometry / instancing]
+ [example:webgl_interactive_instances_gpu WebGL / interactive / instances /gpu]
+ [example:webgl_raymarching_reflect WebGL / raymarching / reflect] +

+ + +var material = new THREE.RawShaderMaterial( { + + uniforms: { + time: { value: 1.0 } + }, + vertexShader: document.getElementById( 'vertexShader' ).textContent, + fragmentShader: document.getElementById( 'fragmentShader' ).textContent, + +} ); + + +

构造函数(Constructor)

+ +

[name]( [param:Object parameters] )

+

[page:Object parameters] - (可选)用于定义材质外观的对象,具有一个或多个属性。 + 材质的任何属性都可以从此处传入(包括从[page:Material] 和 [page:ShaderMaterial]继承的任何属性)。

+

+ + +

属性(Properties)

+

常用属性请参见基类[page:Material]和[page:ShaderMaterial]。

+ +

[property:Boolean isRawShaderMaterial]

+

用于检查此类或派生类是否为点材质。默认值为 *true*。

+ 因为其通常用在内部优化,所以不应该更改该属性值。 +

+ + +

方法(Methods)

+

常用方法请参见基类[page:Material]和[page:ShaderMaterial]。

+ + +

源码(Source)

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/materials/ShaderMaterial.html b/docs/api/zh/materials/ShaderMaterial.html new file mode 100644 index 00000000000000..4b22c944b4d519 --- /dev/null +++ b/docs/api/zh/materials/ShaderMaterial.html @@ -0,0 +1,408 @@ + + + + + + + + + + + [page:Material] → + +

着色器材质([name])

+ +

使用自定义shader渲染的材质。 + shader是一个用[link:https://www.khronos.org/files/opengles_shading_language.pdf GLSL]编写的小程序 ,在GPU上运行。 + 您可能需要使用自定义shader,如果你要: +

    +
  • 要实现内置 [page:Material materials] 之外的效果。
  • +
  • 将许多对象组合成单个[page:Geometry]或[page:BufferGeometry]以提高性能。
  • +
+ 使用*ShaderMaterial*时需要注意以下注意事项: +
    +
  • *ShaderMaterial* 只有使用 [page:WebGLRenderer] 才可以绘制正常, + 因为 [link:https://en.wikipedia.org/wiki/Shader#Vertex_shaders vertexShader] + 和 [link:https://en.wikipedia.org/wiki/Shader#Pixel_shaders fragmentShader] + 属性中GLSL代码必须使用WebGL来编译并运行在GPU中。 +
  • +
  • 从 THREE r72开始,不再支持在ShaderMaterial中直接分配属性。 + 必须使用 [page:BufferGeometry]实例 (而不是 [page:Geometry] 实例),使用[page:BufferAttribute]实例来定义自定义属性。 +
  • +
  • 从 THREE r77开始,[page:WebGLRenderTarget] 或 [page:WebGLRenderTargetCube] 实例不再被用作uniforms。 + 必须使用它们的[page:Texture texture] 属性。 +
  • +
  • 内置attributes和uniforms与代码一起传递到shaders。 + 如果您不希望[page:WebGLProgram]向shader代码添加任何内容,则可以使用[page:RawShaderMaterial]而不是此类。 +
  • +
  • 您可以使用指令#pragma unroll_loop,以便通过shader预处理器在GLSL中展开for循环。 + 该指令必须放在循环的正上方。循环格式必须与定义的标准相对应。 +
      +
    • 循环必须标准化[link:https://en.wikipedia.org/wiki/Normalized_loop normalized]。 +
    • +
    • + 循环变量必须是*i*。 +
    • +
    • + 循环必须使用某种空格格式。 +
    • +
    + + #pragma unroll_loop + for ( int i = 0; i < 10; i ++ ) { + + // ... + + } + +
  • +
+

+ +

例子(Examples)

+ +

+ [example:webgl_animation_cloth webgl / animation / cloth ]
+ [example:webgl_buffergeometry_custom_attributes_particles webgl / buffergeometry / custom / attributes / particles]
+ [example:webgl_buffergeometry_selective_draw webgl / buffergeometry / selective / draw]
+ [example:webgl_custom_attributes webgl / custom / attributes]
+ [example:webgl_custom_attributes_lines webgl / custom / attributes / lines]
+ [example:webgl_custom_attributes_points webgl / custom / attributes / points]
+ [example:webgl_custom_attributes_points2 webgl / custom / attributes / points2]
+ [example:webgl_custom_attributes_points3 webgl / custom / attributes / points3]
+ [example:webgl_depth_texture webgl / depth / texture]
+ [example:webgl_gpgpu_birds webgl / gpgpu / birds]
+ [example:webgl_gpgpu_protoplanet webgl / gpgpu / protoplanet]
+ [example:webgl_gpgpu_water webgl / gpgpu / water]
+ [example:webgl_hdr webgl / hdr]
+ [example:webgl_interactive_points webgl / interactive / points]
+ [example:webgl_kinect webgl / kinect]
+ [example:webgl_lights_hemisphere webgl / lights / hemisphere]
+ [example:webgl_marchingcubes webgl / marchingcubes]
+ [example:webgl_materials_bumpmap_skin webgl / materials / bumpmap / skin]
+ [example:webgl_materials_envmaps webgl / materials / envmaps]
+ [example:webgl_materials_lightmap webgl / materials / lightmap]
+ [example:webgl_materials_parallaxmap webgl / materials / parallaxmap]
+ [example:webgl_materials_shaders_fresnel webgl / materials / shaders / fresnel]
+ [example:webgl_materials_skin webgl / materials / skin]
+ [example:webgl_materials_texture_hdr webgl / materials / texture / hdr]
+ [example:webgl_materials_wireframe webgl / materials / wireframe]
+ [example:webgl_modifier_tessellation webgl / modifier / tessellation]
+ [example:webgl_nearestneighbour webgl / nearestneighbour]
+ [example:webgl_postprocessing_dof2 webgl / postprocessing / dof2]
+ [example:webgl_postprocessing_godrays webgl / postprocessing / godrays] + +

+ + + var material = new THREE.ShaderMaterial( { + + uniforms: { + + time: { value: 1.0 }, + resolution: { value: new THREE.Vector2() } + + }, + + vertexShader: document.getElementById( 'vertexShader' ).textContent, + + fragmentShader: document.getElementById( 'fragmentShader' ).textContent + + } ); + + +

顶点着色器和片元着色器(Vertex shaders and fragment shaders)

+ +
+

您可以为每种材质指定两种不同类型的shaders::

+
    +
  • 顶点着色器首先运行; 它接收*attributes*, + 计算/操纵每个单独顶点的位置,并将其他数据(*varying*s)传递给片元着色器。 +
  • +
  • + 片元(或像素)着色器后运行; 它设置渲染到屏幕的每个单独的“片元”(像素)的颜色。 +
  • +
+

shader中有三种类型的变量: uniforms, attributes, 和 varyings:

+
    +
  • *Uniforms*是所有顶点都具有相同的值的变量。 + 比如灯光,雾,和阴影贴图就是被储存在uniforms中的数据。 + uniforms可以通过顶点着色器和片元着色器来访问。 +
  • +
  • *Attributes* 与每个顶点关联的变量。例如,顶点位置,法线和顶点颜色都是存储在attributes中的数据。attributes + 可以在顶点着色器中访问。 +
  • +
  • *Varyings* 是从顶点着色器传递到片元着色器的变量。对于每一个片元,每一个varying的值将是相邻顶点值的平滑插值。 +
  • +
+

注意:在shader 内部,uniforms和attributes就像常量;你只能使用JavaScript代码通过缓冲区来修改它们的值。 +

+
+ + +

内置attributes 和 uniforms(Built-in attributes and uniforms)

+ +
+

+ [page:WebGLRenderer]默认情况下为shader提供了许多attributes和uniforms; + 这些变量定义在shader程序编译时被自动添加到*片元着色器*和*顶点着色器*代码的前面,你不需要自己声明它们。 + 这些变量的描述请参见[page:WebGLProgram]。 +

+

+ 这些uniforms或attributes(例如,那些和照明,雾等相关的)要求属性设置在材质上, + 以便 [page:WebGLRenderer]来拷贝合适的值到GPU中。 + 如果你想在自己的shader中使用这些功能,请确保设置这些标志。 +

+

+ 如果你不希望[page:WebGLProgram] 向你的shader代码中添加任何东西, + 你可以使用[page:RawShaderMaterial] 而不是这个类。 +

+
+ + +

自定义 attributes 和 uniforms(Custom attributes and uniforms)

+ +
+

+ 自定义attributes和uniforms必须在GLSL着色器代码中声明(在 *vertexShader* 和/或 *fragmentShader* 中)。 + 自定义uniforms必须定义为 *ShaderMaterial* 的 *uniforms* 属性, + 而任何自定义attribtes必须通过[page:BufferAttribute]实例来定义。 + 注意 *varying*s 只需要在shader代码中声明(而不必在材质中)。 +

+

要声明一个自定义属性,更多细节请参考[page:BufferGeometry]页面, + 以及 [page:BufferAttribute] 页面关于*BufferAttribute* 接口。 +

+

+ 当创建attributes时,您创建的用来保存属性数据的每个类型化数组(typed array)必须是您的数据类型大小的倍数。 + 比如,如果你的属性是一个[page:Vector3 THREE.Vector3]类型,并且在你的缓存几何模型[page:BufferGeometry]中有3000个顶点, + 那么你的类型化数组的长度必须是3000 * 3,或者9000(一个顶点一个值)。每个数据类型的尺寸如下表所示: +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
属性尺寸
GLSL 类型JavaScript 类型尺寸
float[page:Number]1
vec2[page:Vector2 THREE.Vector2]2
vec3[page:Vector3 THREE.Vector3]3
vec3[page:Color THREE.Color]3
vec4[page:Vector4 THREE.Vector4]4
+ +

+ 请注意,属性缓冲区 不会 在其值更改时自动刷新。要更新自定义属性, + 需要在模型的[page:BufferAttribute]中设置*needsUpdate*为true。 + (查看[page:BufferGeometry]了解细节)。 +

+ +

+ 要声明一个自定义的[page:Uniform],使用*uniforms*属性: + + uniforms: { + time: { value: 1.0 }, + resolution: { value: new THREE.Vector2() } + } + +

+ +

+ 在[page:Object3D.onBeforeRender]中,建议根据[page:Object3D object]和[page:Camera camera]来更新自定义[page:Uniform]的值。 + 因为 [page:Material] 可以被[page:Mesh meshes],[page:Scene]的[page:Matrix4 matrixWorld]以及[page:Camera]共享, + 会在[page:WebGLRenderer.render]中更新,并会对拥有私有[page:Camera cameras]的[page:Scene scene]的渲染造成影响。 +

+ +
+ +

构造函数(Constructor)

+ +

[name]( [param:Object parameters] )

+

[page:Object parameters] - (可选)用于定义材质外观的对象,具有一个或多个属性。 + 材质的任何属性都可以从此处传入(包括从[page:Material]继承的任何属性)。 +

+ +

属性(Properties)

+

常用属性请参见基类[page:Material]。

+ +

[property:Boolean clipping]

+

定义此材质是否支持剪裁; 如果渲染器传递clippingPlanes uniform,则为true。默认值为false。 +

+ +

[property:Object defaultAttributeValues]

+

当渲染的几何体不包含这些属性但材质包含这些属性时,这些默认值将传递给shaders。这可以避免在缓冲区数据丢失时出错。 + + +this.defaultAttributeValues = { + 'color': [ 1, 1, 1 ], + 'uv': [ 0, 0 ], + 'uv2': [ 0, 0 ] +}; + + +

+ + +

[property:Object defines]

+

使用 #define 指令在GLSL代码为顶点着色器和片段着色器定义自定义常量;每个键/值对产生一行定义语句: + + defines: { + FOO: 15, + BAR: true + } + + 这将在GLSL代码中产生如下定义语句: + + #define FOO 15 + #define BAR true + +

+ +

[property:Object extensions]

+

一个有如下属性的对象: + +this.extensions = { + derivatives: false, // set to use derivatives + fragDepth: false, // set to use fragment depth values + drawBuffers: false, // set to use draw buffers + shaderTextureLOD: false // set to use shader texture LOD +}; + +

+ + +

[property:Boolean fog]

+

定义材质颜色是否受全局雾设置的影响; 如果将fog uniforms传递给shader,则为true。默认值为false。 +

+ + +

[property:String fragmentShader]

+

+ 片元着色器的GLSL代码。这是shader程序的实际代码。在上面的例子中, + *vertexShader* 和 *fragmentShader* 代码是从DOM(HTML文档)中获取的; + 它也可以作为一个字符串直接传递或者通过AJAX加载。 +

+ +

[property:String index0AttributeName]

+

如果设置,则调用[link:https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/bindAttribLocation gl.bindAttribLocation] + 将通用顶点索引绑定到属性变量。默认值未定义。 + +

+ +

[property:Boolean isShaderMaterial]

+

用于检查此类或派生类是否为着色器材质。默认值为 *true*。

+ 因为其通常用在内部优化,所以不应该更改该属性值。 +

+ + + + +

[property:Boolean lights]

+

材质是否受到光照的影响。默认值为 *false*。如果传递与光照相关的uniform数据到这个材质,则为true。默认是false。 +

+ +

[property:Float linewidth]

+

控制线框宽度。默认值为1。

+ 由于[link:https://www.khronos.org/registry/OpenGL/specs/gl/glspec46.core.pdf OpenGL Core Profile]与大多数平台上[page:WebGLRenderer WebGL]渲染器的限制,无论如何设置该值,线宽始终为1。 +

+ + +

[property:Boolean morphTargets]

+

定义材质是否使用 morphTargets。如果将morphTarget attributes传递到此shader,则为true。 +

+ +

[property:boolean morphNormals]

+

定义材质是否使用 morphNormals。设置为true,将从[page:Geometry]传递morphNormal属性给shader。默认值是*false*。 +

+ + +

[property:WebGLProgram program]

+

与此材质相关联的编译后的shader程序,由[page:WebGLRenderer]生成。您应该不需要访问此属性。 +

+ +

[property:Boolean flatShading]

+

定义材质是否使用平面着色进行渲染。默认值为false。 +

+ + +

[property:Boolean skinning]

+

定义材质是否使用蒙皮; 如果将蒙皮属性传递给shader,则为true。默认值为false。 +

+ +

[property:Object uniforms]

+

如下形式的对象: + +{ "uniform1": { value: 1.0 }, "uniform2": { value: 2 } } + + 指定要传递给shader代码的uniforms;键为uniform的名称,值(value)是如下形式: + + { value: 1.0 } + + 这里 *value* 是uniform的值。名称必须匹配 uniform 的name,和GLSL代码中的定义一样。 + 注意,uniforms逐帧被刷新,所以更新uniform值将立即更新GLSL代码中的相应值。 +

+ + +

[property:Number vertexColors]

+

通过定义*colors*属性的生成方式来定义顶点是如何着色的。 + 可选值为[page:Materials THREE.NoColors], [page:Materials THREE.FaceColors] 和 + [page:Materials THREE.VertexColors]。 缺省为 THREE.NoColors。 +

+ +

[property:String vertexShader]

+

顶点着色器的GLSL代码。这是shader程序的实际代码。 + 在上面的例子中,*vertexShader* 和 *fragmentShader* 代码是从DOM(HTML文档)中获取的; + 它也可以作为一个字符串直接传递或者通过AJAX加载。 +

+ +

[property:Boolean wireframe]

+

将几何体渲染为线框(通过GL_LINES而不是GL_TRIANGLES)。默认值为*false*(即渲染为平面多边形)。 +

+ +

[property:Float wireframeLinewidth]

+

控制线框宽度。默认值为1。

+ 由于[link:https://www.khronos.org/registry/OpenGL/specs/gl/glspec46.core.pdf OpenGL Core Profile]与大多数平台上[page:WebGLRenderer WebGL]渲染器的限制,无论如何设置该值,线宽始终为1。 +

+ + + +

方法(Methods)

+

常用方法请参见基类[page:Material]。

+ +

[method:ShaderMaterial clone]() [param:ShaderMaterial this]

+

创建该材质的一个浅拷贝。需要注意的是,vertexShader和fragmentShader使用引用拷贝; + *attributes*的定义也是如此; + 这意味着,克隆的材质将共享相同的编译[page:WebGLProgram]; + 但是,*uniforms* 是 值拷贝,这样对不同的材质我们可以有不同的uniforms变量。 +

+ +

源码(Source)

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/materials/ShadowMaterial.html b/docs/api/zh/materials/ShadowMaterial.html new file mode 100644 index 00000000000000..33d1510398df86 --- /dev/null +++ b/docs/api/zh/materials/ShadowMaterial.html @@ -0,0 +1,64 @@ + + + + + + + + + + + [page:Material] → [page:ShaderMaterial] → + +

阴影材质([name])

+ +

+ 此材质可以接收阴影,但在其他方面完全透明。 +

+ +

例子(Example)

+ [example:webgl_geometry_spline_editor geometry / spline / editor] + + +var planeGeometry = new THREE.PlaneGeometry( 2000, 2000 ); +planeGeometry.rotateX( - Math.PI / 2 ); + +var planeMaterial = new THREE.ShadowMaterial(); +planeMaterial.opacity = 0.2; + +var plane = new THREE.Mesh( planeGeometry, planeMaterial ); +plane.position.y = -200; +plane.receiveShadow = true; +scene.add( plane ); + + +

构造函数(Constructor)

+ +

[name]( [param:Object parameters] )

+

[page:Object parameters] - (可选)用于定义材质外观的对象,具有一个或多个属性。 + 材质的任何属性都可以从此处传入(包括从[page:Material] 和 [page:ShaderMaterial]继承的任何属性)。

+

+ + +

属性(Properties)

+

常用属性请参见基类[page:Material]和[page:ShaderMaterial]。

+ +

[property:Boolean isShadowMaterial]

+

用于检查此类或派生类是否为阴影材质。默认值为 *true*。

+ 因为其通常用在内部优化,所以不应该更改该属性值。 +

+ +

[property:Boolean lights]

+

材质是否受到光照的影响。默认值为 *true*。

+ +

[property:Boolean transparent]

+

定义此材质是否透明。默认值为 *true*。

+ +

方法(Methods)

+

常用方法请参见基类[page:Material]和[page:ShaderMaterial]。

+ +

源码(Source)

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/materials/SpriteMaterial.html b/docs/api/zh/materials/SpriteMaterial.html new file mode 100644 index 00000000000000..c6e53d0e0657b9 --- /dev/null +++ b/docs/api/zh/materials/SpriteMaterial.html @@ -0,0 +1,79 @@ + + + + + + + + + + + [page:Material] → + +

点精灵材质([name])

+ +

一种使用[page:Sprite]的材质。

+ +

例子(Examples)

+
+ [example:webgl_sprites WebGL / sprites]
+ [example:misc_ubiquity_test misc / ubiquity / test]
+ [example:misc_ubiquity_test2 misc / ubiquity / test2]
+ [example:software_sandbox software / sandbox]
+ [example:svg_sandbox svg / sandbox]
+ [example:webgl_materials_cubemap_dynamic webgl / materials / cubemap / dynamic] +
+ + +var spriteMap = new THREE.TextureLoader().load( 'textures/sprite.png' ); + +var spriteMaterial = new THREE.SpriteMaterial( { map: spriteMap, color: 0xffffff } ); + +var sprite = new THREE.Sprite( spriteMaterial ); +sprite.scale.set(200, 200, 1) + +scene.add( sprite ); + + + + +

[name]( [param:Object parameters] )

+

+ [page:Object parameters] - (可选)用于定义材质外观的对象,具有一个或多个属性。 + 材质的任何属性都可以从此处传入(包括从[page:Material] 和 [page:ShaderMaterial]继承的任何属性)。

+ + 属性[page:Hexadecimal color]例外,其可以作为十六进制字符串传递,默认情况下为 *0xffffff*(白色), + 内部调用[page:Color.set](color)。 + SpriteMaterials不会被[page:Material.clippingPlanes]裁剪。 +

+ + +

属性(Properties)

+

常用属性请参见基类[page:Material]。

+ +

[property:Color color]

+

材质的颜色([page:Color]),默认值为白色 (0xffffff)。 [page:.map]会和 color 相乘。

+ +

[property:boolean fog]

+

材质是否受场景雾的影响。默认值为*false*。

+ +

[property:Boolean lights]

+

材质是否受到光照的影响。默认值为 *false*。

+ +

[property:Texture map]

+

颜色贴图。默认为null。

+ +

[property:Radians rotation]

+

sprite的转动,以弧度为单位。默认值为0。

+ +

[property:Boolean sizeAttenuation]

+

精灵的大小是否会被相机深度衰减。(仅限透视摄像头。)默认为*true*。

+ +

方法(Methods)

+

常用方法请参见基类[page:Material]。

+ +

源码(Source)

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/math/Box2.html b/docs/api/zh/math/Box2.html new file mode 100644 index 00000000000000..9e85ba69a64332 --- /dev/null +++ b/docs/api/zh/math/Box2.html @@ -0,0 +1,192 @@ + + + + + + + + + + +

[name]

+ +

+ 表示二维空间中的一个包围盒。 +

+ + +

构造函数(Constructor)

+ + +

[name]( [param:Vector2 min], [param:Vector2 max] )

+

+ [page:Vector2 min] - (可选) [page:Vector2] 表示该盒子的下边界(x, y)。默认值为( + Infinity, + Infinity )。
+ + [page:Vector2 max] - (可选) [page:Vector2] 表示该盒子的上边界(x, y)。默认值为( - Infinity, - Infinity )。

+ 创建一个介于最小和最大值之间的[name]。 +

+ + +

属性(Properties)

+ + + +

[property:Vector2 min]

+

+ [page:Vector2] 表示该盒子的下边界(x, y)。
+ 默认值为( + Infinity, + Infinity )。 +

+ +

[property:Vector2 max]

+

+ [page:Vector2] 表示该盒子的上边界(x, y)。
+ 默认值为( - Infinity, - Infinity )。 +

+ + + +

方法(Methods)

+ +

[method:Vector2 clampPoint]( [param:Vector2 point], [param:Vector2 target] )

+

+ [page:Vector2 point] - clamp 的位置 ([page:Vector2])
+ [page:Vector2 target] — 结果会被复制到该二维向量中。

+ 在该盒子范围内夹紧([link:https://en.wikipedia.org/wiki/Clamping_(graphics) Clamps])[page:Vector2 point]。
+

+ +

[method:Box2 clone]()

+

返回一个新的[page:Box2],其[page:.min min]和[page:.max max]与此盒子相同。

+ +

[method:Boolean containsBox]( [param:Box2 box] )

+

+ [page:Box2 box] - 要检查是否被包含的盒子。

+ 如果盒子包含整个被检查盒子,则返回true。如果两者重叠,
+ 也会返回true。 +

+ +

[method:Boolean containsPoint]( [param:Vector2 point] )

+

+ [page:Vector2 point] - 要检查是否被包含的点[page:Vector2]。

+ 如果指定的点([page:Vector2 point])位于盒子的边界内或边界上,则返回true。 +

+ +

[method:Box2 copy]( [param:Box2 box] )

+

+ 将[page:Box2 box]的[page:.min min] 和 [page:.max max]复制到此盒子中。 +

+ +

[method:Float distanceToPoint]( [param:Vector2 point] )

+

+ [page:Vector2 point] - 要测量距离的点([page:Vector2])。

+ 返回这个盒子的任何边缘到指定点的距离。如果这个点([page:Vector2 point])位于这个盒子里,距离将是0。 +

+ +

[method:Boolean equals]( [param:Box2 box] )

+

+ [page:Box2 box] - 要对比的盒子

+ 如果这个盒子和被对比盒子具有相同的上下边界,则返回true。 +

+ +

[method:Box2 expandByPoint]( [param:Vector2 point] )

+

+ [page:Vector2 point] - 应该被盒子包含的点。

+ 扩展盒子的边界来包含该点。 +

+ +

[method:Box2 expandByScalar]( [param:float scalar] )

+

+ [page:float scalar] - 盒子扩展的距离。

+ 在每个维度上扩展参数scalar所指定的距离,如果为负数,则盒子空间将收缩。 +

+ +

[method:Box2 expandByVector]( [param:Vector2 vector] )

+

+ [page:Vector2 vector] - 按照该向量扩展。

+ 在每个维度中按vector的数值进行扩展。宽度在两个方向上的扩展将由vector的x分量确定, + 高度在两个方向上的扩展则由y分量确定。 +

+ +

[method:Vector2 getCenter]( [param:Vector2 target] )

+

+ [page:Vector2 target] — 结果将被复制到此二维向量中。

+ 以二维向量形式返回盒子的中心点。 +

+ +

[method:Vector2 getParameter]( [param:Vector2 point], [param:Vector2 target] )

+

+ [page:Vector2 point] - 二维向量([page:Vector2]).
+ [page:Vector2 target] — 结果将被复制到此二维向量中。

+ + 返回一个点作为此盒子的宽度和高度的比例。 +

+ +

[method:Vector2 getSize]( [param:Vector2 target] )

+

+ [page:Vector2 target] — 结果将被复制到此二维向量中。

+ + 返回此盒子的宽度和高度。 +

+ +

[method:Box2 intersect]( [param:Box2 box] )

+

+ [page:Box2 box] - 要相交的盒子。

+ 返回两者的相交后的盒子,并将相交后的盒子的上限设置为两者的上限中的较小者,将下限设置为两者的下限中的较大者。 +

+ +

[method:Boolean intersectsBox]( [param:Box2 box] )

+

+ [page:Box2 box] - 用来检查相交的盒子。

+ 确定该盒子是否和其相交。 +

+ +

[method:Boolean isEmpty]()

+

+ 如果这个盒子包含0个顶点,则返回true。
+ 请注意,一个下上边界相等的的盒子仍然包括一个点,一个两个边界共享的点。 +

+ +

[method:Box2 makeEmpty]()

+

使此盒子为空。

+ + +

[method:Box2 set]( [param:Vector2 min], [param:Vector2 max] )

+

+ [page:Vector2 min] - (必须 ) 表示该盒子的下边界(x, y)。
+ [page:Vector2 max] - (必须) 表示该盒子的上边界(x, y)。

+ + 设置这个盒子的上下(x, y)的界限。 +

+ +

[method:Box2 setFromCenterAndSize]( [param:Vector2 center], [param:Vector2 size] )

+

+ [page:Vector2 center] - 盒子所要设置的中心位置。 ([page:Vector2]).
+ [page:Vector2 size] - 盒子所要设置的x和y尺寸 ([page:Vector2]).

+ + 使盒子的中心点位于[page:Vector2 center],并设置宽高为[page:Vector2 size]中指定的值。 +

+ +

[method:Box2 setFromPoints]( [param:Array points] )

+

+ [page:Array points] - 点的集合,由这些点确定的空间将被盒子包围。

+ 设置这个盒子的上下边界,来包含所有设置在[page:Array points]参数中的点。 +

+ +

[method:Box2 translate]( [param:Vector2 offset] )

+

+ [page:Vector2 offset] - 偏移方向和距离。

+ 添加 [page:Vector2 offset] 到这个盒子的上下边界,实际上在2D空间移动这个盒子[page:Vector2 offset]个单位。 +

+ +

[method:Box2 union]( [param:Box2 box] )

+

+ [page:Box2 box] - 将要与该盒子联合的盒子

+ 在[page:Box2 box]参数的上边界和该盒子的上边界之间取较大者,而对两者的下边界取较小者,这样获得一个新的较大的联合盒子。 +

+ + + +

源码(Source)

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/math/Box3.html b/docs/api/zh/math/Box3.html new file mode 100644 index 00000000000000..a657e85522f68e --- /dev/null +++ b/docs/api/zh/math/Box3.html @@ -0,0 +1,302 @@ + + + + + + + + + + +

[name]

+ +

+ 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. +

+ + +

Constructor

+ + +

[name]( [param:Vector3 min], [param:Vector3 max] )

+

+ [page:Vector3 min] - (optional) [page:Vector3] representing the lower (x, y, z) boundary of the box. + Default is ( + Infinity, + Infinity, + Infinity ).
+ + [page:Vector3 max] - (optional) [page:Vector3] representing the lower upper (x, y, z) boundary of the box. + Default is ( - Infinity, - Infinity, - Infinity ).

+ + Creates a [name] bounded by min and max. +

+ +

Properties

+ +

[property:Boolean isBox3]

+

+ Used to check whether this or derived classes are Box3s. Default is *true*.

+ + You should not change this, as it used internally for optimisation. +

+ +

[property:Vector3 min]

+

+ [page:Vector3] representing the lower (x, y, z) boundary of the box.
+ Default is ( + Infinity, + Infinity, + Infinity ). +

+ +

[property:Vector3 max]

+

+ [page:Vector3] representing the upper (x, y, z) boundary of the box.
+ Default is ( - Infinity, - Infinity, - Infinity ). +

+ + + +

Methods

+ +

[method:Box3 applyMatrix4]( [param:Matrix4 matrix] )

+

+ [page:Matrix4 matrix] - The [page:Matrix4] to apply

+ + Transforms this Box3 with the supplied matrix. +

+ +

[method:Vector3 clampPoint]( [param:Vector3 point], [param:Vector3 target] )

+

+ [page:Vector3 point] - [page:Vector3] to clamp.
+ [page:Vector3 target] — the result will be copied into this Vector3.

+ + [link:https://en.wikipedia.org/wiki/Clamping_(graphics) Clamps] the [page:Vector3 point] within the bounds of this box.
+

+ +

[method:Box3 clone]()

+

Returns a new [page:Box3] with the same [page:.min min] and [page:.max max] as this one.

+ +

[method:Boolean containsBox]( [param:Box3 box] )

+

+ [page:Box3 box] - [page:Box3 Box3] to test for inclusion.

+ + Returns true if this box includes the entirety of [page:Box3 box]. If this and [page:Box3 box] are identical,
+ this function also returns true. +

+ +

[method:Boolean containsPoint]( [param:Vector3 point] )

+

+ [page:Vector3 point] - [page:Vector3] to check for inclusion.

+ + Returns true if the specified [page:Vector3 point] lies within or on the boundaries of this box. +

+ +

[method:Box3 copy]( [param:Box3 box] )

+

+ [page:Box3 box] - [page:Box3] to copy.

+ + Copies the [page:.min min] and [page:.max max] from [page:Box3 box] to this box. +

+ +

[method:Float distanceToPoint]( [param:Vector3 point] )

+

+ [page:Vector3 point] - [page:Vector3] to measure distance to.

+ + Returns the distance from any edge of this box to the specified point. + If the [page:Vector3 point] lies inside of this box, the distance will be 0. +

+ + +

[method:Boolean equals]( [param:Box3 box] )

+

+ [page:Box3 box] - Box to compare with this one.

+ + Returns true if this box and [page:Box3 box] share the same lower and upper bounds. +

+ +

[method:Box3 expandByObject]( [param:Object3D object] )

+

+ [page:Object3D object] - [page:Object3D] to expand the box by.

+ + Expands the boundaries of this box to include [page:Object3D object] and its children, + accounting for the object's, and children's, world transforms. + +

+ +

[method:Box3 expandByPoint]( [param:Vector3 point] )

+

+ [page:Vector3 point] - [page:Vector3] that should be included in the box.

+ + Expands the boundaries of this box to include [page:Vector3 point]. +

+ +

[method:Box3 expandByScalar]( [param:float scalar] )

+

+ [page:float scalar] - Distance to expand the box by.

+ + Expands each dimension of the box by [page:float scalar]. If negative, the dimensions of the box + will be contracted. +

+ +

[method:Box3 expandByVector]( [param:Vector3 vector] )

+

+ [page:Vector3 vector] - [page:Vector3] to expand the box by.

+ + Expands this box equilaterally by [page:Vector3 vector]. The width of this box will be + expanded by the x component of [page:Vector3 vector] in both directions. The height of + this box will be expanded by the y component of [page:Vector3 vector] in both directions. + The depth of this box will be expanded by the z component of *vector* in both directions. +

+ +

[method:Sphere getBoundingSphere]( [param:Sphere target] )

+

+ [page:Sphere target] — the result will be copied into this Sphere.

+ + Gets a [page:Sphere] that bounds the box. +

+ +

[method:Vector3 getCenter]( [param:Vector3 target] )

+

+ [page:Vector3 target] — the result will be copied into this Vector3.

+ + Returns the center point of the box as a [page:Vector3]. +

+ +

[method:Vector3 getParameter]( [param:Vector3 point], [param:Vector3 target] )

+

+ [page:Vector3 point] - [page:Vector3].
+ [page:Vector3 target] — the result will be copied into this Vector3.

+ + Returns a point as a proportion of this box's width and height. +

+ +

[method:Vector3 getSize]( [param:Vector3 target] )

+

+ [page:Vector3 target] — the result will be copied into this Vector3.

+ + Returns the width, height and depth of this box. +

+ +

[method:Box3 intersect]( [param:Box3 box] )

+

+ [page:Box3 box] - Box to intersect with.

+ + Returns the intersection of this and [page:Box3 box], setting the upper bound of this box to the lesser + of the two boxes' upper bounds and the lower bound of this box to the greater of the two boxes' + lower bounds. +

+ +

[method:Boolean intersectsBox]( [param:Box3 box] )

+

+ [page:Box3 box] - Box to check for intersection against.

+ + Determines whether or not this box intersects [page:Box3 box]. +

+ +

[method:Boolean intersectsPlane]( [param:Plane plane] )

+

+ [page:Plane plane] - [page:Plane] to check for intersection against.

+ + Determines whether or not this box intersects [page:Plane plane]. +

+ +

[method:Boolean intersectsSphere]( [param:Sphere sphere] )

+

+ [page:Sphere sphere] - [page:Sphere] to check for intersection against.

+ + Determines whether or not this box intersects [page:Sphere sphere]. +

+ +

[method:Boolean intersectsTriangle]( [param:Triangle triangle] )

+

+ [page:Triangle triangle] - [page:Triangle] to check for intersection against.

+ + Determines whether or not this box intersects [page:Triangle triangle]. +

+ +

[method:Boolean isEmpty]()

+

+ Returns true if this box includes zero points within its bounds.
+ Note that a box with equal lower and upper bounds still includes one point, + the one both bounds share. +

+ +

[method:Box3 makeEmpty]()

+

Makes this box empty.

+ +

[method:Box3 set]( [param:Vector3 min], [param:Vector3 max] )

+

+ [page:Vector3 min] - [page:Vector3] representing the lower (x, y, z) boundary of the box.
+ [page:Vector3 max] - [page:Vector3] representing the lower upper (x, y, z) boundary of the box.

+ + Sets the lower and upper (x, y, z) boundaries of this box. +

+ +

[method:Box3 setFromArray]( [param:Array array] ) [param:Box3 this]

+

+ array -- An array of position data that the resulting box will envelop.

+ + Sets the upper and lower bounds of this box to include all of the data in *array*. +

+ +

[method:Box3 setFromBufferAttribute]( [param:BufferAttribute attribute] ) [param:Box3 this]

+

+ [page:BufferAttribute attribute] - A buffer attribute of position data that the resulting box will envelop.

+ + Sets the upper and lower bounds of this box to include all of the data in [page:BufferAttribute attribute]. +

+ +

[method:Box3 setFromCenterAndSize]( [param:Vector3 center], [param:Vector3 size] )

+

+ [page:Vector3 center] - Desired center position of the box ([page:Vector3]).
+ [page:Vector3 size] - Desired x, y and z dimensions of the box ([page:Vector3]).

+ + Centers this box on [page:Vector3 center] and sets this box's width and height to the values specified + in [page:Vector3 size]. +

+ +

[method:Box3 setFromCenterAndSize]( [param:Vector3 center], [param:Vector3 size] ) [param:Box3 this]

+

+ [page:Vector3 center], - Desired center position of the box.
+ [page:Vector3 size] - Desired x, y and z dimensions of the box.

+ + Centers this box on [page:Vector3 center] and sets this box's width, height and depth to the values specified
+ in [page:Vector3 size] +

+ +

[method:Box3 setFromObject]( [param:Object3D object] )

+

+ [page:Object3D object] - [page:Object3D] to compute the bounding box of.

+ + Computes the world-axis-aligned bounding box of an [page:Object3D] (including its children), + accounting for the object's, and children's, world transforms. + +

+ +

[method:Box3 setFromPoints]( [param:Array points] )

+

+ [page:Array points] - Array of [page:Vector3 Vector3s] that the resulting box will contain.

+ + Sets the upper and lower bounds of this box to include all of the points in [page:Array points]. +

+ +

[method:Box3 translate]( [param:Vector3 offset] )

+

+ [page:Vector3 offset] - Direction and distance of offset.

+ + Adds [page:Vector3 offset] to both the upper and lower bounds of this box, effectively moving this box + [page:Vector3 offset] units in 3D space. +

+ +

[method:Box3 union]( [param:Box3 box] )

+

+ [page:Box3 box] - Box that will be unioned with this box.

+ + Unions this box with [page:Box3 box], setting the upper bound of this box to the greater of the + two boxes' upper bounds and the lower bound of this box to the lesser of the two boxes' + lower bounds. +

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/math/Color.html b/docs/api/zh/math/Color.html new file mode 100644 index 00000000000000..02c57a28151fd4 --- /dev/null +++ b/docs/api/zh/math/Color.html @@ -0,0 +1,323 @@ + + + + + + + + + + +

[name]

+ +

+ Class representing a color. +

+ + +

Examples

+ A Color can be initialised in any of the following ways: + +//empty constructor - will default white +var color = new THREE.Color(); + +//Hexadecimal color (recommended) +var color = new THREE.Color( 0xff0000 ); + +//RGB string +var color = new THREE.Color("rgb(255, 0, 0)"); +var color = new THREE.Color("rgb(100%, 0%, 0%)"); + +//X11 color name - all 140 color names are supported. +//Note the lack of CamelCase in the name +var color = new THREE.Color( 'skyblue' ); + +//HSL string +var color = new THREE.Color("hsl(0, 100%, 50%)"); + +//Separate RGB values between 0 and 1 +var color = new THREE.Color( 1, 0, 0 ); + + + + +

Constructor

+ + +

[name]( [param:Color_Hex_or_String r], [param:Float g], [param:Float b] )

+

+ [page:Color_Hex_or_String r] - (optional) If arguments [page:Float g] and [page:Float b] are defined, the red component of the color. + If they are not defined, it can be a [link:https://en.wikipedia.org/wiki/Web_colors#Hex_triplet hexadecimal triplet] (recommended), a CSS-style string, or another Color instance.
+ [page:Float g] - (optional) If it is defined, the green component of the color.
+ [page:Float b] - (optional) If it is defined, the blue component of the color.

+ + Note that standard method of specifying color in three.js is with a [link:https://en.wikipedia.org/wiki/Web_colors#Hex_triplet hexadecimal triplet], and that method is used + throughout the rest of the documentation.

+ + When all arguments are defined then [page:Color_Hex_or_String r] is the red component, [page:Float g] is the green component and [page:Float b] is the blue component of the color.
+ When only [page:Color_Hex_or_String r] is defined:
+

    +
  • It can be a [link:https://en.wikipedia.org/wiki/Web_colors#Hex_triplet hexadecimal triplet] representing the color (recommended).
  • +
  • It can be an another Color instance.
  • +
  • It can be a CSS-style string. For example: +
      +
    • 'rgb(250, 0,0)'
    • +
    • 'rgb(100%,0%,0%)'
    • +
    • 'hsl(0, 100%, 50%)'
    • +
    • '#ff0000'
    • +
    • '#f00'
    • +
    • 'red'
    • +
    + +
  • +
+

+ +

Properties

+ +

[property:Boolean isColor]

+

+ Used to check whether this or derived classes are Colors. Default is *true*.

+ + You should not change this, as it used internally for optimisation. +

+ +

[property:Float r]

+

+ Red channel value between 0 and 1. Default is 1. +

+ +

[property:Float g]

+

+ Green channel value between 0 and 1. Default is 1. +

+ +

[property:Float b]

+

+ Blue channel value between 0 and 1. Default is 1. +

+ + + + + + +

Methods

+ +

[method:Color add]( [param:Color color] )

+

Adds the RGB values of [page:Color color] to the RGB values of this color.

+ +

[method:Color addColors]( [param:Color color1], [param:Color color2] )

+

Sets this color's RGB values to the sum of the RGB values of [page:Color color1] and [page:Color color2].

+ +

[method:Color addScalar]( [param:Number s] )

+

Adds [page:Number s] to the RGB values of this color.

+ +

[method:Color clone]()

+

Returns a new Color with the same [page:.r r], [page:.g g] and [page:.b b] values as this one.

+ +

[method:Color copy]( [param:Color color] )

+

+ Copies the [page:.r r], [page:.g g] and [page:.b b] parameters from [page:Color color] in to this color. +

+ +

[method:Color convertGammaToLinear]( [param:Float gammaFactor] )

+

+ [page:Float gammaFactor] - (optional). Default is *2.0*.

+ Converts this color from gamma space to linear space by taking [page:.r r], [page:.g g] and [page:.b b] to the power of [page:Float gammaFactor]. +

+ +

[method:Color convertLinearToGamma]( [param:Float gammaFactor] )

+

+ [page:Float gammaFactor] - (optional). Default is *2.0*.

+ Converts this color from linear space to gamma space by taking [page:.r r], [page:.g g] and [page:.b b] to the power of 1 / [page:Float gammaFactor]. +

+ +

[method:Color convertLinearToSRGB]()

+

+ Converts this color from linear space to sRGB space. +

+ +

[method:Color convertSRGBToLinear]()

+

+ Converts this color from sRGB space to linear space. +

+ +

[method:Color copyGammaToLinear]( [param:Color color], [param:Float gammaFactor] )

+

+ [page:Color color] — Color to copy.
+ [page:Float gammaFactor] - (optional). Default is *2.0*.

+ + Copies the given color into this color, and then converts this color from gamma space to linear space + by taking [page:.r r], [page:.g g] and [page:.b b] to the power of [page:Float gammaFactor]. +

+ +

[method:Color copyLinearToGamma]( [param:Color color], [param:Float gammaFactor] )

+

+ [page:Color color] — Color to copy.
+ [page:Float gammaFactor] - (optional). Default is *2.0*.

+ + Copies the given color into this color, and then converts this color from linear space to gamma space + by taking [page:.r r], [page:.g g] and [page:.b b] to the power of 1 / [page:Float gammaFactor]. +

+ +

[method:Color copyLinearToSRGB]( [param:Color color]] )

+

+ [page:Color color] — Color to copy.
+ + Copies the given color into this color, and then converts this color from linear space to sRGB space. +

+ +

[method:Color copySRGBToLinear]( [param:Color color] )

+

+ [page:Color color] — Color to copy.
+ + Copies the given color into this color, and then converts this color from sRGB space to linear space. +

+ +

[method:Boolean equals]( [param:Color color] )

+

Compares the RGB values of [page:Color color] with those of this object. Returns true if they are the same, false otherwise.

+ +

[method:Color fromArray]( [param:Array array], [param:Integer offset] )

+

+ [page:Array array] - [page:Array] of floats in the form [ [page:Float r], [page:Float g], [page:Float b] ].
+ [page:Integer offset] - An optional offset into the array.

+ + Sets this color's components based on an array formatted like [ [page:Float r], [page:Float g], [page:Float b] ]. +

+ +

[method:Integer getHex]()

+

Returns the hexadecimal value of this color.

+ +

[method:String getHexString]()

+

Returns the hexadecimal value of this color as a string (for example, 'FFFFFF').

+ +

[method:Object getHSL]( [param:Object target] )

+

+ [page:Object target] — the result will be copied into this Object. Adds h, s and l keys to the object (if not already present).

+ + Convert this Color's [page:.r r], [page:.g g] and [page:.b b] values to [link:https://en.wikipedia.org/wiki/HSL_and_HSV HSL] + format and returns an object of the form: + + + { h: 0, s: 0, l: 0 } + + +

+ +

[method:String getStyle]()

+

Returns the value of this color as a CSS style string. Example: 'rgb(255,0,0)'.

+ +

[method:Color lerp]( [param:Color color], [param:Float alpha] )

+

+ [page:Color color] - color to converge on.
+ [page:Float alpha] - interpolation factor in the closed interval [0, 1].

+ + Linearly interpolates this color's RGB values toward the RGB values of the passed argument. + The alpha argument can be thought of as the ratio between the two colors, where 0.0 is + this color and 1.0 is the first argument. +

+ +

[method:Color lerpHSL]( [param:Color color], [param:Float alpha] )

+

+ [page:Color color] - color to converge on.
+ [page:Float alpha] - interpolation factor in the closed interval [0, 1].

+ + Linearly interpolates this color's HSL values toward the HSL values of the passed argument. + It differs from the classic [page:.lerp] by not interpolating straight from one color to the other, + but instead going through all the hues in between those two colors. + The alpha argument can be thought of as the ratio between the two colors, where 0.0 is + this color and 1.0 is the first argument. +

+ +

[method:Color multiply]( [param:Color color] )

+

Multiplies this color's RGB values by the given [page:Color color]'s RGB values.

+ +

[method:Color multiplyScalar]( [param:Number s] )

+

Multiplies this color's RGB values by [page:Number s].

+ +

[method:Color offsetHSL]( [param:Float h], [param:Float s], [param:Float l] )

+

+ Adds the given [page:Float h], [page:Float s], and [page:Float l] to this color's values. + Internally, this converts the color's [page:.r r], [page:.g g] and [page:.b b] values to HSL, adds + [page:Float h], [page:Float s], and [page:Float l], and then converts the color back to RGB. +

+ +

[method:Color set]( [param:Color_Hex_or_String value] )

+

+ [page:Color_Hex_or_String value] - Value to set this color to.

+ + See the Constructor above for full details of what [page:Color_Hex_or_String value] can be. + Delegates to [page:.copy], [page:.setStyle], or [page:.setHex] depending on input type. +

+ +

[method:Color setHex]( [param:Integer hex] )

+

+ [page:Integer hex] — [link:https://en.wikipedia.org/wiki/Web_colors#Hex_triplet hexadecimal triplet] format.

+ + Sets this color from a hexadecimal value. +

+ +

[method:Color setHSL]( [param:Float h], [param:Float s], [param:Float l] )

+

+ [page:Float h] — hue value between 0.0 and 1.0
+ [page:Float s] — saturation value between 0.0 and 1.0
+ [page:Float l] — lightness value between 0.0 and 1.0

+ + Sets color from HSL values. +

+ +

[method:Color setRGB]( [param:Float r], [param:Float g], [param:Float b] )

+

+ [page:Float r] — Red channel value between 0.0 and 1.0.
+ [page:Float g] — Green channel value between 0.0 and 1.0.
+ [page:Float b] — Blue channel value between 0.0 and 1.0.

+ + Sets this color from RGB values. +

+ +

[method:Color setScalar]( [param:Float scalar] )

+

+ [page:Float scalar] — a value between 0.0 and 1.0.

+ + Sets all three color components to the value [page:Float scalar]. +

+ +

[method:Color setStyle]( [param:String style] )

+

+ [page:String style] — color as a CSS-style string.

+ + Sets this color from a CSS-style string. For example, + "rgb(250, 0,0)", + "rgb(100%, 0%, 0%)", + "hsl(0, 100%, 50%)", + "#ff0000", + "#f00", or + "red" ( or any [link:https://en.wikipedia.org/wiki/X11_color_names#Color_name_chart X11 color name] + - all 140 color names are supported ).
+ + Translucent colors such as "rgba(255, 0, 0, 0.5)" and "hsla(0, 100%, 50%, 0.5)" are also accepted, + but the alpha-channel coordinate will be discarded.

+ + Note that for X11 color names, multiple words such as Dark Orange become the string 'darkorange' (all lowercase). +

+ +

[method:Color sub]( [param:Color color] )

+

+ Subtracts the RGB components of the given color from the RGB components of this color. + If this results in a negative component, that component is set to zero. +

+ +

[method:Array toArray]( [param:Array array], [param:Integer offset] )

+

+ [page:Array array] - An optional array to store the color to.
+ [page:Integer offset] - An optional offset into the array.

+ + Returns an array of the form [ r, g, b ]. +

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/math/Cylindrical.html b/docs/api/zh/math/Cylindrical.html new file mode 100644 index 00000000000000..cc2d76d76c4083 --- /dev/null +++ b/docs/api/zh/math/Cylindrical.html @@ -0,0 +1,73 @@ + + + + + + + + + + +

[name]

+ +

+ A point's [link:https://en.wikipedia.org/wiki/Cylindrical_coordinate_system cylindrical coordinates]. +

+ + +

Constructor

+ +

[name]( [param:Float radius], [param:Float theta], [param:Float y] )

+

+ [page:Float radius] - distance from the origin to a point in the x-z plane. + Default is *1.0*.
+ [page:Float theta] - counterclockwise angle in the x-z plane measured in radians + from the positive z-axis. Default is *0*.
+ [page:Float y] - height above the x-z plane. Default is *0*. +

+ + +

Properties

+ +

[property:Float radius]

+ +

[property:Float theta]

+ +

[property:Float y]

+ + +

Methods

+ +

[method:Cylindrical clone]()

+

+ Returns a new cylindrical with the same [page:.radius radius], [page:.theta theta] + and [page:.y y] properties as this one. +

+ +

[method:Cylindrical copy]( [param:Cylindrical other] )

+

+ Copies the values of the passed Cylindrical's [page:.radius radius], [page:.theta theta] + and [page:.y y] properties to this cylindrical. +

+ +

[method:Cylindrical set]( [param:Float radius], [param:Float theta], [param:Float y] )

+

Sets values of this cylindrical's [page:.radius radius], [page:.theta theta] + and [page:.y y] properties.

+ +

[method:Cylindrical setFromVector3]( [param:Vector3 vec3] )

+

+ Sets values of this cylindrical's [page:.radius radius], [page:.theta theta] + and [page:.y y] properties from the [page:Vector3 Vector3]. +

+ +

[method:Cylindrical setFromCartesianCoords]( [param:Float x], [param:Float y], [param:Float z] )

+

+ Sets values of this cylindrical's [page:.radius radius], [page:.theta theta] + and [page:.y y] properties from Cartesian coordinates. +

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/math/Euler.html b/docs/api/zh/math/Euler.html new file mode 100644 index 00000000000000..69e3aa42b347c0 --- /dev/null +++ b/docs/api/zh/math/Euler.html @@ -0,0 +1,192 @@ + + + + + + + + + + +

[name]

+ +

+ A class representing [link:http://en.wikipedia.org/wiki/Euler_angles Euler Angles].

+ + Euler angles describe a rotational transformation by rotating an object on its various + axes in specified amounts per axis, and a specified axis order. +

+ +

Example

+ + var a = new THREE.Euler( 0, 1, 1.57, 'XYZ' ); + var b = new THREE.Vector3( 1, 0, 1 ); + b.applyEuler(a); + + + +

Constructor

+ + +

[name]( [param:Float x], [param:Float y], [param:Float z], [param:String order] )

+

+ [page:Float x] - (optional) the angle of the x axis in radians. Default is *0*.
+ [page:Float y] - (optional) the angle of the y axis in radians. Default is *0*.
+ [page:Float z] - (optional) the angle of the z axis in radians. Default is *0*.
+ [page:String order] - (optional) a string representing the order that the rotations are applied, + defaults to 'XYZ' (must be upper case).

+ +

+ + +

Properties

+ +

[property:Boolean isEuler]

+

+ Used to check whether this or derived classes are Eulers. Default is *true*.

+ + You should not change this, as it used internally for optimisation. +

+ +

[property:String order]

+

+ The order in which to apply rotations. Default is 'XYZ', which means that the object will first be + rotated around its X axis, then its Y axis and finally its Z axis. Other possibilities are: + 'YZX', 'ZXY', 'XZY', 'YXZ' and 'ZYX'. These must be in upper case.

+ + Three.js uses intrinsic Tait-Bryan angles. This means that rotations are performed with respect + to the local coordinate system. That is, for order 'XYZ', the rotation is first around the local-X + axis (which is the same as the world-X axis), then around local-Y (which may now be different from the + world Y-axis), then local-Z (which may be different from the world Z-axis).

+ + If the order is changed, [page:.onChangeCallback onChangeCallback] will be called. +

+ +

[property:Float x]

+

+ The current value of the x component.

+ + If this is changed, [page:.onChangeCallback onChangeCallback] will be called. +

+ +

[property:Float y]

+

+ The current value of the y component.

+ + If this is changed, [page:.onChangeCallback onChangeCallback] will be called. +

+ +

[property:Float z]

+

+ The current value of the z component.

+ + If this is changed, [page:.onChangeCallback onChangeCallback] will be called. +

+ +

Methods

+ +

[method:Euler copy]( [param:Euler euler] )

+

Copies value of [page:Euler euler] to this euler.

+ +

[method:Euler clone]()

+

Returns a new Euler with the same parameters as this one.

+ +

[method:Boolean equals]( [param:Euler euler] )

+

Checks for strict equality of this euler and [page:Euler euler].

+ +

[method:Euler fromArray]( [param:Array array] )

+

+ [page:Array array] of length 3 or 4. The optional 4th argument corresponds to the [page:.order order].

+ + Assigns this euler's [page:.x x] angle to array[0].
+ Assigns this euler's [page:.y y] angle to array[1].
+ Assigns this euler's [page:.z z] angle to array[2].
+ Optionally assigns this euler's [page:.order order] to array[3]. +

+ +

[method:Euler onChange]( [param:Function onChangeCallback] )

+

+ [page:Function onChangeCallback] - set the value of the onChangeCallback() function. +

+ +

[method:Euler onChangeCallback]( )

+

+ By default this is an empty function, however it can be set via [page:.onChange onChange]().
+ It gets called after changing the [page:.x x], [page:.y y], [page:.z z] or [page:.order order] properties, + and also after calling most setter functions (see those for details). +

+ +

[method:Euler reorder]( [param:String newOrder] )

+

+ Resets the euler angle with a new order by creating a quaternion from this euler angle + and then setting this euler angle with the quaternion and the new order.

+ + WARNING: this discards revolution information. +

+ +

[method:Euler set]( [param:Float x], [param:Float y], [param:Float z], [param:String order] )

+

+ [page:.x x] - the angle of the x axis in radians.
+ [page:.y y] - the angle of the y axis in radians.
+ [page:.z z] - the angle of the z axis in radians.
+ [page:.order order] - (optional) a string representing the order that the rotations are applied.

+ + Sets the angles of this euler transform and optionally the [page:.order order] and then call [page:.onChangeCallback onChangeCallback](). +

+ +

[method:Euler setFromRotationMatrix]( [param:Matrix4 m], [param:String order], [param:Boolean update] )

+

+ [page:Matrix4 m] - a [page:Matrix4] of which the upper 3x3 of matrix is a pure + [link:https://en.wikipedia.org/wiki/Rotation_matrix rotation matrix] (i.e. unscaled).
+ [page:.order order] - (optional) a string representing the order that the rotations are applied.
+ [page:Boolean update] - (optional) whether to call [page:.onChangeCallback onChangeCallback]() after applying + the matrix.

+ + Sets the angles of this euler transform from a pure rotation matrix based on the orientation + specified by order. +

+ +

[method:Euler setFromQuaternion]( [param:Quaternion q], [param:String order], [param:Boolean update] )

+

+ [page:Quaternion q] - a normalized quaternion.
+ [page:.order order] - (optional) a string representing the order that the rotations are applied.
+ [page:Boolean update] - (optional) whether to call [page:.onChangeCallback onChangeCallback]() after applying + the matrix.

+ + Sets the angles of this euler transform from a normalized quaternion based on the orientation + specified by [page:.order order]. +

+ + +

[method:Euler setFromVector3]( [param:Vector3 vector], [param:String order] )

+

+ [page:Vector3 vector] - [page:Vector3].
+ [page:.order order] - (optional) a string representing the order that the rotations are applied.

+ + Set the [page:.x x], [page:.y y] and [page:.z z], and optionally update the [page:.order order]. [page:.onChangeCallback onChangeCallback]() + is called after these changes are made. +

+ + +

[method:Array toArray]( [param:Array array], [param:Integer offset] )

+

+ [page:Array array] - (optional) array to store the euler in.
+ [page:Integer offset] (optional) offset in the array.
+ + Returns an array of the form [[page:.x x], [page:.y y], [page:.z z], [page:.order order ]]. +

+ +

[method:Vector3 toVector3]( [param:Vector3 optionalResult] )

+

+ [page:Vector3 optionalResult] — (optional) If specified, the result will be copied into this Vector, + otherwise a new one will be created.

+ + Returns the Euler's [page:.x x], [page:.y y] and [page:.z z] properties as a [page:Vector3]. +

+ + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/math/Frustum.html b/docs/api/zh/math/Frustum.html new file mode 100644 index 00000000000000..755c80883a12d0 --- /dev/null +++ b/docs/api/zh/math/Frustum.html @@ -0,0 +1,121 @@ + + + + + + + + + + +

[name]

+ +

+ [link:http://en.wikipedia.org/wiki/Frustum Frustums] are used to determine what is + inside the camera's field of view. They help speed up the rendering process - object which lie + outside a camera's frustum can safely be excluded from rendering.

+ + This class is mainly intended for use internally by a renderer for calculating + a [page:Camera camera] or [page:LightShadow.camera shadowCamera]'s frustum. +

+ + +

Constructor

+ + +

[name]([param:Plane p0], [param:Plane p1], [param:Plane p2], [param:Plane p3], [param:Plane p4], [param:Plane p5])

+

+ [page:Plane p0] - (optional) defaults to a new [page:Plane].
+ [page:Plane p1] - (optional) defaults to a new [page:Plane].
+ [page:Plane p2] - (optional) defaults to a new [page:Plane].
+ [page:Plane p3] - (optional) defaults to a new [page:Plane].
+ [page:Plane p4] - (optional) defaults to a new [page:Plane].
+ [page:Plane p5] - (optional) defaults to a new [page:Plane].

+ + Creates a new [name]. +

+ + +

Properties

+ +

[property:Array planes]

+

Array of 6 [page:Plane planes].

+ + +

Methods

+ +

[method:Frustum clone]()

+

Return a new Frustum with the same parameters as this one.

+ + +

[method:Boolean containsPoint]( [param:Vector3 point] )

+

+ [page:Vector3 point] - [page:Vector3] to test.

+ + Checks to see if the frustum contains the [page:Vector3 point]. +

+ +

[method:Frustum copy]( [param:Frustum frustum] )

+

+ [page:Frustum frustum] - The frustum to copy

+ + Copies the properties of the passed [page:Frustum frustum] into this one. +

+ +

[method:Boolean intersectsBox]( [param:Box3 box] )

+

+ [page:Box3 box] - [page:Box3] to check for intersection.

+ + Return true if [page:Box3 box] intersects with this frustum. +

+ +

[method:Boolean intersectsObject]( [param:Object3D object] )

+

+ Checks whether the [page:Object3D object]'s [page:Geometry.boundingSphere bounding sphere] is intersecting the Frustum.

+ + Note that the object must have a [page:Geometry] or [page:BufferGeometry] so that the bounding sphere + can be calculated. +

+ +

[method:Boolean intersectsSphere]( [param:Sphere sphere] )

+

+ [page:Sphere sphere] - [page:Sphere] to check for intersection.

+ + Return true if [page:Sphere sphere] intersects with this frustum. +

+ +

[method:Boolean intersectsSprite]( [param:Sprite sprite] )

+

+ Checks whether the [page:Sprite sprite] is intersecting the Frustum.

+

+ +

[method:Frustum set]( [param:Plane p0], [param:Plane p1], [param:Plane p2], [param:Plane p3], [param:Plane p4], [param:Plane p5] )

+

+ Sets the current frustum from the passed planes. No plane order is implicitely implied. +

+ +

[method:Frustum setFromMatrix]( [param:Matrix4 matrix] )

+

+ [page:Matrix4 matrix] - [page:Matrix4] used to set the [page:.planes planes]

+ + This is used by the [page:WebGLRenderer] to set up the Frustum from a [page:Camera Camera]'s + [page:Camera.projectionMatrix projectionMatrix] and [page:Camera.matrixWorldInverse matrixWorldInverse]. +

+ + + + + + + + + + + + + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/math/Interpolant.html b/docs/api/zh/math/Interpolant.html new file mode 100644 index 00000000000000..37379631407a3d --- /dev/null +++ b/docs/api/zh/math/Interpolant.html @@ -0,0 +1,84 @@ + + + + + + + + + + +

[name]

+ +

+ Abstract base class of interpolants over parametric samples.

+ + The parameter domain is one dimensional, typically the time or a path along a curve defined by the data.

+ + The sample values can have any dimensionality and derived classes may apply special interpretations to the data.

+ + This class provides the interval seek in a Template Method, deferring the actual interpolation to derived classes.

+ + Time complexity is *O(1)* for linear access crossing at most two points and *O(log N)* for random access, + where *N* is the number of positions.

+ + References: [link:http://www.oodesign.com/template-method-pattern.html http://www.oodesign.com/template-method-pattern.html] +

+ + +

Constructor

+ + +

Constructor

+ +

[name]( parameterPositions, sampleValues, sampleSize, resultBuffer )

+

+ parameterPositions -- array of positions
+ sampleValues -- array of samples
+ sampleSize -- number of samples
+ resultBuffer -- buffer to store the interpolation results.

+ + Note: This is not designed to be called directly. +

+ +

Properties

+ + + +

[property:null parameterPositions]

+

+ +

+ +

[property:null resultBuffer]

+

+ +

+ +

[property:null sampleValues]

+

+ +

+ +

[property:Object settings]

+

+ Optional, subclass-specific settings structure. +

+ +

[property:null valueSize]

+

+ +

+ +

Methods

+ +

[method:null evaluate]( [param:Number t] )

+

+ Evaluate the interpolant at position *t*. +

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/math/Line3.html b/docs/api/zh/math/Line3.html new file mode 100644 index 00000000000000..b83b61f1e39e77 --- /dev/null +++ b/docs/api/zh/math/Line3.html @@ -0,0 +1,123 @@ + + + + + + + + + + +

[name]

+ +

A geometric line segment represented by a start and end point.

+ + +

Constructor

+ + +

[name]( [param:Vector3 start], [param:Vector3 end] )

+

+ [page:Vector3 start] - Start of the line segment. Default is (0, 0, 0).
+ [page:Vector3 end] - End of the line segment. Default is (0, 0, 0).

+ + Creates a new [name]. +

+ + +

Properties

+ +

[property:Vector3 start]

+

[page:Vector3] representing the start point of the line.

+ +

[property:Vector3 end]

+

[page:Vector3] representing the end point of the line.

+ + + + + +

Methods

+ +

[method:Line3 applyMatrix4]( [param:Matrix4 matrix] )

+

Applies a matrix transform to the line segment.

+ +

[method:Vector3 at]( [param:Float t], [param:Vector3 target] )

+

+ [page:Float t] - Use values 0-1 to return a position along the line segment.
+ [page:Vector3 target] — the result will be copied into this Vector3.

+ + Returns a vector at a certain position along the line. When [page:Float t] = 0, it returns the start vector, + and when [page:Float t] = 1 it returns the end vector.
+

+ +

[method:Line3 clone]()

+

Returns a new [page:Line3] with the same [page:.start start] and [page:.end end] vectors as this one.

+ +

[method:Vector3 closestPointToPoint]( [param:Vector3 point], [param:Boolean clampToLine], [param:Vector3 target] )

+

+ [page:Vector3 point] - return the closest point on the line to this point.
+ [page:Boolean clampToLine] - whether to clamp the returned value to the line segment.
+ [page:Vector3 target] — the result will be copied into this Vector3.

+ + Returns the closets point on the line. If [page:Boolean clampToLine] is true, then the returned value will be + clamped to the line segment. +

+ +

[method:Float closestPointToPointParameter]( [param:Vector3 point], [param:Boolean clampToLine] )

+

+ [page:Vector3 point] - the point for which to return a point parameter.
+ [page:Boolean clampToLine] - Whether to clamp the result to the range [0, 1].

+ + Returns a point parameter based on the closest point as projected on the line segement. + If [page:Boolean clampToLine] is true, then the returned value will be between 0 and 1. +

+ +

[method:Line3 copy]( [param:Line3 line] )

+

Copies the passed line's [page:.start start] and [page:.end end] vectors to this line.

+ +

[method:Vector3 delta]( [param:Vector3 target] )

+

+ [page:Vector3 target] — the result will be copied into this Vector3.

+ + Returns the delta vector of the line segment ( [page:.end end] vector minus the [page:.start start] vector). +

+ +

[method:Float distance]()

+

Returns the [link:https://en.wikipedia.org/wiki/Euclidean_distance Euclidean distance] + (straight-line distance) between the line's [page:.start start] and [page:.end end] points.

+ +

[method:Float distanceSq]()

+

+ Returns the square of the [link:https://en.wikipedia.org/wiki/Euclidean_distance Euclidean distance] + (straight-line distance) between the line's [page:.start start] + and [page:.end end] vectors. +

+ +

[method:Boolean equals]( [param:Line3 line] )

+

+ [page:Line3 line] - [page:Line3] to compare with this one.

+ + Returns true if both line's [page:.start start] and [page:.end en] points are equal. +

+ +

[method:Vector3 getCenter]( [param:Vector3 target] )

+

+ [page:Vector3 target] — the result will be copied into this Vector3.

+ + Returns the center of the line segment. +

+ +

[method:Line3 set]( [param:Vector3 start], [param:Vector3 end] )

+

+ [page:Vector3 start] - set the [page:.start start point] of the line.
+ [page:Vector3 end] - set the [page:.end end point] of the line.

+ + Sets the start and end values by copying the provided vectors. +

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/math/Math.html b/docs/api/zh/math/Math.html new file mode 100644 index 00000000000000..c87edd728f5323 --- /dev/null +++ b/docs/api/zh/math/Math.html @@ -0,0 +1,112 @@ + + + + + + + + + + +

[name]

+ +

An object with several math utility functions.

+ +

Functions

+ +

[method:Float clamp]( [param:Float value], [param:Float min], [param:Float max] )

+

+ [page:Float value] — Value to be clamped.
+ [page:Float min] — Minimum value.
+ [page:Float max] — Maximum value.

+ + Clamps the [page:Float value] to be between [page:Float min] and [page:Float max]. +

+ +

[method:Float degToRad]( [param:Float degrees] )

+

Converts degrees to radians.

+ +

[method:Integer euclideanModulo]( [param:Integer n], [param:Integer m] )

+

+ [page:Integer n], [page:Integer m] - Integers

+ + Computes the Euclidean modulo of [page:Integer m] % [page:Integer n], that is: + ( ( n % m ) + m ) % m +

+ +

[method:UUID generateUUID]( )

+

+ Generate a [link:https://en.wikipedia.org/wiki/Universally_unique_identifier UUID] + (universally unique identifier). +

+ +

[method:Boolean isPowerOfTwo]( [param:Number n] )

+

Return *true* if [page:Number n] is a power of 2.

+ +

[method:Float lerp]( [param:Float x], [param:Float y], [param:Float t] )

+

+ [page:Float x] - Start point.
+ [page:Float y] - End point.
+ [page:Float t] - interpolation factor in the closed interval [0, 1].

+ + Returns a value [link:https://en.wikipedia.org/wiki/Linear_interpolation linearly interpolated] + from two known points based on the given interval - [page:Float t] = 0 will return [page:Float x] + and [page:Float t] = 1 will return [page:Float y]. +

+ +

[method:Float mapLinear]( [param:Float x], [param:Float a1], [param:Float a2], [param:Float b1], [param:Float b2] )

+

+ [page:Float x] — Value to be mapped.
+ [page:Float a1] — Minimum value for range A.
+ [page:Float a2] — Maximum value for range A.
+ [page:Float b1] — Minimum value for range B.
+ [page:Float b2] — Maximum value for range B.

+ + Linear mapping of [page:Float x] from range [[page:Float a1], [page:Float a2]] to range [[page:Float b1], [page:Float b2]]. +

+ +

[method:Integer ceilPowerOfTwo]( [param:Number n] )

+

Returns the smallest power of 2 that is greater than or equal to [page:Number n].

+ +

[method:Integer floorPowerOfTwo]( [param:Number n] )

+

Returns the largest power of 2 that is less than or equal to [page:Number n].

+ +

[method:Float radToDeg]( [param:Float radians] )

+

Converts radians to degrees.

+ +

[method:Float randFloat]( [param:Float low], [param:Float high] )

+

Random float in the interval [page:Float low] to [page:Float high].

+ +

[method:Float randFloatSpread]( [param:Float range] )

+

Random float in the interval *- [page:Float range] / 2* to *[page:Float range] / 2*.

+ +

[method:Integer randInt]( [param:Integer low], [param:Integer high] )

+

Random integer in the interval [page:Float low] to [page:Float high].

+ +

[method:Float smoothstep]( [param:Float x], [param:Float min], [param:Float max] )

+

+ [page:Float x] - The value to evaluate based on its position between min and max.
+ [page:Float min] - Any x value below min will be 0.
+ [page:Float max] - Any x value above max will be 1.

+ + Returns a value between 0-1 that represents the percentage that x has moved between min and max, + but smoothed or slowed down the closer X is to the min and max.

+ + See [link:http://en.wikipedia.org/wiki/Smoothstep Smoothstep] for details. +

+ +

[method:Float smootherstep]( [param:Float x], [param:Float min], [param:Float max] )

+

+ [page:Float x] - The value to evaluate based on its position between min and max.
+ [page:Float min] - Any x value below min will be 0.
+ [page:Float max] - Any x value above max will be 1.

+ + Returns a value between 0-1. A [link:https://en.wikipedia.org/wiki/Smoothstep#Variations variation on smoothstep] + that has zero 1st and 2nd order derivatives at x=0 and x=1. +

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/math/Matrix3.html b/docs/api/zh/math/Matrix3.html new file mode 100644 index 00000000000000..d37791eaaa32cc --- /dev/null +++ b/docs/api/zh/math/Matrix3.html @@ -0,0 +1,204 @@ + + + + + + + + + + +

[name]

+ +

+ A class representing a 3x3 [link:https://en.wikipedia.org/wiki/Matrix_(mathematics) matrix]. +

+ +

Example

+ +var m = new Matrix3(); + + +

A Note on Row-Major and Column-Major Ordering

+

+ The [page:set]() method takes arguments in [link:https://en.wikipedia.org/wiki/Row-_and_column-major_order#Column-major_order row-major] + order, while internally they are stored in the [page:.elements elements] array in column-major order.

+ + This means that calling + +m.set( 11, 12, 13, + 21, 22, 23, + 31, 32, 33 ); + + will result in the [page:.elements elements] array containing: + +m.elements = [ 11, 21, 31, + 12, 22, 32, + 13, 23, 33 ]; + + and internally all calculations are performed using column-major ordering. However, as the actual ordering + makes no difference mathematically and most people are used to thinking about matrices in row-major order, + the three.js documentation shows matrices in row-major order. Just bear in mind that if you are reading the source + code, you'll have to take the [link:https://en.wikipedia.org/wiki/Transpose transpose] of any matrices outlined here to make sense of the calculations. +

+ +

Constructor

+ + +

[name]()

+

+ Creates and initializes the [name] to the 3x3 + [link:https://en.wikipedia.org/wiki/Identity_matrix identity matrix]. +

+ + + +

Properties

+ +

[property:Float32Array elements]

+

+ A [link:https://en.wikipedia.org/wiki/Row-_and_column-major_order column-major] + list of matrix values. +

+ +

[property:Boolean isMatrix3]

+

+ Used to check whether this or derived classes are Matrix3s. Default is *true*.

+ + You should not change this, as it used internally for optimisation. +

+ + + +

Methods

+ +

[method:Array applyToBufferAttribute]( [param:BufferAttribute attribute] )

+

+ [page:BufferAttribute attribute] - An attribute of floats that represent 3D vectors.

+ + Multiplies (applies) this matrix to every 3D vector in the [page:BufferAttribute attribute]. +

+ + +

[method:Matrix3 clone]()

+

Creates a new Matrix3 and with identical elements to this one.

+ +

[method:this copy]( [param:Matrix3 m] )

+

Copies the elements of matrix [page:Matrix3 m] into this matrix.

+ +

[method:Float determinant]()

+

+ Computes and returns the + [link:https://en.wikipedia.org/wiki/Determinant determinant] of this matrix. +

+ +

[method:Boolean equals]( [param:Matrix3 m] )

+

Return true if this matrix and [page:Matrix3 m] are equal.

+ +

[method:this fromArray]( [param:Array array], [param:Integer offset] )

+

+ [page:Array array] - the array to read the elements from.
+ [page:Integer offset] - (optional) index of first element in the array. Default is 0.

+ + Sets the elements of this matrix based on an array in + [link:https://en.wikipedia.org/wiki/Row-_and_column-major_order#Column-major_order column-major] format. +

+ +

[method:this getInverse]( [param:Matrix3 m], [param:Boolean throwOnDegenerate] )

+

+ [page:Matrix3 m] - the matrix to take the inverse of.
+ [page:Boolean throwOnDegenerate] - (optional) If true, throw an error if the matrix is degenerate (not invertible).

+ + Set this matrix to the [link:https://en.wikipedia.org/wiki/Invertible_matrix inverse] of the passed matrix [page:Matrix3 m], + using the [link:https://en.wikipedia.org/wiki/Invertible_matrix#Analytic_solution analytic method]. + + If [page:Boolean throwOnDegenerate] is not set and the matrix is not invertible, set this to the 3x3 identity matrix. +

+ +

[method:this getNormalMatrix]( [param:Matrix4 m] )

+

+ [page:Matrix4 m] - [page:Matrix4]

+ + Sets this matrix as the upper left 3x3 of the [link:https://en.wikipedia.org/wiki/Normal_matrix normal matrix] + of the passed [page:Matrix4 matrix4]. The normal matrix is the [link:https://en.wikipedia.org/wiki/Invertible_matrix inverse] [link:https://en.wikipedia.org/wiki/Transpose transpose] + of the matrix [page:Matrix4 m]. +

+ +

[method:this identity]()

+

+ Resets this matrix to the 3x3 identity matrix: + +1, 0, 0 +0, 1, 0 +0, 0, 1 + + +

+ +

[method:this multiply]( [param:Matrix3 m] )

+

Post-multiplies this matrix by [page:Matrix3 m].

+ +

[method:this multiplyMatrices]( [param:Matrix3 a], [param:Matrix3 b] )

+

Sets this matrix to [page:Matrix3 a] x [page:Matrix3 b].

+ +

[method:this multiplyScalar]( [param:Float s] )

+

Multiplies every component of the matrix by the scalar value *s*.

+ +

[method:this set]( [param:Float n11], [param:Float n12], [param:Float n13], [param:Float n21], [param:Float n22], [param:Float n23], [param:Float n31], [param:Float n32], [param:Float n33] )

+

+ [page:Float n11] - value to put in row 1, col 1.
+ [page:Float n12] - value to put in row 1, col 2.
+ ...
+ ...
+ [page:Float n32] - value to put in row 3, col 2.
+ [page:Float n33] - value to put in row 3, col 3.

+ + Sets the 3x3 matrix values to the given + [link:https://en.wikipedia.org/wiki/Row-_and_column-major_order row-major] + sequence of values. +

+ +

[method:this premultiply]( [param:Matrix3 m] )

+

Pre-multiplies this matrix by [page:Matrix3 m].

+ +

[method:this setFromMatrix4]( [param:Matrix4 m] )

+

Set this matrx to the upper 3x3 matrix of the Matrix4 [page:Matrix4 m].

+ +

[method:this setUvTransform]( [param:Float tx], [param:Float ty], [param:Float sx], [param:Float sy], [param:Float rotation], [param:Float cx], [param:Float cy] )

+

+ [page:Float tx] - offset x
+ [page:Float ty] - offset y
+ [page:Float sx] - repeat x
+ [page:Float sy] - repeat y
+ [page:Float rotation] - rotation (in radians)
+ [page:Float cx] - center x of rotation
+ [page:Float cy] - center y of rotation

+ + Sets the UV transform matrix from offset, repeat, rotation, and center. +

+ +

[method:Array toArray]( [param:Array array], [param:Integer offset] )

+

+ [page:Array array] - (optional) array to store the resulting vector in. If not given a new array will be created.
+ [page:Integer offset] - (optional) offset in the array at which to put the result.

+ + Writes the elements of this matrix to an array in + [link:https://en.wikipedia.org/wiki/Row-_and_column-major_order#Column-major_order column-major] format. +

+ +

[method:this transpose]()

+

[link:https://en.wikipedia.org/wiki/Transpose Transposes] this matrix in place.

+ +

[method:this transposeIntoArray]( [param:Array array] )

+

+ [page:Array array] - array to store the resulting vector in.

+ + [link:https://en.wikipedia.org/wiki/Transpose Transposes] this matrix into the supplied array, + and returns itself unchanged. +

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/math/Matrix4.html b/docs/api/zh/math/Matrix4.html new file mode 100644 index 00000000000000..e9b7ac7a63156d --- /dev/null +++ b/docs/api/zh/math/Matrix4.html @@ -0,0 +1,412 @@ + + + + + + + + + + +

[name]

+ +

+ A class representing a 4x4 [link:https://en.wikipedia.org/wiki/Matrix_(mathematics) matrix].

+ + The most common use of a 4x4 matrix in 3D computer graphics is as a + [link:https://en.wikipedia.org/wiki/Transformation_matrix Transformation Matrix]. + For an introduction to transformation matrices as used in WebGL, check out + [link:http://www.opengl-tutorial.org/beginners-tutorials/tutorial-3-matrices this tutorial].

+ + This allows a [page:Vector3] representing a point in 3D space to undergo transformations + such as translation, rotation, shear, scale, reflection, orthogonal or perspective projection + and so on, by being multiplied by the matrix. This is known as applying + the matrix to the vector.

+ + Every [page:Object3D] has three associated Matrix4s: +

    +
  • + [page:Object3D.matrix]: This stores the local transform of the object. This is the object's transformation relative to its parent. +
  • +
  • + [page:Object3D.matrixWorld]: The global or world transform of the object. If the object has no parent, then this is identical to the local transform stored in [page:Object3D.matrix matrix]. +
  • +
  • + [page:Object3D.modelViewMatrix]: This represents the object's transformation relative to the camera's coordinate system. + An object's modelViewMatrix is the object's matrixWorld pre-multiplied by the camera's matrixWorldInverse. +
  • +
+ + [page:Camera Cameras] have two additional Matrix4s: +
    +
  • + [page:Camera.matrixWorldInverse]: The view matrix - the inverse of the Camera's [page:Object3D.matrixWorld matrixWorld]. +
  • +
  • + [page:Camera.projectionMatrix]: Represents the information how to project the scene to clip space. +
  • +
+ Note: [page:Object3D.normalMatrix] is not a Matrix4, but a [page:Matrix3]. +

+ +

A Note on Row-Major and Column-Major Ordering

+

+ The [page:set]() method takes arguments in [link:https://en.wikipedia.org/wiki/Row-_and_column-major_order#Column-major_order row-major] + order, while internally they are stored in the [page:.elements elements] array in column-major order.

+ + This means that calling + +var m = new Matrix4(); + +m.set( 11, 12, 13, 14, + 21, 22, 23, 24, + 31, 32, 33, 34, + 41, 42, 43, 44 ); + + + will result in the [page:.elements elements] array containing: + +m.elements = [ 11, 21, 31, 41, + 12, 22, 32, 42, + 13, 23, 33, 43, + 14, 24, 34, 44 ]; + + and internally all calculations are performed using column-major ordering. However, as the actual ordering + makes no difference mathematically and most people are used to thinking about matrices in row-major order, + the three.js documentation shows matrices in row-major order. Just bear in mind that if you are reading the source + code, you'll have to take the [link:https://en.wikipedia.org/wiki/Transpose transpose] of any matrices outlined here to make sense of the calculations. +

+ + +

Constructor

+ + +

[name]()

+ +

+ Creates and initializes the [name] to the 4x4 + [link:https://en.wikipedia.org/wiki/Identity_matrix identity matrix]. +

+ +

Properties

+ +

[property:Float32Array elements]

+

+ A [link:https://en.wikipedia.org/wiki/Row-_and_column-major_order#Column-major_order column-major] + list of matrix values. +

+ +

[property:Boolean isMatrix4]

+

+ Used to check whether this or derived classes are Matrix4s. Default is *true*.

+ + You should not change this, as it used internally for optimisation. +

+ + + + +

Methods

+ +

[method:Array applyToBufferAttribute]( [param:BufferAttribute attribute] )

+

+ [page:BufferAttribute attribute] - An attribute of floats that represent 3D vectors.

+ + Multiplies (applies) this matrix to every 3D vector in the [page:BufferAttribute attribute]. +

+ + +

[method:Matrix4 clone]()

+

Creates a new Matrix4 with identical [page:.elements elements] to this one.

+ +

[method:this compose]( [param:Vector3 position], [param:Quaternion quaternion], [param:Vector3 scale] )

+

+ Sets this matrix to the transformation composed of [page:Vector3 position], + [page:Quaternion quaternion] and [page:Vector3 scale]. Internally this calls + [page:.makeRotationFromQuaternion makeRotationFromQuaternion]( [page:Quaternion quaternion] ) + followed by [page:.scale scale]( [page:Vector3 scale] ), then finally + [page:.setPosition setPosition]( [page:Vector3 position] ). +

+ +

[method:this copy]( [param:Matrix4 m] )

+

Copies the [page:.elements elements] of matrix [page:Matrix4 m] into this matrix.

+ +

[method:this copyPosition]( [param:Matrix4 m] )

+

+ Copies the translation component of the supplied matrix [page:Matrix4 m] into this + matrix's translation component. +

+ +

[method:null decompose]( [param:Vector3 position], [param:Quaternion quaternion], [param:Vector3 scale] )

+

+ Decomposes this matrix into it's [page:Vector3 position], [page:Quaternion quaternion] and + [page:Vector3 scale] components. +

+ +

[method:Float determinant]()

+

+ Computes and returns the + [link:https://en.wikipedia.org/wiki/Determinant determinant] of this matrix.

+ + Based on the method outlined [link:http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm here]. +

+ +

[method:Boolean equals]( [param:Matrix4 m] )

+

Return true if this matrix and [page:Matrix4 m] are equal.

+ +

[method:this extractBasis]( [param:Vector3 xAxis], [param:Vector3 yAxis], [param:Vector3 zAxis] )

+

+ Extracts the [link:https://en.wikipedia.org/wiki/Basis_(linear_algebra) basis] of this + matrix into the three axis vectors provided. If this matrix is: + +a, b, c, d, +e, f, g, h, +i, j, k, l, +m, n, o, p + + then the [page:Vector3 xAxis], [page:Vector3 yAxis], [page:Vector3 zAxis] will be set to: + +xAxis = (a, e, i) +yAxis = (b, f, j) +zAxis = (c, g, k) + +

+ +

[method:this extractRotation]( [param:Matrix4 m] )

+

+ Extracts the rotation component of the supplied matrix [page:Matrix4 m] into this matrix's + rotation component. +

+ +

[method:this fromArray]( [param:Array array], [param:Integer offset] )

+

+ [page:Array array] - the array to read the elements from.
+ [page:Integer offset] - ( optional ) offset into the array. Default is 0.

+ + Sets the elements of this matrix based on an [page:Array array] in + [link:https://en.wikipedia.org/wiki/Row-_and_column-major_order#Column-major_order column-major] format. +

+ +

[method:this getInverse]( [param:Matrix4 m], [param:Boolean throwOnDegenerate] )

+

+ [page:Matrix4 m] - the matrix to take the inverse of.
+ [page:Boolean throwOnDegenerate] - (optional) If true, throw an error if the matrix is degenerate (not invertible).

+ + Set this matrix to the [link:https://en.wikipedia.org/wiki/Invertible_matrix inverse] of the passed matrix [page:Matrix4 m], + using the method outlined [link:http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm here]. + + If [page:Boolean throwOnDegenerate] is not set and the matrix is not invertible, set this to the 4x4 identity matrix. +

+ + +

[method:Float getMaxScaleOnAxis]()

+

Gets the maximum scale value of the 3 axes.

+ +

[method:this identity]()

+

Resets this matrix to the [link:https://en.wikipedia.org/wiki/Identity_matrix identity matrix].

+ +

[method:this lookAt]( [param:Vector3 eye], [param:Vector3 center], [param:Vector3 up], )

+

+ Constructs a rotation matrix, looking from [page:Vector3 eye] towards [page:Vector3 center] + oriented by the [page:Vector3 up] vector. +

+ +

[method:this makeRotationAxis]( [param:Vector3 axis], [param:Float theta] )

+

+ [page:Vector3 axis] — Rotation axis, should be normalized.
+ [page:Float theta] — Rotation angle in radians.

+ + Sets this matrix as rotation transform around [page:Vector3 axis] by [page:Float theta] radians.
+ + This is a somewhat controversial but mathematically sound alternative to rotating via [page:Quaternions]. + See the discussion [link:http://www.gamedev.net/reference/articles/article1199.asp here]. +

+ +

[method:this makeBasis]( [param:Vector3 xAxis], [param:Vector3 yAxis], [param:Vector3 zAxis] )

+

+ Set this to the [link:https://en.wikipedia.org/wiki/Basis_(linear_algebra) basis] matrix consisting + of the three provided basis vectors: + +xAxis.x, yAxis.x, zAxis.x, 0, +xAxis.y, yAxis.y, zAxis.y, 0, +xAxis.z, yAxis.z, zAxis.z, 0, +0, 0, 0, 1 + +

+ +

[method:this makePerspective]( [param:Float left], [param:Float right], [param:Float top], [param:Float bottom], [param:Float near], [param:Float far] )

+

+ Creates a [link:https://en.wikipedia.org/wiki/3D_projection#Perspective_projection perspective projection] matrix. + This is used internally by [page:PerspectiveCamera.updateProjectionMatrix]() +

+ +

[method:this makeOrthographic]( [param:Float left], [param:Float right], [param:Float top], [param:Float bottom], [param:Float near], [param:Float far] )

+

+ Creates an [link:https://en.wikipedia.org/wiki/Orthographic_projection orthographic projection] matrix. + This is used internally by [page:OrthographicCamera.updateProjectionMatrix](). +

+ +

[method:this makeRotationFromEuler]( [param:Euler euler] )

+

+ Sets the rotation component (the upper left 3x3 matrix) of this matrix to the rotation specified by the given [page:Euler Euler Angle]. + The rest of the matrix is set to the identity. Depending on the [page:Euler.order order] of the [page:Euler euler], there are six possible outcomes. + See [link:https://en.wikipedia.org/wiki/Euler_angles#Rotation_matrix this page] for a complete list. +

+ +

[method:this makeRotationFromQuaternion]( [param:Quaternion q] )

+

+ Sets the rotation component of this matrix to the rotation specified by [page:Quaternion q], as outlined + [link:https://en.wikipedia.org/wiki/Rotation_matrix#Quaternion here]. + The rest of the matrix is set to the identity. So, given [page:Quaternion q] = w + xi + yj + zk, the resulting matrix will be: + +1-2y²-2z² 2xy-2zw 2xz+2yw 0 +2xy+2zw 1-2x²-2z² 2yz-2xw 0 +2xz-2yw 2yz+2xw 1-2x²-2y² 0 +0 0 0 1 + +

+ +

[method:this makeRotationX]( [param:Float theta] )

+

+ [page:Float theta] — Rotation angle in radians.

+ + Sets this matrix as a rotational transformation around the X axis by [page:Float theta] (θ) radians. + The resulting matrix will be: + +1 0 0 0 +0 cos(θ) -sin(θ) 0 +0 sin(θ) cos(θ) 0 +0 0 0 1 + +

+ +

[method:this makeRotationY]( [param:Float theta] )

+

+ [page:Float theta] — Rotation angle in radians.

+ + Sets this matrix as a rotational transformation around the Y axis by [page:Float theta] (θ) radians. + The resulting matrix will be: + +cos(θ) 0 sin(θ) 0 +0 1 0 0 +-sin(θ) 0 cos(θ) 0 +0 0 0 1 + +

+ +

[method:this makeRotationZ]( [param:Float theta] )

+

+ [page:Float theta] — Rotation angle in radians.

+ + Sets this matrix as a rotational transformation around the Z axis by [page:Float theta] (θ) radians. + The resulting matrix will be: + +cos(θ) -sin(θ) 0 0 +sin(θ) cos(θ) 0 0 +0 0 1 0 +0 0 0 1 + +

+ +

[method:this makeScale]( [param:Float x], [param:Float y], [param:Float z] )

+

+ [page:Float x] - the amount to scale in the X axis.
+ [page:Float y] - the amount to scale in the Y axis.
+ [page:Float z] - the amount to scale in the Z axis.

+ + Sets this matrix as scale transform: + +x, 0, 0, 0, +0, y, 0, 0, +0, 0, z, 0, +0, 0, 0, 1 + +

+ +

[method:this makeShear]( [param:Float x], [param:Float y], [param:Float z] )

+

+ [page:Float x] - the amount to shear in the X axis.
+ [page:Float y] - the amount to shear in the Y axis.
+ [page:Float z] - the amount to shear in the Z axis.

+ + Sets this matrix as a shear transform: + +1, y, z, 0, +x, 1, z, 0, +x, y, 1, 0, +0, 0, 0, 1 + +

+ +

[method:this makeTranslation]( [param:Float x], [param:Float y], [param:Float z] )

+

+ [page:Float x] - the amount to translate in the X axis.
+ [page:Float y] - the amount to translate in the Y axis.
+ [page:Float z] - the amount to translate in the Z axis.

+ + Sets this matrix as a translation transform: + +1, 0, 0, x, +0, 1, 0, y, +0, 0, 1, z, +0, 0, 0, 1 + +

+ +

[method:this multiply]( [param:Matrix4 m] )

+

Post-multiplies this matrix by [page:Matrix4 m].

+ +

[method:this multiplyMatrices]( [param:Matrix4 a], [param:Matrix4 b] )

+

Sets this matrix to [page:Matrix4 a] x [page:Matrix4 b].

+ +

[method:this multiplyScalar]( [param:Float s] )

+

Multiplies every component of the matrix by a scalar value [page:Float s].

+ +

[method:this premultiply]( [param:Matrix4 m] )

+

Pre-multiplies this matrix by [page:Matrix4 m].

+ +

[method:this scale]( [param:Vector3 v] )

+

Multiplies the columns of this matrix by vector [page:Vector3 v].

+ +

[method:this set]( [param:Float n11], [param:Float n12], [param:Float n13], [param:Float n14], [param:Float n21], [param:Float n22], [param:Float n23], [param:Float n24], [param:Float n31], [param:Float n32], [param:Float n33], [param:Float n34], [param:Float n41], [param:Float n42], [param:Float n43], [param:Float n44] )

+

+ Set the [page:.elements elements] of this matrix to the supplied row-major values [page:Float n11], + [page:Float n12], ... [page:Float n44]. +

+ +

[method:this setPosition]( [param:Vector3 v] )

+

+ Sets the position component for this matrix from vector [page:Vector3 v], without affecting the + rest of the matrix - i.e. if the matrix is currently: + +a, b, c, d, +e, f, g, h, +i, j, k, l, +m, n, o, p + +This becomes: + +a, b, c, v.x, +e, f, g, v.y, +i, j, k, v.z, +m, n, o, p + +

+ +

[method:Array toArray]( [param:Array array], [param:Integer offset] )

+

+ [page:Array array] - (optional) array to store the resulting vector in.
+ [page:Integer offset] - (optional) offset in the array at which to put the result.

+ + Writes the elements of this matrix to an array in + [link:https://en.wikipedia.org/wiki/Row-_and_column-major_order#Column-major_order column-major] format. +

+ +

[method:this transpose]()

+

[link:https://en.wikipedia.org/wiki/Transpose Transposes] this matrix.

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/math/Plane.html b/docs/api/zh/math/Plane.html new file mode 100644 index 00000000000000..c7a1f63e593d0b --- /dev/null +++ b/docs/api/zh/math/Plane.html @@ -0,0 +1,176 @@ + + + + + + + + + + +

[name]

+ +

+ A two dimensional surface that extends infinitely in 3d space, represented in [link:http://mathworld.wolfram.com/HessianNormalForm.html Hessian normal form] + by a unit length normal vector and a constant. +

+ + +

Constructor

+ + +

[name]( [param:Vector3 normal], [param:Float constant] )

+

+ [page:Vector3 normal] - (optional) a unit length [page:Vector3] defining the normal of the plane. Default is *(1, 0, 0)*.
+ [page:Float constant] - (optional) the signed distance from the origin to the plane. Default is *0*. +

+ + +

Properties

+ +

[property:Vector3 normal]

+ +

[property:Float constant]

+ +

Methods

+ +

[method:Plane applyMatrix4]( [param:Matrix4 matrix], [param:Matrix3 optionalNormalMatrix] )

+

+ [page:Matrix4 matrix] - the [Page:Matrix4] to apply.
+ [page:Matrix3 optionalNormalMatrix] - (optional) pre-computed normal [Page:Matrix3] of the Matrix4 being applied.

+ + Apply a Matrix4 to the plane. The matrix must be an affine, homogeneous transform.
+ If supplying an [page:Matrix3 optionalNormalMatrix], it can be created like so: + + var optionalNormalMatrix = new THREE.Matrix3().getNormalMatrix( matrix ); + +

+ +

[method:Plane clone]()

+

Returns a new plane with the same [page:.normal normal] and [page:.constant constant] as this one.

+ +

[method:Vector3 coplanarPoint]( [param:Vector3 target] )

+

+ [page:Vector3 target] — the result will be copied into this Vector3.

+ + Returns a [page:Vector3] coplanar to the plane, by calculating the projection of the + normal vector at the origin onto the plane. +

+ +

[method:Plane copy]( [param:Plane plane] )

+

+ Copies the values of the passed plane's [page:.normal normal] and [page:.constant constant] + properties to this plane. +

+ +

[method:Float distanceToPoint]( [param:Vector3 point] )

+

Returns the signed distance from the [page:Vector3 point] to the plane.

+ +

[method:Float distanceToSphere]( [param:Sphere sphere] )

+

Returns the signed distance from the [page:Sphere sphere] to the plane.

+ +

[method:Boolean equals]( [param:Plane plane] )

+

+ Checks to see if two planes are equal (their [page:.normal normal] and + [page:.constant constant] properties match). +

+ +

[method:Vector3 intersectLine]( [param:Line3 line], [param:Vector3 target] )

+

+ [page:Line3 line] - the [page:Line3] to check for intersection.
+ [page:Vector3 target] — the result will be copied into this Vector3.

+ + Returns the intersection point of the passed line and the plane. Returns undefined + if the line does not intersect. Returns the line's starting point if the line is + coplanar with the plane. +

+ +

[method:Boolean intersectsBox]( [param:Box3 box] )

+

+ [page:Box3 box] - the [page:Box3] to check for intersection.

+ + Determines whether or not this plane intersects [page:Box3 box]. +

+ +

[method:Boolean intersectsLine]( [param:Line3 line] )

+

+ [page:Line3 line] - the [page:Line3] to check for intersection.

+ + Tests whether a line segment intersects with (passes through) the plane. +

+ +

[method:Boolean intersectsSphere]( [param:Sphere sphere] )

+

+ [page:Sphere sphere] - the [page:Sphere] to check for intersection.

+ + Determines whether or not this plane intersects [page:Sphere sphere]. +

+ +

[method:Plane negate]()

+

+ Negates both the normal vector and the constant. +

+ +

[method:Plane normalize]()

+

+ Normalizes the [page:.normal normal] vector, and adjusts the [page:.constant constant] + value accordingly. +

+ +

[method:Vector3 projectPoint]( [param:Vector3 point], [param:Vector3 target] )

+

+ [page:Vector3 point] - the [page:Vector3] to project onto the plane.
+ [page:Vector3 target] — the result will be copied into this Vector3.

+ + Projects a [page:Vector3 point] onto the plane. +

+ +

[method:Plane set]( [param:Vector3 normal], [param:Float constant] )

+

+ [page:Vector3 normal] - a unit length [page:Vector3] defining the normal of the plane.
+ [page:Float constant] - the signed distance from the origin to the plane. Default is *0*.

+ + Sets the plane's [page:.normal normal] and [page:.constant constant] properties. +

+ +

[method:Plane setComponents]( [param:Float x], [param:Float y], [param:Float z], [param:Float w] )

+

+ [page:Float x] - x value of the unit length normal vector.
+ [page:Float y] - y value of the unit length normal vector.
+ [page:Float z] - z value of the unit length normal vector.
+ [page:Float w] - the value of the plane's [page:.constant constant] property.

+ + Set the individual components that define the plane. +

+ +

[method:Plane setFromCoplanarPoints]( [param:Vector3 a], [param:Vector3 b], [param:Vector3 c] )

+

+ [page:Vector3 a] - first point on the plane.
+ [page:Vector3 b] - second point on the plane.
+ [page:Vector3 c] - third point on the plane.

+ + Defines the plane based on the 3 provided points. The winding order is assumed to be counter-clockwise, + and determines the direction of the [page:.normal normal]. +

+ +

[method:Plane setFromNormalAndCoplanarPoint]( [param:Vector3 normal], [param:Vector3 point] ) [param:Vector3 this]

+

+ [page:Vector3 normal] - a unit length [page:Vector3] defining the normal of the plane.
+ [page:Vector3 point] - [page:Vector3]

+ + Sets the plane's properties as defined by a [page:Vector3 normal] and an arbitrary coplanar [page:Vector3 point]. +

+ +

[method:Plane translate]( [param:Vector3 offset] )

+

+ [page:Vector3 offset] - the amount to move the plane by.

+ + Translates the plane by the distance defined by the [page:Vector3 offset] vector. + Note that this only affects the plane constant and will not affect the normal vector. +

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/math/Quaternion.html b/docs/api/zh/math/Quaternion.html new file mode 100644 index 00000000000000..ad0a20f71bcaac --- /dev/null +++ b/docs/api/zh/math/Quaternion.html @@ -0,0 +1,293 @@ + + + + + + + + + + +

[name]

+ +

+ Implementation of a [link:http://en.wikipedia.org/wiki/Quaternion quaternion]. + This is used for [link:https://en.wikipedia.org/wiki/Quaternions_and_spatial_rotation rotating things] + without encountering the dreaded + [link:http://en.wikipedia.org/wiki/Gimbal_lock gimbal lock] issue, amongst other + advantages. +

+ + +

Example

+ + + var quaternion = new THREE.Quaternion(); + quaternion.setFromAxisAngle( new THREE.Vector3( 0, 1, 0 ), Math.PI / 2 ); + + var vector = new THREE.Vector3( 1, 0, 0 ); + vector.applyQuaternion( quaternion ); + + + +

Constructor

+ + +

[name]( [param:Float x], [param:Float y], [param:Float z], [param:Float w] )

+

+ [page:Float x] - x coordinate
+ [page:Float y] - y coordinate
+ [page:Float z] - z coordinate
+ [page:Float w] - w coordinate +

+ + +

Properties

+ +

[property:Float x]

+

Changing this property will result in [page:.onChangeCallback onChangeCallback] being called.

+ +

[property:Float y]

+

Changing this property will result in [page:.onChangeCallback onChangeCallback] being called.

+ +

[property:Float z]

+

Changing this property will result in [page:.onChangeCallback onChangeCallback] being called.

+ +

[property:Float w]

+

Changing this property will result in [page:.onChangeCallback onChangeCallback] being called.

+ + +

Methods

+ +

[method:Float angleTo]( [param:Quaternion q] )

+

+ Returns the angle between this quaternion and quaternion [page:Quaternion q] in radians. +

+ +

[method:Quaternion clone]()

+

+ Creates a new Quaternion with identical [page:.x x], [page:.y y], + [page:.z z] and [page:.w w] properties to this one. +

+ +

[method:Quaternion conjugate]()

+

+ Returns the rotational conjugate of this quaternion. The conjugate of a quaternion + represents the same rotation in the opposite direction about the rotational axis. +

+ +

[method:Quaternion copy]( [param:Quaternion q] )

+

+ Copies the [page:.x x], [page:.y y], [page:.z z] and [page:.w w] properties + of [page:Quaternion q] into this quaternion. +

+ +

[method:Boolean equals]( [param:Quaternion v] )

+

+ [page:Quaternion v] - Quaternion that this quaternion will be compared to.

+ + Compares the [page:.x x], [page:.y y], [page:.z z] and [page:.w w] properties of + [page:Quaternion v] to the equivalent properties of this quaternion to determine if they + represent the same rotation. +

+ +

[method:Float dot]( [param:Quaternion v] )

+

+ Calculates the [link:https://en.wikipedia.org/wiki/Dot_product dot product] of + quaternions [page:Quaternion v] and this one. +

+ +

[method:Quaternion fromArray]( [param:Array array], [param:Integer offset] )

+

+ [page:Array array] - array of format (x, y, z, w) used to construct the quaternion.
+ [page:Integer offset] - (optional) an offset into the array.

+ + Sets this quaternion's [page:.x x], [page:.y y], [page:.z z] and [page:.w w] properties + from an array. +

+ +

[method:Quaternion inverse]()

+

+ Inverts this quaternion - calculate the [page:.conjugate conjugate] and then + [page:.normalize normalizes] the result. +

+ +

[method:Float length]()

+

Computes the [link:https://en.wikipedia.org/wiki/Euclidean_distance Euclidean length] + (straight-line length) of this quaternion, considered as a 4 dimensional vector.

+ +

[method:Float lengthSq]()

+

+ Computes the [link:https://en.wikipedia.org/wiki/Euclidean_distance Euclidean length] + (straight-line length) of this quaternion, considered as a 4 dimensional + vector. This can be useful if you are comparing the lengths of two quaternions, + as this is a slightly more efficient calculation than [page:.length length](). +

+ +

[method:Quaternion normalize]()

+

+ [link:https://en.wikipedia.org/wiki/Normalized_vector Normalizes] this quaternion - that is, + calculated the quaternion that performs the same rotation as this one, but has [page:.length length] + equal to *1*. +

+ +

[method:Quaternion multiply]( [param:Quaternion q] )

+

Multiplies this quaternion by [page:Quaternion q].

+ +

[method:Quaternion multiplyQuaternions]( [param:Quaternion a], [param:Quaternion b] )

+

+ Sets this quaternion to [page:Quaternion a] x [page:Quaternion b].
+ Adapted from the method outlined [link:http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/code/index.htm here]. +

+ +

[method:Quaternion onChange]( [param:Function onChangeCallback] )

+

Sets the [page:.onChangeCallback onChangeCallback]() method.

+ +

[method:Quaternion onChangeCallback]( )

+

+ This function is called whenever any of the following occurs: +

    +
  • + The [page:.x x], [page:.y y], [page:.z z] or + [page:.w w] properties are changed. +
  • +
  • + The [page:.set set](), [page:.copy copy](), [page:.clone clone](), + [page:.setFromAxisAngle setFromAxisAngle](), [page:.setFromRotationMatrix setFromRotationMatrix](), + [page:.conjugate conjugate](), [page:.normalize normalize](), + [page:.multiplyQuaternions multiplyQuaternions](), [page:.slerp slerp]() or [page:.fromArray fromArray]() + functions are called. +
  • +
  • + [page:.setFromEuler setFromEuler]() function is called with its *update* argument set to true. +
  • +
+ By default it is the empty function, however you can change it if needed using [page:.onChange onChange]( [page:Function onChangeCallback] ). +

+ + +

[method:Quaternion premultiply]( [param:Quaternion q] )

+

Pre-multiplies this quaternion by [page:Quaternion q].

+ +

[method:Quaternion rotateTowards]( [param:Quaternion q], [param:Float step] )

+

+ [page:Quaternion q] - The target quaternion.
+ [page:float step] - The angular step in radians.

+ + Rotates this quaternion by a given angular step to the defined quaternion *q*. + The method ensures that the final quaternion will not overshoot *q*. +

+ +

[method:Quaternion slerp]( [param:Quaternion qb], [param:float t] )

+

+ [page:Quaternion qb] - The other quaternion rotation
+ [page:float t] - interpolation factor in the closed interval [0, 1].

+ + Handles the spherical linear interpolation between quaternions. [page:float t] represents the + amount of rotation between this quaternion (where [page:float t] is 0) and [page:Quaternion qb] (where + [page:float t] is 1). This quaternion is set to the result. Also see the static version of the + *slerp* below. + + + // rotate a mesh towards a target quaternion + mesh.quaternion.slerp( endQuaternion, 0.01 ); + +

+ +

[method:Quaternion set]( [param:Float x], [param:Float y], [param:Float z], [param:Float w] )

+

Sets [page:.x x], [page:.y y], [page:.z z], [page:.w w] properties of this quaternion.

+ +

[method:Quaternion setFromAxisAngle]( [param:Vector3 axis], [param:Float angle] )

+

+ Sets this quaternion from rotation specified by [page:Vector3 axis] and [page:Float angle].
+ Adapted from the method [link:http://www.euclideanspace.com/maths/geometry/rotations/conversions/angleToQuaternion/index.htm here].
+ *Axis* is assumed to be normalized, *angle* is in radians. +

+ +

[method:Quaternion setFromEuler]( [param:Euler euler] )

+

Sets this quaternion from the rotation specified by [page:Euler] angle.

+ +

[method:Quaternion setFromRotationMatrix]( [param:Matrix4 m] )

+

+ Sets this quaternion from rotation component of [page:Matrix4 m].
+ Adapted from the method [link:http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToQuaternion/index.htm here]. +

+ +

[method:Quaternion setFromUnitVectors]( [param:Vector3 vFrom], [param:Vector3 vTo] )

+

+ Sets this quaternion to the rotation required to rotate direction vector [page:Vector3 vFrom] to + direction vector [page:Vector3 vTo].
+ Adapted from the method [link:http://lolengine.net/blog/2013/09/18/beautiful-maths-quaternion-from-vectors here].
+ [page:Vector3 vFrom] and [page:Vector3 vTo] are assumed to be normalized. +

+ +

[method:Array toArray]( [param:Array array], [param:Integer offset] )

+

+ [page:Array array] - An optional array to store the quaternion. If not specified, a new array will be created.
+ [page:Integer offset] - (optional) if specified, the result will be copied + into this [page:Array].

+ + Returns the numerical elements of this quaternion in an array of format [x, y, z, w]. +

+ +

Static Methods

+ +

+ Static methods (as opposed to instance methods) are designed to be called directly from the class, + rather than from a specific instance. So to use the static version of, call it like so: + +THREE.Quaternion.slerp( qStart, qEnd, qTarget, t ); + + By contrast, to call the 'normal' or instanced slerp method, you would do the following: + +//instantiate a quaternion with default values +var q = new THREE.Quaternion(); + +//call the instanced slerp method +q.slerp( qb, t ) + + +

+ +

[method:Quaternion slerp]( [param:Quaternion qStart], [param:Quaternion qEnd], [param:Quaternion qTarget], [param:Float t] )

+

+ [page:Quaternion qStart] - The starting quaternion (where [page:Float t] is 0)
+ [page:Quaternion qEnd] - The ending quaternion (where [page:Float t] is 1)
+ [page:Quaternion qTarget] - The target quaternion that gets set with the result
+ [page:float t] - interpolation factor in the closed interval [0, 1].

+ + Unlike the normal method, the static version of slerp sets a target quaternion to the result of the slerp operation. + + // Code setup + var startQuaternion = new THREE.Quaternion().set( 0, 0, 0, 1 ).normalize(); + var endQuaternion = new THREE.Quaternion().set( 1, 1, 1, 1 ).normalize(); + var t = 0; + + // Update a mesh's rotation in the loop + t = ( t + 0.01 ) % 1; // constant angular momentum + THREE.Quaternion.slerp( startQuaternion, endQuaternion, mesh.quaternion, t ); + +

+ + +

[method:null slerpFlat]( [param:Array dst], [param:Integer dstOffset], [param:Array src0], [param:Integer srcOffset0], [param:Array src1], [param:Integer srcOffset1], [param:Float t] )

+

+ [page:Array dst] - The output array.
+ [page:Integer dstOffset] - An offset into the output array.
+ [page:Array src0] - The source array of the starting quaternion.
+ [page:Integer srcOffset0] - An offset into the array *src0*.
+ [page:Array src1] - The source array of the target quatnerion.
+ [page:Integer srcOffset1] - An offset into the array *src1*.
+ [page:float t] - Normalized interpolation factor (between 0 and 1).

+

+

+ Like the static *slerp* method above, but operates directly on flat arrays of numbers. +

+ + + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/math/Ray.html b/docs/api/zh/math/Ray.html new file mode 100644 index 00000000000000..49911afff4f5e8 --- /dev/null +++ b/docs/api/zh/math/Ray.html @@ -0,0 +1,214 @@ + + + + + + + + + + +

[name]

+ +

+ A ray that emits from an origin in a certain direction. This is used by the + [page:Raycaster] to assist with [link:https://en.wikipedia.org/wiki/Ray_casting raycasting]. + Raycasting is used for mouse picking (working out what objects in the 3D space the mouse is over) amongst + other things. +

+ + +

Constructor

+ + +

[name]( [param:Vector3 origin], [param:Vector3 direction] )

+

+ [page:Vector3 origin] - (optional) the origin of the [page:Ray]. Default is a [page:Vector3] at (0, 0, 0).
+ [page:Vector3 direction] - [page:Vector3] The direction of the [page:Ray]. This must be normalized + (with [page:Vector3.normalize]) for the methods to operate properly. Default is a [page:Vector3] at (0, 0, 0).

+ + Creates a new [name]. +

+ +

Properties

+ +

[property:Vector3 origin]

+

The origin of the [page:Ray]. Default is a [page:Vector3] at (0, 0, 0).

+ +

[property:Vector3 direction]

+

+ The direction of the [page:Ray]. This must be normalized (with [page:Vector3.normalize]) + for the methods to operate properly. Default is a [page:Vector3] at (0, 0, 0). +

+ + + + +

Methods

+ +

[method:Ray applyMatrix4]( [param:Matrix4 matrix4] )

+

+ [page:Matrix4 matrix4] - the [page:Matrix4] to apply to this [page:Ray].

+ + Transform this [page:Ray] by the [page:Matrix4]. +

+ +

[method:Vector3 at]( [param:Float t], [param:Vector3 target] )

+

+ [page:Float t] - the distance along the [page:Ray] to retrieve a position for.
+ [page:Vector3 target] — the result will be copied into this Vector3.

+ + Get a [page:Vector3] that is a given distance along this [page:Ray]. +

+ +

[method:Ray clone]()

+

+ Creates a new Ray with identical [page:.origin origin] and [page:.direction direction] to this one. +

+ +

[method:Vector3 closestPointToPoint]( [param:Vector3 point], [param:Vector3 target] )

+

+ [page:Vector3 point] - the point to get the closest approach to.
+ [page:Vector3 target] — the result will be copied into this Vector3.

+ + Get the point along this [page:Ray] that is closest to the [page:Vector3] provided. +

+ +

[method:Ray copy]( [param:Ray ray] )

+

+ Copies the [page:.origin origin] and [page:.direction direction] properties + of [page:Ray ray] into this ray. +

+ +

[method:Float distanceSqToPoint]( [param:Vector3 point] )

+

+ [page:Vector3 point] - the [page:Vector3] to compute a distance to.

+ + Get the squared distance of the closest approach between the [page:Ray] and the [page:Vector3]. +

+ +

[method:Float distanceSqToSegment]( [param:Vector3 v0], [param:Vector3 v1], [param:Vector3 optionalPointOnRay], [param:Vector3 optionalPointOnSegment] )

+

+ [page:Vector3 v0] - the start of the line segment.
+ [page:Vector3 v1] - the end of the line segment.
+ optionalPointOnRay - (optional) if this is provided, it receives the point on this + [page:Ray] that is closest to the segment.
+ optionalPointOnSegment - (optional) if this is provided, it receives the point + on the line segment that is closest to this [page:Ray].

+ + Get the squared distance between this [page:Ray] and a line segment. +

+ +

[method:Float distanceToPlane]( [param:Plane plane] )

+

+ [page:Plane plane] - the [page:Plane] to get the distance to.

+ + Get the distance from [page:.origin origin] to the [page:Plane], or *null* if the [page:Ray] doesn't intersect the [page:Plane]. +

+ +

[method:Float distanceToPoint]( [param:Vector3 point] )

+

+ [page:Vector3 point] - [page:Vector3] The [page:Vector3] to compute a distance to.

+ + Get the distance of the closest approach between the [page:Ray] and the [page:Vector3 point]. +

+ + +

[method:Boolean equals]( [param:Ray ray] )

+

+ [page:Ray ray] - the [page:Ray] to compare to.

+ + Returns true if this and the other [page:Ray ray] have equal [page:.offset offset] + and [page:.direction direction]. +

+ +

[method:Vector3 intersectBox]( [param:Box3 box], [param:Vector3 target] )

+

+ [page:Box3 box] - the [page:Box3] to intersect with.
+ [page:Vector3 target] — the result will be copied into this Vector3.

+ + Intersect this [page:Ray] with a [page:Box3], returning the intersection point or + *null* if there is no intersection. +

+ +

[method:Vector3 intersectPlane]( [param:Plane plane], [param:Vector3 target] )

+

+ [page:Plane plane] - the [page:Plane] to intersect with.
+ [page:Vector3 target] — the result will be copied into this Vector3.

+ + Intersect this [page:Ray] with a [page:Plane], returning the intersection point or + *null* if there is no intersection. +

+ +

[method:Vector3 intersectSphere]( [param:Sphere sphere], [param:Vector3 target] )

+

+ [page:Sphere sphere] - the [page:Sphere] to intersect with.
+ [page:Vector3 target] — the result will be copied into this Vector3.

+ + Intersect this [page:Ray] with a [page:Sphere], returning the intersection point or + *null* if there is no intersection. +

+ +

[method:Vector3 intersectTriangle]( [param:Vector3 a], [param:Vector3 b], [param:Vector3 c], [param:Boolean backfaceCulling], [param:Vector3 target] )

+

+ [page:Vector3 a], [page:Vector3 b], [page:Vector3 c] - The [page:Vector3] points making up the triangle.
+ [page:Boolean backfaceCulling] - whether to use backface culling.
+ [page:Vector3 target] — the result will be copied into this Vector3.

+ + Intersect this [page:Ray] with a triangle, returning the intersection point or *null* + if there is no intersection. +

+ +

[method:Boolean intersectsBox]( [param:Box3 box] )

+

+ [page:Box3 box] - the [page:Box3] to intersect with.

+ + Return true if this [page:Ray] intersects with the [page:Box3]. +

+ +

[method:Boolean intersectsPlane]( [param:Plane plane] )

+

+ [page:Plane plane] - the [page:Plane] to intersect with.

+ + Return true if this [page:Ray] intersects with the [page:Plane]. +

+ +

[method:Boolean intersectsSphere]( [param:Sphere sphere] )

+

+ [page:Sphere sphere] - the [page:Sphere] to intersect with.

+ + Return true if this [page:Ray] intersects with the [page:Sphere]. +

+ +

[method:Ray lookAt]( [param:Vector3 v] )

+

+ [page:Vector3 v] - The [page:Vector3] to look at.

+ + Adjusts the direction of the ray to point at the vector in world coordinates. +

+ +

[method:Ray recast]( [param:Float t] )

+

+ [page:Float t] - The distance along the [page:Ray] to interpolate.

+ + Shift the origin of this [page:Ray] along its direction by the distance given. +

+ +

[method:Ray set]( [param:Vector3 origin], [param:Vector3 direction] )

+

+ [page:Vector3 origin] - the [page:.origin origin] of the [page:Ray].
+ [page:Vector3 origin] - the [page:.direction direction] of the [page:Ray]. + This must be normalized (with [page:Vector3.normalize]) for the methods to operate + properly.

+ + Copy the parameters to the [page:.origin origin] and [page:.direction direction] properties + of this ray. +

+ + + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/math/Sphere.html b/docs/api/zh/math/Sphere.html new file mode 100644 index 00000000000000..c66eecaab80729 --- /dev/null +++ b/docs/api/zh/math/Sphere.html @@ -0,0 +1,139 @@ + + + + + + + + + + +

[name]

+ +

A sphere defined by a center and radius.

+ +

Constructor

+

[name]( [param:Vector3 center], [param:Float radius] )

+

+ [page:Vector3 center] - center of the sphere. Default is a [page:Vector3] at (0, 0, 0).
+ [page:Float radius] - radius of the sphere. Default is 0.

+ + Creates a new [name]. + +

+ + +

Properties

+ + +

[property:Vector3 center]

+

A [page:Vector3] defining the center of the sphere. Default is (0, 0, 0).

+ +

[property:Float radius]

+

The radius of the sphere. Default is 0.

+ +

Methods

+ +

[method:Sphere applyMatrix4]( [param:Matrix4 matrix] )

+

+ [page:Matrix4 matrix] - the [Page:Matrix4] to apply

+ + Transforms this sphere with the provided [page:Matrix4]. +

+ +

[method:Vector3 clampPoint]( [param:Vector3 point], [param:Vector3 target] )

+

+ [page:Vector3 point] - [page:Vector3] The point to clamp.
+ [page:Vector3 target] — the result will be copied into this Vector3.

+ + Clamps a point within the sphere. If the point is is outside the sphere, it will clamp it to the + closets point on the edge of the sphere. Points already inside the sphere will not be affected. +

+ +

[method:Sphere clone]()

+

Returns a new sphere with the same [page:.center center] and [page:.radius radius] as this one.

+ +

[method:Boolean containsPoint]( [param:Vector3 point] )

+

+ [page:Vector3 point] - the [page:Vector3] to be checked

+ + Checks to see if the sphere contains the provided [page:Vector3 point] inclusive of the + surface of the sphere. +

+ +

[method:Sphere copy]( [param:Sphere sphere] )

+

+ Copies the values of the passed sphere's [page:.center center] and [page:.radius radius] + properties to this sphere. +

+ +

[method:Float distanceToPoint]( [param:Vector3 point] )

+

+ Returns the closest distance from the boundary of the sphere to the [page:Vector3 point]. If the sphere contains the point, + the distance will be negative. +

+ +

[method:Boolean empty]()

+

Checks to see if the sphere is empty (the radius set to 0).

+ +

[method:Boolean equals]( [param:Sphere sphere] )

+

+ Checks to see if the two spheres' centers and radii are equal. +

+ +

[method:Box3 getBoundingBox]( [param:Box3 target] )

+

+ [page:Box3 target] — the result will be copied into this Box3.

+ + Returns a[link:https://en.wikipedia.org/wiki/Minimum_bounding_box Minimum Bounding Box] for the sphere. +

+ +

[method:Boolean intersectsBox]( [param:Box3 box] )

+

+ [page:Box3 box] - [page:Box3] to check for intersection against.

+ + Determines whether or not this sphere intersects a given [page:Box3 box]. +

+ +

[method:Boolean intersectsPlane]( [param:Plane plane] )

+

+ [page:Plane plane] - Plane to check for intersection against.

+ + Determines whether or not this sphere intersects a given [page:Plane plane]. +

+ +

[method:Boolean intersectsSphere]( [param:Sphere sphere] )

+

+ [page:Sphere sphere] - Sphere to check for intersection against.

+ + Checks to see if two spheres intersect. +

+ +

[method:Sphere set]( [param:Vector3 center], [param:Float radius] )

+

+ [page:Vector3 center] - center of the sphere.
+ [page:Float radius] - radius of the sphere.

+ + Sets the [page:.center center] and [page:.radius radius] properties of this sphere. +

+ +

[method:Sphere setFromPoints]( [param:Array points], [param:Vector3 optionalCenter] )

+

+ [page:Array points] - an [page:Array] of [page:Vector3] positions.
+ [page:Vector3 optionalCenter] - Optional [page:Vector3] position for the sphere's center.

+ + Computes the minimum bounding sphere for an array of [page:Array points]. If [page:Vector3 optionalCenter]is given, + it is used as the sphere's center. Otherwise, the center of the axis-aligned bounding box encompassing + [page:Array points] is calculated. +

+ +

[method:Sphere translate]( [param:Vector3 offset] )

+

+ Translate the sphere's center by the provided offset [page:Vector3]. +

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/math/Spherical.html b/docs/api/zh/math/Spherical.html new file mode 100644 index 00000000000000..2274b0e0fbe3fb --- /dev/null +++ b/docs/api/zh/math/Spherical.html @@ -0,0 +1,78 @@ + + + + + + + + + + +

[name]

+ +

A point's [link:https://en.wikipedia.org/wiki/Spherical_coordinate_system spherical coordinates].

+ + +

Constructor

+ + +

[name]( [param:Float radius], [param:Float phi], [param:Float theta] )

+

+ [page:Float radius] - the radius, or the [link:https://en.wikipedia.org/wiki/Euclidean_distance Euclidean distance] + (straight-line distance) from the point to the origin. Default is *1.0*.
+ [page:Float phi] - polar angle from the y (up) axis. Default is *0*.
+ [page:Float theta] - equator angle around the y (up) axis. Default is *0*.

+ + The poles (phi) are at the positive and negative y axis. The equator (theta) starts at positive z. +

+ + +

Properties

+ +

[property:Float radius]

+ +

[property:Float phi]

+ +

[property:Float theta]

+ + +

Methods

+ +

[method:Spherical clone]()

+

+ Returns a new plane with the same [page:.radius radius], [page:.phi phi] + and [page:.theta theta] properties as this one. +

+ +

[method:Spherical copy]( [param:Spherical s] )

+

+ Copies the values of the passed Spherical's [page:.radius radius], [page:.phi phi] + and [page:.theta theta] properties to this spherical. +

+ +

[method:Spherical makeSafe]()

+

+ Restricts the polar angle [page:.phi phi] to be between 0.000001 and pi - 0.000001. +

+ +

[method:Spherical set]( [param:Float radius], [param:Float phi], [param:Float theta] )

+

Sets values of this spherical's [page:.radius radius], [page:.phi phi] + and [page:.theta theta] properties.

+ +

[method:Spherical setFromVector3]( [param:Vector3 vec3] )

+

+ Sets values of this spherical's [page:.radius radius], [page:.phi phi] + and [page:.theta theta] properties from the [page:Vector3 Vector3]. +

+ +

[method:Spherical setFromCartesianCoords]( [param:Float x], [param:Float y], [param:Float z] )

+

+ Sets values of this spherical's [page:.radius radius], [page:.phi phi] + and [page:.theta theta] properties from Cartesian coordinates. +

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/math/Triangle.html b/docs/api/zh/math/Triangle.html new file mode 100644 index 00000000000000..5aa5ea12f25b3d --- /dev/null +++ b/docs/api/zh/math/Triangle.html @@ -0,0 +1,143 @@ + + + + + + + + + + +

[name]

+ +

+ A geometric triangle as defined by three [page:Vector3 Vector3s] representing its + three corners. +

+ + +

Constructor

+ + +

[name]( [param:Vector3 a], [param:Vector3 b], [param:Vector3 c] )

+

+ [page:Vector3 a] - the first corner of the triangle. Default is a [page:Vector3] at (0, 0, 0).
+ [page:Vector3 b] - the second corner of the triangle. Default is a [page:Vector3] at (0, 0, 0).
+ [page:Vector3 c] - the final corner of the triangle. Default is a [page:Vector3] at (0, 0, 0).

+ + Creates a new [name]. +

+ + +

Properties

+ +

[property:Vector3 a]

+

+ The first corner of the triangle. Default is a [page:Vector3] at (0, 0, 0). +

+ +

[property:Vector3 b]

+

+ The second corner of the triangle. Default is a [page:Vector3] at (0, 0, 0). +

+ +

[property:Vector3 c]

+

+ the final corner of the triangle. Default is a [page:Vector3] at (0, 0, 0) +

+ +

Methods

+ +

[method:Triangle clone]()

+

+ Returns a new triangle with the same [page:.a a], [page:.b b] and [page:.c c] properties as this one. +

+ +

[method:Vector3 closestPointToPoint]( [param:Vector3 point], [param:Vector3 target] )

+

+ [page:Vector3 point] - [page:Vector3]
+ [page:Vector3 target] — the result will be copied into this Vector3.

+ + Returns the closest point on the triangle to [page:Vector3 point]. +

+ +

[method:Boolean containsPoint]( [param:Vector3 point] )

+

+ [page:Vector3 point] - [page:Vector3] to check.

+ + Returns true if the passed point, when projected onto the plane of the triangle, lies within the triangle. +

+ +

[method:Triangle copy]( [param:Triangle triangle] )

+

+ Copies the values of the passed triangles's [page:.a a], [page:.b b] and [page:.c c] + properties to this triangle. +

+ +

[method:Boolean equals]( [param:Triangle triangle] )

+

+ Returns true if the two triangles have identical [page:.a a], [page:.b b] and [page:.c c] properties. +

+ +

[method:Float getArea]()

+

Return the area of the triangle.

+ +

[method:Vector3 getBarycoord]( [param:Vector3 point], [param:Vector3 target] )

+

+ [page:Vector3 point] - [page:Vector3]
+ [page:Vector3 target] — the result will be copied into this Vector3.

+ + Return a [link:https://en.wikipedia.org/wiki/Barycentric_coordinate_system barycentric coordinate] + from the given vector.

+ + [link:http://commons.wikimedia.org/wiki/File:Barycentric_coordinates_1.png Picture of barycentric coordinates] +

+ +

[method:Vector3 getMidpoint]( [param:Vector3 target] )

+

+ [page:Vector3 target] — the result will be copied into this Vector3.

+ + Calculate the midpoint of the triangle. +

+ +

[method:Vector3 getNormal]( [param:Vector3 target] )

+

+ [page:Vector3 target] — the result will be copied into this Vector3.

+ + Calculate the [link:https://en.wikipedia.org/wiki/Normal_(geometry) normal vector] of the triangle. +

+ +

[method:Plane getPlane]( [param:Plane target] )

+

+ [page:Vector3 target] — the result will be copied into this Plane.

+ + Calculate a [page:Plane plane] based on the triangle. . +

+ +

[method:Boolean intersectsBox]( [param:Box3 box] )

+

+ [page:Box3 box] - Box to check for intersection against.

+ + Determines whether or not this triangle intersects [page:Box3 box]. +

+ +

[method:Triangle set]( [param:Vector3 a], [param:Vector3 b], [param:Vector3 c] ) [param:Triangle this]

+

+ Sets the triangle's [page:.a a], [page:.b b] and [page:.c c] properties to the passed [page:vector3 vector3s]. +

+ +

[method:Triangle setFromPointsAndIndices]( [param:Array points], [param:Integer i0], [param:Integer i1], [param:Integer i2] ) [param:Triangle this]

+

+ points - [page:Array] of [page:Vector3]s
+ i0 - [page:Integer] index
+ i1 - [page:Integer] index
+ i2 - [page:Integer] index

+ + Sets the triangle's vectors to the vectors in the array. +

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/math/Vector2.html b/docs/api/zh/math/Vector2.html new file mode 100644 index 00000000000000..83ca5a87e6e3dd --- /dev/null +++ b/docs/api/zh/math/Vector2.html @@ -0,0 +1,346 @@ + + + + + + + + + + +

[name]

+ +

+ Class representing a 2D [link:https://en.wikipedia.org/wiki/Vector_space vector]. + + A 2D vector is an ordered pair of numbers (labeled x and y), which can be used to + represent a number of things, such as: +

+ +
    +
  • + A point in 2D space (i.e. a position on a plane). +
  • +
  • + A direction and length across a plane. In three.js the length will always be the + [link:https://en.wikipedia.org/wiki/Euclidean_distance Euclidean distance] + (straight-line distance) from (0, 0) to (x, y) and the direction is also + measured from (0, 0) towards (x, y). +
  • +
  • + Any arbitrary ordered pair of numbers. +
  • +
+ +

+ There are other things a 2D vector can be used to represent, such as momentum + vectors, complex numbers and so on, however these are the most common uses in three.js. +

+ +

Example

+ + + var a = new THREE.Vector2( 0, 1 ); + + //no arguments; will be initialised to (0, 0) + var b = new THREE.Vector2( ); + + var d = a.distanceTo( b ); + + + +

Constructor

+ +

[name]( [param:Float x], [param:Float y] )

+

+ [page:Float x] - the x value of the vector. Default is *0*.
+ [page:Float y] - the y value of the vector. Default is *0*.

+ + Creates a new [name]. +

+ + +

Properties

+ +

[property:Boolean isVector2]

+

+ Used to check whether this or derived classes are Vector2s. Default is *true*.

+ + You should not change this, as it is used internally for optimisation. +

+ +

[property:Float height]

+

Alias for [page:.y y].

+ +

[property:Float width]

+

Alias for [page:.x x].

+ +

[property:Float x]

+ +

[property:Float y]

+ + +

Methods

+ +

[method:this add]( [param:Vector2 v] )

+

Adds [page:Vector2 v] to this vector.

+ +

[method:this addScalar]( [param:Float s] )

+

Adds the scalar value [page:Float s] to this vector's [page:.x x] and [page:.y y] values.

+ +

[method:this addScaledVector]( [param:Vector2 v], [param:Float s] )

+

Adds the multiple of [page:Vector2 v] and [page:Float s] to this vector.

+ +

[method:this addVectors]( [param:Vector2 a], [param:Vector2 b] )

+

Sets this vector to [page:Vector2 a] + [page:Vector2 b].

+ +

[method:Float angle]()

+

+ Computes the angle in radians of this vector with respect to the positive x-axis. +

+ +

[method:this applyMatrix3]( [param:Matrix3 m] )

+

+ Multiplies this vector (with an implicit 1 as the 3rd component) by m. +

+ +

[method:this ceil]()

+

+ The [page:.x x] and [page:.y y] components of the vector are rounded up to the nearest integer value. +

+ +

[method:this clamp]( [param:Vector2 min], [param:Vector2 max] )

+

+ [page:Vector2 min] - the minimum x and y values.
+ [page:Vector2 max] - the maximum x and y values in the desired range

+ + If this vector's x or y value is greater than the max vector's x or y value, it is replaced by the corresponding value.

+ If this vector's x or y value is less than the min vector's x or y value, it is replaced by the corresponding value. +

+ +

[method:this clampLength]( [param:Float min], [param:Float max] )

+

+ [page:Float min] - the minimum value the length will be clamped to
+ [page:Float max] - the maximum value the length will be clamped to

+ + If this vector's length is greater than the max value, it is replaced by the max value.

+ If this vector's length is less than the min value, it is replaced by the min value. +

+ +

[method:this clampScalar]( [param:Float min], [param:Float max] )

+

+ [page:Float min] - the minimum value the components will be clamped to
+ [page:Float max] - the maximum value the components will be clamped to

+ + If this vector's x or y values are greater than the max value, they are replaced by the max value.

+ If this vector's x or y values are less than the min value, they are replaced by the min value. +

+ +

[method:Vector2 clone]()

+

+ Returns a new Vector2 with the same [page:.x x] and [page:.y y] values as this one. +

+ +

[method:this copy]( [param:Vector2 v] )

+

+ Copies the values of the passed Vector2's [page:.x x] and [page:.y y] + properties to this Vector2. +

+ +

[method:Float distanceTo]( [param:Vector2 v] )

+

Computes the distance from this vector to [page:Vector2 v].

+ +

[method:Float manhattanDistanceTo]( [param:Vector2 v] )

+

+ Computes the [link:https://en.wikipedia.org/wiki/Taxicab_geometry Manhattan distance] from this vector to [page:Vector2 v]. +

+ +

[method:Float distanceToSquared]( [param:Vector2 v] )

+

+ Computes the squared distance from this vector to [page:Vector2 v]. If you are just + comparing the distance with another distance, you should compare the distance squared instead + as it is slightly more efficient to calculate. +

+ +

[method:this divide]( [param:Vector2 v] )

+

Divides this vector by [page:Vector2 v].

+ +

[method:this divideScalar]( [param:Float s] )

+

+ Divides this vector by scalar [page:Float s].
+ Sets vector to *( 0, 0 )* if [page:Float s] = 0. +

+ +

[method:Float dot]( [param:Vector2 v] )

+

+ Calculates the [link:https://en.wikipedia.org/wiki/Dot_product dot product] of this + vector and [page:Vector2 v]. +

+ +

[method:Float cross]( [param:Vector2 v] )

+

+ Calculates the [link:https://en.wikipedia.org/wiki/Cross_product cross product] of this + vector and [page:Vector2 v]. Note that a 'cross-product' in 2D is not well-defined. This function computes a geometric cross-product often used in 2D graphics +

+ +

[method:Boolean equals]( [param:Vector2 v] )

+

Checks for strict equality of this vector and [page:Vector2 v].

+ +

[method:this floor]()

+

The components of the vector are rounded down to the nearest integer value.

+ +

[method:this fromArray]( [param:Array array], [param:Integer offset] )

+

+ [page:Array array] - the source array.
+ [page:Integer offset] - (optional) offset into the array. Default is 0.

+ + Sets this vector's [page:.x x] value to be array[ offset ] and [page:.y y] value to be array[ offset + 1 ]. +

+ +

[method:this fromBufferAttribute]( [param:BufferAttribute attribute], [param:Integer index] )

+

+ [page:BufferAttribute attribute] - the source attribute.
+ [page:Integer index] - index in the attribute.

+ + Sets this vector's [page:.x x] and [page:.y y] values from the [page:BufferAttribute attribute]. +

+ +

[method:Float getComponent]( [param:Integer index] )

+

+ [page:Integer index] - 0 or 1.

+ + If index equals 0 returns the [page:.x x] value.
+ If index equals 1 returns the [page:.y y] value. +

+ +

[method:Float length]()

+

Computes the [link:https://en.wikipedia.org/wiki/Euclidean_distance Euclidean length] + (straight-line length) from (0, 0) to (x, y).

+ +

[method:Float manhattanLength]()

+

+ Computes the [link:http://en.wikipedia.org/wiki/Taxicab_geometry Manhattan length] of this vector. +

+ +

[method:Float lengthSq]()

+

+ Computes the square of the [link:https://en.wikipedia.org/wiki/Euclidean_distance Euclidean length] + (straight-line length) from (0, 0) to (x, y). If you are comparing the lengths of + vectors, you should compare the length squared instead as it is slightly more efficient to calculate. +

+ +

[method:this lerp]( [param:Vector2 v], [param:Float alpha] )

+

+ [page:Vector2 v] - [page:Vector2] to interpolate towards.
+ alpha - interpolation factor in the closed interval [0, 1].

+ + Linearly interpolates between this vector and [page:Vector2 v], where alpha is the + distance along the line - alpha = 0 will be this vector, and alpha = 1 will be [page:Vector2 v]. +

+ +

[method:this lerpVectors]( [param:Vector2 v1], [param:Vector2 v2], [param:Float alpha] )

+

+ [page:Vector2 v1] - the starting [page:Vector2].
+ [page:Vector2 v2] - [page:Vector2] to interpolate towards.
+ [page:Float alpha] - interpolation factor in the closed interval [0, 1].

+ + Sets this vector to be the vector linearly interpolated between [page:Vector2 v1] and + [page:Vector2 v2] where alpha is the distance along the line connecting the two vectors + - alpha = 0 will be [page:Vector2 v1], and alpha = 1 will be [page:Vector2 v2]. +

+ +

[method:this negate]()

+

Inverts this vector - i.e. sets x = -x and y = -y.

+ +

[method:this normalize]()

+

+ Converts this vector to a [link:https://en.wikipedia.org/wiki/Unit_vector unit vector] - that is, sets it equal to the vector with the same direction + as this one, but [page:.length length] 1. +

+ +

[method:this max]( [param:Vector2 v] )

+

+ If this vector's x or y value is less than [page:Vector2 v]'s x or y value, replace + that value with the corresponding max value. +

+ +

[method:this min]( [param:Vector2 v] )

+

+ If this vector's x or y value is greater than [page:Vector2 v]'s x or y value, replace + that value with the corresponding min value. +

+ +

[method:this multiply]( [param:Vector2 v] )

+

Multiplies this vector by [page:Vector2 v].

+ + +

[method:this multiplyScalar]( [param:Float s] )

+

Multiplies this vector by scalar [page:Float s].

+ +

[method:this rotateAround]( [param:Vector2 center], [param:float angle] )

+

+ [page:Vector2 center] - the point around which to rotate.
+ [page:float angle] - the angle to rotate, in radians.

+ + Rotates the vector around [page:Vector2 center] by [page:float angle] radians. +

+ +

[method:this round]()

+

The components of the vector are rounded to the nearest integer value.

+ +

[method:this roundToZero]()

+

+ The components of the vector are rounded towards zero (up if negative, down if positive) to an integer value. +

+ +

[method:this set]( [param:Float x], [param:Float y] )

+

Sets the [page:.x x] and [page:.y y] components of this vector.

+ +

[method:null setComponent]( [param:Integer index], [param:Float value] )

+

+ [page:Integer index] - 0 or 1.
+ [page:Float value] - [page:Float]

+ + If index equals 0 set [page:.x x] to [page:Float value].
+ If index equals 1 set [page:.y y] to [page:Float value] +

+ +

[method:this setLength]( [param:Float l] )

+

+ Sets this vector to the vector with the same direction as this one, but [page:.length length] + [page:Float l]. +

+ +

[method:this setScalar]( [param:Float scalar] )

+

+ Sets the [page:.x x] and [page:.y y] values of this vector both equal to [page:Float scalar]. +

+ +

[method:this setX]( [param:Float x] )

+

Replaces this vector's [page:.x x] value with [page:Float x].

+ +

[method:this setY]( [param:Float y] )

+

Replaces this vector's [page:.y y] value with [page:Float y].

+ +

[method:this sub]( [param:Vector2 v] )

+

Subtracts [page:Vector2 v] from this vector.

+ +

[method:this subScalar]( [param:Float s] )

+

Subtracts [page:Float s] from this vector's [page:.x x] and [page:.y y] components.

+ +

[method:this subVectors]( [param:Vector2 a], [param:Vector2 b] )

+

Sets this vector to [page:Vector2 a] - [page:Vector2 b].

+ +

[method:Array toArray]( [param:Array array], [param:Integer offset] )

+

+ [page:Array array] - (optional) array to store the vector to. If this is not provided, a new array will be created.
+ [page:Integer offset] - (optional) optional offset into the array.

+ + Returns an array [x, y], or copies x and y into the provided [page:Array array]. +

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/math/Vector3.html b/docs/api/zh/math/Vector3.html new file mode 100644 index 00000000000000..8872681839114f --- /dev/null +++ b/docs/api/zh/math/Vector3.html @@ -0,0 +1,446 @@ + + + + + + + + + + +

[name]

+ +

Class representing a 3D [link:https://en.wikipedia.org/wiki/Vector_space vector]. + + A 3D vector is an ordered triplet of numbers (labeled x, y, and z), which can be used to + represent a number of things, such as: +

+ +
    +
  • + A point in 3D space. +
  • +
  • + A direction and length in 3D space. In three.js the length will always be the + [link:https://en.wikipedia.org/wiki/Euclidean_distance Euclidean distance] + (straight-line distance) from (0, 0, 0) to (x, y, z) and the direction is also + measured from (0, 0, 0) towards (x, y, z). +
  • +
  • + Any arbitrary ordered triplet of numbers. +
  • +
+ +

+ There are other things a 3D vector can be used to represent, such as momentum + vectors and so on, however these are the most common uses in three.js. +

+ + +

Example

+ + +var a = new THREE.Vector3( 0, 1, 0 ); + +//no arguments; will be initialised to (0, 0, 0) +var b = new THREE.Vector3( ); + +var d = a.distanceTo( b ); + + + +

Constructor

+ +

[name]( [param:Float x], [param:Float y], [param:Float z] )

+

+ [page:Float x] - the x value of the vector. Default is *0*.
+ [page:Float y] - the y value of the vector. Default is *0*.
+ [page:Float z] - the z value of the vector. Default is *0*.

+ + Creates a new [name]. +

+ + +

Properties

+ +

[property:Boolean isVector3]

+

+ Used to check whether this or derived classes are Vector3s. Default is *true*.

+ + You should not change this, as it is used internally for optimisation. +

+ +

[property:Float x]

+ +

[property:Float y]

+ +

[property:Float z]

+ + +

Methods

+ +

[method:this add]( [param:Vector3 v] )

+

Adds [page:Vector3 v] to this vector.

+ +

[method:this addScalar]( [param:Float s] )

+

Adds the scalar value s to this vector's [page:.x x], [page:.y y] and [page:.z z] values.

+ +

[method:this addScaledVector]( [param:Vector3 v], [param:Float s] )

+

Adds the multiple of [page:Vector3 v] and [page:Float s] to this vector.

+ +

[method:this addVectors]( [param:Vector3 a], [param:Vector3 b] )

+

Sets this vector to [page:Vector3 a] + [page:Vector3 b].

+ +

[method:this applyAxisAngle]( [param:Vector3 axis], [param:Float angle] )

+

+ [page:Vector3 axis] - A normalized [page:Vector3].
+ [page:Float angle] - An angle in radians.

+ + Applies a rotation specified by an axis and an angle to this vector. +

+ +

[method:this applyEuler]( [param:Euler euler] )

+

+ Applies euler transform to this vector by converting the [page:Euler] object to a + [page:Quaternion] and applying. +

+ +

[method:this applyMatrix3]( [param:Matrix3 m] )

+

Multiplies this vector by [page:Matrix3 m]

+ +

[method:this applyMatrix4]( [param:Matrix4 m] )

+

+ Multiplies this vector (with an implicit 1 in the 4th dimension) and m, and divides by perspective. +

+ +

[method:this applyQuaternion]( [param:Quaternion quaternion] )

+

+ Applies a [page:Quaternion] transform to this vector. +

+ + +

[method:Float angleTo]( [param:Vector3 v] )

+

+ Returns the angle between this vector and vector [page:Vector3 v] in radians. +

+ +

[method:this ceil]()

+

+ The [page:.x x], [page:.y y] and [page:.z z] components of the vector are rounded up to the nearest integer value. +

+ +

[method:this clamp]( [param:Vector3 min], [param:Vector3 max] )

+

+ [page:Vector3 min] - the minimum [page:.x x], [page:.y y] and [page:.z z] values.
+ [page:Vector3 max] - the maximum [page:.x x], [page:.y y] and [page:.z z] values in the desired range

+ + If this vector's x, y or z value is greater than the max vector's x, y or z value, it is replaced by the corresponding value.

+ If this vector's x, y or z value is less than the min vector's x, y or z value, it is replaced by the corresponding value. +

+ +

[method:this clampLength]( [param:Float min], [param:Float max] )

+

+ [page:Float min] - the minimum value the length will be clamped to
+ [page:Float max] - the maximum value the length will be clamped to

+ + If this vector's length is greater than the max value, it is replaced by the max value.

+ If this vector's length is less than the min value, it is replaced by the min value. +

+ +

[method:this clampScalar]( [param:Float min], [param:Float max] )

+

+ [page:Float min] - the minimum value the components will be clamped to
+ [page:Float max] - the maximum value the components will be clamped to

+ + If this vector's x, y or z values are greater than the max value, they are replaced by the max value.

+ If this vector's x, y or z values are less than the min value, they are replaced by the min value. +

+ +

[method:Vector3 clone]()

+

+ Returns a new vector3 with the same [page:.x x], [page:.y y] and [page:.z z] values as this one. +

+ +

[method:this copy]( [param:Vector3 v] )

+

+ Copies the values of the passed vector3's [page:.x x], [page:.y y] and [page:.z z] + properties to this vector3. +

+ +

[method:this cross]( [param:Vector3 v] )

+

+ Sets this vector to [link:https://en.wikipedia.org/wiki/Cross_product cross product] of itself and [page:Vector3 v]. +

+ +

[method:this crossVectors]( [param:Vector3 a], [param:Vector3 b] )

+

+ Sets this vector to [link:https://en.wikipedia.org/wiki/Cross_product cross product] of [page:Vector3 a] and [page:Vector3 b]. +

+ +

[method:Float distanceTo]( [param:Vector3 v] )

+

Computes the distance from this vector to [page:Vector3 v].

+ +

[method:Float manhattanDistanceTo]( [param:Vector3 v] )

+

+ Computes the [link:https://en.wikipedia.org/wiki/Taxicab_geometry Manhattan distance] from this vector to [page:Vector3 v]. +

+ +

[method:Float distanceToSquared]( [param:Vector3 v] )

+

+ Computes the squared distance from this vector to [page:Vector3 v]. If you are just + comparing the distance with another distance, you should compare the distance squared instead + as it is slightly more efficient to calculate. +

+ +

[method:this divide]( [param:Vector3 v] )

+

Divides this vector by [page:Vector3 v].

+ +

[method:this divideScalar]( [param:Float s] )

+

+ Divides this vector by scalar [page:Float s].
+ Sets vector to *( 0, 0, 0 )* if *[page:Float s] = 0*. +

+ +

[method:Float dot]( [param:Vector3 v] )

+

+ Calculate the [link:https://en.wikipedia.org/wiki/Dot_product dot product] of this + vector and [page:Vector3 v]. +

+ +

[method:Boolean equals]( [param:Vector3 v] )

+

Checks for strict equality of this vector and [page:Vector3 v].

+ +

[method:this floor]()

+

The components of the vector are rounded down to the nearest integer value.

+ +

[method:this fromArray]( [param:Array array], [param:Integer offset] )

+

+ [page:Array array] - the source array.
+ [page:Integer offset] - ( optional) offset into the array. Default is 0.

+ + Sets this vector's [page:.x x] value to be array[ offset + 0 ], [page:.y y] value to be array[ offset + 1 ] + and [page:.z z] value to be array[ offset + 2 ]. +

+ +

[method:this fromBufferAttribute]( [param:BufferAttribute attribute], [param:Integer index] )

+

+ [page:BufferAttribute attribute] - the source attribute.
+ [page:Integer index] - index in the attribute.

+ + Sets this vector's [page:.x x], [page:.y y] and [page:.z z] values from the [page:BufferAttribute attribute]. +

+ +

[method:Float getComponent]( [param:Integer index] )

+

+ [page:Integer index] - 0, 1 or 2.

+ + If index equals 0 returns the [page:.x x] value.
+ If index equals 1 returns the [page:.y y] value.
+ If index equals 2 returns the [page:.z z] value. +

+ +

[method:Float length]()

+

Computes the [link:https://en.wikipedia.org/wiki/Euclidean_distance Euclidean length] + (straight-line length) from (0, 0, 0) to (x, y, z).

+ +

[method:Float manhattanLength]()

+

+ Computes the [link:http://en.wikipedia.org/wiki/Taxicab_geometry Manhattan length] of this vector. +

+ +

[method:Float lengthSq]()

+

+ Computes the square of the [link:https://en.wikipedia.org/wiki/Euclidean_distance Euclidean length] + (straight-line length) from (0, 0, 0) to (x, y, z). If you are comparing the lengths of + vectors, you should compare the length squared instead as it is slightly more efficient to calculate. +

+ +

[method:this lerp]( [param:Vector3 v], [param:Float alpha] )

+

+ [page:Vector3 v] - [page:Vector3] to interpolate towards.
+ alpha - interpolation factor in the closed interval [0, 1].

+ + Linearly interpolate between this vector and [page:Vector3 v], where alpha is the + distance along the line - alpha = 0 will be this vector, and alpha = 1 will be [page:Vector3 v]. +

+ +

[method:this lerpVectors]( [param:Vector3 v1], [param:Vector3 v2], [param:Float alpha] )

+

+ [page:Vector3 v1] - the starting [page:Vector3].
+ [page:Vector3 v2] - [page:Vector3] to interpolate towards.
+ [page:Float alpha] - interpolation factor in the closed interval [0, 1].

+ + Sets this vector to be the vector linearly interpolated between [page:Vector3 v1] and + [page:Vector3 v2] where alpha is the distance along the line connecting the two vectors + - alpha = 0 will be [page:Vector3 v1], and alpha = 1 will be [page:Vector3 v2]. +

+ +

[method:this max]( [param:Vector3 v] )

+

+ If this vector's x, y or z value is less than [page:Vector3 v]'s x, y or z value, replace + that value with the corresponding max value. +

+ +

[method:this min]( [param:Vector3 v] )

+

+ If this vector's x, y or z value is greater than [page:Vector3 v]'s x, y or z value, replace + that value with the corresponding min value. +

+ +

[method:this multiply]( [param:Vector3 v] )

+

Multiplies this vector by [page:Vector3 v].

+ +

[method:this multiplyScalar]( [param:Float s] )

+

Multiplies this vector by scalar [page:Float s].

+ +

[method:this multiplyVectors]( [param:Vector3 a], [param:Vector3 b] )

+

Sets this vector equal to [page:Vector3 a] * [page:Vector3 b], component-wise.

+ +

[method:this negate]()

+

Inverts this vector - i.e. sets x = -x, y = -y and z = -z.

+ +

[method:this normalize]()

+

+ Convert this vector to a [link:https://en.wikipedia.org/wiki/Unit_vector unit vector] - that is, sets it equal to the vector with the same direction + as this one, but [page:.length length] 1. +

+ +

[method:this project]( [param:Camera camera] )

+

+ [page:Camera camera] — camera to use in the projection.

+ + [link:https://en.wikipedia.org/wiki/Vector_projection Projects] the vector with the camera. +

+ +

[method:this projectOnPlane]( [param:Vector3 planeNormal] )

+

+ [page:Vector3 planeNormal] - A vector representing a plane normal.

+ + [link:https://en.wikipedia.org/wiki/Vector_projection Projects] this vector onto a plane by subtracting this vector projected onto the plane's + normal from this vector. +

+ +

[method:this projectOnVector]( [param:Vector3] )

+

[link:https://en.wikipedia.org/wiki/Vector_projection Projects] this vector onto another vector.

+ +

[method:this reflect]( [param:Vector3 normal] )

+

+ [page:Vector3 normal] - the normal to the reflecting plane

+ + Reflect the vector off of plane orthogonal to [page:Vector3 normal]. Normal is assumed to + have unit length. +

+ +

[method:this round]()

+

The components of the vector are rounded to the nearest integer value.

+ +

[method:this roundToZero]()

+

+ The components of the vector are rounded towards zero (up if negative, down if positive) to an integer value. +

+ +

[method:this set]( [param:Float x], [param:Float y], [param:Float z] )

+

Sets the [page:.x x], [page:.y y] and [page:.z z] components of this vector.

+ +

[method:null setComponent]( [param:Integer index], [param:Float value] )

+

+ [page:Integer index] - 0, 1 or 2.
+ [page:Float value] - [page:Float]

+ + If index equals 0 set [page:.x x] to [page:Float value].
+ If index equals 1 set [page:.y y] to [page:Float value].
+ If index equals 2 set [page:.z z] to [page:Float value] +

+ +

[method:this setFromCylindrical]( [param:Cylindrical c] )

+

+ Sets this vector from the cylindrical coordinates [page:Cylindrical c]. +

+ +

[method:this setFromCylindricalCoords]( [param:Float radius], [param:Float theta], [param:Float y] )

+

Sets this vector from the cylindrical coordinates [page:Cylindrical radius], [page:Cylindrical theta] and [page:Cylindrical y].

+ +

[method:this setFromMatrixColumn]( [param:Matrix4 matrix], [param:Integer index] )

+

+ Sets this vector's [page:.x x], [page:.y y] and [page:.z z] equal to the column of + the [page:Matrix4 matrix] specified by the [page:Integer index]. +

+ +

[method:this setFromMatrixPosition]( [param:Matrix4 m] )

+

+ Sets this vector to the position elements of the + [link:https://en.wikipedia.org/wiki/Transformation_matrix transformation matrix] [page:Matrix4 m]. +

+ +

[method:this setFromMatrixScale]( [param:Matrix4 m] )

+

+ Sets this vector to the scale elements of the + [link:https://en.wikipedia.org/wiki/Transformation_matrix transformation matrix] [page:Matrix4 m]. +

+ +

[method:this setFromSpherical]( [param:Spherical s] )

+

+ Sets this vector from the spherical coordinates [page:Spherical s]. +

+ +

[method:this setFromSphericalCoords]( [param:Float radius], [param:Float phi], [param:Float theta] )

+

Sets this vector from the spherical coordinates [page:Spherical radius], [page:Spherical phi] and [page:Spherical theta].

+ +

[method:this setLength]( [param:Float l] )

+

+ Set this vector to the vector with the same direction as this one, but [page:.length length] + [page:Float l]. +

+ +

[method:this setScalar]( [param:Float scalar] )

+

+ Set the [page:.x x], [page:.y y] and [page:.z z] values of this vector both equal to [page:Float scalar]. +

+ +

[method:this setX]( [param:Float x] )

+

Replace this vector's [page:.x x] value with [page:Float x].

+ +

[method:this setY]( [param:Float y] )

+

Replace this vector's [page:.y y] value with [page:Float y].

+ +

[method:this setZ]( [param:Float z] )

+

Replace this vector's [page:.z z] value with [page:Float z].

+ +

[method:this sub]( [param:Vector3 v] )

+

Subtracts [page:Vector3 v] from this vector.

+ +

[method:this subScalar]( [param:Float s] )

+

Subtracts [page:Float s] from this vector's [page:.x x], [page:.y y] and [page:.z z] compnents.

+ +

[method:this subVectors]( [param:Vector3 a], [param:Vector3 b] )

+

Sets this vector to [page:Vector3 a] - [page:Vector3 b].

+ +

[method:Array toArray]( [param:Array array], [param:Integer offset] )

+

+ [page:Array array] - (optional) array to store the vector to. If this is not provided + a new array will be created.
+ [page:Integer offset] - (optional) optional offset into the array.

+ + Returns an array [x, y, z], or copies x, y and z into the provided [page:Array array]. +

+ +

[method:this transformDirection]( [param:Matrix4 m] )

+

+ Transforms the direction of this vector by a matrix (the upper left 3 x 3 subset of a [page:Matrix4 m]) + and then [page:.normalize normalizes] the result. +

+ +

[method:this unproject]( [param:Camera camera] )

+

+ [page:Camera camera] — camera to use in the projection.

+ + [link:https://en.wikipedia.org/wiki/Vector_projection Unprojects] the vector with the + camera's projection matrix. +

+ + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/math/Vector4.html b/docs/api/zh/math/Vector4.html new file mode 100644 index 00000000000000..c8197ea95ed109 --- /dev/null +++ b/docs/api/zh/math/Vector4.html @@ -0,0 +1,331 @@ + + + + + + + + + + +

[name]

+ +

Class representing a 4D [link:https://en.wikipedia.org/wiki/Vector_space vector]. + + A 4D vector is an ordered quadruplet of numbers (labeled x, y, z, and w), which can be used to + represent a number of things, such as: +

+ +
    +
  • + A point in 4D space. +
  • +
  • + A direction and length in 4D space. In three.js the length will always be the + [link:https://en.wikipedia.org/wiki/Euclidean_distance Euclidean distance] + (straight-line distance) from (0, 0, 0, 0) to (x, y, z, w) and the direction is also + measured from (0, 0, 0, 0) towards (x, y, z, w). +
  • +
  • + Any arbitrary ordered quadruplet of numbers. +
  • +
+ +

+ There are other things a 4D vector can be used to represent, however these are the most common uses in three.js. +

+ + +

Example

+ + +var a = new THREE.Vector4( 0, 1, 0, 0 ); + +//no arguments; will be initialised to (0, 0, 0, 1) +var b = new THREE.Vector4( ); + +var d = a.dot( b ); + + + +

Constructor

+ +

[name]( [param:Float x], [param:Float y], [param:Float z], [param:Float w] )

+

+ [page:Float x] - the x value of the vector. Default is *0*.
+ [page:Float y] - the y value of the vector. Default is *0*.
+ [page:Float z] - the z value of the vector. Default is *0*.
+ [page:Float w] - the w value of the vector. Default is *1*.

+ + Creates a new [name]. +

+ + +

Properties

+ +

[property:Boolean isVector4]

+

+ Used to check whether this or derived classes are Vector4s. Default is *true*.

+ + You should not change this, as it is used internally for optimisation. +

+ +

[property:Float x]

+ +

[property:Float y]

+ +

[property:Float z]

+ +

[property:Float w]

+ + +

Methods

+ +

[method:this add]( [param:Vector4 v] )

+

Adds [page:Vector4 v] to this vector.

+ +

[method:this addScalar]( [param:Float s] )

+

Adds the scalar value s to this vector's [page:.x x], [page:.y y], [page:.z z] and [page:.w w] values.

+ +

[method:this addScaledVector]( [param:Vector4 v], [param:Float s] )

+

Adds the multiple of [page:Vector4 v] and [page:Float s] to this vector.

+ +

[method:this addVectors]( [param:Vector4 a], [param:Vector4 b] )

+

Sets this vector to [page:Vector4 a] + [page:Vector4 b].

+ +

[method:this applyMatrix4]( [param:Matrix4 m] )

+

+ Multiplies this vector by 4 x 4 [page:Matrix4 m]. +

+ +

[method:this ceil]()

+

+ The [page:.x x], [page:.y y], [page:.z z] and [page:.w w] components of the vector are rounded up to the nearest integer value. +

+ +

[method:this clamp]( [param:Vector4 min], [param:Vector4 max] )

+

+ [page:Vector4 min] - the minimum [page:.x x], [page:.y y], [page:.z z] and [page:.w w] values.
+ [page:Vector4 max] - the maximum [page:.x x], [page:.y y], [page:.z z] and [page:.w w] values in the desired range

+ + If this vector's x, y, z or w value is greater than the max vector's x, y, z or w value, it is replaced by the corresponding value.

+ If this vector's x, y, z or w value is less than the min vector's x, y, z or w value, it is replaced by the corresponding value. +

+ +

[method:this clampLength]( [param:Float min], [param:Float max] )

+

+ [page:Float min] - the minimum value the length will be clamped to
+ [page:Float max] - the maximum value the length will be clamped to

+ + If this vector's length is greater than the max value, it is replaced by the max value.

+ If this vector's length is less than the min value, it is replaced by the min value. +

+ +

[method:this clampScalar]( [param:Float min], [param:Float max] )

+

+ [page:Float min] - the minimum value the components will be clamped to
+ [page:Float max] - the maximum value the components will be clamped to

+ + If this vector's x, y, z or w values are greater than the max value, they are replaced by the max value.

+ If this vector's x, y, z or w values are less than the min value, they are replaced by the min value. +

+ +

[method:Vector4 clone]()

+

+ Returns a new Vector4 with the same [page:.x x], [page:.y y], [page:.z z] and [page:.w w] values as this one. +

+ +

[method:this copy]( [param:Vector4 v] )

+

+ Copies the values of the passed Vector4's [page:.x x], [page:.y y], [page:.z z] and [page:.w w] + properties to this Vector4. +

+ +

[method:this divideScalar]( [param:Float s] )

+

+ Divides this vector by scalar [page:Float s].
+ Sets vector to *( 0, 0, 0, 0 )* if *[page:Float s] = 0*. +

+ +

[method:Float dot]( [param:Vector4 v] )

+

+ Calculates the [link:https://en.wikipedia.org/wiki/Dot_product dot product] of this + vector and [page:Vector4 v]. +

+ +

[method:Boolean equals]( [param:Vector4 v] )

+

Checks for strict equality of this vector and [page:Vector4 v].

+ +

[method:this floor]()

+

The components of the vector are rounded down to the nearest integer value.

+ +

[method:this fromArray]( [param:Array array], [param:Integer offset] )

+

+ [page:Array array] - the source array.
+ [page:Integer offset] - (optional) offset into the array. Default is 0.

+ + Sets this vector's [page:.x x] value to be array[ offset + 0 ], [page:.y y] value to be array[ offset + 1 ] + [page:.z z] value to be array[ offset + 2 ] and [page:.w w ] value to be array[ offset + 3 ]. +

+ +

[method:this fromBufferAttribute]( [param:BufferAttribute attribute], [param:Integer index] )

+

+ [page:BufferAttribute attribute] - the source attribute.
+ [page:Integer index] - index in the attribute.

+ + Sets this vector's [page:.x x], [page:.y y], [page:.z z] and [page:.w w] values from the [page:BufferAttribute attribute]. +

+ +

[method:Float getComponent]( [param:Integer index] )

+

+ [page:Integer index] - 0, 1, 2 or 3.

+ + If index equals 0 returns the [page:.x x] value.
+ If index equals 1 returns the [page:.y y] value.
+ If index equals 2 returns the [page:.z z] value.
+ If index equals 3 returns the [page:.w w] value. +

+ +

[method:Float length]()

+

Computes the [link:https://en.wikipedia.org/wiki/Euclidean_distance Euclidean length] + (straight-line length) from (0, 0, 0, 0) to (x, y, z, w).

+ +

[method:Float manhattanLength]()

+

+ Computes the [link:http://en.wikipedia.org/wiki/Taxicab_geometry Manhattan length] of this vector. +

+ +

[method:Float lengthSq]()

+

+ Computes the square of the [link:https://en.wikipedia.org/wiki/Euclidean_distance Euclidean length] + (straight-line length) from (0, 0, 0, 0) to (x, y, z, w). If you are comparing the lengths of + vectors, you should compare the length squared instead as it is slightly more efficient to calculate. +

+ +

[method:this lerp]( [param:Vector4 v], [param:Float alpha] )

+

+ [page:Vector4 v] - [page:Vector4] to interpolate towards.
+ alpha - interpolation factor in the closed interval [0, 1].

+ + Linearly interpolates between this vector and [page:Vector4 v], where alpha is the + distance along the line - alpha = 0 will be this vector, and alpha = 1 will be [page:Vector4 v]. +

+ +

[method:this lerpVectors]( [param:Vector4 v1], [param:Vector4 v2], [param:Float alpha] )

+

+ [page:Vector4 v1] - the starting [page:Vector4].
+ [page:Vector4 v2] - [page:Vector4] to interpolate towards.
+ [page:Float alpha] - interpolation factor in the closed interval [0, 1].

+ + Sets this vector to be the vector linearly interpolated between [page:Vector4 v1] and + [page:Vector4 v2] where alpha is the distance along the line connecting the two vectors + - alpha = 0 will be [page:Vector4 v1], and alpha = 1 will be [page:Vector4 v2]. +

+ +

[method:this negate]()

+

Inverts this vector - i.e. sets x = -x, y = -y, z = -z and w = -w.

+ +

[method:this normalize]()

+

+ Converts this vector to a [link:https://en.wikipedia.org/wiki/Unit_vector unit vector] - that is, sets it equal to the vector with the same direction + as this one, but [page:.length length] 1. +

+ +

[method:this max]( [param:Vector4 v] )

+

+ If this vector's x, y, z or w value is less than [page:Vector4 v]'s x, y, z or w value, replace + that value with the corresponding max value. +

+ +

[method:this min]( [param:Vector4 v] )

+

+ If this vector's x, y, z or w value is greater than [page:Vector4 v]'s x, y, z or w value, replace + that value with the corresponding min value. +

+ +

[method:this multiplyScalar]( [param:Float s] )

+

Multiplies this vector by scalar [page:Float s].

+ +

[method:this round]()

+

The components of the vector are rounded to the nearest integer value.

+ +

[method:this roundToZero]()

+

+ The components of the vector are rounded towards zero (up if negative, down if positive) to an integer value. +

+ +

[method:this set]( [param:Float x], [param:Float y], [param:Float z], [param:Float w] )

+

Sets the [page:.x x], [page:.y y], [page:.z z] and [page:.w w] components of this vector.

+ +

[method:this setAxisAngleFromQuaternion]( [param:Quaterion q] )

+

+ [page:Quaterion q] - a normalized [page:Quaterion]

+ + Sets the [page:.x x], [page:.y y] and [page:.z z] components of this vector to the + quaternion's axis and [page:.w w] to the angle. +

+ +

[method:this setAxisAngleFromRotationMatrix]( [param:Matrix4 m] )

+

+ [page:Matrix4 m] - a [page:Matrix4] of which the upper left 3x3 matrix is a pure rotation matrix.

+ + Sets the [page:.x x], [page:.y y] and [page:.z z] to the axis of rotation and [page:.w w] to the angle. +

+ +

[method:null setComponent]( [param:Integer index], [param:Float value] )

+

+ [page:Integer index] - 0, 1 or 2.
+ [page:Float value] - [page:Float]

+ + If index equals 0 set [page:.x x] to [page:Float value].
+ If index equals 1 set [page:.y y] to [page:Float value].
+ If index equals 2 set [page:.z z] to [page:Float value].
+ If index equals 3 set [page:.w w] to [page:Float value]. +

+ + +

[method:this setLength]( [param:Float l] )

+

+ Sets this vector to the vector with the same direction as this one, but [page:.length length] + [page:Float l]. +

+ +

[method:this setScalar]( [param:Float scalar] )

+

+ Sets the [page:.x x], [page:.y y], [page:.z z] and [page:.w w] values of this vector both equal to [page:Float scalar]. +

+ +

[method:this setX]( [param:Float x] )

+

Replaces this vector's [page:.x x] value with [page:Float x].

+ +

[method:this setY]( [param:Float y] )

+

Replaces this vector's [page:.y y] value with [page:Float y].

+ +

[method:this setZ]( [param:Float z] )

+

Replaces this vector's [page:.z z] value with [page:Float z].

+ +

[method:this setW]( [param:Float w] )

+

Replaces this vector's [page:.w w] value with [page:Float w].

+ +

[method:this sub]( [param:Vector4 v] )

+

Subtracts [page:Vector4 v] from this vector.

+ +

[method:this subScalar]( [param:Float s] )

+

Subtracts [page:Float s] from this vector's [page:.x x], [page:.y y], [page:.z z] and [page:.w w] compnents.

+ +

[method:this subVectors]( [param:Vector4 a], [param:Vector4 b] )

+

Sets this vector to [page:Vector4 a] - [page:Vector4 b].

+ +

[method:Array toArray]( [param:Array array], [param:Integer offset] )

+

+ [page:Array array] - (optional) array to store the vector to. If this is not provided, a new array will be created.
+ [page:Integer offset] - (optional) optional offset into the array.

+ + Returns an array [x, y, z, w], or copies x, y, z and w into the provided [page:Array array]. +

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/math/interpolants/CubicInterpolant.html b/docs/api/zh/math/interpolants/CubicInterpolant.html new file mode 100644 index 00000000000000..003f95a860257d --- /dev/null +++ b/docs/api/zh/math/interpolants/CubicInterpolant.html @@ -0,0 +1,85 @@ + + + + + + + + + + + [page:Interpolant] → + +

三次插值([name])

+ +

+ +

+ +

例子(Example)

+ + +var interpolant = new THREE.[name]( + new Float32Array( 2 ), + new Float32Array( 2 ), + 1, + new Float32Array( 1 ) +); + +interpolant.evaluate( 0.5 ); + + + +

构造函数(Constructor)

+ +

[name]( parameterPositions, sampleValues, sampleSize, resultBuffer )

+

+ parameterPositions -- 位置数组
+ sampleValues -- 样本数组
+ sampleSize -- 样本数量
+ resultBuffer -- 用于存储插值结果的缓冲区。

+ + +

+ +

属性(Properties)

+ + + +

[property:null parameterPositions]

+

+ +

+ +

[property:null resultBuffer]

+

+ +

+ +

[property:null sampleValues]

+

+ +

+ +

[property:Object settings]

+

+ +

+ +

[property:null valueSize]

+

+ +

+ +

方法(Methods)

+ +

[method:null evaluate]( [param:Number t] )

+

+ 评估位置*t*处的插值。 +

+ +

源码(Source)

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/math/interpolants/DiscreteInterpolant.html b/docs/api/zh/math/interpolants/DiscreteInterpolant.html new file mode 100644 index 00000000000000..5b1ce572a108f5 --- /dev/null +++ b/docs/api/zh/math/interpolants/DiscreteInterpolant.html @@ -0,0 +1,85 @@ + + + + + + + + + + + [page:Interpolant] → + +

离散插值([name])

+ +

+ +

+ +

例子(Example)

+ + +var interpolant = new THREE.[name]( + new Float32Array( 2 ), + new Float32Array( 2 ), + 1, + new Float32Array( 1 ) +); + +interpolant.evaluate( 0.5 ); + + + +

Constructor

+ +

[name]( parameterPositions, sampleValues, sampleSize, resultBuffer )

+

+ parameterPositions -- 位置数组
+ sampleValues -- 样本数组
+ sampleSize -- 样本数量
+ resultBuffer -- 用于存储插值结果的缓冲区。

+ + +

+ +

属性(Properties)

+ + + +

[property:null parameterPositions]

+

+ +

+ +

[property:null resultBuffer]

+

+ +

+ +

[property:null sampleValues]

+

+ +

+ +

[property:Object settings]

+

+ +

+ +

[property:null valueSize]

+

+ +

+ +

Methods

+ +

[method:null evaluate]( [param:Number t] )

+

+ 评估位置*t*处的插值。 +

+ +

源码(Source)

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/math/interpolants/LinearInterpolant.html b/docs/api/zh/math/interpolants/LinearInterpolant.html new file mode 100644 index 00000000000000..1670033ce1afaa --- /dev/null +++ b/docs/api/zh/math/interpolants/LinearInterpolant.html @@ -0,0 +1,85 @@ + + + + + + + + + + + [page:Interpolant] → + +

线性插值([name])

+ +

+ +

+ +

例子(Example)

+ + +var interpolant = new THREE.[name]( + new Float32Array( 2 ), + new Float32Array( 2 ), + 1, + new Float32Array( 1 ) +); + +interpolant.evaluate( 0.5 ); + + + +

构造函数(Constructor)

+ +

[name]( parameterPositions, sampleValues, sampleSize, resultBuffer )

+

+ parameterPositions -- 位置数组
+ sampleValues -- 样本数组
+ sampleSize -- 样本数量
+ resultBuffer -- 用于存储插值结果的缓冲区。

+ + +

+ +

属性(Properties)

+ + + +

[property:null parameterPositions]

+

+ +

+ +

[property:null resultBuffer]

+

+ +

+ +

[property:null sampleValues]

+

+ +

+ +

[property:Object settings]

+

+ +

+ +

[property:null valueSize]

+

+ +

+ +

方法(Methods)

+ +

[method:null evaluate]( [param:Number t] )

+

+ 评估位置*t*处的插值。 +

+ +

源码(Source)

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/math/interpolants/QuaternionLinearInterpolant.html b/docs/api/zh/math/interpolants/QuaternionLinearInterpolant.html new file mode 100644 index 00000000000000..5bcc2cc36602fd --- /dev/null +++ b/docs/api/zh/math/interpolants/QuaternionLinearInterpolant.html @@ -0,0 +1,85 @@ + + + + + + + + + + + [page:Interpolant] → + +

四元数线性插值([name])

+ +

+ +

+ +

例子(Example)

+ + +var interpolant = new THREE.[name]( + new Float32Array( 2 ), + new Float32Array( 2 ), + 1, + new Float32Array( 1 ) +); + +interpolant.evaluate( 0.5 ); + + + +

构造函数(Constructor)

+ +

[name]( parameterPositions, sampleValues, sampleSize, resultBuffer )

+

+ parameterPositions -- 位置数组
+ sampleValues -- 样本数组
+ sampleSize -- 样本数量
+ resultBuffer -- 用于存储插值结果的缓冲区。

+ + +

+ +

属性(Properties)

+ + + +

[property:null parameterPositions]

+

+ +

+ +

[property:null resultBuffer]

+

+ +

+ +

[property:null sampleValues]

+

+ +

+ +

[property:Object settings]

+

+ +

+ +

[property:null valueSize]

+

+ +

+ +

方法(Methods)

+ +

[method:null evaluate]( [param:Number t] )

+

+ 评估位置*t*处的插值。 +

+ +

源码(Source)

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/objects/Bone.html b/docs/api/zh/objects/Bone.html new file mode 100644 index 00000000000000..e9cfb1905815d0 --- /dev/null +++ b/docs/api/zh/objects/Bone.html @@ -0,0 +1,58 @@ + + + + + + + + + + + [page:Object3D] → + +

骨骼([name])

+ +

+ 骨骼是[page:Skeleton](骨架)的一部分。骨架是由[page:SkinnedMesh](蒙皮网格)依次来使用的。 + 骨骼几乎和空白[page:Object3D]相同。 +

+ +

示例

+ + + var root = new THREE.Bone(); + var child = new THREE.Bone(); + + root.add( child ); + child.position.y = 5; + + +

构造器

+ +

[name]( )

+

+ 创建一个新的[name]. +

+ +

属性

+

请参阅其基类[page:Object3D]来查看共有属性。

+ +

[property:Boolean isBone]

+

+ 用于检查这个类或其派生类是否为骨骼。默认值为*true*。

+ 你不应当对这个属性进行改变,因为它在内部使用,以用于优化。 +

+ + +

[property:String type]

+

设置为“Bone”,这可以用于在一个场景中找到所有的Bones。

+ + +

方法

+

请参阅其基类[page:Object3D]来查看其共有方法。

+ +

源代码

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/objects/Group.html b/docs/api/zh/objects/Group.html new file mode 100644 index 00000000000000..10befde43aac2e --- /dev/null +++ b/docs/api/zh/objects/Group.html @@ -0,0 +1,59 @@ + + + + + + + + + + + [page:Object3D] → + +

组([name])

+ +

+ 它几乎和[page:Object3D Object3D]是相同的,其目的是使得组中对象在语法上的结构更加清晰。 +

+ + +

示例

+ + + var geometry = new THREE.BoxBufferGeometry( 1, 1, 1 ); + var material = new THREE.MeshBasicMaterial( {color: 0x00ff00} ); + + var cubeA = new THREE.Mesh( geometry, material ); + cubeA.position.set( 100, 100, 0 ); + + var cubeB = new THREE.Mesh( geometry, material ); + cubeB.position.set( -100, -100, 0 ); + + //create a group and add the two cubes + //These cubes can now be rotated / scaled etc as a group + var group = new THREE.Group(); + group.add( cubeA ); + group.add( cubeB ); + + scene.add( group ); + + + +

构造器

+ +

[name]( )

+ +

属性

+

请参阅其基类[page:Object3D]来查看公共属性。

+ +

[property:String type]

+

一个字符串:“Group”。这个属性不应当被改变。

+ +

方法

+

请参阅其基类[page:Object3D]来查看其公共方法。

+ +

源代码

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/objects/LOD.html b/docs/api/zh/objects/LOD.html new file mode 100644 index 00000000000000..069920e0705bc0 --- /dev/null +++ b/docs/api/zh/objects/LOD.html @@ -0,0 +1,119 @@ + + + + + + + + + + + [page:Object3D] → + +

[name]

+ +

+ Level of Detail - show meshes with more or less geometry based on distance from the camera.

+ + Every level is associated with an object, and rendering can be switched between them at the distances + specified. Typically you would create, say, three meshes, one for far away (low detail), one for mid range (medium detail) + and one for close up (high detail). +

+ +

Example

+ +

+ [example:webgl_lod webgl / lod ] +

+ + +var lod = new THREE.LOD(); + +//Create spheres with 3 levels of detail and create new LOD levels for them +for( var i = 0; i < 3; i++ ) { + + var geometry = new THREE.IcosahedronBufferGeometry( 10, 3 - i ) + + var mesh = new THREE.Mesh( geometry, material ); + + lod.addLevel( mesh, i * 75 ); + +} + +scene.add( lod ); + + +

+ Note that for the LOD to switch between the different detail levels, you will + have to call [page:.update update]( camera ) in your render loop. See the source code + for this example for details: + [example:webgl_lod WebGL / LOD] + + +

Constructor

+

[name]( )

+

+ Creates a new [name]. +

+ + +

Properties

+

See the base [page:Object3D] class for common properties.

+ +

[property:array levels]

+

+ An array of [page:object level] objects

+ + Each level is an object with two properties:
+ [page:Object3D object] - The [page:Object3D] to display at this level.
+ [page:Float distance] - The distance at which to display this level of detail. +

+ +

Methods

+

See the base [page:Object3D] class for common methods.

+ +

[method:null addLevel]( [param:Object3D object], [param:Float distance] )

+

+ [page:Object3D object] - The [page:Object3D] to display at this level.
+ [page:Float distance] - The distance at which to display this level of detail.

+ + Adds a mesh that will display at a certain distance and greater. Typically the further away the distance, + the lower the detail on the mesh. +

+ +

[method:LOD clone]()

+

+ Returns a clone of this LOD object and its associated distance specific objects. +

+ + +

[method:Object3D getObjectForDistance]( [param:Float distance] )

+

+ Get a reference to the first [page:Object3D] (mesh) that is greater than [page:Float distance]. +

+ +

[method:Array raycast]( [param:Raycaster raycaster], [param:Array intersects] )

+

+ Get intersections between a casted [page:Ray] and this LOD. + [page:Raycaster.intersectObject] will call this method. +

+ + + +

[method:null toJSON]( meta )

+

+ Create a JSON structure with details of this LOD object. +

+ +

[method:null update]( [param:Camera camera] )

+

+ Set the visibility of each [page:levels level]'s [page:Object3D object] based on + distance from the [page:Camera camera]. This needs to be called in the render loop + for levels of detail to be updated dynamically. +

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/objects/Line.html b/docs/api/zh/objects/Line.html new file mode 100644 index 00000000000000..cb3800af8f5b1c --- /dev/null +++ b/docs/api/zh/objects/Line.html @@ -0,0 +1,98 @@ + + + + + + + + + + + [page:Object3D] → + +

[name]

+ +

+ A continuous line.

+ + This is nearly the same + as [page:LineSegments]; the only difference is that it is rendered using + [link:https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/drawElements gl.LINE_STRIP] + instead of [link:https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/drawElements gl.LINES] + +

+ + +

Example

+ + var material = new THREE.LineBasicMaterial({ + color: 0x0000ff + }); + + var geometry = new THREE.Geometry(); + geometry.vertices.push( + new THREE.Vector3( -10, 0, 0 ), + new THREE.Vector3( 0, 10, 0 ), + new THREE.Vector3( 10, 0, 0 ) + ); + + var line = new THREE.Line( geometry, material ); + scene.add( line ); + + + +

Constructor

+ +

[name]( [param:Geometry geometry], [param:Material material] )

+ +

+ [page:Geometry geometry] — vertices representing the line segment(s). Default is a new [page:BufferGeometry].
+ [page:Material material] — material for the line. Default is a new [page:LineBasicMaterial] with random color.
+

+ +

If no material is supplied, a randomized line material will be created and assigned to the object.

+ + +

Properties

+

See the base [page:Object3D] class for common properties.

+ +

[property:Boolean isLine]

+

+ Used to check whether this or derived classes are lines. Default is *true*.

+ + You should not change this, as it used internally for optimisation. +

+ + +

[property:Geometry geometry]

+

Vertices representing the line segment(s).

+ +

[property:Material material]

+

Material for the line.

+ + +

Methods

+

See the base [page:Object3D] class for common methods.

+ +

[method:Line computeLineDistances]()

+

+ Computes an array of distance values which are necessary for [page:LineDashedMaterial]. For each vertex in the geometry, the method calculates the cumulative length from the current point to the very beginning of the line. +

+ +

[method:null raycast]( [param:Raycaster raycaster], [param:Array intersects] )

+

+ Get intersections between a casted [page:Ray] and this Line. + [page:Raycaster.intersectObject] will call this method. +

+ +

[method:Line clone]()

+

+ Returns a clone of this Line object and its descendants. +

+ + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/objects/LineLoop.html b/docs/api/zh/objects/LineLoop.html new file mode 100644 index 00000000000000..0c25e2fd3101b1 --- /dev/null +++ b/docs/api/zh/objects/LineLoop.html @@ -0,0 +1,55 @@ + + + + + + + + + + + [page:Object3D] → [page:Line] → + +

[name]

+ +

+ A continuous line that connects back to the start.

+ + This is nearly the same as [page:Line]; the only difference is that it is rendered using + [link:https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/drawElements gl.LINE_LOOP] + instead of [link:https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/drawElements gl.LINE_STRIP], + which draws a straight line to the next vertex, and connects the last vertex back to the first. +

+ + +

Constructor

+ +

[name]( [param:Geometry geometry], [param:Material material] )

+ +

+ [page:Geometry geometry] — List of vertices representing points on the line loop.
+ [page:Material material] — Material for the line. Default is [page:LineBasicMaterial LineBasicMaterial]. +

+ +

If no material is supplied, a randomized line material will be created and assigned to the object.

+ + +

Properties

+

See the base [page:Line] class for common properties.

+ +

[property:Boolean isLineLoop]

+

+ Used to check whether this or derived classes are line loops. Default is *true*.

+ + You should not change this, as it used internally for optimisation. +

+ + +

Methods

+

See the base [page:Line] class for common methods.

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/objects/LineSegments.html b/docs/api/zh/objects/LineSegments.html new file mode 100644 index 00000000000000..bc349168ba3a09 --- /dev/null +++ b/docs/api/zh/objects/LineSegments.html @@ -0,0 +1,54 @@ + + + + + + + + + + + [page:Object3D] → [page:Line] → + +

[name]

+ +

+ A series of lines drawn between pairs of vertices.

+ + This is nearly the same as [page:Line]; the only difference is that it is rendered using + [link:https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/drawElements gl.LINES] + instead of [link:https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/drawElements gl.LINE_STRIP]. +

+ + +

Constructor

+ +

[name]( [param:Geometry geometry], [param:Material material] )

+ +

+ [page:Geometry geometry] — Pair(s) of vertices representing each line segment(s).
+ [page:Material material] — Material for the line. Default is [page:LineBasicMaterial LineBasicMaterial]. +

+ +

If no material is supplied, a randomized line material will be created and assigned to the object.

+ + +

Properties

+

See the base [page:Line] class for common properties.

+ +

[property:Boolean isLineSegments]

+

+ Used to check whether this or derived classes are line segments. Default is *true*.

+ + You should not change this, as it used internally for optimisation. +

+ + +

Methods

+

See the base [page:Line] class for common methods.

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/objects/Mesh.html b/docs/api/zh/objects/Mesh.html new file mode 100644 index 00000000000000..7472c9e22913d2 --- /dev/null +++ b/docs/api/zh/objects/Mesh.html @@ -0,0 +1,113 @@ + + + + + + + + + + + [page:Object3D] → + +

[name]

+ +

+ Class representing triangular [link:https://en.wikipedia.org/wiki/Polygon_mesh polygon mesh] based objects. + Also serves as a base for other classes such as [page:SkinnedMesh]. +

+ + +

Example

+ + + var geometry = new THREE.BoxBufferGeometry( 1, 1, 1 ); + var material = new THREE.MeshBasicMaterial( { color: 0xffff00 } ); + var mesh = new THREE.Mesh( geometry, material ); + scene.add( mesh ); + + + +

Constructor

+ +

[name]( [param:Geometry geometry], [param:Material material] )

+

+ [page:Geometry geometry] — (optional) an instance of [page:Geometry] or [page:BufferGeometry]. + Default is a new [page:BufferGeometry].
+ [page:Material material] — (optional) a single or an array of [page:Material]. Default is a new [page:MeshBasicMaterial] +

+ + +

Properties

+

See the base [page:Object3D] class for common properties.

+ +

[property:Integer drawMode]

+

+ Determines how the mesh triangles are constructed from the vertices. + See the draw mode [page:DrawModes constants] for all possible values. + Default is [page:DrawModes TrianglesDrawMode]. +

+ + +

[property:Boolean isMesh]

+

+ Used to check whether this or derived classes are meshes. Default is *true*.

+ + You should not change this, as it is used internally for optimisation. +

+ +

[property:Geometry geometry]

+

+ An instance of [page:Geometry] or [page:BufferGeometry] (or derived classes), + defining the object's structure.

+ + It's recommended to always use a [page:BufferGeometry] if possible for best performance. +

+ +

[property:Material material]

+

+ An instance of material derived from the [page:Material] base class or an array of materials, defining the + object's appearance. Default is a [page:MeshBasicMaterial] with a random color. +

+ +

[property:Array morphTargetInfluences]

+

+ An array of weights typically from 0-1 that specify how much of the morph is applied. + Undefined by default, but reset to a blank array by [page:Mesh.updateMorphTargets updateMorphTargets]. +

+ +

[property:Object morphTargetDictionary]

+

+ A dictionary of morphTargets based on the morphTarget.name property. + Undefined by default, but rebuilt [page:Mesh.updateMorphTargets updateMorphTargets]. +

+ + +

Methods

+

See the base [page:Object3D] class for common methods.

+ +

[method:null setDrawMode]( [param:Integer value] )

+

Set the value of [page:.drawMode drawMode].

+ +

[method:Mesh clone]()

+

Returns a clone of this [name] object and its descendants.

+ +

[method:null raycast]( [param:Raycaster raycaster], [param:Array intersects] )

+

+ Get intersections between a casted ray and this mesh. + [page:Raycaster.intersectObject] will call this method. +

+ +

[method:null updateMorphTargets]()

+

+ Updates the morphTargets to have no influence on the object. Resets the + [page:Mesh.morphTargetInfluences morphTargetInfluences] and + [page:Mesh.morphTargetDictionary morphTargetDictionary] properties. +

+ + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/objects/Points.html b/docs/api/zh/objects/Points.html new file mode 100644 index 00000000000000..5493fb1fcb3c88 --- /dev/null +++ b/docs/api/zh/objects/Points.html @@ -0,0 +1,78 @@ + + + + + + + + + + + [page:Object3D] → + +

[name]

+ +

+ A class for displaying points. + The points are rendered by the [page:WebGLRenderer] using + [link:https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/drawElements gl.POINTS]. +

+ + +

Constructor

+ +

[name]( [param:Geometry geometry], [param:Material material] )

+

+ [page:Geometry geometry] — (optional) an instance of [page:Geometry] or [page:BufferGeometry]. + Default is a new [page:BufferGeometry].
+ [page:Material material] — (optional) a [page:Material]. Default is a new [page:PointsMaterial] + with a random color. +

+ + +

Properties

+

See the base [page:Object3D] class for common properties.

+ +

[property:Geometry geometry]

+

+ An instance of [page:Geometry] or [page:BufferGeometry] (or derived classes), + defining the object's structure.

+ + Its recommended to always use a [page:BufferGeometry] if possible for best performance. +

+ +

[property:Boolean isPoints]

+

+ Used to check whether this or derived classes are points. Default is *true*.

+ + You should not change this, as it used internally for optimisation. +

+ +

[property:Material material]

+

+ An instance of [page:Material], defining the object's appearance. + Default is a [page:PointsMaterial] with a random color. +

+ + +

Methods

+

See the base [page:Object3D] class for common methods.

+ +

[method:null raycast]( [param:Raycaster raycaster], [param:Array intersects] )

+

+ Get intersections between a casted ray and this Points. + [page:Raycaster.intersectObject] will call this method. +

+ +

[method:Points clone]()

+

+ Returns a clone of this Points object and its descendants. +

+ + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + + diff --git a/docs/api/zh/objects/Skeleton.html b/docs/api/zh/objects/Skeleton.html new file mode 100644 index 00000000000000..c06a0975e30389 --- /dev/null +++ b/docs/api/zh/objects/Skeleton.html @@ -0,0 +1,114 @@ + + + + + + + + + + + +

骨架([name])

+ +

+ 使用一个[page:Bone bones]数组来创建一个可以由[page:SkinnedMesh]使用的骨架。 +

+ +

实例

+ +// Create a simple "arm" + +var bones = []; + +var shoulder = new THREE.Bone(); +var elbow = new THREE.Bone(); +var hand = new THREE.Bone(); + +shoulder.add( elbow ); +elbow.add( hand ); + +bones.push( shoulder ); +bones.push( elbow ); +bones.push( hand ); + +shoulder.position.y = -5; +elbow.position.y = 0; +hand.position.y = 5; + +var armSkeleton = new THREE.Skeleton( bones ); + +

+ 请查看[page:SkinnedMesh]页面,来查看其在标准的[page:BufferGeometry]中使用的示例。 +

+ +

构造器

+ + +

[name]( [param:Array bones], [param:Array boneInverses] )

+

+ [page:Array bones] —— 包含有一组[page:Bone bone]的数组,默认值是一个空数组。
+ [page:Array boneInverses] —— (可选) 包含[page:Matrix4 Matrix4]的数组。

+ + 创建一个新的[name]. +

+ + +

属性

+ +

[property:Array bones]

+

+ 包含有一组[page:Bone bone]的数组。请注意,这是一份原始数组的拷贝,不是引用,所以你可以在不对当前数组造成影响的情况下,修改原始数组。 +

+ +

[property:Array boneInverses]

+

+ 包含有一组[page:Matrix4 Matrix4],表示每个独立骨骼[page:Matrix4 matrixWorld]矩阵的逆矩阵。 +

+ +

[property:Float32Array boneMatrices]

+

+ 当使用顶点纹理时,数组缓冲区保存着骨骼数据。 +

+ +

[property:DataTexture boneTexture]

+

+ 当使用顶点纹理时,[page:DataTexture]保存着骨骼数据。 +

+ + +

方法

+ +

[method:Skeleton clone]()

+

+ 返回一个当前Skeleton对象的克隆。 +

+ + +

[method:null calculateInverses]()

+

如果没有在构造器中提供,生成[page:.boneInverses boneInverses]数组。 +

+ + +

[method:null pose]()

+

返回骨架的基础姿势。

+ + +

[method:null update]()

+

+ 在改变骨骼后,更新[page:Float32Array boneMatrices] 和 [page:DataTexture boneTexture]的值。 + 如果骨架被用于[page:SkinnedMesh],则它将会被[page:WebGLRenderer]自动调用。 +

+ +

[method:Bone getBoneByName]( [param:String name] )

+

+ + name -- 匹配Bone对象中.name属性的字符串。

+ 在骨架中的骨骼数组中遍览,并返回第一个能够和name匹配上的骨骼对象。
+

+ +

源代码

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/objects/SkinnedMesh.html b/docs/api/zh/objects/SkinnedMesh.html new file mode 100644 index 00000000000000..93dacbe281c86e --- /dev/null +++ b/docs/api/zh/objects/SkinnedMesh.html @@ -0,0 +1,155 @@ + + + + + + + + + + + [page:Object3D] → [page:Mesh] → + +

蒙皮网格([name])

+ +

+ 具有[page:Skeleton](骨架)和[page:Bone bones](骨骼)的网格,可用于给几何体上的顶点添加动画。 + 其材质必须支持蒙皮,并且已经启用了蒙皮 —— 请阅读[page:MeshStandardMaterial.skinning]。 +

+ + + + + +

示例

+ + + var geometry = new THREE.CylinderGeometry( 5, 5, 5, 5, 15, 5, 30 ); + + //Create the skin indices and skin weights + for ( var i = 0; i < geometry.vertices.length; i ++ ) { + + // Imaginary functions to calculate the indices and weights + // This part will need to be changed depending your skeleton and model + var skinIndex = calculateSkinIndex( geometry.vertices, i ); + var skinWeight = calculateSkinWeight( geometry.vertices, i ); + + // Ease between each bone + geometry.skinIndices.push( new THREE.Vector4( skinIndex, skinIndex + 1, 0, 0 ) ); + geometry.skinWeights.push( new THREE.Vector4( 1 - skinWeight, skinWeight, 0, 0 ) ); + + } + + var mesh = new THREE.SkinnedMesh( geometry, material ); + + // See example from THREE.Skeleton for the armSkeleton + var rootBone = armSkeleton.bones[ 0 ]; + mesh.add( rootBone ); + + // Bind the skeleton to the mesh + mesh.bind( armSkeleton ); + + // Move the bones and manipulate the model + armSkeleton.bones[ 0 ].rotation.x = -0.1; + armSkeleton.bones[ 1 ].rotation.x = 0.2; + + +

构造器

+

[name]( [param:Geometry geometry], [param:Material material] )

+

+ [page:Geometry geometry] —— 一个[page:Geometry]或者[page:BufferGeometry](推荐)的实例。 + [page:Geometry.skinIndices skinIndices] 和 [page:Geometry.skinWeights skinWeights] 在几何体上应当被设置为true。
+ [page:Material material] —— (可选)一个[page:Material]的实例,默认值是一个新的[page:MeshBasicMaterial]。 +

+ + + + + +

属性

+

请参阅其基类[page:Mesh]来查看共有属性。

+ +

[property:string bindMode]

+

+ “attached”(附加)或者“detached”(分离)。“attached”使用[page:SkinnedMesh.matrixWorld] + 属性作为对骨骼的基本变换矩阵,“detached”则使用[page:SkinnedMesh.bindMatrix]。 + 默认值是“attached”。 +

+ +

[property:Matrix4 bindMatrix]

+

+ 用于绑定的骨骼变换的基础矩阵。 +

+ +

[property:Matrix4 bindMatrixInverse]

+

+ 用于重置绑定的骨骼变换的基础矩阵。 +

+ +

[property:Boolean isSkinnedMesh]

+

+ 用于检查这个类或者其派生类是否为蒙皮网格,默认值为*true*。

+ 你不应当对这个属性进行改变,因为它在使用,以用于优化。 +

+ +

[property:Skeleton skeleton]

+

+ [page:Skeleton]是由从构造函数中传入的[page:Geometry]中的[page:Geometry.bones bones]来创建的。 +

+ + + +

方法

+

请参阅其基类[page:Mesh]来查看共有方法。

+ +

[method:null bind]( [param:Skeleton skeleton], [param:Matrix4 bindMatrix] )

+

+ [page:Skeleton skeleton] —— 由一棵[page:Bone Bones]树创建的[page:Skeleton]。
+ [page:Matrix4 bindMatrix] —— 代表着骨架基本变换的[page:Matrix4](4x4矩阵)。

+ 将骨架绑定到一个蒙皮网格上。bindMatrix会被保存到.bindMatrix属性中,其逆矩阵.bindMatrixInverse也会被计算出来。 + 它在构造函数中会被自动调用,其骨架是由传入到构造函数的[page:Geometry]中的[page:Geometry.bones bones]来创建的。 +

+ +

[method:SkinnedMesh clone]()

+

+ 返回当前SkinnedMesh对象的一个克隆及其任何后代。 +

+ +

[method:null normalizeSkinWeights]()

+

+ 规范化[page:Geometry.skinWeights]矢量。不会对[page:BufferGeometry]产生影响。 +

+ +

[method:null pose]()

+

+ 这个方法设置了在“休息”状态下蒙皮网格的姿势(重置姿势)。 +

+ +

[method:null updateMatrixWorld]( [param:Boolean force] )

+

+ 更新[page:Matrix4 MatrixWorld]矩阵。 +

+ +

[method:null initBones]()

+

+ 从内部几何体中创建一个分层[page:Bone bones]对象的数组。 +

+ +

源代码

+ [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/objects/Sprite.html b/docs/api/zh/objects/Sprite.html new file mode 100644 index 00000000000000..ce1ea9b8f46bb1 --- /dev/null +++ b/docs/api/zh/objects/Sprite.html @@ -0,0 +1,86 @@ + + + + + + + + + + + [page:Object3D] → + +

精灵([name])

+ +

+ 精灵是一个总是面朝着摄像机的平面,通常含有使用一个半透明的纹理。

+ 精灵不会投射任何阴影,即使设置了castShadow = true也将不会有任何效果。 +

+ +

示例

+ + +var spriteMap = new THREE.TextureLoader().load( "sprite.png" ); +var spriteMaterial = new THREE.SpriteMaterial( { map: spriteMap, color: 0xffffff } ); +var sprite = new THREE.Sprite( spriteMaterial ); +scene.add( sprite ); + + + +

构造器

+ +

[name]( [param:Material material] )

+

+ [page:Material material] - (可选值)是[page:SpriteMaterial]的一个实例。 默认值是一个白色的[page:SpriteMaterial]。

+ + 创建一个新的[name]。 +

+ + +

属性

+

请参阅其基类[page:Object3D]来查看共有属性。

+ +

[property:Boolean isSprite]

+

+ 用于检查这个类或者其派生类是否为精灵,默认值为*true*。

+ 你不应当对这个属性进行改变,因为它在使用,以用于优化。 +

+ + +

[property:SpriteMaterial material]

+

+ [page:SpriteMaterial]的一个实例,定义了这个对象的外观。默认值是一个白色的[page:SpriteMaterial]。 +

+ + +

[property:Vector2 center]

+

+ 这个精灵的锚点,也就是精灵旋转时,围绕着旋转的点。当值为(0.5,0.5)时,对应着这个精灵的中心点;当值为(0,0)时,对应着这个精灵左下角的点。
+ 其默认值是(0.5,0.5)。 +

+ +

方法

+

请参阅其基类[page:Object3D]来查看共有方法。

+ +

[method:Sprite clone]()

+

+ 返回当前Sprite对象的一个克隆及其任何后代。 +

+ +

[method:Sprite copy]( [param:Sprite sprite] )

+

+ 将前一个Sprite对象的属性复制给当前的这个对象。 +

+ +

[method:null raycast]( [param:Raycaster raycaster], [param:Array intersects] )

+

+ 在投射的光线和精灵之前产生交互。 + [page:Raycaster.intersectObject]将会调用这个方法。 +

+ + +

源代码

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/renderers/WebGLRenderTarget.html b/docs/api/zh/renderers/WebGLRenderTarget.html new file mode 100644 index 00000000000000..36107b0267c838 --- /dev/null +++ b/docs/api/zh/renderers/WebGLRenderTarget.html @@ -0,0 +1,120 @@ + + + + + + + + + + +

[name]

+ +

+ [link:https://msdn.microsoft.com/en-us/library/ff604997.aspx render target]是一个缓冲,就是在这个缓冲中,视频卡为正在后台渲染的场景绘制像素。 + 它用于不同的效果,例如用于在一个图像显示在屏幕上之前先做一些处理。 + +

+ + +

构造器

+ + +

[name]([param:Number width], [param:Number height], [param:Object options])

+ +

+ [page:Float width] -renderTarget的宽度
+ [page:Float height] - renderTarget的高度
+ options - (可选)一个保存着自动生成的目标纹理的纹理参数以及表示是否使用深度缓存/模板缓存的布尔值的对象 + 以下是一些合法选项:

+ + [page:Constant wrapS] - 默认是[page:Textures ClampToEdgeWrapping].
+ [page:Constant wrapT] - 默认是[page:Textures ClampToEdgeWrapping].
+ [page:Constant magFilter] - 默认是[page:Textures LinearFilter].
+ [page:Constant minFilter] - 默认是[page:Textures LinearFilter].
+ [page:Constant format] - 默认是[page:Textures RGBAFormat].
+ [page:Constant type] - 默认是[page:Textures UnsignedByteType].
+ [page:Number anisotropy] - 默认是*1*. 参见[page:Texture.anistropy]
+ [page:Constant encoding] - 默认是[page:Textures LinearEncoding].
+ [page:Boolean depthBuffer] - 默认是*true*. 如果不需要就设为false
+ [page:Boolean stencilBuffer] - 默认是*true*. 如果不需要就设为false

+ + 创建一个新[name] +

+ +

属性

+ +

[property:number width]

+

+ 渲染目标宽度 +

+ +

[property:number height]

+

+ 渲染目标高度 +

+ +

[property:Vector4 scissor]

+

+ 渲染目标视口内的一个矩形区域,区域之外的片元将会被丢弃 +

+ +

[property:boolean scissorTest]

+

+ 表明是否激活了剪裁测试 +

+ +

[property:Vector4 viewport]

+

+ 渲染目标的视口 +

+ +

[property:Texture texture]

+

+ 纹理实例保存这渲染的像素,用作进一步处理的输入值 +

+ +

[property:boolean depthBuffer]

+

+ 渲染到深度缓冲区。默认true. +

+ +

[property:boolean stencilBuffer]

+

+ 渲染到模板缓冲区。默认true. +

+ +

[property:DepthTexture depthTexture]

+

+ 如果设置,那么场景的深度将会被渲染到慈纹理上。默认是null. +

+ + +

方法

+ +

[method:null setSize]( [param:Number width], [param:Number height] )

+

+ 设置渲染目标的大小 +

+ +

[method:WebGLRenderTarget clone]()

+

+ 创建一个渲染目标副本 +

+ +

[method:WebGLRenderTarget copy]( [param:WebGLRenderTarget source] )

+

+ 采用传入的渲染目标的设置 +

+ +

[method:null dispose]()

+

+ 发出一个处理事件 +

+

[page:EventDispatcher EventDispatcher]方法可从此类中获得

+ +

源码

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/renderers/WebGLRenderTargetCube.html b/docs/api/zh/renderers/WebGLRenderTargetCube.html new file mode 100644 index 00000000000000..4426ed2c579936 --- /dev/null +++ b/docs/api/zh/renderers/WebGLRenderTargetCube.html @@ -0,0 +1,67 @@ + + + + + + + + + + + [page:WebGLRenderTarget] → + +

[name]

+ +

+ 被[page:CubeCamera]作为它的[page:WebGLRenderTarget]使用 +

+ +

例子

+ +

有关示例请参阅[page:CubeCamera]

+ + +

构造器

+ + +

[name]([param:Number width], [param:Number height], [param:Object options])

+

+ [page:Float width] - renderTarget的宽度
+ [page:Float height] - renderTarget的高度
+ options - (可选)一个保存着自动生成的目标纹理的纹理参数以及表示是否使用深度缓存/模板缓存的布尔值的对象。 + 有关纹理参数的说明,请参阅[page:Texture Texture]. 以下是合理选项:

+ + [page:Constant wrapS] - 默认是[page:Textures ClampToEdgeWrapping].
+ [page:Constant wrapT] - 默认是[page:Textures ClampToEdgeWrapping].
+ [page:Constant magFilter] - 默认是[page:Textures .LinearFilter].
+ [page:Constant minFilter] - 默认是[page:Textures LinearFilter].
+ [page:Constant format] - 默认是[page:Textures RGBAFormat].
+ [page:Constant type] - 默认是[page:Textures UnsignedByteType].
+ [page:Number anisotropy] - 默认是 *1*. 参见[page:Texture.anistropy]
+ [page:Constant encoding] - 默认是[page:Textures LinearEncoding].
+ [page:Boolean depthBuffer] - 默认是*true*.如果不需要就设为false
+ [page:Boolean stencilBuffer] - 默认是*true*.如果不需要就设为false

+ + 创建一个新[name] +

+ +

属性

+ +

[property:integer activeCubeFace]

+

+ activeCubeFace属性对应立方体的面(PX 0, NX 1, PY 2, NY 3, PZ 4, NZ 5) 并由[page:CubeCamera]内部使用和设置 +

+ +

继承属性,请参阅[page:WebGLRenderTarget]

+ + +

方法

+ +

继承方法,请参阅[page:WebGLRenderTarget]

+ + +

源码

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/renderers/WebGLRenderer.html b/docs/api/zh/renderers/WebGLRenderer.html new file mode 100644 index 00000000000000..2c9c58ca36066d --- /dev/null +++ b/docs/api/zh/renderers/WebGLRenderer.html @@ -0,0 +1,437 @@ + + + + + + + + + + +

[name]

+ +

+ WebGL Render 用[link:https://en.wikipedia.org/wiki/WebGL WebGL]渲染出你精心制作的场景。 +

+ +

构造器

+ +

[name]( [param:Object parameters] )

+

+ [page:Object parameters] - (可选) 该对象的属性定义了渲染器的行为。也可以完全不传参数。在所有情况下,当缺少参数时,它将采用合理的默认值。 + 以下是合法参数:

+ + [page:DOMElement canvas] - 一个供渲染器绘制其输出的[link:https://developer.mozilla.org/en-US/docs/Web/HTML/Element/canvas canvas] + 它和下面的[page:WebGLRenderer.domElement domElement]属性对应。 + 如果没有传这个参数,会创建一个新canvas
+ + + [page:WebGLRenderingContext context] - 可用于将渲染器附加到已有的渲染环境([link:https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext RenderingContext])中。默认值是null
+ + [page:String precision] - 着色器精度. 可以是 *"highp"*, *"mediump"* 或者 *"lowp"*. + 如果设备支持,默认为*"highp"* . 点击[link:https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/WebGL_best_practices here] 查看"应该避免的事"
+ + [page:Boolean alpha] - canvas是否包含alpha (透明度)。默认为 *false*
+ + [page:Boolean premultipliedAlpha] - renderer是否假设颜色有 + [link:https://en.wikipedia.org/wiki/Glossary_of_computer_graphics#Premultiplied_alpha premultiplied alpha]. + 默认为*true*
+ + [page:Boolean antialias] - 是否执行抗锯齿。默认为*false*.
+ + [page:Boolean stencil] - 绘图缓存是否有一个至少8位的模板缓存([link:https://en.wikipedia.org/wiki/Stencil_buffer stencil buffer])。默认为*true*
+ + [page:Boolean preserveDrawingBuffer] -是否保留缓直到手动清除或被覆盖。 默认*false*.
+ + [page:String powerPreference] - 提示用户代理怎样的配置更适用于当前WebGL环境。 可能是*"high-performance"*, *"low-power"* 或 *"default"*。默认是*"default"*. + 详见[link:https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.2 WebGL spec]
+ + [page:Boolean depth] - 绘图缓存是否有一个至少6位的深度缓存([link:https://en.wikipedia.org/wiki/Z-buffering depth buffer] )。 + 默认是*true*.
+ + [page:Boolean logarithmicDepthBuffer] - 是否使用对数深度缓存。如果要在单个场景中处理巨大的比例差异,就有必要使用。 + 默认是*false*。 示例:[example:webgl_camera_logarithmicdepthbuffer camera / logarithmicdepthbuffer] +

+ +

属性

+ +

[property:Boolean autoClear]

+

定义渲染器是否在渲染每一帧之前自动清除其输出。

+ + +

[property:Boolean autoClearColor]

+

+ 如果[page:.autoClear autoClear]为true, 定义renderer是否清除颜色缓存。 + 默认是*true* +

+ + +

[property:Boolean autoClearDepth]

+

+ 如果[page:.autoClear autoClear]是true, 定义renderer是否清除深度缓存。 + 默认是*true* +

+ + +

[property:Boolean autoClearStencil]

+

+ 如果[page:.autoClear autoClear]是true, 定义renderer是否清除模板缓存. + 默认是*true* +

+ +

[property:Object capabilities]

+

+ 一个包含当前渲染环境([link:https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext RenderingContext])的功能细节的对象。
+ + - [page:Boolean floatFragmentTextures]: 环境是否支持[link:https://developer.mozilla.org/en-US/docs/Web/API/OES_texture_float OES_texture_float]扩展。 + 根据[link:https://webglstats.com/ WebGLStats], 截至2016年2月,超过95%的支持WebGL的设备支持此功能
+ - [page:Boolean floatVertexTextures]: 如果[page:Boolean floatFragmentTextures]和[page:Boolean vertexTextures]都是true, 则此值为*true*
+ - [page:Method getMaxAnisotropy](): 返回最大可用各向异性。
+ - [page:Method getMaxPrecision](): 返回顶点着色器和片元着色器的最大可用精度。
+ - [page:Boolean logarithmicDepthBuffer]: 如果[page:parameter logarithmicDepthBuffer]在构造器中被设为true且 + 环境支持[link:https://developer.mozilla.org/en-US/docs/Web/API/EXT_frag_depth EXT_frag_depth]扩展,则此值为*true* + 根据[link:https://webglstats.com/ WebGLStats], 截至2016年2月, 约66%的支持WebGL的设备支持此功能
+ - [page:Integer maxAttributes]: *gl.MAX_VERTEX_ATTRIBS*的值
+ - [page:Integer maxCubemapSize]: *gl.MAX_CUBE_MAP_TEXTURE_SIZE* 的值,着色器可使用的立方体贴图纹理的最大宽度*高度
+ - [page:Integer maxFragmentUniforms]: *gl.MAX_FRAGMENT_UNIFORM_VECTORS*的值,片元着色器可使用的全局变量(uniforms)数量
+ - [page:Integer maxTextureSize]: *gl.MAX_TEXTURE_SIZE*的值,着色器可使用纹理的最大宽度*高度
+ - [page:Integer maxTextures]: *gl.MAX_TEXTURE_IMAGE_UNITS的值,着色器可使用的纹理数量
+ - [page:Integer maxVaryings]: *gl.MAX_VARYING_VECTORS*的值,着色器可使用矢量的数量
+ - [page:Integer maxVertexTextures]: *gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS*的值,顶点着色器可使用的纹理数量。
+ - [page:Integer maxVertexUniforms]: *gl.MAX_VERTEX_UNIFORM_VECTORS*的值,顶点着色器可使用的全局变量(uniforms)数量
+ - [page:String precision]: 渲染器当前使用的着色器的精度
+ - [page:Boolean vertexTextures]: 如果[property:Integer maxVertexTextures]大于0,此值为*true* (即可以使用顶点纹理)
+

+ +

[property:Array clippingPlanes]

+

+ 用户自定义的剪裁平面,在世界空间中被指定为THREE.Plane对象。 + 这些平面全局使用。空间中与该平面点积为负的点将被切掉。 + 默认值是[] +

+ +

[property:WebGLRenderingContext context]

+

+ 渲染器默认使用[link:https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext HTMLCanvasElement.getContext]()从其 + [page:WebGLRenderer.domElement domElement]获取渲染环境([link:https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext RenderingContext])

+ + 你可以手动创建创建它,但它必须与[page:WebGLRenderer.domElement domElement]对应,才能呈现到屏幕上。 + +

+ +

[property:DOMElement domElement]

+

+ 一个[link:https://developer.mozilla.org/en-US/docs/Web/HTML/Element/canvas canvas],渲染器在其上绘制输出。
+ 渲染器的构造函数会自动创建(如果没有传入canvas参数);你需要做的仅仅是像下面这样将它加页面里去
+ + document.body.appendChild( renderer.domElement ); + +

+ +

[property:Object extensions]

+

+ [page:WebGLRenderer.extensions.get .extensions.get]方法的包装, 用于检查是否支持各种WebGL扩展 +

+ +

[property:Float gammaFactor]

+

默认是 *2*.

+ + +

[property:Boolean gammaInput]

+

如果设置,那么所有的纹理和颜色都会预乘gamma。 默认值是*false*.

+ + +

[property:Boolean gammaOutput]

+

如果设置, 那么它期望所有纹理和颜色需要乘以gamma输出。 默认值*false*.

+ +

[property:Object info]

+

一个对象,包含有关图形板内存和渲染过程的一系列统计信息。这些信息可用于调试或仅仅满足下好奇心。改对象包含以下字段:

+

+

    +
  • memory: +
      +
    • geometries
    • +
    • textures
    • +
    +
  • +
  • render: +
      +
    • calls
    • +
    • triangles
    • +
    • points
    • +
    • lines
    • +
    +
  • +
  • programs +
  • +
+

+

默认情况下,每次调用渲染时这些数据都会重置。 但当时用一个或多个镜像时,最好使用自定义模式重置它们: + + renderer.info.autoReset = false; + renderer.info.reset(); + +

+ +

[property:Boolean localClippingEnabled]

+

定义渲染器是否考虑对象级剪切平面。 默认为*false*.

+ +

[property:Integer maxMorphTargets]

+

+ 默认是8。 一个着色器中允许的最大MorphTargets数。 + 切记标准材质只允许8个MorphTargets。 +

+ +

[property:Integer maxMorphNormals]

+

+ 默认是4。 色器中允许的最大MorphNormal数。 + 切记标准材质只允许4个MorphNormal。 +

+ +

[property:Boolean physicallyCorrectLights]

+

+ 是否使用物理上正确的光照模式。 默认是*false*。 + 示例:[example:webgl_lights_physical lights / physical] +

+ +

[property:Object properties]

+

+ 渲染器内部使用,以跟踪各种子对象属性。 +

+ +

[property:WebGLRenderLists renderLists]

+

+ 在内部用于处理场景渲染对象的排序。 +

+ +

[property:WebGLShadowMap shadowMap]

+

+ 如果使用,它包含阴影贴图的引用。 +

+ +

[property:Boolean shadowMap.enabled]

+

如果设置, 请在场景中使用阴影贴图。 默认是 *false*

+ +

[property:Boolean shadowMap.autoUpdate]

+

启用场景中的阴影自动更新。默认是*true*

+

如果不需要动态光照/阴影, 则可以在实例化渲染器时将之设为false

+ +

[property:Boolean shadowMap.needsUpdate]

+

当被设为*true*, 场景中的阴影贴图会在下次*render*调用时刷新。默认是*false*

+

如果你已经禁用了阴影贴图的自动更新(*shadowMap.autoUpdate = false*), 那么想要在下一次渲染时更新阴影的话就需要将此值设为*true*

+ +

[property:Integer shadowMap.type]

+

定义阴影贴图类型 (未过滤, 关闭部分过滤, 关闭部分双线性过滤)

+

可选值有THREE.BasicShadowMap, THREE.PCFShadowMap (默认), THREE.PCFSoftShadowMap。 详见[page:Renderer Renderer constants]

+ +

[property:Boolean sortObjects]

+

+ 定义渲染器是否应对对象进行排序。默认是*true*.

+ + 说明: 排序用于尝试正确渲染出具有一定透明度的对象。根据定义,排序可能不总是有用。根据应用的需求,可能需要关闭排序并使其他方法来处理透明度的渲染,例如, + 手动确定每个对象的显然顺序。 +

+ +

[property:Object state]

+

+ 包含设置[page:WebGLRenderer.context]状态的各种属性的函数。 +

+ +

[property:Constant toneMapping]

+

+ 默认是[page:Renderer LinearToneMapping]。查看[page:Renderer Renderer constants]以获取其它备选项 +

+ +

[property:Number toneMappingExposure]

+

+ 色调映射的曝光级别。默认是*1* +

+ +

[property:Number toneMappingWhitePoint]

+

+ 色调映射的白点。默认是*1* +

+ +

方法

+ +

[method:Integer allocTextureUnit]

+

+ 尝试分配纹理单元以供着色器使用。如果尝试分配超过GPU支持量的纹理单元,则会报警告。主要供内部使用。 + 请参阅[page:WebGLRenderer.capabilities capabilities.maxTextures]。 +

+ +

[method:null clear]( [param:Boolean color], [param:Boolean depth], [param:Boolean stencil] )

+

+ 告诉渲染器清除颜色、深度或模板缓存. + 此方法将颜色缓存初始化为当前颜色。参数们默认都是*true* +

+ +

[method:null clearColor]( )

+

清除颜色缓存。 相当于调用[page:WebGLRenderer.clear .clear]( true, false, false )

+ +

[method:null clearDepth]( )

+

清除深度缓存。相当于调用[page:WebGLRenderer.clear .clear]( false, true, false )

+ +

[method:null clearStencil]( )

+

清除模板缓存。相当于调用[page:WebGLRenderer.clear .clear]( false, false, true )

+ +

[method:null clearTarget]([param:WebGLRenderTarget renderTarget], [param:boolean color], [param:boolean depth], [param:boolean stencil])

+

+ renderTarget -- 需要被清除的[page:WebGLRenderTarget renderTarget]
+ color -- 如果设置, 颜色会被清除
+ depth -- 如果设置, 深度缓存会被清除
+ stencil -- 如果设置, 模板缓存会被清除 +

+

+ 该方法清楚了一个rendertarget。为此它会激活此endertarget +

+ +

[method:null compile]( [param:Scene scene], [param:Camera camera] )

+

使用相机编译场景中的所有材质。这对于在首次渲染之前预编译着色器很有用。

+ +

[method:null copyFramebufferToTexture]( [param:Vector2 position], [param:Texture texture], [param:Number level] )

+

将当前WebGLFramebuffer中的像素复制到2D纹理中。可访问[link:https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/copyTexImage2D WebGLRenderingContext.copyTexImage2D].

+ +

[method:null copyTextureToTexture]( [param:Vector2 position], [param:Texture srcTexture], [param:Texture dstTexture], [param:Number level] )

+

将纹理的所有像素复制到一个已有的从给定位置开始的纹理中。可访问[link:https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/texSubImage2D WebGLRenderingContext.texSubImage2D].

+ +

[method:null dispose]( )

+

处理当前的渲染环境

+ +

[method:Object extensions.get]( [param:String extensionName] )

+

+ 用于检查是否支持各种扩展,并返回一个对象,其中包含扩展的详细信息。 + 该方法检查以下扩展:

+ + - *WEBGL_depth_texture*
+ - *EXT_texture_filter_anisotropic*
+ - *WEBGL_compressed_texture_s3tc*
+ - *WEBGL_compressed_texture_pvrtc*
+ - *WEBGL_compressed_texture_etc1* +

+ +

[method:null forceContextLoss]( )

+

+ 模拟WebGL环境的丢失。需要支持 + [link:https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_lose_context WEBGL_lose_context]扩展才能用。 + 根据[link:https://webglstats.com/ WebGLStats], as of February 2016 90% of WebGL enabled devices support this. +

+ +

[method:Float getClearAlpha]()

+

返回一个表示当前alpha值的[page:Float float],范围0到1

+ +

[method:Color getClearColor]()

+

返回一个表示当前颜色值的[page:Color THREE.Color]实例

+ +

[method:WebGLRenderingContext getContext]()

+

返回当前WebGL环境

+ +

[method:WebGLContextAttributes getContextAttributes]()

+

返回一个对象,这个对象中存有在WebGL环境在创建的时候所设置的属性

+ +

[method:RenderTarget getRenderTarget]()

+

如果当前存在RenderTarget,返回当前它

+ +

[method:RenderTarget getCurrentViewport]()

+

返回当前视口

+ +

[method:Object getDrawingBufferSize]()

+

返回一个包含渲染器绘图缓存宽度和高度(单位像素)的对象。

+ +

[method:number getPixelRatio]()

+

返回当前使用设备像素比

+ +

[method:Object getSize]()

+

返回包含渲染器输出canvas的宽度和高度(单位像素)的对象。

+ +

[method:null resetGLState]( )

+

将GL状态重置为默认值。WebGL环境丢失时会内部调用

+ +

[method:null readRenderTargetPixels]( [param:WebGLRenderTarget renderTarget], [param:Float x], [param:Float y], [param:Float width], [param:Float height], buffer )

+

将enderTarget中的像素数据读取到传入的缓冲区中。这是link:https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/readPixels WebGLRenderingContext.readPixels]()的包装器
+ 示例:[example:webgl_interactive_cubes_gpu interactive / cubes / gpu] +

+ +

[method:null render]( [param:Scene scene], [param:Camera camera], [param:WebGLRenderTarget renderTarget], [param:Boolean forceClear] )

+

+ 用相机([page:Camera camera])渲染一个场景([page:Scene scene])
+ + 渲染一般是在canvas上完成的,或者是[page:WebGLRenderTarget renderTarget](如果有指定)
+ + 如果[page:Boolean forceClear]值是*true*,那么颜色、深度及模板缓存将会在渲染之前清除,即使渲染器的[page:WebGLRenderer.autoClear autoClear]属性值是false
+ + 即便forceClear设为true, 也可以通过将[page:WebGLRenderer.autoClearColor autoClearColor]、[page:WebGLRenderer.autoClearStencil autoClearStencil]或[page:WebGLRenderer.autoClearDepth autoClearDepth]属性的值设为false来阻止对应缓存被清除。 +

+ +

[method:null renderBufferDirect]( [param:Camera camera], [param:Fog fog], [param:Geometry geometry], [param:Material material], [param:Object3D object], [param:Object group] )

+

使用相机和指定材质渲染缓冲几何组。

+ +

[method:null renderBufferImmediate]( [param:Object3D object], [param:shaderprogram program], [param:Material shading] )

+

object - 一个[page:Object3D]实例
+ program - 一个shaderProgram实例
+ shading - 一个Material实例

+ + 渲染即使缓冲,由enderImmediateObject对象调用 +

+ +

[method:null setAnimationLoop]( [param:Function callback] )

+

[page:Function callback] — 每个可用帧都会调用的函数。 如果传入‘null’,所有正在进行的动画都会停止。

+

可用来代替[link:https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame requestAnimationFrame]的内置函数. 对于WebVR想谬,必须使用此功能

+ +

[method:null setClearAlpha]( [param:Float alpha] )

+

设置alpha。合法参数是一个*0.0*到 *1.0*之间的浮点数

+ +

[method:null setClearColor]( [param:Color color], [param:Float alpha] )

+

设置颜色及其透明度

+ +

[method:null setPixelRatio]( [param:number value] )

+

设置设备像素比。通常用于避免HiDPI设备上绘图模糊

+ +

[method:null setRenderTarget]( [param:WebGLRenderTarget renderTarget] )

+

+ renderTarget -- 需要被激活的[page:WebGLRenderTarget renderTarget](可选).

+ 该方法设置活跃rendertarget. 参数缺省则将canvas设置成活跃rendertarget +

+ +

[method:null setScissor]( [param:Integer x], [param:Integer y], [param:Integer width], [param:Integer height] )

+

+ 将剪裁区域设为(x, y)到(x + width, y + height) + Sets the scissor area from +

+ +

[method:null setScissorTest]( [param:Boolean boolean] )

+

+ 启用或禁用剪裁检测. 若启用,则只有在所定义的裁剪区域内的像素才会受之后的渲染器影响。 +

+ +

[method:null setSize]( [param:Integer width], [param:Integer height], [param:Boolean updateStyle] )

+

+ 将输出canvas的大小调整为(width, height)并考虑设备像素比,且将视口从(0, 0)开始调整到适合大小 + 将[page:Boolean updateStyle]设置为false以阻止对canvas的样式做任何改变。 +

+ +

[method:null setTexture2D]( [param:Texture texture], [param:number slot] )

+

+ texture -- 需被设置的[page:Texture texture]
+ slot -- 纹理应该使用的插槽号

+ 该方法为WebGL着色器将正确的纹理设置到正确的插槽中。插槽号可作为取样器的全局变量(uniform)

+ + 说明: 该方法取代了旧的[method:null setTexture]方法 +

+ +

[method:null setTextureCube]( [param:CubeTexture cubeTexture], [param:Number slot] )

+

+ texture -- 需要被设置的[page:CubeTexture cubeTexture]
+ slot -- 纹理应该使用的插槽号

+ + 该方法为WebGL着色器将正确的纹理设置到正确的插槽中。插槽号可作为取样器的全局变量(uniform) +

+ +

[method:null setViewport]( [param:Integer x], [param:Integer y], [param:Integer width], [param:Integer height] )

+

将视口大小设置为(x, y)到 (x + width, y + height).

+ +

源码

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/renderers/shaders/ShaderChunk.html b/docs/api/zh/renderers/shaders/ShaderChunk.html new file mode 100644 index 00000000000000..a9c917b94ba3c3 --- /dev/null +++ b/docs/api/zh/renderers/shaders/ShaderChunk.html @@ -0,0 +1,29 @@ + + + + + + + + + + +

[name]

+ +

Shader chunks for WebGL Shader library

+ + + +

Properties

+ + + +

Methods

+ + + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/renderers/shaders/ShaderLib.html b/docs/api/zh/renderers/shaders/ShaderLib.html new file mode 100644 index 00000000000000..d363e2e5da52a8 --- /dev/null +++ b/docs/api/zh/renderers/shaders/ShaderLib.html @@ -0,0 +1,28 @@ + + + + + + + + + + +

[name]

+ +

Webgl Shader Library for three.js

+ + +

Properties

+ + + +

Methods

+ + + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/renderers/shaders/UniformsLib.html b/docs/api/zh/renderers/shaders/UniformsLib.html new file mode 100644 index 00000000000000..f8228941c52b56 --- /dev/null +++ b/docs/api/zh/renderers/shaders/UniformsLib.html @@ -0,0 +1,29 @@ + + + + + + + + + + +

[name]

+ +

Uniforms library for shared webgl shaders

+ + + +

Properties

+ + + +

Methods

+ + + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/renderers/shaders/UniformsUtils.html b/docs/api/zh/renderers/shaders/UniformsUtils.html new file mode 100644 index 00000000000000..bf978cbbb89229 --- /dev/null +++ b/docs/api/zh/renderers/shaders/UniformsUtils.html @@ -0,0 +1,27 @@ + + + + + + + + + + +

[name]

+ +

Uniform Utilities. Support merging and cloning of uniform variables

+ +

Properties

+ + + +

Methods

+ + + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/renderers/webgl/WebGLProgram.html b/docs/api/zh/renderers/webgl/WebGLProgram.html new file mode 100644 index 00000000000000..14abf7cec03bde --- /dev/null +++ b/docs/api/zh/renderers/webgl/WebGLProgram.html @@ -0,0 +1,147 @@ + + + + + + + + + + +

[name]

+ +

Constructor for the GLSL program sent to vertex and fragment shaders, including default uniforms and attributes.

+ +

Built-in uniforms and attributes

+ +

Vertex shader (unconditional):

+
+ + // = object.matrixWorld + uniform mat4 modelMatrix; + + // = camera.matrixWorldInverse * object.matrixWorld + uniform mat4 modelViewMatrix; + + // = camera.projectionMatrix + uniform mat4 projectionMatrix; + + // = camera.matrixWorldInverse + uniform mat4 viewMatrix; + + // = inverse transpose of modelViewMatrix + uniform mat3 normalMatrix; + + // = camera position in world space + uniform vec3 cameraPosition; + + + // default vertex attributes provided by Geometry and BufferGeometry + attribute vec3 position; + attribute vec3 normal; + attribute vec2 uv; + +

+ Note that you can therefore calculate the position of a vertex in the vertex shader by: + + gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); + + or alternatively + + gl_Position = projectionMatrix * viewMatrix * modelMatrix * vec4( position, 1.0 ); + +

+
+ +

Vertex shader (conditional):

+
+ + #ifdef USE_COLOR + // vertex color attribute + attribute vec3 color; + #endif + + + #ifdef USE_MORPHTARGETS + + attribute vec3 morphTarget0; + attribute vec3 morphTarget1; + attribute vec3 morphTarget2; + attribute vec3 morphTarget3; + + #ifdef USE_MORPHNORMALS + + attribute vec3 morphNormal0; + attribute vec3 morphNormal1; + attribute vec3 morphNormal2; + attribute vec3 morphNormal3; + + #else + + attribute vec3 morphTarget4; + attribute vec3 morphTarget5; + attribute vec3 morphTarget6; + attribute vec3 morphTarget7; + + #endif + #endif + + + #ifdef USE_SKINNING + attribute vec4 skinIndex; + attribute vec4 skinWeight; + #endif + +
+ +

Fragment shader:

+
+ + uniform mat4 viewMatrix; + uniform vec3 cameraPosition; + +
+ + +

Constructor

+ +

[name]( [param:WebGLRenderer renderer], [param:Object code], [param:Material material], [param:Object parameters] )

+

For parameters see [page:WebGLRenderer WebGLRenderer]

+ +

Properties

+ +

[property:String id]

+

+ +

[property:String code]

+

+ +

[property:Integer usedTimes]

+

+ +

[property:Object program]

+

+ +

[property:WebGLShader vertexShader]

+

+ +

[property:WebGLShader fragmentShader]

+

+ +

Methods

+ +

[method:Object getUniforms]()

+

+ Returns a name-value mapping of all active uniform locations. +

+ +

[method:Object getAttributes]()

+

+ Returns a name-value mapping of all active vertex attribute locations. +

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/renderers/webgl/WebGLShader.html b/docs/api/zh/renderers/webgl/WebGLShader.html new file mode 100644 index 00000000000000..92f4079e5745f8 --- /dev/null +++ b/docs/api/zh/renderers/webgl/WebGLShader.html @@ -0,0 +1,49 @@ + + + + + + + + + + +

[name]

+ +

A lower level function to compile either a vertex or fragment shader.

+ +

Example

+ + + var gl = renderer.context; + + var glVertexShader = new THREE.WebGLShader( gl, gl.VERTEX_SHADER, vertexSourceCode ); + var glFragmentShader = new THREE.WebGLShader( gl, gl.FRAGMENT_SHADER, fragmentSourceCode ); + + var program = gl.createProgram(); + + gl.attachShader( program, glVertexShader ); + gl.attachShader( program, glFragmentShader ); + + gl.linkProgram( program ); + + +

Function

+ +

[page:WebGLShader objects]([page:WebGLContext gl], [page:WebGLEnum type], [page:String source])

+ +

+ gl -- The current WebGL context + type -- The WebGL type, either gl.VERTEX_SHADER or gl.FRAGMENT_SHADER + source -- The source code for the shader +

+

+ This will compile an individual shader, but won't link it to be a complete [page:WebGLProgram]. Note: this + is a function so the new operator should not be used. +

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/renderers/webgl/WebGLState.html b/docs/api/zh/renderers/webgl/WebGLState.html new file mode 100644 index 00000000000000..2d8a34ada4093e --- /dev/null +++ b/docs/api/zh/renderers/webgl/WebGLState.html @@ -0,0 +1,60 @@ + + + + + + + + + + +

[name]

+ +

+ + +

Methods

+ +

[method:null enable]( [param:integer id], [param:boolean boolean] )

+

+ TODO +

+ +

[method:null disable]( [param:integer id], [param:boolean boolean] )

+

+ TODO +

+ +

[method:null setDepthTest]( [param:boolean depthTest] )

+

+ depthTest -- The boolean to decide if depth of a fragment needs to be tested against the depth buffer .
+

+

+ This sets, based on depthTest, whether or not the depth data needs to be tested against the depth buffer. +

+ +

[method:null setDepthWrite]( [param:boolean depthWrite] )

+

+ depthWrite -- The boolean to decide if depth of a fragment needs to be kept.
+

+

+ This sets, based on depthWrite, whether or not the depth data needs to be written in the depth buffer. +

+ +

[method:null setBlending]( [param:number blending], [param:number blendEquation], [param:number blendSrc], [param:number blendDst] )

+

+ blending -- A number indicating the blending mode. Possible value are THREE.NoBlending, THREE.NormalBlending, THREE.AdditiveBlending, THREE.SubtractiveBlending, THREE.MultiplyBlending or THREE.CustomBlending
+ blendEquation -- When blending is THREE.CustomBlending, then you can set the blendEquation. Possible values are THREE.AddEquation, THREE.SubtractEquation or THREE.ReverseSubtractEquation.
+ blendSrc -- When blending is THREE.CustomBlending, then you can set the blendSrc. Possible values are THREE.ZeroFactor, THREE.OneFactor,THREE.SrcColorFactor, THREE.OneMinusSrcColorFactor, THREE.SrcAlphaFactor, THREE.OneMinusSrcAlphaFactor, THREE.DstAlphaFactor, THREE.OneMinusDstAlphaFactor, THREE.DstColorFactor,THREE.OneMinusDstColorFactor or THREE.SrcAlphaSaturateFactor
+ blendDst -- When blending is THREE.CustomBlending, then you can set the blendDst. Possible values are THREE.ZeroFactor, THREE.OneFactor,THREE.SrcColorFactor, THREE.OneMinusSrcColorFactor, THREE.SrcAlphaFactor, THREE.OneMinusSrcAlphaFactor, THREE.DstAlphaFactor, THREE.OneMinusDstAlphaFactor, THREE.DstColorFactor,THREE.OneMinusDstColorFactor or THREE.SrcAlphaSaturateFactor +

+

+ This method sets the correct blending. +

+ + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/scenes/Fog.html b/docs/api/zh/scenes/Fog.html new file mode 100644 index 00000000000000..ae713493bd1673 --- /dev/null +++ b/docs/api/zh/scenes/Fog.html @@ -0,0 +1,50 @@ + + + + + + + + + + +

[name]

+ +

This class contains the parameters that define linear fog, i.e., that grows linearly denser with the distance.

+ + +

Constructor

+ + +

[name]( [param:Integer color], [param:Float near], [param:Float far] )

+

The color parameter is passed to the [page:Color] constructor to set the color property. Color can be a hexadecimal integer or a CSS-style string.

+ +

Properties

+ +

[property:String name]

+

Optional name of the object (doesn't need to be unique). Default is an empty string.

+ +

[property:Color color]

+

Fog color. Example: If set to black, far away objects will be rendered black.

+ +

[property:Float near]

+

The minimum distance to start applying fog. Objects that are less than 'near' units from the active camera won't be affected by fog.

+

Default is 1.

+ +

[property:Float far]

+

The maximum distance at which fog stops being calculated and applied. Objects that are more than 'far' units away from the active camera won't be affected by fog.

+

Default is 1000.

+ +

Methods

+ +

[method:Fog clone]()

+

Returns a new fog instance with the same parameters as this one.

+ +

[method:Fog toJSON]()

+

Return fog data in JSON format.

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/scenes/FogExp2.html b/docs/api/zh/scenes/FogExp2.html new file mode 100644 index 00000000000000..2fdbf28b6ec233 --- /dev/null +++ b/docs/api/zh/scenes/FogExp2.html @@ -0,0 +1,46 @@ + + + + + + + + + + +

[name]

+ +

This class contains the parameters that define exponential fog, i.e., that grows exponentially denser with the distance.

+ + +

Constructor

+ + +

[name]( [param:Integer color], [param:Float density] )

+ +

The color parameter is passed to the [page:Color] constructor to set the color property. Color can be a hexadecimal integer or a CSS-style string.

+

Properties

+ +

[property:String name]

+

Optional name of the object (doesn't need to be unique). Default is an empty string.

+ +

[property:Color color]

+

Fog color. Example: If set to black, far away objects will be rendered black.

+ +

[property:Float density]

+

Defines how fast the fog will grow dense.

+

Default is 0.00025.

+ +

Methods

+ +

[method:FogExp2 clone]()

+

Returns a new FogExp2 instance with the same parameters as this one.

+ +

[method:FogExp2 toJSON]()

+

Return FogExp2 data in JSON format.

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/scenes/Scene.html b/docs/api/zh/scenes/Scene.html new file mode 100644 index 00000000000000..d6a1dd0e1b3811 --- /dev/null +++ b/docs/api/zh/scenes/Scene.html @@ -0,0 +1,58 @@ + + + + + + + + + + + [page:Object3D] → +

[name]

+ +

Scenes allow you to set up what and where is to be rendered by three.js. This is where you place objects, lights and cameras.

+ + +

Constructor

+ + +

[name]()

+

+ Create a new scene object. +

+ + +

Properties

+ +

[property:Fog fog]

+ +

A [page:Fog fog] instance defining the type of fog that affects everything rendered in the scene. Default is null.

+ +

[property:Material overrideMaterial]

+ +

If not null, it will force everything in the scene to be rendered with that material. Default is null.

+ +

[property:boolean autoUpdate]

+

+ Default is true. If set, then the renderer checks every frame if the scene and its objects needs matrix updates. + When it isn't, then you have to maintain all matrices in the scene yourself. +

+ +

[property:Object background]

+

+ If not null, sets the background used when rendering the scene, and is always rendered first. Can be set to a [page:Color] which sets the clear color, a [page:Texture] covering the canvas, or a [page:CubeTexture]. Default is null. +

+ +

Methods

+ +

[method:JSON toJSON]

+

+ Return the scene data in JSON format. +

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/textures/CanvasTexture.html b/docs/api/zh/textures/CanvasTexture.html new file mode 100644 index 00000000000000..fd235247df896d --- /dev/null +++ b/docs/api/zh/textures/CanvasTexture.html @@ -0,0 +1,77 @@ + + + + + + + + + + + [page:Texture] → + +

[name]

+ +

+ Creates a texture from a canvas element.

+ + This is almost the same as the base [page:Texture Texture] class, except that it sets [page:Texture.needsUpdate needsUpdate] to *true* immediately. +

+ + +

Constructor

+

[name]( [param:HTMLElement canvas], [param:Constant mapping], [param:Constant wrapS], [param:Constant wrapT], [param:Constant magFilter], [param:Constant minFilter], [param:Constant format], [param:Constant type], [param:Number anisotropy] )

+

+ [page:HTMLElement canvas] -- The HTML canvas element from which to load the texture.
+ + [page:Constant mapping] -- How the image is applied to the object. An object type of [page:Textures THREE.UVMapping]. + See [page:Textures mapping constants] for other choices.
+ + [page:Constant wrapS] -- The default is [page:Textures THREE.ClampToEdgeWrapping]. + See [page:Textures wrap mode constants] for other choices.
+ + [page:Constant wrapT] -- The default is [page:Textures THREE.ClampToEdgeWrapping]. + See [page:Textures wrap mode constants] for other choices.
+ + [page:Constant magFilter] -- How the texture is sampled when a texel covers more than one pixel. + The default is [page:Textures THREE.LinearFilter]. See [page:Textures magnification filter constants] for other choices.
+ + [page:Constant minFilter] -- How the texture is sampled when a texel covers less than one pixel. + The default is [page:Textures THREE.LinearMipMapLinearFilter]. See [page:Textures minification filter constants] for other choices.
+ + [page:Constant format] -- The format used in the texture. + See [page:Textures format constants] for other choices.
+ + [page:Constant type] -- Default is [page:Textures THREE.UnsignedByteType]. + See [page:Textures type constants] for other choices.
+ + [page:Number anisotropy] -- The number of samples taken along the axis through the pixel that has the highest density of texels. + By default, this value is 1. A higher value gives a less blurry result than a basic mipmap, at the cost of more texture samples being used. + Use [page:WebGLrenderer.getMaxAnisotropy renderer.getMaxAnisotropy]() to find the maximum valid anisotropy value for the GPU; this value is usually a power of 2.

+

+ + +

Properties

+ +

+ See the base [page:Texture Texture] class for common properties. +

+ +

[property:boolean needsUpdate]

+ +

+ True by default. This is required so that the canvas data is loaded. +

+ +

Methods

+ +

+ See the base [page:Texture Texture] class for common methods. +

+ + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/textures/CompressedTexture.html b/docs/api/zh/textures/CompressedTexture.html new file mode 100644 index 00000000000000..733f568d71936d --- /dev/null +++ b/docs/api/zh/textures/CompressedTexture.html @@ -0,0 +1,88 @@ + + + + + + + + + + + [page:Texture] → + +

[name]

+ +

+ Creates a texture based on data in compressed form, for example from a [link:https://en.wikipedia.org/wiki/DirectDraw_Surface DDS] file.

+ + + For use with the [page:CompressedTextureLoader CompressedTextureLoader]. +

+ + +

Constructor

+ + +

[name]( [param:Array mipmaps], [param:Number width], [param:Number height], [param:Constant format], [param:Constant type], [param:Constant mapping], [param:Constant wrapS], [param:Constant wrapT], [param:Constant magFilter], [param:Constant minFilter], [param:Number anisotropy] )

+

+ [page:Array mipmaps] -- The mipmaps array should contain objects with data, width and height. The mipmaps should be of the correct format and type.
+ + [page:Number width] -- The width of the biggest mipmap.
+ + [page:Number height] -- The height of the biggest mipmap.
+ + [page:Constant format] -- The format used in the mipmaps. + See [page:Textures ST3C Compressed Texture Formats], + [page:Textures PVRTC Compressed Texture Formats] and + [page:Textures ETC Compressed Texture Format] for other choices.
+ + [page:Constant type] -- Default is [page:Textures THREE.UnsignedByteType]. + See [page:Textures type constants] for other choices.
+ + [page:Constant mapping] -- How the image is applied to the object. An object type of [page:Textures THREE.UVMapping]. + See [page:Textures mapping constants] for other choices.
+ + [page:Constant wrapS] -- The default is [page:Textures THREE.ClampToEdgeWrapping]. + See [page:Textures wrap mode constants] for other choices.
+ + [page:Constant wrapT] -- The default is [page:Textures THREE.ClampToEdgeWrapping]. + See [page:Textures wrap mode constants] for other choices.
+ + [page:Constant magFilter] -- How the texture is sampled when a texel covers more than one pixel. + The default is [page:Textures THREE.LinearFilter]. See [page:Textures magnification filter constants] for other choices.
+ + [page:Constant minFilter] -- How the texture is sampled when a texel covers less than one pixel. + The default is [page:Textures THREE.LinearMipMapLinearFilter]. See [page:Textures minification filter constants] for other choices.
+ + [page:Number anisotropy] -- The number of samples taken along the axis through the pixel that has the highest density of texels. + By default, this value is 1. A higher value gives a less blurry result than a basic mipmap, at the cost of more texture samples being used. + Use renderer.getMaxAnisotropy() to find the maximum valid anisotropy value for the GPU; this value is usually a power of 2.

+

+ + +

Properties

+ + See the base [page:Texture Texture] class for common properties. + +

[property:boolean flipY]

+ +

+ False by default. Flipping textures does not work for compressed textures. +

+ +

[property:boolean generateMipmaps]

+ +

+ False by default. Mipmaps can't be generated for compressed textures +

+ + +

Methods

+ + + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/textures/CubeTexture.html b/docs/api/zh/textures/CubeTexture.html new file mode 100644 index 00000000000000..d3e0400abcec89 --- /dev/null +++ b/docs/api/zh/textures/CubeTexture.html @@ -0,0 +1,57 @@ + + + + + + + + + + + [page:Texture] → + +

[name]

+ +

Creates a cube texture made up of six images.

+ +

Example

+ + + var loader = new THREE.CubeTextureLoader(); + loader.setPath( 'textures/cube/pisa/' ); + + var textureCube = loader.load( [ + 'px.png', 'nx.png', + 'py.png', 'ny.png', + 'pz.png', 'nz.png' + ] ); + + var material = new THREE.MeshBasicMaterial( { color: 0xffffff, envMap: textureCube } ); + + +

Constructor

+ + +

[name]( images, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy )

+ +

+ CubeTexture is almost equivalent in functionality and usage to [page:Texture]. The only differences are that the + images are an array of 6 images as opposed to a single image, and the mapping options are + [page:Textures THREE.CubeReflectionMapping] (default) or [page:Textures THREE.CubeRefractionMapping] +

+ + +

Properties

+ +

See [page:Texture]

+ +

Methods

+ + +

See [page:Texture]

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/textures/DataTexture.html b/docs/api/zh/textures/DataTexture.html new file mode 100644 index 00000000000000..bb36c55477a0a2 --- /dev/null +++ b/docs/api/zh/textures/DataTexture.html @@ -0,0 +1,77 @@ + + + + + + + + + + + [page:Texture] → + +

[name]

+ +

Creates a texture directly from raw data, width and height.

+ + +

Constructor

+ +

[name]( data, width, height, format, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy )

+

+ The data argument must be an ArrayBuffer or a typed array view. + Further parameters correspond to the properties inherited from [page:Texture], where both magFilter and minFilter default to THREE.NearestFilter. The properties flipY and generateMipmaps are intially set to false. +

+

+ The interpretation of the data depends on type and format: + If the type is THREE.UnsignedByteType, a Uint8Array will be useful for addressing the texel data. + If the format is THREE.RGBAFormat, data needs four values for one texel; Red, Green, Blue and Alpha (typically the opacity). Similarly, THREE.RGBFormat specifies a format where only three values are used for each texel.
+ + For the packed types, THREE.UnsignedShort4444Type, THREE.UnsignedShort5551Type or THREE.UnsignedShort565Type, all color components of one texel can be addressed as bitfields within an integer element of a Uint16Array.
+ + In order to use the types THREE.FloatType and THREE.HalfFloatType, the WebGL implementation must support the respective extensions OES_texture_float and OES_texture_half_float. In order to use THREE.LinearFilter for component-wise, bilinear interpolation of the texels based on these types, the WebGL extensions OES_texture_float_linear or OES_texture_half_float_linear must also be present. +

+ +

Example

+ + + // create a buffer with color data + + var size = width * height; + var data = new Uint8Array( 3 * size ); + + var r = Math.floor( color.r * 255 ); + var g = Math.floor( color.g * 255 ); + var b = Math.floor( color.b * 255 ); + + for ( var i = 0; i < size; i ++ ) { + + var stride = i * 3; + + data[ stride ] = r; + data[ stride + 1 ] = g; + data[ stride + 2 ] = b; + + } + + // used the buffer to create a [name] + + var texture = new THREE.DataTexture( data, width, height, THREE.RGBFormat ); + texture.needsUpdate = true + + +

Properties

+ +

[property:Image image]

+

+ Overridden with a record type holding data, width and height. +

+ +

Methods

+ + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/textures/DepthTexture.html b/docs/api/zh/textures/DepthTexture.html new file mode 100644 index 00000000000000..3ec095dfd2f815 --- /dev/null +++ b/docs/api/zh/textures/DepthTexture.html @@ -0,0 +1,113 @@ + + + + + + + + + + + [page:Texture] → + +

[name]

+ +

+ Creates a texture for use as a Depth Texture. Require support for the + [link:https://www.khronos.org/registry/webgl/extensions/WEBGL_depth_texture/ WEBGL_depth_texture] extension. +

+ +

Example

+ + [example:webgl_depth_texture depth / texture] + +

Constructor

+

[name]( [param:Number width], [param:Number height], [param:Constant type], [param:Constant wrapS], [param:Constant wrapT], [param:Constant magFilter], [param:Constant minFilter], [param:Number anisotropy], [param:Constant format] )

+ +

+ [page:Number width] -- width of the texture.
+ + [page:Number height] -- height of the texture.
+ + [page:Constant type] -- Default is [page:Textures THREE.UnsignedShortType]. + See [page:Textures type constants] for other choices.
+ + [page:Constant mapping] -- + See [page:Textures type constants] for details.
+ + [page:Constant wrapS] -- The default is [page:Textures THREE.ClampToEdgeWrapping]. + See [page:Textures wrap mode constants] for other choices.
+ + [page:Constant wrapT] -- The default is [page:Textures THREE.ClampToEdgeWrapping]. + See [page:Textures wrap mode constants] for other choices.
+ + [page:Constant magFilter] -- How the texture is sampled when a texel covers more than one pixel. + The default is [page:Textures THREE.NearestFilter]. See [page:Textures magnification filter constants] for other choices.
+ + [page:Constant minFilter] -- How the texture is sampled when a texel covers less than one pixel. + The default is [page:Textures THREE.NearestFilter]. See [page:Textures minification filter constants] for other choices.
+ + [page:Number anisotropy] -- The number of samples taken along the axis through the pixel that has the highest density of texels. + By default, this value is 1. A higher value gives a less blurry result than a basic mipmap, at the cost of more texture samples being used. + Use [page:WebGLrenderer.getMaxAnisotropy renderer.getMaxAnisotropy]() to find the maximum valid anisotropy value for the GPU; this value is usually a power of 2.
+ + [page:Constant format] -- must be either [page:Textures DepthFormat] (default) or [page:Textures DepthStencilFormat]. + See [page:Textures format constants] for details.
+

+ + +

Properties

+ +

+ See the base [page:Texture Texture] class for common properties + - the following are also part of the texture class, but have different defaults here. +

+ +

[page:Texture.format .format]

+

+ Either [page:Textures DepthFormat] (default) or [page:Textures DepthStencilFormat]. + See [page:Textures format constants] for details.
+

+ +

[page:Texture.type .type]

+

+ Default is [page:Textures THREE.UnsignedShortType]. + See [page:Textures format constants] for details.
+

+ +

[page:Texture.magFilter .magFilter]

+

+ How the texture is sampled when a texel covers more than one pixel. + The default is [page:Textures THREE.NearestFilter]. + See [page:Textures magnification filter constants] for other choices. +

+ +

[page:Texture.minFilter .minFilter]

+

+ How the texture is sampled when a texel covers less than one pixel. + The default is [page:Textures THREE.NearestFilter]. + See [page:Textures magnification filter constants] for other choices. +

+ +

[page:Texture.flipY .flipY]

+

+ Depth textures do not need to be flipped so this is *false* by default. +

+ +

[page:Texture.generateMipmaps .generateMipmaps]

+

+ Depth textures do not use mipmaps. +

+ +

Methods

+ +

+ See the base [page:Texture Texture] class for common methods. +

+ + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/textures/Texture.html b/docs/api/zh/textures/Texture.html new file mode 100644 index 00000000000000..51e9858f0962b5 --- /dev/null +++ b/docs/api/zh/textures/Texture.html @@ -0,0 +1,263 @@ + + + + + + + + + + +

[name]

+ +

Create a texture to apply to a surface or as a reflection or refraction map.

+ + +

Constructor

+ +

[name]( image, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, encoding )

+ +

Example

+ + + // load a texture, set wrap mode to repeat + var texture = new THREE.TextureLoader().load( "textures/water.jpg" ); + texture.wrapS = THREE.RepeatWrapping; + texture.wrapT = THREE.RepeatWrapping; + texture.repeat.set( 4, 4 ); + + +

Properties

+ +

[property:Integer id]

+

+ Readonly - unique number for this texture instance. +

+ +

[property:String uuid]

+

+ [link:http://en.wikipedia.org/wiki/Universally_unique_identifier UUID] of this object instance. + This gets automatically assigned, so this shouldn't be edited. +

+ +

[property:String name]

+

+ Optional name of the object (doesn't need to be unique). Default is an empty string. +

+ +

[property:Image image]

+

+ An image object, typically created using the [page:TextureLoader.load] method. + This can be any image (e.g., PNG, JPG, GIF, DDS) or video (e.g., MP4, OGG/OGV) type supported by three.js.

+ + To use video as a texture you need to have a playing HTML5 + video element as a source for your texture image and continuously update this texture + as long as video is playing - the [page:VideoTexture VideoTexture] class handles this automatically. +

+ +

[property:array mipmaps]

+

+ Array of user-specified mipmaps (optional). +

+ +

[property:number mapping]

+

+ How the image is applied to the object. An object type of [page:Textures THREE.UVMapping] is the default, + where the U,V coordinates are used to apply the map.
+ + See the [page:Textures texture constants] page for other mapping types. +

+ +

[property:number wrapS]

+

+ This defines how the texture is wrapped horizontally and corresponds to *U* in UV mapping.
+ The default is [page:Textures THREE.ClampToEdgeWrapping], where the edge is clamped to the outer edge texels. + The other two choices are [page:Textures THREE.RepeatWrapping] and [page:Textures THREE.MirroredRepeatWrapping]. + See the [page:Textures texture constants] page for details. +

+ +

[property:number wrapT]

+

+ This defines how the texture is wrapped vertically and corresponds to *V* in UV mapping.
+ The same choices are available as for [property:number wrapS].

+ + NOTE: tiling of images in textures only functions if image dimensions are powers of two + (2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, ...) in terms of pixels. + Individual dimensions need not be equal, but each must be a power of two. + This is a limitation of WebGL, not three.js. +

+ +

[property:number magFilter]

+

+ How the texture is sampled when a texel covers more than one pixel. The default is + [page:Textures THREE.LinearFilter], which takes the four closest texels and bilinearly interpolates among them. + The other option is [page:Textures THREE.NearestFilter], which uses the value of the closest texel.
+ See the [page:Textures texture constants] page for details. +

+ +

[property:number minFilter]

+

+ How the texture is sampled when a texel covers less than one pixel. The default is + [page:Textures THREE.LinearMipMapLinearFilter], which uses mipmapping and a trilinear filter.

+ + See the [page:Textures texture constants] page for all possible choices. +

+ +

[property:number anisotropy]

+

+ The number of samples taken along the axis through the pixel that has the highest density of texels. + By default, this value is 1. A higher value gives a less blurry result than a basic mipmap, + at the cost of more texture samples being used. Use [page:WebGLRenderer.getMaxAnisotropy renderer.getMaxAnisotropy]() to + find the maximum valid anisotropy value for the GPU; this value is usually a power of 2. +

+ +

[property:number format]

+

+ The default is [page:Textures THREE.RGBAFormat], although the [page:TextureLoader TextureLoader] will automatically + set this to [page:Textures THREE.RGBFormat] for JPG images.

+ + See the [page:Textures texture constants] page for details of other formats. +

+ +

[property:number type]

+

+ This must correspond to the [page:Texture.format .format]. The default is [page:Textures THREE.UnsignedByteType], + which will be used for most texture formats.

+ + See the [page:Textures texture constants] page for details of other formats. +

+ +

[property:Vector2 offset]

+

+ How much a single repetition of the texture is offset from the beginning, in each direction U and V. + Typical range is *0.0* to *1.0*. _Note:_ The offset property is a convenience modifier and only affects + the Texture's application to the first set of UVs on a model. If the Texture is used as a map requiring + additional UV sets (e.g. the aoMap or lightMap of most stock materials), those UVs must be manually + assigned to achieve the desired offset. +

+ +

[property:Vector2 repeat]

+

+ How many times the texture is repeated across the surface, in each direction U and V. If repeat is set + greater than 1 in either direction, the corresponding Wrap parameter should also be set to + [page:Textures THREE.RepeatWrapping] or [page:Textures THREE.MirroredRepeatWrapping] to achieve the desired + tiling effect. _Note:_ The repeat property is a convenience modifier and only affects + the Texture's application to the first set of UVs on a model. If the Texture is used as a map requiring + additional UV sets (e.g. the aoMap or lightMap of most stock materials), those UVs must be manually + assigned to achieve the desired repetiton. +

+ +

[property:number rotation]

+

+ How much the texture is rotated around the center point, in radians. Postive values are counter-clockwise. Default is *0*. +

+ +

[property:Vector2 center]

+

+ The point around which rotation occurs. A value of (0.5, 0.5) corresponds to the center of the texture. Default is (0, 0), the lower left. +

+ +

[property:boolean matrixAutoUpdate]

+

+ Whether to update the texture's uv-transform [page:Texture.matrix .matrix] from the texture properties [page:Texture.offset .offset], [page:Texture.repeat .repeat], + [page:Texture.rotation .rotation], and [page:Texture.center .center]. True by default. + Set this to false if you are specifying the uv-transform matrix directly. +

+ +

[property:Matrix3 matrix]

+

+ The uv-transform matrix for the texture. Updated by the renderer from the texture properties [page:Texture.offset .offset], [page:Texture.repeat .repeat], + [page:Texture.rotation .rotation], and [page:Texture.center .center] when the texture's [page:Texture.matrixAutoUpdate .matrixAutoUpdate] property is true. + When [page:Texture.matrixAutoUpdate .matrixAutoUpdate] property is false, this matrix may be set manually. + Default is the identity matrix. +

+ +

[property:boolean generateMipmaps]

+

+ Whether to generate mipmaps (if possible) for a texture. True by default. Set this to false if you are + creating mipmaps manually. +

+ +

[property:boolean premultiplyAlpha]

+

+ False by default, which is the norm for PNG images. Set to true if the RGB values have + been stored premultiplied by alpha. +

+ +

[property:boolean flipY]

+

+ True by default. Flips the image's Y axis to match the WebGL texture coordinate space. +

+ +

[property:number unpackAlignment]

+

+ 4 by default. Specifies the alignment requirements for the start of each pixel row in memory. + The allowable values are 1 (byte-alignment), 2 (rows aligned to even-numbered bytes), + 4 (word-alignment), and 8 (rows start on double-word boundaries). + See [link:http://www.khronos.org/opengles/sdk/docs/man/xhtml/glPixelStorei.xml glPixelStorei] + for more information. +

+ +

[property:number encoding]

+

+ [page:Textures THREE.LinearEncoding] is the default. + See the [page:Textures texture constants] page for details of other formats.

+ + Note that if this value is changed on a texture after the material has been used, + it is necessary to trigger a Material.needsUpdate for this value to be realized in the shader. +

+ +

[property:Integer version]

+

+ This starts at *0* and counts how many times [property:Boolean needsUpdate] is set to *true*. +

+ +

[property:Function onUpdate]

+

+ A callback function, called when the texture is updated (e.g., when needsUpdate has been set to true + and then the texture is used). +

+ +

[property:Boolean needsUpdate]

+

+ Set this to *true* to trigger an update next time the texture is used. Particularly important for setting the wrap mode. +

+ + +

Methods

+ +

[page:EventDispatcher EventDispatcher] methods are available on this class.

+ +

[method:null updateMatrix]()

+

+ Update the texture's uv-transform [page:Texture.matrix .matrix] from the texture properties [page:Texture.offset .offset], [page:Texture.repeat .repeat], + [page:Texture.rotation .rotation], and [page:Texture.center .center]. +

+ +

[method:Texture clone]()

+

+ Make copy of the texture. Note this is not a "deep copy", the image is shared. +

+ +

[method:Texture toJSON]( [param:Object meta] )

+

+ meta -- optional object containing metadata.
+ Convert the material to three.js JSON format. +

+ +

[method:null dispose]()

+

+ Call [page:EventDispatcher EventDispatcher].dispatchEvent with a 'dispose' event type. +

+ +

[method:Vector2 transformUv]( [param:Vector2 uv] )

+

+ Transform the uv based on the value of this texture's [page:Texture.offset .offset], [page:Texture.repeat .repeat], + [page:Texture.wrapS .wrapS], [page:Texture.wrapT .wrapT] and [page:Texture.flipY .flipY] properties. +

+ +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/api/zh/textures/VideoTexture.html b/docs/api/zh/textures/VideoTexture.html new file mode 100644 index 00000000000000..5f18bff1578e75 --- /dev/null +++ b/docs/api/zh/textures/VideoTexture.html @@ -0,0 +1,96 @@ + + + + + + + + + + + [page:Texture] → + +

[name]

+ +

+ Creates a texture for use with a video texture.

+ + This is almost the same as the base [page:Texture Texture] class, except that it continuosly sets [page:Texture.needsUpdate needsUpdate] to *true* so that the texture is updated as the video plays. Automatic creation of [page:Texture.mipmaps mipmaps] is also disabled. +

+ +

Example

+ +

[example:webgl_materials_video materials / video ]

+ + +//assuming you have created a HTML video element with id="video" +var video = document.getElementById( 'video' ); + +var texture = new THREE.VideoTexture( video ); +texture.minFilter = THREE.LinearFilter; +texture.magFilter = THREE.LinearFilter; +texture.format = THREE.RGBFormat; + + + +

Constructor

+

[name]( [param:Video video], [param:Constant mapping], [param:Constant wrapS], [param:Constant wrapT], [param:Constant magFilter], [param:Constant minFilter], [param:Constant format], [param:Constant type], [param:Number anisotropy] )

+

+ [page:Video video] -- The video element to use as the texture.
+ + [page:Constant mapping] -- How the image is applied to the object. An object type of [page:Textures THREE.UVMapping]. + See [page:Textures mapping constants] for other choices.
+ + [page:Constant wrapS] -- The default is [page:Textures THREE.ClampToEdgeWrapping]. + See [page:Textures wrap mode constants] for other choices.
+ + [page:Constant wrapT] -- The default is [page:Textures THREE.ClampToEdgeWrapping]. + See [page:Textures wrap mode constants] for other choices.
+ + [page:Constant magFilter] -- How the texture is sampled when a texel covers more than one pixel. + The default is [page:Textures THREE.LinearFilter]. See [page:Textures magnification filter constants] for other choices.
+ + [page:Constant minFilter] -- How the texture is sampled when a texel covers less than one pixel. + The default is [page:Textures THREE.LinearMipMapLinearFilter]. See [page:Textures minification filter constants] for other choices.
+ + [page:Constant format] -- The format used in the texture. + See [page:Textures format constants] for other choices.
+ + [page:Constant type] -- Default is [page:Textures THREE.UnsignedByteType]. + See [page:Textures type constants] for other choices.
+ + [page:Number anisotropy] -- The number of samples taken along the axis through the pixel that has the highest density of texels. + By default, this value is 1. A higher value gives a less blurry result than a basic mipmap, at the cost of more texture samples being used. + Use [page:WebGLrenderer.getMaxAnisotropy renderer.getMaxAnisotropy]() to find the maximum valid anisotropy value for the GPU; this value is usually a power of 2.

+

+ + +

Properties

+ +

+ See the base [page:Texture Texture] class for common properties. +

+ +

[property:boolean needsUpdate]

+

+ You will not need to set this manually here as it is handled by the [page:VideoTexture.update update] method. +

+ +

Methods

+ +

+ See the base [page:Texture Texture] class for common methods. +

+ +

[method:null update]()

+

+ This is called automatically and sets [property:boolean needsUpdate] to *true* every time + a new frame is available. +

+ + +

Source

+ + [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] + + diff --git a/docs/examples/SpriteCanvasMaterial.html b/docs/examples/SpriteCanvasMaterial.html index 9f1acff963a025..b49cba14f63226 100644 --- a/docs/examples/SpriteCanvasMaterial.html +++ b/docs/examples/SpriteCanvasMaterial.html @@ -23,6 +23,7 @@

[name]( [param:Object parameters] )

parameters is an object that can be used to set up the default properties

+ rotation - the rotation of the sprite
color - the color of the sprite
program - the program used to draw the sprite

@@ -30,7 +31,10 @@

[name]( [param:Object parameters] )

Properties

- +

[property:Radians rotation]

+

+ The rotation of the sprite in radians. Default is 0. +

[property:Color color]

diff --git a/docs/examples/loaders/BabylonLoader.html b/docs/examples/loaders/BabylonLoader.html index 0cb6aa8f4ad86c..e0e602722c9f54 100644 --- a/docs/examples/loaders/BabylonLoader.html +++ b/docs/examples/loaders/BabylonLoader.html @@ -84,6 +84,14 @@

[method:Object3D parse]( [param:Object json] )

Lights are parsed accordingly.

+

[method:BabylonLoader setPath]( [param:String path] )

+

+ [page:String path] — Base path. +

+

+ Set the base path for the file. +

+

Source

[link:https://github.com/mrdoob/three.js/blob/master/examples/js/loaders/BabylonLoader.js examples/js/loaders/BabylonLoader.js] diff --git a/docs/examples/loaders/GLTFLoader.html b/docs/examples/loaders/GLTFLoader.html index dbb7988bf2b57d..179931b2887889 100644 --- a/docs/examples/loaders/GLTFLoader.html +++ b/docs/examples/loaders/GLTFLoader.html @@ -84,6 +84,31 @@

Browser compatibility

[link:https://github.com/stefanpenner/es6-promise include a polyfill] providing a Promise replacement.

+

Textures

+ +

Textures containing color information (.map, .emissiveMap, and .specularMap) always use sRGB colorspace in + glTF, while vertex colors and material properties (.color, .emissive, .specular) use linear colorspace. In a + typical rendering workflow, textures are converted to linear colorspace by the renderer, lighting calculations + are made, then final output is converted back to sRGB and displayed on screen. Unless you need post-processing + in linear colorspace, always configure [page:WebGLRenderer] as follows when using glTF:

+ + + renderer.gammaOutput = true; + renderer.gammaFactor = 2.2; + + +

GLTFLoader will automatically configure textures referenced from a .gltf or .glb file correctly, with the + assumption that the renderer is set up as shown above. When loading textures externally (e.g., using + [page:TextureLoader]) and applying them to a glTF model, colorspace and orientation must be given:

+ + + // If texture is used for color information, set colorspace. + texture.encoding = THREE.sRGBEncoding; + + // UVs use the convention that (0, 0) corresponds to the upper left corner of a texture. + texture.flipY = false; + +

Custom extensions

@@ -135,7 +160,15 @@

[method:null load]( [param:String url], [param:Function onLoad], [param:Func Begin loading from url and call the callback function with the parsed response content.

-

[method:null setPath]( [param:String path] )

+

[method:GLTFLoader setPath]( [param:String path] )

+

+ [page:String path] — Base path. +

+

+ Set the base path for the .gltf/.glb file. +

+ +

[method:GLTFLoader setResourcePath]( [param:String path] )

[page:String path] — Base path for loading additional resources e.g. textures and .bin data.

diff --git a/docs/examples/loaders/MTLLoader.html b/docs/examples/loaders/MTLLoader.html index 4e989ed721e909..40a2be09b6b77d 100644 --- a/docs/examples/loaders/MTLLoader.html +++ b/docs/examples/loaders/MTLLoader.html @@ -49,16 +49,16 @@

[method:MTLLoader setPath]( [param:String path] )

[page:String path] — required

- Set base path for resolving references. If set this path will be prepended to each loaded and found reference. + Set base path for MTL file.

-

[method:MTLLoader setTexturePath]( [param:String path] )

+

[method:MTLLoader setResourcePath]( [param:String path] )

[page:String path] — required

- Set base path for resolving texture references. If set this path will be prepended found texture reference. If not set and setPath is, it will be used as texture base path. + Set base path for additional resources like textures. If set, this path will be used as the base path.

@@ -88,9 +88,10 @@

[method:MTLLoader setMaterialOptions]( [param:Object options] )

-

[method:MTLLoaderMaterialCreator parse]( [param:String text] )

+

[method:MTLLoaderMaterialCreator parse]( [param:String text, param:String path] )

[page:String text] — The textual mtl structure to parse. + [page:String path] — The path to the MTL file.

Parse a mtl text structure and return a [page:MTLLoaderMaterialCreator] instance.
diff --git a/docs/examples/loaders/PCDLoader.html b/docs/examples/loaders/PCDLoader.html index 04595ef271cc4f..8a8242dee8ce7e 100644 --- a/docs/examples/loaders/PCDLoader.html +++ b/docs/examples/loaders/PCDLoader.html @@ -93,6 +93,14 @@

[method:Object3D parse]( [param:Arraybuffer data],[param:String url] )

The object is converted to [page:Points] with a [page:BufferGeometry] and a [page:PointsMaterial].

+

[method:PCDLoader setPath]( [param:String path] )

+

+ [page:String path] — Base path. +

+

+ Set the base path for the file. +

+

Source

[link:https://github.com/mrdoob/three.js/blob/master/examples/js/loaders/PCDLoader.js examples/js/loaders/PCDLoader.js] diff --git a/docs/examples/loaders/PDBLoader.html b/docs/examples/loaders/PDBLoader.html index cc2ba652cedf6a..b50cb8383771d7 100644 --- a/docs/examples/loaders/PDBLoader.html +++ b/docs/examples/loaders/PDBLoader.html @@ -87,6 +87,14 @@

[method:Object parse]( [param:String text] )

Parse a pdb text and return a JSON structure.

+

[method:PDBLoader setPath]( [param:String path] )

+

+ [page:String path] — Base path. +

+

+ Set the base path for the file. +

+

Source

[link:https://github.com/mrdoob/three.js/blob/master/examples/js/loaders/PDBLoader.js examples/js/loaders/PDBLoader.js] diff --git a/docs/examples/loaders/PRWMLoader.html b/docs/examples/loaders/PRWMLoader.html index eb70f49ce021a2..1ceb782582b368 100644 --- a/docs/examples/loaders/PRWMLoader.html +++ b/docs/examples/loaders/PRWMLoader.html @@ -94,6 +94,14 @@

PRWMLoader.isBigEndianPlatform( )

Return true if the endianness of the platform is Big Endian, false otherwise.

+

[method:PRWMLoader setPath]( [param:String path] )

+

+ [page:String path] — Base path. +

+

+ Set the base path for the file. +

+

Source

[link:https://github.com/mrdoob/three.js/blob/master/examples/js/loaders/PRWMLoader.js examples/js/loaders/PRWMLoader.js] diff --git a/docs/examples/loaders/SVGLoader.html b/docs/examples/loaders/SVGLoader.html index 3afdea5f8d779f..685deebdcba860 100644 --- a/docs/examples/loaders/SVGLoader.html +++ b/docs/examples/loaders/SVGLoader.html @@ -99,6 +99,13 @@

[method:null load]( [param:String url], [param:Function onLoad], [param:Func Begin loading from url and call onLoad with the response content.

+

[method:SVGLoader setPath]( [param:String path] )

+

+ [page:String path] — Base path. +

+

+ Set the base path for the file. +

Source

diff --git a/docs/examples/loaders/TGALoader.html b/docs/examples/loaders/TGALoader.html index 731c42d6f46ea1..e9344047b6fab9 100644 --- a/docs/examples/loaders/TGALoader.html +++ b/docs/examples/loaders/TGALoader.html @@ -76,6 +76,14 @@

[method:DataTexture load]( [param:String url], [param:Function onLoad], [par Begin loading from url and pass the loaded [page:DataTexture texture] to onLoad. The [page:DataTexture texture] is also directly returned for immediate use (but may not be fully loaded).

+

[method:TGALoader setPath]( [param:String path] )

+

+ [page:String path] — Base path. +

+

+ Set the base path for the file. +

+

Source

[link:https://github.com/mrdoob/three.js/blob/master/examples/js/loaders/TGALoader.js examples/js/loaders/TGALoader.js] diff --git a/docs/index.css b/docs/index.css index e0ad40bdbe249f..17f586cfb7d702 100644 --- a/docs/index.css +++ b/docs/index.css @@ -58,7 +58,7 @@ a { width: 260px; height: 100%; overflow: auto; - padding-left: 20px; + padding: 0px 20px 0px 20px; background: #fafafa; } @@ -77,7 +77,6 @@ iframe { } .filterBlock { - margin-right: 20px; position: relative; } @@ -175,7 +174,7 @@ iframe { #content { position: absolute; left: 0; - top: 90px; + top: 120px; right: 0; bottom: 0; font-size: 17px; diff --git a/docs/index.html b/docs/index.html index 096bcebfa9f3fb..7198bc9d4d9099 100644 --- a/docs/index.html +++ b/docs/index.html @@ -22,6 +22,13 @@

three.js / docs

x + +
+
+ en | + zh +
+
@@ -44,6 +51,15 @@

three.js / docs

// + var language = 'en'; + + function setLanguage( value ) { + + language = value; + createNavigation(); + + } + var panel = document.getElementById( 'panel' ); var content = document.getElementById( 'content' ); var clearFilterButton = document.getElementById( 'clearFilterButton' ); @@ -55,6 +71,8 @@

three.js / docs

var titles = {}; var categoryElements = []; + var navigation; + // Functionality for hamburger button (on small devices) @@ -118,16 +136,24 @@

three.js / docs

function createNavigation() { + if ( navigation !== undefined ) { + + content.removeChild( navigation ); + + } + // Create the navigation panel using data from list.js - var navigation = document.createElement( 'div' ); + navigation = document.createElement( 'div' ); content.appendChild( navigation ); - for ( var section in list ) { + var localList = list[ language ]; + + for ( var section in localList ) { // Create sections - var categories = list[ section ]; + var categories = localList[ section ]; var sectionHead = document.createElement( 'h2' ); sectionHead.textContent = section; @@ -157,8 +183,6 @@

three.js / docs

// Localisation - pageURL = pageURL.replace( '{lan}', 'en' ); - var listElement = document.createElement( 'li' ); categoryContent.appendChild( listElement ); diff --git a/docs/list.js b/docs/list.js index a2a10173c7bcff..0327f2b077f12f 100644 --- a/docs/list.js +++ b/docs/list.js @@ -1,421 +1,850 @@ var list = { - "Manual": { - - "Getting Started": { - "Creating a scene": "manual/{lan}/introduction/Creating-a-scene", - "Import via modules": "manual/{lan}/introduction/Import-via-modules", - "Browser support": "manual/{lan}/introduction/Browser-support", - "WebGL compatibility check": "manual/{lan}/introduction/WebGL-compatibility-check", - "How to run things locally": "manual/{lan}/introduction/How-to-run-things-locally", - "Drawing lines": "manual/{lan}/introduction/Drawing-lines", - "Creating text": "manual/{lan}/introduction/Creating-text", - "Loading 3D models": "manual/{lan}/introduction/Loading-3D-models", - "Migration guide": "manual/{lan}/introduction/Migration-guide", - "Code style guide": "manual/{lan}/introduction/Code-style-guide", - "FAQ": "manual/{lan}/introduction/FAQ", - "Useful links": "manual/{lan}/introduction/Useful-links" - }, - - "Next Steps": { - "How to update things": "manual/{lan}/introduction/How-to-update-things", - "Matrix transformations": "manual/{lan}/introduction/Matrix-transformations", - "Animation system": "manual/{lan}/introduction/Animation-system" - }, + "en": { + + "Manual": { + + "Getting Started": { + "Creating a scene": "manual/en/introduction/Creating-a-scene", + "Import via modules": "manual/en/introduction/Import-via-modules", + "Browser support": "manual/en/introduction/Browser-support", + "WebGL compatibility check": "manual/en/introduction/WebGL-compatibility-check", + "How to run things locally": "manual/en/introduction/How-to-run-things-locally", + "Drawing lines": "manual/en/introduction/Drawing-lines", + "Creating text": "manual/en/introduction/Creating-text", + "Loading 3D models": "manual/en/introduction/Loading-3D-models", + "Migration guide": "manual/en/introduction/Migration-guide", + "Code style guide": "manual/en/introduction/Code-style-guide", + "FAQ": "manual/en/introduction/FAQ", + "Useful links": "manual/en/introduction/Useful-links" + }, + + "Next Steps": { + "How to update things": "manual/en/introduction/How-to-update-things", + "How to create VR content": "manual/en/introduction/How-to-create-VR-content", + "Matrix transformations": "manual/en/introduction/Matrix-transformations", + "Animation system": "manual/en/introduction/Animation-system" + }, + + "Build Tools": { + "Testing with NPM": "manual/en/buildTools/Testing-with-NPM" + } + + }, + + "Reference": { + + "Animation": { + "AnimationAction": "api/en/animation/AnimationAction", + "AnimationClip": "api/en/animation/AnimationClip", + "AnimationMixer": "api/en/animation/AnimationMixer", + "AnimationObjectGroup": "api/en/animation/AnimationObjectGroup", + "AnimationUtils": "api/en/animation/AnimationUtils", + "KeyframeTrack": "api/en/animation/KeyframeTrack", + "PropertyBinding": "api/en/animation/PropertyBinding", + "PropertyMixer": "api/en/animation/PropertyMixer" + }, + + "Animation / Tracks": { + "BooleanKeyframeTrack": "api/en/animation/tracks/BooleanKeyframeTrack", + "ColorKeyframeTrack": "api/en/animation/tracks/ColorKeyframeTrack", + "NumberKeyframeTrack": "api/en/animation/tracks/NumberKeyframeTrack", + "QuaternionKeyframeTrack": "api/en/animation/tracks/QuaternionKeyframeTrack", + "StringKeyframeTrack": "api/en/animation/tracks/StringKeyframeTrack", + "VectorKeyframeTrack": "api/en/animation/tracks/VectorKeyframeTrack" + }, + + "Audio": { + "Audio": "api/en/audio/Audio", + "AudioAnalyser": "api/en/audio/AudioAnalyser", + "AudioContext": "api/en/audio/AudioContext", + "AudioListener": "api/en/audio/AudioListener", + "PositionalAudio": "api/en/audio/PositionalAudio" + }, + + "Cameras": { + "ArrayCamera": "api/en/cameras/ArrayCamera", + "Camera": "api/en/cameras/Camera", + "CubeCamera": "api/en/cameras/CubeCamera", + "OrthographicCamera": "api/en/cameras/OrthographicCamera", + "PerspectiveCamera": "api/en/cameras/PerspectiveCamera", + "StereoCamera": "api/en/cameras/StereoCamera" + }, + + "Constants": { + "Animation": "api/en/constants/Animation", + "Core": "api/en/constants/Core", + "CustomBlendingEquation": "api/en/constants/CustomBlendingEquations", + "DrawModes": "api/en/constants/DrawModes", + "Materials": "api/en/constants/Materials", + "Renderer": "api/en/constants/Renderer", + "Textures": "api/en/constants/Textures" + }, + + "Core": { + "BufferAttribute": "api/en/core/BufferAttribute", + "BufferGeometry": "api/en/core/BufferGeometry", + "Clock": "api/en/core/Clock", + "DirectGeometry": "api/en/core/DirectGeometry", + "EventDispatcher": "api/en/core/EventDispatcher", + "Face3": "api/en/core/Face3", + "Geometry": "api/en/core/Geometry", + "InstancedBufferAttribute": "api/en/core/InstancedBufferAttribute", + "InstancedBufferGeometry": "api/en/core/InstancedBufferGeometry", + "InstancedInterleavedBuffer": "api/en/core/InstancedInterleavedBuffer", + "InterleavedBuffer": "api/en/core/InterleavedBuffer", + "InterleavedBufferAttribute": "api/en/core/InterleavedBufferAttribute", + "Layers": "api/en/core/Layers", + "Object3D": "api/en/core/Object3D", + "Raycaster": "api/en/core/Raycaster", + "Uniform": "api/en/core/Uniform" + }, + + "Core / BufferAttributes": { + "BufferAttribute Types": "api/en/core/bufferAttributeTypes/BufferAttributeTypes" + }, + + "Deprecated": { + "DeprecatedList": "api/en/deprecated/DeprecatedList" + }, + + "Extras": { + "Earcut": "api/en/extras/Earcut", + "ShapeUtils": "api/en/extras/ShapeUtils" + }, + + "Extras / Core": { + "Curve": "api/en/extras/core/Curve", + "CurvePath": "api/en/extras/core/CurvePath", + "Font": "api/en/extras/core/Font", + "Interpolations": "api/en/extras/core/Interpolations", + "Path": "api/en/extras/core/Path", + "Shape": "api/en/extras/core/Shape", + "ShapePath": "api/en/extras/core/ShapePath" + }, + + "Extras / Curves": { + "ArcCurve": "api/en/extras/curves/ArcCurve", + "CatmullRomCurve3": "api/en/extras/curves/CatmullRomCurve3", + "CubicBezierCurve": "api/en/extras/curves/CubicBezierCurve", + "CubicBezierCurve3": "api/en/extras/curves/CubicBezierCurve3", + "EllipseCurve": "api/en/extras/curves/EllipseCurve", + "LineCurve": "api/en/extras/curves/LineCurve", + "LineCurve3": "api/en/extras/curves/LineCurve3", + "QuadraticBezierCurve": "api/en/extras/curves/QuadraticBezierCurve", + "QuadraticBezierCurve3": "api/en/extras/curves/QuadraticBezierCurve3", + "SplineCurve": "api/en/extras/curves/SplineCurve" + }, + + "Extras / Objects": { + "ImmediateRenderObject": "api/en/extras/objects/ImmediateRenderObject", + }, + + "Geometries": { + "BoxBufferGeometry": "api/en/geometries/BoxBufferGeometry", + "BoxGeometry": "api/en/geometries/BoxGeometry", + "CircleBufferGeometry": "api/en/geometries/CircleBufferGeometry", + "CircleGeometry": "api/en/geometries/CircleGeometry", + "ConeBufferGeometry": "api/en/geometries/ConeBufferGeometry", + "ConeGeometry": "api/en/geometries/ConeGeometry", + "CylinderBufferGeometry": "api/en/geometries/CylinderBufferGeometry", + "CylinderGeometry": "api/en/geometries/CylinderGeometry", + "DodecahedronBufferGeometry": "api/en/geometries/DodecahedronBufferGeometry", + "DodecahedronGeometry": "api/en/geometries/DodecahedronGeometry", + "EdgesGeometry": "api/en/geometries/EdgesGeometry", + "ExtrudeBufferGeometry": "api/en/geometries/ExtrudeBufferGeometry", + "ExtrudeGeometry": "api/en/geometries/ExtrudeGeometry", + "IcosahedronBufferGeometry": "api/en/geometries/IcosahedronBufferGeometry", + "IcosahedronGeometry": "api/en/geometries/IcosahedronGeometry", + "LatheBufferGeometry": "api/en/geometries/LatheBufferGeometry", + "LatheGeometry": "api/en/geometries/LatheGeometry", + "OctahedronBufferGeometry": "api/en/geometries/OctahedronBufferGeometry", + "OctahedronGeometry": "api/en/geometries/OctahedronGeometry", + "ParametricBufferGeometry": "api/en/geometries/ParametricBufferGeometry", + "ParametricGeometry": "api/en/geometries/ParametricGeometry", + "PlaneBufferGeometry": "api/en/geometries/PlaneBufferGeometry", + "PlaneGeometry": "api/en/geometries/PlaneGeometry", + "PolyhedronBufferGeometry": "api/en/geometries/PolyhedronBufferGeometry", + "PolyhedronGeometry": "api/en/geometries/PolyhedronGeometry", + "RingBufferGeometry": "api/en/geometries/RingBufferGeometry", + "RingGeometry": "api/en/geometries/RingGeometry", + "ShapeBufferGeometry": "api/en/geometries/ShapeBufferGeometry", + "ShapeGeometry": "api/en/geometries/ShapeGeometry", + "SphereBufferGeometry": "api/en/geometries/SphereBufferGeometry", + "SphereGeometry": "api/en/geometries/SphereGeometry", + "TetrahedronBufferGeometry": "api/en/geometries/TetrahedronBufferGeometry", + "TetrahedronGeometry": "api/en/geometries/TetrahedronGeometry", + "TextBufferGeometry": "api/en/geometries/TextBufferGeometry", + "TextGeometry": "api/en/geometries/TextGeometry", + "TorusBufferGeometry": "api/en/geometries/TorusBufferGeometry", + "TorusGeometry": "api/en/geometries/TorusGeometry", + "TorusKnotBufferGeometry": "api/en/geometries/TorusKnotBufferGeometry", + "TorusKnotGeometry": "api/en/geometries/TorusKnotGeometry", + "TubeBufferGeometry": "api/en/geometries/TubeBufferGeometry", + "TubeGeometry": "api/en/geometries/TubeGeometry", + "WireframeGeometry": "api/en/geometries/WireframeGeometry" + }, + + "Helpers": { + "ArrowHelper": "api/en/helpers/ArrowHelper", + "AxesHelper": "api/en/helpers/AxesHelper", + "BoxHelper": "api/en/helpers/BoxHelper", + "Box3Helper": "api/en/helpers/Box3Helper", + "CameraHelper": "api/en/helpers/CameraHelper", + "DirectionalLightHelper": "api/en/helpers/DirectionalLightHelper", + "FaceNormalsHelper": "api/en/helpers/FaceNormalsHelper", + "GridHelper": "api/en/helpers/GridHelper", + "PolarGridHelper": "api/en/helpers/PolarGridHelper", + "HemisphereLightHelper": "api/en/helpers/HemisphereLightHelper", + "PlaneHelper": "api/en/helpers/PlaneHelper", + "PointLightHelper": "api/en/helpers/PointLightHelper", + "RectAreaLightHelper": "api/en/helpers/RectAreaLightHelper", + "SkeletonHelper": "api/en/helpers/SkeletonHelper", + "SpotLightHelper": "api/en/helpers/SpotLightHelper", + "VertexNormalsHelper": "api/en/helpers/VertexNormalsHelper" + }, + + "Lights": { + "AmbientLight": "api/en/lights/AmbientLight", + "DirectionalLight": "api/en/lights/DirectionalLight", + "HemisphereLight": "api/en/lights/HemisphereLight", + "Light": "api/en/lights/Light", + "PointLight": "api/en/lights/PointLight", + "RectAreaLight": "api/en/lights/RectAreaLight", + "SpotLight": "api/en/lights/SpotLight" + }, + + "Lights / Shadows": { + "DirectionalLightShadow": "api/en/lights/shadows/DirectionalLightShadow", + "LightShadow": "api/en/lights/shadows/LightShadow", + "SpotLightShadow": "api/en/lights/shadows/SpotLightShadow" + }, + + "Loaders": { + "AnimationLoader": "api/en/loaders/AnimationLoader", + "AudioLoader": "api/en/loaders/AudioLoader", + "BufferGeometryLoader": "api/en/loaders/BufferGeometryLoader", + "Cache": "api/en/loaders/Cache", + "CompressedTextureLoader": "api/en/loaders/CompressedTextureLoader", + "CubeTextureLoader": "api/en/loaders/CubeTextureLoader", + "DataTextureLoader": "api/en/loaders/DataTextureLoader", + "FileLoader": "api/en/loaders/FileLoader", + "FontLoader": "api/en/loaders/FontLoader", + "ImageBitmapLoader": "api/en/loaders/ImageBitmapLoader", + "ImageLoader": "api/en/loaders/ImageLoader", + "JSONLoader": "api/en/loaders/JSONLoader", + "Loader": "api/en/loaders/Loader", + "LoaderUtils": "api/en/loaders/LoaderUtils", + "MaterialLoader": "api/en/loaders/MaterialLoader", + "ObjectLoader": "api/en/loaders/ObjectLoader", + "TextureLoader": "api/en/loaders/TextureLoader" + }, + + "Loaders / Managers": { + "DefaultLoadingManager": "api/en/loaders/managers/DefaultLoadingManager", + "LoadingManager": "api/en/loaders/managers/LoadingManager" + }, + + "Materials": { + "LineBasicMaterial": "api/en/materials/LineBasicMaterial", + "LineDashedMaterial": "api/en/materials/LineDashedMaterial", + "Material": "api/en/materials/Material", + "MeshBasicMaterial": "api/en/materials/MeshBasicMaterial", + "MeshDepthMaterial": "api/en/materials/MeshDepthMaterial", + "MeshLambertMaterial": "api/en/materials/MeshLambertMaterial", + "MeshNormalMaterial": "api/en/materials/MeshNormalMaterial", + "MeshPhongMaterial": "api/en/materials/MeshPhongMaterial", + "MeshPhysicalMaterial": "api/en/materials/MeshPhysicalMaterial", + "MeshStandardMaterial": "api/en/materials/MeshStandardMaterial", + "MeshToonMaterial": "api/en/materials/MeshToonMaterial", + "PointsMaterial": "api/en/materials/PointsMaterial", + "RawShaderMaterial": "api/en/materials/RawShaderMaterial", + "ShaderMaterial": "api/en/materials/ShaderMaterial", + "ShadowMaterial": "api/en/materials/ShadowMaterial", + "SpriteMaterial": "api/en/materials/SpriteMaterial" + }, + + "Math": { + "Box2": "api/en/math/Box2", + "Box3": "api/en/math/Box3", + "Color": "api/en/math/Color", + "Cylindrical": "api/en/math/Cylindrical", + "Euler": "api/en/math/Euler", + "Frustum": "api/en/math/Frustum", + "Interpolant": "api/en/math/Interpolant", + "Line3": "api/en/math/Line3", + "Math": "api/en/math/Math", + "Matrix3": "api/en/math/Matrix3", + "Matrix4": "api/en/math/Matrix4", + "Plane": "api/en/math/Plane", + "Quaternion": "api/en/math/Quaternion", + "Ray": "api/en/math/Ray", + "Sphere": "api/en/math/Sphere", + "Spherical": "api/en/math/Spherical", + "Triangle": "api/en/math/Triangle", + "Vector2": "api/en/math/Vector2", + "Vector3": "api/en/math/Vector3", + "Vector4": "api/en/math/Vector4" + }, + + "Math / Interpolants": { + "CubicInterpolant": "api/en/math/interpolants/CubicInterpolant", + "DiscreteInterpolant": "api/en/math/interpolants/DiscreteInterpolant", + "LinearInterpolant": "api/en/math/interpolants/LinearInterpolant", + "QuaternionLinearInterpolant": "api/en/math/interpolants/QuaternionLinearInterpolant" + }, + + "Objects": { + "Bone": "api/en/objects/Bone", + "Group": "api/en/objects/Group", + "Line": "api/en/objects/Line", + "LineLoop": "api/en/objects/LineLoop", + "LineSegments": "api/en/objects/LineSegments", + "LOD": "api/en/objects/LOD", + "Mesh": "api/en/objects/Mesh", + "Points": "api/en/objects/Points", + "Skeleton": "api/en/objects/Skeleton", + "SkinnedMesh": "api/en/objects/SkinnedMesh", + "Sprite": "api/en/objects/Sprite" + }, + + "Renderers": { + "WebGLRenderer": "api/en/renderers/WebGLRenderer", + "WebGLRenderTarget": "api/en/renderers/WebGLRenderTarget", + "WebGLRenderTargetCube": "api/en/renderers/WebGLRenderTargetCube" + }, + + "Renderers / Shaders": { + "ShaderChunk": "api/en/renderers/shaders/ShaderChunk", + "ShaderLib": "api/en/renderers/shaders/ShaderLib", + "UniformsLib": "api/en/renderers/shaders/UniformsLib", + "UniformsUtils": "api/en/renderers/shaders/UniformsUtils" + }, + + "Scenes": { + "Fog": "api/en/scenes/Fog", + "FogExp2": "api/en/scenes/FogExp2", + "Scene": "api/en/scenes/Scene" + }, + + "Textures": { + "CanvasTexture": "api/en/textures/CanvasTexture", + "CompressedTexture": "api/en/textures/CompressedTexture", + "CubeTexture": "api/en/textures/CubeTexture", + "DataTexture": "api/en/textures/DataTexture", + "DepthTexture": "api/en/textures/DepthTexture", + "Texture": "api/en/textures/Texture", + "VideoTexture": "api/en/textures/VideoTexture" + } + + }, + + "Examples": { + + "Animations": { + "CCDIKSolver": "examples/animations/CCDIKSolver", + "MMDAnimationHelper": "examples/animations/MMDAnimationHelper", + "MMDPhysics": "examples/animations/MMDPhysics" + }, + + "Controls": { + "OrbitControls": "examples/controls/OrbitControls" + }, + + "Geometries": { + "ConvexBufferGeometry": "examples/geometries/ConvexBufferGeometry", + "ConvexGeometry": "examples/geometries/ConvexGeometry", + "DecalGeometry": "examples/geometries/DecalGeometry" + }, + + "Loaders": { + "BabylonLoader": "examples/loaders/BabylonLoader", + "GLTFLoader": "examples/loaders/GLTFLoader", + "MMDLoader": "examples/loaders/MMDLoader", + "MTLLoader": "examples/loaders/MTLLoader", + "OBJLoader": "examples/loaders/OBJLoader", + "OBJLoader2": "examples/loaders/OBJLoader2", + "LoaderSupport": "examples/loaders/LoaderSupport", + "PCDLoader": "examples/loaders/PCDLoader", + "PDBLoader": "examples/loaders/PDBLoader", + "SVGLoader": "examples/loaders/SVGLoader", + "TGALoader": "examples/loaders/TGALoader", + "PRWMLoader": "examples/loaders/PRWMLoader" + }, + + "Objects": { + "Lensflare": "examples/objects/Lensflare", + }, + + "Exporters": { + "GLTFExporter": "examples/exporters/GLTFExporter", + "PLYExporter": "examples/exporters/PLYExporter" + }, + + "Plugins": { + "LookupTable": "examples/Lut", + "SpriteCanvasMaterial": "examples/SpriteCanvasMaterial" + }, + + "QuickHull": { + "Face": "examples/quickhull/Face", + "HalfEdge": "examples/quickhull/HalfEdge", + "QuickHull": "examples/quickhull/QuickHull", + "VertexNode": "examples/quickhull/VertexNode", + "VertexList": "examples/quickhull/VertexList" + }, + + "Renderers": { + "CanvasRenderer": "examples/renderers/CanvasRenderer", + "CSS2DRenderer": "examples/renderers/CSS2DRenderer", + "CSS3DRenderer": "examples/renderers/CSS3DRenderer", + "SVGRenderer": "examples/renderers/SVGRenderer" + + }, + + "Utils": { + "BufferGeometryUtils": "examples/utils/BufferGeometryUtils", + "SceneUtils": "examples/utils/SceneUtils" + } + + }, + + "Developer Reference": { + + "Polyfills": { + "Polyfills": "api/en/Polyfills" + }, + + "WebGLRenderer": { + "WebGLProgram": "api/en/renderers/webgl/WebGLProgram", + "WebGLShader": "api/en/renderers/webgl/WebGLShader", + "WebGLState": "api/en/renderers/webgl/WebGLState" + } - "Build Tools": { - "Testing with NPM": "manual/{lan}/buildTools/Testing-with-NPM" } }, - "Reference": { - - "Animation": { - "AnimationAction": "api/{lan}/animation/AnimationAction", - "AnimationClip": "api/{lan}/animation/AnimationClip", - "AnimationMixer": "api/{lan}/animation/AnimationMixer", - "AnimationObjectGroup": "api/{lan}/animation/AnimationObjectGroup", - "AnimationUtils": "api/{lan}/animation/AnimationUtils", - "KeyframeTrack": "api/{lan}/animation/KeyframeTrack", - "PropertyBinding": "api/{lan}/animation/PropertyBinding", - "PropertyMixer": "api/{lan}/animation/PropertyMixer" - }, - - "Animation / Tracks": { - "BooleanKeyframeTrack": "api/{lan}/animation/tracks/BooleanKeyframeTrack", - "ColorKeyframeTrack": "api/{lan}/animation/tracks/ColorKeyframeTrack", - "NumberKeyframeTrack": "api/{lan}/animation/tracks/NumberKeyframeTrack", - "QuaternionKeyframeTrack": "api/{lan}/animation/tracks/QuaternionKeyframeTrack", - "StringKeyframeTrack": "api/{lan}/animation/tracks/StringKeyframeTrack", - "VectorKeyframeTrack": "api/{lan}/animation/tracks/VectorKeyframeTrack" - }, - - "Audio": { - "Audio": "api/{lan}/audio/Audio", - "AudioAnalyser": "api/{lan}/audio/AudioAnalyser", - "AudioContext": "api/{lan}/audio/AudioContext", - "AudioListener": "api/{lan}/audio/AudioListener", - "PositionalAudio": "api/{lan}/audio/PositionalAudio" - }, - - "Cameras": { - "ArrayCamera": "api/{lan}/cameras/ArrayCamera", - "Camera": "api/{lan}/cameras/Camera", - "CubeCamera": "api/{lan}/cameras/CubeCamera", - "OrthographicCamera": "api/{lan}/cameras/OrthographicCamera", - "PerspectiveCamera": "api/{lan}/cameras/PerspectiveCamera", - "StereoCamera": "api/{lan}/cameras/StereoCamera" - }, - - "Constants": { - "Animation": "api/{lan}/constants/Animation", - "Core": "api/{lan}/constants/Core", - "CustomBlendingEquation": "api/{lan}/constants/CustomBlendingEquations", - "DrawModes": "api/{lan}/constants/DrawModes", - "Materials": "api/{lan}/constants/Materials", - "Renderer": "api/{lan}/constants/Renderer", - "Textures": "api/{lan}/constants/Textures" - }, - - "Core": { - "BufferAttribute": "api/{lan}/core/BufferAttribute", - "BufferGeometry": "api/{lan}/core/BufferGeometry", - "Clock": "api/{lan}/core/Clock", - "DirectGeometry": "api/{lan}/core/DirectGeometry", - "EventDispatcher": "api/{lan}/core/EventDispatcher", - "Face3": "api/{lan}/core/Face3", - "Geometry": "api/{lan}/core/Geometry", - "InstancedBufferAttribute": "api/{lan}/core/InstancedBufferAttribute", - "InstancedBufferGeometry": "api/{lan}/core/InstancedBufferGeometry", - "InstancedInterleavedBuffer": "api/{lan}/core/InstancedInterleavedBuffer", - "InterleavedBuffer": "api/{lan}/core/InterleavedBuffer", - "InterleavedBufferAttribute": "api/{lan}/core/InterleavedBufferAttribute", - "Layers": "api/{lan}/core/Layers", - "Object3D": "api/{lan}/core/Object3D", - "Raycaster": "api/{lan}/core/Raycaster", - "Uniform": "api/{lan}/core/Uniform" - }, - - "Core / BufferAttributes": { - "BufferAttribute Types": "api/{lan}/core/bufferAttributeTypes/BufferAttributeTypes" - }, - - "Deprecated": { - "DeprecatedList": "api/{lan}/deprecated/DeprecatedList" - }, - - "Extras": { - "Earcut": "api/{lan}/extras/Earcut", - "ShapeUtils": "api/{lan}/extras/ShapeUtils" - }, - - "Extras / Core": { - "Curve": "api/{lan}/extras/core/Curve", - "CurvePath": "api/{lan}/extras/core/CurvePath", - "Font": "api/{lan}/extras/core/Font", - "Interpolations": "api/{lan}/extras/core/Interpolations", - "Path": "api/{lan}/extras/core/Path", - "Shape": "api/{lan}/extras/core/Shape", - "ShapePath": "api/{lan}/extras/core/ShapePath" - }, - - "Extras / Curves": { - "ArcCurve": "api/{lan}/extras/curves/ArcCurve", - "CatmullRomCurve3": "api/{lan}/extras/curves/CatmullRomCurve3", - "CubicBezierCurve": "api/{lan}/extras/curves/CubicBezierCurve", - "CubicBezierCurve3": "api/{lan}/extras/curves/CubicBezierCurve3", - "EllipseCurve": "api/{lan}/extras/curves/EllipseCurve", - "LineCurve": "api/{lan}/extras/curves/LineCurve", - "LineCurve3": "api/{lan}/extras/curves/LineCurve3", - "QuadraticBezierCurve": "api/{lan}/extras/curves/QuadraticBezierCurve", - "QuadraticBezierCurve3": "api/{lan}/extras/curves/QuadraticBezierCurve3", - "SplineCurve": "api/{lan}/extras/curves/SplineCurve" - }, - - "Extras / Objects": { - "ImmediateRenderObject": "api/{lan}/extras/objects/ImmediateRenderObject", - }, - - "Geometries": { - "BoxBufferGeometry": "api/{lan}/geometries/BoxBufferGeometry", - "BoxGeometry": "api/{lan}/geometries/BoxGeometry", - "CircleBufferGeometry": "api/{lan}/geometries/CircleBufferGeometry", - "CircleGeometry": "api/{lan}/geometries/CircleGeometry", - "ConeBufferGeometry": "api/{lan}/geometries/ConeBufferGeometry", - "ConeGeometry": "api/{lan}/geometries/ConeGeometry", - "CylinderBufferGeometry": "api/{lan}/geometries/CylinderBufferGeometry", - "CylinderGeometry": "api/{lan}/geometries/CylinderGeometry", - "DodecahedronBufferGeometry": "api/{lan}/geometries/DodecahedronBufferGeometry", - "DodecahedronGeometry": "api/{lan}/geometries/DodecahedronGeometry", - "EdgesGeometry": "api/{lan}/geometries/EdgesGeometry", - "ExtrudeBufferGeometry": "api/{lan}/geometries/ExtrudeBufferGeometry", - "ExtrudeGeometry": "api/{lan}/geometries/ExtrudeGeometry", - "IcosahedronBufferGeometry": "api/{lan}/geometries/IcosahedronBufferGeometry", - "IcosahedronGeometry": "api/{lan}/geometries/IcosahedronGeometry", - "LatheBufferGeometry": "api/{lan}/geometries/LatheBufferGeometry", - "LatheGeometry": "api/{lan}/geometries/LatheGeometry", - "OctahedronBufferGeometry": "api/{lan}/geometries/OctahedronBufferGeometry", - "OctahedronGeometry": "api/{lan}/geometries/OctahedronGeometry", - "ParametricBufferGeometry": "api/{lan}/geometries/ParametricBufferGeometry", - "ParametricGeometry": "api/{lan}/geometries/ParametricGeometry", - "PlaneBufferGeometry": "api/{lan}/geometries/PlaneBufferGeometry", - "PlaneGeometry": "api/{lan}/geometries/PlaneGeometry", - "PolyhedronBufferGeometry": "api/{lan}/geometries/PolyhedronBufferGeometry", - "PolyhedronGeometry": "api/{lan}/geometries/PolyhedronGeometry", - "RingBufferGeometry": "api/{lan}/geometries/RingBufferGeometry", - "RingGeometry": "api/{lan}/geometries/RingGeometry", - "ShapeBufferGeometry": "api/{lan}/geometries/ShapeBufferGeometry", - "ShapeGeometry": "api/{lan}/geometries/ShapeGeometry", - "SphereBufferGeometry": "api/{lan}/geometries/SphereBufferGeometry", - "SphereGeometry": "api/{lan}/geometries/SphereGeometry", - "TetrahedronBufferGeometry": "api/{lan}/geometries/TetrahedronBufferGeometry", - "TetrahedronGeometry": "api/{lan}/geometries/TetrahedronGeometry", - "TextBufferGeometry": "api/{lan}/geometries/TextBufferGeometry", - "TextGeometry": "api/{lan}/geometries/TextGeometry", - "TorusBufferGeometry": "api/{lan}/geometries/TorusBufferGeometry", - "TorusGeometry": "api/{lan}/geometries/TorusGeometry", - "TorusKnotBufferGeometry": "api/{lan}/geometries/TorusKnotBufferGeometry", - "TorusKnotGeometry": "api/{lan}/geometries/TorusKnotGeometry", - "TubeBufferGeometry": "api/{lan}/geometries/TubeBufferGeometry", - "TubeGeometry": "api/{lan}/geometries/TubeGeometry", - "WireframeGeometry": "api/{lan}/geometries/WireframeGeometry" - }, - - "Helpers": { - "ArrowHelper": "api/{lan}/helpers/ArrowHelper", - "AxesHelper": "api/{lan}/helpers/AxesHelper", - "BoxHelper": "api/{lan}/helpers/BoxHelper", - "Box3Helper": "api/{lan}/helpers/Box3Helper", - "CameraHelper": "api/{lan}/helpers/CameraHelper", - "DirectionalLightHelper": "api/{lan}/helpers/DirectionalLightHelper", - "FaceNormalsHelper": "api/{lan}/helpers/FaceNormalsHelper", - "GridHelper": "api/{lan}/helpers/GridHelper", - "PolarGridHelper": "api/{lan}/helpers/PolarGridHelper", - "HemisphereLightHelper": "api/{lan}/helpers/HemisphereLightHelper", - "PlaneHelper": "api/{lan}/helpers/PlaneHelper", - "PointLightHelper": "api/{lan}/helpers/PointLightHelper", - "RectAreaLightHelper": "api/{lan}/helpers/RectAreaLightHelper", - "SkeletonHelper": "api/{lan}/helpers/SkeletonHelper", - "SpotLightHelper": "api/{lan}/helpers/SpotLightHelper", - "VertexNormalsHelper": "api/{lan}/helpers/VertexNormalsHelper" - }, - - "Lights": { - "AmbientLight": "api/{lan}/lights/AmbientLight", - "DirectionalLight": "api/{lan}/lights/DirectionalLight", - "HemisphereLight": "api/{lan}/lights/HemisphereLight", - "Light": "api/{lan}/lights/Light", - "PointLight": "api/{lan}/lights/PointLight", - "RectAreaLight": "api/{lan}/lights/RectAreaLight", - "SpotLight": "api/{lan}/lights/SpotLight" - }, - - "Lights / Shadows": { - "DirectionalLightShadow": "api/{lan}/lights/shadows/DirectionalLightShadow", - "LightShadow": "api/{lan}/lights/shadows/LightShadow", - "SpotLightShadow": "api/{lan}/lights/shadows/SpotLightShadow" - }, - - "Loaders": { - "AnimationLoader": "api/{lan}/loaders/AnimationLoader", - "AudioLoader": "api/{lan}/loaders/AudioLoader", - "BufferGeometryLoader": "api/{lan}/loaders/BufferGeometryLoader", - "Cache": "api/{lan}/loaders/Cache", - "CompressedTextureLoader": "api/{lan}/loaders/CompressedTextureLoader", - "CubeTextureLoader": "api/{lan}/loaders/CubeTextureLoader", - "DataTextureLoader": "api/{lan}/loaders/DataTextureLoader", - "FileLoader": "api/{lan}/loaders/FileLoader", - "FontLoader": "api/{lan}/loaders/FontLoader", - "ImageBitmapLoader": "api/{lan}/loaders/ImageBitmapLoader", - "ImageLoader": "api/{lan}/loaders/ImageLoader", - "JSONLoader": "api/{lan}/loaders/JSONLoader", - "Loader": "api/{lan}/loaders/Loader", - "LoaderUtils": "api/{lan}/loaders/LoaderUtils", - "MaterialLoader": "api/{lan}/loaders/MaterialLoader", - "ObjectLoader": "api/{lan}/loaders/ObjectLoader", - "TextureLoader": "api/{lan}/loaders/TextureLoader" - }, - - "Loaders / Managers": { - "DefaultLoadingManager": "api/{lan}/loaders/managers/DefaultLoadingManager", - "LoadingManager": "api/{lan}/loaders/managers/LoadingManager" - }, - - "Materials": { - "LineBasicMaterial": "api/{lan}/materials/LineBasicMaterial", - "LineDashedMaterial": "api/{lan}/materials/LineDashedMaterial", - "Material": "api/{lan}/materials/Material", - "MeshBasicMaterial": "api/{lan}/materials/MeshBasicMaterial", - "MeshDepthMaterial": "api/{lan}/materials/MeshDepthMaterial", - "MeshLambertMaterial": "api/{lan}/materials/MeshLambertMaterial", - "MeshNormalMaterial": "api/{lan}/materials/MeshNormalMaterial", - "MeshPhongMaterial": "api/{lan}/materials/MeshPhongMaterial", - "MeshPhysicalMaterial": "api/{lan}/materials/MeshPhysicalMaterial", - "MeshStandardMaterial": "api/{lan}/materials/MeshStandardMaterial", - "MeshToonMaterial": "api/{lan}/materials/MeshToonMaterial", - "PointsMaterial": "api/{lan}/materials/PointsMaterial", - "RawShaderMaterial": "api/{lan}/materials/RawShaderMaterial", - "ShaderMaterial": "api/{lan}/materials/ShaderMaterial", - "ShadowMaterial": "api/{lan}/materials/ShadowMaterial", - "SpriteMaterial": "api/{lan}/materials/SpriteMaterial" - }, - - "Math": { - "Box2": "api/{lan}/math/Box2", - "Box3": "api/{lan}/math/Box3", - "Color": "api/{lan}/math/Color", - "Cylindrical": "api/{lan}/math/Cylindrical", - "Euler": "api/{lan}/math/Euler", - "Frustum": "api/{lan}/math/Frustum", - "Interpolant": "api/{lan}/math/Interpolant", - "Line3": "api/{lan}/math/Line3", - "Math": "api/{lan}/math/Math", - "Matrix3": "api/{lan}/math/Matrix3", - "Matrix4": "api/{lan}/math/Matrix4", - "Plane": "api/{lan}/math/Plane", - "Quaternion": "api/{lan}/math/Quaternion", - "Ray": "api/{lan}/math/Ray", - "Sphere": "api/{lan}/math/Sphere", - "Spherical": "api/{lan}/math/Spherical", - "Triangle": "api/{lan}/math/Triangle", - "Vector2": "api/{lan}/math/Vector2", - "Vector3": "api/{lan}/math/Vector3", - "Vector4": "api/{lan}/math/Vector4" - }, - - "Math / Interpolants": { - "CubicInterpolant": "api/{lan}/math/interpolants/CubicInterpolant", - "DiscreteInterpolant": "api/{lan}/math/interpolants/DiscreteInterpolant", - "LinearInterpolant": "api/{lan}/math/interpolants/LinearInterpolant", - "QuaternionLinearInterpolant": "api/{lan}/math/interpolants/QuaternionLinearInterpolant" - }, - - "Objects": { - "Bone": "api/{lan}/objects/Bone", - "Group": "api/{lan}/objects/Group", - "Line": "api/{lan}/objects/Line", - "LineLoop": "api/{lan}/objects/LineLoop", - "LineSegments": "api/{lan}/objects/LineSegments", - "LOD": "api/{lan}/objects/LOD", - "Mesh": "api/{lan}/objects/Mesh", - "Points": "api/{lan}/objects/Points", - "Skeleton": "api/{lan}/objects/Skeleton", - "SkinnedMesh": "api/{lan}/objects/SkinnedMesh", - "Sprite": "api/{lan}/objects/Sprite" - }, - - "Renderers": { - "WebGLRenderer": "api/{lan}/renderers/WebGLRenderer", - "WebGLRenderTarget": "api/{lan}/renderers/WebGLRenderTarget", - "WebGLRenderTargetCube": "api/{lan}/renderers/WebGLRenderTargetCube" - }, - - "Renderers / Shaders": { - "ShaderChunk": "api/{lan}/renderers/shaders/ShaderChunk", - "ShaderLib": "api/{lan}/renderers/shaders/ShaderLib", - "UniformsLib": "api/{lan}/renderers/shaders/UniformsLib", - "UniformsUtils": "api/{lan}/renderers/shaders/UniformsUtils" - }, - - "Scenes": { - "Fog": "api/{lan}/scenes/Fog", - "FogExp2": "api/{lan}/scenes/FogExp2", - "Scene": "api/{lan}/scenes/Scene" - }, - - "Textures": { - "CanvasTexture": "api/{lan}/textures/CanvasTexture", - "CompressedTexture": "api/{lan}/textures/CompressedTexture", - "CubeTexture": "api/{lan}/textures/CubeTexture", - "DataTexture": "api/{lan}/textures/DataTexture", - "DepthTexture": "api/{lan}/textures/DepthTexture", - "Texture": "api/{lan}/textures/Texture", - "VideoTexture": "api/{lan}/textures/VideoTexture" - } - - }, - - "Examples": { - - "Animations": { - "CCDIKSolver": "examples/animations/CCDIKSolver", - "MMDAnimationHelper": "examples/animations/MMDAnimationHelper", - "MMDPhysics": "examples/animations/MMDPhysics" - }, - - "Controls": { - "OrbitControls": "examples/controls/OrbitControls" - }, - - "Geometries": { - "ConvexBufferGeometry": "examples/geometries/ConvexBufferGeometry", - "ConvexGeometry": "examples/geometries/ConvexGeometry", - "DecalGeometry": "examples/geometries/DecalGeometry" - }, - - "Loaders": { - "BabylonLoader": "examples/loaders/BabylonLoader", - "GLTFLoader": "examples/loaders/GLTFLoader", - "MMDLoader": "examples/loaders/MMDLoader", - "MTLLoader": "examples/loaders/MTLLoader", - "OBJLoader": "examples/loaders/OBJLoader", - "OBJLoader2": "examples/loaders/OBJLoader2", - "LoaderSupport": "examples/loaders/LoaderSupport", - "PCDLoader": "examples/loaders/PCDLoader", - "PDBLoader": "examples/loaders/PDBLoader", - "SVGLoader": "examples/loaders/SVGLoader", - "TGALoader": "examples/loaders/TGALoader", - "PRWMLoader": "examples/loaders/PRWMLoader" - }, - - "Objects": { - "Lensflare": "examples/objects/Lensflare", - }, - - "Exporters": { - "GLTFExporter": "examples/exporters/GLTFExporter", - "PLYExporter": "examples/exporters/PLYExporter" - }, - - "Plugins": { - "LookupTable": "examples/Lut", - "SpriteCanvasMaterial": "examples/SpriteCanvasMaterial" - }, - - "QuickHull": { - "Face": "examples/quickhull/Face", - "HalfEdge": "examples/quickhull/HalfEdge", - "QuickHull": "examples/quickhull/QuickHull", - "VertexNode": "examples/quickhull/VertexNode", - "VertexList": "examples/quickhull/VertexList" - }, - - "Renderers": { - "CanvasRenderer": "examples/renderers/CanvasRenderer", - "CSS2DRenderer": "examples/renderers/CSS2DRenderer", - "CSS3DRenderer": "examples/renderers/CSS3DRenderer", - "SVGRenderer": "examples/renderers/SVGRenderer" - - }, - - "Utils": { - "BufferGeometryUtils": "examples/utils/BufferGeometryUtils", - "SceneUtils": "examples/utils/SceneUtils" - } - - }, - - "Developer Reference": { - - "Polyfills": { - "Polyfills": "api/{lan}/Polyfills" - }, + "zh": { + + "Manual": { + + "Getting Started": { + "创建一个场景": "manual/zh/introduction/Creating-a-scene", + "通过模块来引入": "manual/zh/introduction/Import-via-modules", + "浏览器支持": "manual/zh/introduction/Browser-support", + "WebGL兼容性检查": "manual/zh/introduction/WebGL-compatibility-check", + "如何在本地运行Three.js": "manual/zh/introduction/How-to-run-things-locally", + "画线": "manual/zh/introduction/Drawing-lines", + "创建文字": "manual/zh/introduction/Creating-text", + "载入3D模型": "manual/zh/introduction/Loading-3D-models", + "迁移指南": "manual/zh/introduction/Migration-guide", + "代码风格指南": "manual/zh/introduction/Code-style-guide", + "常见问题": "manual/zh/introduction/FAQ", + "一些有用的链接": "manual/zh/introduction/Useful-links" + }, + + "Next Steps": { + "How to update things": "manual/zh/introduction/How-to-update-things", + "Matrix transformations": "manual/zh/introduction/Matrix-transformations", + "Animation system": "manual/zh/introduction/Animation-system" + }, + + "Build Tools": { + "Testing with NPM": "manual/zh/buildTools/Testing-with-NPM" + } + + }, + + "Reference": { + + "Animation": { + "AnimationAction": "api/zh/animation/AnimationAction", + "AnimationClip": "api/zh/animation/AnimationClip", + "AnimationMixer": "api/zh/animation/AnimationMixer", + "AnimationObjectGroup": "api/zh/animation/AnimationObjectGroup", + "AnimationUtils": "api/zh/animation/AnimationUtils", + "KeyframeTrack": "api/zh/animation/KeyframeTrack", + "PropertyBinding": "api/zh/animation/PropertyBinding", + "PropertyMixer": "api/zh/animation/PropertyMixer" + }, + + "Animation / Tracks": { + "BooleanKeyframeTrack": "api/zh/animation/tracks/BooleanKeyframeTrack", + "ColorKeyframeTrack": "api/zh/animation/tracks/ColorKeyframeTrack", + "NumberKeyframeTrack": "api/zh/animation/tracks/NumberKeyframeTrack", + "QuaternionKeyframeTrack": "api/zh/animation/tracks/QuaternionKeyframeTrack", + "StringKeyframeTrack": "api/zh/animation/tracks/StringKeyframeTrack", + "VectorKeyframeTrack": "api/zh/animation/tracks/VectorKeyframeTrack" + }, + + "Audio": { + "Audio": "api/zh/audio/Audio", + "AudioAnalyser": "api/zh/audio/AudioAnalyser", + "AudioContext": "api/zh/audio/AudioContext", + "AudioListener": "api/zh/audio/AudioListener", + "PositionalAudio": "api/zh/audio/PositionalAudio" + }, + + "Cameras": { + "ArrayCamera": "api/zh/cameras/ArrayCamera", + "Camera": "api/zh/cameras/Camera", + "CubeCamera": "api/zh/cameras/CubeCamera", + "OrthographicCamera": "api/zh/cameras/OrthographicCamera", + "PerspectiveCamera": "api/zh/cameras/PerspectiveCamera", + "StereoCamera": "api/zh/cameras/StereoCamera" + }, + + "Constants": { + "Animation": "api/zh/constants/Animation", + "Core": "api/zh/constants/Core", + "CustomBlendingEquation": "api/zh/constants/CustomBlendingEquations", + "DrawModes": "api/zh/constants/DrawModes", + "Materials": "api/zh/constants/Materials", + "Renderer": "api/zh/constants/Renderer", + "Textures": "api/zh/constants/Textures" + }, + + "Core": { + "BufferAttribute": "api/zh/core/BufferAttribute", + "BufferGeometry": "api/zh/core/BufferGeometry", + "Clock": "api/zh/core/Clock", + "DirectGeometry": "api/zh/core/DirectGeometry", + "EventDispatcher": "api/zh/core/EventDispatcher", + "Face3": "api/zh/core/Face3", + "Geometry": "api/zh/core/Geometry", + "InstancedBufferAttribute": "api/zh/core/InstancedBufferAttribute", + "InstancedBufferGeometry": "api/zh/core/InstancedBufferGeometry", + "InstancedInterleavedBuffer": "api/zh/core/InstancedInterleavedBuffer", + "InterleavedBuffer": "api/zh/core/InterleavedBuffer", + "InterleavedBufferAttribute": "api/zh/core/InterleavedBufferAttribute", + "Layers": "api/zh/core/Layers", + "Object3D": "api/zh/core/Object3D", + "Raycaster": "api/zh/core/Raycaster", + "Uniform": "api/zh/core/Uniform" + }, + + "Core / BufferAttributes": { + "BufferAttribute Types": "api/zh/core/bufferAttributeTypes/BufferAttributeTypes" + }, + + "Deprecated": { + "DeprecatedList": "api/zh/deprecated/DeprecatedList" + }, + + "Extras": { + "Earcut": "api/zh/extras/Earcut", + "ShapeUtils": "api/zh/extras/ShapeUtils" + }, + + "Extras / Core": { + "Curve": "api/zh/extras/core/Curve", + "CurvePath": "api/zh/extras/core/CurvePath", + "Font": "api/zh/extras/core/Font", + "Interpolations": "api/zh/extras/core/Interpolations", + "Path": "api/zh/extras/core/Path", + "Shape": "api/zh/extras/core/Shape", + "ShapePath": "api/zh/extras/core/ShapePath" + }, + + "Extras / Curves": { + "ArcCurve": "api/zh/extras/curves/ArcCurve", + "CatmullRomCurve3": "api/zh/extras/curves/CatmullRomCurve3", + "CubicBezierCurve": "api/zh/extras/curves/CubicBezierCurve", + "CubicBezierCurve3": "api/zh/extras/curves/CubicBezierCurve3", + "EllipseCurve": "api/zh/extras/curves/EllipseCurve", + "LineCurve": "api/zh/extras/curves/LineCurve", + "LineCurve3": "api/zh/extras/curves/LineCurve3", + "QuadraticBezierCurve": "api/zh/extras/curves/QuadraticBezierCurve", + "QuadraticBezierCurve3": "api/zh/extras/curves/QuadraticBezierCurve3", + "SplineCurve": "api/zh/extras/curves/SplineCurve" + }, + + "Extras / Objects": { + "ImmediateRenderObject": "api/zh/extras/objects/ImmediateRenderObject", + }, + + "Geometries": { + "BoxBufferGeometry": "api/zh/geometries/BoxBufferGeometry", + "BoxGeometry": "api/zh/geometries/BoxGeometry", + "CircleBufferGeometry": "api/zh/geometries/CircleBufferGeometry", + "CircleGeometry": "api/zh/geometries/CircleGeometry", + "ConeBufferGeometry": "api/zh/geometries/ConeBufferGeometry", + "ConeGeometry": "api/zh/geometries/ConeGeometry", + "CylinderBufferGeometry": "api/zh/geometries/CylinderBufferGeometry", + "CylinderGeometry": "api/zh/geometries/CylinderGeometry", + "DodecahedronBufferGeometry": "api/zh/geometries/DodecahedronBufferGeometry", + "DodecahedronGeometry": "api/zh/geometries/DodecahedronGeometry", + "EdgesGeometry": "api/zh/geometries/EdgesGeometry", + "ExtrudeBufferGeometry": "api/zh/geometries/ExtrudeBufferGeometry", + "ExtrudeGeometry": "api/zh/geometries/ExtrudeGeometry", + "IcosahedronBufferGeometry": "api/zh/geometries/IcosahedronBufferGeometry", + "IcosahedronGeometry": "api/zh/geometries/IcosahedronGeometry", + "LatheBufferGeometry": "api/zh/geometries/LatheBufferGeometry", + "LatheGeometry": "api/zh/geometries/LatheGeometry", + "OctahedronBufferGeometry": "api/zh/geometries/OctahedronBufferGeometry", + "OctahedronGeometry": "api/zh/geometries/OctahedronGeometry", + "ParametricBufferGeometry": "api/zh/geometries/ParametricBufferGeometry", + "ParametricGeometry": "api/zh/geometries/ParametricGeometry", + "PlaneBufferGeometry": "api/zh/geometries/PlaneBufferGeometry", + "PlaneGeometry": "api/zh/geometries/PlaneGeometry", + "PolyhedronBufferGeometry": "api/zh/geometries/PolyhedronBufferGeometry", + "PolyhedronGeometry": "api/zh/geometries/PolyhedronGeometry", + "RingBufferGeometry": "api/zh/geometries/RingBufferGeometry", + "RingGeometry": "api/zh/geometries/RingGeometry", + "ShapeBufferGeometry": "api/zh/geometries/ShapeBufferGeometry", + "ShapeGeometry": "api/zh/geometries/ShapeGeometry", + "SphereBufferGeometry": "api/zh/geometries/SphereBufferGeometry", + "SphereGeometry": "api/zh/geometries/SphereGeometry", + "TetrahedronBufferGeometry": "api/zh/geometries/TetrahedronBufferGeometry", + "TetrahedronGeometry": "api/zh/geometries/TetrahedronGeometry", + "TextBufferGeometry": "api/zh/geometries/TextBufferGeometry", + "TextGeometry": "api/zh/geometries/TextGeometry", + "TorusBufferGeometry": "api/zh/geometries/TorusBufferGeometry", + "TorusGeometry": "api/zh/geometries/TorusGeometry", + "TorusKnotBufferGeometry": "api/zh/geometries/TorusKnotBufferGeometry", + "TorusKnotGeometry": "api/zh/geometries/TorusKnotGeometry", + "TubeBufferGeometry": "api/zh/geometries/TubeBufferGeometry", + "TubeGeometry": "api/zh/geometries/TubeGeometry", + "WireframeGeometry": "api/zh/geometries/WireframeGeometry" + }, + + "Helpers": { + "ArrowHelper": "api/zh/helpers/ArrowHelper", + "AxesHelper": "api/zh/helpers/AxesHelper", + "BoxHelper": "api/zh/helpers/BoxHelper", + "Box3Helper": "api/zh/helpers/Box3Helper", + "CameraHelper": "api/zh/helpers/CameraHelper", + "DirectionalLightHelper": "api/zh/helpers/DirectionalLightHelper", + "FaceNormalsHelper": "api/zh/helpers/FaceNormalsHelper", + "GridHelper": "api/zh/helpers/GridHelper", + "PolarGridHelper": "api/zh/helpers/PolarGridHelper", + "HemisphereLightHelper": "api/zh/helpers/HemisphereLightHelper", + "PlaneHelper": "api/zh/helpers/PlaneHelper", + "PointLightHelper": "api/zh/helpers/PointLightHelper", + "RectAreaLightHelper": "api/zh/helpers/RectAreaLightHelper", + "SkeletonHelper": "api/zh/helpers/SkeletonHelper", + "SpotLightHelper": "api/zh/helpers/SpotLightHelper", + "VertexNormalsHelper": "api/zh/helpers/VertexNormalsHelper" + }, + + "Lights": { + "AmbientLight": "api/zh/lights/AmbientLight", + "DirectionalLight": "api/zh/lights/DirectionalLight", + "HemisphereLight": "api/zh/lights/HemisphereLight", + "Light": "api/zh/lights/Light", + "PointLight": "api/zh/lights/PointLight", + "RectAreaLight": "api/zh/lights/RectAreaLight", + "SpotLight": "api/zh/lights/SpotLight" + }, + + "Lights / Shadows": { + "DirectionalLightShadow": "api/zh/lights/shadows/DirectionalLightShadow", + "LightShadow": "api/zh/lights/shadows/LightShadow", + "SpotLightShadow": "api/zh/lights/shadows/SpotLightShadow" + }, + + "Loaders": { + "AnimationLoader": "api/zh/loaders/AnimationLoader", + "AudioLoader": "api/zh/loaders/AudioLoader", + "BufferGeometryLoader": "api/zh/loaders/BufferGeometryLoader", + "Cache": "api/zh/loaders/Cache", + "CompressedTextureLoader": "api/zh/loaders/CompressedTextureLoader", + "CubeTextureLoader": "api/zh/loaders/CubeTextureLoader", + "DataTextureLoader": "api/zh/loaders/DataTextureLoader", + "FileLoader": "api/zh/loaders/FileLoader", + "FontLoader": "api/zh/loaders/FontLoader", + "ImageBitmapLoader": "api/zh/loaders/ImageBitmapLoader", + "ImageLoader": "api/zh/loaders/ImageLoader", + "JSONLoader": "api/zh/loaders/JSONLoader", + "Loader": "api/zh/loaders/Loader", + "LoaderUtils": "api/zh/loaders/LoaderUtils", + "MaterialLoader": "api/zh/loaders/MaterialLoader", + "ObjectLoader": "api/zh/loaders/ObjectLoader", + "TextureLoader": "api/zh/loaders/TextureLoader" + }, + + "Loaders / Managers": { + "DefaultLoadingManager": "api/zh/loaders/managers/DefaultLoadingManager", + "LoadingManager": "api/zh/loaders/managers/LoadingManager" + }, + + "Materials": { + "LineBasicMaterial": "api/zh/materials/LineBasicMaterial", + "LineDashedMaterial": "api/zh/materials/LineDashedMaterial", + "Material": "api/zh/materials/Material", + "MeshBasicMaterial": "api/zh/materials/MeshBasicMaterial", + "MeshDepthMaterial": "api/zh/materials/MeshDepthMaterial", + "MeshLambertMaterial": "api/zh/materials/MeshLambertMaterial", + "MeshNormalMaterial": "api/zh/materials/MeshNormalMaterial", + "MeshPhongMaterial": "api/zh/materials/MeshPhongMaterial", + "MeshPhysicalMaterial": "api/zh/materials/MeshPhysicalMaterial", + "MeshStandardMaterial": "api/zh/materials/MeshStandardMaterial", + "MeshToonMaterial": "api/zh/materials/MeshToonMaterial", + "PointsMaterial": "api/zh/materials/PointsMaterial", + "RawShaderMaterial": "api/zh/materials/RawShaderMaterial", + "ShaderMaterial": "api/zh/materials/ShaderMaterial", + "ShadowMaterial": "api/zh/materials/ShadowMaterial", + "SpriteMaterial": "api/zh/materials/SpriteMaterial" + }, + + "Math": { + "Box2": "api/zh/math/Box2", + "Box3": "api/zh/math/Box3", + "Color": "api/zh/math/Color", + "Cylindrical": "api/zh/math/Cylindrical", + "Euler": "api/zh/math/Euler", + "Frustum": "api/zh/math/Frustum", + "Interpolant": "api/zh/math/Interpolant", + "Line3": "api/zh/math/Line3", + "Math": "api/zh/math/Math", + "Matrix3": "api/zh/math/Matrix3", + "Matrix4": "api/zh/math/Matrix4", + "Plane": "api/zh/math/Plane", + "Quaternion": "api/zh/math/Quaternion", + "Ray": "api/zh/math/Ray", + "Sphere": "api/zh/math/Sphere", + "Spherical": "api/zh/math/Spherical", + "Triangle": "api/zh/math/Triangle", + "Vector2": "api/zh/math/Vector2", + "Vector3": "api/zh/math/Vector3", + "Vector4": "api/zh/math/Vector4" + }, + + "Math / Interpolants": { + "CubicInterpolant": "api/zh/math/interpolants/CubicInterpolant", + "DiscreteInterpolant": "api/zh/math/interpolants/DiscreteInterpolant", + "LinearInterpolant": "api/zh/math/interpolants/LinearInterpolant", + "QuaternionLinearInterpolant": "api/zh/math/interpolants/QuaternionLinearInterpolant" + }, + + "Objects": { + "Bone": "api/zh/objects/Bone", + "Group": "api/zh/objects/Group", + "Line": "api/zh/objects/Line", + "LineLoop": "api/zh/objects/LineLoop", + "LineSegments": "api/zh/objects/LineSegments", + "LOD": "api/zh/objects/LOD", + "Mesh": "api/zh/objects/Mesh", + "Points": "api/zh/objects/Points", + "Skeleton": "api/zh/objects/Skeleton", + "SkinnedMesh": "api/zh/objects/SkinnedMesh", + "Sprite": "api/zh/objects/Sprite" + }, + + "Renderers": { + "WebGLRenderer": "api/zh/renderers/WebGLRenderer", + "WebGLRenderTarget": "api/zh/renderers/WebGLRenderTarget", + "WebGLRenderTargetCube": "api/zh/renderers/WebGLRenderTargetCube" + }, + + "Renderers / Shaders": { + "ShaderChunk": "api/zh/renderers/shaders/ShaderChunk", + "ShaderLib": "api/zh/renderers/shaders/ShaderLib", + "UniformsLib": "api/zh/renderers/shaders/UniformsLib", + "UniformsUtils": "api/zh/renderers/shaders/UniformsUtils" + }, + + "Scenes": { + "Fog": "api/zh/scenes/Fog", + "FogExp2": "api/zh/scenes/FogExp2", + "Scene": "api/zh/scenes/Scene" + }, + + "Textures": { + "CanvasTexture": "api/zh/textures/CanvasTexture", + "CompressedTexture": "api/zh/textures/CompressedTexture", + "CubeTexture": "api/zh/textures/CubeTexture", + "DataTexture": "api/zh/textures/DataTexture", + "DepthTexture": "api/zh/textures/DepthTexture", + "Texture": "api/zh/textures/Texture", + "VideoTexture": "api/zh/textures/VideoTexture" + } + + }, + + "Examples": { + + "Animations": { + "CCDIKSolver": "examples/animations/CCDIKSolver", + "MMDAnimationHelper": "examples/animations/MMDAnimationHelper", + "MMDPhysics": "examples/animations/MMDPhysics" + }, + + "Controls": { + "OrbitControls": "examples/controls/OrbitControls" + }, + + "Geometries": { + "ConvexBufferGeometry": "examples/geometries/ConvexBufferGeometry", + "ConvexGeometry": "examples/geometries/ConvexGeometry", + "DecalGeometry": "examples/geometries/DecalGeometry" + }, + + "Loaders": { + "BabylonLoader": "examples/loaders/BabylonLoader", + "GLTFLoader": "examples/loaders/GLTFLoader", + "MMDLoader": "examples/loaders/MMDLoader", + "MTLLoader": "examples/loaders/MTLLoader", + "OBJLoader": "examples/loaders/OBJLoader", + "OBJLoader2": "examples/loaders/OBJLoader2", + "LoaderSupport": "examples/loaders/LoaderSupport", + "PCDLoader": "examples/loaders/PCDLoader", + "PDBLoader": "examples/loaders/PDBLoader", + "SVGLoader": "examples/loaders/SVGLoader", + "TGALoader": "examples/loaders/TGALoader", + "PRWMLoader": "examples/loaders/PRWMLoader" + }, + + "Objects": { + "Lensflare": "examples/objects/Lensflare", + }, + + "Exporters": { + "GLTFExporter": "examples/exporters/GLTFExporter", + "PLYExporter": "examples/exporters/PLYExporter" + }, + + "Plugins": { + "LookupTable": "examples/Lut", + "SpriteCanvasMaterial": "examples/SpriteCanvasMaterial" + }, + + "QuickHull": { + "Face": "examples/quickhull/Face", + "HalfEdge": "examples/quickhull/HalfEdge", + "QuickHull": "examples/quickhull/QuickHull", + "VertexNode": "examples/quickhull/VertexNode", + "VertexList": "examples/quickhull/VertexList" + }, + + "Renderers": { + "CanvasRenderer": "examples/renderers/CanvasRenderer", + "CSS2DRenderer": "examples/renderers/CSS2DRenderer", + "CSS3DRenderer": "examples/renderers/CSS3DRenderer", + "SVGRenderer": "examples/renderers/SVGRenderer" + + }, + + "Utils": { + "BufferGeometryUtils": "examples/utils/BufferGeometryUtils", + "SceneUtils": "examples/utils/SceneUtils" + } + + }, + + "Developer Reference": { + + "Polyfills": { + "Polyfills": "api/zh/Polyfills" + }, + + "WebGLRenderer": { + "WebGLProgram": "api/zh/renderers/webgl/WebGLProgram", + "WebGLShader": "api/zh/renderers/webgl/WebGLShader", + "WebGLState": "api/zh/renderers/webgl/WebGLState" + } - "WebGLRenderer": { - "WebGLProgram": "api/{lan}/renderers/webgl/WebGLProgram", - "WebGLShader": "api/{lan}/renderers/webgl/WebGLShader", - "WebGLState": "api/{lan}/renderers/webgl/WebGLState" } } diff --git a/docs/manual/en/introduction/How-to-create-VR-content.html b/docs/manual/en/introduction/How-to-create-VR-content.html new file mode 100644 index 00000000000000..b004c6c931a4a2 --- /dev/null +++ b/docs/manual/en/introduction/How-to-create-VR-content.html @@ -0,0 +1,84 @@ + + + + + + + + + + + + +

[name]

+
+ +

+ This guide provides a brief overview of the basic components of a web-based VR application + made with three.js. +

+ +

Workflow

+ +

+ First, you have to include [link:https://github.com/mrdoob/three.js/blob/master/examples/js/vr/WebVR.js WebVR.js] + into your project. +

+ + +<script src="/path/to/WebVR.js"></script> + + +

+ *WEBVR.createButton()* does two important things: It creates a button which indicates + VR compatibility. Besides, it initiates a VR session if the user activates the button. The only thing you have + to do is to add the following line of code to your app. +

+ + +document.body.appendChild( WEBVR.createButton( renderer ) ); + + +

+ Next, you have to tell your instance of *WebGLRenderer* to enable VR rendering. +

+ + +renderer.vr.enabled = true; + + +

+ Finally, you have to adjust your animation loop since we can't use our well known + *window.requestAnimationFrame()* function. For VR projects we use [page:WebGLRenderer.setAnimationLoop setAnimationLoop]. + The minimal code looks like this: +

+ + +renderer.setAnimationLoop( function () { + + renderer.render( scene, camera ); + +} ); + + +

Next Steps

+ +

+ Have a look at one of the official WebVR examples to see this workflow in action.

+ + [example:webvr_ballshooter WebVR / ballshoter]
+ [example:webvr_cubes WebVR / cubes]
+ [example:webvr_dragging WebVR / dragging]
+ [example:webvr_lorenzattractor WebVR / lorenzattractor]
+ [example:webvr_panorama WebVR / panorama]
+ [example:webvr_paint WebVR / paint]
+ [example:webvr_rollercoaster WebVR / rollercoaster]
+ [example:webvr_sandbox WebVR / sandbox]
+ [example:webvr_sculpt WebVR / sculpt]
+ [example:webvr_vive_paint WebVR / vive / paint]
+ [example:webvr_vive_sculpt WebVR / vive / sculpt]
+

+ + + + diff --git a/docs/manual/zh/buildTools/Testing-with-NPM.html b/docs/manual/zh/buildTools/Testing-with-NPM.html new file mode 100644 index 00000000000000..3f6a7c4aef6590 --- /dev/null +++ b/docs/manual/zh/buildTools/Testing-with-NPM.html @@ -0,0 +1,258 @@ + + + + + + + + + + +

[name]

+ +

+ This article shows how to get three.js into a [link:https://nodejs.org/en/ node.js] environment so that you + can execute automated tests. Tests can be run on the command line, or by automated + CI tools like [link:https://travis-ci.org/ Travis]. +

+ +

The short version

+ +

+ If you're comfortable with node and npm, + + $ npm install three --save-dev + + and add + + var THREE = require('three'); + + to your test. +

+ +

Create a testable project from scratch

+

+ If you're not familiar with these tools, here's a quick guide (for linux, the installation process + will be slightly different using windows, but the NPM commands are identical). +

+ +

Basic setup

+
+
    +
  1. + Install [link:https://www.npmjs.org/ npm] and nodejs. The shortest path typically looks something like + +$ sudo apt-get install -y npm nodejs-legacy +# fix any problems with SSL in the default registry URL +$ npm config set registry http://registry.npmjs.org/ + +
  2. + +
  3. + Make a new project directory + + $ mkdir test-example; cd test-example + +
  4. + +
  5. + Ask npm to create a new project file for you: + + $ npm init + + and accept all defaults by hitting Enter on all the prompts. + This will create package.json. +

  6. + +
  7. + Try and start the test feature with + +$ npm test + + This will fail, which is expected. + If you look in the package.json, the definition of the test script is + + "test": "echo \"Error: no test specified\" && exit 1" + +
  8. + +
+
+ +

Add mocha

+
+ We're going to use [link:https://mochajs.org/ mocha]. + +
    +
  1. + Install mocha with + +$ npm install mocha --save-dev + + Notice that node_modules/ is created and your dependencies appear in there. + Also notice that your package.json has been updated: the property devDependencies + is added and updated by the use of --save-dev. +

  2. + +
  3. + Edit package.json to use mocha for testing. When test is invoked, we just want to run + mocha and specify a verbose reporter. By default this will run anything in test/ + (not having directory test/ can run into npm ERR!, create it by mkdir test) + + "test": "mocha --reporter list" + +
  4. + +
  5. + Rerun the test with + + $ npm test + + + This should now succeed, reporting 0 passing (1ms) + or similar. +
  6. + +
+
+ +

Add three.js

+
+
    +
  1. + Let's pull in our three.js dependency with + +$ npm install three --save-dev + +
      +
    • + If you need a different three version, use + + $ npm show three versions + + to see + what's available. To tell npm the right one, use + + $ npm install three@0.84.0 --save + + (0.84.0 in this example). --save makes this a dependency of this project, rather than + dev dependency. See the docs [link:https://www.npmjs.org/doc/json.html here] for more info. +
    • +
    +
  2. + +
  3. + Mocha will look for tests in test/, so let's + + $ mkdir test + +
  4. + +
  5. + Finally we actually need a JS test to run. Let's add a simple test that will verify that + the three.js object is available and working. Create test/verify-three.js containing: + +var THREE = require('three'); +var assert = require("assert"); + +describe('The THREE object', function() { + it('should have a defined BasicShadowMap constant', function() { + assert.notEqual('undefined', THREE.BasicShadowMap); + }), + + it('should be able to construct a Vector3 with default of x=0', function() { + var vec3 = new THREE.Vector3(); + assert.equal(0, vec3.x); + }) +}) + +
  6. + +
  7. + Finally let's test again with $ npm test. This should run the tests above and succeed, + showing something like: + +The THREE object should have a defined BasicShadowMap constant: 0ms +The THREE object should be able to construct a Vector3 with default of x=0: 0ms +2 passing (8ms) + +
  8. +
+
+ +

Add your own code

+
+ You need to do three things: + +
    +
  1. + Write a test for the expected behaviour of your code, and place it under test/. + [link:https://github.com/air/encounter/blob/master/test/Physics-test.js Here] is an example from a real project. +
  2. + +
  3. + Export your functional code in such a way that nodejs can see it, for use in conjunction with require. + See it [link:https://github.com/air/encounter/blob/master/js/Physics.js here]. +
  4. + +
  5. + Require your code into the test file, in the same way we did a require('three') in the example above. +
  6. +
+ +

+ Items 2 and 3 will vary depending on how you manage your code. In the example of Physics.js + given above, the export part is right at the end. We assign an object to module.exports: +

+ +//============================================================================= +// make available in nodejs +//============================================================================= +if (typeof exports !== 'undefined') +{ + module.exports = Physics; +} + +
+ +

Dealing with dependencies

+
+

+ If you're already using something clever like require.js or browserify, skip this part. +

+

+ Typically a three.js project is going to run in the browser. Module loading is hence done by + the browser executing a bunch of script tags. Your individual files don't have to worry + about dependencies. In a nodejs context however, there is no index.html binding everything + together, so you have to be explicit. +

+

+ If you're exporting a module that depends on other files, you're going to have to tell node to load them. + Here is one approach: +

+
    +
  1. + At the start of your module, check to see if you're in a nodejs environment. +
  2. +
  3. + If so, explicitly declare your dependencies. +
  4. +
  5. + If not, you're probably in a browser so you don't need to do anything else. +
  6. +
+ Example code from Physics.js: + +//============================================================================= +// setup for server-side testing +//============================================================================= +if (typeof require === 'function') // test for nodejs environment +{ + var THREE = require('three'); + var MY3 = require('./MY3.js'); +} + +
+ + + diff --git a/docs/manual/zh/introduction/Animation-system.html b/docs/manual/zh/introduction/Animation-system.html new file mode 100644 index 00000000000000..0e8a8586a9117a --- /dev/null +++ b/docs/manual/zh/introduction/Animation-system.html @@ -0,0 +1,131 @@ + + + + + + + + + + +

[name]

+ +

Overview(概述)

+ +

+ 在three.js动画系统中,您可以为模型的各种属性设置动画: + [page:SkinnedMesh 蒙皮和装配模型]的骨头,[page:Geometry.morphTargets 变形目标],不同的材料属性(颜色, + 不透明度,布尔运算),可见性和变换。 动画属性可以淡入,淡出,交叉淡化和扭曲。 不同时间的重量和时间尺度 + 可以更改同一对象以及不同对象上的动画独立。 可以在相同和不同对象上进行各种动画同步。 +

+ 在一个同构系统中实现所有这一切,即three.js动画系统 + [link:https://github.com/mrdoob/three.js/issues/6881在2015年彻底改变] + (注意过时的信息!),它现在有一个与Unity /虚幻引擎4类似的架构.此页面简要概述了主要组件系统以及它们如何协同工作。 +

+ +

Animation Clips(动画片段)

+ +

+ 如果您已成功导入动画3D对象(如果有,则无关紧要) + 骨骼或变形目标或两者) - 例如使用[link:https://github.com/KhronosGroup/glTF-Blender-Exporter glTF Blender导出器]从Blender导出它 + 使用[page:GLTFLoader]将其加载到three.js场景中 - 其中一个响应字段应该是一个名为“animations”的数组,其中包含此模型的[page:AnimationClip AnimationClips](请参阅下面的可能加载器列表)。 +

+ 每个* AnimationClip *通常保存对象的某个活动的数据。 如果 + mesh是一个字符,例如,可以有一个用于walkcycle的动画片段,第二个 + 跳跃,三分之一的回避等等。 +

+ +

Keyframe Tracks(关键帧轨道)

+ +

+ 在这样的* AnimationClip *里面,每个动画属性的数据都存储在一个 + 单独[page:KeyframeTrack]。 假设一个角色对象有一个[page:Skeleton skeleton], + 一个关键帧轨道可以存储下臂骨骼位置变化的数据 + 随着时间的推移,不同的轨道数据为同一骨骼的旋转变化,三分之一 + 轨道位置,旋转或缩放另一个骨骼,等等。 应该很清楚, + AnimationClip可以由许多这样的轨道组成。 + .

+ 假设模型具有[page:Geometry.morphTargets 变形目标](例如一个变形 + 目标显示一个友好的面孔,另一个显示愤怒的脸),每个轨道持有 + 关于某个变形的[page:Mesh.morphTargetInfluences 影响]的信息 + 目标在剪辑执行期间发生变化。 +

+ +

Animation Mixer(动画混音器)

+ +

+ 存储的数据仅构成动画的基础 - 实际播放由控制 + [page:AnimationMixer]。 你可以想象这不仅仅是动画的播放器,而是 + 作为硬件的模拟,如真正的调音台控制台,可以控制几个动画 + 同时,混合和合并它们。 +

+ +

Animation Actions

+ +

+ * AnimationMixer *本身只有很少(通用)属性和方法,因为它 + 可以通过[page:AnimationAction AnimationActions]来控制。 通过配置 + * AnimationAction *您可以确定何时播放某个* AnimationClip *,暂停 + 或者停在其中一个混音器上,是否以及频率必须重复,无论是否 + 应使用淡入淡出或时间缩放以及一些其他内容(例如交叉渐变)来执行 + 或同步。 +

+ +

Animation Object Groups(动画对象组)

+ +

+ 如果您希望一组对象接收共享动画状态,则可以使用[page:AnimationObjectGroup]. + +

+ +

Supported Formats and Loaders(支持的格式和加载器)

+ +

+ 请注意,并非所有模型格式都包含动画(尤其是OBJ,没有),而且只有一些 + three.js加载器支持[page:AnimationClip AnimationClip]序列。 以下几个确实 + 支持此动画类型: +

+ +
    +
  • [page:JSONLoader THREE.JSONLoader]
  • +
  • [page:ObjectLoader THREE.ObjectLoader]
  • +
  • THREE.BVHLoader
  • +
  • THREE.ColladaLoader
  • +
  • THREE.FBXLoader
  • +
  • [page:GLTFLoader THREE.GLTFLoader]
  • +
  • THREE.MMDLoader
  • +
  • THREE.SEA3DLoader
  • +
+ +

+ 请注意,3ds max和Maya当前无法导出多个动画(这意味着动画不是 + 在同一时间线上)直接到一个文件。 +

+ +

Example

+ + + var mesh; + + // Create an AnimationMixer, and get the list of AnimationClip instances + var mixer = new THREE.AnimationMixer( mesh ); + var clips = mesh.animations; + + // Update the mixer on each frame + function update () { + mixer.update( deltaSeconds ); + } + + // Play a specific animation + var clip = THREE.AnimationClip.findByName( clips, 'dance' ); + var action = mixer.clipAction( clip ); + action.play(); + + // Play all animations + clips.forEach( function ( clip ) { + mixer.clipAction( clip ).play(); + } ); + + + + diff --git a/docs/manual/zh/introduction/Browser-support.html b/docs/manual/zh/introduction/Browser-support.html new file mode 100644 index 00000000000000..d6e37b0da072a8 --- /dev/null +++ b/docs/manual/zh/introduction/Browser-support.html @@ -0,0 +1,125 @@ + + + + + + + + + + +

浏览器支持([name])

+ +

总览

+
+

+ 在所有现代浏览器中,Three.js可以使用WebGL来渲染场景。对于较旧的浏览器,特别是Internet Explorer 10或者更低版本浏览器,你将需要回落到其它[link:https://github.com/mrdoob/three.js/tree/master/examples/js/renderers renderers](CSS2DRenderer、CSS3DRenderer、SVGRenderer、CanvasRenderer)。此外,你或许不得不包含一些额外的“填充物”来解决兼容性问题,特别是当你使用[link:https://github.com/mrdoob/three.js/tree/master/examples /examples]目录中的文件时。 +

+

+ 注意:如果你并不需要支持较旧的浏览器,那就不推荐使用其他渲染器来进行渲染,因为与WebGLRenderer相比,其它渲染器渲染较慢,并且不支持WebGL的诸多特性。 +

+
+ +

支持WebGL的渲染器

+
+

+ Google Chrome 9+、Firefox 4+、Opera 15+、Safari 5.1+、Internet Explorer 11 和 Microsoft Edge。你可以点击[link:https://caniuse.com/#feat=webgl Can I use WebGL]来查阅各个浏览器对WebGL的支持性。 +

+
+ +

+ 在Three.js中所使用到的JavaScript语言特性或者Web API +

+
+

+ 这里是一些在Three.js中使用到的特性,其中的一部分需要额外的“填充物”来解决兼容性问题。 +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
特性适用范围模块
Typed ArraysSourceBufferAttribute, BufferGeometry, etc.
Web Audio APISourceAudio, AudioContext, AudioListener, etc.
WebVR APISourceWebVRManager, etc.
BlobSourceFileLoader, etc.
PromiseExamplesGLTFLoader, GLTFExporter, WebVR, VREffect, etc.
FetchExamplesImageBitmapLoader, etc.
File APIExamplesGLTFExporter, etc.
URL APIExamplesGLTFLoader, etc.
Pointer Lock APIExamplesPointerLockControls
+
+ +

关于用于解决兼容性问题的“填充物”

+
+

根据你的需求,引入相关的“填充物”即可。以IE9为例,你至少需要来使用“填充物”完成以下的功能。

+
    +
  • Typed Arrays
  • +
  • Blob
  • +
+
+ +

建议的“填充物”

+
+
    +
  • + [link:https://github.com/zloirock/core-js core-js] +
  • +
  • + [link:https://github.com/inexorabletash/polyfill/blob/master/typedarray.js typedarray.js] +
  • +
  • + [link:https://github.com/stefanpenner/es6-promise/ ES6-Promise] +
  • +
  • + [link:https://github.com/eligrey/Blob.js Blob.js] +
  • +
  • + [link:https://github.com/github/fetch fetch] +
  • +
+
+ + diff --git a/docs/manual/zh/introduction/Code-style-guide.html b/docs/manual/zh/introduction/Code-style-guide.html new file mode 100644 index 00000000000000..ec7beb97b7e2ad --- /dev/null +++ b/docs/manual/zh/introduction/Code-style-guide.html @@ -0,0 +1,22 @@ + + + + + + + + + + +

代码风格指南([name])

+ +

+ 在three.js中的所有文档和示例使用的是Mr.doob的代码风格。 + 当然,你也可以自由选择你更加喜欢的风格来为你工作, + 但是,如果你希望添加代码或者添加示例到three.js的库中,你将必须遵守这个指南。 +

+ 有关代码风格的详细信息,请 + 点击此处进行浏览。 +

+ + diff --git a/docs/manual/zh/introduction/Creating-a-scene.html b/docs/manual/zh/introduction/Creating-a-scene.html new file mode 100644 index 00000000000000..578c273b53f0a1 --- /dev/null +++ b/docs/manual/zh/introduction/Creating-a-scene.html @@ -0,0 +1,165 @@ + + + + + + + + + + +

创建一个场景([name])


+ +

这一部分将对three.js来做一个简要的介绍。在这一部分里,我们将以搭建一个包含有旋转立方体的场景。在页面下方有一个已经完成的例子,当你遇到麻烦,或者需要帮助的时候,可以看一看。

+ +

开始之前

+

+ 在你开始使用three.js之前,你需要一个地方来显示它。将下列HTML代码保存为你电脑上的一个HTML文件,同时将[link:https://threejs.org/build/three.js three.js]复制到该HTML文件所在的目录下的js/目录下,然后在你的浏览器中打开这个HTML文件。 +

+ + <!DOCTYPE html> + <html> + <head> + <meta charset=utf-8> + <title>My first three.js app</title> + <style> + body { margin: 0; } + canvas { width: 100%; height: 100% } + </style> + </head> + <body> + <script src="js/three.js"></script> + <script> + // Our Javascript will go here. + </script> + </body> + </html> + + +

好了,接下来的所有代码将会写入到空的<script>标签中。

+ +

创建一个场景

+ +

为了真正能够让你的场景借助three.js来进行显示,我们需要以下几个对象:场景、相机和渲染器,这样我们就能透过摄像机渲染出场景。

+ + + var scene = new THREE.Scene(); + var camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 0.1, 1000 ); + + var renderer = new THREE.WebGLRenderer(); + renderer.setSize( window.innerWidth, window.innerHeight ); + document.body.appendChild( renderer.domElement ); + + +

我们花一点点时间来解释一下这里发生了什么。我们现在建立了场景、相机和渲染器。

+ +

three.js里有几种不同的相机,在这里,我们使用的是PerspectiveCamera(透视摄像机)。

+ +

第一个属性是视野角度(FOV)。视野角度就是无论在什么时候,你所能在显示器上看到的场景的范围,它的值是一个角度。

+ +

第二个值是长宽比(aspect ratio)。 也就是你用一个物体的宽除以它的高的比值。比如说,当你在一个宽屏电视上播放老电影时,可以看到图像仿佛是被压扁的。

+ +

接下来的两个值是远剪切面近剪切面。 也就是说当物体所在的位置比摄像机的远剪切面远或者所在位置比近剪切面近的时候,该物体超出的部分将不会被渲染到场景中。现在你或许并不用担心这个值的影响,但未来为了获得更好的渲染性能,你将可以在你的应用程序里去设置它。

+ +

接下来是渲染器。这里是施展魔法的地方。除了我们在这里用到的WebGLRenderer渲染器之外,Three.js同时提供了其他几种渲染器,当用户所使用的浏览器过于老旧,或者由于其他原因不支持WebGL时,可以使用这几种渲染器进行降级。

+ +

除了创建一个渲染器的实例之外,我们还需要在我们的应用程序里设置一个渲染器的大小尺寸。比如说,我们可以使用所需要的渲染区域的宽高,来让渲染器渲染出的场景填充满我们的应用程序。因此,我们可以将渲染器宽高设置为浏览器窗口宽高。对于性能比较敏感的应用程序来说,你可以给setSize传入一个较小的值,例如window.innerWidth/2window.innerHeight/2,这将使得应用程序在渲染时,以一半的长宽尺寸渲染场景。

+ +

如果你希望保持你的应用程序的尺寸,但是以较低的分辨率来渲染,你可以在调用setSize时,给updateStyle(第三个参数)传入false。例如,假设你的<canvas> 标签现在已经具有了100%的宽和高,调用setSize(window.innerWidth/2, window.innerHeight/2, false)将使得你的应用程序以一半的分辨率来进行渲染。

+ +

最后,我们将renderer(渲染器)这个元素添加到我们的HTML文档中,这也就是渲染器使用<canvas>元素来将场景展现给我们。

+ +

“嗯,看起来很不错,那你说的那个立方体在哪儿?”我们接下来来对它继续进行添加吧。

+ + + var geometry = new THREE.BoxGeometry( 1, 1, 1 ); + var material = new THREE.MeshBasicMaterial( { color: 0x00ff00 } ); + var cube = new THREE.Mesh( geometry, material ); + scene.add( cube ); + + camera.position.z = 5; + + +

要创建一个立方体,我们需要一个BoxGeometry(立方体)对象. 这个对象包含了一个立方体中所有的顶点(vertices)和面faces。未来我们将在这方面进行更多的探索。

+ +

接下来,对于这个立方体,我们需要给它一个材质,来让它有颜色。Three.js自带了几种材质,但在这里我们使用的是MeshBasicMaterial。所有的材质是都一个将会被应用于立方体的属性对象。在这里为了简单起见,我们只设置一个color属性,值为0x00ff00,也就是绿色。这里所做的事情,就相当于是在CSS或者Photoshop中使用十六进制(hex colors)的颜色格式来设置颜色。

+ +

第三步,我们需要一个Mesh(网格)。 网格是包含有一个几何体以及应用在在此几何体上的材质的对象,我们可以直接将网格对象放入到我们的场景中,并让它在场景中自由移动。

+ +

默认情况下,当我们调用scene.add()的时候,物体将会被添加到坐标为(0,0,0)的位置。但这可能会使得摄像机的位置和立方体相互重叠(也就是摄像机位于立方体中)。为了防止这种情况的发生,我们只需要将摄像机稍微向外移动一些即可。

+ +

渲染场景

+ +

现在,如果你已经从上面复制了我们已经写好的代码到HTML文件中,你将不会在其中看到任何东西。这是因为我们还没有对它进行真正的渲染。为此,我们需要调用一个被叫做“渲染”或者“动画循环”的东西。

+ + + function animate() { + requestAnimationFrame( animate ); + renderer.render( scene, camera ); + } + animate(); + + +

在这里我们创建了一个循环——这使得渲染器能够在每次屏幕刷新时对场景进行绘制(在大多数屏幕上,刷新率一般是60次/秒)。如果你正在浏览器里写一个游戏,你或许会说“为什么我们不直接用setInterval来实现刷新的功能呢?”当然啦,我们的确可以用setInterval,但是,requestAnimationFrame有很多的优点。最重要的一点或许就是当用户切换到其它的标签页时,它会暂停,因此不会浪费用户宝贵的处理器资源,以及损耗电池的使用寿命。

+ +

使立方体动起来

+ +

+ 在开始之前,如果你已经将上面的代码写入到了你所创建的文件中,你应当已经可以看到一个绿色的立方体。让我们来做一些更加有趣的事——让它旋转起来。

+ +

将下列代码添加到animate()函数中renderer.render调用的上方:

+ + + cube.rotation.x += 0.01; + cube.rotation.y += 0.01; + + +

这一段代码将在每一帧时被渲染时调用(正常情况下是60次/秒),这就让立方体有了一个看起来很不错的旋转动画。基本上来说,当应用程序运行时,如果你想要移动或者改变任何场景中的东西,都必须要经过这个动画循环。当然,在这个动画循环函数里,你也可以调用别的函数,这样你在写animate函数的时候,这样你在写animate函数的时候,就不用在这里以成千上万的代码来结尾了。

+ +

结果

+

祝贺你!你现在已经成功完成了你的第一个Three.js应用程序。它现在很简单, 你现在已经有了一个起点。

+ +

下面是完整的代码,请尽情运行它或者修改它,这将可以让你对它的工作机制有更加深入的了解。

+ + + <html> + <head> + <title>My first three.js app</title> + <style> + body { margin: 0; } + canvas { width: 100%; height: 100% } + </style> + </head> + <body> + <script src="js/three.js"></script> + <script> + var scene = new THREE.Scene(); + var camera = new THREE.PerspectiveCamera( 75, window.innerWidth/window.innerHeight, 0.1, 1000 ); + + var renderer = new THREE.WebGLRenderer(); + renderer.setSize( window.innerWidth, window.innerHeight ); + document.body.appendChild( renderer.domElement ); + + var geometry = new THREE.BoxGeometry( 1, 1, 1 ); + var material = new THREE.MeshBasicMaterial( { color: 0x00ff00 } ); + var cube = new THREE.Mesh( geometry, material ); + scene.add( cube ); + + camera.position.z = 5; + + var animate = function () { + requestAnimationFrame( animate ); + + cube.rotation.x += 0.01; + cube.rotation.y += 0.01; + + renderer.render( scene, camera ); + }; + + animate(); + </script> + </body> + </html> + + + diff --git a/docs/manual/zh/introduction/Creating-text.html b/docs/manual/zh/introduction/Creating-text.html new file mode 100644 index 00000000000000..825f91cd5800c1 --- /dev/null +++ b/docs/manual/zh/introduction/Creating-text.html @@ -0,0 +1,109 @@ + + + + + + + + + + +

创建文字([name])

+
+

有时候,您可能需要在你的Three.js应用程序中使用到文本,这里有几种方法可以做到。 +

+
+ +

1. DOM + CSS

+
+

+ 使用HTML通常是最简单、最快速的添加文本的方法,这是大多数的Three.js示例中用于添加描述性叠加文字的方法。 +

+

你可以在这里添加内容

+ <div id="info">Description</div> + +

+ 然后使用CSS来将其绝对定位在其它具有z-index的元素之上,尤其是当你全屏运行three.js的时候。 +

+ + +#info { + position: absolute; + top: 10px; + width: 100%; + text-align: center; + z-index: 100; + display:block; +} + + +
+ + + +

2. 将文字绘制到画布中,并将其用作[page:Texture](纹理)

+
+

如果你希望在three.js的场景中的平面上轻松地绘制文本,请使用此方法。

+
+ + +

3. 在你所喜欢的3D软件里创建模型,并导出给three.js +

+
+

如果你更喜欢使用3D建模软件来工作并导出模型到three.js,请使用这种方法。

+
+ + + +

4. three.js自带的文字几何体

+
+

+ 如果你更喜欢使用纯three.js来工作,或者创建能够由程序改变的、动态的3D文字,你可以创建一个其几何体为THREE.TextGeometry的实例的网格: +

+

+ new THREE.TextGeometry( text, parameters ); +

+

+ 然而,为了使得它能够工作,你的TextGeometry需要在其“font”参数上设置一个THREE.Font的实例。 +
+ 请参阅 [page:TextGeometry] 页面来阅读如何完成此操作的详细信息,以及每一个接收的参数的描述,还有由three.js分发、自带的JSON字体的列表。 +

+ +

示例

+ [example:webgl_geometry_text WebGL / geometry / text]
+ [example:canvas_geometry_text canvas / geometry / text]
+ [example:webgl_shadowmap WebGL / shadowmap] + +

+ 如果Typeface已经关闭,或者没有你所想使用的字体,这有一个教程:[link:http://www.jaanga.com/2012/03/blender-to-threejs-create-3d-text-with.html]
+ 这是一个在blender上运行的python脚本,能够让你将文字导出为Three.js的JSON格式。 +

+ +
+ + + +

5. 位图字体

+
+

+ BMFonts (位图字体) 可以将字形批处理为单个BufferGeometry。BMFont的渲染支持自动换行、字母间距、字句调整、signed distance fields with standard derivatives、multi-channel signed distance fields、多纹理字体等特性。 + 详情请参阅[link:https://github.com/Jam3/three-bmfont-text three-bmfont-text]。 +

+

+ 现有库存的字体在项目中同样可用,就像[link:https://github.com/etiennepinchon/aframe-fonts A-Frame Fonts]一样, + 或者你也可以从任何TTF字体中创建你自己的字体,优化时,只需要包含项目中所需的字符即可。 +

+

+ 这是一些有用的工具: +

+
    +
  • [link:http://msdf-bmfont.donmccurdy.com/ msdf-bmfont-web] (web-based)
  • +
  • [link:https://github.com/soimy/msdf-bmfont-xml msdf-bmfont-xml] (commandline)
  • +
  • [link:https://github.com/libgdx/libgdx/wiki/Hiero hiero] (desktop app)
  • +
+
+ + + + + diff --git a/docs/manual/zh/introduction/Drawing-lines.html b/docs/manual/zh/introduction/Drawing-lines.html new file mode 100644 index 00000000000000..3bba46b5137b87 --- /dev/null +++ b/docs/manual/zh/introduction/Drawing-lines.html @@ -0,0 +1,66 @@ + + + + + + + + + + +

画线([name])

+
+

+ 假设你将要画一个圆或者画一条线,而不是一个线框,或者说不是一个[page:Mesh](网格)。 + 第一步我们要做的,是设置好[page:WebGLRenderer renderer](渲染器)、[page:Scene scene](场景)和[page:Camera camera](相机)-(如果对这里所提到的东西,还不了解,请阅读本手册第一章“创建一个场景 - Creating a scene”)。 +

+ +

这是我们将要用到的代码:

+ +var renderer = new THREE.WebGLRenderer(); +renderer.setSize( window.innerWidth, window.innerHeight ); +document.body.appendChild( renderer.domElement ); + +var camera = new THREE.PerspectiveCamera( 45, window.innerWidth / window.innerHeight, 1, 500 ); +camera.position.set( 0, 0, 100 ); +camera.lookAt( 0, 0, 0 ); + +var scene = new THREE.Scene(); + +

+ 接下来我们要做的事情是定义一个材质。对于线条来说,我们能使用的材质只有[page:LineBasicMaterial] 或者 [page:LineDashedMaterial]。 +

+ +//create a blue LineBasicMaterial +var material = new THREE.LineBasicMaterial( { color: 0x0000ff } ); + + +

+ 定义好材质之后,我们需要一个带有一些顶点的[page:Geometry] 或者 [page:BufferGeometry]。 + (推荐使用BufferGeometry,因为它在性能上表现得会更好一些;但在这里,为了简单起见,我们使用Geometry): +

+ + +var geometry = new THREE.Geometry(); +geometry.vertices.push(new THREE.Vector3( -10, 0, 0) ); +geometry.vertices.push(new THREE.Vector3( 0, 10, 0) ); +geometry.vertices.push(new THREE.Vector3( 10, 0, 0) ); + + +

注意,线是画在每一对连续的顶点之间的,而不是在第一个顶点和最后一个顶点之间绘制线条(线条并未闭合)。

+ +

既然我们已经有了能够画两条线的点和一个材质,那我们现在就可以将他们组合在一起,形成一条线。

+ +var line = new THREE.Line( geometry, material ); + +

剩下的事情就是把它添加到场景中,并调用[page:WebGLRenderer.render render](渲染)函数。

+ + +scene.add( line ); +renderer.render( scene, camera ); + + +

你现在应当已经看到了一个由两条蓝线组成的、指向上的箭头。

+
+ + diff --git a/docs/manual/zh/introduction/FAQ.html b/docs/manual/zh/introduction/FAQ.html new file mode 100644 index 00000000000000..353d10bbfaa96d --- /dev/null +++ b/docs/manual/zh/introduction/FAQ.html @@ -0,0 +1,55 @@ + + + + + + + + + + +

常见问题([name])

+ +

哪一种三维物体格式能够得到最好地支持呢?

+
+

+ 推荐使用glTF(gl传输格式)来对三维物体进行导入和导出,由于glTF这种格式是专注于在程序运行时呈现三维物体的,所以它的传输效率非常高,且加载速度非常快。 +

+ + +

three.js同样也为其它广受欢迎的格式像FBX、Collada以及OBJ等等提供了载入工具。虽然如此,你应当还是首先尝试着在你的项目里建立一个基于glTF的工作流程。 + 了解更多详细信息,请查看[link:#manual/introduction/Loading-3D-models loading 3D models]。 +

+
+ +

为什么在示例中会有一些和viewport相关的meta标签?

+
+
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
+ +

这些标签用于在移动端浏览器上控制视口的大小和缩放(页面内容可能会以与可视区域不同的大小来呈现)。

+ +

[link:https://developer.apple.com/library/content/documentation/AppleApplications/Reference/SafariWebContent/UsingtheViewport/UsingtheViewport.html Safari: Using the Viewport]

+ +

[link:https://developer.mozilla.org/en/Mobile/Viewport_meta_tag MDN: Using the viewport meta tag]

+
+ +

如何在窗口调整大小时保持场景比例不变?

+

+ 我们希望所有的物体,无论它们距离摄像机有多远,都能呈现相同尺寸,即使是在窗口被重新调整大小的时候。 + 解决这个问题的关键,是一个很重要的公式:给定距离,求可见高度 + +visible_height = 2 * Math.tan( ( Math.PI / 180 ) * camera.fov / 2 ) * distance_from_camera;
+
+ 如果我们以一定的百分比增加了窗口的高度,那我们所想要的结果便是所有距离的可见高度都增加相同的百分比。 + 这并不能通过改变摄像机的位置来实现,相反,你得改变摄像机的视野角度(FOV)。这是个示例:[link:http://jsfiddle.net/Q4Jpu/ Example]. +

+ +

为什么我的物体的一部分是不可见的?

+

+ 这可能是由于面消隐而导致的。面是具有朝向的,这个朝向决定了哪边是正面或者哪边是背面。 + 在正常情况下,渲染时会将背面进行消隐。要查看这是不是你所遇到的问题,请将material的slide更改为THREE.DoubleSide。 + material.side = THREE.DoubleSide +

+ + + diff --git a/docs/manual/zh/introduction/How-to-run-things-locally.html b/docs/manual/zh/introduction/How-to-run-things-locally.html new file mode 100644 index 00000000000000..3e1168c86fa6d1 --- /dev/null +++ b/docs/manual/zh/introduction/How-to-run-things-locally.html @@ -0,0 +1,182 @@ + + + + + + + + + + +

如何在本地运行Three.js([name])

+

+ 倘若你只是使用Three.js库中所提供的几何体,且不载入任何纹理贴图,则网页是可以从本地的文件系统中打开,并且是能够直接运行的,只需在文件管理器中双击HTML文件,它就可以在浏览器中进行显示。 + (此时你将在地址栏中看到类似这样的URL:file:///yourFile.html) + +

+ +

从外部文件载入的内容

+
+

+ 倘若你需要从外部文件里载入几何体或是纹理贴图,由于浏览器[link:http://en.wikipedia.org/wiki/Same_origin_policy same origin policy](同源策略)的安全限制,从本地文件系统载入外部文件将会失败,同时抛出安全性异常。 +

+ +

这里有两种方法来解决这个问题:

+ +
    +
  1. + 在浏览器中改变本地文件的安全策略,这将使你可以通过file:///yourFile.html来直接运行*本地文件系统*中的文件。 +
  2. +
  3. + 从本地的服务器运行文件,这可以让你通过http://localhost/yourFile.html来访问运行在*本地服务器*上的文件。 +
  4. +
+ +

+ 倘若你选择第一种方法,请小心,倘若你使用同一个浏览器来进行日常网络冲浪,你将可能会触发一些漏洞。 + 你或许可以创建一个用于开发环境的独立的浏览器配置文件或者快捷方式,仅仅用于本地开发;这将使得日常使用环境与开发环境相分离,以保证日常使用环境的安全性。 + 接下来,我们来看一看除此之外的别的方法。 +

+
+ + +

运行一个本地的服务器

+
+

+ 很多的编程语言都具有一个内置的简易HTTP服务器。它们的功能并不像能够被用于生产环境的服务器,例如[link:https://www.apache.org/ Apache] 或者 [link:https://nginx.org NGINX]那样完善, + 但对于你来测试three.js应用程序来说,它们就已经足够了。 +

+ +

Node.js server

+
+

Node.js 具有一个简单的HTTP服务器包,如需安装,请执行:

+ npm install http-server -g + +

若要从本地目录下运行,请执行:

+ http-server . -p 8000 +
+ +

Python server

+
+

+ 如果你已经安装好了[link:http://python.org/ Python],只需要从命令行里便可以运行它(从工作目录): +

+ +//Python 2.x +python -m SimpleHTTPServer + +//Python 3.x +python -m http.server + + +

这将会在为当前目录在8000端口创建一个服务器,也就是说你可以在地址栏里输入这个地址来访问已经创建好的服务器:

+ + http://localhost:8000/ +
+ +

Ruby server

+
+

如果你已经安装好了Ruby,通过执行下列命也可以创建同样的服务器:

+ +ruby -r webrick -e "s = WEBrick::HTTPServer.new(:Port => 8000, :DocumentRoot => Dir.pwd); trap('INT') { s.shutdown }; s.start" + +
+ +

PHP server

+
+

PHP自从5.4.0版本开始,就内置了一个Web服务器:

+ php -S localhost:8000 +
+ +

Lighttpd

+
+

+ Lighttpd是一个轻量级的通用Web服务器,在这里,我们将介绍如何在OS X上使用HomeBrew来安装它。 + 和我们在这里讨论的其他服务器不同,lighttpd是一个成熟的、准用于生产环境的服务器。 +

+ +
    +
  1. + 通过HomeBrew安装lighttpd + brew install lighttpd +
  2. +
  3. + 在你希望作为服务器来运行的目录里,创建一个名为lighttpd.conf的配置文件。 + 这是一个配置文件的样本:[link:http://redmine.lighttpd.net/projects/lighttpd/wiki/TutorialConfiguration TutorialConfiguration]。 +
  4. +
  5. + 在配置文件里,将server.document-root更改为你将要创建的服务器中的文件的所在的目录。 +
  6. +
  7. + 通过这个命令来启动: + lighttpd -f lighttpd.conf +
  8. +
  9. + 使用浏览器打开http://localhost:3000/,然后服务器将可以从你所选择的目录中向你提供静态文件。 +
  10. +
+
+ +

更改本地文件的安全策略

+
+

Safari

+
+

+ 在“偏好”面板中启用开发菜单,位于“高级”->“在菜单栏中显示开发菜单” +

+ +

+ 之后从Safari中的“开发”菜单中,选择“停用本地文件限制”,同样需要注意的是,Safari对于缓存有一些奇怪的行为, + 因此建议,在同一菜单中打开“停用缓存”的选项;如果你正在编辑,请使用Safari进行调试。 +

+
+ + +

Chrome

+
+

请关闭Chrome浏览器正在运行的*所有*实例,注意这里非常重要的关键字是“*所有*”。

+ +

+ 在Windows中,你可以在任务管理器中查看所有正在运行的Chorme浏览器的实例。 + 此外,如果你在系统任务栏中看到了Chrome图标,请鼠标右键打开它的上下文菜单,点击关闭。这样就应当已经关闭所有正在运行的Chrome浏览器实例了。 + +

+ +

+ 然后使用命令行执行Chrome浏览器,并在命令行中添加允许访问本地文件的参数:

+ + chrome --allow-file-access-from-files + +

+ 在Windows中,最简单的做法或许就是创建一个特别的快捷方式图标,快捷方式的目标指向上面的命令行 + (右键点击快捷方式图标->属性->目标)。 +

+ +

在Mac OS X中,你可以用这种方法来添加允许访问本地文件的参数并运行Chrome:

+ + open /Applications/Google\ Chrome.app --args --allow-file-access-from-files +
+

Firefox

+
+
    +
  1. + 在地址栏中,键入about:config +
  2. +
  3. + 找到这个参数security.fileuri.strict_origin_policy +
  4. +
  5. + 将其设置为false +
  6. +
+
+ +
+ +

+ 其它简单的替代方案你可以在Stack Overflow上找到:[link:http://stackoverflow.com/q/12905426/24874 click here]。 +

+
+ + + diff --git a/docs/manual/zh/introduction/How-to-update-things.html b/docs/manual/zh/introduction/How-to-update-things.html new file mode 100644 index 00000000000000..8ffe13cc53617b --- /dev/null +++ b/docs/manual/zh/introduction/How-to-update-things.html @@ -0,0 +1,247 @@ + + + + + + + + + + +

[name]

+
+

默认情况下,所有对象都会自动更新它们的矩阵(如果它们已添加到场景中)

+ +var object = new THREE.Object3D(); +scene.add( object ); + + 或者它们是已添加到场景中的另一个对象的子节点: + +var object1 = new THREE.Object3D(); +var object2 = new THREE.Object3D(); + +object1.add( object2 ); +scene.add( object1 ); //object1 and object2 will automatically update their matrices + +
+ +

但是,如果你知道对象将是静态的,则可以禁用此选项并在需要时手动更新转换矩阵。

+ + +object.matrixAutoUpdate = false; +object.updateMatrix(); + + +

Geometries(几何形状)

+
+

[page:BufferGeometry]

+
+

+ BufferGeometries 将信息(例如顶点位置,面索引,法线,颜色,uv和任何自定义属性) 存储在 [page:BufferAttribute buffers] - 也就是, + [link:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Typed_arrays typed arrays]. + 这使得它们通常比标准Geometries更快,缺点是更难用。 +

+

+ 关于更新BufferGeometries, 最重要的是理解你不能调整 buffers 大小(这种操作开销很大, 相当于创建了个新的geometry). + 但你可以更新 buffers的内容. +

+

+ 这意味着如果你知道BufferGeometry的一个属性会增长,比如顶点的数量, + 你必须预先分配足够大的buffer来容纳可能创建的任何新顶点。 + 当然,这也意味着BufferGeometry将有一个最大大小 - 无法创建一个可以高效地无限扩展的BufferGeometry。 +

+

+ 我们以在渲染时扩展的line来示例。我们将分配可容纳500个顶点的空间但起初仅绘制2个,使用 + 在500个顶点的缓冲区中,但首先只使用 [page:BufferGeometry.drawRange]. +

+ +var MAX_POINTS = 500; + +// geometry +var geometry = new THREE.BufferGeometry(); + +// attributes +var positions = new Float32Array( MAX_POINTS * 3 ); // 3 vertices per point +geometry.addAttribute( 'position', new THREE.BufferAttribute( positions, 3 ) ); + +// draw range +var drawCount = 2; // draw the first 2 points, only +geometry.setDrawRange( 0, drawCount ); + +// material +var material = new THREE.LineBasicMaterial( { color: 0xff0000, linewidth: 2 } ); + +// line +var line = new THREE.Line( geometry, material ); +scene.add( line ); + +

+ 然后我们随机增加顶点到line中,以这样的一种方式: +

+ +var positions = line.geometry.attributes.position.array; + +var x, y, z, index; +x = y = z = index = 0; + +for ( var i = 0, l = MAX_POINTS; i < l; i ++ ) { + + positions[ index ++ ] = x; + positions[ index ++ ] = y; + positions[ index ++ ] = z; + + x += ( Math.random() - 0.5 ) * 30; + y += ( Math.random() - 0.5 ) * 30; + z += ( Math.random() - 0.5 ) * 30; + +} + +

+ 如果要更改第一次渲染后渲染的点数,执行以下操作: +

+ +line.geometry.setDrawRange( 0, newValue ); + +

+ 如果要在第一次渲染后更改position数值,则需要像这样设置needsUpdate标志: +

+ +line.geometry.attributes.position.needsUpdate = true; // required after the first render + + +

+ [link:http://jsfiddle.net/w67tzfhx/ 这个fiddle] 展示了一个你可以参考的运动的line. +

+ +

Examples:

+ [example:webgl_custom_attributes WebGL / custom / attributes]
+ [example:webgl_buffergeometry_custom_attributes_particles WebGL / buffergeometry / custom / attributes / particles] + + +
+ +

[page:Geometry]

+
+

+ 以下标志控制各种geometry属性的更新. 仅对于需要更新的属性设置标志 + ,因为更新成本很高. 一旦buffers + 改变, 这些标志位会自动重置为false. 你需要保持这些设置为true,如果你想要持续更新buffers. 请注意这仅适用于[page:Geometry] + 而不是 [page:BufferGeometry]. +

+ +var geometry = new THREE.Geometry(); +geometry.verticesNeedUpdate = true; +geometry.elementsNeedUpdate = true; +geometry.morphTargetsNeedUpdate = true; +geometry.uvsNeedUpdate = true; +geometry.normalsNeedUpdate = true; +geometry.colorsNeedUpdate = true; +geometry.tangentsNeedUpdate = true; + + +

+ 在早于 [link:https://github.com/mrdoob/three.js/releases/tag/r66 r66]版本中, meshes + 需要额外设定 dynamic 标志true (为了维持内部的 typed arrays): +

+ + + //removed after r66 + geometry.dynamic = true; + + +

Examples:

+ [example:webgl_geometry_dynamic WebGL / geometry / dynamic]
+
+ +
+ + + + +

Materials(材质)

+
+

所有uniforms值都可以自由改变 (e.g. colors, textures, opacity, etc), 这些数值在每帧都发给shader .

+ +

GL状态相关参数也可以随时改变 (depthTest, blending, polygonOffset, etc).

+ +

平滑/平滑阴影被作到法线. 你需要重置法线 buffer (见上).

+ +

在运行时无法轻松更改以下属性 (一旦material被渲染了一次):

+
    +
  • uniforms的数量和类型
  • +
  • lights的数量和类型
  • +
  • 存在与否 +
      +
    • texture
    • +
    • fog
    • +
    • vertex colors
    • +
    • skinning
    • +
    • morphing
    • +
    • shadow map
    • +
    • alpha test
    • +
    +
  • +
+ +

这些变化需要建立新的shader程序. 你需要设置

+ material.needsUpdate = true + +

请记住,这可能会非常缓慢并导致帧率的波动。 (特别是在Windows上,因为shader编译在directx中比opengl慢).

+ +

为了获得更流畅的体验,您可以通过“虚拟”值(如零强度光,白色纹理或零密度雾)在一定程度上模拟这些功能的变化.

+ +

您可以自由更改用于几何块的材质,但是无法更改对象如何划分为块(根据面材料).

+ +

如果你需要在运行时使用不同的材料配置:

+

如果材料/块的数量很少,您可以事先预先划分物体(例如,人的头发/脸部/身体/上衣/裤子,汽车的前部/侧面/顶部/玻璃/轮胎/内部).

+ +

如果数量很大(例如,每个面可能有所不同),请考虑不同的解决方案,例如使用属性/纹理来驱动不同的每个面部外观。

+ +

Examples:

+ [example:webgl_materials_cars WebGL / materials / cars]
+ [example:webgl_postprocessing_dof WebGL / webgl_postprocessing / dof] +
+ + +

Textures(纹理)

+
+

如果更改了图像,画布,视频和数据纹理,则需要设置以下标志:

+ + texture.needsUpdate = true; + +

Render targets update automatically.

+ +

Examples:

+ [example:webgl_materials_video WebGL / materials / video]
+ [example:webgl_rtt WebGL / rtt] + +
+ + +

Cameras(相机)

+
+

相机的位置和目标会自动更新。 如果你需要改变

+
    +
  • + fov +
  • +
  • + aspect +
  • +
  • + near +
  • +
  • + far +
  • +
+

+ 那么你需要重新计算投影矩阵: +

+ +camera.aspect = window.innerWidth / window.innerHeight; +camera.updateProjectionMatrix(); + +
+ + diff --git a/docs/manual/zh/introduction/Import-via-modules.html b/docs/manual/zh/introduction/Import-via-modules.html new file mode 100644 index 00000000000000..f447bb76fe448b --- /dev/null +++ b/docs/manual/zh/introduction/Import-via-modules.html @@ -0,0 +1,72 @@ + + + + + + + + + + +

通过模块来引入([name])


+ +

+ 虽然通过script标签来引入three.js是一个能够快速起步、快速运行的方式,但这种方式对于一些具有较长生命周期的项目来说是有一些缺点的。比如说: + +

    +
  • 你必须手动获得并在你的源代码中包含这个库的一个拷贝
  • +
  • 更新这个库的版本是一个手动操作的过程
  • +
  • 在检查新版本的库时,你的版本差异对比将会被许多行给弄乱。
  • +
+

+ +

使用像npm这样的依赖包管理器可以很好地避免这些需要注意的问题,只需在你的电脑上下载并导入你所需要的库的版本即可。

+ +

通过npm来安装

+ +

Three.js目前已经作为一个npm包来进行了发布,详情请参阅:[link:https://www.npmjs.com/package/three npm]。这意味着,在所有你需要包含three.js库的项目中,只需运行"npm install three"即可。

+ +

导入这个模块

+ +

假设你正在使用[link:https://webpack.github.io/ Webpack]或者[link:https://github.com/substack/node-browserify Browserify]等允许你“通过打包所有依赖,来在浏览器中使用require('modules')”的打包工具对你的文件进行打包。

+ +

你现在可以在你的源代码中引入模块,并继续像往常一样使用这个库。 +

+ + + var THREE = require('three'); + + var scene = new THREE.Scene(); + ... + + +

+ 你也可以使用[link:https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Statements/import ES6 import](在ES6标准中新增的import语句) +

+ + + import * as THREE from 'three'; + + const scene = new THREE.Scene(); + ... + + +

+ 或者,如果你希望只导入three.js库中的特定部分,例如Scene: +

+ + + import { Scene } from 'three'; + + const scene = new Scene(); + ... + + +

注意事项

+ +

+ 目前,无法用这种方式导入"examples/js"目录中的文件。 + 这是因为一些文件依赖于THREE的全局命名空间污染。了解更多详情,请参阅Transform `examples/js` to support modules #9562。 +

+ + diff --git a/docs/manual/zh/introduction/Loading-3D-models.html b/docs/manual/zh/introduction/Loading-3D-models.html new file mode 100644 index 00000000000000..11d30a9bd66ea1 --- /dev/null +++ b/docs/manual/zh/introduction/Loading-3D-models.html @@ -0,0 +1,109 @@ + + + + + + + + + + + + +

载入3D模型([name])

+
+ +

+ 3D模型目前的有成千上万种格式可供选择,但每一种格式都具有不同的目的、用途以及复杂性。 + 虽然 + three.js已经提供了多种导入工具 + 但是选择正确的文件格式以及工作流程将可以节省很多时间,以及避免很多挫折。某些格式难以使用,或者实时体验效率低下,或者目前尚未得到完全支持。 +

+ +

+ 对大多数用户,本指南向你推荐了一个工作流程,并向你提供了一些当没有达到预期效果时的建议。 + +

+ +

在开始之前

+ +

+ 如果你是第一次运行一个本地服务器,可以先阅读[link:#manual/introduction/How-to-run-things-locally how to run things locally]。 + 正确地托管文件,可以避免很多查看3D模型时的常见错误。 +

+ +

推荐的工作流程

+ +

+ 如果有可能的话,我们推荐使用glTF(gl传输格式)。.GLB.GLTF是这种格式的这两种不同版本, + 都可以被很好地支持。由于glTF这种格式是专注于在程序运行时呈现三维物体的,所以它的传输效率非常高,且加载速度非常快。 + 功能方面则包括了网格、材质、纹理、皮肤、骨骼、变形目标、动画、灯光和摄像机。 +

+ +

+ 公共领域的glTF文件可以在网上找到,例如 + + Sketchfab,或者很多工具包含了glTF的导出功能: +

+ + + +

+ 倘若你所喜欢的工具不支持glTF格式,请考虑向该工具的作者请求glTF导出功能, + 或者在the glTF roadmap thread贴出你的想法。 + +

+ +

+ 当glTF不可用的时候,诸如FBX、OBJ或者COLLADA等等其它广受欢迎的格式在Three.js中也是可以使用、并且定期维护的。 +

+ +

故障排除

+ +

+ 你花了几个小时亲手建了一个堪称杰作的模型,现在你把它给导入到网页中—— + 哦,天呐~😭它导入以后完全失真了、材质贴图丢了、或者说整个模型完全丢失了!
+ 接下来我们来按照下面的步骤排除故障: +

+ +
    +
  1. + 在Javascript的Console中查找错误,并确定当你调用.load()的时候,使用了onError回调函数来输出结果。 +
  2. +
  3. + 请在别的应用程序中查看3D模型。对于glTF格式的模型来说,可以直接在下面的应用程序中进行查看: + three.js和 + babylon.js。 + 如果该模型能够在一个或者更多应用程序里正确地呈现,请点击这里向three.js提交Bug报告。 + 如果模型不能在任意一个应用程序里显示,我们强烈鼓励你向我们提交Bug报告,并告知我们你的模型是使用哪一款应用程序创建的。 + +
  4. +
  5. + 尝试将模型放大或缩小到原来的1000倍。许多模型的缩放比例各不相同,倘若摄像机位于相机内,则大型模型将可能不会显示。 +
  6. +
  7. + 在网络面板中查找失败的纹理贴图请求,像C:\\Path\To\Model\texture.jpg。使用相对于你的模型的文件路径,例如 + images/texture.jpg——这或许需要在文本编辑器中来对模型文件进行修改。 +
  8. +
+ +

请求帮助

+ +

+ 倘若你已经尝试经历了以上故障排除的过程,但是你的模型仍然无法工作,寻求正确的方法来获得帮助将使您更快地获得解决方案。 +您可以将您的问题发布到three.js forum, + 同时,尽可能将你的模型(或者一个简单的、具有相同问题的模型)包含在你能够使用的任何格式中,为其他人提供足够的信息,以便快速重现这个问题——最好是一个能够现场演示的Demo。 +

+ + + + diff --git a/docs/manual/zh/introduction/Matrix-transformations.html b/docs/manual/zh/introduction/Matrix-transformations.html new file mode 100644 index 00000000000000..54ff9fc60b7758 --- /dev/null +++ b/docs/manual/zh/introduction/Matrix-transformations.html @@ -0,0 +1,67 @@ + + + + + + + + + + +

[name]

+ +

+ Three.js使用*matrix*编码3D变换 - 平移(位置),旋转和缩放。 [page:Object3D]的每个实例都有一个[page:Object3D.matrix matrix],用于存储该对象的位置,旋转和比例。 本页介绍如何更新对象的转换。 +

+ +

Convenience properties and *matrixAutoUpdate*(便利属性和 *matrixAutoUpdate*)

+ + 有两种方法可以更新对象的转换: +
    +
  1. + 修改对象的* position *,* quaternion *和* scale *属性,让three.js重新计算 + 来自这些属性的对象矩阵: + + object.position.copy(start_position); + object.quaternion.copy(quaternion); + + 默认情况下,* matrixAutoUpdate *属性设置为true,并且将自动重新计算矩阵。 +如果对象是静态的,或者您希望在重新计算时手动控制,则可以通过将属性设置为false来获得更好的性能: + + object.matrixAutoUpdate = false; + + 更改任何属性后,手动更新矩阵: + + object.updateMatrix(); + +
  2. +
  3. + 直接修改对象的矩阵。 [page:Matrix4]类有各种修改矩阵的方法: + + object.matrix.setRotationFromQuaternion(quaternion); + object.matrix.setPosition(start_position); + object.matrixAutoUpdate = false; + + 请注意,在这种情况下,* matrixAutoUpdate * 必须设置为* false *,并且您应该确保调用* updateMatrix *。 调用* updateMatrix *将破坏对矩阵所做的手动更改,从* position *,* scale *重新计算矩阵,依此类推。 +
  4. +
+ +

Object and world matrices(对象和世界矩阵)

+

+ 对象的[page:Object3D.matrix matrix]将对象的转换 相对于 对象的[page:Object3D.parent parent]; 要在 世界 坐标中获取对象的转换,您必须访问该对象的[page:Object3D.matrixWorld]。 + An object's [page:Object3D.matrix matrix] stores the object's transformation +

+

+ 当父对象或子对象的转换发生更改时,可以通过调用[page:Object3D.updateMatrixWorld updateMatrixWorld]()来请求更新子对象的[page:Object3D.matrixWorld matrixWorld]。 +

+ +

Rotation and Quaternion(旋转和四元数)

+

+ Three.js提供了两种表示3D旋转的方式:[page:Euler Euler angles]和[page:Quaternion Quaternions],以及两者之间的转换方法。 欧拉角受到称为“万向节锁定”的问题,其中某些配置可能失去一定程度的自由度(防止物体绕一个轴旋转)。 因此,对象旋转始终存储在对象的[page:Object3D.quaternion quaternion]中。 +

+

+ 该库的早期版本包含* useQuaternion *属性,当设置为false时,将导致对象的[page:Object3D.matrix矩阵]从欧拉角计算。 这种做法已被弃用 - 相反,您应该使用[page:Object3D.setRotationFromEuler setRotationFromEuler]方法,该方法将更新四元数。 +

+ + + diff --git a/docs/manual/zh/introduction/Migration-guide.html b/docs/manual/zh/introduction/Migration-guide.html new file mode 100644 index 00000000000000..193e7005b77774 --- /dev/null +++ b/docs/manual/zh/introduction/Migration-guide.html @@ -0,0 +1,19 @@ + + + + + + + + + + +

迁移指南([name])

+

+ 迁移指南保留在[link:https://github.com/mrdoob/three.js/wiki wiki]中。 + 它包含了从r45起,直到当前版本的每一个版本的更改列表。 +

+ 你可以在这里找到:[link:https://github.com/mrdoob/three.js/wiki/Migration-Guide here]。 +

+ + diff --git a/docs/manual/zh/introduction/Useful-links.html b/docs/manual/zh/introduction/Useful-links.html new file mode 100644 index 00000000000000..ac4bbbac61d282 --- /dev/null +++ b/docs/manual/zh/introduction/Useful-links.html @@ -0,0 +1,171 @@ + + + + + + + + + + +

一些有用的链接([name])


+ +

+ 下面是一些你在学习three.js过程中或许对你有很大帮助的链接。
+ 如果你发现了一些你想要在这里添加的东西,或者下面的某些链接已经不再可用,请尽情点击右上角的编辑按钮来做一些修改。

+请注意,three.js目前正处于快速发展的阶段,这里的很多链接已经过时了;如果一些东西没有按照你所预想情况、或者以下链接中所说的情况来工作,请查看 +浏览器的Console中的错误或者警告,以及相应的文档,特别是[page:DeprecatedList](弃用清单)。

+ +此外除了这个页面,mrdoob还在Google+上维护了一些和three.js相关的链接。 +点击这里来查看它们。 +

+ +

帮助论坛

+

+ Three.js官方使用[link:http://stackoverflow.com/tags/three.js/info Stack Overflow]来处理帮助请求。 + 如果你需要一些帮助,这才是你所要去的地方。请一定不要在GitHub上提issue来寻求帮助。 + +

+ +

教程以及课程

+ +

three.js入门

+
    +
  • + [link:https://codepen.io/rachsmith/post/beginning-with-3d-webgl-pt-1-the-scene Beginning with 3D WebGL] by [link:https://codepen.io/rachsmith/ Rachel Smith]. +
  • +
  • + [link:https://www.august.com.au/blog/animating-scenes-with-webgl-three-js/ Animating scenes with WebGL and three.js] +
  • +
+ +

更加广泛、高级的文章与教程

+
    +
  • + [link:http://blog.cjgammon.com/ Collection of tutorials] by [link:http://www.cjgammon.com/ CJ Gammon]. +
  • +
  • + [link:https://medium.com/soffritti.pierfrancesco/glossy-spheres-in-three-js-bfd2785d4857 Glossy spheres in three.js]. +
  • +
  • + [link:https://www.udacity.com/course/cs291 Interactive 3D Graphics] - a free course on Udacity that teaches the fundamentals of 3D Graphics, + and uses three.js as its coding tool. +
  • +
  • + [Link:https://aerotwist.com/tutorials/ Aerotwist] tutorials by [link:https://github.com/paullewis/ Paul Lewis]. +
  • +
  • + [link:http://learningthreejs.com/ Learning Three.js] – a blog with articles dedicated to teaching three.js +
  • +
  • + [link:http://bkcore.com/blog/3d/webgl-three-js-animated-selective-glow.html Animated selective glow in Three.js] + by [link:https://github.com/BKcore BKcore] +
  • +
+ +

其它非英语的教程

+
    +
  • + [link:http://www.natural-science.or.jp/article/20120220155529.php Building A Physics Simulation Environment] - three.js tutorial in Japanese +
  • + +
+ +

新闻与更新

+
    +
  • + [link:http://www.reddit.com/r/threejs/ Three.js on reddit] +
  • +
  • + [link:http://www.reddit.com/r/webgl/ WebGL on reddit] +
  • +
  • + [link:http://learningwebgl.com/blog/ Learning WebGL Blog] – The authoritive news source for WebGL. +
  • +
  • + [link:https://plus.google.com/104300307601542851567/posts Three.js posts] on Google+ – frequent posts on Three.js +
  • +
+

示例

+
    +
  • + [link:https://github.com/edwinwebb/three-seed/ three-seed] - three.js starter project with ES6 and Webpack +
  • +
  • + [link:http://stemkoski.github.io/Three.js/index.html Professor Stemkoskis Examples] - a collection of beginner friendly + examples built using three.js r60. +
  • +
  • + [link:https://threejs.org/examples/ Official three.js examples] - these examples are + maintained as part of the three.js repository, and always use the latest version of three.js. +
  • +
  • + [link:https://rawgit.com/mrdoob/three.js/dev/examples/ Official three.js dev branch examples] - + Same as the above, except these use the dev branch of three.js, and are used to check that + everything is working as three.js being is developed. +
  • +
+ +

工具

+
    +
  • + [link:http://www.physgl.org/ physgl.org] - javascript front-end with wrappers to three.js, to bring WebGL + graphics to students learning physics and math. +
  • +
  • + [link:https://whs.io/ Whitestorm.js] – Modular three.js framework with AmmoNext physics plugin. +
  • + +
  • + [link:http://zz85.github.io/zz85-bookmarklets/threelabs.html Three.js Inspector] +
  • +
  • + [link:http://idflood.github.io/ThreeNodes.js/ ThreeNodes.js]. +
  • +
+ +

WebGL参考

+
    +
  • + [link:https://www.khronos.org/files/webgl/webgl-reference-card-1_0.pdf] - Reference of all WebGL and GLSL keywords, terminology, syntex and definations. +
  • +
+ +

较旧的链接

+

+ 这些链接是出于历史的目的而保留的,你或许可以发现它们仍然很有用,但是它们可能含有和three.js非常老旧的版本有关的信息。 +

+ +
    +
  • + AlterQualia at WebGL Camp 3 +
  • +
  • + [link:http://yomotsu.github.io/threejs-examples/ Yomotsus Examples] - a collection of examples using three.js r45. +
  • +
  • + [link:http://fhtr.org/BasicsOfThreeJS/#1 Introduction to Three.js] by [link:http://github.com/kig/ Ilmari Heikkinen] (slideshow). +
  • +
  • + [link:http://www.slideshare.net/yomotsu/webgl-and-threejs WebGL and Three.js] by [link:http://github.com/yomotsu Akihiro Oyamada] (slideshow). +
  • +
  • + [link:http://bkcore.com/blog/general/adobe-user-group-nl-talk-video-hexgl.html Fast HTML5 game development using three.js] by [link:https://github.com/BKcore BKcore] (video). +
  • +
  • + Trigger Rally by [link:https://github.com/jareiko jareiko] (video). +
  • +
  • + [link:http://blackjk3.github.io/threefab/ ThreeFab] - scene editor, maintained up until around three.js r50. +
  • +
  • + [link:http://bkcore.com/blog/3d/webgl-three-js-workflow-tips.html Max to Three.js workflow tips and tricks] by [link:https://github.com/BKcore BKcore] +
  • +
  • + [link:http://12devsofxmas.co.uk/2012/01/webgl-and-three-js/ A whirlwind look at Three.js] + by [link:http://github.com/nrocy Paul King] +
  • +
+ + + diff --git a/docs/manual/zh/introduction/WebGL-compatibility-check.html b/docs/manual/zh/introduction/WebGL-compatibility-check.html new file mode 100644 index 00000000000000..2ab8572312fb06 --- /dev/null +++ b/docs/manual/zh/introduction/WebGL-compatibility-check.html @@ -0,0 +1,32 @@ + + + + + + + + + + +

WebGL兼容性检查([name])


+

+ 虽然这个问题现在已经变得越来越小,但不得不说,有的设备或者浏览器直到现在仍然不支持WebGL。
以下的方法可以帮助你检测当前用户所使用的环境是否支持WebGL,倘若不支持,将向用户显示一条信息。 +

+ +

+ 请将[link:https://github.com/mrdoob/three.js/blob/master/examples/js/Detector.js]引入到你的文件,并在尝试开始渲染之前先运行该文件。 +

+ + +if (Detector.webgl) { + // Initiate function or other initializations here + animate(); +} else { + var warning = Detector.getWebGLErrorMessage(); + document.getElementById('container').appendChild(warning); +} + + + + + diff --git a/docs/page.js b/docs/page.js index dc8c89fc2e2565..83da14f909ac1c 100644 --- a/docs/page.js +++ b/docs/page.js @@ -35,6 +35,10 @@ function onDocumentLoad( event ) { case 'api': path = /\/api\/[A-z0-9\/]+/.exec( pathname ).toString().substr( 5 ); + + // Remove localized part of the path (e.g. 'en/' or 'es-MX/'): + path = path.replace( /^[A-z0-9-]+\//, '' ); + break; case 'examples': diff --git a/editor/index.html b/editor/index.html index a326ff53c19437..6f90dfb6b081d2 100644 --- a/editor/index.html +++ b/editor/index.html @@ -4,12 +4,12 @@ OpenSim 4.0 Visualizer 041518 - - - - - - + + + + + + @@ -34,6 +34,7 @@ + diff --git a/editor/js/Loader.js b/editor/js/Loader.js index 7555066964bf88..e7fad5bf006a42 100644 --- a/editor/js/Loader.js +++ b/editor/js/Loader.js @@ -209,7 +209,10 @@ var Loader = function ( editor ) { var contents = event.target.result; + THREE.DRACOLoader.setDecoderPath( '../examples/js/libs/draco/gltf/' ); + var loader = new THREE.GLTFLoader(); + loader.setDRACOLoader( new THREE.DRACOLoader() ); loader.parse( contents, '', function ( result ) { result.scene.name = filename; @@ -574,7 +577,7 @@ var Loader = function ( editor ) { case 'geometry': var loader = new THREE.JSONLoader(); - loader.setTexturePath( scope.texturePath ); + loader.setResourcePath( scope.texturePath ); var result = loader.parse( data ); diff --git a/editor/js/Sidebar.Settings.Shortcuts.js b/editor/js/Sidebar.Settings.Shortcuts.js index 843e30a50eb3ed..734756accf4d98 100644 --- a/editor/js/Sidebar.Settings.Shortcuts.js +++ b/editor/js/Sidebar.Settings.Shortcuts.js @@ -20,14 +20,12 @@ Sidebar.Settings.Shortcuts = function ( editor ) { var shortcuts = [ 'translate', 'rotate', 'scale', 'undo', 'focus' ]; - for ( var i = 0; i < shortcuts.length; i ++ ) { - - let name = shortcuts[ i ]; + function createShortcutInput( name ) { - let configName = 'settings/shortcuts/' + name; - let shortcutRow = new UI.Row(); + var configName = 'settings/shortcuts/' + name; + var shortcutRow = new UI.Row(); - let shortcutInput = new UI.Input().setWidth( '150px' ).setFontSize( '12px' ); + var shortcutInput = new UI.Input().setWidth( '150px' ).setFontSize( '12px' ); shortcutInput.setTextTransform( 'lowercase' ); shortcutInput.onChange( function () { @@ -85,6 +83,12 @@ Sidebar.Settings.Shortcuts = function ( editor ) { } + for ( var i = 0; i < shortcuts.length; i ++ ) { + + createShortcutInput( shortcuts[ i ] ); + + } + document.addEventListener( 'keydown', function ( event ) { switch ( event.key.toLowerCase() ) { @@ -100,7 +104,7 @@ Sidebar.Settings.Shortcuts = function ( editor ) { var object = editor.selected; if ( object === null ) return; - + var parent = object.parent; if ( parent !== null ) editor.execute( new RemoveObjectCommand( object ) ); diff --git a/examples/canvas_interactive_particles.html b/examples/canvas_interactive_sprites.html similarity index 76% rename from examples/canvas_interactive_particles.html rename to examples/canvas_interactive_sprites.html index a0bb1058f05889..c5f9fb75f05e8e 100644 --- a/examples/canvas_interactive_particles.html +++ b/examples/canvas_interactive_sprites.html @@ -1,7 +1,7 @@ - three.js canvas - interactive particles + three.js canvas - interactive sprites - + @@ -93,7 +93,11 @@ - + - + @@ -87,7 +87,11 @@ - + + + + +
+ three.js - 3D Texture
+ Scanned head data by + Divine Augustine
+ licensed under + CPOL +
+ + + + + + + + + + + diff --git a/examples/webgl2_materials_texture3d_volume.html b/examples/webgl2_materials_texture3d_volume.html new file mode 100644 index 00000000000000..0d621b19d66b72 --- /dev/null +++ b/examples/webgl2_materials_texture3d_volume.html @@ -0,0 +1,212 @@ + + + + three.js webgl - volume rendering example + + + + + + +
+ three.js - Float volume render test (mip / isosurface) +
+
+ + + + + + + + + + + + + + + + + diff --git a/examples/webgl_animation_cloth.html b/examples/webgl_animation_cloth.html index 917a09fdcd4a28..c4701508f55d1d 100644 --- a/examples/webgl_animation_cloth.html +++ b/examples/webgl_animation_cloth.html @@ -38,7 +38,7 @@ - + @@ -74,7 +74,11 @@ } - if ( ! Detector.webgl ) Detector.addGetWebGLMessage(); + if ( WEBGL.isWebGLAvailable() === false ) { + + document.body.appendChild( WEBGL.getWebGLErrorMessage() ); + + } var container, stats; var camera, scene, renderer; diff --git a/examples/webgl_animation_keyframes.html b/examples/webgl_animation_keyframes.html index 63825d501b890b..39a7f6ec1e04ba 100644 --- a/examples/webgl_animation_keyframes.html +++ b/examples/webgl_animation_keyframes.html @@ -37,14 +37,14 @@
three.js webgl - animation - keyframes

- Model: Littlest Tokyo by - glenatron, CC Attribution. + Model: Littlest Tokyo by + Glen Fox, CC Attribution.

- + diff --git a/examples/webgl_animation_skinning_blending.html b/examples/webgl_animation_skinning_blending.html index b46d64cd7495b9..70bcdfc8edb6cb 100644 --- a/examples/webgl_animation_skinning_blending.html +++ b/examples/webgl_animation_skinning_blending.html @@ -48,14 +48,18 @@ - + - @@ -218,7 +217,6 @@ scene.add( mesh2 ); helper = new THREE.SkeletonHelper( mesh ); - helper.material.linewidth = 3; helper.visible = false; scene.add( helper ); diff --git a/examples/webgl_buffergeometry.html b/examples/webgl_buffergeometry.html index 6da5a22e5ab88b..28d41d3c60c676 100644 --- a/examples/webgl_buffergeometry.html +++ b/examples/webgl_buffergeometry.html @@ -35,12 +35,16 @@ - + - - - + + + +
three.js webgl - buffer geometry constructed from geometry - by Callum Prentice
- + - + - + - + @@ -94,7 +94,11 @@ - + - + - + - + @@ -54,7 +54,11 @@ - + - + - + - + - + - - + + + @@ -72,7 +72,11 @@ - + - + + @@ -75,7 +75,11 @@ - + - + - + + @@ -127,7 +128,7 @@ var geometry = new THREE.BufferGeometry(); geometry.setFromPoints( [ new THREE.Vector3(), new THREE.Vector3() ] ); - line = new THREE.Line( geometry, new THREE.LineBasicMaterial( { linewidth: 4 } ) ); + line = new THREE.Line( geometry, new THREE.LineBasicMaterial() ); scene.add( line ); loadLeePerrySmith(); @@ -239,19 +240,19 @@ function loadLeePerrySmith( callback ) { - var loader = new THREE.JSONLoader(); + var loader = new THREE.GLTFLoader(); - loader.load( 'models/json/leeperrysmith/LeePerrySmith.json', function( geometry ) { + loader.load( 'models/gltf/LeePerrySmith/LeePerrySmith.glb', function( gltf ) { - var material = new THREE.MeshPhongMaterial( { + mesh = gltf.scene.children[ 0 ]; + mesh.material = new THREE.MeshPhongMaterial( { specular: 0x111111, - map: textureLoader.load( 'models/json/leeperrysmith/Map-COL.jpg' ), - specularMap: textureLoader.load( 'models/json/leeperrysmith/Map-SPEC.jpg' ), - normalMap: textureLoader.load( 'models/json/leeperrysmith/Infinite-Level_02_Tangent_SmoothUV.jpg' ), + map: textureLoader.load( 'models/gltf/LeePerrySmith/Map-COL.jpg' ), + specularMap: textureLoader.load( 'models/gltf/LeePerrySmith/Map-SPEC.jpg' ), + normalMap: textureLoader.load( 'models/gltf/LeePerrySmith/Infinite-Level_02_Tangent_SmoothUV.jpg' ), shininess: 25 } ); - mesh = new THREE.Mesh( geometry, material ); scene.add( mesh ); mesh.scale.set( 10, 10, 10 ); diff --git a/examples/webgl_effects_anaglyph.html b/examples/webgl_effects_anaglyph.html index 4dc0b97395ac9d..0390e81e35ba45 100644 --- a/examples/webgl_effects_anaglyph.html +++ b/examples/webgl_effects_anaglyph.html @@ -28,7 +28,7 @@ color: #ffffff; } - #oldie a { color:#da0 } + #webglmessage a { color:#da0 } @@ -39,11 +39,15 @@ - + - + - + - + - + @@ -65,7 +65,11 @@ - + - + @@ -43,7 +43,11 @@ - + - + - + - + - + - + - + @@ -50,9 +50,13 @@ //////////////////////////////////////////////////////////////////////////////// // Utah/Newell Teapot demo //////////////////////////////////////////////////////////////////////////////// - /*global THREE, Detector, container, dat, window */ + /*global THREE, WEBGL, container, dat, window */ - if ( ! Detector.webgl ) Detector.addGetWebGLMessage(); + if ( WEBGL.isWebGLAvailable() === false ) { + + document.body.appendChild( WEBGL.getWebGLErrorMessage() ); + + } var camera, scene, renderer; var cameraControls; @@ -250,7 +254,8 @@ h.add( effectController, "nonblinn" ).name( "original scale" ).onChange( render ); // shading - h = gui.add( effectController, "newShading", [ "wireframe", "flat", "smooth", "glossy", "textured", "reflective" ] ).name( "Shading" ).onChange( render ); + + gui.add( effectController, "newShading", [ "wireframe", "flat", "smooth", "glossy", "textured", "reflective" ] ).name( "Shading" ).onChange( render ); } diff --git a/examples/webgl_geometry_terrain.html b/examples/webgl_geometry_terrain.html index 4b54e0e543c2e6..16487852093b00 100644 --- a/examples/webgl_geometry_terrain.html +++ b/examples/webgl_geometry_terrain.html @@ -39,14 +39,14 @@ - + - - - - + + - + - + - + @@ -322,7 +322,11 @@ - + @@ -267,7 +267,11 @@ - + @@ -201,7 +201,11 @@ - + @@ -103,7 +103,11 @@ + + - + - + - + - + - - + + + + + + + + + diff --git a/examples/webgl_lights_hemisphere.html b/examples/webgl_lights_hemisphere.html index 51683637464726..9f56f6a11b6354 100644 --- a/examples/webgl_lights_hemisphere.html +++ b/examples/webgl_lights_hemisphere.html @@ -47,7 +47,7 @@ - + @@ -86,7 +86,11 @@ - + - + - + - + - + - + - + - + - + @@ -55,7 +55,11 @@ - + @@ -53,7 +53,11 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - +
three.js - Texture loader using ImageBitmap
- + - + - + - - + + - - - + + + - - - - + + + + - - + + - diff --git a/examples/webgl_loader_mmd_audio.html b/examples/webgl_loader_mmd_audio.html index 529ccf2008628c..2350066fb42dfe 100644 --- a/examples/webgl_loader_mmd_audio.html +++ b/examples/webgl_loader_mmd_audio.html @@ -47,7 +47,6 @@ - - diff --git a/examples/webgl_loader_nodes.html b/examples/webgl_loader_nodes.html index ea748474efa190..2238c40a96b3c1 100644 --- a/examples/webgl_loader_nodes.html +++ b/examples/webgl_loader_nodes.html @@ -109,7 +109,7 @@ gui = new dat.GUI(); - var example = gui.add( param, 'load', { + gui.add( param, 'load', { 'caustic': 'caustic', 'displace': 'displace', 'wave': 'wave', diff --git a/examples/webgl_loader_nrrd.html b/examples/webgl_loader_nrrd.html index ad33d0c340a79a..e600b73fa92ca7 100644 --- a/examples/webgl_loader_nrrd.html +++ b/examples/webgl_loader_nrrd.html @@ -56,14 +56,18 @@ - + diff --git a/examples/webgl_loader_obj2_meshspray.html b/examples/webgl_loader_obj2_meshspray.html index 0ad2726f99671d..243a8141ae7682 100644 --- a/examples/webgl_loader_obj2_meshspray.html +++ b/examples/webgl_loader_obj2_meshspray.html @@ -72,7 +72,6 @@
- diff --git a/examples/webgl_loader_obj2_options.html b/examples/webgl_loader_obj2_options.html index de8fc3cf049b9d..9708579d975e16 100644 --- a/examples/webgl_loader_obj2_options.html +++ b/examples/webgl_loader_obj2_options.html @@ -72,7 +72,6 @@
- diff --git a/examples/webgl_loader_obj2_run_director.html b/examples/webgl_loader_obj2_run_director.html index 72d76098ca6317..3089427c421568 100644 --- a/examples/webgl_loader_obj2_run_director.html +++ b/examples/webgl_loader_obj2_run_director.html @@ -78,7 +78,6 @@
- diff --git a/examples/webgl_loader_obj_mtl.html b/examples/webgl_loader_obj_mtl.html index 22eda8c6e8d655..a07c933f2c114e 100644 --- a/examples/webgl_loader_obj_mtl.html +++ b/examples/webgl_loader_obj_mtl.html @@ -36,7 +36,6 @@ - - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -91,7 +91,11 @@ exposure: 1.0, }; - if ( ! Detector.webgl ) Detector.addGetWebGLMessage(); + if ( WEBGL.isWebGLAvailable() === false ) { + + document.body.appendChild( WEBGL.getWebGLErrorMessage() ); + + } var container, stats; @@ -111,7 +115,8 @@ var loader = new THREE.EXRLoader(); - var texture = loader.load( "textures/piz_compressed.exr", function( texture, textureData ){ + loader.load( "textures/piz_compressed.exr", function( texture, textureData ) { + console.log( textureData.header ); // exr header texture.minFilter = THREE.NearestFilter; @@ -133,6 +138,7 @@ quad.position.z = -100; scene.add( quad ); animate(); + } ); renderer = new THREE.WebGLRenderer(); diff --git a/examples/webgl_loader_texture_hdr.html b/examples/webgl_loader_texture_hdr.html index 66f1572077ce60..055ef58751dd49 100644 --- a/examples/webgl_loader_texture_hdr.html +++ b/examples/webgl_loader_texture_hdr.html @@ -40,11 +40,15 @@ - + - + - + - + - +
@@ -41,7 +41,11 @@ - + - + - + - + + + + + + - + - - + if ( WEBGL.isWebGLAvailable() === false ) { - + diff --git a/examples/webgl_lod.html b/examples/webgl_lod.html index 779c729250893e..31dfd0c75ee722 100644 --- a/examples/webgl_lod.html +++ b/examples/webgl_lod.html @@ -40,12 +40,16 @@ - + - + - + - + - + + - + - + + + - + + + + - + diff --git a/examples/webgl_materials_channels.html b/examples/webgl_materials_channels.html index 2bf7b581731714..d682e9262f715d 100644 --- a/examples/webgl_materials_channels.html +++ b/examples/webgl_materials_channels.html @@ -45,13 +45,17 @@ - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/examples/webgl_materials_cubemap_refraction.html b/examples/webgl_materials_cubemap_refraction.html index 449419c04d71a9..29dce92455461e 100644 --- a/examples/webgl_materials_cubemap_refraction.html +++ b/examples/webgl_materials_cubemap_refraction.html @@ -22,7 +22,7 @@ #d { text-align:center; margin:1em auto -9.5em; z-index:200; position:relative; display:block; background:rgba(0,0,0,0.5); padding:0.5em; width:400px; border-radius:15px; -webkit-box-shadow: 0px 0px 10px rgba(0,0,0,0.5) } - #oldie { margin-top:15em !important } + #webglmessage { margin-top:15em !important } @@ -38,12 +38,16 @@ - + - + @@ -73,7 +73,11 @@ - + - + @@ -45,7 +45,11 @@ - + @@ -46,7 +46,11 @@ - + - + + + + + + + + + + + + + diff --git a/examples/webgl_materials_modified.html b/examples/webgl_materials_modified.html index e2021a54f3aed3..83679460f48f0f 100644 --- a/examples/webgl_materials_modified.html +++ b/examples/webgl_materials_modified.html @@ -29,7 +29,7 @@ z-index:1000; } - #oldie { + #webglmessage { background:rgb(200,100,0) !important; color:#fff; } @@ -45,13 +45,18 @@ + - + - + + - + @@ -69,7 +70,11 @@ - + - + @@ -57,7 +57,11 @@ - + @@ -54,7 +54,11 @@ - + - - + + - + - + - + - + - + - + @@ -41,7 +41,11 @@ - + - + @@ -41,7 +41,11 @@ - + - + - + - + - + - + - + - +
- + - + - - + - + - + - + - + - + - + - + - + @@ -44,9 +44,12 @@ - + - + - + - + - + - + - + + + - + @@ -57,7 +57,11 @@ - + @@ -50,7 +50,11 @@ - + - +
@@ -45,7 +45,11 @@ - + - \ No newline at end of file + diff --git a/examples/webgl_postprocessing_outline.html b/examples/webgl_postprocessing_outline.html index b04a3c86927184..7bb620ae730dd8 100644 --- a/examples/webgl_postprocessing_outline.html +++ b/examples/webgl_postprocessing_outline.html @@ -37,7 +37,7 @@ - + @@ -54,7 +54,11 @@ - + @@ -53,9 +53,9 @@ - + @@ -54,7 +54,11 @@ - + @@ -50,7 +50,11 @@ - + @@ -61,7 +61,11 @@ - diff --git a/examples/webgl_raycast_texture.html b/examples/webgl_raycast_texture.html index ea777120881e74..f6129236d36e28 100644 --- a/examples/webgl_raycast_texture.html +++ b/examples/webgl_raycast_texture.html @@ -181,7 +181,7 @@ } - } + }; var width = window.innerWidth; var height = window.innerHeight; diff --git a/examples/webgl_read_float_buffer.html b/examples/webgl_read_float_buffer.html index bbbdf9f3683df9..1b655cacc88232 100644 --- a/examples/webgl_read_float_buffer.html +++ b/examples/webgl_read_float_buffer.html @@ -35,7 +35,7 @@ - + - + @@ -45,7 +45,11 @@ - + - + - + - + - + - + - + @@ -58,7 +58,11 @@ - + diff --git a/examples/webgl_shadowmap.html b/examples/webgl_shadowmap.html index e01a991e061a09..778ab9c430812a 100644 --- a/examples/webgl_shadowmap.html +++ b/examples/webgl_shadowmap.html @@ -40,12 +40,16 @@ - + - + @@ -134,7 +134,11 @@ - + - + - + - + - + - + @@ -51,7 +51,11 @@ - + @@ -47,7 +47,11 @@ - + @@ -47,7 +47,11 @@ +
@@ -52,7 +52,11 @@ + - - + diff --git a/examples/webvr_ballshooter.html b/examples/webvr_ballshooter.html index c6e87a7c05bffa..05e7a8507c131a 100644 --- a/examples/webvr_ballshooter.html +++ b/examples/webvr_ballshooter.html @@ -4,12 +4,12 @@ three.js webvr - ball shooter - - - - - - + + + + + +