You've already forked Nitro_Render_V3
mirror of
https://github.com/duckietm/Nitro_Render_V3.git
synced 2026-06-19 15:06:20 +00:00
Merge remote-tracking branch 'origin/main'
This commit is contained in:
@@ -293,6 +293,13 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener
|
|||||||
clear: true
|
clear: true
|
||||||
});
|
});
|
||||||
|
|
||||||
|
for(const child of container.children)
|
||||||
|
{
|
||||||
|
child.removeChildren();
|
||||||
|
}
|
||||||
|
|
||||||
|
container.destroy({ children: true });
|
||||||
|
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
this._activeTexture.source.hitMap = null;
|
this._activeTexture.source.hitMap = null;
|
||||||
|
|
||||||
|
|||||||
@@ -117,12 +117,7 @@ export class RoomCameraWidgetManager implements IRoomCameraWidgetManager
|
|||||||
|
|
||||||
TextureUtils.writeToTexture(container, renderTexture);
|
TextureUtils.writeToTexture(container, renderTexture);
|
||||||
|
|
||||||
const image = await TextureUtils.generateImage(renderTexture);
|
return await TextureUtils.generateImage(renderTexture);
|
||||||
|
|
||||||
container.destroy({ children: true });
|
|
||||||
renderTexture.destroy(true);
|
|
||||||
|
|
||||||
return image;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public get effects(): Map<string, IRoomCameraWidgetEffect>
|
public get effects(): Map<string, IRoomCameraWidgetEffect>
|
||||||
|
|||||||
@@ -110,6 +110,12 @@ export class RoomMessageHandler
|
|||||||
this._latestEntryTileEvent = null;
|
this._latestEntryTileEvent = null;
|
||||||
this._activeWiredUserMovements.clear();
|
this._activeWiredUserMovements.clear();
|
||||||
this._activeRoomUserWalks.clear();
|
this._activeRoomUserWalks.clear();
|
||||||
|
|
||||||
|
if(this._planeParser)
|
||||||
|
{
|
||||||
|
this._planeParser.dispose();
|
||||||
|
this._planeParser = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public setRoomId(id: number): void
|
public setRoomId(id: number): void
|
||||||
|
|||||||
@@ -1101,14 +1101,19 @@ export class AvatarVisualization extends RoomObjectSpriteVisualization implement
|
|||||||
|
|
||||||
if(oppositeDirection !== currentDirection)
|
if(oppositeDirection !== currentDirection)
|
||||||
{
|
{
|
||||||
const highlightEnabled = ((this.object.model.getValue<number>(RoomObjectVariable.FIGURE_HIGHLIGHT_ENABLE) === 1) && (this.object.model.getValue<number>(RoomObjectVariable.FIGURE_HIGHLIGHT) === 1));
|
// Reuse the cached opposite texture if direction and base texture haven't changed
|
||||||
|
if(this._reflectionOppositeTexture && (this._reflectionOppositeDirection === currentDirection) && (this._reflectionOppositeBaseTexture === sprite.texture))
|
||||||
this._avatarImage.setDirection(AvatarSetType.FULL, oppositeDirection);
|
|
||||||
|
|
||||||
const renderedOpposite = (this._avatarImage.processAsTexture(AvatarSetType.FULL, highlightEnabled) || sprite.texture);
|
|
||||||
|
|
||||||
if((this._reflectionOppositeDirection !== currentDirection) || (this._reflectionOppositeBaseTexture !== sprite.texture) || !this._reflectionOppositeTexture)
|
|
||||||
{
|
{
|
||||||
|
oppositeTexture = this._reflectionOppositeTexture;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const highlightEnabled = ((this.object.model.getValue<number>(RoomObjectVariable.FIGURE_HIGHLIGHT_ENABLE) === 1) && (this.object.model.getValue<number>(RoomObjectVariable.FIGURE_HIGHLIGHT) === 1));
|
||||||
|
|
||||||
|
this._avatarImage.setDirection(AvatarSetType.FULL, oppositeDirection);
|
||||||
|
|
||||||
|
const renderedOpposite = (this._avatarImage.processAsTexture(AvatarSetType.FULL, highlightEnabled) || sprite.texture);
|
||||||
|
|
||||||
if(this._reflectionOppositeTexture)
|
if(this._reflectionOppositeTexture)
|
||||||
{
|
{
|
||||||
this._reflectionOppositeTexture.destroy(true);
|
this._reflectionOppositeTexture.destroy(true);
|
||||||
@@ -1118,15 +1123,15 @@ export class AvatarVisualization extends RoomObjectSpriteVisualization implement
|
|||||||
this._reflectionOppositeTexture = this.cloneTexture(renderedOpposite);
|
this._reflectionOppositeTexture = this.cloneTexture(renderedOpposite);
|
||||||
this._reflectionOppositeDirection = currentDirection;
|
this._reflectionOppositeDirection = currentDirection;
|
||||||
this._reflectionOppositeBaseTexture = sprite.texture;
|
this._reflectionOppositeBaseTexture = sprite.texture;
|
||||||
|
|
||||||
|
oppositeTexture = (this._reflectionOppositeTexture || renderedOpposite);
|
||||||
|
|
||||||
|
// Restore the live avatar direction and refresh the current texture so
|
||||||
|
// movement updates do not keep showing the opposite-facing texture.
|
||||||
|
this._avatarImage.setDirection(AvatarSetType.FULL, currentDirection);
|
||||||
|
|
||||||
|
sprite.texture = (this._avatarImage.processAsTexture(AvatarSetType.FULL, highlightEnabled) || sprite.texture);
|
||||||
}
|
}
|
||||||
|
|
||||||
oppositeTexture = (this._reflectionOppositeTexture || renderedOpposite);
|
|
||||||
|
|
||||||
// Restore the live avatar direction and refresh the current texture so
|
|
||||||
// movement updates do not keep showing the opposite-facing texture.
|
|
||||||
this._avatarImage.setDirection(AvatarSetType.FULL, currentDirection);
|
|
||||||
|
|
||||||
sprite.texture = (this._avatarImage.processAsTexture(AvatarSetType.FULL, highlightEnabled) || sprite.texture);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -105,6 +105,7 @@ export class IsometricImageFurniVisualization extends FurnitureAnimatedVisualiza
|
|||||||
const sprite = this.getSprite(layerId);
|
const sprite = this.getSprite(layerId);
|
||||||
if (sprite) {
|
if (sprite) {
|
||||||
sprite.texture = this._thumbnailTexture;
|
sprite.texture = this._thumbnailTexture;
|
||||||
|
sprite.offsetY -= 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -741,6 +741,7 @@ export class RoomPlane implements IRoomPlane
|
|||||||
});
|
});
|
||||||
|
|
||||||
animationCanvas.destroy(true);
|
animationCanvas.destroy(true);
|
||||||
|
animContainer.destroy({ children: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
private renderLandscapeLayer(texture: Texture, tint: number, alignBottom: boolean): void
|
private renderLandscapeLayer(texture: Texture, tint: number, alignBottom: boolean): void
|
||||||
@@ -798,7 +799,7 @@ export class RoomPlane implements IRoomPlane
|
|||||||
clear: false
|
clear: false
|
||||||
});
|
});
|
||||||
|
|
||||||
layerSprite.destroy();
|
layerContainer.destroy({ children: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
private renderBackgroundColor(): void
|
private renderBackgroundColor(): void
|
||||||
@@ -826,7 +827,7 @@ export class RoomPlane implements IRoomPlane
|
|||||||
clear: true
|
clear: true
|
||||||
});
|
});
|
||||||
|
|
||||||
colorGraphics.destroy();
|
colorContainer.destroy({ children: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
private clearPlaneTexture(): void
|
private clearPlaneTexture(): void
|
||||||
@@ -838,12 +839,16 @@ export class RoomPlane implements IRoomPlane
|
|||||||
|
|
||||||
if(canvasWidth <= 0 || canvasHeight <= 0)
|
if(canvasWidth <= 0 || canvasHeight <= 0)
|
||||||
{
|
{
|
||||||
|
const emptyContainer = new Container();
|
||||||
|
|
||||||
GetRenderer().render({
|
GetRenderer().render({
|
||||||
target: this._planeTexture,
|
target: this._planeTexture,
|
||||||
container: new Container(),
|
container: emptyContainer,
|
||||||
clear: true
|
clear: true
|
||||||
});
|
});
|
||||||
|
|
||||||
|
emptyContainer.destroy();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -863,7 +868,7 @@ export class RoomPlane implements IRoomPlane
|
|||||||
clear: true
|
clear: true
|
||||||
});
|
});
|
||||||
|
|
||||||
colorGraphics.destroy();
|
colorContainer.destroy({ children: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
private renderWindowReflections(): void
|
private renderWindowReflections(): void
|
||||||
|
|||||||
+1
@@ -154,5 +154,6 @@ export class PlaneVisualizationAnimationLayer
|
|||||||
const sprite = new Sprite(item.bitmapData.texture);
|
const sprite = new Sprite(item.bitmapData.texture);
|
||||||
sprite.position.set(x, y);
|
sprite.position.set(x, y);
|
||||||
TextureUtils.writeToTexture(sprite, canvas, false);
|
TextureUtils.writeToTexture(sprite, canvas, false);
|
||||||
|
sprite.destroy();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,7 +39,44 @@ export class RoomInstanceData
|
|||||||
|
|
||||||
public dispose(): void
|
public dispose(): void
|
||||||
{
|
{
|
||||||
return;
|
if(this._selectedObject)
|
||||||
|
{
|
||||||
|
this._selectedObject.dispose();
|
||||||
|
this._selectedObject = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(this._placedObject)
|
||||||
|
{
|
||||||
|
this._placedObject.dispose();
|
||||||
|
this._placedObject = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(this._furnitureStackingHeightMap)
|
||||||
|
{
|
||||||
|
this._furnitureStackingHeightMap.dispose();
|
||||||
|
this._furnitureStackingHeightMap = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(this._tileObjectMap)
|
||||||
|
{
|
||||||
|
this._tileObjectMap.dispose();
|
||||||
|
this._tileObjectMap = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(this._legacyGeometry)
|
||||||
|
{
|
||||||
|
this._legacyGeometry = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(this._roomCamera)
|
||||||
|
{
|
||||||
|
this._roomCamera = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
this._floorStack.clear();
|
||||||
|
this._wallStack.clear();
|
||||||
|
this._mouseButtonCursorOwners = [];
|
||||||
|
this._modelName = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public setModelName(name: string): void
|
public setModelName(name: string): void
|
||||||
|
|||||||
@@ -3,7 +3,8 @@ import { Texture } from 'pixi.js';
|
|||||||
|
|
||||||
export class TexturePool
|
export class TexturePool
|
||||||
{
|
{
|
||||||
private static MAX_IDLE: number = 3600;
|
private static MAX_IDLE: number = 1800;
|
||||||
|
private static MAX_POOL_SIZE: number = 200;
|
||||||
|
|
||||||
private _textures: { [index: string]: { [index: string]: Texture[] } } = {};
|
private _textures: { [index: string]: { [index: string]: Texture[] } } = {};
|
||||||
private _totalTextures: number = 0;
|
private _totalTextures: number = 0;
|
||||||
@@ -51,6 +52,16 @@ export class TexturePool
|
|||||||
{
|
{
|
||||||
if(!texture) return;
|
if(!texture) return;
|
||||||
|
|
||||||
|
if(this._totalTextures >= TexturePool.MAX_POOL_SIZE)
|
||||||
|
{
|
||||||
|
//@ts-ignore
|
||||||
|
delete texture.source.hitMap;
|
||||||
|
|
||||||
|
if(!texture.destroyed) texture.destroy(true);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if(!this._textures[texture.width]) this._textures[texture.width] = {};
|
if(!this._textures[texture.width]) this._textures[texture.width] = {};
|
||||||
|
|
||||||
if(!this._textures[texture.width][texture.height]) this._textures[texture.width][texture.height] = [];
|
if(!this._textures[texture.width][texture.height]) this._textures[texture.width][texture.height] = [];
|
||||||
|
|||||||
Reference in New Issue
Block a user