Explorar el Código

Add option autoUpdateParent in object.userData, Update plugin package-lock.json, version bump 0.0.40

master
Palash Bansal hace 1 año
padre
commit
d7f5fc8bd9
No account linked to committer's email address

+ 1
- 0
examples/multi-render-uv-clip/script.ts Ver fichero

@@ -8,6 +8,7 @@ import {
} from 'threepipe'
import {TweakpaneUiPlugin} from '@threepipe/plugin-tweakpane'

// todo make tutorial for this in docs?
async function init() {

const viewer = new ThreeViewer({

+ 3
- 1
examples/progressive-hdr-shadows-exp/script.ts Ver fichero

@@ -151,6 +151,7 @@ function createDirLight(viewer: ThreeViewer) {
directionalLight.shadowNear = 0.1
directionalLight.shadowFar = 10
directionalLight.shadowFrustum = 4
directionalLight.userData.autoUpdateParent = false // so that viewer.setDirty is not called when we change any property.
viewer.scene.addObject(directionalLight, {addToRoot: true})
// move to index 0 in parent.children, so that directionalLight always has index 0 in shader. required for material extension
const parent = directionalLight.parent!
@@ -162,6 +163,7 @@ function createDirLight(viewer: ThreeViewer) {

return directionalLight
}

function updateLight(viewer: ThreeViewer, directionalLight: DirectionalLight, histogram: ReturnType<typeof createHistogramFromImage>) {
if (viewer.renderManager.frameCount < 1) return
// if (viewer.renderManager.frameCount > 2) return
@@ -171,7 +173,7 @@ function updateLight(viewer: ThreeViewer, directionalLight: DirectionalLight, hi

const i = viewer.renderManager.frameCount <= 1 ? histogram.brightestI : histogram.sampleIndex()
histogram.indexToColor(i, directionalLight)
directionalLight.intensity = 0 // so it doesnt show in the scene
directionalLight.intensity = 0 // so it doesnt show in the scene. Note that setDirty is disabled for this light (autoUpdateParent)
histogram.indexToPosition(i, directionalLight.position).multiplyScalar(0.5 + size).add(center)
directionalLight.lookAt(center)
directionalLight.shadow.camera.near = Math.max(size / 100, 0.1)

+ 1
- 0
examples/tweakpane-editor/script.ts Ver fichero

@@ -54,6 +54,7 @@ import {
ViewerUiConfigPlugin,
VignettePlugin,
VirtualCamerasPlugin,
HemisphereLight,
} from 'threepipe'
import {TweakpaneUiPlugin} from '@threepipe/plugin-tweakpane'
import {HierarchyUiPlugin, TweakpaneEditorPlugin} from '@threepipe/plugin-tweakpane-editor'

+ 11
- 11
package-lock.json Ver fichero

@@ -1,15 +1,15 @@
{
"name": "threepipe",
"version": "0.0.39",
"version": "0.0.40",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "threepipe",
"version": "0.0.39",
"version": "0.0.40",
"license": "Apache-2.0",
"dependencies": {
"@types/three": "https://github.com/repalash/three-ts-types/releases/download/v0.157.1004/package.tgz",
"@types/three": "https://github.com/repalash/three-ts-types/releases/download/v0.157.1005/package.tgz",
"@types/webxr": "^0.5.1",
"@types/wicg-file-system-access": "^2020.9.5",
"popmotion": "^11.0.5",
@@ -35,7 +35,7 @@
"rimraf": "^5.0.1",
"rollup-plugin-glsl": "^1.3.0",
"rollup-plugin-license": "^3.0.1",
"three": "https://github.com/repalash/three.js-modded/releases/download/v0.157.1004/package.tgz",
"three": "https://github.com/repalash/three.js-modded/releases/download/v0.157.1007/package.tgz",
"tslib": "^2.5.0",
"typedoc": "^0.27.5",
"typescript": "5.7.2",
@@ -49,7 +49,7 @@
"win-node-env": "^0.6.1"
},
"peerDependencies": {
"three": "https://github.com/repalash/three.js-modded/releases/download/v0.157.1004/package.tgz"
"three": "https://github.com/repalash/three.js-modded/releases/download/v0.157.1007/package.tgz"
},
"peerDependenciesMeta": {
"three": {
@@ -2327,9 +2327,9 @@
"license": "MIT"
},
"node_modules/@types/three": {
"version": "0.157.1004",
"resolved": "https://github.com/repalash/three-ts-types/releases/download/v0.157.1004/package.tgz",
"integrity": "sha512-J5sdEce4YMYU7uYsL0b+St12VNpaQIDIrmzaiMGl/tunMtzCJBCpVFwBln7vewtCws6MopHGw2H0huAQIeEBxQ==",
"version": "0.157.1005",
"resolved": "https://github.com/repalash/three-ts-types/releases/download/v0.157.1005/package.tgz",
"integrity": "sha512-Qb6XlwUyDAoNUi9IxS5lYmkShRsVFCAsG4KAXTPlmi6G2V/GIzmvXZ5Ut2SV1L+7nCEFwtvENkzP3/MVQ9cWUQ==",
"dependencies": {
"fflate": "~0.6.10",
"meshoptimizer": "~0.18.1"
@@ -9920,9 +9920,9 @@
"license": "MIT"
},
"node_modules/three": {
"version": "0.157.1004",
"resolved": "https://github.com/repalash/three.js-modded/releases/download/v0.157.1004/package.tgz",
"integrity": "sha512-91lAxpFKhjnxV20rVODh2QehyEAgKlMghL0wiZLwxYKxueLJ/6ZH74yEEsMWHV+Jgf1I598OGzD6Xzecs8Epwg==",
"version": "0.157.1007",
"resolved": "https://github.com/repalash/three.js-modded/releases/download/v0.157.1007/package.tgz",
"integrity": "sha512-VjnxBF9JRjkFrqnHcrpa6VuOHSPyQzzLSYBUrPq0qJZmHhTVo4ns6MmZ8TA0v0kCu9pPNILDH9ZBY5d84v4UPA==",
"dev": true,
"license": "MIT"
},

+ 1
- 1
package.json Ver fichero

@@ -1,6 +1,6 @@
{
"name": "threepipe",
"version": "0.0.40-dev",
"version": "0.0.40",
"description": "A 3D viewer framework built on top of three.js in TypeScript with a focus on quality rendering, modularity and extensibility.",
"main": "dist/index.js",
"module": "dist/index.mjs",

+ 2
- 2
plugins/blend-importer/package-lock.json Ver fichero

@@ -1,12 +1,12 @@
{
"name": "@threepipe/plugin-blend-importer",
"version": "0.0.3",
"version": "0.0.4",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@threepipe/plugin-blend-importer",
"version": "0.0.3",
"version": "0.0.4",
"license": "Apache-2.0",
"dependencies": {
"threepipe": "file:./../../src/"

+ 2
- 2
plugins/blueprintjs/package-lock.json Ver fichero

@@ -1,12 +1,12 @@
{
"name": "@threepipe/plugin-blueprintjs",
"version": "0.3.2",
"version": "0.3.3",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@threepipe/plugin-blueprintjs",
"version": "0.3.2",
"version": "0.3.3",
"license": "Apache-2.0",
"dependencies": {
"threepipe": "file:./../../src/"

+ 2
- 2
plugins/configurator/package-lock.json Ver fichero

@@ -1,12 +1,12 @@
{
"name": "@threepipe/plugin-configurator",
"version": "0.1.2",
"version": "0.1.3",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@threepipe/plugin-configurator",
"version": "0.1.2",
"version": "0.1.3",
"license": "Apache-2.0",
"dependencies": {
"threepipe": "file:./../../src/",

+ 2
- 2
plugins/extra-importers/package-lock.json Ver fichero

@@ -1,12 +1,12 @@
{
"name": "@threepipe/plugins-extra-importers",
"version": "0.2.2",
"version": "0.2.3",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@threepipe/plugins-extra-importers",
"version": "0.2.2",
"version": "0.2.3",
"license": "Apache-2.0",
"dependencies": {
"threepipe": "file:./../../src/"

+ 2
- 2
plugins/gltf-transform/package-lock.json Ver fichero

@@ -1,12 +1,12 @@
{
"name": "@threepipe/plugin-gltf-transform",
"version": "0.1.2",
"version": "0.1.3",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@threepipe/plugin-gltf-transform",
"version": "0.1.2",
"version": "0.1.3",
"license": "Apache-2.0",
"dependencies": {
"threepipe": "file:./../../src/"

+ 2
- 2
plugins/network/package-lock.json Ver fichero

@@ -1,12 +1,12 @@
{
"name": "@threepipe/plugin-network",
"version": "0.1.1",
"version": "0.1.2",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@threepipe/plugin-network",
"version": "0.1.1",
"version": "0.1.2",
"license": "Apache-2.0",
"dependencies": {
"aws4fetch": "^1.0.18",

+ 3
- 3
plugins/svg-renderer/package-lock.json Ver fichero

@@ -1,12 +1,12 @@
{
"name": "@threepipe/plugin-svg-renderer",
"version": "0.2.2",
"version": "0.2.3",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@threepipe/plugin-svg-renderer",
"version": "0.2.2",
"version": "0.2.3",
"license": "GPLV3",
"dependencies": {
"threepipe": "file:./../../src/"
@@ -24,7 +24,7 @@
}
},
"../../node_modules/three": {
"version": "0.157.1004",
"version": "0.157.1007",
"dev": true,
"license": "MIT",
"devDependencies": {

+ 2
- 2
plugins/tweakpane/package-lock.json Ver fichero

@@ -1,12 +1,12 @@
{
"name": "@threepipe/plugin-tweakpane",
"version": "0.5.3",
"version": "0.5.4",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@threepipe/plugin-tweakpane",
"version": "0.5.3",
"version": "0.5.4",
"license": "Apache-2.0",
"dependencies": {
"threepipe": "file:./../../src/"

+ 5
- 0
src/core/IObject.ts Ver fichero

@@ -207,6 +207,11 @@ export interface IObject3DUserData extends IImportResultUserData {
*/
userSelectable?: boolean

/**
* Disables `bubbleToParent` in setDirty calls on the object. As an effect scene, viewer are not updated on property change. See progressive-hdr-shadows-exp or any baker.
*/
autoUpdateParent?: boolean

/**
* For Physics plugins
*/

+ 2
- 1
src/core/material/UnlitMaterial.ts Ver fichero

@@ -149,7 +149,6 @@ export class UnlitMaterial<TE extends IMaterialEventMap = IMaterialEventMap> ext
/**
* Deserializes the material from JSON.
* Textures should be loaded and in meta.textures before calling this method.
* todo - needs to be tested
* @param data
* @param meta
* @param _internal
@@ -159,6 +158,8 @@ export class UnlitMaterial<TE extends IMaterialEventMap = IMaterialEventMap> ext
ThreeSerialization.Deserialize(data, this, meta, true)
return this.setValues(data)
}
// this will deserialize the material from the outside because we need access to the viewer to load textures
// todo check if the material is in scene? if not, show an error/warning?
this.dispatchEvent({type: 'beforeDeserialize', data, meta, bubbleToObject: true, bubbleToParent: true})
return this
}

+ 1
- 1
src/core/object/iObjectCommons.ts Ver fichero

@@ -15,7 +15,7 @@ export const iObjectCommons = {
if (typeof options === 'string') { // just incase called by decorators
options = {change: options}
}
this.dispatchEvent({bubbleToParent: true, ...options, type: 'objectUpdate', object: this, args}) // this sets sceneUpdate in root scene
this.dispatchEvent({bubbleToParent: this.userData?.autoUpdateParent ?? true, ...options, type: 'objectUpdate', object: this, args}) // this sets sceneUpdate in root scene
if (options?.refreshUi !== false && options?.last !== false) this.refreshUi?.()
// console.log('object update')
},

+ 1
- 1
src/viewer/version.ts Ver fichero

@@ -1 +1 @@
export const VERSION = '0.0.39'
export const VERSION = '0.0.40'

Cargando…
Cancelar
Guardar