3DHOP object related native functions:
animateToTrackballPosition(position) | - | set a new position for the used trackball and animate the camera from the current point of view to the new setted; | |
Parameters | position | [array] : the spatial coordinates of the trackball (the number of values may varying depending on the used trackball); | |
enableLightTrackball(on) | - | enable or disable the 3D scene trackball interactive lighting control; | |
Parameters | on | [boolean] : true to enable, false to disable (light trackball is disabled by default); | |
enableOnHover(on) | - | enable or disable the visual effects (spots transparency and mouse cursor changes) related to the movement of the mouse pointer onto a mesh in the 3D scene. | |
Parameters | on | [boolean] : true to enable, false to disable (on hover effects are disabled by default). Visual effects activation could decreases performance on slower systems; | |
getTrackballPosition() | return the actual position of the used trackball; | ||
Returns | - | [array] : the spatial coordinates of the trackball (the number of values may varying depending on the used trackball); | |
isInstanceVisibilityEnabled(tag) | return the visibility status in the 3D scene of the specified model instance; | ||
Parameters | tag | [string] : the tag name specified in the "tags" field of "modelInstance" (in "setScene") that refers the instance of the model on which the visibility command acts. Accepts the constant value "HOP_ALL" too (without quotes) that refers all the models instances ("HOP_ALL is the default tag value"); | |
Returns | - | [boolean] : true if visible, false if not visible. If tag is "HOP_ALL" the function returns true if at least one of all the instances is visible; | |
isLightTrackballEnabled() | return the activation status of the 3D scene trackball interactive lighting control; | ||
Returns | - | [boolean] : true if enabled, false if disabled; | |
isSpotVisibilityEnabled(tag) | return the visibility status in the 3D scene of the specified hot spot instance; | ||
Parameters | tag | [string] : the tag name specified in the "tags" field of "spots" (in "setScene") that refers the instance of the hot spot on which the visibility command acts. Accepts the constant value "HOP_ALL" too (without quotes) that refers all the hot spots instances ("HOP_ALL is the default tag value"); | |
Returns | - | [boolean] : true if visible, false if not visible. If tag is "HOP_ALL" the function returns true if at least one of all the instances is visible; | |
isOnHoverEnabled() | return the activation status of the visual effects (spots transparency and mouse cursor changes) related to the movement of the mouse pointer onto a mesh in the 3D scene; | ||
Returns | - | [boolean] : true if enabled, false if disabled; | |
resetTrackball() | - | reset both the position and light control trackballs to the initial setting; | |
rotateLight(x, y) | - | rotate the 3D scene light trackball; | |
Parameters | x | [number] : the amount of displacement along the x-axis (accepts values from -0.5 to 0.5); | |
y | [number] : the amount of displacement along the y-axis (accepts values from -0.5 to 0.5); | ||
setInstanceVisibility(tag, state, redraw) | - | set the visibility in the 3D scene of the specified model instance; | |
Parameters | tag | [string] : the tag name specified in the "tags" field of "modelInstance" (in "setScene") that refers the instance of the model on which the visibility command acts. Accepts the constant value "HOP_ALL" too (without quotes) that refers all the models instances; | |
state | [boolean] : true to make the instance visible, false to not make; | ||
redraw | [boolean] : true to redraw the 3D scene, false to not redraw; | ||
setScene(options) | - | 3DHOP main method, set the 3D scene; | |
Parameters | options | [multiple values] : all the text fields that define the virtual scene (meshes, modelInstances, spots, trackball, space). Check the how to section for more details; | |
setSpotVisibility(tag, state, redraw) | - | set the visibility in the 3D scene of the specified hot spot instance; | |
Parameters | tag | [string] : the tag name specified in the "tags" field of "spots" (in "setScene") that refers the instance of the hot spot on which the visibility command acts. Accepts the constant value "HOP_ALL" too (without quotes) that refers all the hot spots instances; | |
state | [boolean] : true to make the instance visible, false to not make; | ||
redraw | [boolean] : true to redraw the 3D scene, false to not redraw; | ||
setTrackballPosition(position) | - | set a new position for the used trackball and redraw the 3D scene with the camera in the new setted point; | |
Parameters | position | [array] : the spatial coordinates of the trackball (the number of values may varying depending on the used trackball); | |
supportsWebGL() | check if the system supports the WebGL API; | ||
Returns | - | [boolean] : true if supported, false if not supported; | |
toggleDebugMode() | - | toggle 3DHOP between normal mode and debug mode; | |
toggleInstanceVisibility(tag, redraw) | - | toggle the visibility in the 3D scene of the specified model instance; | |
Parameters | tag | [string] : the tag name specified in the "tags" field of "modelInstance" (in "setScene") that refers the instance of the model on which the visibility command acts. Accepts the constant value "HOP_ALL" too (without quotes) that refers all the models instances; | |
redraw | [boolean] : true to redraw the 3D scene, false to not redraw; | ||
toggleSpotVisibility(tag, redraw) | - | toggle the visibility in the 3D scene of the specified hot spot instance; | |
Parameters | tag | [string] : the tag name specified in the "tags" field of "spots" (in "setScene") that refers the instance of the hot spot on which the visibility command acts. Accepts the constant value "HOP_ALL" too (without quotes) that refers all the hot spots instances; | |
redraw | [boolean] : true to redraw the 3D scene, false to not redraw; | ||
zoomIn() | - | zoom the camera one step into the 3D scene; | |
zoomOut() | - | zoom the camera one step out of the 3D scene; |
3DHOP object related callback functions (activated by specific events):
_onEnterInstance(id) | - | bind an event handler to be fired when the mouse enters an instance; | |
Parameters | id | [string] : the instance name specified in the "modelInstance" field of "setScene"; | |
_onEnterSpot(id) | - | bind an event handler to be fired when the mouse enters a spot; | |
Parameters | id | [string] : the spot name specified in the "spots" field of "setScene"; | |
_onLeaveInstance(id) | - | bind an event handler to be fired when the mouse leaves an instance; | |
Parameters | id | [string] : the instance name specified in the "modelInstance" field of "setScene"; | |
_onLeaveSpot(id) | - | bind an event handler to be fired when the mouse leaves a spot; | |
Parameters | id | [string] : the spot name specified in the "spots" field of "setScene"; | |
_onPickedInstance(id) | - | bind an event handler to be fired when the mouse clicks an instance; | |
Parameters | id | [string] : the instance name specified in the "modelInstance" field of "setScene"; | |
_onPickedSpot(id) | - | bind an event handler to be fired when the mouse clicks a spot; | |
Parameters | id | [string] : the spot name specified in the "spots" field of "setScene"; |
3DHOP object independent utility functions:
fullscreenSwitch() | - | switch between 3DHOP element fullscreen and normal mode, simultaneously updating the toolbar related button icon; | |
hotspotSwitch() | - | switch between on/off toolbar related hotspot button icon; | |
lightSwitch() | - | switch between on/off toolbar related light control button icon; | |
moveToolbar(left, top) | - | move the 3DHOP toolbar around the screen; | |
Parameters | left | [number] : toolbar margin-left space in px (relative to 3DHOP container, default value is 10). Accepts the CSS margin syntax too (enclosed in quotes); | |
top | [number] : toolbar margin-top space in px (relative to 3DHOP container, default value is 10). Accepts the CSS margin syntax too (enclosed in quotes); | ||
resizeCanvas(width, height) | - | change the 3DHOP sizes; | |
Parameters | width | [number] : 3DHOP width value in px (default is full browser). Accepts the CSS width syntax too (enclosed in quotes); | |
height | [number] : 3DHOP height value in px (default is full browser). Accepts the CSS height syntax too (enclosed in quotes); |