Comparing version 0.6.0 to 0.7.0
142
index.d.ts
@@ -0,1 +1,3 @@ | ||
/// <reference types="@2gis/gl-matrix" /> | ||
declare module '2gl' { | ||
@@ -12,3 +14,3 @@ export class Shader { | ||
interface AttributeDefinition { | ||
export interface AttributeDefinition { | ||
name: string; | ||
@@ -19,3 +21,3 @@ index?: boolean; | ||
interface UniformDefinition { | ||
export interface UniformDefinition { | ||
name: string; | ||
@@ -29,3 +31,3 @@ type: 'mat2' | 'mat3' | 'mat4' | | ||
interface ShaderProgramOptions { | ||
export interface ShaderProgramOptions { | ||
vertex: Shader; | ||
@@ -50,3 +52,3 @@ fragment: Shader; | ||
interface BufferBindOptions { | ||
export interface BufferBindOptions { | ||
itemSize: number; | ||
@@ -94,3 +96,3 @@ dataType: number; | ||
interface TextureOptions { | ||
export interface TextureOptions { | ||
magFilter: number; | ||
@@ -140,6 +142,42 @@ minFilter: number; | ||
interface RenderTargetOptions extends TextureOptions { | ||
export interface RenderTargetOptions extends TextureOptions { | ||
size: Vec2; | ||
} | ||
export class Object3D { | ||
public children: Object3D[]; | ||
public parent: Object3D | null; | ||
public visible: boolean; | ||
public scale: Vec3; | ||
public position: Vec3; | ||
public quaternion: Quat; | ||
public localMatrix: Mat4; | ||
public worldMatrix: Mat4; | ||
public worldMatrixNeedsUpdate: boolean; | ||
public type: number; | ||
constructor(); | ||
public add(object: Object3D): this; | ||
public remove(object: Object3D): this; | ||
public render(): this; | ||
public updateLocalMatrix(): this; | ||
public updateWorldMatrix(): this; | ||
public getWorldPosition(): Vec3; | ||
public traverse(callback: (obj: Object3D) => void): this; | ||
public traverseVisible(callback: (obj: Object3D) => void): this; | ||
public typifyForRender(rp: {[type: number]: RendererPlugin}): this; | ||
} | ||
export class Scene extends Object3D {} | ||
export class Camera extends Object3D {} | ||
export class RendererPlugin { | ||
public _objects: Object3D[]; | ||
public type: number; | ||
constructor(); | ||
public render(): this; | ||
public addObject(object: Object3D): this; | ||
public hasObjects(): boolean; | ||
} | ||
export class RenderTarget { | ||
@@ -155,3 +193,3 @@ public readonly options: RenderTargetOptions; | ||
interface RendererState { | ||
export interface RendererState { | ||
gl: WebGLRenderingContext; | ||
@@ -161,2 +199,38 @@ extensions: {[name: string]: any}; | ||
export interface RendererOptions { | ||
canvas: string | HTMLCanvasElement; | ||
gl: WebGLRenderingContext; | ||
pixelRatio: number; | ||
antialias: boolean; | ||
stencil: boolean; | ||
autoClear: boolean; | ||
clearColor: Vec4; | ||
sortObjects: boolean; | ||
failIfMajorPerformanceCaveat: boolean; | ||
version: number; | ||
} | ||
export class Renderer { | ||
public _gl: WebGLRenderingContext; | ||
public autoClear: boolean; | ||
public clearColor: Vec4; | ||
public sortObjects: boolean; | ||
public _pluginsByType: {[type: number]: RendererPlugin}; | ||
public _plugins: RendererPlugin[]; | ||
public webGlExtensions: {[name: string]: any}; | ||
constructor(options: Partial<RendererOptions>); | ||
public addPlugin(plugin: RendererPlugin, order?: number): this; | ||
public removePlugin(plugin: RendererPlugin): this; | ||
public setPixelRatio(value: number): this; | ||
public getPixelRatio(): this; | ||
public setSize(width: number, height: number): this; | ||
public setViewport(width: number, height: number): this; | ||
public getSize(): Vec2; | ||
public setRenderTarget(rt: RenderTarget): this; | ||
public readPixels(x: number, y: number, width: number, height: number, arrat: TypedArray): this; | ||
public clear(): this; | ||
public render(scene: Scene, camera: Camera, userData: any): this; | ||
public addExtension(name: string): this; | ||
} | ||
export class Vao { | ||
@@ -168,2 +242,26 @@ constructor(program: ShaderProgram, attributes: {[name: string]: Buffer | BufferChannel}); | ||
} | ||
export class Box { | ||
public min: Vec3; | ||
public max: Vec3; | ||
constructor(min?: Vec3, max?: Vec3); | ||
public containsPoint(point: Vec3): boolean; | ||
public expandByPoint(point: Vec3): this; | ||
} | ||
export class Plane { | ||
public normal: Vec3; | ||
public constant: number; | ||
constructor(normal?: Vec3, constane?: number); | ||
public distanceToPoint(point: Vec3): number; | ||
public setComponents(x: number, y: number, z: number, w: number): this; | ||
public normalize(): this; | ||
} | ||
export class Frustum { | ||
public planes: Plane[]; | ||
constructor(planes?: Plane[]); | ||
public setFromMatrix(m: Mat4): this; | ||
public intersectsBox(box: Box): boolean; | ||
} | ||
} | ||
@@ -201,2 +299,17 @@ | ||
declare module '2gl/Renderer' { | ||
import { Renderer } from '2gl'; | ||
export default Renderer; | ||
} | ||
declare module '2gl/RendererPlugin' { | ||
import { RendererPlugin } from '2gl'; | ||
export default RendererPlugin; | ||
} | ||
declare module '2gl/Object3D' { | ||
import { Object3D } from '2gl'; | ||
export default Object3D; | ||
} | ||
declare module '2gl/Vao' { | ||
@@ -206,1 +319,16 @@ import { Vao } from '2gl'; | ||
} | ||
declare module '2gl/math/Box' { | ||
import { Box } from '2gl'; | ||
export default Box; | ||
} | ||
declare module '2gl/math/Plane' { | ||
import { Plane } from '2gl'; | ||
export default Plane; | ||
} | ||
declare module '2gl/math/Frustum' { | ||
import { Frustum } from '2gl'; | ||
export default Frustum; | ||
} |
{ | ||
"name": "2gl", | ||
"version": "0.6.0", | ||
"version": "0.7.0", | ||
"description": "WebGL library for 2GIS projects", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -26,2 +26,3 @@ /** | ||
this._objects = []; | ||
return this; | ||
} | ||
@@ -44,2 +45,2 @@ | ||
export default RendererPlugin; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNyYy9SZW5kZXJlclBsdWdpbi5qcyJdLCJuYW1lcyI6WyJSZW5kZXJlclBsdWdpbiIsImNvbnN0cnVjdG9yIiwiX29iamVjdHMiLCJ0eXBlIiwicmVuZGVyIiwiYWRkT2JqZWN0Iiwib2JqZWN0IiwicHVzaCIsImhhc09iamVjdHMiLCJsZW5ndGgiXSwibWFwcGluZ3MiOiJBQUFBOzs7Ozs7OztBQVFBLE1BQU1BLGNBQU4sQ0FBcUI7QUFDakJDLGtCQUFjO0FBQ1YsYUFBS0MsUUFBTCxHQUFnQixFQUFoQjs7QUFFQTs7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wYXJhbSB7U3RhdGV9IHN0YXRlXG4gICAgICovXG4gICAgcmVuZGVyKCkge1xuICAgICAgICB0aGlzLl9vYmplY3RzID0gW107XG4gICAgICAgIHJldHVybiB0aGlzO1xuICAgIH1cblxuICAgIC8qKlxuICAgICAqINCU0L7QsdCw0LLQu9GP0LXRgiDQvtCx0YrQtdC60YIg0Log0L/Qu9Cw0LPQuNC90YMg0L3QsCDRjdGC0LDQv9C1INGA0LXQvdC00LXRgNC40L3Qs9CwXG4gICAgICogQHBhcmFtIHtPYmplY3QzRH0gb2JqZWN0XG4gICAgICovXG4gICAgYWRkT2JqZWN0KG9iamVjdCkge1xuICAgICAgICB0aGlzLl9vYmplY3RzLnB1c2gob2JqZWN0KTtcbiAgICAgICAgcmV0dXJuIHRoaXM7XG4gICAgfVxuXG4gICAgaGFzT2JqZWN0cygpIHtcbiAgICAgICAgcmV0dXJuIHRoaXMuX29iamVjdHMubGVuZ3RoID4gMDtcbiAgICB9XG59XG5cbmV4cG9ydCBkZWZhdWx0IFJlbmRlcmVyUGx1Z2luO1xuIl19 |
@@ -26,2 +26,3 @@ /** | ||
this._objects = []; | ||
return this; | ||
} | ||
@@ -28,0 +29,0 @@ |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
7962
0
1739391
124