Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# IDE
.idea
*.sw*
.claude

# OS
.DS_Store
Expand Down
2 changes: 0 additions & 2 deletions packages/melonjs/src/camera/camera2d.js
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,6 @@ export default class Camera2d extends Renderable {
* @returns {Vector2d}
*/
localToWorld(x, y, v) {
// TODO memoization for one set of coords (multitouch)
v = v || vector2dPool.get();
v.set(x, y).add(this.pos).sub(game.world.pos);
if (!this.currentTransform.isIdentity()) {
Expand All @@ -604,7 +603,6 @@ export default class Camera2d extends Renderable {
* @returns {Vector2d} a vector with the converted local coordinates
*/
worldToLocal(x, y, v) {
// TODO memoization for one set of coords (multitouch)
v = v || vector2dPool.get();
v.set(x, y);
if (!this.currentTransform.isIdentity()) {
Expand Down
4 changes: 2 additions & 2 deletions packages/melonjs/src/level/tiled/TMXTileMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -454,8 +454,8 @@ export default class TMXTileMap {
settings.tint.parseHex(settings.tintcolor, true);
}

/// XXX Clean/rewrite all this part to remove object
/// specific instantiation logic/details from here
// TODO: clean/rewrite this part to remove object-specific
// instantiation logic from here (see getObjects refactoring plan)

// groups can contains either text, objects or layers
if (settings instanceof TMXLayer) {
Expand Down
16 changes: 0 additions & 16 deletions packages/melonjs/src/math/color.ts
Original file line number Diff line number Diff line change
Expand Up @@ -561,8 +561,6 @@ export class Color {
* @returns Reference to this object for method chaining
*/
parseRGB(rgbColor: string) {
// TODO : Memoize this function by caching its input

const match = rgbaRx.exec(rgbColor);
if (!match) {
return this.parseHex(rgbColor as `#${string}`);
Expand All @@ -583,8 +581,6 @@ export class Color {
* @returns Reference to this object for method chaining
*/
parseHex(hexColor: `#${string}`, argb = false) {
// TODO : Memoize this function by caching its input

let match: RegExpExecArray | null;
if ((match = hex8Rx.exec(hexColor))) {
// #AARRGGBB or #RRGGBBAA
Expand Down Expand Up @@ -663,9 +659,6 @@ export class Color {
* @returns The color in "#RRGGBB" format
*/
toHex() {
// TODO : Memoize this function by caching its result until any of
// the r,g,b,a values are changed

return `#${toHex(this.r)}${toHex(this.g)}${toHex(this.b)}`;
}

Expand All @@ -675,9 +668,6 @@ export class Color {
* @returns The color in "#RRGGBBAA" format
*/
toHex8(alpha = this.alpha) {
// TODO : Memoize this function by caching its result until any of
// the r,g,b,a values are changed

return `#${toHex(this.r)}${toHex(this.g)}${toHex(this.b)}${toHex(alpha * 255)}`;
}

Expand All @@ -686,9 +676,6 @@ export class Color {
* @returns The color in "rgb(R,G,B)" format
*/
toRGB() {
// TODO : Memoize this function by caching its result until any of
// the r,g,b,a values are changed

return `rgb(${this.r},${this.g},${this.b})` as const;
}

Expand All @@ -698,9 +685,6 @@ export class Color {
* @returns The color in "rgba(R,G,B,A)" format
*/
toRGBA(alpha = this.alpha) {
// TODO : Memoize this function by caching its result until any of
// the r,g,b,a values are changed

return `rgba(${this.r},${this.g},${this.b},${alpha})` as const;
}
}
Expand Down
5 changes: 2 additions & 3 deletions packages/melonjs/src/math/observableVector3d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -393,10 +393,10 @@ export class ObservableVector3d {
/**
* Rotate this vector (counter-clockwise) by the specified angle (in radians) around the z axis
* @param angle - The angle to rotate (in radians)
* @param [v] - an optional point to rotate around (on the same z axis)
* @param [v] - an optional point to rotate around
* @returns Reference to this object for method chaining
*/
rotate(angle: number, v?: Vector2d | Point) {
rotate(angle: number, v?: Vector2d | Point | Vector3d) {
let cx = 0;
let cy = 0;

Expand All @@ -405,7 +405,6 @@ export class ObservableVector3d {
cy = v.y;
}

// TODO also rotate on the z axis if the given vector is a 3d one
const x = this.x - cx;
const y = this.y - cy;

Expand Down
5 changes: 2 additions & 3 deletions packages/melonjs/src/math/vector3d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -308,10 +308,10 @@ export class Vector3d {
/**
* Rotate this vector (counter-clockwise) by the specified angle (in radians) around the z axis
* @param angle - The angle to rotate (in radians)
* @param [v] - an optional point to rotate around (on the same z axis)
* @param [v] - an optional point to rotate around
* @returns Reference to this object for method chaining
*/
rotate(angle: number, v?: XYPoint) {
rotate(angle: number, v?: XYPoint | Vector3d) {
let cx = 0;
let cy = 0;

Expand All @@ -320,7 +320,6 @@ export class Vector3d {
cy = v.y;
}

// TODO also rotate on the z axis if the given vector is a 3d one
const x = this.x - cx;
const y = this.y - cy;

Expand Down
2 changes: 0 additions & 2 deletions packages/melonjs/src/renderable/container.js
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,6 @@ export default class Container extends Renderable {
// if the child is a container
if (child instanceof Container) {
// add all container child bodies
// TODO: make it recursive ?
child.forEach((cchild) => {
if (cchild.body instanceof Body) {
worldContainer.addBody(cchild.body);
Expand Down Expand Up @@ -342,7 +341,6 @@ export default class Container extends Renderable {
// if the child is a container
if (child instanceof Container) {
// add all container child bodies
// TODO: make it recursive ?
child.forEach((cchild) => {
if (cchild.body instanceof Body) {
worldContainer.addBody(cchild.body);
Expand Down
2 changes: 1 addition & 1 deletion packages/melonjs/src/renderable/draggable.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export class Draggable extends Renderable {
*/
dragMove(e) {
if (this.dragging === true) {
this.pos.set(e.gameX, e.gameY, this.pos.z); //TODO : z ?
this.pos.set(e.gameX, e.gameY, this.pos.z);
this.pos.sub(this.grabOffset);
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/melonjs/src/renderable/renderable.js
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@ export default class Renderable extends Rect {
if (typeof this._absPos === "undefined") {
this._absPos = vector2dPool.get();
}
// XXX Cache me or something
// TODO: cache the absolute position and invalidate when pos or ancestor changes
this._absPos.set(this.pos.x, this.pos.y);
if (
typeof this.ancestor !== "undefined" &&
Expand Down
2 changes: 1 addition & 1 deletion packages/melonjs/src/renderable/sprite.js
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ export default class Sprite extends Renderable {
const frameObjectName = frameObject.name;
if (typeof frameObjectName === "number") {
if (typeof this.textureAtlas[frameObjectName] !== "undefined") {
// TODO: adding the cache source coordinates add undefined entries in webGL mode
// see https://github.com/melonjs/melonJS/issues/1281
this.anim[name].frames[i] = Object.assign(
{},
this.textureAtlas[frameObjectName],
Expand Down
3 changes: 2 additions & 1 deletion packages/melonjs/src/renderable/text/text.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,8 @@ export default class Text extends Renderable {
}

// the canvas Texture used to render this text
// XXX: offscreenCanvas is currently disabled for text rendering due to issue in WebGL mode
// offscreenCanvas is currently disabled for text rendering due to issue in WebGL mode
// see https://github.com/melonjs/melonJS/issues/1180
this.canvasTexture = new CanvasRenderTarget(2, 2, {
offscreenCanvas: false,
});
Expand Down
6 changes: 3 additions & 3 deletions packages/melonjs/src/video/texture/atlas.js
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ export class TextureAtlas {
* @returns {object} the created region
*/
addRegion(name, x, y, w, h) {
// TODO: Require proper atlas regions instead of caching arbitrary region keys
// see https://github.com/melonjs/melonJS/issues/1281
if (renderer.settings.verbose === true) {
console.warn("Adding texture region", name, "for texture", this);
}
Expand Down Expand Up @@ -367,7 +367,7 @@ export class TextureAtlas {
let region = this.getRegion(name);

if (typeof region === "undefined") {
// TODO: Require proper atlas regions instead of caching arbitrary region keys
// see https://github.com/melonjs/melonJS/issues/1281
const keys = name.split(",");
region = this.addRegion(name, +keys[0], +keys[1], +keys[2], +keys[3]);
}
Expand Down Expand Up @@ -397,7 +397,7 @@ export class TextureAtlas {
(s.y + sh) / h, // v1 (bottom)
]);
// Cache source coordinates
// TODO: Remove this when the Batcher only accepts a region name
// see https://github.com/melonjs/melonJS/issues/1281
const key = s.x + "," + s.y + "," + w + "," + h;
atlas[key] = atlas[name];
}
Expand Down
2 changes: 1 addition & 1 deletion packages/melonjs/src/video/texture/cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class TextureCache {
}

// No units available
// TODO: Merge textures instead of throwing an exception
// see https://github.com/melonjs/melonJS/issues/1280
throw new Error(
"Texture cache overflow: " +
this.max_size +
Expand Down
4 changes: 2 additions & 2 deletions packages/melonjs/src/video/webgl/webgl_renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ export default class WebGLRenderer extends Renderer {
image,
);

// FIXME: Remove old cache entry and texture when changing the repeat mode
// see https://github.com/melonjs/melonJS/issues/1278
this.currentCompositor.uploadTexture(texture);

return texture;
Expand Down Expand Up @@ -843,7 +843,7 @@ export default class WebGLRenderer extends Renderer {
*/
setAntiAlias(enable = false) {
super.setAntiAlias(enable);
// TODO: perhaps handle GLNEAREST or other options with texture binding
// see https://github.com/melonjs/melonJS/issues/1279
}

/**
Expand Down
Loading