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
6 changes: 6 additions & 0 deletions build/three.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -14756,6 +14756,9 @@ class Object3D extends EventDispatcher {

if ( this.matrixAutoUpdate === false ) object.matrixAutoUpdate = false;

if ( this.morphTargetDictionary !== undefined ) object.morphTargetDictionary = Object.assign( {}, this.morphTargetDictionary );
if ( this.morphTargetInfluences !== undefined ) object.morphTargetInfluences = this.morphTargetInfluences.slice();

// object specific properties

if ( this.isInstancedMesh ) {
Expand Down Expand Up @@ -49390,6 +49393,9 @@ class ObjectLoader extends Loader {

if ( data.pivot !== undefined ) object.pivot = new Vector3().fromArray( data.pivot );

if ( data.morphTargetDictionary !== undefined ) object.morphTargetDictionary = Object.assign( {}, data.morphTargetDictionary );
if ( data.morphTargetInfluences !== undefined ) object.morphTargetInfluences = data.morphTargetInfluences.slice();

if ( data.castShadow !== undefined ) object.castShadow = data.castShadow;
if ( data.receiveShadow !== undefined ) object.receiveShadow = data.receiveShadow;

Expand Down
6 changes: 6 additions & 0 deletions build/three.core.js
Original file line number Diff line number Diff line change
Expand Up @@ -14754,6 +14754,9 @@ class Object3D extends EventDispatcher {

if ( this.matrixAutoUpdate === false ) object.matrixAutoUpdate = false;

if ( this.morphTargetDictionary !== undefined ) object.morphTargetDictionary = Object.assign( {}, this.morphTargetDictionary );
if ( this.morphTargetInfluences !== undefined ) object.morphTargetInfluences = this.morphTargetInfluences.slice();

// object specific properties

if ( this.isInstancedMesh ) {
Expand Down Expand Up @@ -49388,6 +49391,9 @@ class ObjectLoader extends Loader {

if ( data.pivot !== undefined ) object.pivot = new Vector3().fromArray( data.pivot );

if ( data.morphTargetDictionary !== undefined ) object.morphTargetDictionary = Object.assign( {}, data.morphTargetDictionary );
if ( data.morphTargetInfluences !== undefined ) object.morphTargetInfluences = data.morphTargetInfluences.slice();

if ( data.castShadow !== undefined ) object.castShadow = data.castShadow;
if ( data.receiveShadow !== undefined ) object.receiveShadow = data.receiveShadow;

Expand Down
2 changes: 1 addition & 1 deletion build/three.core.min.js

Large diffs are not rendered by default.

55 changes: 38 additions & 17 deletions build/three.webgpu.js
Original file line number Diff line number Diff line change
Expand Up @@ -14205,7 +14205,7 @@ const normalViewGeometry = /*@__PURE__*/ ( Fn( ( builder ) => {

let node;

if ( builder.material.flatShading === true ) {
if ( builder.isFlatShading() ) {

node = normalFlat;

Expand All @@ -14229,7 +14229,7 @@ const normalWorldGeometry = /*@__PURE__*/ ( Fn( ( builder ) => {

let normal = normalViewGeometry.transformDirection( cameraViewMatrix );

if ( builder.material.flatShading !== true ) {
if ( builder.isFlatShading() !== true ) {

normal = normal.toVarying( 'v_normalWorldGeometry' );

Expand All @@ -14245,15 +14245,15 @@ const normalWorldGeometry = /*@__PURE__*/ ( Fn( ( builder ) => {
* @tsl
* @type {Node<vec3>}
*/
const normalView = /*@__PURE__*/ ( Fn( ( { subBuildFn, material, context } ) => {
const normalView = /*@__PURE__*/ ( Fn( ( builder ) => {

let node;

if ( subBuildFn === 'NORMAL' || subBuildFn === 'VERTEX' ) {
if ( builder.subBuildFn === 'NORMAL' || builder.subBuildFn === 'VERTEX' ) {

node = normalViewGeometry;

if ( material.flatShading !== true ) {
if ( builder.isFlatShading() !== true ) {

node = directionToFaceDirection( node );

Expand All @@ -14263,7 +14263,7 @@ const normalView = /*@__PURE__*/ ( Fn( ( { subBuildFn, material, context } ) =>

// Use getUV context to avoid side effects from nodes overwriting getUV in the context (e.g. EnvironmentNode)

node = context.setupNormal().context( { getUV: null } );
node = builder.context.setupNormal().context( { getUV: null } );

}

Expand Down Expand Up @@ -15239,11 +15239,11 @@ const tangentLocal = /*@__PURE__*/ tangentGeometry.xyz.toVar( 'tangentLocal' );
* @tsl
* @type {Node<vec3>}
*/
const tangentView = /*@__PURE__*/ ( Fn( ( { subBuildFn, geometry, material } ) => {
const tangentView = /*@__PURE__*/ ( Fn( ( builder ) => {

let node;

if ( subBuildFn === 'VERTEX' || geometry.hasAttribute( 'tangent' ) ) {
if ( builder.subBuildFn === 'VERTEX' || builder.geometry.hasAttribute( 'tangent' ) ) {

node = modelViewMatrix.mul( vec4( tangentLocal, 0 ) ).xyz.toVarying( 'v_tangentView' ).normalize();

Expand All @@ -15253,7 +15253,7 @@ const tangentView = /*@__PURE__*/ ( Fn( ( { subBuildFn, geometry, material } ) =

}

if ( material.flatShading !== true ) {
if ( builder.isFlatShading() !== true ) {

node = directionToFaceDirection( node );

Expand All @@ -15280,11 +15280,11 @@ const tangentWorld = /*@__PURE__*/ tangentView.transformDirection( cameraViewMat
* @param {string} varyingName - The name of the varying to assign the bitangent to.
* @returns {Node<vec3>} The bitangent node.
*/
const getBitangent = /*@__PURE__*/ Fn( ( [ crossNormalTangent, varyingName ], { subBuildFn, material } ) => {
const getBitangent = /*@__PURE__*/ Fn( ( [ crossNormalTangent, varyingName ], builder ) => {

let bitangent = crossNormalTangent.mul( tangentGeometry.w ).xyz;

if ( subBuildFn === 'NORMAL' && material.flatShading !== true ) {
if ( builder.subBuildFn === 'NORMAL' && builder.isFlatShading() !== true ) {

bitangent = bitangent.toVarying( varyingName );

Expand Down Expand Up @@ -15316,11 +15316,11 @@ const bitangentLocal = /*@__PURE__*/ getBitangent( normalLocal.cross( tangentLoc
* @tsl
* @type {Node<vec3>}
*/
const bitangentView = /*@__PURE__*/ ( Fn( ( { subBuildFn, geometry, material } ) => {
const bitangentView = /*@__PURE__*/ ( Fn( ( builder ) => {

let node;

if ( subBuildFn === 'VERTEX' || geometry.hasAttribute( 'tangent' ) ) {
if ( builder.subBuildFn === 'VERTEX' || builder.geometry.hasAttribute( 'tangent' ) ) {

node = getBitangent( normalView.cross( tangentView ), 'v_bitangentView' ).normalize();

Expand All @@ -15330,7 +15330,7 @@ const bitangentView = /*@__PURE__*/ ( Fn( ( { subBuildFn, geometry, material } )

}

if ( material.flatShading !== true ) {
if ( builder.isFlatShading() !== true ) {

node = directionToFaceDirection( node );

Expand Down Expand Up @@ -15485,7 +15485,7 @@ class NormalMapNode extends TempNode {

}

setup( { material } ) {
setup( builder ) {

const { normalMapType, scaleNode, unpackNormalMode } = this;

Expand Down Expand Up @@ -15521,7 +15521,7 @@ class NormalMapNode extends TempNode {

let scale = scaleNode;

if ( material.flatShading === true ) {
if ( builder.isFlatShading() === true ) {

scale = directionToFaceDirection( scale );

Expand Down Expand Up @@ -49771,6 +49771,17 @@ class NodeBuilder {

}

/**
* Whether the material is using flat shading or not.
*
* @returns {boolean} Whether the material is using flat shading or not.
*/
isFlatShading() {

return this.material.flatShading === true || this.geometry.hasAttribute( 'normal' ) === false;

}

/**
* Whether the material is opaque or not.
*
Expand Down Expand Up @@ -72172,7 +72183,17 @@ class WebGPUTextureUtils {

}

textureData.texture = backend.device.createTexture( textureDescriptorGPU );
try {

textureData.texture = backend.device.createTexture( textureDescriptorGPU );

} catch ( e ) {

warn( 'WebGPURenderer: Failed to create texture with descriptor:', textureDescriptorGPU );
this.createDefaultTexture( texture );
return;

}

if ( isMSAA ) {

Expand Down
2 changes: 1 addition & 1 deletion build/three.webgpu.min.js

Large diffs are not rendered by default.

55 changes: 38 additions & 17 deletions build/three.webgpu.nodes.js
Original file line number Diff line number Diff line change
Expand Up @@ -14205,7 +14205,7 @@ const normalViewGeometry = /*@__PURE__*/ ( Fn( ( builder ) => {

let node;

if ( builder.material.flatShading === true ) {
if ( builder.isFlatShading() ) {

node = normalFlat;

Expand All @@ -14229,7 +14229,7 @@ const normalWorldGeometry = /*@__PURE__*/ ( Fn( ( builder ) => {

let normal = normalViewGeometry.transformDirection( cameraViewMatrix );

if ( builder.material.flatShading !== true ) {
if ( builder.isFlatShading() !== true ) {

normal = normal.toVarying( 'v_normalWorldGeometry' );

Expand All @@ -14245,15 +14245,15 @@ const normalWorldGeometry = /*@__PURE__*/ ( Fn( ( builder ) => {
* @tsl
* @type {Node<vec3>}
*/
const normalView = /*@__PURE__*/ ( Fn( ( { subBuildFn, material, context } ) => {
const normalView = /*@__PURE__*/ ( Fn( ( builder ) => {

let node;

if ( subBuildFn === 'NORMAL' || subBuildFn === 'VERTEX' ) {
if ( builder.subBuildFn === 'NORMAL' || builder.subBuildFn === 'VERTEX' ) {

node = normalViewGeometry;

if ( material.flatShading !== true ) {
if ( builder.isFlatShading() !== true ) {

node = directionToFaceDirection( node );

Expand All @@ -14263,7 +14263,7 @@ const normalView = /*@__PURE__*/ ( Fn( ( { subBuildFn, material, context } ) =>

// Use getUV context to avoid side effects from nodes overwriting getUV in the context (e.g. EnvironmentNode)

node = context.setupNormal().context( { getUV: null } );
node = builder.context.setupNormal().context( { getUV: null } );

}

Expand Down Expand Up @@ -15239,11 +15239,11 @@ const tangentLocal = /*@__PURE__*/ tangentGeometry.xyz.toVar( 'tangentLocal' );
* @tsl
* @type {Node<vec3>}
*/
const tangentView = /*@__PURE__*/ ( Fn( ( { subBuildFn, geometry, material } ) => {
const tangentView = /*@__PURE__*/ ( Fn( ( builder ) => {

let node;

if ( subBuildFn === 'VERTEX' || geometry.hasAttribute( 'tangent' ) ) {
if ( builder.subBuildFn === 'VERTEX' || builder.geometry.hasAttribute( 'tangent' ) ) {

node = modelViewMatrix.mul( vec4( tangentLocal, 0 ) ).xyz.toVarying( 'v_tangentView' ).normalize();

Expand All @@ -15253,7 +15253,7 @@ const tangentView = /*@__PURE__*/ ( Fn( ( { subBuildFn, geometry, material } ) =

}

if ( material.flatShading !== true ) {
if ( builder.isFlatShading() !== true ) {

node = directionToFaceDirection( node );

Expand All @@ -15280,11 +15280,11 @@ const tangentWorld = /*@__PURE__*/ tangentView.transformDirection( cameraViewMat
* @param {string} varyingName - The name of the varying to assign the bitangent to.
* @returns {Node<vec3>} The bitangent node.
*/
const getBitangent = /*@__PURE__*/ Fn( ( [ crossNormalTangent, varyingName ], { subBuildFn, material } ) => {
const getBitangent = /*@__PURE__*/ Fn( ( [ crossNormalTangent, varyingName ], builder ) => {

let bitangent = crossNormalTangent.mul( tangentGeometry.w ).xyz;

if ( subBuildFn === 'NORMAL' && material.flatShading !== true ) {
if ( builder.subBuildFn === 'NORMAL' && builder.isFlatShading() !== true ) {

bitangent = bitangent.toVarying( varyingName );

Expand Down Expand Up @@ -15316,11 +15316,11 @@ const bitangentLocal = /*@__PURE__*/ getBitangent( normalLocal.cross( tangentLoc
* @tsl
* @type {Node<vec3>}
*/
const bitangentView = /*@__PURE__*/ ( Fn( ( { subBuildFn, geometry, material } ) => {
const bitangentView = /*@__PURE__*/ ( Fn( ( builder ) => {

let node;

if ( subBuildFn === 'VERTEX' || geometry.hasAttribute( 'tangent' ) ) {
if ( builder.subBuildFn === 'VERTEX' || builder.geometry.hasAttribute( 'tangent' ) ) {

node = getBitangent( normalView.cross( tangentView ), 'v_bitangentView' ).normalize();

Expand All @@ -15330,7 +15330,7 @@ const bitangentView = /*@__PURE__*/ ( Fn( ( { subBuildFn, geometry, material } )

}

if ( material.flatShading !== true ) {
if ( builder.isFlatShading() !== true ) {

node = directionToFaceDirection( node );

Expand Down Expand Up @@ -15485,7 +15485,7 @@ class NormalMapNode extends TempNode {

}

setup( { material } ) {
setup( builder ) {

const { normalMapType, scaleNode, unpackNormalMode } = this;

Expand Down Expand Up @@ -15521,7 +15521,7 @@ class NormalMapNode extends TempNode {

let scale = scaleNode;

if ( material.flatShading === true ) {
if ( builder.isFlatShading() === true ) {

scale = directionToFaceDirection( scale );

Expand Down Expand Up @@ -49771,6 +49771,17 @@ class NodeBuilder {

}

/**
* Whether the material is using flat shading or not.
*
* @returns {boolean} Whether the material is using flat shading or not.
*/
isFlatShading() {

return this.material.flatShading === true || this.geometry.hasAttribute( 'normal' ) === false;

}

/**
* Whether the material is opaque or not.
*
Expand Down Expand Up @@ -72172,7 +72183,17 @@ class WebGPUTextureUtils {

}

textureData.texture = backend.device.createTexture( textureDescriptorGPU );
try {

textureData.texture = backend.device.createTexture( textureDescriptorGPU );

} catch ( e ) {

warn( 'WebGPURenderer: Failed to create texture with descriptor:', textureDescriptorGPU );
this.createDefaultTexture( texture );
return;

}

if ( isMSAA ) {

Expand Down
2 changes: 1 addition & 1 deletion build/three.webgpu.nodes.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions editor/js/Menubar.Render.js
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ class RenderVideoDialog {

const qualityToBitrate = {
'low': 2e6,
'medium': 5e6,
'medium': 5e6,
'high': 10e6,
'ultra': 20e6
};
Expand Down Expand Up @@ -526,7 +526,7 @@ class RenderVideoDialog {
player.render( currentTime );

const bitmap = await createImageBitmap( canvas );
const frame = new VideoFrame( bitmap, { timestamp: i * ( 1_000_000 / fps ) } );
const frame = new VideoFrame( bitmap, { timestamp: i * ( 1e6 / fps ) } );

videoEncoder.encode( frame, { keyFrame: i % fps === 0 } );
frame.close();
Expand Down
Loading
Loading