UNPKG

x_ite

Version:

X_ITE X3D Browser, view and manipulate X3D, VRML, glTF and other 3D sources in HTML.

1,056 lines (1,007 loc) 941 kB
// Type definitions for X3D // Project: X_ITE // Definitions by: // * Glen Whitney <https://github.com/gwhitney>, // * Holger Seelig <https://github.com/create3000> // * Elmar <https://github.com/krisutofu> export = X3D; type X3D = typeof X3D; /** * There is the X3D object which is globally available, it expects one function handler that is called when the browsers (\<x3d-canvas\> elements) are ready, and a second function handler, that is called if an error occurred. These two arguments are optional. The return value of the X3D function is a Promise, which can be used instead of the arguments. */ declare function X3D(onfulfilled?: () => void, onrejected?: (error: Error) => void): Promise <void>; /** * Namespace for all X3D objects. */ declare namespace X3D { /** * In X_ITE's case, the `X3D` function object is the main entry function. If you need to use another JavaScript library alongside X_ITE, return control of the `X3D` function object back to the other library with a call to `X3D .noConflict ()`. Old references of `X3D` function object are saved during X_ITE initialization; `X3D .noConflict ()` simply restores them. The return value is the `X3D` function object itself. */ function noConflict(): X3D; /** * Creates a new x3d-canvas DOM element, initializes it and returns it. Throws an exception if the browser object cannot be created. */ function createBrowser(): X3DCanvasElement; /** * The selector argument must be a string containing a valid CSS selector expression to match elements against, or a valid X3DCanvasElement. If no selector was given, »x3d-canvas« is used as selector string. The return value is the appropriate X3DBrowser object. */ function getBrowser(selector?: string | X3DCanvasElement): X3DBrowser; // namespace until end of file! /** * The X3DCanvasElement, \<x3d-canvas\>, is the main element that displays the X3D content. It defines some functions to be used with this object. */ class X3DCanvasElement extends HTMLElement { /** * A reference to the X3DBrowser object that is associated with this element. */ readonly browser: X3DBrowser; /** * See https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/captureStream. */ captureStream (frameRate?: number): MediaStream; /** * See https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob. */ toBlob (callback: (blob: Blob) => void, type?: string, quality?: number): void; /** * See https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toDataURL. */ toDataURL (type?: string, encoderOptions?: number): string; } /** * This section lists the methods available in the *browser* object, which allows scripts to get and set browser information. */ class X3DBrowser extends X3DObject { /** * A browser-implementation specific string describing the browser. This property is read-only. */ readonly name: string; /** * A browser-implementation specific string describing the browser version. This property is read-only. */ readonly version: string; /** * If provided, the URL to the entity that wrote this browser. This property is read-only. */ readonly providerURL: string; /** * The current speed of the avatar in m/s. This property is read-only. */ readonly currentSpeed: number; /** * The current frame rate in frames per second. This property is read-only. */ readonly currentFrameRate: number; /** * A user-defined String which can be read and written. */ description: string; /** * Returns the list of all profiles that are supported by this browser. This property is read-only. */ readonly supportedProfiles: ProfileInfoArray; /** * Returns a list of all components that are supported by this browser. This property is read-only. */ readonly supportedComponents: ComponentInfoArray; /** * Returns a list of all concrete node classes that are supported by this browser. This property is read-only. */ readonly concreteNodes: ConcreteNodesArray; /** * Returns a list of all abstract node classes that are supported by this browser. This property is read-only. */ readonly abstractNodes: AbstractNodesArray; /** * Returns a list of all field type classes that are supported by this browser. This property is read-only. */ readonly fieldTypes: FieldTypesArray; /** * A String value which can be read and written, containing the URL against which relative URLs are resolved. By default, this is the address of the web page itself. Although this feature is rarely needed, it can be useful when loading a `data:` or `blob:` URL with `Browser.loadURL`, or when using `Browser.createX3DFromString`. The value of *baseURL* will only be used with the external browser. */ baseURL: string; /** * The real type of this class is dependent on whether the user code is inside a prototype instance or not. If the user code is inside a prototype instance the property represent an X3DExecutionContext otherwise it represent an X3DScene. This property is read-only. */ readonly currentScene: X3DScene; /* * Returns the active layer, if any. The active layer is the layer on which navigation takes place. This property is read-only. */ readonly activeLayer: X3DLayerNodeProxy | null; /* * Returns the bound NavigationInfo node in the active layer, if any. This property is read-only. */ readonly activeNavigationInfo: NavigationInfoProxy | null; /* * Returns the bound X3DViewpointNode in the active layer, if any. This property is read-only. */ readonly activeViewpoint: X3DViewpointNodeProxy | null; /** * Returns a reference to the corresponding ContextMenu. This property is read-only. */ readonly contextMenu: ContextMenu; /** * Returns a reference to the corresponding X3DCanvasElement. This property is read-only. */ readonly element: X3DCanvasElement; /** * The `getSupportedProfile` service returns a ProfileInfo object of the named profile from the `supportedProfiles` array. The parameter is the name of a profile from which to fetch the declaration. The browser only returns a ProfileInfo object if it supports the named profile. If it does not support the named profile, an error is thrown. */ getSupportedProfile (name: string): ProfileInfo; /** * The `getSupportedComponent` service returns a ComponentInfo object of the named component from the `supportedComponents` array. The parameter is the name of a component from which to fetch the declaration. The browser only returns a ComponentInfo object if it supports the named component. If it does not support the component, an error is thrown. */ getSupportedComponent (name: string): ComponentInfo; /** * The `getProfile` service returns a ProfileInfo object of the named profile. The parameter is the name of a profile from which to fetch the declaration. The browser only returns a ProfileInfo object if it supports the named profile. If it does not support the named profile, an error is thrown. */ getProfile (name: string): ProfileInfo; /** * The `getComponent` service returns a ComponentInfo object of the named component. The first parameter is the name of a component and the second the level from which to fetch the declaration. The browser only returns a ComponentInfo object if it supports the named component and the requested level. If it does not support the component at the level desired, an error is thrown. If level is omitted, it defaults to the highest supported level of this component. */ getComponent (name: string, level?: number): ComponentInfo; /** * The `createScene` service creates a new empty scene that conforms to the given profile and component declarations. The Promise resolves when all components are loaded. */ createScene (profile: ProfileInfo, ... components: ComponentInfo []): Promise<X3DScene>; /** * Loads all components, external and internal, specified by `args`. If the argument is a `String`, the name of a component must be given. */ loadComponents (... args: Array <X3DScene | ProfileInfo | ComponentInfoArray | ComponentInfo | string>): Promise <void>; /** * Replace the current world with this new scene that has been loaded or constructed from somewhere. A Promise is returned that will be resolved when the scene is completely loaded. */ replaceWorld (scene: X3DScene): Promise <void>; /** * The string may be any valid X3D content in any language supported by the browser implementation. If the browser does not support the content encoding the appropriate exception will be thrown. */ createX3DFromString (x3dSyntax: string): Promise <X3DScene>; /** * Parse the passed URL into an X3D scene and return a Promise that resolves to an X3DScene object. */ createX3DFromURL (url: MFString): Promise <X3DScene>; /** * Parse the passed URL into an X3D scene. When complete send the passed event to the passed node. The event is a string with the name of an MFNode inputOnly field of the passed node. */ createX3DFromURL (url: MFString, node: SFNode, fieldName: string): void; /** * Load the passed URL, using the passed parameter string to possibly redirect it to another frame. If the destination is the frame containing the current scene, this method may never return. The return value is a Promise object, that is resolved when the new scene is loaded. */ loadURL (url: MFString, parameter?: MFString): Promise <void>; /** * Imports an X3D XML DOM document or fragment, converts it, and returns a Promise that resolves to an X3DScene object. */ importDocument (dom: HTMLElement | string): Promise <X3DScene>; /** * Imports an X3D JSON document or fragment, converts it, and returns a Promise that resolves to an X3DScene object. */ importJS (json: JSONObject | string): Promise <X3DScene>; /** * Returns a browser property with the corresponding *name*. */ getBrowserProperty (name: BrowserProperty): boolean; /** * Returns a browser option with the corresponding *name*. */ getBrowserOption <T extends keyof BrowserOption> (name: T): BrowserOption [T]; /** * Sets a browser option with the corresponding *name* to the given value. */ setBrowserOption <T extends keyof BrowserOption> (name: T, value: BrowserOption [T]): void; /** * Returns a rendering property with the corresponding *name*. */ getRenderingProperty <T extends keyof RenderingProperty> (name: T): RenderingProperty [T]; /** * Returns context menu object. */ getContextMenu (): ContextMenu; /** * Adds a browser *callback* function associated with *key,* where *key* can be of any type. The callback function is called when a browser event has been occurred. If *event* is omitted, the callback function is added to all events. The signature of the callback function is `function (event)`, where event can be any value listed below: * * - X3DConstants .CONNECTION_ERROR * - X3DConstants .BROWSER_EVENT * - X3DConstants .INITIALIZED_EVENT * - X3DConstants .SHUTDOWN_EVENT * - X3DConstants .INITIALIZED_ERROR */ addBrowserCallback (key: any, event: number, callback: (event: number) => void): void; addBrowserCallback (key: any, callback: (event: number) => void): void; /** * Removes a browser callback function associated with *key* and *event*. If *event* is omitted, all callback associated whit key are removed. */ removeBrowserCallback (key: any, event?: number): void; /** * Modifies the current view to show the entire visible scene within *transitionTime* seconds. If *layer* is omitted, the active layer is used. */ viewAll (layer?: X3DLayerNodeProxy, transitionTime?: number): void; /** * Changes the bound viewpoint node to the next viewpoint in the list of user viewpoints of *layer*. If *layer* is omitted, the active layer is used. */ nextViewpoint (layer?: X3DLayerNodeProxy): void; /** * Changes the bound viewpoint node to the previous viewpoint in the list of user viewpoints of *layer*. If *layer* is omitted, the active layer is used. */ previousViewpoint (layer?: X3DLayerNodeProxy): void; /** * Changes the bound viewpoint node to the first viewpoint in the list of user viewpoints of *layer*. If *layer* is omitted, the active layer is used. */ firstViewpoint (layer?: X3DLayerNodeProxy): void; /** * Changes the bound viewpoint node to the last viewpoint in the list of user viewpoints of *layer*. If *layer* is omitted, the active layer is used. */ lastViewpoint (layer?: X3DLayerNodeProxy): void; /** * Changes the bound viewpoint node to the viewpoint named *name*. The viewpoint must be available in *layer*. If *layer* is omitted, the active layer is used. */ changeViewpoint (layer: X3DLayerNodeProxy, name: string): void; changeViewpoint (name: string): void; /** * Changes the default cursor images to the ones specified in *cursorTypes*. You can omit properties if you want to use the default cursor image for this action. The values can be any valid CSS cursor. */ setCursors (cursorTypes: CursorTypes): void; /** * Constrains a *translation*, which should be added to the position of the active viewpoint, to a possible value that avatar can move to. If the avatar reaches or intersects with an obstacle the translation is either constrained to slide along the wall or to stop. If *layer* is omitted, the active layer is used. */ constrainTranslation (layer: X3DLayerNodeProxy, translation: SFVec3d | SFVec3f): SFVec3f; constrainTranslation (translation: SFVec3d | SFVec3f): SFVec3f; /** * Returns the closest collidable object when looked in *direction*, measured from the active viewpoint position. The maximum detection radius is `2 * avatarHeight` (where *avatarHeight* is the second value of NavigationInfo *avatarSize*). Compare *distance* with *collisionRadius* (first value of NavigationInfo *avatarSize*) to detect if a collision with an object occurs. If *layer* is omitted, the active layer is used. * * The return value is an object with the properties *node*, *distance* and *normal*. */ getClosestObject (layer: X3DLayerNodeProxy, direction: SFVec3d | SFVec3f): ClosestObject; getClosestObject (direction: SFVec3d | SFVec3f): ClosestObject; /** * Start processing events. */ beginUpdate (): void; /** * Stop processing events. */ endUpdate (): void; /** * Prints *args* to the browser's console without a newline character. Successive calls to this function append the descriptions on the same line. The output is the implicit call to the object's `toString ()` function. */ print (... args: any []): void; /** * Prints *args* to the browser’s console, inserting a newline character after the output. Successive calls to this function will result in each output presented on separate lines. The output is the implicit call to the object’s `toString ()` function. */ printLn (... args: any []): void; /** * Returns the X3D VRML-encoded string of current scene that, if parsed as the value of `createX3DFromString ()` of X3DBrowser, produce this scene. */ toVRMLString (options?: ToStringOptions): string; /** * Returns the X3D XML-encoded string of current scene that, if parsed as the value of `createX3DFromString ()` of X3DBrowser, produce this scene. * * For *options* see `X3DScene.toVRMLString`. */ toXMLString (options?: ToStringOptions): string; /** * Returns the X3D JSON-encoded string of current scene that, if parsed as the value of `createX3DFromString ()` of X3DBrowser, produce this scene. * * For *options* see `X3DScene.toVRMLString`. */ toJSONString (options?: ToStringOptions): string; // VRML methods /** * A browser-implementation specific string describing the browser. */ getName (): string; /** * A browser-implementation specific string describing the browser version. */ getVersion (): string; /** * The current speed of the avatar in m/s. */ getCurrentSpeed (): number; /** * The current frame rate in frames per second. */ getCurrentFrameRate (): number; /** * A string containing the URL of this execution context. */ getWorldURL (): string; /** * Replace the current world with this new nodes that has been loaded or constructed from somewhere. */ replaceWorld (nodes: MFNode): Promise <void>; /** * The string may be any valid VRML content. */ createVrmlFromString (vrmlSyntax: string): MFNode; /** * Parse the passed URL into an VRML scene. When complete send the passed event to the passed node. The event is a string with the name of an MFNode inputOnly field of the passed node. */ createVrmlFromURL (url: MFString, node: SFNode, fieldName: string): void; /** * Add a route in the current scene from the passed *sourceField* to the passed *destinationField*. */ addRoute (sourceNode: SFNode, sourceField: string, destinationNode: SFNode, destinationField: string): void; /** * Remove the route in the current scene between the passed *sourceField* and passed *destinationField*, if one exists. */ deleteRoute (sourceNode: SFNode, sourceField: string, destinationNode: SFNode, destinationField: string): void; /** * Load the passed URL, using the passed parameter string to possibly redirect it to another frame. If the destination is the frame containing the current scene, this method may never return. */ loadURL (url: MFString, parameter?: MFString): void; /** * A user-defined String. */ setDescription (description: string): void; } type JSONValue = | string | number | boolean | null | JSONValue [] | { [key: string]: JSONValue }; interface JSONObject { [k: string]: JSONValue; } type BrowserProperty = "ABSTRACT_NODES" | "CONCRETE NODES" | "EXTERNAL_INTERACTIONS" | "PROTOTYPE_CREATE" | "DOM_IMPORT" | "XML_ENCODING" | "CLASSIC_VRML_ENCODING" | "BINARY_ENCODING"; type BrowserOption = { SplashScreen: boolean, Dashboard: boolean, Rubberband: boolean, EnableInlineViewpoints: boolean, Antialiased: boolean, TextureQuality: QualityLevelTypes, PrimitiveQuality: QualityLevelTypes, QualityWhenMoving: QualityLevelTypes | "SAME", Shading: ShadingTypes, MotionBlur: boolean, // Additional options: AlwaysUpdateGeometries: boolean, AutoUpdate: boolean, Cache: boolean, ColorSpace: ColorSpaceTypes, ContentScale: number, ContextMenu: boolean, Debug: boolean, Exposure: number, Gravity: number, LoadUrlObjects: boolean, LogarithmicDepthBuffer: boolean, MaximumFrameRate: number, MetadataReference: string, Multisampling: number, Mute: boolean, Notifications: boolean, OrderIndependentTransparency: boolean, StraightenHorizon: boolean, TextCompression: "CHAR_SPACING" | "SCALING", Timings: boolean, ToneMapping: ToneMappingTypes, WallFriction: number, XRSessionMode: "NONE" | "IMMERSIVE_VR" | "IMMERSIVE_AR" | "INLINE", }; type ColorSpaceTypes = "SRGB" | "LINEAR_WHEN_PHYSICAL_MATERIAL" | "LINEAR"; type QualityLevelTypes = "LOW" | "MEDIUM" | "HIGH"; type ShadingTypes = "POINT" | "WIREFRAME" | "FLAT" | "GOURAUD" | "PHONG"; type ToneMappingTypes = "NONE" | "ACES_NARKOWICZ" | "ACES_HILL" | "ACES_HILL_EXPOSURE_BOOST" | "KHR_PBR_NEUTRAL"; type RenderingProperty = { Shading: ShadingTypes, MaxTextureSize: number, TextureUnits: number, MaxLights: number, Antialiased: boolean, ColorDepth: number, TextureMemory: number, ContentScale: number, LogarithmicDepthBuffer: boolean, MaxAnisotropicDegree: number, MaxSamples: number, Multisampling: number, PixelsPerPoint: number, XRSession: boolean, }; type ClosestObject = { node: X3DShapeNodeProxy | null, distance: number, normal: SFVec3f | null, frontFacing: boolean, }; type CursorTypes = { DEFAULT: string; GRABBING: string; MOVE: string; POINTER: string; WAIT: string; }; class ContextMenu { userMenu: UserMenuCallback; getUserMenu (): UserMenuCallback; setUserMenu (cb: UserMenuCallback): void; } type ContextMenuOptions = { selector: string, items: UserMenuItems, appendTo?: string | HTMLElement, triggers: string, hideOnSecondTrigger?: boolean, selectableSubMenu?: boolean, reposition?: boolean, delay?: number, autoHide?: boolean, zindex?: number | (($trigger: string, options: ContextMenuOptions) => number) className?: string, classNames?: Record <string, string>, animation?: {duration: number, show: string, hide: string}, events?: Record <string, (options: ContextMenuOptions) => boolean>, position?: (options: unknown, x?: number|string, y?: number|string) => void, determinePosition?: (menu: unknown) => void, callback?: MenuCallback, build?: ($triggerElement: unknown, e: Event) => ContextMenuOptions, itemClickEvent?: string, }; type UserMenuCallback = (browser: X3DBrowser) => UserMenuItems; type UserMenuItems = Record <string, UserMenuItem>; type MenuCallback = (itemKey: string, options: ContextMenuOptions, event: Event) => (boolean | void); type MenuIconCallback = (options: ContextMenuOptions, $itemElement: HTMLElement, itemKey: string, item: unknown) => string; type MenuBoolCallback = (itemKey: string, options: ContextMenuOptions) => boolean; type UserMenuItem = { name: string, isHtmlName?: boolean, callback: MenuCallback, className?: string, icon?: string | MenuIconCallback, disabled?: boolean | MenuBoolCallback, visible?: boolean | MenuBoolCallback, type?: string, events?: Record <string, unknown>, value?: string, selected?: boolean | string, radio?: string, options?: Record <string|number, string>, height?: number, items?: UserMenuItems, accesskey?: string, dataAttr?: Record <string, string>, }; /** * A scene is an extension of the execution context services with additional services provided. */ class X3DScene extends X3DExecutionContext { /** * When used inside a prototype instance, this property is not writable. The MFNode object instance is also not be writable. When used anywhere else, it is writable. */ rootNodes: MFNode; /** * A reference to the ExportedNodesArray object used by this execution context. This property is read-only. */ readonly exportedNodes: ExportedNodesArray; /** * Replaces the profile of this scene by the given profile. A profile of `null` is equivalent to a 'Full' profile. */ setProfile (profile: ProfileInfo | null): void; /** * Adds the component to the list of components. */ addComponent (component: ComponentInfo): void; /** * Updates the component. */ updateComponent (component: ComponentInfo): void; /** * Removes the component with the given name. */ removeComponent (name: string): void; /** * Updates the *name* and the *conversion factor* of the unit specified by *category*. */ updateUnit (category: string, name: string, conversionFactor: number): void; /** * Returns the UnitInfo object with the given *category*. */ getUnit (category: string): UnitInfo; /** * Returns the metadata values array associated with *name*. */ getMetaData (name: string): string []; /** * Creates or updates the metadata with *name* and *value.* */ setMetaData (name: string, value: string | string []): void; /** * Adds the metadata with *name* and *value.* */ addMetaData (name: string, value: string | string []): void; /** * Removes the metadata *name.* */ removeMetaData (name: string): void; /** * Adds *node* to the list of root nodes. If the node already exists, the function silently returns. */ addRootNode (node: SFNode): void; /** * Removes *node* from the list of root nodes. */ removeRootNode (node: SFNode): void; /** * Returns a reference to the node with the exported name *exportedName.* If no exported node *exportedName* is found an exception is thrown. */ getExportedNode (exportedName: string): SFNode; /** * Creates the exported node *exportedName.* */ addExportedNode (exportedName: string, node: SFNode): void; /** * Creates or updates the exported node *exportedName.* */ updateExportedNode (exportedName: string, node: SFNode): void; /** * Removes the exported node *exportedName.* */ removeExportedNode (exportedName: string): void; /** * Returns the X3D VRML-encoded string that, if parsed as the value of `createX3DFromString ()` of X3DBrowser, produce this scene. * * #### Options * * An object with one or more of these properties: * * - **style:** String, output style, one of: **"TIDY"**, "COMPACT", "SMALL", "CLEAN" * - **indent:** String, initial indent, default: "" * - **precision:** Integer, float precision, default: 7 * - **doublePrecision:** Integer, double precision, default: 15 * - **html:** Boolean, HTML style, default: false * - **closingTags:** Boolean, use closing tags, default: false */ toVRMLString (options?: ToStringOptions): string; /** * Returns the X3D XML-encoded string that, if parsed as the value of `createX3DFromString ()` of X3DBrowser, produce this scene. * * For *options* see `X3DScene.toVRMLString`. */ toXMLString (options?: ToStringOptions): string; /** * Returns the X3D JSON-encoded string that, if parsed as the value of `createX3DFromString ()` of X3DBrowser, produce this scene. * * For *options* see `X3DScene.toVRMLString`. */ toJSONString (options?: ToStringOptions): string; } /** * This section lists the methods available in the X3DExecutionContext object, which allows scripts to get access to the scene graph. */ class X3DExecutionContext extends X3DObject { /** * The string represent the basic specification version used by the parsed file in decimal format. For example, a scene conforming to this specification returns a value such as "4.0". This property is read-only. */ readonly specificationVersion: string; /** * The encoding is represented as a string that describes the data encoding used. Valid values are "ASCII", "VRML", "XML", "BINARY", "SCRIPTED", "BIFS", "NONE". This property is read-only. * * Additional valid values are “GLTF”, “OBJ”, “STL”, “PLY”, “SVG”. */ readonly encoding: "ASCII" | "VRML" | "XML" | "JSON" | "BINARY" | "SCRIPTED" | "BIFS" | "NONE" | "GLTF" | "OBJ" | "STL" | "PLY" | "SVG"; /** * A reference to the ProfileInfo object used by this execution context. A value of `null` implies profile `Full`. This property is read-only. */ readonly profile: ProfileInfo | null; /** * A reference to the ComponentInfoArray object used by this execution context. This property is read-only. */ readonly components: ComponentInfoArray; /** * A string containing the URL of this execution context. This property is read-only. */ readonly worldURL: string; /** * A string containing the URL against which relative URLs are resolved. This property is read-only. */ readonly baseURL: string; /** * A reference to the UnitInfoArray object used by this execution context. This property is read-only. */ readonly units: UnitInfoArray; /** * A reference to the NamedNodesArray object used by this execution context. This property is read-only. */ readonly namedNodes: NamedNodesArray; /** * A reference to the ImportedNodesArray object used by this execution context. This property is read-only. */ readonly importedNodes: ImportedNodesArray; /** * When used inside a prototype instance, this property is not writable. The MFNode object instance is also not be writable. When used anywhere else, it is writable. */ readonly rootNodes: MFNode; /** * A reference to the ProtoDeclarationArray object used by this execution context. This property is read-only. */ readonly protos: ProtoDeclarationArray; /** * A reference to the ExternProtoDeclarationArray object used by this execution context. This property is read-only. */ readonly externprotos: ExternProtoDeclarationArray; /** * A reference to the RouteArray object used by this execution context. This property is read-only. */ readonly routes: RouteArray; /** * Creates a new default instance of the node given by the *typeName* string containing the name of an X3D node type. */ createNode <T extends keyof ConcreteNodeTypes> (typeName: T): ConcreteNodeTypes [T]; /** * Creates a new default instance of the prototype given by the *protoName* string containing the name of an prototype or extern prototype of this execution context. */ createProto (protoName: string): X3DPrototypeInstanceProxy; /** * Returns a reference to the named node named by the string *name.* If no named node with the name *name* exists an exception is throw. */ getNamedNode (name: string): SFNode; /** * Creates the named node referenced by *name.* This will give *node* a new name. */ addNamedNode (name: string, node: SFNode): void; /** * Creates or updates the named node referenced by *name.* This will give *node* a new name. */ updateNamedNode (name: string, node: SFNode): void; /** * Removes the named node *name.* */ removeNamedNode (name: string): void; /** * Returns a reference to the imported node named by the string *importedName.* If no imported node with the imported name *importedName* exists an exception is throw. */ getImportedNode (importedName: string): SFNode; /** * Creates the imported node *importedName.* If not *importedName* is given *exportedName* is used as imported name. The node to import must be an exported node named by *exportedName* in *inlineNode.* */ addImportedNode (inlineNode: SFNode, exportedName: string, importedName?: string): void; /** * Creates or updates the imported node *importedName.* If not *importedName* is given *exportedName* is used as imported name. The node to import must be an exported node named by *exportedName* in *inlineNode.* */ updateImportedNode (inlineNode: SFNode, exportedName: string, importedName?: string): void; /** * Removes the imported node *importedName.* */ removeImportedNode (importedName: string): void; /** * Add a route from the passed *sourceField* to the passed *destinationField.* The return value is an X3DRoute object. */ addRoute (sourceNode: SFNode, sourceField: string, destinationNode: SFNode, destinationField: string): X3DRoute; /** * Remove the route if it is connected. */ deleteRoute (route: X3DRoute): void; /** * Remove the route between the passed *sourceField* and passed *destinationField*, if one exists. */ deleteRoute (sourceNode: SFNode, sourceField: string, destinationNode: SFNode, destinationField: string): void; } /** * ConcreteNodesArray is an object that represents an array of classes derived from X3DNode. This is a read-only object. Individual elements of the array can be referenced using the standard C-style dereferencing operator (e.g. *concreteNodesArrayName*[*index*], where *index* is an integer-valued expression with 0\<=*index*\<length and length is the number of elements in the array). */ class ConcreteNodesArray extends X3DInfoArray <X3DConcreteNode> { } /** * The X3DConcreteNode interface defines an interface for concrete node types, it extends the X3DAbstractNode interface. The object consists solely of read-only properties. It does not define any additional functions. */ interface X3DConcreteNode extends X3DAbstractNode { /** * The default container field name for this node. This property is read-only. */ readonly containerField: string; /** * Returns an array with two strings defining the first version and last version where this node is specified. This property is read-only. */ readonly specificationRange: { readonly from: string, readonly to: string, }; /** * Returns a list of fields defined for the SFNode object. */ readonly fieldDefinitions: FieldDefinitionArray; } /** * AbstractNodesArray is an object that represents an array of classes derived from X3DNode. This is a read-only object. Individual elements of the array can be referenced using the standard C-style dereferencing operator (e.g. *abstractNodesArrayName*[*index*], where *index* is an integer-valued expression with 0\<=*index*\<length and length is the number of elements in the array). */ class AbstractNodesArray extends X3DInfoArray <X3DAbstractNode> { } /** * The X3DAbstractNode interface defines an interface for concrete node types. The object consists solely of read-only properties. It does not define any additional functions. */ interface X3DAbstractNode { /** * The node type name for this class. This property is read-only. */ readonly typeName: string; /** * Returns an object with two properties *name* and *level* which can be used to get a ComponentInfo object from the X3D browser. This property is read-only. */ readonly componentInfo: { readonly name: string, readonly level: number, }; } /** * FieldTypesArray is an object that represents an array of classes derived from X3DField. This is a read-only object. Individual elements of the array can be referenced using the standard C-style dereferencing operator (e.g. *FieldTypesArray*[*index*], where *index* is an integer-valued expression with 0\<=*index*\<length and length is the number of elements in the array). */ class FieldTypesArray extends X3DInfoArray <X3DField> { } /** * ProfileInfoArray is an object that represents an array of ProfileInfo objects. This is a read-only object. Individual elements of the array can be referenced using the standard C-style dereferencing operator (e.g. *profileInfoArrayName*[*index*], where *index* is an integer-valued expression with 0\<=*index*\<length and length is the number of elements in the array). */ class ProfileInfoArray extends X3DInfoArray <ProfileInfo> { } /** * This object stores information about a particular X3D profile. */ class ProfileInfo extends X3DObject { /** * A string of the formal name of this profile. This property is read-only. */ readonly name: string; /** * A generic, freeform title string provided by the browser manufacturer. This property is read-only. */ readonly title: string; /** * If provided, the URL to the entity that wrote this component. This assumes that extensions to the browser may not necessarily be provided by the browser writer's themselves. This property is read-only. */ readonly providerURL: string; /** * An ComponentInfoArray object of the ComponentInfo object instances that make up this profile. This property is read-only. */ readonly components: ComponentInfoArray } /** * ComponentInfoArray is an object that represents an array of ComponentInfo objects. This is a read-only object. Individual elements of the array can be referenced using the standard C-style dereferencing operator (e.g. *componentInfoArrayName*[*index*], where *index* is an integer-valued expression with 0\<=*index*\<length and length is the number of elements in the array). */ class ComponentInfoArray extends X3DInfoArray <ComponentInfo> { } /** * The ComponentInfo object stores information about a particular X3D component. The object consists solely of read-only properties. It does not define any additional functions. */ class ComponentInfo extends X3DObject { /** * A string of the formal name of this profile. This property is read-only. */ readonly name: string; /** * A number of the level of support of this instance. This property is read-only. */ readonly level: number; /** * A generic, freeform title string provided by the browser manufacturer. This property is read-only. */ readonly title: string; /** * If provided, the URL to the entity that wrote this component. This assumes that extensions to the browser may not necessarily be provided by the browser writer's themselves. This property is read-only. */ readonly providerURL: string; } /** * UnitInfoArray is an object that represents an array of UnitInfo objects. This is a read-only object. Individual elements of the array can be referenced using the standard C-style dereferencing operator (e.g. *unitInfoArrayName*[*index*], where *index* is an integer-valued expression with 0\<=*index*\<length and length is the number of elements in the array). */ class UnitInfoArray extends X3DInfoArray <UnitInfo> { } /** * The UnitInfo object stores information about a particular unit declaration. The object consists solely of read-only properties. It does not define any additional functions. */ class UnitInfo extends X3DObject { /** * The category of default unit being modified as defined in the table. This property is read-only. */ readonly category: string; /** * A string of the name assigned to the new default unit. This property is read-only. */ readonly name: string; /** * The double-precision number needed to convert from the new default unit to the initial default unit. This property is read-only. */ readonly conversionFactor: number; } /** * NamedNodesArray is an object that represents an array of SFNode objects. This is a read-only object. Individual elements of the array can be referenced using the standard C-style dereferencing operator (e.g. *namedNodesArrayName*[*index*], where *index* is an integer-valued expression with 0\<=*index*\<length and length is the number of elements in the array). */ class NamedNodesArray extends X3DInfoArray <SFNode> { } /** * ImportedNodesArray is an object that represents an array of X3DImportedNode objects. This is a read-only object. Individual elements of the array can be referenced using the standard C-style dereferencing operator (e.g. *importedNodesArrayName*[*index*], where *index* is an integer-valued expression with 0\<=*index*\<length and length is the number of elements in the array). */ class ImportedNodesArray extends X3DInfoArray <X3DImportedNode> { } /** * The X3DImportedNode object stores information about a particular import declaration. The object consists solely of read-only properties. It does not define any additional functions. */ class X3DImportedNode extends X3DObject { /** * The SFNode object of the Inline node. This property is read-only. */ readonly inlineNode: SFNode; /** * A string of the exported name. This property is read-only. */ readonly exportedName: string; /** * The SFNode object of the exported node. This property is read-only. */ readonly exportedNode: SFNode; /** * A string of the imported name. This property is read-only. */ readonly importedName: string; } /** * ExportedNodesArray is an object that represents an array of X3DExportedNode objects. This is a read-only object. Individual elements of the array can be referenced using the standard C-style dereferencing operator (e.g. *exportedNodesArrayName*[*index*], where *index* is an integer-valued expression with 0\<=*index*\<length and length is the number of elements in the array). */ class ExportedNodesArray extends X3DInfoArray <X3DExportedNode> { } /** * The X3DExportedNode object stores information about a particular export declaration. The object consists solely of read-only properties. It does not define any additional functions. */ class X3DExportedNode extends X3DObject { /** * A string of the exported name. This property is read-only. */ readonly exportedName: string; /** * The SFNode object of the corresponding node. This property is read-only. */ readonly localNode: SFNode; } /** * ProtoDeclarationArray is an object that represents an array of X3DProtoDeclaration objects. This is a read-only object. Individual elements of the array can be referenced using the standard C-style dereferencing operator (e.g. *protoDeclarationArrayName*[*index*], where *index* is an integer-valued expression with 0\<=*index*\<length and length is the number of elements in the array). */ class ProtoDeclarationArray extends X3DInfoArray <X3DProtoDeclaration> { } /** * A PROTO declaration is represented by the X3DProtoDeclaration object. This object can only be fetched using the X3DExecutionContext object. */ class X3DProtoDeclaration extends X3DObject { /** * A string of the declared name of this prototype. This property is read-only. */ readonly name: string; /** * A reference to FieldDefinitionArray of all the fields defined for this prototype. This property is read-only. */ readonly fields: FieldDefinitionArray; /** * Always has the value of false. This property is read-only. */ readonly isExternProto: false; /** * Short description or purpose of the prototype. */ appInfo: string; /** * A string containing the documentation of this prototype. */ documentation: string; /** * Creates a new default instance of the prototype. */ newInstance (): X3DPrototypeInstanceProxy; /** * Returns the X3D VRML-encoded string that, if parsed as the value of createX3DFromString () of X3DBrowser, produce this prototype. * * For options see `X3DScene.toVRMLString`. */ toVRMLString (options?: ToStringOptions): string; /** * Returns the X3D XML-encoded string that, if parsed as the value of createX3DFromString () of X3DBrowser, produce this prototype. * * For options see `X3DScene.toVRMLString`. */ toXMLString (options?: ToStringOptions): string; /** * Returns the X3D JSON-encoded string that, if parsed as the value of createX3DFromString () of X3DBrowser, produce this prototype. * * For options see `X3DScene.toVRMLString`. */ toJSONString (options?: ToStringOptions): string; } /** * ExternProtoDeclarationArray is an object that represents an array of X3DExternProtoDeclaration objects. This is a read-only object. Individual elements of the array can be referenced using the standard C-style dereferencing operator (e.g. *externProtoDeclarationArrayName*[*index*], where *index* is an integer-valued expression with 0\<=*index*\<length and length is the number of elements in the array). */ class ExternProtoDeclarationArray extends X3DInfoArray <X3DExternProtoDeclaration> { } /** * An EXTERNPROTO declaration is represented by the X3DExternProtoDeclaration object. EXTERNPROTO declarations can only be fetched using the X3DExecutionContext object. */ class X3DExternProtoDeclaration extends X3DObject { /** * A string of the declared name of this extern prototype. This property is read-only. */ readonly name: string; /** * A reference to FieldDefinitionArray of all the fields defined for this extern prototype. This property is read-only. */ readonly fields: FieldDefinitionArray; /** * A MFString array of all the URI's defined for this extern prototype. This property is read-only. */ readonly urls: MFString; /** * Always has the value of true. This property is read-only. */ readonly isExternProto: true; /** * Short description or purpose of the extern prototype. */ appInfo: string; /** * A string containing the documentation of this extern prototype. */ documentation: string; /** * The value is one of the *_STATE* properties defined in the X3DConstants object. This property is read-only. */ readonly loadState: number; /** * Creates a new default instance of the extern prototype. */ newInstance (): X3DPrototypeInstanceProxy; /** * Triggers the loading of the extern prototype. It returns a Promise that is resolved when the extern prototype is completely loaded and all instances are updated. */ loadNow (): Promise <void>; /** * Returns the X3D VRML-encoded string that, if parsed as the value of createX3DFromString () of X3DBrowser, produce this prototype. * * For options see `X3DScene.toVRMLString`. */ toVRMLString (options?: ToStringOptions): string; /** * Returns the X3D XML-encoded string that, if parsed as the value of createX3DFromString () of X3DBrowser, produce this prototype. * * For options see `X3DScene.toVRMLString`. */ toXMLString (options?: ToStringOptions): string; /** * Returns the X3D JSON-encoded string that, if parsed as the value of createX3DFromString () of X3DBrowser, produce this prototype. * * For options see `X3DScene.toVRMLString`. */ toJSONString (options?: ToStringOptions): string; } /** * RouteArray is an object that represents an array of X3DRoute objects. This is a read-only object. Individual elements of the array can be referenced using the standard C-style dereferencing operator (e.g. *routeArrayName*[*index*], where *index* is an integer-valued expression with 0\<=*index*\<length and length is the number of elements in the array). */ class RouteArray extends X3DInfoArray <X3DRoute> { } /** * Routes are represented by the X3DRoute object. Routes can only be created through calls to the addRoute () function of X3DExecutionContext. */ class X3DRoute extends X3DObject { /** * A reference to the node that is the source of this route. */ readonly sourceNode: SFNode; /** * A string of the name of the field in the source node. */ readonly sourceField: string; /** * A reference to the node that is the destination of this route. */ readonly destinationNode: SFNode; /**