repo_name
string
dataset
string
owner
string
lang
string
func_name
string
code
string
docstring
string
url
string
sha
string
three.ez
github_2023
agargaro
typescript
InstancedMesh2.hoveredInstance
public get hoveredInstance(): InstancedMeshEntity { return this._hoveredInstance; }
/** * Gets the currently hovered instance. */
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/instancedMesh/InstancedMesh2.ts#L41-L41
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
InstancedMesh2.focusedInstance
public get focusedInstance(): InstancedMeshEntity { return this._focusedInstance; }
/** * Gets the currently focused instance. */
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/instancedMesh/InstancedMesh2.ts#L46-L46
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
InstancedMesh2.clickingInstance
public get clickingInstance(): InstancedMeshEntity { return this._clickingInstance; }
/** * Gets the currently clicking instance. */
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/instancedMesh/InstancedMesh2.ts#L51-L51
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
InstancedMesh2.draggingInstance
public get draggingInstance(): InstancedMeshEntity { return this._draggingInstance; }
/** * Gets the currently dragging instance. */
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/instancedMesh/InstancedMesh2.ts#L56-L56
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
InstancedMesh2.constructor
constructor(geometry: BufferGeometry, material: Material, count: number, singleInstanceType: typeof InstancedMeshEntity, animate = false, color?: ColorRepresentation) { super(geometry, material, count); color = this._tempColor.set(color); this._animate = animate; if (animate) { this.instanceMatri...
/** * @param geometry The geometry for the instanced mesh. * @param material The material to apply to the instanced mesh. * @param count The number of instances to create. * @param singleInstanceType The type of individual instance to create. * @param animate A flag indicating whether the 'anim...
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/instancedMesh/InstancedMesh2.ts#L66-L95
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
InstancedMesh2.focus
public focus(target?: InstancedMeshEntity): void { if (!this.__focused) return; const focusableObj = target?.focusable ? target : undefined; if ((!target || focusableObj?.enabled) && this._focusedInstance !== focusableObj) { const oldFocusedObj = this._focusedInstance; this._focusedInstance = f...
/** * Set the focus to the specified instance, if focus is enabled for the InstancedMesh2, or clears the focus if no target is provided. * @param target Optional. The instance to focus on. If not provided, the focus is cleared. */
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/instancedMesh/InstancedMesh2.ts#L101-L121
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
InstancedMeshEntity.hovered
public get hovered(): boolean { return this.__hovered; }
/** Indicates if the primary pointer is over this object. */
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/instancedMesh/InstancedMeshEntity.ts#L49-L49
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
InstancedMeshEntity.focused
public get focused(): boolean { return this.__focused; }
/** Indicates if the object is currently focused. */
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/instancedMesh/InstancedMeshEntity.ts#L51-L51
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
InstancedMeshEntity.clicking
public get clicking(): boolean { return this.__clicking; }
/** Indicates if the object is currently being clicked. */
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/instancedMesh/InstancedMeshEntity.ts#L53-L53
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
InstancedMeshEntity.dragging
public get dragging(): boolean { return this.__dragging; }
/** Indicates if the object is currently being dragged. */
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/instancedMesh/InstancedMeshEntity.ts#L55-L55
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
InstancedMeshEntity.enabledState
public get enabledState(): boolean { return this.enabled && this.parent.enabledState; }
/** Retrieves the combined enabled state considering parent objects. */
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/instancedMesh/InstancedMeshEntity.ts#L57-L57
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
InstancedMeshEntity.matrixWorld
public get matrixWorld(): Matrix4 { const matrix = this.parent._tempMatrix; matrix.compose(this.position, this.quaternion, this.scale); this.parent.updateWorldMatrix(true, false); return matrix.premultiply(this.parent.matrixWorld); }
/** * The global transform of the object. */
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/instancedMesh/InstancedMeshEntity.ts#L62-L67
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
InstancedMeshEntity.constructor
constructor(parent: InstancedMesh2, index: number, color?: ColorRepresentation) { super(); this.parent = parent; this.instanceId = index; this.__eventsDispatcher = new EventsDispatcherInstanced(this); if (color !== undefined) { this.setColor(color); } }
/** * @param parent - The parent InstancedMesh2 that contains this instance. * @param index - The index of this instance within the parent InstancedMesh2. * @param color - The initial color representation for this instance (optional). */
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/instancedMesh/InstancedMeshEntity.ts#L74-L82
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
InstancedMeshEntity.setColor
public setColor(color: ColorRepresentation): void { const parent = this.parent; parent.setColorAt(this.instanceId, parent._tempColor.set(color)); parent.instanceColor.needsUpdate = true; }
/** * Sets the color of this instance. * @param color - The color representation to set. */
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/instancedMesh/InstancedMeshEntity.ts#L88-L92
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
InstancedMeshEntity.getColor
public getColor(color = this.parent._tempColor): Color { this.parent.getColorAt(this.instanceId, color); return color; }
/** * Gets the color of this instance. * @param color - An optional target Color object to store the result (optional). * @returns The color representation of this instance. */
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/instancedMesh/InstancedMeshEntity.ts#L99-L102
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
InstancedMeshEntity.updateMatrix
public updateMatrix(): void { const parent = this.parent; const matrix = parent._tempMatrix; matrix.compose(this.position, this.quaternion, this.scale); parent.setMatrixAt(this.instanceId, matrix); parent.instanceMatrix.needsUpdate = true; }
/** * Updates the local transform. */
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/instancedMesh/InstancedMeshEntity.ts#L107-L113
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
InstancedMeshEntity.applyMatrix4
public applyMatrix4(m: Matrix4): this { const parent = this.parent; const matrix = parent._tempMatrix; matrix.compose(this.position, this.quaternion, this.scale); matrix.premultiply(m); matrix.decompose(this.position, this.quaternion, this.scale); parent.setMatrixAt(this.instanceId, matrix); ...
/** * Applies the matrix transform to the object and updates the object's position, rotation, and scale. * @param m Matrix to apply. * @returns The instance of the object. */
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/instancedMesh/InstancedMeshEntity.ts#L120-L129
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
InstancedMeshEntity.applyQuaternion
public applyQuaternion(q: Quaternion): this { this.quaternion.premultiply(q); return this; }
/** * Applies the rotation represented by the quaternion to the object. * @param q Quaternion to apply. * @returns The instance of the object. */
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/instancedMesh/InstancedMeshEntity.ts#L136-L139
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
InstancedMeshEntity.rotateOnAxis
public rotateOnAxis(axis: Vector3, angle: number): this { tempQuaternion.setFromAxisAngle(axis, angle); this.quaternion.multiply(tempQuaternion); return this; }
/** * Rotate an object along an axis in object space. The axis is assumed to be normalized. * @param axis A normalized vector in object space. * @param angle The angle in radians. * @returns The instance of the object. */
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/instancedMesh/InstancedMeshEntity.ts#L147-L151
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
InstancedMeshEntity.rotateOnWorldAxis
public rotateOnWorldAxis(axis: Vector3, angle: number): this { tempQuaternion.setFromAxisAngle(axis, angle); this.quaternion.premultiply(tempQuaternion); return this; }
/** * Rotate an object along an axis in world space. The axis is assumed to be normalized. Method Assumes no rotated parent. * @param axis A normalized vector in world space. * @param angle The angle in radians. * @returns The instance of the object. */
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/instancedMesh/InstancedMeshEntity.ts#L159-L163
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
InstancedMeshEntity.applyFocus
public applyFocus(): void { this.parent.focus(this); }
/** * Applies focus to the object. */
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/instancedMesh/InstancedMeshEntity.ts#L168-L170
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
InstancedMeshEntity.applyBlur
public applyBlur(): void { if (this.parent.focusedInstance === this) { this.parent.focus(); } }
/** * Applies blur (removes focus) from the object. */
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/instancedMesh/InstancedMeshEntity.ts#L175-L179
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
InstancedMeshEntity.on
public on<K extends keyof InstancedEvents>(types: K | K[], listener: (event?: InstancedEvents[K]) => void): (event?: InstancedEvents[K]) => void { if (typeof types === 'string') { return this.__eventsDispatcher.add(types, listener) as (event?: InstancedEvents[K]) => void; } for (const type of types as...
/** * Attaches an event listener to the object. * @param type - The type of event to listen for. * @param listener - The callback function to execute when the event occurs. * @returns A function to remove the event listener. */
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/instancedMesh/InstancedMeshEntity.ts#L187-L195
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
InstancedMeshEntity.hasEvent
public hasEvent<K extends keyof InstancedEvents>(type: K, listener: (event?: InstancedEvents[K]) => void): boolean { return this.__eventsDispatcher.has(type, listener); }
/** * Checks if the object has a specific event listener. * @param type - The type of event to check for. * @param listener - The callback function to check. * @returns `true` if the event listener is attached; otherwise, `false`. */
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/instancedMesh/InstancedMeshEntity.ts#L203-L205
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
InstancedMeshEntity.off
public off<K extends keyof InstancedEvents>(type: K, listener: (event?: InstancedEvents[K]) => void): void { this.__eventsDispatcher.remove(type, listener); }
/** * Removes an event listener from the object. * @param type - The type of event to remove the listener from. * @param listener - The callback function to remove. */
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/instancedMesh/InstancedMeshEntity.ts#L212-L214
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
InstancedMeshEntity.trigger
public trigger<K extends keyof InstancedEvents>(type: K, event?: InstancedEvents[K]): void { this.__eventsDispatcher.dispatchManual(type, event); }
/** * Triggers a specific event on the object. * @param type - The type of event to trigger. * @param event - Optional event data to pass to the listeners. */
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/instancedMesh/InstancedMeshEntity.ts#L221-L223
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
InstancedMeshEntity.tween
public tween(): Tween<InstancedMeshEntity> { return new Tween(this); }
/** * Initiates a Tween animation for the object. * @returns A Tween instance for further configuration. */
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/instancedMesh/InstancedMeshEntity.ts#L229-L231
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
RenderView.constructor
constructor(parameters: ViewParameters, rendererSize: Vector2) { this._rendererSize = rendererSize; this.scene = parameters.scene; this.camera = parameters.camera; this.viewport = parameters.viewport; this.tags = parameters.tags; this._visible = parameters.visible ?? true; this.enabled = par...
/** * Don't instantiate this manually. */
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/rendering/RenderView.ts#L76-L92
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
RenderView.update
public update(): void { if (this.viewport) { this.computedViewport.left = Math.floor(this._rendererSize.x * this.viewport.left); this.computedViewport.bottom = Math.floor(this._rendererSize.y * this.viewport.bottom); this.computedViewport.width = Math.floor(this._rendererSize.x * this.viewport.wid...
/** * Updates the dimensions of the viewport based on the renderer size. */
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/rendering/RenderView.ts#L97-L110
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
RunningTween.finished
public get finished(): boolean { return this._finished; }
/** * Indicates whether the running tween has finished executing. */
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/tweening/RunningTween.ts#L63-L63
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
RunningTween.constructor
constructor(target: T, tween: Tween<T>) { this.target = target; this.tween = tween; }
/** * Don't instantiate this manually. */
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/tweening/RunningTween.ts#L68-L71
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
RunningTween.setTimeScale
public setTimeScale(value: number): this { this.timeScale = value; return this; }
/** * Set the time scale for the running tween. * @param value - The time scale value to apply. * @returns The updated RunningTween instance. */
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/tweening/RunningTween.ts#L78-L81
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
RunningTween.pause
public pause(): void { this.paused = true; }
/** * Pause the execution of the running tween. */
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/tweening/RunningTween.ts#L86-L88
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
RunningTween.resume
public resume(): void { this.paused = false; }
/** * Resume the execution of the running tween if it was paused. */
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/tweening/RunningTween.ts#L93-L95
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
RunningTween.stop
public stop(): void { TweenManager.stop(this); }
/** * Stop the running tween, causing it to finish immediately. */
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/tweening/RunningTween.ts#L100-L102
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
RunningTween.complete
public complete(): void { TweenManager.complete(this); }
/** * Complete the running tween, causing it to finish immediately. */
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/tweening/RunningTween.ts#L107-L109
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
RunningTween.revert
public revert(): void { console.error('Revert method not implemented yet.'); // handle (!blockHistory) }
/** * Revert the running tween to its initial state (Not implemented yet). */
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/tweening/RunningTween.ts#L114-L116
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
RunningTween.getBlock
public getBlock(): RunningBlock { this.currentBlock?.config?.onComplete?.call(this.target, this.target); const block = this.getCurrentBlock(); block?.config?.onStart?.call(this.target, this.target); if (!this.tween.blockHistory && !this.reversed && !this.repeat && block) { this.history.push(block)...
/** @internal */
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/tweening/RunningTween.ts#L119-L128
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
RunningTween.getCurrentBlock
private getCurrentBlock(): RunningBlock { if (this.reversed) return this.getPrevBlock(); return this.repeat ? this.getRepeatBlock() : this.getNextBlock(); }
/** @internal */
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/tweening/RunningTween.ts#L131-L134
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
RunningTween.getPrevBlock
private getPrevBlock(): RunningBlock { if (this.actionIndex > 0) { const block = this.history[--this.actionIndex]; block.reversed = !block.originallyReversed; block.elapsedTime = 0; block.tweensStarted = false; return block; } }
/** @internal */
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/tweening/RunningTween.ts#L137-L145
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
RunningTween.getRepeatBlock
private getRepeatBlock(): RunningBlock { if (this.actionIndex < this.history.length - 1) { const block = this.history[++this.actionIndex]; block.reversed = block.originallyReversed; block.elapsedTime = 0; block.tweensStarted = false; return block; } }
/** @internal */
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/tweening/RunningTween.ts#L148-L156
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
RunningTween.getNextBlock
private getNextBlock(): RunningBlock { while (++this.actionIndex < this.tween.actions.length) { const action = this.tween.actions[this.actionIndex]; if (action.isRepeat) { this.handleRepetition(action.times); } else if (action.isYoyo) { const block = this.handleYoyo(action.times); ...
/** @internal */
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/tweening/RunningTween.ts#L159-L173
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
RunningTween.cloneBlock
private cloneBlock(block: RunningBlock): RunningBlock { return { elapsedTime: 0, totalTime: block.totalTime, reversed: !block.reversed, originallyReversed: !block.reversed, actions: block.actions, tweens: block.tweens, config: block.config, runningTweens: this.cloneRu...
/** @internal */
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/tweening/RunningTween.ts#L176-L187
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
RunningTween.cloneRunningTweens
private cloneRunningTweens(runningTweens: RunningTween<T>[]): RunningTween<T>[] { if (!runningTweens) return; const ret: RunningTween<T>[] = []; for (const runningTween of runningTweens) { const runningCloned = new RunningTween(runningTween.target, runningTween.tween); runningCloned.timeScale = ...
/** @internal */
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/tweening/RunningTween.ts#L190-L204
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
RunningTween.handleMotion
private handleMotion(): RunningBlock { const descriptor = this.tween.actions[this.actionIndex].init(this.target); return { config: descriptor.config, actions: descriptor.actions, elapsedTime: 0, totalTime: Math.max(...descriptor.actions.map((x) => x.time)) }; }
/** @internal */
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/tweening/RunningTween.ts#L207-L215
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
RunningTween.handleTween
private handleTween(action: ActionTween<T>): RunningBlock { return { tweens: action.tweens, elapsedTime: 0, totalTime: 0 }; }
/** @internal */
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/tweening/RunningTween.ts#L218-L224
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
RunningTween.handleRepetition
private handleRepetition(times: number): void { const repeat = this.repetitions; repeat[this.actionIndex] ??= 0; if (repeat[this.actionIndex] < times) { repeat[this.actionIndex]++; do { this.actionIndex--; } while (this.actionIndex > -1 && !this.tween.actions[this.actionIndex].hasA...
/** @internal */
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/tweening/RunningTween.ts#L227-L237
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
RunningTween.handleYoyo
private handleYoyo(times: number): RunningBlock { const repeat = this.repetitions; repeat[this.actionIndex] ??= 0; if (repeat[this.actionIndex] < times) { repeat[this.actionIndex]++; if (repeat[this.actionIndex--] < 3) { return this.cloneBlock(this.history[this.history.length - 1]); ...
/** @internal */
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/tweening/RunningTween.ts#L240-L253
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
RunningTween.execute
public execute(delta: number): boolean { if (this.paused) return true; delta *= this.timeScale; do { delta = Math.min(this.executeBlock(delta), this.getTweensDelta(this.currentBlock)); } while (delta >= 0 && this.getBlock()); return delta < 0; }
/** @internal */
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/tweening/RunningTween.ts#L256-L263
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
RunningTween.executeBlock
private executeBlock(delta: number): number { const block = this.currentBlock; block.elapsedTime += delta; this.executeActions(block); this.executeTweens(block, delta); return block.elapsedTime - block.totalTime; }
/** @internal */
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/tweening/RunningTween.ts#L266-L272
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
RunningTween.executeActions
private executeActions(block: RunningBlock): void { if (block.actions) { for (const action of block.actions) { const elapsedTime = Math.min(1, block.elapsedTime / (action.time + 10 ** -12)); const alpha = block.reversed ? 1 - elapsedTime : elapsedTime; const easedAlpha = action.easing?...
/** @internal */
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/tweening/RunningTween.ts#L275-L288
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
RunningTween.executeTweens
private executeTweens(block: RunningBlock, delta: number): void { if (block.tweens && !block.tweensStarted) { if (!block.runningTweens) { block.runningTweens = []; for (const tween of block.tweens) { this.executeTween(block, delta, tween); } } else { for (const ...
/** @internal */
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/tweening/RunningTween.ts#L291-L305
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
RunningTween.executeTween
private executeTween(block: RunningBlock, delta: number, tween: Tween<T>): void { const runningTween = TweenManager.createChildren(this.target, tween, this.root ?? this); block.runningTweens.push(runningTween); if (runningTween.execute(delta)) { TweenManager.addChildren(runningTween); } }
/** @internal */
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/tweening/RunningTween.ts#L308-L314
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
RunningTween.executeExistingTween
private executeExistingTween(delta: number, reversed: boolean): void { this.reversed = reversed ? !this.originallyReversed : this.originallyReversed; this.repeat = !this.reversed; this.actionIndex = this.reversed ? this.history.length : -1; this.getBlock(); if (this.execute(delta)) { TweenMana...
/** @internal */
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/tweening/RunningTween.ts#L317-L325
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
RunningTween.getTweensDelta
public getTweensDelta(block: RunningBlock): number { let delta = Number.MAX_SAFE_INTEGER; if (block.runningTweens) { for (const exTween of block.runningTweens) { const indexLastBlock = (exTween.repeat || exTween.reversed) ? exTween.actionIndex : exTween.history.length - 1; const lastBlock ...
/** @internal */
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/tweening/RunningTween.ts#L328-L338
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
Tween.constructor
constructor(target: T) { this.target = target; }
/** * @param target - The object to apply the tween to. */
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/tweening/Tween.ts#L23-L25
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
Tween.setId
public setId(id: string): this { this.id = id; return this; }
/** * Set a unique identifier for the Tween. If specified, stops the old tween with the same id. * @param id The identifier to assign to the Tween. * @returns The updated Tween instance. */
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/tweening/Tween.ts#L32-L35
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
Tween.setTags
public setTags(...tags: string[]): this { this.tags = tags; return this; }
/** * Set tags for the Tween, which can be used for filtering and management. * @param tags - Tags to associate with the Tween. * @returns The updated Tween instance. */
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/tweening/Tween.ts#L42-L45
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
Tween.setTarget
public setTarget(target: T): this { this.target = target; return this; }
/** * Set the target object for the Tween. * @param target - The object to apply the tween to. * @returns The updated Tween instance. */
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/tweening/Tween.ts#L52-L55
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
Tween.to
public to(time: number, action: Motion<T>, config?: MotionConfig<T>): this { this.actions.push(new ActionMotion(time, action, config, false)); return this; }
/** * Define a motion from the current state to a new state over a specified time. * @param time - The duration of the motion in milliseconds. * @param action - The motion configuration. * @param config - Additional motion configuration options. * @returns The updated Tween instance. */
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/tweening/Tween.ts#L64-L67
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
Tween.by
public by(time: number, action: Motion<T>, config?: MotionConfig<T>): this { this.actions.push(new ActionMotion(time, action, config, true)); return this; }
/** * Define a relative motion from the current state. * @param time - The duration of the motion in milliseconds. * @param action - The motion configuration. * @param config - Additional motion configuration options. * @returns The updated Tween instance. */
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/tweening/Tween.ts#L76-L79
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
Tween.set
public set(action: SetMotion<T>): this { this.actions.push(new ActionMotion(0, action, {}, false)); return this; }
/** * Define a movement from the current state to a new state instantaneously. * @param action - The motion configuration. * @returns The updated Tween instance. */
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/tweening/Tween.ts#L86-L89
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
Tween.call
public call(callback: () => void): this { this.actions.push(new ActionCallback(callback)); return this; }
/** * Add a callback action to the Tween. * @param callback - The callback function to execute. * @returns The updated Tween instance. */
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/tweening/Tween.ts#L96-L99
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
Tween.delay
public delay(time: number): this { this.actions.push(new ActionDelay(time)); return this; }
/** * Add a delay before executing the next action. * @param time - The duration of the delay in milliseconds. * @returns The updated Tween instance. */
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/tweening/Tween.ts#L106-L109
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
Tween.repeat
public repeat(times = 1): this { if (times === Infinity) { this.blockHistory = true; this.infiniteLoop = true; } if (this.actions[this.actions.length - 1].isRepeat) { this.actions[this.actions.length - 1].times += times; } else { this.actions.push(new ActionRepeat(times)); } ...
/** * Repeat the last action for a specific number of times. * @param times - The number of times to repeat the action. * @returns The updated Tween instance. */
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/tweening/Tween.ts#L116-L127
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
Tween.repeatForever
public repeatForever(): this { return this.repeat(Infinity); }
/** * Repeat the last action indefinitely. * @returns The updated Tween instance. */
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/tweening/Tween.ts#L133-L135
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
Tween.yoyo
public yoyo(times = 1): this { if (times === Infinity) { this.infiniteLoop = true; } if (this.actions[this.actions.length - 1].isYoyo) { this.actions[this.actions.length - 1].times += times; } else { this.actions.push(new ActionYoyo(times)); } return this; }
/** * Apply a yoyo effect to the last action, making it reverse its motion, for a specific number of times. * @param times - The number of times to yoyo the last action. * @returns The updated Tween instance. */
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/tweening/Tween.ts#L142-L152
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
Tween.yoyoForever
public yoyoForever(): this { return this.yoyo(Infinity); }
/** * Apply a yoyo effect to the last action, making it reverse its motion, indefinitely. * @returns The updated Tween instance. */
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/tweening/Tween.ts#L158-L160
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
Tween.then
public then(tween: Tween<T>): this { this.actions.push(new ActionTween(tween)); this.infiniteLoop ||= tween.infiniteLoop; return this; }
/** * Chain another Tween to execute after this Tween. * @param tween - The Tween to chain. * @returns The updated Tween instance. */
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/tweening/Tween.ts#L167-L171
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
Tween.parallel
public parallel(...tweens: Tween<T>[]): this { this.actions.push(new ActionTween(...tweens)); this.infiniteLoop ||= tweens.some((x) => x.infiniteLoop); return this; }
/** * Run multiple Tweens in parallel. * @param tweens - The Tweens to run in parallel. * @returns The updated Tween instance. */
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/tweening/Tween.ts#L178-L182
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
Tween.sequence
public sequence(...tweens: Tween<T>[]): this { for (const tween of tweens) { this.actions.push(new ActionTween(tween)); this.infiniteLoop ||= tween.infiniteLoop; } return this; }
/** * Run multiple Tweens in sequence. * @param tweens - The Tweens to run in sequence. * @returns The updated Tween instance. */
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/tweening/Tween.ts#L189-L195
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
Tween.chain
public chain(tween: Tween<T>): this { this.actions.push(...tween.actions); this.infiniteLoop ||= tween.infiniteLoop; return this; }
/** * Chain actions from another Tween to this Tween. * @param tween - The Tween containing actions to chain. * @returns The updated Tween instance. */
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/tweening/Tween.ts#L202-L206
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
Tween.clone
public clone(): Tween<T> { const tween = new Tween(this.target); tween.actions = [...this.actions]; tween.tags = [...this.tags]; tween.infiniteLoop = this.infiniteLoop; return tween; }
/** * Clone the Tween instance. * @returns A new Tween instance with the same configuration. */
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/tweening/Tween.ts#L212-L218
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
Tween.start
public start(): RunningTween<T> { if (this.id !== undefined) { TweenManager.stopById(this.id); } return TweenManager.create(this.target, this); }
/** * Start the Tween and create a RunningTween instance. * @returns A RunningTween instance that controls the execution of the Tween. */
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/tweening/Tween.ts#L224-L229
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
TweenManager.create
public static create<T>(target: T, tween: Tween<T>): RunningTween<T> { const runningTween = new RunningTween(target, tween); runningTween.getBlock(); this._running.push(runningTween); return runningTween; }
/** @internal */
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/tweening/TweenManager.ts#L12-L17
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
TweenManager.createChildren
public static createChildren<T>(target: T, tween: Tween<T>, root: RunningTween<T>): RunningTween<T> { const runningTween = new RunningTween(target, tween); runningTween.root = root; runningTween.getBlock(); return runningTween; }
/** @internal */
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/tweening/TweenManager.ts#L20-L25
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
TweenManager.addChildren
public static addChildren<T>(runningTween: RunningTween<T>): void { this._runningChildren.push(runningTween); }
/** @internal */
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/tweening/TweenManager.ts#L28-L30
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
TweenManager.update
public static update(delta: number): void { const runningChildren = this._runningChildren; for (let i = runningChildren.length - 1; i >= 0; i--) { const rc = runningChildren[i]; if (!rc.execute(delta * rc.root.timeScale)) { runningChildren.splice(i, 1); } } const running = thi...
/** @internal */
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/tweening/TweenManager.ts#L33-L49
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
TweenManager.stop
public static stop<T>(runningTween: RunningTween<T>): void { const index = this._running.indexOf(runningTween); if (index < 0) return; this._running.splice(index, 1); runningTween._finished = true; runningTween.paused = false; const runningChildren = this._runningChildren; for (let i = runn...
/** @internal */
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/tweening/TweenManager.ts#L52-L65
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
TweenManager.complete
public static complete<T>(runningTween: RunningTween<T>): void { const index = this._running.indexOf(runningTween); if (index < 0) return; runningTween.paused = false; const runningChildren = this._runningChildren; for (let i = runningChildren.length - 1; i >= 0; i--) { if (runningChildren[i]...
/** @internal */
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/tweening/TweenManager.ts#L68-L84
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
TweenManager.stopById
public static stopById(id: string): void { for (let i = this._running.length - 1; i >= 0; i--) { if (this._running[i].tween.id === id) { this._running[i].stop(); return; } } }
/** * Stop the running tween with a specific id. * @param id Tween identifier. */
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/tweening/TweenManager.ts#L90-L97
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
TweenManager.stopAll
public static stopAll(): void { for (let i = this._running.length - 1; i >= 0; i--) { this._running[i].stop(); } }
/** * Stop all running tweens. */
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/tweening/TweenManager.ts#L102-L106
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
TweenManager.stopAllByTag
public static stopAllByTag(tag: string): void { for (let i = this._running.length - 1; i >= 0; i--) { if (this._running[i].tween.tags.indexOf(tag) > -1) { this._running[i].stop(); } } }
/** * Stop all running tweens with a specific tag. * @param tag - The tag to filter running tweens. */
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/tweening/TweenManager.ts#L112-L118
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
TweenManager.completeAll
public static completeAll(): void { for (let i = this._running.length - 1; i >= 0; i--) { this._running[i].complete(); } }
/** * Complete all running tweens. */
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/tweening/TweenManager.ts#L123-L127
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
TweenManager.completeAllByTag
public static completeAllByTag(tag: string): void { for (let i = this._running.length - 1; i >= 0; i--) { if (this._running[i].tween.tags.indexOf(tag) > -1) { this._running[i].complete(); } } }
/** * Complete all running tweens with a specific tag. * @param tag - The tag to filter running tweens. */
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/tweening/TweenManager.ts#L133-L139
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
Asset.getLoader
public static getLoader<T extends Loader>(loaderType: new () => T): T { if (!this._loaders.has(loaderType)) { this._loaders.set(loaderType, new loaderType()); } return this._loaders.get(loaderType) as T; }
/** * Get a specific loader based on the resource type. * @param loaderType The desired loader type. * @returns The loader associated with the resource type. */
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/utils/Asset.ts#L94-L99
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
Asset.load
public static load<T>(loaderType: typeof Loader<any>, path: string, onProgress?: (event: ProgressEvent) => void, onError?: (error: unknown) => void): Promise<T> { return new Promise<T>((resolve) => { if (this._results[path]) return resolve(this._results[path]); const loader = this.getLoader(loaderType);...
/** * Load a resource using a specified loader type and path. * @param loaderType The type of loader to use for loading the resource. * @param path The path to the resource to be loaded. * @param onProgress (optional) A callback function to report loading progress with a ProgressEvent. * @returns A Promi...
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/utils/Asset.ts#L108-L120
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
Asset.preload
public static preload(loader: typeof Loader<any>, ...paths: (string | ResourceConfig)[]): void { this._pending.push({ loader, paths }); }
/** * Preload resources for future use. * @param loader The loader type to be used for preloading. * @param paths An array of resource paths or configurations to preload. */
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/utils/Asset.ts#L127-L129
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
Asset.preloadAllPending
public static preloadAllPending(config: LoadingConfig = {}): Promise<void[]> { const promise = this.loadAll(config, ...this._pending); this._pending = []; return promise; }
/** * Preload all pending resources and return a promise that resolves when all resources are loaded. * @param config Optional configuration for the loading process. * @returns A promise that resolves when all pending resources are loaded. */
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/utils/Asset.ts#L136-L140
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
Asset.loadAll
public static loadAll(config: LoadingConfig = {}, ...resources: Resource[]): Promise<void[]> { const promises: Promise<void>[] = []; config.onProgress ??= this.onProgress; config.onError ??= this.onError; config.total = 0; config.progress = 0; for (const resource of resources) { this.load...
/** * Load all specified resources and return a promise that resolves when all resources are loaded. * @param config Configuration for the loading process. * @param resources An array of resource objects to load. * @returns A promise that resolves when all resources are loaded. */
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/utils/Asset.ts#L148-L160
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
IntersectionUtils.line_line_2D
public static line_line_2D(a1: VectorObject3D, a2: VectorObject3D, b1: VectorObject3D, b2: VectorObject3D, target = new Vector3()): Vector3 { const [a1c, a2c, b1c, b2c] = VectorUtils.getPositionsFromObject3D([a1, a2, b1, b2]); const denominator = (b2c.y - b1c.y) * (a2c.x - a1c.x) - (b2c.x - b1c.x) * (a2c.y - a1...
/** * Computes the intersection between two 2D lines defined by points `a1` and `a2`, and `b1` and `b2`. * * @param a1 - The first point of the first line. * @param a2 - The second point of the first line. * @param b1 - The first point of the second line. * @param b2 - The second point of ...
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/utils/IntersectionUtils.ts#L21-L27
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
IntersectionUtils.segment_segment_2D
public static segment_segment_2D(a1: VectorObject3D, a2: VectorObject3D, b1: VectorObject3D, b2: VectorObject3D, target = new Vector3()): Vector3 { const [a1c, a2c, b1c, b2c] = VectorUtils.getPositionsFromObject3D([a1, a2, b1, b2]); const denominator = (b2c.y - b1c.y) * (a2c.x - a1c.x) - (b2c.x - b1c.x) * (a2c....
/** * Computes the intersection between two 2D line segments defined by points `a1` and `a2`, and `b1` and `b2`. * * @param a1 - The first point of the first segment. * @param a2 - The second point of the first segment. * @param b1 - The first point of the second segment. * @param b2 - The...
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/utils/IntersectionUtils.ts#L41-L49
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
IntersectionUtils.line_line_3D
public static line_line_3D(a1: ObjVec3, a2: ObjVec3, b1: ObjVec3, b2: ObjVec3, target = new Vector3(), tolerance = 10 ** -6): Vector3 { const [p1c, p2c, p3c, p4c] = VectorUtils.getPositionsFromObject3D([a1, a2, b1, b2]); const p13 = TEMP[0].subVectors(p1c, p3c); const p43 = TEMP[1].subVectors(p4c, p3c); ...
/** * Computes the intersection between two 3D lines defined by points `a1` and `a2`, and `b1` and `b2`. * * @param a1 - The first point of the first line. * @param a2 - The second point of the first line. * @param b1 - The first point of the second line. * @param b2 - The second point of ...
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/utils/IntersectionUtils.ts#L64-L92
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
IntersectionUtils.line_boxAABB
public static line_boxAABB(rayOrigin: Vector3, rayDir: Vector3, box: Box3): boolean { const invdirx = 1 / rayDir.x, invdiry = 1 / rayDir.y, invdirz = 1 / rayDir.z; let tmin = 0, tmax = Infinity, bmin: number, bmax: number, dmin: number, dmax: number; if (invdirx >= 0) { bmin = box.min.x; bmax =...
/** * Checks if a 3D line intersects an Axis-Aligned Bounding Box (AABB) defined by `box`. * * @param rayOrigin - The origin of the line. * @param rayDir - The direction of the line. * @param box - The AABB to check for intersection with. * @returns `true` if the line intersects the AABB, ...
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/utils/IntersectionUtils.ts#L102-L149
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
IntersectionUtils.segment_boxAABB
public static segment_boxAABB(p1: Vector3, p2: Vector3, box: Box3): boolean { const rayDir = TEMP[0].subVectors(p2, p1).normalize(); const distance = p1.distanceTo(p2); const invdirx = 1 / rayDir.x, invdiry = 1 / rayDir.y, invdirz = 1 / rayDir.z; let tmin = 0, tmax = Infinity, bmin: number, bmax: number...
/** * Checks if a 3D line segment defined by points `p1` and `p2` intersects an Axis-Aligned Bounding Box (AABB) defined by `box`. * * @param p1 - The first point of the segment. * @param p2 - The second point of the segment. * @param box - The AABB to check for intersection with. * @retur...
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/utils/IntersectionUtils.ts#L159-L208
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
TextPanel.constructor
constructor(private readonly name: string, private readonly properties: string[], private readonly fg: string, private readonly bg: string, private readonly updateTime: number) { this.dom = document.createElement('canvas'); this.dom.width = this.WIDTH; this.dom.height = this.HEIGHT; this.dom.style.cssTe...
// TODO: need to generalize call and triangles in props
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/utils/Stats.ts#L232-L252
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
TextPanel._formatNumber
private _formatNumber(input: number): string { if (input >= 1e9) { return (input / 1e9).toFixed(2) + 'ʙ'; } else if (input >= 1e6) { return (input / 1e6).toFixed(2) + 'ᴍ'; } else if (input >= 1e3) { return (input / 1e3).toFixed(2) + 'ᴋ'; } else { return input.toString(); } ...
/** * Adds a suffix (B for billion, M for million, K for thousand) to a large number. * @param {number} input - The numeric value to foment. * @return {string} The number formatted with an appropriate suffix. */
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/utils/Stats.ts#L331-L341
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
Utils.getSceneIntersection
public static getSceneIntersection(ray: Ray, camera: Camera, distance: number): Vector3 { this._plane.setFromNormalAndCoplanarPoint(camera.getWorldDirection(this._plane.normal), camera.getWorldPosition(this._temp)); this._plane.translate(this._temp.copy(this._plane.normal).setLength(distance)); return ray.i...
/** * Calculates the intersection point of a ray with a plane in world coordinates. * @param ray - The ray to intersect with the plane. * @param camera - The camera used as a reference for the plane's orientation. * @param distance - The distance from the camera to the plane. * @returns The intersection ...
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/utils/Utils.ts#L23-L27
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
Utils.setChildrenDragTarget
public static setChildrenDragTarget(target: Object3D, dragTarget: Object3D): void { target.traverse((obj) => { obj.draggable = true; obj.dragTarget = dragTarget; }); }
/** * Set for all children of the target, the draggable flag to true and a dragTarget. * @param target - The Object3D whose children you want to enable as draggable elements. * @param dragTarget - The Object3D that will act as the drag target for the children. */
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/utils/Utils.ts#L34-L39
7da9727b605f49314016a99561b8d797ca0519b6
three.ez
github_2023
agargaro
typescript
Utils.computeBoundingSphereChildren
public static computeBoundingSphereChildren(target: Object3D): void { target.traverse((obj) => { obj.updateMatrixWorld(); if ((obj as SkinnedMesh).computeBoundingSphere) { (obj as SkinnedMesh).computeBoundingSphere(); } }); }
/** * Computes bounding spheres for child objects within the specified Object3D hierarchy. * @param target - The root Object3D from which to start computing bounding spheres for children. */
https://github.com/agargaro/three.ez/blob/7da9727b605f49314016a99561b8d797ca0519b6/src/utils/Utils.ts#L45-L52
7da9727b605f49314016a99561b8d797ca0519b6