perf(graphics-3d): worldToScreen and the render getter allocate on every call

Abierto
#506 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
68/100
Tipo de issue
Refactorización
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
typescript

Línea de trabajo

Start with modules/graphics-3d/src/graphics-3d.library.ts at the two cited locations, then read nearby callers to check how worldToScreen results and the render getter are used. The issue proposes a scratch Vector3, a cached default render closure, and an optional output parameter. Confirm the intended API behavior with existing tests or callers, then verify repeated calls avoid the reported allocations and layout reads while preserving results.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

enhancement modules:graphics-3d
Which package or utils is this feature request for?

graphics-3d

Feature

Each worldToScreen call clones a Vector3, returns a new object and calls getBoundingClientRect(), which can force a layout. The render getter returns a new closure on each access. This matters when called per frame for many entities (HUD labels).

Where:

Evidence:

return this._customRender ?? (() => this._drawDefault());
const ndc = point.clone().project(this.camera);
Ideal solution or implementation

Use a scratch Vector3, cache the default render closure, and take an optional out parameter.

Alternative solutions or implementations

No response

Other context

Found during a code audit of main at be72076.

Lenguaje dominante
TypeScript
Estrellas
7
Forks
2
Merge medio
1 d 17 h
PR fusionados (30 d)
17

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de NanoForge-dev/Engine

Todos los issues de NanoForge-dev/Engine

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.