Skip to content

Commit 855d12d

Browse files
committed
reintroduced Camera.getOmniXY used by dashboard
1 parent 836ad98 commit 855d12d

File tree

4 files changed

+11
-1
lines changed

4 files changed

+11
-1
lines changed

src/ts/camera.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,12 @@ export class Camera {
520520
return Math.floor((rot / (Math.PI * 2)) * numFrames);
521521
}
522522

523+
/** [Omni] Get the corresponding screen coordinates based on xyz coords */
524+
public getOmniXY(x:number, y:number, z:number) : Float64Array {
525+
this.e._getOmniXY(this.image.ptr, x, y, z);
526+
return this._xy;
527+
}
528+
523529
public setOmniSettings() : void {
524530
const i = this.image;
525531
const omni = i.$settings.omni;

src/types/wasm.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,8 @@ export interface MicrioWasmExports extends WebAssembly.Exports {
215215
* @returns Memory pointer to the `Uint32Array` containing the Matrix4 array
216216
*/
217217
_getMatrix(ptr:number, x?:number, y?:number, s?:number, r?:number, rX?:number, rY?:number, rZ?:number, t?:number, sX?:number, sY?:number) : number;
218+
/** Get the screen coordinates based on omni object xyz coordinates */
219+
_getOmniXY(ptr:number, x: number, y: number, z: number) : number;
218220
/** Set the relative View area of a MicrioImage to render to, animates by default. Used in grids.
219221
* @param ptr The image memory pointer in shared Wasm memory
220222
* @param x0 The viewport X0 coordinate

src/wasm/camera.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ export default class Camera {
6464
return this.getXYOmniCoo(x-.5, y-.5, radius, rotation, abs);
6565
}
6666

67-
private getXYOmniCoo(x: f64, y: f64, z:f64, rotation:f64, abs:bool) : Coordinates {
67+
getXYOmniCoo(x: f64, y: f64, z:f64, rotation:f64, abs:bool) : Coordinates {
6868
const c = this.canvas;
6969
const el = c.el;
7070
const mat = c.webgl.pMatrix, vec4 = c.webgl.vec4;

src/wasm/exports.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ export function _getXY(c:Canvas, x: f64, y: f64, abs: bool, radius:f64, rotation
5050
return c.getXY(x, y, abs, radius, rotation) };
5151
export function _getMatrix(c:Canvas, x:f64,y:f64,s:f64,r:f64,rX:f64,rY:f64, rZ:f64,t:f64,sX:f64,sY:f64) : Float32Array {
5252
return c.getMatrix(x,y,s,r,rX,rY,rZ,t,sX,sY) };
53+
export function _getOmniXY(c:Canvas, x: f64, y: f64, z:f64) : Float64Array {
54+
return c.camera.getXYOmniCoo(x, y, z, 0, false).toArray() };
5355
export function _setArea(c:Canvas, x0:f64,y0:f64,x1:f64,y1:f64,direct:bool,noDispatch:bool) : void {
5456
c.setArea(x0, y0, x1, y1, direct, noDispatch) }
5557
export function _setImageArea(i:Image, x0:f64,y0:f64,x1:f64,y1:f64) : void {

0 commit comments

Comments
 (0)