mirror of
https://github.com/billsonnn/nitro-renderer.git
synced 2025-01-18 22:36:27 +01:00
Send the camera packet
This commit is contained in:
parent
e2d6ef315a
commit
c64515e0f7
@ -5,29 +5,30 @@ import { PNGEncoder } from '../../../../utils/PNGEncoder';
|
||||
|
||||
export class RenderRoomMessageComposer implements IMessageComposer<ConstructorParameters<typeof RenderRoomMessageComposer>>
|
||||
{
|
||||
private _data: any;
|
||||
private _data: any;
|
||||
|
||||
constructor(k:any, _arg_2: string, _arg_3: string, _arg_4: number, _arg_5: number)
|
||||
{
|
||||
this._data = [];
|
||||
}
|
||||
constructor(k:any = '', _arg_2: string = '', _arg_3: string = '', _arg_4: number = -1, _arg_5: number = -1)
|
||||
{
|
||||
this._data = [];
|
||||
}
|
||||
|
||||
public getMessageArray()
|
||||
{
|
||||
return this._data;
|
||||
}
|
||||
public getMessageArray()
|
||||
{
|
||||
return this._data;
|
||||
}
|
||||
|
||||
public dispose(): void
|
||||
{
|
||||
this._data = [];
|
||||
}
|
||||
public dispose(): void
|
||||
{
|
||||
this._data = [];
|
||||
}
|
||||
|
||||
public assignBitmap(texture: RenderTexture):void
|
||||
{
|
||||
const bitmapEncoded = PNGEncoder.encode(texture);
|
||||
for(let i = 0; i < bitmapEncoded.byteLength; i++)
|
||||
{
|
||||
this._data[i] = new Byte(bitmapEncoded[i]);
|
||||
}
|
||||
}
|
||||
public assignBitmap(texture: RenderTexture):void
|
||||
{
|
||||
const bitmapEncoded = PNGEncoder.encode(texture);
|
||||
|
||||
for(let i = 0; i < bitmapEncoded.byteLength; i++)
|
||||
{
|
||||
this._data[i] = new Byte(bitmapEncoded[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -90,7 +90,7 @@ export interface IRoomEngine extends INitroManager
|
||||
processRoomObjectOperation(objectId: number, category: number, operation: string): boolean;
|
||||
processRoomObjectPlacement(placementSource: string, id: number, category: number, typeId: number, legacyString?: string, stuffData?: IObjectData, state?: number, frameNumber?: number, posture?: string): boolean;
|
||||
dispatchMouseEvent(canvasId: number, x: number, y: number, type: string, altKey: boolean, ctrlKey: boolean, shiftKey: boolean, buttonDown: boolean): void;
|
||||
createRoomScreenshot(roomId: number, canvasId?: number, bounds?: Rectangle): HTMLImageElement;
|
||||
createRoomScreenshot(roomId: number, canvasId?: number, bounds?: Rectangle, sendToServer?: boolean): HTMLImageElement;
|
||||
modifyRoomObjectData(objectId: number, objectCategory: number, colorHex: string, text: string): boolean;
|
||||
deleteRoomObject(objectId: number, objectCategory: number): boolean;
|
||||
sessionDataManager: ISessionDataManager;
|
||||
|
@ -30,6 +30,7 @@ import { RoomGeometry } from '../../room/utils/RoomGeometry';
|
||||
import { Vector3d } from '../../room/utils/Vector3d';
|
||||
import { PetCustomPart } from '../avatar/pets/PetCustomPart';
|
||||
import { PetFigureData } from '../avatar/pets/PetFigureData';
|
||||
import { RenderRoomMessageComposer } from '../communication';
|
||||
import { INitroCommunicationManager } from '../communication/INitroCommunicationManager';
|
||||
import { ToolbarIconEnum } from '../enums/ToolbarIconEnum';
|
||||
import { NitroToolbarAnimateIconEvent } from '../events/NitroToolbarAnimateIconEvent';
|
||||
@ -3447,7 +3448,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato
|
||||
return null;
|
||||
}
|
||||
|
||||
public createRoomScreenshot(roomId: number, canvasId: number = -1, bounds: Rectangle = null): HTMLImageElement
|
||||
public createRoomScreenshot(roomId: number, canvasId: number = -1, bounds: Rectangle = null, sendToServer: boolean = false): HTMLImageElement
|
||||
{
|
||||
let canvas: IRoomRenderingCanvas = null;
|
||||
|
||||
@ -3471,6 +3472,15 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato
|
||||
texture = canvas.getDisplayAsTexture();
|
||||
}
|
||||
|
||||
if(sendToServer)
|
||||
{
|
||||
const composer = new RenderRoomMessageComposer();
|
||||
|
||||
composer.assignBitmap(texture);
|
||||
|
||||
this._communication.connection.send(composer);
|
||||
}
|
||||
|
||||
const base64 = TextureUtils.generateImageUrl(texture);
|
||||
const image = new Image();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user