Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@lightningjs/renderer

Package Overview
Dependencies
Maintainers
0
Versions
58
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lightningjs/renderer - npm Package Compare versions

Comparing version 1.0.0-rc.3 to 1.0.0

2

dist/exports/index.d.ts

@@ -26,3 +26,3 @@ /**

export * from '../src/common/CommonTypes.js';
export { CoreTextureManager, type TextureTypeMap, type TextureMap, } from '../src/core/CoreTextureManager.js';
export { CoreTextureManager, type TextureMap, } from '../src/core/CoreTextureManager.js';
export type { MemoryInfo } from '../src/core/TextureMemoryManager.js';

@@ -29,0 +29,0 @@ export type { ShaderMap, EffectMap } from '../src/core/CoreShaderManager.js';

@@ -17,3 +17,3 @@ import { ImageWorkerManager } from './lib/ImageWorker.js';

*/
export interface TextureTypeMap {
export interface TextureMap {
ColorTexture: typeof ColorTexture;

@@ -25,8 +25,2 @@ ImageTexture: typeof ImageTexture;

}
/**
* Map of texture instance types
*/
export type TextureMap = {
[K in keyof TextureTypeMap]: InstanceType<TextureTypeMap[K]>;
};
export type ExtractProps<Type> = Type extends {

@@ -131,3 +125,3 @@ z$__type__Props: infer Props;

*/
txConstructors: Partial<TextureTypeMap>;
txConstructors: Partial<TextureMap>;
imageWorkerManager: ImageWorkerManager | null;

@@ -155,4 +149,4 @@ hasCreateImageBitmap: boolean;

constructor(numImageWorkers: number);
registerTextureType<Type extends keyof TextureTypeMap>(textureType: Type, textureClass: TextureTypeMap[Type]): void;
loadTexture<Type extends keyof TextureTypeMap>(textureType: Type, props: ExtractProps<TextureTypeMap[Type]>): InstanceType<TextureTypeMap[Type]>;
registerTextureType<Type extends keyof TextureMap>(textureType: Type, textureClass: TextureMap[Type]): void;
loadTexture<Type extends keyof TextureMap>(textureType: Type, props: ExtractProps<TextureMap[Type]>): InstanceType<TextureMap[Type]>;
private initTextureToCache;

@@ -159,0 +153,0 @@ /**

@@ -37,3 +37,2 @@ /*

const WORDS_PER_QUAD = 24;
const QUAD_BUFFER_SIZE = 4 * 1024 * 1024;
export class WebGlCoreRenderer extends CoreRenderer {

@@ -44,5 +43,5 @@ //// WebGL Native Context and Data

//// Persistent data
quadBuffer = new ArrayBuffer(QUAD_BUFFER_SIZE);
fQuadBuffer = new Float32Array(this.quadBuffer);
uiQuadBuffer = new Uint32Array(this.quadBuffer);
quadBuffer;
fQuadBuffer;
uiQuadBuffer;
renderOps = [];

@@ -69,2 +68,5 @@ //// Render Op / Buffer Filling State

super(options);
this.quadBuffer = new ArrayBuffer(this.stage.options.quadBufferSize);
this.fQuadBuffer = new Float32Array(this.quadBuffer);
this.uiQuadBuffer = new Uint32Array(this.quadBuffer);
this.mode = 'webgl';

@@ -525,3 +527,3 @@ const { canvas, clearColor, bufferMemory } = options;

const bufferInfo = {
totalAvailable: QUAD_BUFFER_SIZE,
totalAvailable: this.stage.options.quadBufferSize,
totalUsed: this.quadBufferUsage,

@@ -528,0 +530,0 @@ };

@@ -28,2 +28,3 @@ import { AnimationManager } from './animations/AnimationManager.js';

eventBus: EventEmitter;
quadBufferSize: number;
}

@@ -30,0 +31,0 @@ export type StageFpsUpdateHandler = (stage: Stage, fpsData: FpsUpdatePayload) => void;

import type { EffectMap, ShaderMap } from '../core/CoreShaderManager.js';
import type { ExtractProps, TextureTypeMap, TextureMap } from '../core/CoreTextureManager.js';
import type { ExtractProps, TextureMap } from '../core/CoreTextureManager.js';
import { EventEmitter } from '../common/EventEmitter.js';

@@ -151,2 +151,8 @@ import { Stage } from '../core/Stage.js';

renderMode?: 'webgl' | 'canvas';
/**
* Quad buffer size in bytes
*
* @defaultValue 4 * 1024 * 1024
*/
quadBufferSize?: number;
}

@@ -271,3 +277,3 @@ /**

*/
createTexture<TxType extends keyof TextureTypeMap>(textureType: TxType, props: ExtractProps<TextureTypeMap[TxType]>): TextureMap[TxType];
createTexture<TxType extends keyof TextureMap>(textureType: TxType, props: ExtractProps<TextureMap[TxType]>): InstanceType<TextureMap[TxType]>;
/**

@@ -274,0 +280,0 @@ * Create a new shader controller for a shader type

@@ -107,2 +107,3 @@ /*

renderMode: settings.renderMode ?? 'webgl',
quadBufferSize: settings.quadBufferSize ?? 4 * 1024 * 1024,
};

@@ -134,2 +135,3 @@ this.settings = resolvedSettings;

eventBus: this,
quadBufferSize: this.settings.quadBufferSize,
});

@@ -136,0 +138,0 @@ // Extract the root node

@@ -51,3 +51,2 @@ /*

CoreTextureManager,
type TextureTypeMap,
type TextureMap,

@@ -54,0 +53,0 @@ } from '../src/core/CoreTextureManager.js';

{
"name": "@lightningjs/renderer",
"version": "1.0.0-rc.3",
"version": "1.0.0",
"description": "Lightning 3 Renderer",

@@ -5,0 +5,0 @@ "type": "module",

@@ -37,3 +37,3 @@ /*

*/
export interface TextureTypeMap {
export interface TextureMap {
ColorTexture: typeof ColorTexture;

@@ -46,9 +46,2 @@ ImageTexture: typeof ImageTexture;

/**
* Map of texture instance types
*/
export type TextureMap = {
[K in keyof TextureTypeMap]: InstanceType<TextureTypeMap[K]>;
};
export type ExtractProps<Type> = Type extends { z$__type__Props: infer Props }

@@ -164,3 +157,3 @@ ? Props

*/
txConstructors: Partial<TextureTypeMap> = {};
txConstructors: Partial<TextureMap> = {};

@@ -209,5 +202,5 @@ imageWorkerManager: ImageWorkerManager | null = null;

registerTextureType<Type extends keyof TextureTypeMap>(
registerTextureType<Type extends keyof TextureMap>(
textureType: Type,
textureClass: TextureTypeMap[Type],
textureClass: TextureMap[Type],
): void {

@@ -217,6 +210,6 @@ this.txConstructors[textureType] = textureClass;

loadTexture<Type extends keyof TextureTypeMap>(
loadTexture<Type extends keyof TextureMap>(
textureType: Type,
props: ExtractProps<TextureTypeMap[Type]>,
): InstanceType<TextureTypeMap[Type]> {
props: ExtractProps<TextureMap[Type]>,
): InstanceType<TextureMap[Type]> {
let texture: Texture | undefined;

@@ -242,3 +235,3 @@ const TextureClass = this.txConstructors[textureType];

}
return texture as InstanceType<TextureTypeMap[Type]>;
return texture as InstanceType<TextureMap[Type]>;
}

@@ -245,0 +238,0 @@

@@ -58,3 +58,2 @@ /*

const WORDS_PER_QUAD = 24;
const QUAD_BUFFER_SIZE = 4 * 1024 * 1024;
// const BYTES_PER_QUAD = WORDS_PER_QUAD * 4;

@@ -75,5 +74,5 @@

//// Persistent data
quadBuffer: ArrayBuffer = new ArrayBuffer(QUAD_BUFFER_SIZE);
fQuadBuffer: Float32Array = new Float32Array(this.quadBuffer);
uiQuadBuffer: Uint32Array = new Uint32Array(this.quadBuffer);
quadBuffer: ArrayBuffer;
fQuadBuffer: Float32Array;
uiQuadBuffer: Uint32Array;
renderOps: WebGlCoreRenderOp[] = [];

@@ -105,2 +104,7 @@

super(options);
this.quadBuffer = new ArrayBuffer(this.stage.options.quadBufferSize);
this.fQuadBuffer = new Float32Array(this.quadBuffer);
this.uiQuadBuffer = new Uint32Array(this.quadBuffer);
this.mode = 'webgl';

@@ -706,3 +710,3 @@

const bufferInfo: BufferInfo = {
totalAvailable: QUAD_BUFFER_SIZE,
totalAvailable: this.stage.options.quadBufferSize,
totalUsed: this.quadBufferUsage,

@@ -709,0 +713,0 @@ };

@@ -67,2 +67,3 @@ /*

eventBus: EventEmitter;
quadBufferSize: number;
}

@@ -69,0 +70,0 @@

@@ -22,7 +22,3 @@ /*

import type { EffectMap, ShaderMap } from '../core/CoreShaderManager.js';
import type {
ExtractProps,
TextureTypeMap,
TextureMap,
} from '../core/CoreTextureManager.js';
import type { ExtractProps, TextureMap } from '../core/CoreTextureManager.js';
import { EventEmitter } from '../common/EventEmitter.js';

@@ -204,2 +200,9 @@ import { Inspector } from './Inspector.js';

renderMode?: 'webgl' | 'canvas';
/**
* Quad buffer size in bytes
*
* @defaultValue 4 * 1024 * 1024
*/
quadBufferSize?: number;
}

@@ -292,2 +295,3 @@

renderMode: settings.renderMode ?? 'webgl',
quadBufferSize: settings.quadBufferSize ?? 4 * 1024 * 1024,
};

@@ -330,2 +334,3 @@ this.settings = resolvedSettings;

eventBus: this,
quadBufferSize: this.settings.quadBufferSize,
});

@@ -445,10 +450,7 @@

*/
createTexture<TxType extends keyof TextureTypeMap>(
createTexture<TxType extends keyof TextureMap>(
textureType: TxType,
props: ExtractProps<TextureTypeMap[TxType]>,
): TextureMap[TxType] {
return this.stage.txManager.loadTexture(
textureType,
props,
) as TextureMap[TxType];
props: ExtractProps<TextureMap[TxType]>,
): InstanceType<TextureMap[TxType]> {
return this.stage.txManager.loadTexture(textureType, props);
}

@@ -455,0 +457,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc