UNPKG

polygonjs-engine

Version:

node-based webgl 3D engine https://polygonjs.com

98 lines (97 loc) 6.35 kB
/** * Allows to detect when the mouse hovers over an object * */ import { TypedEventNode } from './_Base'; import { EventContext } from '../../scene/utils/events/_BaseEventsController'; 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'; 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 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 */ overrideCamera: import("../utils/params/ParamsConfig").ParamTemplate<ParamType.BOOLEAN>; /** @param by default the ray is sent from the current camera, but this allows to set a custom ray */ overrideRay: import("../utils/params/ParamsConfig").ParamTemplate<ParamType.BOOLEAN>; /** @param the camera to override to */ camera: import("../utils/params/ParamsConfig").ParamTemplate<ParamType.OPERATOR_PATH>; /** @param the ray origin */ rayOrigin: import("../utils/params/ParamsConfig").ParamTemplate<ParamType.VECTOR3>; /** @param the ray direction */ rayDirection: import("../utils/params/ParamsConfig").ParamTemplate<ParamType.VECTOR3>; /** @param the material to use on the scene for GPU detection */ material: import("../utils/params/ParamsConfig").ParamTemplate<ParamType.OPERATOR_PATH>; /** @param the current pixel value being read */ pixelValue: import("../utils/params/ParamsConfig").ParamTemplate<ParamType.VECTOR4>; /** @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 prints which objects are targeted by this node, for debugging */ printFoundObjectsFromMask: import("../utils/params/ParamsConfig").ParamTemplate<ParamType.BUTTON>; /** @param toggle to hit if tested against children */ traverseChildren: import("../utils/params/ParamsConfig").ParamTemplate<ParamType.BOOLEAN>; sep: import("../utils/params/ParamsConfig").ParamTemplate<ParamType.SEPARATOR>; /** @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.OPERATOR_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.OPERATOR_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> { params_config: RaycastParamsConfig; static type(): string; static readonly OUTPUT_HIT = "hit"; static readonly OUTPUT_MISS = "miss"; readonly cpu_controller: RaycastCPUController; readonly gpu_controller: RaycastGPUController; initializeNode(): void; trigger_hit(context: EventContext<MouseEvent>): void; trigger_miss(context: EventContext<MouseEvent>): void; private _process_mouse_event; private _last_event_processed_at; private _process_trigger_event_throttled; private _process_trigger_event; private _process_trigger_update_objects; private _process_trigger_vel_reset; } export {};