Skip to content

[pull] dev from mrdoob:dev #721

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 9, 2025
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
12 changes: 6 additions & 6 deletions examples/jsm/controls/DragControls.js
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ function onPointerMove( event ) {
if ( raycaster.ray.intersectPlane( _plane, _intersection ) ) {

_selected.position.copy( _intersection.sub( _offset ).applyMatrix4( _inverseMatrix ) );
this.dispatchEvent( { type: 'drag', object: _selected } );

}

Expand All @@ -313,11 +314,10 @@ function onPointerMove( event ) {
_diff.subVectors( _pointer, _previousPointer ).multiplyScalar( this.rotateSpeed );
_selected.rotateOnWorldAxis( _up, _diff.x );
_selected.rotateOnWorldAxis( _right.normalize(), - _diff.y );
this.dispatchEvent( { type: 'drag', object: _selected } );

}

this.dispatchEvent( { type: 'drag', object: _selected } );

_previousPointer.copy( _pointer );

} else {
Expand Down Expand Up @@ -414,21 +414,21 @@ function onPointerDown( event ) {

_inverseMatrix.copy( _selected.parent.matrixWorld ).invert();
_offset.copy( _intersection ).sub( _worldPosition.setFromMatrixPosition( _selected.matrixWorld ) );
domElement.style.cursor = 'move';
this.dispatchEvent( { type: 'dragstart', object: _selected } );

} else if ( this.state === STATE.ROTATE ) {

// the controls only support Y+ up
_up.set( 0, 1, 0 ).applyQuaternion( camera.quaternion ).normalize();
_right.set( 1, 0, 0 ).applyQuaternion( camera.quaternion ).normalize();
domElement.style.cursor = 'move';
this.dispatchEvent( { type: 'dragstart', object: _selected } );

}

}

domElement.style.cursor = 'move';

this.dispatchEvent( { type: 'dragstart', object: _selected } );

}

_previousPointer.copy( _pointer );
Expand Down
21 changes: 19 additions & 2 deletions examples/jsm/loaders/KTX2Loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,12 @@ import {
RGB_ETC2_Format,
RGB_PVRTC_4BPPV1_Format,
RGB_S3TC_DXT1_Format,
RGBFormat,
RGFormat,
RedFormat,
SRGBColorSpace,
UnsignedByteType
UnsignedByteType,
UnsignedInt5999Type
} from 'three';
import { WorkerPool } from '../utils/WorkerPool.js';
import {
Expand Down Expand Up @@ -70,6 +72,7 @@ import {
VK_FORMAT_R8G8_UNORM,
VK_FORMAT_R8_SRGB,
VK_FORMAT_R8_UNORM,
VK_FORMAT_E5B9G9R9_UFLOAT_PACK32,
VK_FORMAT_UNDEFINED
} from '../libs/ktx-parse.module.js';
import { ZSTDDecoder } from '../libs/zstddec.module.js';
Expand Down Expand Up @@ -918,7 +921,7 @@ KTX2Loader.BasisWorker = function () {
// Parsing for non-Basis textures. These textures may have supercompression
// like Zstd, but they do not require transcoding.

const UNCOMPRESSED_FORMATS = new Set( [ RGBAFormat, RGFormat, RedFormat ] );
const UNCOMPRESSED_FORMATS = new Set( [ RGBAFormat, RGBFormat, RGFormat, RedFormat ] );

const FORMAT_MAP = {

Expand All @@ -937,6 +940,8 @@ const FORMAT_MAP = {
[ VK_FORMAT_R8_SRGB ]: RedFormat,
[ VK_FORMAT_R8_UNORM ]: RedFormat,

[ VK_FORMAT_E5B9G9R9_UFLOAT_PACK32 ]: RGBFormat,

[ VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK ]: RGB_ETC2_Format,
[ VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK ]: RGBA_ETC2_EAC_Format,

Expand Down Expand Up @@ -979,6 +984,8 @@ const TYPE_MAP = {
[ VK_FORMAT_R8_SRGB ]: UnsignedByteType,
[ VK_FORMAT_R8_UNORM ]: UnsignedByteType,

[ VK_FORMAT_E5B9G9R9_UFLOAT_PACK32 ]: UnsignedInt5999Type,

[ VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK ]: UnsignedByteType,
[ VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK ]: UnsignedByteType,

Expand Down Expand Up @@ -1071,6 +1078,16 @@ async function createRawTexture( container ) {

);

} else if ( TYPE_MAP[ vkFormat ] === UnsignedInt5999Type ) {

data = new Uint32Array(

levelData.buffer,
levelData.byteOffset,
levelData.byteLength / Uint32Array.BYTES_PER_ELEMENT

);

} else {

data = levelData;
Expand Down
Binary file added examples/textures/ktx2/2d_rgb9e5_linear.ktx2
Binary file not shown.
1 change: 1 addition & 0 deletions examples/webgl_loader_texture_ktx2.html
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@
{ path: '2d_rgba8_linear.ktx2' },
{ path: '2d_rgba16_linear.ktx2' },
{ path: '2d_rgba32_linear.ktx2' },
{ path: '2d_rgb9e5_linear.ktx2' },
]
},
{
Expand Down
4 changes: 3 additions & 1 deletion src/nodes/accessors/InstanceNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,9 @@ class InstanceNode extends Node {
*/
setup( builder ) {

const { count, instanceMatrix, instanceColor } = this;
const { instanceMatrix, instanceColor } = this;

const { count } = instanceMatrix;

let { instanceMatrixNode, instanceColorNode } = this;

Expand Down