Palash Bansal 1 год назад
Родитель
Сommit
8100d39375
Аккаунт пользователя с таким Email не найден

+ 4
- 4
examples/model-viewer/script.ts Просмотреть файл

import {BloomPlugin, DepthOfFieldPlugin, SSContactShadowsPlugin, SSReflectionPlugin, TemporalAAPlugin, VelocityBufferPlugin, SSGIPlugin, AnisotropyPlugin} from '@threepipe/webgi-plugins' import {BloomPlugin, DepthOfFieldPlugin, SSContactShadowsPlugin, SSReflectionPlugin, TemporalAAPlugin, VelocityBufferPlugin, SSGIPlugin, AnisotropyPlugin} from '@threepipe/webgi-plugins'


function checkQuery(key: string, def = true) { function checkQuery(key: string, def = true) {
return !['false', 'no', 'f'].includes(getUrlQueryParam(key, def ? 'yes' : 'no').toLowerCase())
return !['false', 'no', 'f'].includes(getUrlQueryParam(key, def ? 'yes' : 'no')!.toLowerCase())
} }


async function init() { async function init() {
}, },
// set it to true if you only have opaque objects in the scene to get better performance. // set it to true if you only have opaque objects in the scene to get better performance.
zPrepass: checkQuery('depthPrepass', checkQuery('zPrepass', false)), zPrepass: checkQuery('depthPrepass', checkQuery('zPrepass', false)),
modelRootScale: parseFloat(getUrlQueryParam('modelRootScale', '1')),
modelRootScale: parseFloat(getUrlQueryParam('modelRootScale', '1')!),
dropzone: { // this can also be set to true and configured by getting a reference to the DropzonePlugin dropzone: { // this can also be set to true and configured by getting a reference to the DropzonePlugin
// allowedExtensions: ['gltf', 'glb', 'hdr', 'bin', 'png', 'jpeg', 'webp', 'jpg', 'exr', 'fbx', 'obj'], // only allow these file types. If undefined, all files are allowed. // allowedExtensions: ['gltf', 'glb', 'hdr', 'bin', 'png', 'jpeg', 'webp', 'jpg', 'exr', 'fbx', 'obj'], // only allow these file types. If undefined, all files are allowed.
addOptions: { addOptions: {
autoSetBackground: true, // when any image is dropped autoSetBackground: true, // when any image is dropped
autoScale: checkQuery('autoScale', true), // auto scale according to radius autoScale: checkQuery('autoScale', true), // auto scale according to radius
autoCenter: checkQuery('autoCenter', true), // auto center the object autoCenter: checkQuery('autoCenter', true), // auto center the object
autoScaleRadius: parseFloat(getUrlQueryParam('autoScaleRadius', '2')),
autoScaleRadius: parseFloat(getUrlQueryParam('autoScaleRadius', '2')!),
// license: 'Imported from dropzone', // Any license to set on imported objects // license: 'Imported from dropzone', // Any license to set on imported objects
importConfig: true, // import config from file importConfig: true, // import config from file
}, },


const model = getUrlQueryParam('m') || getUrlQueryParam('model') const model = getUrlQueryParam('m') || getUrlQueryParam('model')
if (model) { if (model) {
const ext = getUrlQueryParam('ext') || getUrlQueryParam('model-extension')
const ext = getUrlQueryParam('ext') || getUrlQueryParam('model-extension') || undefined
const loader = viewer.getPlugin(DropzonePlugin) ?? viewer const loader = viewer.getPlugin(DropzonePlugin) ?? viewer
const obj = await loader.load(model, {fileExtension: ext}) const obj = await loader.load(model, {fileExtension: ext})
console.log(obj) console.log(obj)

+ 3
- 1
examples/tweakpane-editor/ThreeEditor.ts Просмотреть файл

KTX2LoadPlugin, KTXLoadPlugin, PLYLoadPlugin, Rhino3dmLoadPlugin, STLLoadPlugin, USDZLoadPlugin, KTX2LoadPlugin, KTXLoadPlugin, PLYLoadPlugin, Rhino3dmLoadPlugin, STLLoadPlugin, USDZLoadPlugin,
BlendLoadPlugin, BlendLoadPlugin,
HierarchyUiPlugin, HierarchyUiPlugin,
GeometryGeneratorPlugin, new Object3DWidgetsPlugin(false), Object3DGeneratorPlugin,
new Object3DWidgetsPlugin(false),
Object3DGeneratorPlugin,
GeometryGeneratorPlugin,
GaussianSplattingPlugin, GaussianSplattingPlugin,
// BaseGroundPlugin, // BaseGroundPlugin,
ContactShadowGroundPlugin, ContactShadowGroundPlugin,

+ 4
- 4
examples/tweakpane-editor/script.ts Просмотреть файл

}, },
// set it to true if you only have opaque objects in the scene to get better performance. // set it to true if you only have opaque objects in the scene to get better performance.
zPrepass: checkQuery('depthPrepass', checkQuery('zPrepass', false)), zPrepass: checkQuery('depthPrepass', checkQuery('zPrepass', false)),
modelRootScale: parseFloat(getUrlQueryParam('modelRootScale', '1')),
modelRootScale: parseFloat(getUrlQueryParam('modelRootScale', '1')!),
dropzone: { dropzone: {
autoImport: true, autoImport: true,
autoAdd: true, autoAdd: true,
addOptions: { addOptions: {
autoScale: checkQuery('autoScale', true), autoScale: checkQuery('autoScale', true),
autoCenter: checkQuery('autoCenter', true), autoCenter: checkQuery('autoCenter', true),
autoScaleRadius: parseFloat(getUrlQueryParam('autoScaleRadius', '2')),
autoScaleRadius: parseFloat(getUrlQueryParam('autoScaleRadius', '2')!),
clearSceneObjects: checkQuery('clearSceneObjectsOnDrop', false), // clear the scene before adding new objects on drop. clearSceneObjects: checkQuery('clearSceneObjectsOnDrop', false), // clear the scene before adding new objects on drop.
license: getUrlQueryParam('licenseText') ?? undefined, // Any license to set on imported objects license: getUrlQueryParam('licenseText') ?? undefined, // Any license to set on imported objects
}, },


const model = getUrlQueryParam('m') || getUrlQueryParam('model') const model = getUrlQueryParam('m') || getUrlQueryParam('model')
if (model) { if (model) {
const ext = getUrlQueryParam('ext') || getUrlQueryParam('model-extension')
const ext = getUrlQueryParam('ext') || getUrlQueryParam('model-extension') || undefined
const loader = viewer.getPlugin(DropzonePlugin) ?? viewer const loader = viewer.getPlugin(DropzonePlugin) ?? viewer
const obj = await loader.load(model, {fileExtension: ext}) const obj = await loader.load(model, {fileExtension: ext})
console.log(obj) console.log(obj)
init().finally(_testFinish) init().finally(_testFinish)


function checkQuery(key: string, def = true) { function checkQuery(key: string, def = true) {
return !['false', 'no', 'f', '0'].includes(getUrlQueryParam(key, def ? 'yes' : 'no').toLowerCase())
return !['false', 'no', 'f', '0'].includes(getUrlQueryParam(key, def ? 'yes' : 'no')!.toLowerCase())
} }

Загрузка…
Отмена
Сохранить