Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
155 changes: 89 additions & 66 deletions build/three.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -24072,15 +24072,6 @@ class Skeleton {
*/
this.boneMatrices = null;

/**
* An array buffer holding the bone data of the previous frame.
* Required for computing velocity. Maintained in {@link SkinningNode}.
*
* @type {?Float32Array}
* @default null
*/
this.previousBoneMatrices = null;

/**
* A texture holding the bone data for use
* in the vertex shader.
Expand Down Expand Up @@ -24506,15 +24497,6 @@ class InstancedMesh extends Mesh {
*/
this.instanceMatrix = new InstancedBufferAttribute( new Float32Array( count * 16 ), 16 );

/**
* Represents the local transformation of all instances of the previous frame.
* Required for computing velocity. Maintained in {@link InstanceNode}.
*
* @type {?InstancedBufferAttribute}
* @default null
*/
this.previousInstanceMatrix = null;

/**
* Represents the color of all instances. You have to set its
* {@link BufferAttribute#needsUpdate} flag to true if you modify instanced data
Expand Down Expand Up @@ -24644,8 +24626,6 @@ class InstancedMesh extends Mesh {

this.instanceMatrix.copy( source.instanceMatrix );

if ( source.previousInstanceMatrix !== null ) this.previousInstanceMatrix = source.previousInstanceMatrix.clone();

if ( source.morphTexture !== null ) this.morphTexture = source.morphTexture.clone();
if ( source.instanceColor !== null ) this.instanceColor = source.instanceColor.clone();

Expand Down Expand Up @@ -36309,6 +36289,10 @@ class SphereGeometry extends BufferGeometry {
const verticesRow = [];

const v = iy / heightSegments;
const theta = thetaStart + v * thetaLength;

const y = radius * Math.cos( theta );
const ringRadius = Math.sqrt( radius * radius - y * y );

// special case for the poles

Expand All @@ -36327,12 +36311,13 @@ class SphereGeometry extends BufferGeometry {
for ( let ix = 0; ix <= widthSegments; ix ++ ) {

const u = ix / widthSegments;
const phi = phiStart + u * phiLength;

// vertex

vertex.x = - radius * Math.cos( phiStart + u * phiLength ) * Math.sin( thetaStart + v * thetaLength );
vertex.y = radius * Math.cos( thetaStart + v * thetaLength );
vertex.z = radius * Math.sin( phiStart + u * phiLength ) * Math.sin( thetaStart + v * thetaLength );
vertex.x = - ringRadius * Math.cos( phi );
vertex.y = y;
vertex.z = ringRadius * Math.sin( phi );

vertices.push( vertex.x, vertex.y, vertex.z );

Expand Down Expand Up @@ -48814,6 +48799,8 @@ class ObjectLoader extends Loader {

function loadImage( url ) {

url = scope.manager.resolveURL( url );

scope.manager.itemStart( url );

return loader.load( url, function () {
Expand Down Expand Up @@ -60413,7 +60400,7 @@ const fragment$e = "#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\

const vertex$d = "#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <skinbase_vertex>\n\t#include <morphinstance_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}";

const fragment$d = "#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <clipping_planes_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = vec4( dist, 0.0, 0.0, 1.0 );\n}";
const fragment$d = "#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <clipping_planes_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = vec4( dist, 0.0, 0.0, 1.0 );\n}";

const vertex$c = "varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}";

Expand Down Expand Up @@ -68153,12 +68140,20 @@ function WebGLRenderList() {

}

function sort( customOpaqueSort, customTransparentSort ) {
function sort( customOpaqueSort, customTransparentSort, reversedDepth ) {

if ( opaque.length > 1 ) opaque.sort( customOpaqueSort || painterSortStable );
if ( transmissive.length > 1 ) transmissive.sort( customTransparentSort || reversePainterSortStable );
if ( transparent.length > 1 ) transparent.sort( customTransparentSort || reversePainterSortStable );

if ( reversedDepth ) {

opaque.reverse();
transmissive.reverse();
transparent.reverse();

}

}

function finish() {
Expand Down Expand Up @@ -75524,73 +75519,101 @@ function WebGLUniformsGroups( gl, info, capabilities, state ) {

for ( let i = 0, il = uniforms.length; i < il; i ++ ) {

const uniformArray = Array.isArray( uniforms[ i ] ) ? uniforms[ i ] : [ uniforms[ i ] ];
const uniformItem = uniforms[ i ];

for ( let j = 0, jl = uniformArray.length; j < jl; j ++ ) {
if ( Array.isArray( uniformItem ) ) {

const uniform = uniformArray[ j ];
for ( let j = 0, jl = uniformItem.length; j < jl; j ++ ) {

if ( hasUniformChanged( uniform, i, j, cache ) === true ) {
updateUniform( uniformItem[ j ], i, j, cache );

const offset = uniform.__offset;
}

const values = Array.isArray( uniform.value ) ? uniform.value : [ uniform.value ];
} else {

let arrayOffset = 0;
updateUniform( uniformItem, i, 0, cache );

for ( let k = 0; k < values.length; k ++ ) {
}

const value = values[ k ];
}

const info = getUniformSize( value );
gl.bindBuffer( gl.UNIFORM_BUFFER, null );

// TODO add integer and struct support
if ( typeof value === 'number' || typeof value === 'boolean' ) {
}

uniform.__data[ 0 ] = value;
gl.bufferSubData( gl.UNIFORM_BUFFER, offset + arrayOffset, uniform.__data );
function updateUniform( uniform, index, indexArray, cache ) {

} else if ( value.isMatrix3 ) {
if ( hasUniformChanged( uniform, index, indexArray, cache ) === true ) {

// manually converting 3x3 to 3x4
const offset = uniform.__offset;
const value = uniform.value;

uniform.__data[ 0 ] = value.elements[ 0 ];
uniform.__data[ 1 ] = value.elements[ 1 ];
uniform.__data[ 2 ] = value.elements[ 2 ];
uniform.__data[ 3 ] = 0;
uniform.__data[ 4 ] = value.elements[ 3 ];
uniform.__data[ 5 ] = value.elements[ 4 ];
uniform.__data[ 6 ] = value.elements[ 5 ];
uniform.__data[ 7 ] = 0;
uniform.__data[ 8 ] = value.elements[ 6 ];
uniform.__data[ 9 ] = value.elements[ 7 ];
uniform.__data[ 10 ] = value.elements[ 8 ];
uniform.__data[ 11 ] = 0;
if ( Array.isArray( value ) ) {

} else if ( ArrayBuffer.isView( value ) ) {
let arrayOffset = 0;

// copy the buffer data using "set"
uniform.__data.set( new value.constructor( value.buffer, value.byteOffset, uniform.__data.length ) );
for ( let k = 0; k < value.length; k ++ ) {

} else {
const val = value[ k ];
const info = getUniformSize( val );

value.toArray( uniform.__data, arrayOffset );
writeUniformValue( val, uniform.__data, arrayOffset );

arrayOffset += info.storage / Float32Array.BYTES_PER_ELEMENT;
// only toArray() values advance arrayOffset
if ( typeof val !== 'number' && typeof val !== 'boolean' && ! val.isMatrix3 && ! ArrayBuffer.isView( val ) ) {

}
arrayOffset += info.storage / Float32Array.BYTES_PER_ELEMENT;

}

gl.bufferSubData( gl.UNIFORM_BUFFER, offset, uniform.__data );

}

} else {

writeUniformValue( value, uniform.__data, 0 );

}

gl.bufferSubData( gl.UNIFORM_BUFFER, offset, uniform.__data );

}

gl.bindBuffer( gl.UNIFORM_BUFFER, null );
}

function writeUniformValue( value, data, offset ) {

// TODO add integer and struct support
if ( typeof value === 'number' || typeof value === 'boolean' ) {

data[ 0 ] = value;

} else if ( value.isMatrix3 ) {

// manually converting 3x3 to 3x4

data[ 0 ] = value.elements[ 0 ];
data[ 1 ] = value.elements[ 1 ];
data[ 2 ] = value.elements[ 2 ];
data[ 3 ] = 0;
data[ 4 ] = value.elements[ 3 ];
data[ 5 ] = value.elements[ 4 ];
data[ 6 ] = value.elements[ 5 ];
data[ 7 ] = 0;
data[ 8 ] = value.elements[ 6 ];
data[ 9 ] = value.elements[ 7 ];
data[ 10 ] = value.elements[ 8 ];
data[ 11 ] = 0;

} else if ( ArrayBuffer.isView( value ) ) {

// copy the buffer data using "set"
data.set( new value.constructor( value.buffer, value.byteOffset, data.length ) );

} else {

value.toArray( data, offset );

}

}

Expand Down Expand Up @@ -77512,7 +77535,7 @@ class WebGLRenderer {

if ( _this.sortObjects === true ) {

currentRenderList.sort( _opaqueSort, _transparentSort );
currentRenderList.sort( _opaqueSort, _transparentSort, camera.reversedDepth );

}

Expand All @@ -77527,6 +77550,8 @@ class WebGLRenderer {

this.info.render.frame ++;

if ( this.info.autoReset === true ) this.info.reset();

if ( _clippingEnabled === true ) clipping.beginShadows();

const shadowsArray = currentRenderState.state.shadowsArray;
Expand All @@ -77537,8 +77562,6 @@ class WebGLRenderer {

//

if ( this.info.autoReset === true ) this.info.reset();

// render scene (skip if first effect is a render pass - it will render the scene itself)

const skipSceneRender = useOutput && output.hasRenderPass();
Expand Down
33 changes: 10 additions & 23 deletions build/three.core.js
Original file line number Diff line number Diff line change
Expand Up @@ -24092,15 +24092,6 @@ class Skeleton {
*/
this.boneMatrices = null;

/**
* An array buffer holding the bone data of the previous frame.
* Required for computing velocity. Maintained in {@link SkinningNode}.
*
* @type {?Float32Array}
* @default null
*/
this.previousBoneMatrices = null;

/**
* A texture holding the bone data for use
* in the vertex shader.
Expand Down Expand Up @@ -24526,15 +24517,6 @@ class InstancedMesh extends Mesh {
*/
this.instanceMatrix = new InstancedBufferAttribute( new Float32Array( count * 16 ), 16 );

/**
* Represents the local transformation of all instances of the previous frame.
* Required for computing velocity. Maintained in {@link InstanceNode}.
*
* @type {?InstancedBufferAttribute}
* @default null
*/
this.previousInstanceMatrix = null;

/**
* Represents the color of all instances. You have to set its
* {@link BufferAttribute#needsUpdate} flag to true if you modify instanced data
Expand Down Expand Up @@ -24664,8 +24646,6 @@ class InstancedMesh extends Mesh {

this.instanceMatrix.copy( source.instanceMatrix );

if ( source.previousInstanceMatrix !== null ) this.previousInstanceMatrix = source.previousInstanceMatrix.clone();

if ( source.morphTexture !== null ) this.morphTexture = source.morphTexture.clone();
if ( source.instanceColor !== null ) this.instanceColor = source.instanceColor.clone();

Expand Down Expand Up @@ -36329,6 +36309,10 @@ class SphereGeometry extends BufferGeometry {
const verticesRow = [];

const v = iy / heightSegments;
const theta = thetaStart + v * thetaLength;

const y = radius * Math.cos( theta );
const ringRadius = Math.sqrt( radius * radius - y * y );

// special case for the poles

Expand All @@ -36347,12 +36331,13 @@ class SphereGeometry extends BufferGeometry {
for ( let ix = 0; ix <= widthSegments; ix ++ ) {

const u = ix / widthSegments;
const phi = phiStart + u * phiLength;

// vertex

vertex.x = - radius * Math.cos( phiStart + u * phiLength ) * Math.sin( thetaStart + v * thetaLength );
vertex.y = radius * Math.cos( thetaStart + v * thetaLength );
vertex.z = radius * Math.sin( phiStart + u * phiLength ) * Math.sin( thetaStart + v * thetaLength );
vertex.x = - ringRadius * Math.cos( phi );
vertex.y = y;
vertex.z = ringRadius * Math.sin( phi );

vertices.push( vertex.x, vertex.y, vertex.z );

Expand Down Expand Up @@ -48834,6 +48819,8 @@ class ObjectLoader extends Loader {

function loadImage( url ) {

url = scope.manager.resolveURL( url );

scope.manager.itemStart( url );

return loader.load( url, function () {
Expand Down
2 changes: 1 addition & 1 deletion build/three.core.min.js

Large diffs are not rendered by default.

Loading
Loading