Socket
Socket
Sign inDemoInstall

claygl-next

Package Overview
Dependencies
1
Maintainers
1
Versions
43
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.0-alpha.40 to 2.0.0-alpha.41

2

dist/core/util.d.ts

@@ -60,4 +60,4 @@ /**

};
export declare function setCanvasSize(canvas: HTMLCanvasElement, width: number, height: number, pixelRatio?: number): void;
export declare function setCanvasSize(canvas: HTMLCanvasElement | OffscreenCanvas, width: number, height: number, pixelRatio?: number): void;
export declare const isArray: (arg: any) => arg is any[];
export declare function assert(cond: boolean, msg?: string): void;

@@ -36,3 +36,3 @@ import Notifier from './core/Notifier';

export interface RendererOpts {
canvas: HTMLCanvasElement | null;
canvas: HTMLCanvasElement | OffscreenCanvas | null;
/**

@@ -114,3 +114,3 @@ * Canvas width

uid: number;
canvas: HTMLCanvasElement;
canvas: HTMLCanvasElement | OffscreenCanvas;
/**

@@ -117,0 +117,0 @@ * Canvas width, set by resize method

@@ -10,3 +10,3 @@ import { Dict, UnionToIntersection } from './core/type';

export type ShaderType = 'vertex' | 'fragment';
export type UniformType = 'bool' | 'int' | 'sampler2D' | 'sampler2DArray' | 'sampler3D' | 'samplerCube' | 'float' | 'vec2' | 'vec3' | 'vec4' | 'ivec2' | 'ivec3' | 'ivec4' | 'mat2' | 'mat3' | 'mat4';
export type UniformType = 'bool' | 'int' | 'sampler2D' | 'sampler2DArray' | 'sampler3D' | 'samplerCube' | 'isampler2D' | 'usampler2D' | 'float' | 'vec2' | 'vec3' | 'vec4' | 'ivec2' | 'ivec3' | 'ivec4' | 'mat2' | 'mat3' | 'mat4';
export type NativeUniformType = Exclude<UniformType, '_struct'>;

@@ -30,2 +30,4 @@ declare const attributeSizeMap: {

sampler2DArray: Texture2DArray;
isampler2D: Texture2D;
usampler2D: Texture2D;
float: number;

@@ -49,2 +51,4 @@ vec2: vec2.Vec2Array;

sampler2DArray: Texture2DArray[];
isampler2D: Texture2D[];
usampler2D: Texture2D[];
float: ArrayLike<number>;

@@ -195,3 +199,3 @@ vec2: ArrayLike<number>;

export type PickFragmentTextureUniforms<T extends FragmentShader<Dict<ShaderDefineValue>, Dict<ShaderUniformLoose>>['uniforms']> = Pick<T, {
[key in keyof T]: T[key]['type'] extends 'sampler2D' | 'samplerCube' ? key : never;
[key in keyof T]: T[key]['type'] extends 'sampler2D' | 'samplerCube' | 'isampler2D' | 'usampler2D' | 'sampler3D' | 'sampler2DArray' ? key : never;
}[keyof T]>;

@@ -203,3 +207,3 @@ export declare class Shader<V extends VertexShader = VertexShader<Dict<ShaderDefineValue>, Dict<ShaderUniformLoose>, Dict<ShaderAttributeLoose>, Dict<ShaderVaringLoose>>, F extends FragmentShader = FragmentShader<Dict<ShaderDefineValue>, Dict<ShaderUniformLoose>>> {

shaderType: 'fragment' | 'vertex';
type: 'sampler2D' | 'samplerCube';
type: 'sampler2D' | 'samplerCube' | 'isampler2D' | 'usampler2D' | 'sampler3D' | 'sampler2DArray';
}>;

@@ -206,0 +210,0 @@ /**

@@ -27,2 +27,6 @@ /**

functions: ((functionName?: string | undefined) => string)[];
/**
* Clampped to edge when sampling.
* In stereo rendering. It will clampped to each part of screen.
*/
main: string;

@@ -43,2 +47,6 @@ };

functions: ((functionName?: string | undefined) => string)[];
/**
* Clampped to edge when sampling.
* In stereo rendering. It will clampped to each part of screen.
*/
main: string;

@@ -66,2 +74,6 @@ };

functions: ((functionName?: string | undefined) => string)[];
/**
* Clampped to edge when sampling.
* In stereo rendering. It will clampped to each part of screen.
*/
main: string;

@@ -107,2 +119,6 @@ };

functions: ((functionName?: string | undefined) => string)[];
/**
* Clampped to edge when sampling.
* In stereo rendering. It will clampped to each part of screen.
*/
main: string;

@@ -127,2 +143,6 @@ };

functions: ((functionName?: string | undefined) => string)[];
/**
* Clampped to edge when sampling.
* In stereo rendering. It will clampped to each part of screen.
*/
main: string;

@@ -155,2 +175,6 @@ };

functions: ((functionName?: string | undefined) => string)[];
/**
* Clampped to edge when sampling.
* In stereo rendering. It will clampped to each part of screen.
*/
main: string;

@@ -177,2 +201,6 @@ };

functions: ((functionName?: string | undefined) => string)[];
/**
* Clampped to edge when sampling.
* In stereo rendering. It will clampped to each part of screen.
*/
main: string;

@@ -222,2 +250,6 @@ };

functions: ((functionName?: string | undefined) => string)[];
/**
* Clampped to edge when sampling.
* In stereo rendering. It will clampped to each part of screen.
*/
main: string;

@@ -240,3 +272,7 @@ };

functions: ((functionName?: string | undefined) => string)[];
/**
* Clampped to edge when sampling.
* In stereo rendering. It will clampped to each part of screen.
*/
main: string;
};
import { GLEnum } from './core/type';
export type TextureImageSource = HTMLImageElement | HTMLCanvasElement | HTMLVideoElement;
export type TexturePixelSource = {
data: Uint8Array | Float32Array;
data: Uint8Array | Float32Array | Int32Array;
width: number;

@@ -13,3 +13,3 @@ height: number;

export declare function getDefaultTextureFormatBySource(source?: TextureSource): number;
export declare function getDefaultTypeBySource(source?: TextureSource): 5121 | 5126 | 5131;
export declare function getDefaultTypeBySource(source?: TextureSource): 5121 | 5124 | 5125 | 5126 | 5131;
export interface TextureOpts<TSource = unknown> {

@@ -16,0 +16,0 @@ /**

@@ -31,3 +31,3 @@ import Texture, { TextureOpts, TextureSource } from './Texture';

protected _defaultFormat(): number;
protected _defaultType(): 5121 | 5126 | 5131;
protected _defaultType(): 5121 | 5124 | 5125 | 5126 | 5131;
isRenderable(): boolean;

@@ -34,0 +34,0 @@ load(src: string, crossOrigin?: string): Promise<void>;

@@ -13,3 +13,3 @@ import Texture, { TextureOpts, TextureSource } from './Texture';

protected _defaultFormat(): number;
protected _defaultType(): 5121 | 5126 | 5131;
protected _defaultType(): 5121 | 5124 | 5125 | 5126 | 5131;
isRenderable(): boolean;

@@ -16,0 +16,0 @@ load(srcList: string[], crossOrigin?: string): Promise<void>;

@@ -15,5 +15,5 @@ import Texture, { TextureOpts, TexturePixelSource } from './Texture';

protected _defaultFormat(): number;
protected _defaultType(): 5121 | 5126 | 5131;
protected _defaultType(): 5121 | 5124 | 5125 | 5126 | 5131;
isRenderable(): boolean;
}
export default Texture3D;

@@ -44,3 +44,3 @@ import Texture, { TextureOpts, TextureSource } from './Texture';

protected _defaultFormat(): number;
protected _defaultType(): 5121 | 5126 | 5131;
protected _defaultType(): 5121 | 5124 | 5125 | 5126 | 5131;
isPowerOfTwo(): boolean;

@@ -47,0 +47,0 @@ isRenderable(): boolean;

@@ -130,3 +130,5 @@ // TODO createCompositor

}
!isDomCanvas && container.appendChild(renderer.canvas);
!isDomCanvas &&
container.appendChild &&
container.appendChild(renderer.canvas);
// Set scene to initialize.

@@ -133,0 +135,0 @@ this._onBeforeRenderScene = this._onBeforeRenderScene.bind(this);

@@ -60,4 +60,4 @@ /**

};
export declare function setCanvasSize(canvas: HTMLCanvasElement, width: number, height: number, pixelRatio?: number): void;
export declare function setCanvasSize(canvas: HTMLCanvasElement | OffscreenCanvas, width: number, height: number, pixelRatio?: number): void;
export declare const isArray: (arg: any) => arg is any[];
export declare function assert(cond: boolean, msg?: string): void;

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

// TODO deleteProgram
import { assign, genGUID, isArray, keys } from '../core/util';

@@ -2,0 +3,0 @@ import * as constants from '../core/constants';

@@ -36,3 +36,3 @@ import Notifier from './core/Notifier';

export interface RendererOpts {
canvas: HTMLCanvasElement | null;
canvas: HTMLCanvasElement | OffscreenCanvas | null;
/**

@@ -114,3 +114,3 @@ * Canvas width

uid: number;
canvas: HTMLCanvasElement;
canvas: HTMLCanvasElement | OffscreenCanvas;
/**

@@ -117,0 +117,0 @@ * Canvas width, set by resize method

@@ -10,3 +10,3 @@ import { Dict, UnionToIntersection } from './core/type';

export type ShaderType = 'vertex' | 'fragment';
export type UniformType = 'bool' | 'int' | 'sampler2D' | 'sampler2DArray' | 'sampler3D' | 'samplerCube' | 'float' | 'vec2' | 'vec3' | 'vec4' | 'ivec2' | 'ivec3' | 'ivec4' | 'mat2' | 'mat3' | 'mat4';
export type UniformType = 'bool' | 'int' | 'sampler2D' | 'sampler2DArray' | 'sampler3D' | 'samplerCube' | 'isampler2D' | 'usampler2D' | 'float' | 'vec2' | 'vec3' | 'vec4' | 'ivec2' | 'ivec3' | 'ivec4' | 'mat2' | 'mat3' | 'mat4';
export type NativeUniformType = Exclude<UniformType, '_struct'>;

@@ -30,2 +30,4 @@ declare const attributeSizeMap: {

sampler2DArray: Texture2DArray;
isampler2D: Texture2D;
usampler2D: Texture2D;
float: number;

@@ -49,2 +51,4 @@ vec2: vec2.Vec2Array;

sampler2DArray: Texture2DArray[];
isampler2D: Texture2D[];
usampler2D: Texture2D[];
float: ArrayLike<number>;

@@ -195,3 +199,3 @@ vec2: ArrayLike<number>;

export type PickFragmentTextureUniforms<T extends FragmentShader<Dict<ShaderDefineValue>, Dict<ShaderUniformLoose>>['uniforms']> = Pick<T, {
[key in keyof T]: T[key]['type'] extends 'sampler2D' | 'samplerCube' ? key : never;
[key in keyof T]: T[key]['type'] extends 'sampler2D' | 'samplerCube' | 'isampler2D' | 'usampler2D' | 'sampler3D' | 'sampler2DArray' ? key : never;
}[keyof T]>;

@@ -203,3 +207,3 @@ export declare class Shader<V extends VertexShader = VertexShader<Dict<ShaderDefineValue>, Dict<ShaderUniformLoose>, Dict<ShaderAttributeLoose>, Dict<ShaderVaringLoose>>, F extends FragmentShader = FragmentShader<Dict<ShaderDefineValue>, Dict<ShaderUniformLoose>>> {

shaderType: 'fragment' | 'vertex';
type: 'sampler2D' | 'samplerCube';
type: 'sampler2D' | 'samplerCube' | 'isampler2D' | 'usampler2D' | 'sampler3D' | 'sampler2DArray';
}>;

@@ -206,0 +210,0 @@ /**

@@ -172,11 +172,12 @@ // TODO check if name of varyings, uniforms, attributes conflicts

const item = obj[symbol];
const itemType = item.type;
// Use #define to define the length. Need to check #ifdef here.
const isDefinedLen = item.array && isNaN(+item.len);
const arrayExpr = item.array ? `[${item.len}]` : '';
const needsFlat = isVaring && item.type.startsWith('i');
const needsHighp = itemType.startsWith('isampler') || itemType.startsWith('usampler');
// Int varying
const needsFlat = isVaring && itemType.startsWith('i');
return ((isDefinedLen ? `#ifdef ${item.len}\n` : '') +
// `${composeStruct(item.struct, symbol)}` +
`${needsFlat ? 'flat ' : ''}${varType} ${
// item.struct ? getStructName(symbol) :
item.type} ${symbol}${arrayExpr};` +
`${needsFlat ? 'flat ' : ''}${varType} ${needsHighp ? 'highp ' : ''}${itemType} ${symbol}${arrayExpr};` +
(isDefinedLen ? `\n#endif` : ''));

@@ -251,3 +252,8 @@ })

const uniformSemantic = uniform.semantic;
if (uniformType === 'sampler2D' || uniformType === 'samplerCube') {
if (uniformType === 'sampler2D' ||
uniformType === 'samplerCube' ||
uniformType === 'isampler2D' ||
uniformType === 'usampler2D' ||
uniformType === 'sampler3D' ||
uniformType === 'sampler2DArray') {
textures[uniformName] = {

@@ -327,5 +333,6 @@ type: uniformType,

export function isTextureUniform(uniform) {
return uniform.type.startsWith('sampler');
const type = uniform.type;
return type.startsWith('sampler') || type.startsWith('isampler') || type.startsWith('usampler');
}
export default Shader;
//# sourceMappingURL=Shader.js.map

@@ -27,2 +27,6 @@ /**

functions: ((functionName?: string | undefined) => string)[];
/**
* Clampped to edge when sampling.
* In stereo rendering. It will clampped to each part of screen.
*/
main: string;

@@ -43,2 +47,6 @@ };

functions: ((functionName?: string | undefined) => string)[];
/**
* Clampped to edge when sampling.
* In stereo rendering. It will clampped to each part of screen.
*/
main: string;

@@ -66,2 +74,6 @@ };

functions: ((functionName?: string | undefined) => string)[];
/**
* Clampped to edge when sampling.
* In stereo rendering. It will clampped to each part of screen.
*/
main: string;

@@ -107,2 +119,6 @@ };

functions: ((functionName?: string | undefined) => string)[];
/**
* Clampped to edge when sampling.
* In stereo rendering. It will clampped to each part of screen.
*/
main: string;

@@ -127,2 +143,6 @@ };

functions: ((functionName?: string | undefined) => string)[];
/**
* Clampped to edge when sampling.
* In stereo rendering. It will clampped to each part of screen.
*/
main: string;

@@ -155,2 +175,6 @@ };

functions: ((functionName?: string | undefined) => string)[];
/**
* Clampped to edge when sampling.
* In stereo rendering. It will clampped to each part of screen.
*/
main: string;

@@ -177,2 +201,6 @@ };

functions: ((functionName?: string | undefined) => string)[];
/**
* Clampped to edge when sampling.
* In stereo rendering. It will clampped to each part of screen.
*/
main: string;

@@ -222,2 +250,6 @@ };

functions: ((functionName?: string | undefined) => string)[];
/**
* Clampped to edge when sampling.
* In stereo rendering. It will clampped to each part of screen.
*/
main: string;

@@ -240,3 +272,7 @@ };

functions: ((functionName?: string | undefined) => string)[];
/**
* Clampped to edge when sampling.
* In stereo rendering. It will clampped to each part of screen.
*/
main: string;
};
import { GLEnum } from './core/type';
export type TextureImageSource = HTMLImageElement | HTMLCanvasElement | HTMLVideoElement;
export type TexturePixelSource = {
data: Uint8Array | Float32Array;
data: Uint8Array | Float32Array | Int32Array;
width: number;

@@ -13,3 +13,3 @@ height: number;

export declare function getDefaultTextureFormatBySource(source?: TextureSource): number;
export declare function getDefaultTypeBySource(source?: TextureSource): 5121 | 5126 | 5131;
export declare function getDefaultTypeBySource(source?: TextureSource): 5121 | 5124 | 5125 | 5126 | 5131;
export interface TextureOpts<TSource = unknown> {

@@ -16,0 +16,0 @@ /**

@@ -31,2 +31,18 @@ /**

: constants.R32F;
case constants.INT:
return format === constants.RGBA
? constants.RGBA32I
: format === constants.RGB
? constants.RGB32I
: format === constants.RG
? constants.RG32I
: constants.R32I;
case constants.UNSIGNED_INT:
return format === constants.RGBA
? constants.RGBA32UI
: format === constants.RGB
? constants.RGB32UI
: format === constants.RG
? constants.RG32UI
: constants.R32UI;
case constants.UNSIGNED_BYTE:

@@ -58,7 +74,12 @@ return format === constants.RGBA

if (isPixelSource(source)) {
return source.data instanceof Float32Array
const data = source.data;
return data instanceof Float32Array
? constants.FLOAT
: source.data instanceof Uint16Array
: data instanceof Uint16Array
? constants.HALF_FLOAT
: constants.UNSIGNED_BYTE;
: data instanceof Uint32Array
? constants.UNSIGNED_INT
: data instanceof Int32Array
? constants.INT
: constants.UNSIGNED_BYTE;
}

@@ -65,0 +86,0 @@ return constants.UNSIGNED_BYTE;

@@ -31,3 +31,3 @@ import Texture, { TextureOpts, TextureSource } from './Texture';

protected _defaultFormat(): number;
protected _defaultType(): 5121 | 5126 | 5131;
protected _defaultType(): 5121 | 5124 | 5125 | 5126 | 5131;
isRenderable(): boolean;

@@ -34,0 +34,0 @@ load(src: string, crossOrigin?: string): Promise<void>;

@@ -13,3 +13,3 @@ import Texture, { TextureOpts, TextureSource } from './Texture';

protected _defaultFormat(): number;
protected _defaultType(): 5121 | 5126 | 5131;
protected _defaultType(): 5121 | 5124 | 5125 | 5126 | 5131;
isRenderable(): boolean;

@@ -16,0 +16,0 @@ load(srcList: string[], crossOrigin?: string): Promise<void>;

@@ -15,5 +15,5 @@ import Texture, { TextureOpts, TexturePixelSource } from './Texture';

protected _defaultFormat(): number;
protected _defaultType(): 5121 | 5126 | 5131;
protected _defaultType(): 5121 | 5124 | 5125 | 5126 | 5131;
isRenderable(): boolean;
}
export default Texture3D;

@@ -44,3 +44,3 @@ import Texture, { TextureOpts, TextureSource } from './Texture';

protected _defaultFormat(): number;
protected _defaultType(): 5121 | 5126 | 5131;
protected _defaultType(): 5121 | 5124 | 5125 | 5126 | 5131;
isPowerOfTwo(): boolean;

@@ -47,0 +47,0 @@ isRenderable(): boolean;

{
"name": "claygl-next",
"version": "2.0.0-alpha.40",
"version": "2.0.0-alpha.41",
"description": "A 3D graphic library",

@@ -5,0 +5,0 @@ "keywords": [

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

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 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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc