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
54 changes: 51 additions & 3 deletions editor/js/Sidebar.Project.App.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ function SidebarProjectApp( editor ) {

const toZip = {};

const rendererType = config.getKey( 'project/renderer/type' );

//

let output = editor.toJSON();
Expand Down Expand Up @@ -115,6 +117,26 @@ function SidebarProjectApp( editor ) {

content = content.replace( '<!-- title -->', title );

//

const IMPORTMAP = {
WebGLRenderer: {
imports: {
'three': './js/three.module.js'
}
},
WebGPURenderer: {
imports: {
'three': './js/three.webgpu.js',
'three/webgpu': './js/three.webgpu.js'
}
}
};
const importmap = JSON.stringify( IMPORTMAP[ rendererType ], null, '\t' );
content = content.replace( '<!-- importmap -->', indent( '\n' + indent( importmap, 1 ) + '\n', 2 ) );

//

let editButton = '';

if ( config.getKey( 'project/editable' ) ) {
Expand Down Expand Up @@ -145,11 +167,24 @@ function SidebarProjectApp( editor ) {
toZip[ 'js/three.core.js' ] = strToU8( content );

} );
loader.load( '../build/three.module.js', function ( content ) {

toZip[ 'js/three.module.js' ] = strToU8( content );
if ( rendererType === 'WebGPURenderer' ) {

} );
loader.load( '../build/three.webgpu.js', function ( content ) {

toZip[ 'js/three.webgpu.js' ] = strToU8( content );

} );

} else {

loader.load( '../build/three.module.js', function ( content ) {

toZip[ 'js/three.module.js' ] = strToU8( content );

} );

}

} );
container.add( publishButton );
Expand All @@ -167,4 +202,17 @@ function SidebarProjectApp( editor ) {

}

//

function indent( text, count, space = '\t' ) {

return text
.split( '\n' )
.map( line => space.repeat( count ) + line )
.join( '\n' );

}

//

export { SidebarProjectApp };
9 changes: 1 addition & 8 deletions editor/js/libs/app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,7 @@
</style>
</head>
<body ontouchstart="">
<script type="importmap">
{
"imports": {
"three": "./js/three.module.js",
"three/webgpu": "./js/three.webgpu.js"
}
}
</script>
<script type="importmap"><!-- importmap --></script>
<script type="module">

import * as THREE from 'three';
Expand Down
4 changes: 2 additions & 2 deletions examples/jsm/loaders/KTX2Loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -1035,9 +1035,9 @@ const TYPE_MAP = {
[ VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK ]: UnsignedByteType,
[ VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK ]: UnsignedByteType,
[ VK_FORMAT_EAC_R11_UNORM_BLOCK ]: UnsignedByteType,
[ VK_FORMAT_EAC_R11_UNORM_BLOCK ]: UnsignedByteType,
[ VK_FORMAT_EAC_R11G11_UNORM_BLOCK ]: UnsignedByteType,
[ VK_FORMAT_EAC_R11_SNORM_BLOCK ]: UnsignedByteType,
[ VK_FORMAT_EAC_R11G11_UNORM_BLOCK ]: UnsignedByteType,
[ VK_FORMAT_EAC_R11G11_SNORM_BLOCK ]: UnsignedByteType,

[ VK_FORMAT_ASTC_4x4_SFLOAT_BLOCK_EXT ]: HalfFloatType,
[ VK_FORMAT_ASTC_4x4_SRGB_BLOCK ]: UnsignedByteType,
Expand Down