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
2 changes: 1 addition & 1 deletion examples/jsm/exporters/GLTFExporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -1848,7 +1848,7 @@ class GLTFWriter {
const validVertexAttributes =
/^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/;

if ( ! validVertexAttributes.test( attributeName ) ) attributeName = '_' + attributeName;
if ( ! validVertexAttributes.test( attributeName ) && ! attributeName.startsWith( '_' ) ) attributeName = '_' + attributeName;

if ( cache.attributes.has( this.getUID( attribute ) ) ) {

Expand Down
42 changes: 40 additions & 2 deletions examples/jsm/tsl/display/OutlineNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,17 @@ class OutlineNode extends TempNode {
*/
this._selectionCache = new Set();

/**
* The number of selected objects from the previous frame. Used to detect
* the transition to an empty selection so the composite render target can
* be cleared once and avoid leaving a stale outline on screen.
*
* @private
* @type {number}
* @default 0
*/
this._lastSelectionCount = 0;

/**
* The result of the effect is represented as a separate texture node.
*
Expand Down Expand Up @@ -449,6 +460,35 @@ class OutlineNode extends TempNode {
const { renderer } = frame;
const { camera, scene } = this;

this._updateSelectionCache();

// If no objects are selected, all subsequent passes can be skipped since
// the outline would be empty anyway. The composite render target is cleared
// once when transitioning to an empty selection so a previously rendered
// outline does not linger on screen.

if ( this._selectionCache.size === 0 ) {

if ( this._lastSelectionCount > 0 ) {

_rendererState = RendererUtils.resetRendererState( renderer, _rendererState );

renderer.setRenderTarget( this._renderTargetComposite );
renderer.setClearColor( 0x000000, 0 );
renderer.clear();

RendererUtils.restoreRendererState( renderer, _rendererState );

this._lastSelectionCount = 0;

}

return;

}

this._lastSelectionCount = this._selectionCache.size;

_rendererState = RendererUtils.resetRendererAndSceneState( renderer, scene, _rendererState );

//
Expand All @@ -460,8 +500,6 @@ class OutlineNode extends TempNode {

renderer.setClearColor( 0xffffff, 1 );

this._updateSelectionCache();

const currentSceneName = scene.name;

// 1. Draw non-selected objects in the depth buffer
Expand Down
45 changes: 3 additions & 42 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading