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 editor/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@

}

// ServiceWorker
// @deprecated, r183

if ( 'serviceWorker' in navigator ) {

Expand Down
1 change: 1 addition & 0 deletions editor/js/Editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ function Editor() {

this.viewportCamera = this.camera;
this.viewportShading = 'default';
this.viewportColor = new THREE.Color();

this.addCamera( this.camera );

Expand Down
2 changes: 2 additions & 0 deletions editor/js/Menubar.Render.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ class RenderImageDialog {

const renderer = new THREE.WebGLRenderer( { antialias: true, logarithmicDepthBuffer: true } );
renderer.setSize( imageWidth.getValue(), imageHeight.getValue() );
renderer.setClearColor( editor.viewportColor );

if ( project.shadows !== undefined ) renderer.shadowMap.enabled = project.shadows;
if ( project.shadowType !== undefined ) renderer.shadowMap.type = project.shadowType;
Expand Down Expand Up @@ -414,6 +415,7 @@ class RenderVideoDialog {
await player.load( editor.toJSON() );
player.setPixelRatio( 1 );
player.setSize( videoWidth.getValue(), videoHeight.getValue() );
player.setClearColor( editor.viewportColor );

//

Expand Down
2 changes: 2 additions & 0 deletions editor/js/Viewport.js
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,8 @@ function Viewport( editor ) {

}

renderer.getClearColor( editor.viewportColor );

renderer.setPixelRatio( window.devicePixelRatio );
renderer.setSize( container.dom.offsetWidth, container.dom.offsetHeight );

Expand Down
6 changes: 6 additions & 0 deletions editor/js/libs/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,12 @@ const APP = {

};

this.setClearColor = function ( color ) {

renderer.setClearColor( color );

};

this.setSize = function ( width, height ) {

this.width = width;
Expand Down
319 changes: 6 additions & 313 deletions editor/sw.js
Original file line number Diff line number Diff line change
@@ -1,324 +1,17 @@
const cacheName = 'threejs-editor';

const assets = [
'./',

'./manifest.json',
'./images/icon.png',

'../files/favicon.ico',

'../build/three.module.js',

'../examples/jsm/controls/TransformControls.js',

'../examples/jsm/libs/chevrotain.module.min.js',
'../examples/jsm/libs/fflate.module.js',

'../examples/jsm/libs/draco/draco_decoder.js',
'../examples/jsm/libs/draco/draco_decoder.wasm',
'../examples/jsm/libs/draco/draco_encoder.js',
'../examples/jsm/libs/draco/draco_wasm_wrapper.js',

'../examples/jsm/libs/draco/gltf/draco_decoder.js',
'../examples/jsm/libs/draco/gltf/draco_decoder.wasm',
'../examples/jsm/libs/draco/gltf/draco_wasm_wrapper.js',

'../examples/jsm/libs/meshopt_decoder.module.js',

'../examples/jsm/libs/mikktspace.module.js',

'../examples/jsm/libs/motion-controllers.module.js',

'../examples/jsm/libs/rhino3dm/rhino3dm.wasm',
'../examples/jsm/libs/rhino3dm/rhino3dm.js',

'../examples/jsm/loaders/3DMLoader.js',
'../examples/jsm/loaders/3MFLoader.js',
'../examples/jsm/loaders/AMFLoader.js',
'../examples/jsm/loaders/ColladaLoader.js',
'../examples/jsm/loaders/DRACOLoader.js',
'../examples/jsm/loaders/FBXLoader.js',
'../examples/jsm/loaders/GLTFLoader.js',
'../examples/jsm/loaders/KMZLoader.js',
'../examples/jsm/loaders/MD2Loader.js',
'../examples/jsm/loaders/OBJLoader.js',
'../examples/jsm/loaders/MTLLoader.js',
'../examples/jsm/loaders/PCDLoader.js',
'../examples/jsm/loaders/PLYLoader.js',
'../examples/jsm/loaders/STLLoader.js',
'../examples/jsm/loaders/SVGLoader.js',
'../examples/jsm/loaders/TDSLoader.js',
'../examples/jsm/loaders/USDLoader.js',
'../examples/jsm/loaders/usd/USDAParser.js',
'../examples/jsm/loaders/usd/USDCParser.js',
'../examples/jsm/loaders/VOXLoader.js',
'../examples/jsm/loaders/VRMLLoader.js',
'../examples/jsm/loaders/VTKLoader.js',
'../examples/jsm/loaders/XYZLoader.js',

'../examples/jsm/loaders/EXRLoader.js',
'../examples/jsm/loaders/KTX2Loader.js',
'../examples/jsm/loaders/HDRLoader.js',
'../examples/jsm/loaders/TGALoader.js',

'../examples/jsm/curves/NURBSCurve.js',
'../examples/jsm/curves/NURBSUtils.js',

'../examples/jsm/interactive/HTMLMesh.js',
'../examples/jsm/interactive/InteractiveGroup.js',

'../examples/jsm/environments/ColorEnvironment.js',
'../examples/jsm/environments/RoomEnvironment.js',

'../examples/jsm/exporters/DRACOExporter.js',
'../examples/jsm/exporters/GLTFExporter.js',
'../examples/jsm/exporters/OBJExporter.js',
'../examples/jsm/exporters/PLYExporter.js',
'../examples/jsm/exporters/STLExporter.js',
'../examples/jsm/exporters/USDZExporter.js',

'../examples/jsm/helpers/VertexNormalsHelper.js',
'../examples/jsm/helpers/ViewHelper.js',

'../examples/jsm/utils/BufferGeometryUtils.js',

'../examples/jsm/webxr/XRControllerModelFactory.js',

'./images/rotate.svg',
'./images/scale.svg',
'./images/translate.svg',

'./js/libs/codemirror/codemirror.css',
'./js/libs/codemirror/theme/monokai.css',

'./js/libs/codemirror/codemirror.js',
'./js/libs/codemirror/mode/javascript.js',
'./js/libs/codemirror/mode/glsl.js',

'./js/libs/esprima.js',
'./js/libs/jsonlint.js',

'./js/libs/codemirror/addon/dialog.css',
'./js/libs/codemirror/addon/show-hint.css',
'./js/libs/codemirror/addon/tern.css',

'./js/libs/codemirror/addon/dialog.js',
'./js/libs/codemirror/addon/show-hint.js',
'./js/libs/codemirror/addon/tern.js',
'./js/libs/acorn/acorn.js',
'./js/libs/acorn/acorn_loose.js',
'./js/libs/acorn/walk.js',
'./js/libs/ternjs/polyfill.js',
'./js/libs/ternjs/signal.js',
'./js/libs/ternjs/tern.js',
'./js/libs/ternjs/def.js',
'./js/libs/ternjs/comment.js',
'./js/libs/ternjs/infer.js',
'./js/libs/ternjs/doc_comment.js',
'./js/libs/tern-threejs/threejs.js',

'./js/libs/signals.min.js',
'./js/libs/ui.js',
'./js/libs/ui.three.js',

'./js/libs/app.js',
'./js/Player.js',
'./js/Script.js',

//

'./css/main.css',

'./js/EditorControls.js',
'./js/Storage.js',

'./js/Editor.js',
'./js/Config.js',
'./js/History.js',
'./js/Loader.js',
'./js/LoaderUtils.js',
'./js/GLTFImportDialog.js',
'./js/Menubar.js',
'./js/Menubar.File.js',
'./js/Menubar.Edit.js',
'./js/Menubar.Add.js',
'./js/Menubar.Help.js',
'./js/Menubar.View.js',
'./js/Menubar.Status.js',
'./js/Resizer.js',
'./js/Selector.js',
'./js/Sidebar.js',
'./js/Sidebar.Scene.js',
'./js/Sidebar.Project.js',
'./js/Sidebar.Project.Renderer.js',
'./js/Sidebar.Project.Materials.js',
'./js/Sidebar.Project.Resources.js',
'./js/Sidebar.Project.App.js',
'./js/Sidebar.Settings.js',
'./js/Sidebar.Settings.History.js',
'./js/Sidebar.Settings.Shortcuts.js',
'./js/Sidebar.Properties.js',
'./js/Sidebar.Object.js',
'./js/Sidebar.Object.Animation.js',
'./js/Sidebar.Geometry.js',
'./js/Sidebar.Geometry.BufferGeometry.js',
'./js/Sidebar.Geometry.Modifiers.js',
'./js/Sidebar.Geometry.BoxGeometry.js',
'./js/Sidebar.Geometry.CapsuleGeometry.js',
'./js/Sidebar.Geometry.CircleGeometry.js',
'./js/Sidebar.Geometry.CylinderGeometry.js',
'./js/Sidebar.Geometry.DodecahedronGeometry.js',
'./js/Sidebar.Geometry.ExtrudeGeometry.js',
'./js/Sidebar.Geometry.IcosahedronGeometry.js',
'./js/Sidebar.Geometry.LatheGeometry.js',
'./js/Sidebar.Geometry.OctahedronGeometry.js',
'./js/Sidebar.Geometry.PlaneGeometry.js',
'./js/Sidebar.Geometry.RingGeometry.js',
'./js/Sidebar.Geometry.SphereGeometry.js',
'./js/Sidebar.Geometry.ShapeGeometry.js',
'./js/Sidebar.Geometry.TetrahedronGeometry.js',
'./js/Sidebar.Geometry.TorusGeometry.js',
'./js/Sidebar.Geometry.TorusKnotGeometry.js',
'./js/Sidebar.Geometry.TubeGeometry.js',
'./js/Sidebar.Material.js',
'./js/Sidebar.Material.BooleanProperty.js',
'./js/Sidebar.Material.ColorProperty.js',
'./js/Sidebar.Material.ConstantProperty.js',
'./js/Sidebar.Material.MapProperty.js',
'./js/Sidebar.Material.NumberProperty.js',
'./js/Sidebar.Material.Program.js',
'./js/Sidebar.Script.js',
'./js/Strings.js',
'./js/Toolbar.js',
'./js/Viewport.js',
'./js/Viewport.Controls.js',
'./js/Viewport.Info.js',
'./js/Viewport.Pathtracer.js',
'./js/Viewport.ViewHelper.js',
'./js/Viewport.XR.js',

'./js/Command.js',
'./js/commands/AddObjectCommand.js',
'./js/commands/RemoveObjectCommand.js',
'./js/commands/MoveObjectCommand.js',
'./js/commands/SetPositionCommand.js',
'./js/commands/SetRotationCommand.js',
'./js/commands/SetScaleCommand.js',
'./js/commands/SetValueCommand.js',
'./js/commands/SetUuidCommand.js',
'./js/commands/SetColorCommand.js',
'./js/commands/SetGeometryCommand.js',
'./js/commands/SetGeometryValueCommand.js',
'./js/commands/MultiCmdsCommand.js',
'./js/commands/AddScriptCommand.js',
'./js/commands/RemoveScriptCommand.js',
'./js/commands/SetScriptValueCommand.js',
'./js/commands/SetMaterialCommand.js',
'./js/commands/SetMaterialColorCommand.js',
'./js/commands/SetMaterialMapCommand.js',
'./js/commands/SetMaterialValueCommand.js',
'./js/commands/SetMaterialVectorCommand.js',
'./js/commands/SetSceneCommand.js',
'./js/commands/Commands.js',

//

'./examples/arkanoid.app.json',
'./examples/camera.app.json',
'./examples/particles.app.json',
'./examples/pong.app.json',
'./examples/shaders.app.json'

];

self.addEventListener( 'install', async function () {

const cache = await caches.open( cacheName );

await Promise.all( assets.map( async function ( asset ) {

try {

await cache.add( asset );

} catch ( error ) {

console.warn( '[SW] Couldn\'t cache:', asset );

}

} ) );
self.addEventListener( 'install', function () {

self.skipWaiting();

} );

self.addEventListener( 'activate', async function ( event ) {

event.waitUntil(
caches.keys().then( function ( names ) {
self.addEventListener( 'activate', function () {

return Promise.all(
names.filter( name => name !== cacheName ).map( name => caches.delete( name ) )
);
self.registration.unregister();

} ).then( function () {
caches.keys().then( function ( names ) {

self.clients.claim();
for ( const name of names ) caches.delete( name );

} )
);
} );

} );

self.addEventListener( 'fetch', async function ( event ) {

const request = event.request;

if ( request.url.startsWith( 'chrome-extension' ) ) return;

event.respondWith( networkFirst( request ) );

} );

async function networkFirst( request ) {

try {

let response = await fetch( request );

if ( request.url.endsWith( 'editor/' ) || request.url.endsWith( 'editor/index.html' ) ) { // copied from coi-serviceworker

const newHeaders = new Headers( response.headers );
newHeaders.set( 'Cross-Origin-Embedder-Policy', 'require-corp' );
newHeaders.set( 'Cross-Origin-Opener-Policy', 'same-origin' );

response = new Response( response.body, { status: response.status, statusText: response.statusText, headers: newHeaders } );

}

if ( request.method === 'GET' ) {

const cache = await caches.open( cacheName );
cache.put( request, response.clone() );

}

return response;

} catch ( error ) {

const cachedResponse = await caches.match( request );

if ( cachedResponse === undefined ) {

console.warn( '[SW] Not cached:', request.url );

}

return cachedResponse;

}

}
2 changes: 1 addition & 1 deletion utils/docs/template/tmpl/params.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
<tr>
<?js if (params.hasName) {?>
<td class="name">
<strong><?js= param.name ?></strong>
<strong translate="no"><?js= param.name ?></strong>
</td>
<?js } ?>
<td class="description last">
Expand Down