Skip to content

Commit

Permalink
Merge branch 'dev' into batchedMesh-setColorAt
Browse files Browse the repository at this point in the history
  • Loading branch information
Kikedao committed May 10, 2024
2 parents 3b173f0 + a13bb05 commit 3107348
Show file tree
Hide file tree
Showing 298 changed files with 2,810 additions and 1,575 deletions.
14 changes: 12 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ macos-latest ]
os: [ windows-latest ]
CI: [ 0, 1, 2, 3 ]
env:
CI: ${{ matrix.CI }}
Expand All @@ -92,10 +92,20 @@ jobs:
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4
if: always()
with:
name: Output screenshots
name: Output screenshots-${{ matrix.os }}-${{ matrix.CI }}
path: test/e2e/output-screenshots
if-no-files-found: ignore

merge:
runs-on: ${{ matrix.os }}
needs: [ e2e ]
steps:
- name: Merge Artifacts
uses: actions/upload-artifact/merge@v4
with:
name: artifacts
pattern: Output screenshots-*

e2e-cov:
name: Examples ready for release
runs-on: ubuntu-latest
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ scene.add( mesh );

const renderer = new THREE.WebGLRenderer( { antialias: true } );
renderer.setSize( width, height );
renderer.setAnimationLoop( animation );
renderer.setAnimationLoop( animate );
document.body.appendChild( renderer.domElement );

// animation

function animation( time ) {
function animate( time ) {

mesh.rotation.x = time / 2000;
mesh.rotation.y = time / 1000;
Expand All @@ -58,7 +58,7 @@ function animation( time ) {
}
```

If everything goes well, you should see [this](https://jsfiddle.net/2nyxkmco/).
If everything goes well, you should see [this](https://jsfiddle.net/v98k6oze/).

### Cloning this repository

Expand Down
126 changes: 120 additions & 6 deletions build/three.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/
'use strict';

const REVISION = '164';
const REVISION = '165dev';

const MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2 };
const TOUCH = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 };
Expand Down Expand Up @@ -3079,6 +3079,20 @@ class DataArrayTexture extends Texture {
this.flipY = false;
this.unpackAlignment = 1;

this.layerUpdates = new Set();

}

addLayerUpdate( layerIndex ) {

this.layerUpdates.add( layerIndex );

}

clearLayerUpdates() {

this.layerUpdates.clear();

}

}
Expand Down Expand Up @@ -17322,7 +17336,7 @@ function WebGLExtensions( gl ) {

if ( extension === null ) {

console.warn( 'THREE.WebGLRenderer: ' + name + ' extension not supported.' );
warnOnce( 'THREE.WebGLRenderer: ' + name + ' extension not supported.' );

}

Expand Down Expand Up @@ -24583,7 +24597,22 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,

if ( dataReady ) {

state.compressedTexSubImage3D( _gl.TEXTURE_2D_ARRAY, i, 0, 0, 0, mipmap.width, mipmap.height, image.depth, glFormat, mipmap.data, 0, 0 );
if ( texture.layerUpdates.size > 0 ) {

for ( const layerIndex of texture.layerUpdates ) {

const layerSize = mipmap.width * mipmap.height;
state.compressedTexSubImage3D( _gl.TEXTURE_2D_ARRAY, i, 0, 0, layerIndex, mipmap.width, mipmap.height, 1, glFormat, mipmap.data.slice( layerSize * layerIndex, layerSize * ( layerIndex + 1 ) ), 0, 0 );

}

texture.clearLayerUpdates();

} else {

state.compressedTexSubImage3D( _gl.TEXTURE_2D_ARRAY, i, 0, 0, 0, mipmap.width, mipmap.height, image.depth, glFormat, mipmap.data, 0, 0 );

}

}

Expand Down Expand Up @@ -24689,7 +24718,72 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,

if ( dataReady ) {

state.texSubImage3D( _gl.TEXTURE_2D_ARRAY, 0, 0, 0, 0, image.width, image.height, image.depth, glFormat, glType, image.data );
if ( texture.layerUpdates.size > 0 ) {

// When type is GL_UNSIGNED_BYTE, each of these bytes is
// interpreted as one color component, depending on format. When
// type is one of GL_UNSIGNED_SHORT_5_6_5,
// GL_UNSIGNED_SHORT_4_4_4_4, GL_UNSIGNED_SHORT_5_5_5_1, each
// unsigned value is interpreted as containing all the components
// for a single pixel, with the color components arranged
// according to format.
//
// See https://registry.khronos.org/OpenGL-Refpages/es1.1/xhtml/glTexImage2D.xml
let texelSize;
switch ( glType ) {

case _gl.UNSIGNED_BYTE:
switch ( glFormat ) {

case _gl.ALPHA:
texelSize = 1;
break;
case _gl.LUMINANCE:
texelSize = 1;
break;
case _gl.LUMINANCE_ALPHA:
texelSize = 2;
break;
case _gl.RGB:
texelSize = 3;
break;
case _gl.RGBA:
texelSize = 4;
break;

default:
throw new Error( `Unknown texel size for format ${glFormat}.` );

}

break;

case _gl.UNSIGNED_SHORT_4_4_4_4:
case _gl.UNSIGNED_SHORT_5_5_5_1:
case _gl.UNSIGNED_SHORT_5_6_5:
texelSize = 1;
break;

default:
throw new Error( `Unknown texel size for type ${glType}.` );

}

const layerSize = image.width * image.height * texelSize;

for ( const layerIndex of texture.layerUpdates ) {

state.texSubImage3D( _gl.TEXTURE_2D_ARRAY, 0, 0, 0, layerIndex, image.width, image.height, 1, glFormat, glType, image.data.slice( layerSize * layerIndex, layerSize * ( layerIndex + 1 ) ) );

}

texture.clearLayerUpdates();

} else {

state.texSubImage3D( _gl.TEXTURE_2D_ARRAY, 0, 0, 0, 0, image.width, image.height, image.depth, glFormat, glType, image.data );

}

}

Expand Down Expand Up @@ -34389,6 +34483,20 @@ class CompressedArrayTexture extends CompressedTexture {
this.image.depth = depth;
this.wrapR = ClampToEdgeWrapping;

this.layerUpdates = new Set();

}

addLayerUpdates( layerIndex ) {

this.layerUpdates.add( layerIndex );

}

clearLayerUpdates() {

this.layerUpdates.clear();

}

}
Expand Down Expand Up @@ -43503,6 +43611,10 @@ class FileLoader extends Loader {

}

}, ( e ) => {

controller.error( e );

} );

}
Expand Down Expand Up @@ -50996,13 +51108,15 @@ function ascSort( a, b ) {

function intersect( object, raycaster, intersects, recursive ) {

let stopTraversal = false;

if ( object.layers.test( raycaster.layers ) ) {

object.raycast( raycaster, intersects );
stopTraversal = object.raycast( raycaster, intersects );

}

if ( recursive === true ) {
if ( recursive === true && stopTraversal !== true ) {

const children = object.children;

Expand Down

0 comments on commit 3107348

Please sign in to comment.