/** * Copyright (c) 2026 mol* contributors, licensed under MIT, See LICENSE file for more info. * * @author Alexander Rose * @author Gianluca Tomasello */ import { ParamDefinition as PD } from '../../../../mol-util/param-definition.js'; import { ParticleList, ParticleTarget } from '../../../../mol-model/particles/particle-list.js'; import { Theme } from '../../../../mol-theme/theme.js'; import { GraphicsRenderObject } from '../../../../mol-gl/render-object.js'; import { Loci as ModelLoci } from '../../../../mol-model/loci.js'; import { MarkerAction } from '../../../../mol-util/marker-action.js'; import { VisualContext } from '../../../visual.js'; import { WebGLContext } from '../../../../mol-gl/webgl/context.js'; import { Geometry } from '../../../../mol-geo/geometry/geometry.js'; import { TransformData } from '../../../../mol-geo/geometry/transform-data.js'; import { OrderedSet } from '../../../../mol-data/int.js'; import { Sphere3D } from '../../../../mol-math/geometry.js'; /** Params shared by all target kinds; the per-kind groups below are merged on top of these. */ export declare const ParticleTargetCommonParams: { instanceGranularity: PD.BooleanParam; lodLevels: PD.ObjectList>; alpha: PD.Numeric; material: PD.Group>; clip: PD.Group[]; }>>; emissive: PD.Numeric; density: PD.Numeric; renderMerged: PD.Select; lod: PD.Vec3; cellSize: PD.Numeric; batchSize: PD.Numeric; }; export type ParticleTargetCommonParams = typeof ParticleTargetCommonParams; /** Params for targets that are structures, rendered as sphere impostors, a sphere mesh or a blob surface. */ export declare const ParticleTargetStructureParams: { blobSize: PD.Numeric; blobMethod: PD.Mapped, "grid"> | PD.NamedParams, "clustering">>; resolution: PD.Numeric; adjustResolution: PD.BooleanParam; blobShape: PD.Mapped, "ellipsoid"> | PD.NamedParams, "sphericalHarmonics">>; radiusOffset: PD.Numeric; smoothness: PD.Numeric; sizeFactor: PD.Numeric; detail: PD.Numeric; tryUseImpostor: PD.BooleanParam; solidInterior: PD.BooleanParam; type: PD.Select; doubleSided: PD.BooleanParam; flipSided: PD.BooleanParam; flatShaded: PD.BooleanParam; ignoreLight: PD.BooleanParam; celShaded: PD.BooleanParam; xrayShaded: PD.Select; transparentBackfaces: PD.Select<"off" | "on" | "opaque">; bumpFrequency: PD.Numeric; bumpAmplitude: PD.Numeric; interior: PD.Group; substanceStrength: number; }>>; animation: PD.Group>; alpha: PD.Numeric; quality: PD.Select<"auto" | "medium" | "high" | "low" | "custom" | "highest" | "higher" | "lower" | "lowest">; material: PD.Group>; clip: PD.Group[]; }>>; emissive: PD.Numeric; density: PD.Numeric; instanceGranularity: PD.Select; renderMerged: PD.Select; lod: PD.Vec3; cellSize: PD.Numeric; batchSize: PD.Numeric; clipPrimitive: PD.BooleanParam; approximate: PD.BooleanParam; alphaThickness: PD.Numeric; lodLevels: PD.ObjectList>; }; export type ParticleTargetStructureParams = typeof ParticleTargetStructureParams; /** Params for targets that are shapes, rendered using the shape's own geometry. */ export declare const ParticleTargetShapeParams: { doubleSided: PD.BooleanParam; flipSided: PD.BooleanParam; flatShaded: PD.BooleanParam; ignoreLight: PD.BooleanParam; celShaded: PD.BooleanParam; xrayShaded: PD.Select; transparentBackfaces: PD.Select<"off" | "on" | "opaque">; solidInterior: PD.BooleanParam; bumpFrequency: PD.Numeric; bumpAmplitude: PD.Numeric; interior: PD.Group; substanceStrength: number; }>>; animation: PD.Group>; alpha: PD.Numeric; quality: PD.Select<"auto" | "medium" | "high" | "low" | "custom" | "highest" | "higher" | "lower" | "lowest">; material: PD.Group>; clip: PD.Group[]; }>>; emissive: PD.Numeric; density: PD.Numeric; instanceGranularity: PD.Select; renderMerged: PD.Select; lod: PD.Vec3; cellSize: PD.Numeric; batchSize: PD.Numeric; scaleByRadius: PD.BooleanParam; }; export type ParticleTargetShapeParams = typeof ParticleTargetShapeParams; /** Params for targets that are volumes, rendered as an isosurface mesh or as dots. */ export declare const ParticleTargetVolumeParams: { scaleByRadius: PD.BooleanParam; perturbPositions: PD.BooleanParam; sizeFactor: PD.Numeric; detail: PD.Numeric; tryUseImpostor: PD.BooleanParam; wrap: PD.Select<"auto" | "off" | "on">; floodfill: PD.Select<"inside" | "outside" | "off">; solidInterior: PD.BooleanParam; type: PD.Select; isoValue: PD.Conditioned | Readonly<{ kind: "relative"; relativeValue: number; }>, PD.Base | Readonly<{ kind: "relative"; relativeValue: number; }>>, { absolute: PD.Converted, number>; relative: PD.Converted, number>; }>; doubleSided: PD.BooleanParam; flipSided: PD.BooleanParam; flatShaded: PD.BooleanParam; ignoreLight: PD.BooleanParam; celShaded: PD.BooleanParam; xrayShaded: PD.Select; transparentBackfaces: PD.Select<"off" | "on" | "opaque">; bumpFrequency: PD.Numeric; bumpAmplitude: PD.Numeric; interior: PD.Group; substanceStrength: number; }>>; animation: PD.Group>; alpha: PD.Numeric; quality: PD.Select<"auto" | "medium" | "high" | "low" | "custom" | "highest" | "higher" | "lower" | "lowest">; material: PD.Group>; clip: PD.Group[]; }>>; emissive: PD.Numeric; density: PD.Numeric; instanceGranularity: PD.Select; renderMerged: PD.Select; lod: PD.Vec3; cellSize: PD.Numeric; batchSize: PD.Numeric; clipPrimitive: PD.BooleanParam; approximate: PD.BooleanParam; alphaThickness: PD.Numeric; lodLevels: PD.ObjectList>; }; export type ParticleTargetVolumeParams = typeof ParticleTargetVolumeParams; export declare const ParticleTargetRepresentationParams: { structure: PD.Group, "grid"> | PD.NamedParams, "clustering">; resolution: number; adjustResolution: boolean; blobShape: PD.NamedParams, "ellipsoid"> | PD.NamedParams, "sphericalHarmonics">; radiusOffset: number; smoothness: number; sizeFactor: number; detail: number; tryUseImpostor: boolean; solidInterior: boolean; type: string; doubleSided: boolean; flipSided: boolean; flatShaded: boolean; ignoreLight: boolean; celShaded: boolean; xrayShaded: boolean | "inverted"; transparentBackfaces: "off" | "on" | "opaque"; bumpFrequency: number; bumpAmplitude: number; interior: PD.Normalize<{ color: /*elided*/ any; colorStrength: /*elided*/ any; substance: /*elided*/ any; substanceStrength: /*elided*/ any; }>; animation: PD.Normalize<{ wiggleMode: /*elided*/ any; wiggleSpeed: /*elided*/ any; wiggleAmplitude: /*elided*/ any; wiggleFrequency: /*elided*/ any; tumbleSpeed: /*elided*/ any; tumbleAmplitude: /*elided*/ any; tumbleFrequency: /*elided*/ any; }>; alpha: number; quality: "auto" | "medium" | "high" | "low" | "custom" | "highest" | "higher" | "lower" | "lowest"; material: PD.Normalize<{ metalness: number; roughness: number; bumpiness: number; }>; clip: PD.Normalize<{ variant: /*elided*/ any; objects: /*elided*/ any; }>; emissive: number; density: number; instanceGranularity: import("../../../../mol-geo/geometry/base.js").InstanceGranularityValue; renderMerged: import("../../../../mol-geo/geometry/base.js").RenderMergedValue; lod: import("../../../../mol-math/linear-algebra.js").Vec3; cellSize: number; batchSize: number; clipPrimitive: boolean; approximate: boolean; alphaThickness: number; lodLevels: PD.Normalize<{ minDistance: number; maxDistance: number; overlap: number; stride: number; scaleBias: number; }>[]; }>>; shape: PD.Group; animation: PD.Normalize<{ wiggleMode: /*elided*/ any; wiggleSpeed: /*elided*/ any; wiggleAmplitude: /*elided*/ any; wiggleFrequency: /*elided*/ any; tumbleSpeed: /*elided*/ any; tumbleAmplitude: /*elided*/ any; tumbleFrequency: /*elided*/ any; }>; alpha: number; quality: "auto" | "medium" | "high" | "low" | "custom" | "highest" | "higher" | "lower" | "lowest"; material: PD.Normalize<{ metalness: number; roughness: number; bumpiness: number; }>; clip: PD.Normalize<{ variant: /*elided*/ any; objects: /*elided*/ any; }>; emissive: number; density: number; instanceGranularity: import("../../../../mol-geo/geometry/base.js").InstanceGranularityValue; renderMerged: import("../../../../mol-geo/geometry/base.js").RenderMergedValue; lod: import("../../../../mol-math/linear-algebra.js").Vec3; cellSize: number; batchSize: number; scaleByRadius: boolean; }>>; volume: PD.Group | Readonly<{ kind: "relative"; relativeValue: number; }>; doubleSided: boolean; flipSided: boolean; flatShaded: boolean; ignoreLight: boolean; celShaded: boolean; xrayShaded: boolean | "inverted"; transparentBackfaces: "off" | "on" | "opaque"; bumpFrequency: number; bumpAmplitude: number; interior: PD.Normalize<{ color: /*elided*/ any; colorStrength: /*elided*/ any; substance: /*elided*/ any; substanceStrength: /*elided*/ any; }>; animation: PD.Normalize<{ wiggleMode: /*elided*/ any; wiggleSpeed: /*elided*/ any; wiggleAmplitude: /*elided*/ any; wiggleFrequency: /*elided*/ any; tumbleSpeed: /*elided*/ any; tumbleAmplitude: /*elided*/ any; tumbleFrequency: /*elided*/ any; }>; alpha: number; quality: "auto" | "medium" | "high" | "low" | "custom" | "highest" | "higher" | "lower" | "lowest"; material: PD.Normalize<{ metalness: number; roughness: number; bumpiness: number; }>; clip: PD.Normalize<{ variant: /*elided*/ any; objects: /*elided*/ any; }>; emissive: number; density: number; instanceGranularity: import("../../../../mol-geo/geometry/base.js").InstanceGranularityValue; renderMerged: import("../../../../mol-geo/geometry/base.js").RenderMergedValue; lod: import("../../../../mol-math/linear-algebra.js").Vec3; cellSize: number; batchSize: number; clipPrimitive: boolean; approximate: boolean; alphaThickness: number; lodLevels: PD.Normalize<{ minDistance: number; maxDistance: number; overlap: number; stride: number; scaleBias: number; }>[]; }>>; instanceGranularity: PD.BooleanParam; lodLevels: PD.ObjectList>; alpha: PD.Numeric; material: PD.Group>; clip: PD.Group[]; }>>; emissive: PD.Numeric; density: PD.Numeric; renderMerged: PD.Select; lod: PD.Vec3; cellSize: PD.Numeric; batchSize: PD.Numeric; }; export type ParticleTargetRepresentationParams = typeof ParticleTargetRepresentationParams; export type ParticleTargetRepresentationProps = PD.Values; /** * The flat props used for a single target: the common props with the group of the target's * kind merged on top. Only the params of the matching kind are present, so kind-specific * props are optional here. */ export type ParticleTargetProps = PD.Values & Partial> & Partial> & Partial>; /** Resolves the flat props for a single target, see `createParticleTargetPropsProvider`. */ export type ParticleTargetPropsProvider = (target: ParticleTarget) => ParticleTargetProps; /** * Create a provider that flattens the representation props for a single target: common props * with the group for the target's kind merged on top, with quality-derived props resolved * against the target's own data (e.g. sphere detail from the number of spheres). * * The per-kind flattening is done once up front and the quality resolution is memoized per * target data object, since targets are commonly shared between many particles and the work * would otherwise be repeated for every target on every update. * * Create one provider per update; it holds the props by value. */ export declare function createParticleTargetPropsProvider(props: ParticleTargetRepresentationProps): ParticleTargetPropsProvider; /** * Build per-instance transforms placing the target geometry at each of `indices`. * * The geometry is built at its actual coordinates, centered at `invariantBoundingSphere.center` * rather than at the origin. Each particle transform is therefore composed with a pre-translation * by `-center` so that the geometry renders centred on the particle position. When `scaleByRadius` * is set (e.g. for shape targets), each instance is additionally scaled by the particle radius; * the scaling is applied before the center subtraction so the basis already accounts for it. * The bounding sphere used for grid/culling purposes is likewise inflated by the largest radius * in play, since it is otherwise unaware of the per-instance scale (see `calcInstanceGrid`). */ export declare function createTargetParticleTransform(particles: ParticleList, indices: OrderedSet, invariantBoundingSphere: Sphere3D, cellSize: number, batchSize: number, scaleByRadius: boolean, transformData?: TransformData): TransformData; export declare function createTargetGeometry(ctx: VisualContext, target: ParticleTarget, theme: Theme, props: ParticleTargetProps, webgl: WebGLContext | undefined, existing?: Geometry): Geometry | Promise; export declare function targetGeometryPropsChanged(target: ParticleTarget, oldProps: ParticleTargetProps, newProps: ParticleTargetProps, webgl: WebGLContext | undefined): boolean; export declare function targetMustRecreate(target: ParticleTarget, oldProps: ParticleTargetProps, newProps: ParticleTargetProps): boolean; /** * A single visual for one target (structure or shape), managing one renderObject. * Geometry = the reference geometry in its invariant frame. * Instances = the particles of this target, given as indices into the unfiltered `ParticleList`. */ export interface TargetVisual { renderObject: GraphicsRenderObject | undefined; geometryVersion: number; /** Maps local instance index → global particle index in the unfiltered ParticleList. */ particleIndices: OrderedSet | undefined; createOrUpdate(ctx: VisualContext, theme: Theme, props: ParticleTargetProps, particles: ParticleList, particleIndices: OrderedSet, target: ParticleTarget): Promise; mark(loci: ModelLoci, action: MarkerAction): boolean; destroy(): void; } export declare function createTargetVisual(_targetId: number, materialId: number, webgl?: WebGLContext): TargetVisual;