Bladeren bron

Minor checks and fixes

master
Palash Bansal 2 jaren geleden
bovenliggende
commit
6afa4f9a61
No account linked to committer's email address

+ 4
- 4
src/assetmanager/AssetImporter.ts Bestand weergeven

const isData = path.startsWith('data:') || false const isData = path.startsWith('data:') || false
if (!isData) path = path.replace(/\?.*$/, '') // remove query string if (!isData) path = path.replace(/\?.*$/, '') // remove query string


const ext = isData ? undefined : file?.ext ?? parseFileExtension(file?.name ?? path)?.toLowerCase()
const ext = isData ? undefined : file?.ext ?? parseFileExtension(file?.name ?? path.trim())?.toLowerCase()
const mime = file?.mime ?? isData ? path.slice(0, path.indexOf(';')).split(':')[1] || undefined : undefined const mime = file?.mime ?? isData ? path.slice(0, path.indexOf(';')).split(':')[1] || undefined : undefined


if (file) { if (file) {
// get a loader that can load a file. // get a loader that can load a file.
private _getLoader(name?:string, ext?:string, mime?: string): ILoader | undefined { private _getLoader(name?:string, ext?:string, mime?: string): ILoader | undefined {
if (!ext && !mime && name) ext = parseFileExtension(name).toLowerCase() if (!ext && !mime && name) ext = parseFileExtension(name).toLowerCase()
mime = mime?.toLowerCase()
ext = ext?.toLowerCase()
return (name ? this._loadingManager.getHandler(name) as ILoader : undefined)
mime = mime?.toLowerCase().trim()
ext = ext?.toLowerCase().trim()
return (name ? this._loadingManager.getHandler(name.trim()) as ILoader : undefined)
|| this._loaderCache.find((lc)=> ext && lc.ext.includes(ext) || mime && lc.mime.includes(mime))?.loader || this._loaderCache.find((lc)=> ext && lc.ext.includes(ext) || mime && lc.mime.includes(mime))?.loader
} }



+ 1
- 0
src/core/material/PhysicalMaterial.ts Bestand weergeven

expanded: true, expanded: true,
onChange: (ev)=>{ onChange: (ev)=>{
if (!ev.config || ev.config.onChange) return if (!ev.config || ev.config.onChange) return
// todo frameFade
// todo set needsUpdate true only for properties that require it like maps. // todo set needsUpdate true only for properties that require it like maps.
this.setDirty({uiChangeEvent: ev, needsUpdate: !!ev.last, refreshUi: !!ev.last}) this.setDirty({uiChangeEvent: ev, needsUpdate: !!ev.last, refreshUi: !!ev.last})
}, },

+ 1
- 1
src/core/object/RootScene.ts Bestand weergeven

return imported as T&IObject3D return imported as T&IObject3D
} }
this._addObject3D(<IObject3D>imported, options) this._addObject3D(<IObject3D>imported, options)
this.dispatchEvent({type: 'addSceneObject', object: <IObject3D>imported})
this.dispatchEvent({type: 'addSceneObject', object: <IObject3D>imported, options})
return imported as T&IObject3D return imported as T&IObject3D
} }



+ 1
- 1
src/plugins/material/ClearcoatTintPlugin.ts Bestand weergeven

if (tf.tintColor === undefined) tf.tintColor = '#ffffff' if (tf.tintColor === undefined) tf.tintColor = '#ffffff'
if (tf.thickness === undefined) tf.thickness = 0.1 if (tf.thickness === undefined) tf.thickness = 0.1
if (tf.ior === undefined) tf.ior = 1.5 if (tf.ior === undefined) tf.ior = 1.5
Object.assign(tf, params)
params && Object.assign(tf, params)
if (material.setDirty) material.setDirty() if (material.setDirty) material.setDirty()
return tf return tf
} }

+ 1
- 1
src/plugins/material/FragmentClippingExtensionPlugin.ts Bestand weergeven

if (tf.clipParams === undefined) tf.clipParams = [0, 0, 0, 0] if (tf.clipParams === undefined) tf.clipParams = [0, 0, 0, 0]
if (tf.clipMode === undefined !== undefined) tf.clipMode = FragmentClippingMode.Circle if (tf.clipMode === undefined !== undefined) tf.clipMode = FragmentClippingMode.Circle
if (tf.clipInvert === undefined !== undefined) tf.clipInvert = false if (tf.clipInvert === undefined !== undefined) tf.clipInvert = false
Object.assign(tf, params)
params && Object.assign(tf, params)
if (material.setDirty) material.setDirty() if (material.setDirty) material.setDirty()
return true return true
} }

+ 1
- 1
src/plugins/material/NoiseBumpMaterialPlugin.ts Bestand weergeven

if (tf.useColorFlakes === undefined) tf.useColorFlakes = false if (tf.useColorFlakes === undefined) tf.useColorFlakes = false
if (tf.flakeParams === undefined) tf.flakeParams = new Vector4(0, 1, 3, 0) if (tf.flakeParams === undefined) tf.flakeParams = new Vector4(0, 1, 3, 0)
if (tf.flakeFallOffParams === undefined) tf.flakeFallOffParams = new Vector3(0, 1, 0) if (tf.flakeFallOffParams === undefined) tf.flakeFallOffParams = new Vector3(0, 1, 0)
Object.assign(tf, params)
params && Object.assign(tf, params)
if (material.setDirty) material.setDirty() if (material.setDirty) material.setDirty()
return true return true
} }

+ 1
- 1
src/plugins/postprocessing/AScreenPassExtensionPlugin.ts Bestand weergeven

} }


private _onPluginAdd = (e: IViewerEvent)=>{ private _onPluginAdd = (e: IViewerEvent)=>{
if (e.plugin?.constructor?.PluginType !== 'GBuffer') return
if (e.plugin?.constructor?.PluginType !== GBufferPlugin.PluginType) return
const gbuffer = e.plugin as GBufferPlugin const gbuffer = e.plugin as GBufferPlugin
gbuffer.registerGBufferUpdater(this.constructor.PluginType, this.updateGBufferFlags.bind(this)) gbuffer.registerGBufferUpdater(this.constructor.PluginType, this.updateGBufferFlags.bind(this))
this._viewer?.removeEventListener('addPlugin', this._onPluginAdd) this._viewer?.removeEventListener('addPlugin', this._onPluginAdd)

Laden…
Annuleren
Opslaan