Skip to content

Commit

Permalink
Merge pull request mrdoob#1 from mrdoob/dev
Browse files Browse the repository at this point in the history
Updating my fork with changes.
  • Loading branch information
khum08 authored Feb 28, 2021
2 parents 4d90e23 + c21b290 commit cbb9c5b
Show file tree
Hide file tree
Showing 64 changed files with 3,052 additions and 189 deletions.
22 changes: 8 additions & 14 deletions build/three.js
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,7 @@
Function("r", "regeneratorRuntime = r")(runtime);
}

var REVISION = '126dev';
var REVISION = '127dev';
var MOUSE = {
LEFT: 0,
MIDDLE: 1,
Expand Down Expand Up @@ -11660,7 +11660,7 @@
renderer.clear(renderer.autoClearColor, renderer.autoClearDepth, renderer.autoClearStencil);
}

if (background && (background.isCubeTexture || background.isWebGLCubeRenderTarget || background.mapping === CubeUVReflectionMapping)) {
if (background && (background.isCubeTexture || background.mapping === CubeUVReflectionMapping)) {
if (boxMesh === undefined) {
boxMesh = new Mesh(new BoxGeometry(1, 1, 1), new ShaderMaterial({
name: 'BackgroundCubeMaterial',
Expand Down Expand Up @@ -11688,11 +11688,6 @@
objects.update(boxMesh);
}

if (background.isWebGLCubeRenderTarget) {
// TODO Deprecate
background = background.texture;
}

boxMesh.material.uniforms.envMap.value = background;
boxMesh.material.uniforms.flipEnvMap.value = background.isCubeTexture && background._needsFlipEnvMap ? -1 : 1;

Expand Down Expand Up @@ -19018,15 +19013,15 @@
if (opaqueObjects.length > 0) renderObjects(opaqueObjects, scene, camera);
if (transparentObjects.length > 0) renderObjects(transparentObjects, scene, camera); //

if (scene.isScene === true) scene.onAfterRender(_this, scene, camera); //

if (_currentRenderTarget !== null) {
// Generate mipmap if we're using any kind of mipmap filtering
textures.updateRenderTargetMipmap(_currentRenderTarget); // resolve multisample renderbuffers to a single-sample texture if necessary

textures.updateMultisampleRenderTarget(_currentRenderTarget);
} // Ensure depth buffer writing is enabled so it can be cleared on next render
} //


if (scene.isScene === true) scene.onAfterRender(_this, scene, camera); // Ensure depth buffer writing is enabled so it can be cleared on next render

state.buffers.depth.setTest(true);
state.buffers.depth.setMask(true);
Expand Down Expand Up @@ -19575,7 +19570,7 @@

var halfFloatSupportedByExt = textureType === HalfFloatType && (extensions.has('EXT_color_buffer_half_float') || capabilities.isWebGL2 && extensions.has('EXT_color_buffer_float'));

if (textureType !== UnsignedByteType && utils.convert(textureType) !== _gl.getParameter(35738) && // IE11, Edge and Chrome Mac < 52 (#9513)
if (textureType !== UnsignedByteType && utils.convert(textureType) !== _gl.getParameter(35738) && // Edge and Chrome Mac < 52 (#9513)
!(textureType === FloatType && (capabilities.isWebGL2 || extensions.has('OES_texture_float') || extensions.has('WEBGL_color_buffer_float'))) && // Chrome Mac >= 52 and Firefox
!halfFloatSupportedByExt) {
console.error('THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.');
Expand Down Expand Up @@ -25959,7 +25954,7 @@
var trackType = track.constructor;
var json; // derived classes can define a static toJSON method

if (trackType.toJSON !== undefined) {
if (trackType.toJSON !== this.toJSON) {
json = trackType.toJSON(track);
} else {
// by default, we assume the data can be serialized as-is
Expand Down Expand Up @@ -31396,8 +31391,7 @@
}();

function createPaths(text, size, data) {
var chars = Array.from ? Array.from(text) : String(text).split(''); // workaround for IE11, see #13988

var chars = Array.from(text);
var scale = size / data.resolution;
var line_height = (data.boundingBox.yMax - data.boundingBox.yMin + data.underlineThickness) * scale;
var paths = [];
Expand Down
2 changes: 1 addition & 1 deletion build/three.min.js

Large diffs are not rendered by default.

26 changes: 9 additions & 17 deletions build/three.module.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// threejs.org/license
const REVISION = '126dev';
const REVISION = '127dev';
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 };
const CullFaceNone = 0;
Expand Down Expand Up @@ -13542,7 +13542,7 @@ function WebGLBackground( renderer, cubemaps, state, objects, premultipliedAlpha

}

if ( background && ( background.isCubeTexture || background.isWebGLCubeRenderTarget || background.mapping === CubeUVReflectionMapping ) ) {
if ( background && ( background.isCubeTexture || background.mapping === CubeUVReflectionMapping ) ) {

if ( boxMesh === undefined ) {

Expand Down Expand Up @@ -13584,14 +13584,6 @@ function WebGLBackground( renderer, cubemaps, state, objects, premultipliedAlpha

}

if ( background.isWebGLCubeRenderTarget ) {

// TODO Deprecate

background = background.texture;

}

boxMesh.material.uniforms.envMap.value = background;
boxMesh.material.uniforms.flipEnvMap.value = ( background.isCubeTexture && background._needsFlipEnvMap ) ? - 1 : 1;

Expand Down Expand Up @@ -24035,10 +24027,6 @@ function WebGLRenderer( parameters ) {

//

if ( scene.isScene === true ) scene.onAfterRender( _this, scene, camera );

//

if ( _currentRenderTarget !== null ) {

// Generate mipmap if we're using any kind of mipmap filtering
Expand All @@ -24051,6 +24039,10 @@ function WebGLRenderer( parameters ) {

}

//

if ( scene.isScene === true ) scene.onAfterRender( _this, scene, camera );

// Ensure depth buffer writing is enabled so it can be cleared on next render

state.buffers.depth.setTest( true );
Expand Down Expand Up @@ -24854,7 +24846,7 @@ function WebGLRenderer( parameters ) {

const halfFloatSupportedByExt = ( textureType === HalfFloatType ) && ( extensions.has( 'EXT_color_buffer_half_float' ) || ( capabilities.isWebGL2 && extensions.has( 'EXT_color_buffer_float' ) ) );

if ( textureType !== UnsignedByteType && utils.convert( textureType ) !== _gl.getParameter( 35738 ) && // IE11, Edge and Chrome Mac < 52 (#9513)
if ( textureType !== UnsignedByteType && utils.convert( textureType ) !== _gl.getParameter( 35738 ) && // Edge and Chrome Mac < 52 (#9513)
! ( textureType === FloatType && ( capabilities.isWebGL2 || extensions.has( 'OES_texture_float' ) || extensions.has( 'WEBGL_color_buffer_float' ) ) ) && // Chrome Mac >= 52 and Firefox
! halfFloatSupportedByExt ) {

Expand Down Expand Up @@ -32999,7 +32991,7 @@ class KeyframeTrack {
let json;

// derived classes can define a static toJSON method
if ( trackType.toJSON !== undefined ) {
if ( trackType.toJSON !== this.toJSON ) {

json = trackType.toJSON( track );

Expand Down Expand Up @@ -40054,7 +40046,7 @@ class Font {

function createPaths( text, size, data ) {

const chars = Array.from ? Array.from( text ) : String( text ).split( '' ); // workaround for IE11, see #13988
const chars = Array.from( text );
const scale = size / data.resolution;
const line_height = ( data.boundingBox.yMax - data.boundingBox.yMin + data.underlineThickness ) * scale;

Expand Down
2 changes: 1 addition & 1 deletion docs/api/en/scenes/Scene.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ <h3>[property:Boolean autoUpdate]</h3>
<h3>[property:Object background]</h3>
<p>
If not null, sets the background used when rendering the scene, and is always rendered first.
Can be set to a [page:Color] which sets the clear color, a [page:Texture] covering the canvas, a cubemap as a [page:CubeTexture] or [page:WebGLCubeRenderTarget] or an equirectangular as a [page:Texture] . Default is null.
Can be set to a [page:Color] which sets the clear color, a [page:Texture] covering the canvas, a cubemap as a [page:CubeTexture] or an equirectangular as a [page:Texture] . Default is null.
</p>

<h3>[property:Texture environment]</h3>
Expand Down
2 changes: 1 addition & 1 deletion docs/api/zh/scenes/Scene.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ <h3>[property:Object background]</h3>
<p>
若不为空,在渲染场景的时候将设置背景,且背景总是首先被渲染的。
可以设置一个用于的“clear”的[page:Color](颜色)、一个覆盖canvas的[page:Texture](纹理),
或是 a cubemap as a [page:CubeTexture] or [page:WebGLCubeRenderTarget] or an equirectangular as a [page:Texture]。默认值为null。
或是 a cubemap as a [page:CubeTexture] or an equirectangular as a [page:Texture]。默认值为null。
</p>

<h3>[property:Texture environment]</h3>
Expand Down
2 changes: 1 addition & 1 deletion docs/manual/en/introduction/How-to-dispose-of-objects.html
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ <h3>Why can't *three.js* dispose objects automatically?</h3>
<p>
This question was asked many times by the community so it's important to clarify this matter. Fact is that *three.js* does not know the lifetime or scope
of user-created entities like geometries or materials. This is the responsibility of the application. For example even if a material is currently not used for rendering,
it might base necessary for the next frame. So if the application decides that a certain object can be deleted, it has to notify the engine via calling the respective
it might be necessary for the next frame. So if the application decides that a certain object can be deleted, it has to notify the engine via calling the respective
*dispose()* method.
</p>

Expand Down
5 changes: 5 additions & 0 deletions editor/js/Editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ function Editor() {
startPlayer: new Signal(),
stopPlayer: new Signal(),

// vr

toggleVR: new Signal(),
exitedVR: new Signal(),

// notifications

editorCleared: new Signal(),
Expand Down
29 changes: 28 additions & 1 deletion editor/js/Menubar.Edit.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import { Box3, Vector3 } from '../../build/three.module.js';

import { UIPanel, UIRow, UIHorizontalRule } from './libs/ui.js';

import { AddObjectCommand } from './commands/AddObjectCommand.js';
import { RemoveObjectCommand } from './commands/RemoveObjectCommand.js';
import { SetPositionCommand } from './commands/SetPositionCommand.js';

function MenubarEdit( editor ) {

Expand Down Expand Up @@ -85,6 +88,30 @@ function MenubarEdit( editor ) {

options.add( new UIHorizontalRule() );

// Center

var option = new UIRow();
option.setClass( 'option' );
option.setTextContent( strings.getKey( 'menubar/edit/center' ) );
option.onClick( function () {

var object = editor.selected;

if ( object === null || object.parent === null ) return; // avoid centering the camera or scene

const aabb = new Box3().setFromObject( object );
const center = aabb.getCenter( new Vector3() );
const newPosition = new Vector3();

newPosition.x = object.position.x + ( object.position.x - center.x );
newPosition.y = object.position.y + ( object.position.y - center.y );
newPosition.z = object.position.z + ( object.position.z - center.z );

editor.execute( new SetPositionCommand( editor, object, newPosition ) );

} );
options.add( option );

// Clone

var option = new UIRow();
Expand All @@ -94,7 +121,7 @@ function MenubarEdit( editor ) {

var object = editor.selected;

if ( object.parent === null ) return; // avoid cloning the camera or scene
if ( object === null || object.parent === null ) return; // avoid cloning the camera or scene

object = object.clone();

Expand Down
51 changes: 48 additions & 3 deletions editor/js/Menubar.View.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,63 @@ function MenubarView( editor ) {
options.setClass( 'options' );
container.add( options );

// VR mode
// Fullscreen

var option = new UIRow();
option.setClass( 'option' );
option.setTextContent( 'VR mode' );
option.setTextContent( 'Fullscreen' );
option.onClick( function () {

editor.signals.enterVR.dispatch();
if ( document.fullscreenElement === null ) {

document.documentElement.requestFullscreen();

} else if ( document.exitFullscreen ) {

document.exitFullscreen();

}

// Safari

if ( document.webkitFullscreenElement === null ) {

document.documentElement.webkitRequestFullscreen();

} else if ( document.webkitExitFullscreen ) {

document.webkitExitFullscreen();

}

} );
options.add( option );

// VR (Work in progress)

if ( 'xr' in navigator ) {

navigator.xr.isSessionSupported( 'immersive-vr' )
.then( function ( supported ) {

if ( supported ) {

var option = new UIRow();
option.setClass( 'option' );
option.setTextContent( 'VR' );
option.onClick( function () {

editor.signals.toggleVR.dispatch();

} );
options.add( option );

}

} );

}

return container;

}
Expand Down
2 changes: 2 additions & 0 deletions editor/js/Menubar.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { MenubarAdd } from './Menubar.Add.js';
import { MenubarEdit } from './Menubar.Edit.js';
import { MenubarFile } from './Menubar.File.js';
import { MenubarExamples } from './Menubar.Examples.js';
import { MenubarView } from './Menubar.View.js';
import { MenubarHelp } from './Menubar.Help.js';
import { MenubarPlay } from './Menubar.Play.js';
import { MenubarStatus } from './Menubar.Status.js';
Expand All @@ -18,6 +19,7 @@ function Menubar( editor ) {
container.add( new MenubarAdd( editor ) );
container.add( new MenubarPlay( editor ) );
container.add( new MenubarExamples( editor ) );
container.add( new MenubarView( editor ) );
container.add( new MenubarHelp( editor ) );

container.add( new MenubarStatus( editor ) );
Expand Down
3 changes: 3 additions & 0 deletions editor/js/Strings.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ function Strings( config ) {
'menubar/edit/undo': 'Undo (Ctrl+Z)',
'menubar/edit/redo': 'Redo (Ctrl+Shift+Z)',
'menubar/edit/clear_history': 'Clear History',
'menubar/edit/center': 'Center',
'menubar/edit/clone': 'Clone',
'menubar/edit/delete': 'Delete (Del)',
'menubar/edit/fixcolormaps': 'Fix Color Maps',
Expand Down Expand Up @@ -354,6 +355,7 @@ function Strings( config ) {
'menubar/edit/undo': 'Annuler (Ctrl+Z)',
'menubar/edit/redo': 'Refaire (Ctrl+Shift+Z)',
'menubar/edit/clear_history': 'Supprimer Historique',
'menubar/edit/center': 'Center',
'menubar/edit/clone': 'Cloner',
'menubar/edit/delete': 'Supprimer (Supp)',
'menubar/edit/fixcolormaps': 'Correction des couleurs',
Expand Down Expand Up @@ -680,6 +682,7 @@ function Strings( config ) {
'menubar/edit/undo': '撤销 (Ctrl+Z)',
'menubar/edit/redo': '重做 (Ctrl+Shift+Z)',
'menubar/edit/clear_history': '清空历史记录',
'menubar/edit/center': 'Center',
'menubar/edit/clone': '拷贝',
'menubar/edit/delete': '删除 (Del)',
'menubar/edit/fixcolormaps': '修复颜色贴图',
Expand Down
Loading

0 comments on commit cbb9c5b

Please sign in to comment.