| 16 | * @category Objects > Custom Object 3D |
| 17 | */ |
| 18 | export class CustomRuntimeObject3D |
| 19 | extends gdjs.CustomRuntimeObject |
| 20 | implements gdjs.Base3DHandler |
| 21 | { |
| 22 | /** |
| 23 | * Position on the Z axis. |
| 24 | */ |
| 25 | private _z: float = 0; |
| 26 | private _minZ: float = 0; |
| 27 | private _maxZ: float = 0; |
| 28 | private _scaleZ: float = 1; |
| 29 | private _flippedZ: boolean = false; |
| 30 | /** |
| 31 | * Euler angle with the `ZYX` order. |
| 32 | * |
| 33 | * Note that `_rotationZ` is `angle` from `gdjs.RuntimeObject`. |
| 34 | */ |
| 35 | private _rotationX: float = 0; |
| 36 | /** |
| 37 | * Euler angle with the `ZYX` order. |
| 38 | * |
| 39 | * Note that `_rotationZ` is `angle` from `gdjs.RuntimeObject`. |
| 40 | */ |
| 41 | private _rotationY: float = 0; |
| 42 | private _customCenterZ: float = 0; |
| 43 | private static _temporaryVector = new THREE.Vector3(); |
| 44 | |
| 45 | constructor( |
| 46 | parent: gdjs.RuntimeInstanceContainer, |
| 47 | objectData: gdjs.Object3DData & gdjs.CustomObjectConfiguration, |
| 48 | instanceData?: InstanceData |
| 49 | ) { |
| 50 | super(parent, objectData, instanceData); |
| 51 | } |
| 52 | |
| 53 | protected override _createRender() { |
| 54 | const parent = this._runtimeScene; |
| 55 | return new gdjs.CustomRuntimeObject3DRenderer( |
| 56 | this, |
| 57 | this._instanceContainer, |
| 58 | parent |
| 59 | ); |
| 60 | } |
| 61 | |
| 62 | protected override _reinitializeRenderer(): void { |
| 63 | this.getRenderer().reinitialize(this, this.getParent()); |
| 64 | } |
| 65 | |
| 66 | override getRenderer(): gdjs.CustomRuntimeObject3DRenderer { |
| 67 | return super.getRenderer() as gdjs.CustomRuntimeObject3DRenderer; |
| 68 | } |
| 69 | |
| 70 | override get3DRendererObject() { |
| 71 | // It can't be null because Three.js is always loaded |
| 72 | // when a custom 3D object is used. |
| 73 | return this.getRenderer().get3DRendererObject()!; |
| 74 | } |
| 75 |
nothing calls this directly
no outgoing calls
no test coverage detected