Sfoglia il codice sorgente

Add Object3D2, add some links on website.

master
Palash Bansal 11 mesi fa
parent
commit
47a79121c8
Nessun account collegato all'indirizzo email del committer
3 ha cambiato i file con 54 aggiunte e 0 eliminazioni
  1. 1
    0
      src/core/index.ts
  2. 43
    0
      src/core/object/Object3D2.ts
  3. 10
    0
      website/guide/viewer-api.md

+ 1
- 0
src/core/index.ts Vedi File

@@ -9,6 +9,7 @@ export {UnlitMaterial, MeshBasicMaterial2} from './material/UnlitMaterial'
export {UnlitLineMaterial, LineBasicMaterial2} from './material/UnlitLineMaterial'
export {LineMaterial2, MeshLineMaterial} from './material/LineMaterial2'
export {LegacyPhongMaterial} from './material/LegacyPhongMaterial'
export {Object3D2} from './object/Object3D2'
export {Mesh2} from './object/Mesh2'
export {MeshLine} from './object/MeshLine'
export {MeshLineSegments} from './object/MeshLineSegments'

+ 43
- 0
src/core/object/Object3D2.ts Vedi File

@@ -0,0 +1,43 @@
import {Object3D} from 'three'
import {IObject3D, IObject3DEventMap, IObject3DUserData} from '../IObject'
import {iObjectCommons} from './iObjectCommons'

export class Object3D2<TE extends IObject3DEventMap = IObject3DEventMap> extends Object3D<TE> implements IObject3D<TE> {
assetType = 'model' as const
setDirty = iObjectCommons.setDirty
refreshUi = iObjectCommons.refreshUi

/**
* @deprecated use `this` instead
*/
get modelObject(): this {
return this
}

constructor() {
super()
iObjectCommons.upgradeObject3D.call(this)
}

declare userData: IObject3DUserData

// region inherited type fixes
// re-declaring from IObject3D because: https://github.com/microsoft/TypeScript/issues/16936

traverse: (callback: (object: IObject3D) => void) => void
traverseVisible: (callback: (object: IObject3D) => void) => void
traverseAncestors: (callback: (object: IObject3D) => void) => void
getObjectById: <T extends IObject3D = IObject3D>(id: number) => T | undefined
getObjectByName: <T extends IObject3D = IObject3D>(name: string) => T | undefined
getObjectByProperty: <T extends IObject3D = IObject3D>(name: string, value: string) => T | undefined
copy: (source: Object3D2|IObject3D, recursive?: boolean, ...args: any[]) => this
clone: (recursive?: boolean) => this
remove: (...object: IObject3D[]) => this
declare parent: IObject3D | null
declare children: IObject3D[]
dispose: (removeFromParent?: boolean) => void

// endregion

}


+ 10
- 0
website/guide/viewer-api.md Vedi File

@@ -1027,15 +1027,25 @@ Some important interfaces:

Some important classes

* [Object3D2](https://threepipe.org/docs/classes/Object3D2.html) - Extends three.js [Object3D](https://threejs.org/docs/#api/en/objects/Object3D) and implements [IObject3D](https://threepipe.org/docs/interfaces/IObject3D.html).
* [Mesh2](https://threepipe.org/docs/classes/Mesh2.html) - Extends three.js [Mesh](https://threejs.org/docs/#api/en/objects/Mesh) and implements [IObject3D](https://threepipe.org/docs/interfaces/IObject3D.html).
* [PerspectiveCamera2](https://threepipe.org/docs/classes/PerspectiveCamera2.html) - Extends three.js [PerspectiveCamera](https://threejs.org/docs/#api/en/cameras/PerspectiveCamera) and implements [ICamera](https://threepipe.org/docs/interfaces/ICamera.html). (different constructor than PerspectiveCamera)
* [OrthographicCamera2](https://threepipe.org/docs/classes/OrthographicCamera2.html) - Extends three.js [OrthographicCamera](https://threejs.org/docs/#api/en/cameras/OrthographicCamera) and implements [ICamera](https://threepipe.org/docs/interfaces/ICamera.html). (different constructor than OrthographicCamera)
* [PerspectiveCamera0](https://threepipe.org/docs/classes/PerspectiveCamera0.html) - Extends three.js [PerspectiveCamera](https://threejs.org/docs/#api/en/cameras/PerspectiveCamera) and implements [ICamera](https://threepipe.org/docs/interfaces/ICamera.html). (same constructor than PerspectiveCamera)
* [OrthographicCamera0](https://threepipe.org/docs/classes/OrthographicCamera0.html) - Extends three.js [OrthographicCamera](https://threejs.org/docs/#api/en/cameras/OrthographicCamera) and implements [ICamera](https://threepipe.org/docs/interfaces/ICamera.html). (same constructor than OrthographicCamera)
* [BufferGeometry2](https://threepipe.org/docs/classes/BufferGeometry2.html) - Extends three.js [BufferGeometry](https://threejs.org/docs/#api/en/core/BufferGeometry) and implements [IGeometry](https://threepipe.org/docs/interfaces/IGeometry.html).
* [LineGeometry2](https://threepipe.org/docs/classes/LineGeometry2.html) - Extends three.js [LineGeometry](https://threejs.org/docs/#api/en/core/LineGeometry) and implements [IGeometry](https://threepipe.org/docs/interfaces/IGeometry.html).
* [LineSegmentsGeometry2](https://threepipe.org/docs/classes/LineSegmentsGeometry2.html) - Extends three.js [LineSegmentsGeometry](https://threejs.org/docs/#api/en/core/LineSegmentsGeometry) and implements [IGeometry](https://threepipe.org/docs/interfaces/IGeometry.html).
* [WireframeGeometry3](https://threepipe.org/docs/classes/WireframeGeometry3.html) - Extends three.js [WireframeGeometry2](https://threejs.org/docs/#api/en/core/WireframeGeometry2) and implements [IGeometry](https://threepipe.org/docs/interfaces/IGeometry.html).
* [RootScene](https://threepipe.org/docs/classes/RootScene.html) - Extends three.js [Scene](https://threejs.org/docs/#api/en/scenes/Scene) and implements [IScene](https://threepipe.org/docs/interfaces/IScene.html).
* [RenderManager](https://threepipe.org/docs/classes/RenderManager.html) - Implements [IRenderManager](https://threepipe.org/docs/interfaces/IRenderManager.html).
* [PhysicalMaterial](https://threepipe.org/docs/classes/PhysicalMaterial.html) - Extends three.js [MeshPhysicalMaterial](https://threejs.org/docs/#api/en/materials/MeshPhysicalMaterial) and implements [IMaterial](https://threepipe.org/docs/interfaces/IMaterial.html).
* [UnlitMaterial](https://threepipe.org/docs/classes/UnlitMaterial.html) - Extends three.js [MeshBasicMaterial](https://threejs.org/docs/#api/en/materials/MeshBasicMaterial) and implements [IMaterial](https://threepipe.org/docs/interfaces/IMaterial.html).
* [LineMaterial2](https://threepipe.org/docs/classes/LineMaterial2.html) - Extends three.js [LineMaterial](https://threejs.org/docs/#api/en/materials/LineMaterial) and implements [IMaterial](https://threepipe.org/docs/interfaces/IMaterial.html).
* [ObjectShaderMaterial](https://threepipe.org/docs/classes/ObjectShaderMaterial.html) - Extends three.js [ShaderMaterial](https://threejs.org/docs/#api/en/materials/ShaderMaterial) and implements [IMaterial](https://threepipe.org/docs/interfaces/IMaterial.html) and can be assigned to objects in the scene.
* [ShaderMaterial2](https://threepipe.org/docs/classes/ShaderMaterial2.html) - Extends three.js [ShaderMaterial](https://threejs.org/docs/#api/en/materials/ShaderMaterial) and implements [IMaterial](https://threepipe.org/docs/interfaces/IMaterial.html).
* [ExtendedShaderMaterial](https://threepipe.org/docs/classes/ExtendedShaderMaterial.html) - Extends [ShaderMaterial2](https://threepipe.org/docs/classes/ShaderMaterial2.html) and supports texture access/write with color-space/encoding support.
* [LegacyPhongMaterial](https://threepipe.org/docs/classes/LegacyPhongMaterial.html) - Extends three.js [MeshPhongMaterial](https://threejs.org/docs/#api/en/materials/MeshPhongMaterial) and implements [IMaterial](https://threepipe.org/docs/interfaces/IMaterial.html).
* [UnlitLineMaterial](https://threepipe.org/docs/classes/UnlitLineMaterial.html) - Extends three.js [LineBasicMaterial](https://threejs.org/docs/#api/en/materials/LineBasicMaterial) and implements [IMaterial](https://threepipe.org/docs/interfaces/IMaterial.html).
* [DirectionalLight2](https://threepipe.org/docs/classes/DirectionalLight2.html) - Extends three.js [DirectionalLight](https://threejs.org/docs/#api/en/lights/DirectionalLight) and implements [ILight](https://threepipe.org/docs/interfaces/ILight.html).
* [SpotLight2](https://threepipe.org/docs/classes/SpotLight2.html) - Extends three.js [SpotLight](https://threejs.org/docs/#api/en/lights/SpotLight) and implements [ILight](https://threepipe.org/docs/interfaces/ILight.html).

Loading…
Annulla
Salva