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

@luma.gl/engine

Package Overview
Dependencies
Maintainers
6
Versions
177
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@luma.gl/engine - npm Package Compare versions

Comparing version 9.1.0-alpha.15 to 9.1.0-alpha.16

dist/factories/pipeline-factory.d.ts

3

dist/animation-loop/make-animation-loop.js

@@ -9,3 +9,4 @@ // luma.gl

let renderLoop = null;
const device = props?.device || luma.createDevice({ id: 'animation-loop', adapters: props?.adapters });
const device = props?.device ||
luma.createDevice({ id: 'animation-loop', adapters: props?.adapters, createCanvasContext: true });
// Create an animation loop;

@@ -12,0 +13,0 @@ const animationLoop = new AnimationLoop({

@@ -56,5 +56,5 @@ import type { Texture, TextureProps, Sampler, TextureView, Device, Texture1DData, Texture2DData, Texture3DData, TextureArrayData, TextureCubeData, TextureCubeArrayData } from '@luma.gl/core';

height: number;
}): void;
}): boolean;
}
export {};
//# sourceMappingURL=async-texture.d.ts.map

@@ -74,5 +74,11 @@ // luma.gl, MIT license

}
if (size.width === this.texture.width && size.height === this.texture.height) {
return false;
}
if (this.texture) {
this.texture = this.texture.createResizedTexture(size);
const texture = this.texture;
this.texture = texture.clone(size);
texture.destroy();
}
return true;
}

@@ -79,0 +85,0 @@ }

@@ -7,4 +7,4 @@ import type { ComputePipelineProps, Shader, Binding } from '@luma.gl/core';

import { ShaderInputs } from "../shader-inputs.js";
import { PipelineFactory } from "../lib/pipeline-factory.js";
import { ShaderFactory } from "../lib/shader-factory.js";
import { PipelineFactory } from "../factories/pipeline-factory.js";
import { ShaderFactory } from "../factories/shader-factory.js";
export type ComputationProps = Omit<ComputePipelineProps, 'shader'> & {

@@ -11,0 +11,0 @@ source?: string;

@@ -8,4 +8,4 @@ // luma.gl

import { ShaderInputs } from "../shader-inputs.js";
import { PipelineFactory } from "../lib/pipeline-factory.js";
import { ShaderFactory } from "../lib/shader-factory.js";
import { PipelineFactory } from "../factories/pipeline-factory.js";
import { ShaderFactory } from "../factories/shader-factory.js";
import { uid } from "../utils/uid.js";

@@ -200,3 +200,3 @@ // import {getDebugTableForShaderLayout} from '../debug/debug-shader-layout';

source: this.source,
debug: this.props.debugShaders
debugShaders: this.props.debugShaders
});

@@ -203,0 +203,0 @@ this.pipeline = this.pipelineFactory.createComputePipeline({

@@ -1,2 +0,3 @@

import { Resource } from '@luma.gl/core';
import type { BufferProps, FramebufferProps } from '@luma.gl/core';
import { Device, Resource, Buffer, Framebuffer } from '@luma.gl/core';
/**

@@ -22,2 +23,27 @@ * Helper class for working with repeated transformations / computations

}
/** Helper for managing double-buffered framebuffers */
export declare class SwapFramebuffers extends Swap<Framebuffer> {
constructor(device: Device, props: FramebufferProps);
/**
* Resizes the Framebuffers.
* @returns true if the size changed, otherwise exiting framebuffers were preserved
* @note any contents are not preserved!
*/
resize(size: {
width: number;
height: number;
}): boolean;
}
/** Helper for managing double-buffered GPU buffers */
export declare class SwapBuffers extends Swap<Buffer> {
constructor(device: Device, props: BufferProps);
/**
* Resizes the Buffers.
* @returns true if the size changed, otherwise exiting buffers were preserved.
* @note any contents are not preserved!
*/
resize(props: {
byteLength: number;
}): boolean;
}
//# sourceMappingURL=swap.d.ts.map

@@ -31,1 +31,45 @@ // luma.gl

}
/** Helper for managing double-buffered framebuffers */
export class SwapFramebuffers extends Swap {
constructor(device, props) {
super({ current: device.createFramebuffer(props), next: device.createFramebuffer(props) });
}
/**
* Resizes the Framebuffers.
* @returns true if the size changed, otherwise exiting framebuffers were preserved
* @note any contents are not preserved!
*/
resize(size) {
if (size.width === this.current.width && size.height === this.current.height) {
return false;
}
const { current, next } = this;
this.current = current.clone(size);
current.destroy();
this.next = next.clone(size);
next.destroy();
return true;
}
}
/** Helper for managing double-buffered GPU buffers */
export class SwapBuffers extends Swap {
constructor(device, props) {
super({ current: device.createBuffer(props), next: device.createBuffer(props) });
}
/**
* Resizes the Buffers.
* @returns true if the size changed, otherwise exiting buffers were preserved.
* @note any contents are not preserved!
*/
resize(props) {
if (props.byteLength === this.current.byteLength) {
return false;
}
const { current, next } = this;
this.current = current.clone(props);
current.destroy();
this.next = next.clone(props);
next.destroy();
return true;
}
}

@@ -15,5 +15,8 @@ export { Timeline } from "./animation/timeline.js";

export { TextureTransform } from "./compute/texture-transform.js";
export { PipelineFactory } from "./lib/pipeline-factory.js";
export { ShaderFactory } from "./lib/shader-factory.js";
export { ClipSpace } from "./lib/clip-space.js";
export { PipelineFactory } from "./factories/pipeline-factory.js";
export { ShaderFactory } from "./factories/shader-factory.js";
export type { ClipSpaceProps } from "./models/clip-space.js";
export { ClipSpace } from "./models/clip-space.js";
export type { BackgroundTextureModelProps } from "./models/background-texture-model.js";
export { BackgroundTextureModel } from "./models/background-texture-model.js";
export { ScenegraphNode } from "./scenegraph/scenegraph-node.js";

@@ -41,7 +44,11 @@ export { GroupNode } from "./scenegraph/group-node.js";

export { TruncatedConeGeometry } from "./geometries/truncated-cone-geometry.js";
export type { ShaderModuleInputs } from "./shader-inputs.js";
export { ShaderInputs } from "./shader-inputs.js";
export { makeRandomGenerator } from "./application-utils/random.js";
export { setPathPrefix, loadImage, loadImageBitmap } from "./application-utils/load-file.js";
export type { ShaderModuleInputs } from "./shader-inputs.js";
export { ShaderInputs as _ShaderInputs } from "./shader-inputs.js";
export type { ShaderPassRendererProps } from "./passes/shader-pass-renderer.js";
export { ShaderPassRenderer } from "./passes/shader-pass-renderer.js";
export { Swap } from "./compute/swap.js";
export { SwapBuffers } from "./compute/swap.js";
export { SwapFramebuffers } from "./compute/swap.js";
export type { ComputationProps } from "./compute/computation.js";

@@ -48,0 +55,0 @@ export { Computation } from "./compute/computation.js";

@@ -14,6 +14,6 @@ // luma.gl

export { TextureTransform } from "./compute/texture-transform.js";
export { PipelineFactory } from "./lib/pipeline-factory.js";
export { ShaderFactory } from "./lib/shader-factory.js";
// Utils
export { ClipSpace } from "./lib/clip-space.js";
export { PipelineFactory } from "./factories/pipeline-factory.js";
export { ShaderFactory } from "./factories/shader-factory.js";
export { ClipSpace } from "./models/clip-space.js";
export { BackgroundTextureModel } from "./models/background-texture-model.js";
// Scenegraph Core nodes

@@ -32,7 +32,10 @@ export { ScenegraphNode } from "./scenegraph/scenegraph-node.js";

export { TruncatedConeGeometry } from "./geometries/truncated-cone-geometry.js";
export { ShaderInputs } from "./shader-inputs.js";
// Application Utilities
export { makeRandomGenerator } from "./application-utils/random.js";
export { setPathPrefix, loadImage, loadImageBitmap } from "./application-utils/load-file.js";
export { ShaderInputs as _ShaderInputs } from "./shader-inputs.js";
export { ShaderPassRenderer } from "./passes/shader-pass-renderer.js";
export { Swap } from "./compute/swap.js";
export { SwapBuffers } from "./compute/swap.js";
export { SwapFramebuffers } from "./compute/swap.js";
export { Computation } from "./compute/computation.js";

@@ -39,0 +42,0 @@ export { requestAnimationFrame, cancelAnimationFrame } from "./animation-loop/request-animation-frame.js";

@@ -8,4 +8,4 @@ import type { TypedArray } from '@math.gl/types';

import { GPUGeometry } from "../geometry/gpu-geometry.js";
import { PipelineFactory } from "../lib/pipeline-factory.js";
import { ShaderFactory } from "../lib/shader-factory.js";
import { PipelineFactory } from "../factories/pipeline-factory.js";
import { ShaderFactory } from "../factories/shader-factory.js";
import { ShaderInputs } from "../shader-inputs.js";

@@ -12,0 +12,0 @@ import { AsyncTexture } from "../async-texture/async-texture.js";

@@ -7,4 +7,4 @@ // luma.gl

import { makeGPUGeometry } from "../geometry/gpu-geometry.js";
import { PipelineFactory } from "../lib/pipeline-factory.js";
import { ShaderFactory } from "../lib/shader-factory.js";
import { PipelineFactory } from "../factories/pipeline-factory.js";
import { ShaderFactory } from "../factories/shader-factory.js";
import { getDebugTableForShaderLayout } from "../debug/debug-shader-layout.js";

@@ -387,6 +387,8 @@ import { debugFramebuffer } from "../debug/debug-framebuffer.js";

this._uniformStore = new UniformStore(this.shaderInputs.modules);
// Create uniform buffer bindings for all modules
for (const moduleName of Object.keys(this.shaderInputs.modules)) {
const uniformBuffer = this._uniformStore.getManagedUniformBuffer(this.device, moduleName);
this.bindings[`${moduleName}Uniforms`] = uniformBuffer;
// Create uniform buffer bindings for all modules that actually have uniforms
for (const [moduleName, module] of Object.entries(this.shaderInputs.modules)) {
if (shaderModuleHasUniforms(module)) {
const uniformBuffer = this._uniformStore.getManagedUniformBuffer(this.device, moduleName);
this.bindings[`${moduleName}Uniforms`] = uniformBuffer;
}
}

@@ -398,3 +400,3 @@ this.setNeedsRedraw('shaderInputs');

this._uniformStore.setUniforms(this.shaderInputs.getUniformValues());
this.setBindings(this.shaderInputs.getBindings());
this.setBindings(this.shaderInputs.getBindingValues());
// TODO - this is already tracked through buffer/texture update times?

@@ -577,3 +579,3 @@ this.setNeedsRedraw('shaderInputs');

source: this.source || this.vs,
debug: this.props.debugShaders
debugShaders: this.props.debugShaders
});

@@ -589,3 +591,3 @@ let fs = null;

source: this.source || this.fs,
debug: this.props.debugShaders
debugShaders: this.props.debugShaders
});

@@ -646,3 +648,3 @@ }

_logFramebuffer(renderPass) {
const debugFramebuffers = log.get('framebuffer');
const debugFramebuffers = this.device.props.debugFramebuffers;
this._drawCount++;

@@ -693,2 +695,5 @@ // Update first 3 frames and then every 60 frames

}
function shaderModuleHasUniforms(module) {
return Boolean(module.uniformTypes && !isObjectEmpty(module.uniformTypes));
}
// HELPERS

@@ -728,10 +733,8 @@ /** TODO - move to core, document add tests */

function isObjectEmpty(obj) {
let isEmpty = true;
// @ts-ignore key is unused
// eslint-disable-next-line @typescript-eslint/no-unused-vars
for (const key in obj) {
isEmpty = false;
break;
return false;
}
return isEmpty;
return true;
}

@@ -54,3 +54,3 @@ // luma.gl

});
console.log(color255);
// console.log(color255);
// Check if we have

@@ -57,0 +57,0 @@ let highlightedObjectColor = new Float32Array(color255).map(x => x / 255);

@@ -51,3 +51,2 @@ import type { UniformValue, Texture, Sampler } from '@luma.gl/core';

}>): void;
/** Merges all bindings for the shader (from the various modules) */
/**

@@ -59,5 +58,6 @@ * Return the map of modules

/** Get all uniform values for all modules */
getUniformValues(): Record<keyof ShaderPropsT, Record<string, UniformValue>>;
getUniformValues(): Partial<Record<keyof ShaderPropsT, Record<string, UniformValue>>>;
/** Merges all bindings for the shader (from the various modules) */
getBindings(): Record<string, Texture | Sampler>;
getBindingValues(): Record<string, Texture | Sampler>;
/** Return a debug table that can be used for console.table() or log.table() */
getDebugTable(): Record<string, Record<string, unknown>>;

@@ -64,0 +64,0 @@ }

@@ -80,6 +80,2 @@ // luma.gl

}
/** Merges all bindings for the shader (from the various modules) */
// getUniformBlocks(): Record<string, Texture | Sampler> {
// return this.moduleUniforms;
// }
/**

@@ -97,3 +93,3 @@ * Return the map of modules

/** Merges all bindings for the shader (from the various modules) */
getBindings() {
getBindingValues() {
const bindings = {};

@@ -105,2 +101,3 @@ for (const moduleBindings of Object.values(this.moduleBindings)) {

}
/** Return a debug table that can be used for console.table() or log.table() */
getDebugTable() {

@@ -107,0 +104,0 @@ const table = {};

{
"name": "@luma.gl/engine",
"version": "9.1.0-alpha.15",
"version": "9.1.0-alpha.16",
"description": "3D Engine Components for luma.gl",

@@ -52,3 +52,3 @@ "type": "module",

},
"gitHead": "41af576ca655cb749a5567cf903f9e9242793c77"
"gitHead": "39eec40d12c826548b636c057fdb8572adfe611f"
}

@@ -26,3 +26,4 @@ // luma.gl

const device =
props?.device || luma.createDevice({id: 'animation-loop', adapters: props?.adapters});
props?.device ||
luma.createDevice({id: 'animation-loop', adapters: props?.adapters, createCanvasContext: true});

@@ -29,0 +30,0 @@ // Create an animation loop;

@@ -129,9 +129,17 @@ // luma.gl, MIT license

*/
resize(size: {width: number; height: number}): void {
resize(size: {width: number; height: number}): boolean {
if (!this.isReady) {
throw new Error('Cannot resize texture before it is ready');
}
if (size.width === this.texture.width && size.height === this.texture.height) {
return false;
}
if (this.texture) {
this.texture = this.texture.createResizedTexture(size);
const texture = this.texture;
this.texture = texture.clone(size);
texture.destroy();
}
return true;
}

@@ -138,0 +146,0 @@ }

@@ -19,4 +19,4 @@ // luma.gl

import {ShaderInputs} from '../shader-inputs';
import {PipelineFactory} from '../lib/pipeline-factory';
import {ShaderFactory} from '../lib/shader-factory';
import {PipelineFactory} from '../factories/pipeline-factory';
import {ShaderFactory} from '../factories/shader-factory';
import {uid} from '../utils/uid';

@@ -292,3 +292,3 @@ // import {getDebugTableForShaderLayout} from '../debug/debug-shader-layout';

source: this.source,
debug: this.props.debugShaders
debugShaders: this.props.debugShaders
});

@@ -295,0 +295,0 @@

@@ -5,3 +5,4 @@ // luma.gl

import {Resource} from '@luma.gl/core';
import type {BufferProps, FramebufferProps} from '@luma.gl/core';
import {Device, Resource, Buffer, Framebuffer} from '@luma.gl/core';

@@ -38,1 +39,56 @@ /**

}
/** Helper for managing double-buffered framebuffers */
export class SwapFramebuffers extends Swap<Framebuffer> {
constructor(device: Device, props: FramebufferProps) {
super({current: device.createFramebuffer(props), next: device.createFramebuffer(props)});
}
/**
* Resizes the Framebuffers.
* @returns true if the size changed, otherwise exiting framebuffers were preserved
* @note any contents are not preserved!
*/
resize(size: {width: number; height: number}): boolean {
if (size.width === this.current.width && size.height === this.current.height) {
return false;
}
const {current, next} = this;
this.current = current.clone(size);
current.destroy();
this.next = next.clone(size);
next.destroy();
return true;
}
}
/** Helper for managing double-buffered GPU buffers */
export class SwapBuffers extends Swap<Buffer> {
constructor(device: Device, props: BufferProps) {
super({current: device.createBuffer(props), next: device.createBuffer(props)});
}
/**
* Resizes the Buffers.
* @returns true if the size changed, otherwise exiting buffers were preserved.
* @note any contents are not preserved!
*/
resize(props: {byteLength: number}) {
if (props.byteLength === this.current.byteLength) {
return false;
}
const {current, next} = this;
this.current = current.clone(props);
current.destroy();
this.next = next.clone(props);
next.destroy();
return true;
}
}

@@ -29,7 +29,10 @@ // luma.gl

export {PipelineFactory} from './lib/pipeline-factory';
export {ShaderFactory} from './lib/shader-factory';
export {PipelineFactory} from './factories/pipeline-factory';
export {ShaderFactory} from './factories/shader-factory';
// Utils
export {ClipSpace} from './lib/clip-space';
// Models
export type {ClipSpaceProps} from './models/clip-space';
export {ClipSpace} from './models/clip-space';
export type {BackgroundTextureModelProps} from './models/background-texture-model';
export {BackgroundTextureModel} from './models/background-texture-model';

@@ -64,2 +67,5 @@ // Scenegraph Core nodes

export type {ShaderModuleInputs} from './shader-inputs';
export {ShaderInputs} from './shader-inputs';
// Application Utilities

@@ -70,6 +76,9 @@ export {makeRandomGenerator} from './application-utils/random';

// EXPERIMENTAL
export type {ShaderModuleInputs} from './shader-inputs';
export {ShaderInputs as _ShaderInputs} from './shader-inputs';
export type {ShaderPassRendererProps} from './passes/shader-pass-renderer';
export {ShaderPassRenderer} from './passes/shader-pass-renderer';
export {Swap} from './compute/swap';
export {SwapBuffers} from './compute/swap';
export {SwapFramebuffers} from './compute/swap';
export type {ComputationProps} from './compute/computation';

@@ -76,0 +85,0 @@ export {Computation} from './compute/computation';

@@ -39,4 +39,4 @@ // luma.gl

import {GPUGeometry, makeGPUGeometry} from '../geometry/gpu-geometry';
import {PipelineFactory} from '../lib/pipeline-factory';
import {ShaderFactory} from '../lib/shader-factory';
import {PipelineFactory} from '../factories/pipeline-factory';
import {ShaderFactory} from '../factories/shader-factory';
import {getDebugTableForShaderLayout} from '../debug/debug-shader-layout';

@@ -48,2 +48,3 @@ import {debugFramebuffer} from '../debug/debug-framebuffer';

import type {ShaderModuleInputs} from '../shader-inputs';
import {ShaderInputs} from '../shader-inputs';

@@ -536,6 +537,8 @@ // import type {AsyncTextureProps} from '../async-texture/async-texture';

this._uniformStore = new UniformStore(this.shaderInputs.modules);
// Create uniform buffer bindings for all modules
for (const moduleName of Object.keys(this.shaderInputs.modules)) {
const uniformBuffer = this._uniformStore.getManagedUniformBuffer(this.device, moduleName);
this.bindings[`${moduleName}Uniforms`] = uniformBuffer;
// Create uniform buffer bindings for all modules that actually have uniforms
for (const [moduleName, module] of Object.entries(this.shaderInputs.modules)) {
if (shaderModuleHasUniforms(module)) {
const uniformBuffer = this._uniformStore.getManagedUniformBuffer(this.device, moduleName);
this.bindings[`${moduleName}Uniforms`] = uniformBuffer;
}
}

@@ -548,3 +551,3 @@ this.setNeedsRedraw('shaderInputs');

this._uniformStore.setUniforms(this.shaderInputs.getUniformValues());
this.setBindings(this.shaderInputs.getBindings());
this.setBindings(this.shaderInputs.getBindingValues());
// TODO - this is already tracked through buffer/texture update times?

@@ -757,3 +760,3 @@ this.setNeedsRedraw('shaderInputs');

source: this.source || this.vs,
debug: this.props.debugShaders
debugShaders: this.props.debugShaders
});

@@ -769,3 +772,3 @@

source: this.source || this.fs,
debug: this.props.debugShaders
debugShaders: this.props.debugShaders
});

@@ -840,3 +843,3 @@ }

_logFramebuffer(renderPass: RenderPass): void {
const debugFramebuffers = log.get('framebuffer');
const debugFramebuffers = this.device.props.debugFramebuffers;
this._drawCount++;

@@ -892,2 +895,6 @@ // Update first 3 frames and then every 60 frames

function shaderModuleHasUniforms(module: ShaderModuleInputs): boolean {
return Boolean(module.uniformTypes && !isObjectEmpty(module.uniformTypes));
}
// HELPERS

@@ -930,10 +937,8 @@

function isObjectEmpty(obj: object): boolean {
let isEmpty = true;
// @ts-ignore key is unused
// eslint-disable-next-line @typescript-eslint/no-unused-vars
for (const key in obj) {
isEmpty = false;
break;
return false;
}
return isEmpty;
return true;
}

@@ -70,3 +70,3 @@ // luma.gl

});
console.log(color255);
// console.log(color255);

@@ -73,0 +73,0 @@ // Check if we have

@@ -126,7 +126,2 @@ // luma.gl

/** Merges all bindings for the shader (from the various modules) */
// getUniformBlocks(): Record<string, Texture | Sampler> {
// return this.moduleUniforms;
// }
/**

@@ -141,3 +136,3 @@ * Return the map of modules

/** Get all uniform values for all modules */
getUniformValues(): Record<keyof ShaderPropsT, Record<string, UniformValue>> {
getUniformValues(): Partial<Record<keyof ShaderPropsT, Record<string, UniformValue>>> {
return this.moduleUniforms;

@@ -147,3 +142,3 @@ }

/** Merges all bindings for the shader (from the various modules) */
getBindings(): Record<string, Texture | Sampler> {
getBindingValues(): Record<string, Texture | Sampler> {
const bindings = {} as Record<string, Texture | Sampler>;

@@ -156,2 +151,3 @@ for (const moduleBindings of Object.values(this.moduleBindings)) {

/** Return a debug table that can be used for console.table() or log.table() */
getDebugTable(): Record<string, Record<string, unknown>> {

@@ -158,0 +154,0 @@ const table: Record<string, Record<string, unknown>> = {};

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 too big to display

Sorry, the diff of this file is too big to display

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