@polygonjs/polygonjs
Version:
node-based WebGL 3D engine https://polygonjs.com
101 lines (100 loc) • 6.38 kB
TypeScript
/**
* Allows to detect when the mouse hovers over an object
*
*/
import { TypedEventNode } from './_Base';
import { RaycastCPUController } from './utils/raycast/CPUController';
import { RaycastGPUController } from './utils/raycast/GPUController';
import { ParamType } from '../../poly/ParamType';
export declare enum TargetType {
SCENE_GRAPH = "scene graph",
NODE = "node"
}
export declare const TARGET_TYPES: TargetType[];
import { NodeParamsConfig } from '../utils/params/ParamsConfig';
import { EventContext } from '../../../core/event/EventContextType';
declare class RaycastParamsConfig extends NodeParamsConfig {
/** @param defines if the ray detection is done on the CPU or GPU (GPU being currently experimental) */
mode: import("../utils/params/ParamsConfig").ParamTemplate<ParamType.INTEGER>;
/** @param defines if the mouse parameter is update when the cursor screen position changes */
tmouse: import("../utils/params/ParamsConfig").ParamTemplate<ParamType.BOOLEAN>;
/** @param mouse coordinates (0,0) being the center of the screen, (-1,-1) being the bottom left corner and (1,1) being the top right corner */
mouse: import("../utils/params/ParamsConfig").ParamTemplate<ParamType.VECTOR2>;
/** @param by default the ray is sent from the current camera, but this allows to set another camera */
/** @param by default the ray is sent from the current camera, but this allows to set a custom ray */
/** @param the camera to override to */
/** @param the ray origin */
/** @param the ray direction */
/** @param the material to use on the scene for GPU detection */
overrideMaterial: import("../utils/params/ParamsConfig").ParamTemplate<ParamType.BOOLEAN>;
/** @param the material to use on the scene for GPU detection */
material: import("../utils/params/ParamsConfig").ParamTemplate<ParamType.NODE_PATH>;
/** @param the current pixel color being read */
pixelColor: import("../utils/params/ParamsConfig").ParamTemplate<ParamType.COLOR>;
pixelAlpha: import("../utils/params/ParamsConfig").ParamTemplate<ParamType.FLOAT>;
/** @param the value threshold for which a hit is detected */
hitThreshold: import("../utils/params/ParamsConfig").ParamTemplate<ParamType.FLOAT>;
/** @param defines the hit it tested against geometry or just a plane */
intersectWith: import("../utils/params/ParamsConfig").ParamTemplate<ParamType.INTEGER>;
/** @param threshold used to test hit with points */
pointsThreshold: import("../utils/params/ParamsConfig").ParamTemplate<ParamType.FLOAT>;
/** @param plane direction if the hit is tested against a plane */
planeDirection: import("../utils/params/ParamsConfig").ParamTemplate<ParamType.VECTOR3>;
/** @param plane offset if the hit is tested against a plane */
planeOffset: import("../utils/params/ParamsConfig").ParamTemplate<ParamType.FLOAT>;
targetType: import("../utils/params/ParamsConfig").ParamTemplate<ParamType.INTEGER>;
/** @param node whose objects to test hit against, when testing against geometries */
targetNode: import("../utils/params/ParamsConfig").ParamTemplate<ParamType.NODE_PATH>;
/** @param objects to test hit against, when testing against geometries */
objectMask: import("../utils/params/ParamsConfig").ParamTemplate<ParamType.STRING>;
/** @param toggle to hit if tested against children */
traverseChildren: import("../utils/params/ParamsConfig").ParamTemplate<ParamType.BOOLEAN>;
/** @param toggle on to update hit position */
tposition: import("../utils/params/ParamsConfig").ParamTemplate<ParamType.BOOLEAN>;
/** @param toggle on to set the param to the hit position */
tpositionTarget: import("../utils/params/ParamsConfig").ParamTemplate<ParamType.BOOLEAN>;
/** @param this will be set to the hit position */
position: import("../utils/params/ParamsConfig").ParamTemplate<ParamType.VECTOR3>;
/** @param this parameter will be set to the hit position */
positionTarget: import("../utils/params/ParamsConfig").ParamTemplate<ParamType.PARAM_PATH>;
/** @param toggle on to set the param to the mouse velocity (experimental) */
tvelocity: import("../utils/params/ParamsConfig").ParamTemplate<ParamType.BOOLEAN>;
/** @param toggle on to set the param to the mouse velocity */
tvelocityTarget: import("../utils/params/ParamsConfig").ParamTemplate<ParamType.BOOLEAN>;
/** @param this will be set to the mouse velocity */
velocity: import("../utils/params/ParamsConfig").ParamTemplate<ParamType.VECTOR3>;
/** @param this will be set to the mouse velocity */
velocityTarget: import("../utils/params/ParamsConfig").ParamTemplate<ParamType.PARAM_PATH>;
/** @param for geometry hit tests, a vertex attribute can be read */
geoAttribute: import("../utils/params/ParamsConfig").ParamTemplate<ParamType.BOOLEAN>;
/** @param geometry vertex attribute to read */
geoAttributeName: import("../utils/params/ParamsConfig").ParamTemplate<ParamType.STRING>;
/** @param type of attribute */
geoAttributeType: import("../utils/params/ParamsConfig").ParamTemplate<ParamType.INTEGER>;
/** @param attribute value for float */
geoAttributeValue1: import("../utils/params/ParamsConfig").ParamTemplate<ParamType.FLOAT>;
/** @param attribute value for string */
geoAttributeValues: import("../utils/params/ParamsConfig").ParamTemplate<ParamType.STRING>;
}
export declare class RaycastEventNode extends TypedEventNode<RaycastParamsConfig> {
paramsConfig: RaycastParamsConfig;
static type(): string;
static readonly INPUT_TRIGGER = "trigger";
static readonly INPUT_MOUSE = "mouse";
static readonly INPUT_UPDATE_OBJECTS = "updateObjects";
static readonly INPUT_TRIGGER_VEL_RESET = "triggerVelReset";
static readonly OUTPUT_HIT = "hit";
static readonly OUTPUT_MISS = "miss";
readonly cpuController: RaycastCPUController;
readonly gpuController: RaycastGPUController;
initializeNode(): void;
triggerHit(context: EventContext<MouseEvent>): void;
triggerMiss(context: EventContext<MouseEvent>): void;
private _processMouseEvent;
private _lastEventProcessedAt;
private _processTriggerEventThrottled;
private _processTriggerEvent;
private _processTriggerUpdateObjects;
private _processTriggerVelReset;
}
export {};