You've already forked Nitro_Render_V3
mirror of
https://github.com/duckietm/Nitro_Render_V3.git
synced 2026-06-20 07:26:18 +00:00
🆙 the latest updates to Renderer
This commit is contained in:
@@ -356,16 +356,19 @@ export class RoomEngine implements IRoomEngine, IRoomCreator, IRoomEngineService
|
||||
if(roomCanvas) roomCanvas.setMask(flag);
|
||||
}
|
||||
|
||||
public setRoomInstanceRenderingCanvasScale(roomId: number, canvasId: number, scale: number, point: Point = null, offsetPoint: Point = null, override: boolean = false, asDelta: boolean = false): void
|
||||
public setRoomInstanceRenderingCanvasScale(roomId: number, canvasId: number, level: number, point: Point = null, offsetPoint: Point = null, isFlipForced: boolean = false, flag: boolean = false): void
|
||||
{
|
||||
if(!GetConfiguration().getValue('room.zoom.enabled', true)) return;
|
||||
|
||||
if(!flag) level = ((isFlipForced) ? -1 : ((level) < 1) ? 0.5 : Math.floor(level));
|
||||
|
||||
const roomCanvas = this.getRoomInstanceRenderingCanvas(roomId, canvasId);
|
||||
|
||||
if(roomCanvas)
|
||||
{
|
||||
roomCanvas.setScale(scale, point, offsetPoint, override, asDelta);
|
||||
if(!roomCanvas) return;
|
||||
|
||||
GetEventDispatcher().dispatchEvent(new RoomEngineEvent(RoomEngineEvent.ROOM_ZOOMED, roomId));
|
||||
}
|
||||
roomCanvas.setScale(level, point, offsetPoint, isFlipForced);
|
||||
|
||||
GetEventDispatcher().dispatchEvent(new RoomEngineEvent(RoomEngineEvent.ROOM_ZOOMED, roomId));
|
||||
}
|
||||
|
||||
public getRoomInstanceRenderingCanvas(roomId: number, canvasId: number = -1): IRoomRenderingCanvas
|
||||
|
||||
+2
-1
@@ -73,7 +73,8 @@ export class FurnitureGuildIsometricBadgeVisualization extends IsometricImageFur
|
||||
|
||||
sprite.setFromMatrix(matrix);
|
||||
|
||||
sprite.position.set(0);
|
||||
sprite.x = 0;
|
||||
sprite.y = 0;
|
||||
|
||||
return TextureUtils.generateTexture(sprite);
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { IAssetData, IAssetVisualizationData, IObjectVisualizationData } from '@nitrots/api';
|
||||
import { BLEND_MODES } from 'pixi.js';
|
||||
import { RoomGeometry } from '../../../utils';
|
||||
import { ColorData, LayerData, SizeData } from '../data';
|
||||
|
||||
export class FurnitureVisualizationData implements IObjectVisualizationData
|
||||
@@ -105,11 +106,33 @@ export class FurnitureVisualizationData implements IObjectVisualizationData
|
||||
this._sizes.push(size);
|
||||
}
|
||||
|
||||
this.removeInvalidSizes();
|
||||
|
||||
this._sizes.sort();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private removeInvalidSizes(): void
|
||||
{
|
||||
if(!this._sizes || !this._sizes.length) return;
|
||||
|
||||
const zoomedIn = this._sizeDatas.get(RoomGeometry.SCALE_ZOOMED_IN);
|
||||
const zoomedOut = this._sizeDatas.get(RoomGeometry.SCALE_ZOOMED_OUT);
|
||||
|
||||
if(zoomedIn && zoomedOut)
|
||||
{
|
||||
if(zoomedIn.layerCount !== zoomedOut.layerCount)
|
||||
{
|
||||
this._sizeDatas.delete(RoomGeometry.SCALE_ZOOMED_OUT);
|
||||
|
||||
const index = this._sizes.indexOf(RoomGeometry.SCALE_ZOOMED_OUT);
|
||||
|
||||
if(index >= 0) this._sizes.splice(index, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected processVisualElement(sizeData: SizeData, key: string, data: any): boolean
|
||||
{
|
||||
if(!sizeData || !key || !data) return false;
|
||||
|
||||
+2
-1
@@ -105,7 +105,8 @@ export class IsometricImageFurniVisualization extends FurnitureAnimatedVisualiza
|
||||
const offsetX = ((background.width - sprite.width) / 2);
|
||||
const offsetY = ((background.height - sprite.height) / 2);
|
||||
|
||||
sprite.position.set(offsetX, offsetY);
|
||||
sprite.x = Math.floor(offsetX);
|
||||
sprite.y = Math.floor(offsetY);
|
||||
|
||||
container.addChild(background, sprite);
|
||||
|
||||
|
||||
@@ -12,7 +12,10 @@ export class RoomPlane implements IRoomPlane
|
||||
{
|
||||
public static HORIZONTAL_ANGLE_DEFAULT: number = 45;
|
||||
public static VERTICAL_ANGLE_DEFAULT: number = 30;
|
||||
public static PLANE_GEOMETRY: IRoomGeometry = new RoomGeometry(64, new Vector3d(RoomPlane.HORIZONTAL_ANGLE_DEFAULT, RoomPlane.VERTICAL_ANGLE_DEFAULT), new Vector3d(-10, 0, 0));
|
||||
public static PLANE_GEOMETRY: { [index: number]: IRoomGeometry } = {
|
||||
'32': new RoomGeometry(32, new Vector3d(RoomPlane.HORIZONTAL_ANGLE_DEFAULT, RoomPlane.VERTICAL_ANGLE_DEFAULT), new Vector3d(-10, 0, 0)),
|
||||
'64': new RoomGeometry(64, new Vector3d(RoomPlane.HORIZONTAL_ANGLE_DEFAULT, RoomPlane.VERTICAL_ANGLE_DEFAULT), new Vector3d(-10, 0, 0))
|
||||
};
|
||||
private static LANDSCAPE_COLOR: number = 0x0082F0;
|
||||
|
||||
public static TYPE_UNDEFINED: number = 0;
|
||||
@@ -195,6 +198,7 @@ export class RoomPlane implements IRoomPlane
|
||||
|
||||
Randomizer.setSeed(this._randomSeed);
|
||||
|
||||
const planeGeometry = RoomPlane.PLANE_GEOMETRY[geometry.scale];
|
||||
let width = (this._leftSide.length * geometry.scale);
|
||||
let height = (this._rightSide.length * geometry.scale);
|
||||
const normal = geometry.getCoordinatePosition(this._normal);
|
||||
@@ -206,7 +210,7 @@ export class RoomPlane implements IRoomPlane
|
||||
const roomCollection = GetAssetManager().getCollection('room');
|
||||
const planeVisualizationData = roomCollection?.data?.roomVisualization?.[dataType];
|
||||
const plane = planeVisualizationData?.planes?.find(plane => (plane.id === planeId));
|
||||
const planeVisualization = (dataType === 'landscapeData') ? plane?.animatedVisualization?.[0] : plane?.visualizations?.[0];
|
||||
const planeVisualization = ((dataType === 'landscapeData') ? plane?.animatedVisualization : plane?.visualizations)?.find(visualization => (visualization.size === planeGeometry.scale)) ?? null;
|
||||
const planeLayer = planeVisualization?.allLayers?.[0] as IAssetPlaneVisualizationLayer;
|
||||
const planeMaterialId = planeLayer?.materialId;
|
||||
const planeColor = planeLayer?.color;
|
||||
@@ -222,9 +226,9 @@ export class RoomPlane implements IRoomPlane
|
||||
switch(this._type)
|
||||
{
|
||||
case RoomPlane.TYPE_FLOOR: {
|
||||
const _local_10 = RoomPlane.PLANE_GEOMETRY.getScreenPoint(new Vector3d(0, 0, 0));
|
||||
const _local_11 = RoomPlane.PLANE_GEOMETRY.getScreenPoint(new Vector3d(0, (height / RoomPlane.PLANE_GEOMETRY.scale), 0));
|
||||
const _local_12 = RoomPlane.PLANE_GEOMETRY.getScreenPoint(new Vector3d((width / RoomPlane.PLANE_GEOMETRY.scale), 0, 0));
|
||||
const _local_10 = planeGeometry.getScreenPoint(new Vector3d(0, 0, 0));
|
||||
const _local_11 = planeGeometry.getScreenPoint(new Vector3d(0, (height / planeGeometry.scale), 0));
|
||||
const _local_12 = planeGeometry.getScreenPoint(new Vector3d((width / planeGeometry.scale), 0, 0));
|
||||
|
||||
let x = 0;
|
||||
let y = 0;
|
||||
@@ -234,7 +238,7 @@ export class RoomPlane implements IRoomPlane
|
||||
width = Math.round(Math.abs((_local_10.x - _local_12.x)));
|
||||
height = Math.round(Math.abs((_local_10.x - _local_11.x)));
|
||||
|
||||
const _local_15 = (_local_10.x - RoomPlane.PLANE_GEOMETRY.getScreenPoint(new Vector3d(1, 0, 0)).x);
|
||||
const _local_15 = (_local_10.x - planeGeometry.getScreenPoint(new Vector3d(1, 0, 0)).x);
|
||||
|
||||
x = (this._textureOffsetX * Math.trunc(Math.abs(_local_15)));
|
||||
y = (this._textureOffsetY * Math.trunc(Math.abs(_local_15)));
|
||||
@@ -261,9 +265,9 @@ export class RoomPlane implements IRoomPlane
|
||||
break;
|
||||
}
|
||||
case RoomPlane.TYPE_WALL: {
|
||||
const _local_8 = RoomPlane.PLANE_GEOMETRY.getScreenPoint(new Vector3d(0, 0, 0));
|
||||
const _local_9 = RoomPlane.PLANE_GEOMETRY.getScreenPoint(new Vector3d(0, 0, (height / RoomPlane.PLANE_GEOMETRY.scale)));
|
||||
const _local_10 = RoomPlane.PLANE_GEOMETRY.getScreenPoint(new Vector3d(0, (width / RoomPlane.PLANE_GEOMETRY.scale), 0));
|
||||
const _local_8 = planeGeometry.getScreenPoint(new Vector3d(0, 0, 0));
|
||||
const _local_9 = planeGeometry.getScreenPoint(new Vector3d(0, 0, (height / planeGeometry.scale)));
|
||||
const _local_10 = planeGeometry.getScreenPoint(new Vector3d(0, (width / planeGeometry.scale), 0));
|
||||
|
||||
if(_local_8 && _local_9 && _local_10)
|
||||
{
|
||||
@@ -285,19 +289,18 @@ export class RoomPlane implements IRoomPlane
|
||||
break;
|
||||
}
|
||||
case RoomPlane.TYPE_LANDSCAPE: {
|
||||
const _local_13 = RoomPlane.PLANE_GEOMETRY.getScreenPoint(new Vector3d(0, 0, 0));
|
||||
const _local_14 = RoomPlane.PLANE_GEOMETRY.getScreenPoint(new Vector3d(0, 0, 1));
|
||||
const _local_15 = RoomPlane.PLANE_GEOMETRY.getScreenPoint(new Vector3d(0, 1, 0));
|
||||
const _local_13 = planeGeometry.getScreenPoint(new Vector3d(0, 0, 0));
|
||||
const _local_14 = planeGeometry.getScreenPoint(new Vector3d(0, 0, 1));
|
||||
const _local_15 = planeGeometry.getScreenPoint(new Vector3d(0, 1, 0));
|
||||
|
||||
if(_local_13 && _local_14 && _local_15)
|
||||
{
|
||||
width = Math.round(Math.abs((((_local_13.x - _local_15.x) * width) / RoomPlane.PLANE_GEOMETRY.scale)));
|
||||
height = Math.round(Math.abs((((_local_13.y - _local_14.y) * height) / RoomPlane.PLANE_GEOMETRY.scale)));
|
||||
width = Math.round(Math.abs((((_local_13.x - _local_15.x) * width) / planeGeometry.scale)));
|
||||
height = Math.round(Math.abs((((_local_13.y - _local_14.y) * height) / planeGeometry.scale)));
|
||||
}
|
||||
|
||||
const renderMaxX = Math.trunc(this._textureMaxX * Math.abs((_local_13.x - _local_15.x)));
|
||||
const renderMaxY = Math.trunc(this._textureMaxY * Math.abs((_local_13.y - _local_14.y)));
|
||||
|
||||
const renderOffsetX = Math.trunc(this._textureOffsetX * Math.abs((_local_13.x - _local_15.x)));
|
||||
const renderOffsetY = Math.trunc(this._textureOffsetY * Math.abs((_local_13.y - _local_14.y)));
|
||||
|
||||
|
||||
@@ -234,7 +234,7 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
}
|
||||
}
|
||||
|
||||
public setScale(scale: number, point: Point = null, offsetPoint: Point = null): void
|
||||
public setScale(scale: number, point: Point = null, offsetPoint: Point = null, isFlipForced: boolean = false): void
|
||||
{
|
||||
if(!this._master || !this._display) return;
|
||||
|
||||
@@ -266,7 +266,8 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
|
||||
if((this._display.x !== this._screenOffsetX) || (this._display.y !== this._screenOffsetY))
|
||||
{
|
||||
this._display.position.set(this._screenOffsetX, this._screenOffsetY);
|
||||
this._display.x = Math.floor(this._screenOffsetX);
|
||||
this._display.y = Math.floor(this._screenOffsetY);
|
||||
|
||||
update = true;
|
||||
}
|
||||
@@ -562,8 +563,8 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
this.updateEnterRoomEffect(extendedSprite, objectSprite);
|
||||
}
|
||||
|
||||
if(extendedSprite.x !== sprite.x) extendedSprite.x = sprite.x;
|
||||
if(extendedSprite.y !== sprite.y) extendedSprite.y = sprite.y;
|
||||
extendedSprite.x = Math.round(sprite.x);
|
||||
extendedSprite.y = Math.round(sprite.y);
|
||||
|
||||
extendedSprite.offsetX = objectSprite.offsetX;
|
||||
extendedSprite.offsetY = objectSprite.offsetY;
|
||||
|
||||
Reference in New Issue
Block a user