Skip to content

Commit

Permalink
Editor: Improved Viewport.Info.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrdoob committed Feb 28, 2024
1 parent e29ce31 commit 4654223
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 15 deletions.
6 changes: 3 additions & 3 deletions editor/js/Strings.js
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ function Strings( config ) {
'viewport/info/objects': 'Objects',
'viewport/info/vertices': 'Vertices',
'viewport/info/triangles': 'Triangles',
'viewport/info/frametime': 'Frametime'
'viewport/info/rendertime': 'Render time'

},

Expand Down Expand Up @@ -694,7 +694,7 @@ function Strings( config ) {
'viewport/info/objects': 'Objets',
'viewport/info/vertices': 'Sommets',
'viewport/info/triangles': 'Triangles',
'viewport/info/frametime': 'Temps de trame'
'viewport/info/rendertime': 'Render time'

},

Expand Down Expand Up @@ -1040,7 +1040,7 @@ function Strings( config ) {
'viewport/info/objects': '物体',
'viewport/info/vertices': '顶点',
'viewport/info/triangles': '三角形',
'viewport/info/frametime': '帧时'
'viewport/info/rendertime': 'Render time'

}

Expand Down
23 changes: 11 additions & 12 deletions editor/js/Viewport.Info.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,25 @@ function ViewportInfo( editor ) {
container.setId( 'info' );
container.setPosition( 'absolute' );
container.setLeft( '10px' );
container.setBottom( '10px' );
container.setBottom( '20px' );
container.setFontSize( '12px' );
container.setColor( '#fff' );
container.setTextTransform( 'lowercase' );

const objectsText = new UIText( '0' ).setMarginLeft( '6px' );
const verticesText = new UIText( '0' ).setMarginLeft( '6px' );
const trianglesText = new UIText( '0' ).setMarginLeft( '6px' );
const frametimeText = new UIText( '0' ).setMarginLeft( '6px' );
const objectsText = new UIText( '0' ).setTextAlign( 'right' ).setWidth( '60px' ).setMarginRight( '6px' );
const verticesText = new UIText( '0' ).setTextAlign( 'right' ).setWidth( '60px' ).setMarginRight( '6px' );
const trianglesText = new UIText( '0' ).setTextAlign( 'right' ).setWidth( '60px' ).setMarginRight( '6px' );
const frametimeText = new UIText( '0' ).setTextAlign( 'right' ).setWidth( '60px' ).setMarginRight( '6px' );

container.add( new UIText( strings.getKey( 'viewport/info/objects' ) ), objectsText, new UIBreak() );
container.add( new UIText( strings.getKey( 'viewport/info/vertices' ) ), verticesText, new UIBreak() );
container.add( new UIText( strings.getKey( 'viewport/info/triangles' ) ), trianglesText, new UIBreak() );
container.add( new UIText( strings.getKey( 'viewport/info/frametime' ) ), frametimeText, new UIBreak() );
container.add( objectsText, new UIText( strings.getKey( 'viewport/info/objects' ) ), new UIBreak() );
container.add( verticesText, new UIText( strings.getKey( 'viewport/info/vertices' ) ), new UIBreak() );
container.add( trianglesText, new UIText( strings.getKey( 'viewport/info/triangles' ) ), new UIBreak() );
container.add( frametimeText, new UIText( strings.getKey( 'viewport/info/rendertime' ) ), new UIBreak() );

signals.objectAdded.add( update );
signals.objectRemoved.add( update );
signals.geometryChanged.add( update );
signals.sceneRendered.add( updateFrametime );

//

Expand Down Expand Up @@ -76,11 +77,9 @@ function ViewportInfo( editor ) {

}

signals.sceneRendered.add( updateFrametime );

function updateFrametime( frametime ) {

frametimeText.setValue( Number( frametime ).toFixed( 2 ) + ' ms' );
frametimeText.setValue( Number( frametime ).toFixed( 2 ) );

}

Expand Down

0 comments on commit 4654223

Please sign in to comment.