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

claygl-next

Package Overview
Dependencies
Maintainers
1
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

claygl-next - npm Package Compare versions

Comparing version 2.0.0-alpha.26 to 2.0.0-alpha.27

4

lib/app/EventManager.d.ts

@@ -21,3 +21,3 @@ import * as rayPicking from '../picking/rayPicking';

export declare class EventManager {
private _renderer;
private _renderer?;
private _container;

@@ -27,3 +27,3 @@ private _scene;

private _listenedEvents;
constructor(container: HTMLElement, renderer: Renderer, scene?: Scene, camera?: Camera);
constructor(container: HTMLElement, renderer?: Renderer, scene?: Scene, camera?: Camera);
setCamera(camera?: Camera): void;

@@ -30,0 +30,0 @@ setScene(scene?: Scene): void;

@@ -80,3 +80,10 @@ import * as rayPicking from '../picking/rayPicking';

}
const pickResultAll = rayPicking.pickAll(renderer, scene, mainCamera, offsetX, offsetY);
const pickResultAll = rayPicking.pickAll(
// Make sure the EventManager can be used without renderer.
renderer || {
x: 0,
y: 0,
width: dom.clientWidth,
height: dom.clientHeight
}, scene, mainCamera, offsetX, offsetY);
// Just ignore silent element.

@@ -83,0 +90,0 @@ const pickResult = pickResultAll.find((result) => !result.target.silent);

import Ray from './math/Ray';
import { Vec3Array } from './glmatrix/common';
import type Renderer from './Renderer';
import type Camera from './Camera';

@@ -127,3 +126,3 @@ import type Renderable from './Renderable';

*/
pick?: (x: number, y: number, renderer: Renderer, camera: Camera, renderable: Renderable, out: Intersection[]) => boolean;
pick?: (x: number, y: number, camera: Camera, renderable: Renderable, out: Intersection[]) => boolean;
/**

@@ -130,0 +129,0 @@ * User defined ray picking algorithm instead of default

@@ -6,2 +6,8 @@ import Vector3 from '../math/Vector3';

import type ClayNode from '../Node';
interface Viewport {
x: number;
y: number;
width: number;
height: number;
}
/**

@@ -14,3 +20,3 @@ * Pick all intersection objects, wich will be sorted from near to far

*/
export declare function pickAll(renderer: Renderer, scene: Scene, camera: Camera, x: number, y: number, output?: Intersection[], forcePickAll?: boolean): Intersection[];
export declare function pickAll(renderer: Renderer | Viewport, scene: Scene, camera: Camera, x: number, y: number, output?: Intersection[], forcePickAll?: boolean): Intersection[];
/**

@@ -50,1 +56,2 @@ * Pick the nearest intersection object in the scene

}
export {};

@@ -7,2 +7,12 @@ import Ray from '../math/Ray';

import * as constants from '../core/constants';
function screenToNDC(x, y, viewport, out) {
// Invert y;
y = viewport.height - y;
const arr = out.array;
arr[0] = (x - viewport.x) / viewport.width;
arr[0] = arr[0] * 2 - 1;
arr[1] = (y - viewport.y) / viewport.height;
arr[1] = arr[1] * 2 - 1;
return out;
}
/**

@@ -18,6 +28,8 @@ * Pick all intersection objects, wich will be sorted from near to far

const ndc = new Vector2();
renderer.screenToNDC(x, y, ndc);
renderer.screenToNDC
? renderer.screenToNDC(x, y, ndc)
: screenToNDC(x, y, renderer, ndc);
camera.castRay(ndc, ray);
output = output || [];
intersectNode(renderer, camera, ray, ndc, scene, output, forcePickAll || false);
intersectNode(camera, ray, ndc, scene, output, forcePickAll || false);
output.sort(intersectionCompareFunc);

@@ -35,3 +47,3 @@ return output;

}
function intersectNode(renderer, camera, ray, ndc, node, out, forcePickAll) {
function intersectNode(camera, ray, ndc, node, out, forcePickAll) {
const renderable = node;

@@ -47,3 +59,3 @@ const geometry = renderable.geometry;

renderable.geometry.pick)) {
intersectRenderable(renderer, camera, ray, ndc, renderable, out);
intersectRenderable(camera, ray, ndc, renderable, out);
}

@@ -53,3 +65,3 @@ }

for (let i = 0; i < childrenRef.length; i++) {
intersectNode(renderer, camera, ray, ndc, childrenRef[i], out, forcePickAll);
intersectNode(camera, ray, ndc, childrenRef[i], out, forcePickAll);
}

@@ -62,3 +74,3 @@ }

const worldInverse = new Matrix4();
function intersectRenderable(renderer, camera, rawRay, ndc, renderable, out) {
function intersectRenderable(camera, rawRay, ndc, renderable, out) {
const isSkinnedMesh = renderable.isSkinnedMesh();

@@ -78,3 +90,3 @@ ray.copy(rawRay);

if (geometry.pick) {
geometry.pick(ndc.x, ndc.y, renderer, camera, renderable, out);
geometry.pick(ndc.x, ndc.y, camera, renderable, out);
return;

@@ -81,0 +93,0 @@ }

{
"name": "claygl-next",
"version": "2.0.0-alpha.26",
"version": "2.0.0-alpha.27",
"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

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