Members
(constant) colorSpace
Texture encoding used to have the right color of the .glb model + have an alpha channel
- Source
(constant) createLocalStorageCheckbox
- Source
(constant) createLocalStorageDetails
- Source
(constant) createLocalStorageNumberInput
- Source
(constant) createLocalStorageSlider
- Source
(constant) defaultConfigScene :SceneConfig
Default scene 3D config
- Source
Methods
RequestService()
Used by Widget.WebService Service used to make authentificate HTTP requests (with a token) Wiki : https://github.com/MEPP-team/UD-Viz/wiki/Request-Service#request-service
- Source
URLSetCameraMatrix(camera) → {boolean}
Initialize camera matrix with url search params produced by appendCameraMatrixToURL
Name | Type | Description |
---|---|---|
camera | THREE. | camera to initialize with url |
true if a camera matrix has been found in url
- Type:
- boolean
addCubeTexture(paths, scene)
Name | Type | Description |
---|---|---|
paths | Array.<string> | paths of cube texture order should be negX posX negY posY posZ negZ |
scene | THREE. | 3d scene |
- Source
addLights(scene) → {Object}
Add default lights to a scene 3D one directional and one ambient
Name | Type | Description |
---|---|---|
scene | THREE. | the scene where to add lights |
- Source
- lights added
- Type:
- Object
appendCameraMatrixToURL(url, camera) → {URL}
Append in search params of an url the camera matrix
Name | Type | Description |
---|---|---|
url | URL | url to append the camera matrix |
camera | THREE. | camera to read the matrix from |
- url to append the camera matrix
- Type:
- URL
appendWireframeByGeometryAttributeToObject3D(object3D, nameOfGeometryAttribute, threshOldAngle)
Traverse a THREE.Object3D and append in each Object3D children a THREE.LineSegment geometry representing its wireframe. Each wireframe geometry will keep the associated attribute value.
Name | Type | Description |
---|---|---|
object3D | THREE. | An Object3D from three |
nameOfGeometryAttribute | string | The attribute used to split each geometry of the BufferGeometry |
threshOldAngle | number | An edge is only rendered if the angle (in degrees) between the face normals of the adjoining faces exceeds this value. default = 1 degree. |
- Source
appendWireframeToObject3D(object3D, threshOldAngle)
Traverse a THREE.Object3D and append in each Object3D children a THREE.LineSegment geometry representing its wireframe
Name | Type | Description |
---|---|---|
object3D | THREE. | An Object3D from three |
threshOldAngle | number | An edge is only rendered if the angle (in degrees) between the face normals of the adjoining faces exceeds this value. default = 1 degree. |
- Source
autoDurationTravel(controls, targetPos) → {number}
Compute a distance automatically for travel features of itowns Planar View
Note: Code retrieve itowns - https://github.com/iTowns/itowns/blob/1bad0d627764c73b606179c636ad7b70105dd633/src/Controls/PlanarControls.js#L712
Name | Type | Description |
---|---|---|
controls | itowns. | planar controls of itownsView |
targetPos | THREE. | position of our target |
- Source
the duration of travel to focus a targetPosition
- Type:
- number
bindLightTransform(offset, phi, theta, obj, dirLight)
Place the directional light in order its shadow camera fit the object
Name | Type | Description |
---|---|---|
offset | number | distance from the bounding sphere of the object to the light |
phi | number | phi of spherical coord in radian |
theta | number | theta of spherical coord in radian |
obj | THREE. | the object to fit inside the projection plane of the shadow camera |
dirLight | THREE. | the light with the shadow camera |
- Source
cameraFitRectangle(camera, min, max, altitude)
Move camera transform so the rectangle define by min & max (in the xy plane) fit the entire screen
Name | Type | Description |
---|---|---|
camera | THREE. | camera to update |
min | THREE. | min coord of the rectangle |
max | THREE. | max coord of the rectangle |
altitude | number | altitude of the rectangle |
- Source
- To Do
- rectangle is not force to be in xy plane
checkParentChild(child, parent) → {boolean}
Check if an html element belong to another one recursively
Name | Type | Description |
---|---|---|
child | HTMLElement | html child |
parent | HTMLElement | html parent |
- true if child belong to parent
- Type:
- boolean
computeFileNameFromPath(path) → {string}
Name | Type | Description |
---|---|---|
path | string | path of file |
- name of file
- Type:
- string
console.log(computeFilename("./some_folder/another_folder/filename.whatever"))// log filename
computeNearFarCamera(camera, min, max)
Compute near and far of camera in order to wrap a box define by a min and max value
Name | Type | Description |
---|---|---|
camera | THREE. | camera to compute near and far |
min | THREE. | min coord of box |
max | THREE. | max coord of box |
- Source
createDateIntervalInput(labelText) → {Object}
Name | Type | Description |
---|---|---|
labelText | string | text of the label |
- date interval object
- Type:
- Object
createDisplayable(label) → {Object}
Create a button to toggle visibility of the content in a container
Name | Type | Description |
---|---|---|
label | string | label of the container |
- parent is the element to add container is the element to fill
- Type:
- Object
createLabelInput(labelText, inputType) → {Object}
Name | Type | Description |
---|---|---|
labelText | string | label text |
inputType | string | input type |
- parent is the element to add input is the input element
- Type:
- Object
createSpriteFromString(string, optionsopt) → {THREE.Sprite}
Generates a sprite with text from a given string
Name | Type | Attributes | Description |
---|---|---|---|
string | string | The string displayed in the sprite | |
options | SpriteStringOptions | <optional> | Options of generation |
- Source
three's Sprite
- Type:
- THREE.
Sprite
downloadImageOnDisk(url, filename)
Download an image on the local disk
Name | Type | Description |
---|---|---|
url | string | url of the image to download |
filename | string | name of the file on disk |
downloadObjectAsJson(exportObj, exportName)
Download on the local disk an object as .json
Name | Type | Description |
---|---|---|
exportObj | object | object to download |
exportName | string | name of file |
fetchC3DTileFeatureWithNodeText(itownsView, batchTableKey, batchTableValue) → {object}
fetchC3DTileFeatureWithNodeText takes a parameter batchTableKey
and returns a feature from a 3DTileslayer
if the batch table content of the feature contains a given batchTableValue
string in the given key. Returns an object containing the first matching feature and its layer.
Name | Type | Description |
---|---|---|
itownsView | itowns. | view |
batchTableKey | string | a given batch table key |
batchTableValue | string | a given batch table value |
- Source
containting the feature and the layer containing the feature
- Type:
- object
focusC3DTilesLayer(itownsView, layer) → {Promise|null}
Focus a C3DTiles Layer
Name | Type | Description |
---|---|---|
itownsView | itowns. | view |
layer | itowns. | layer to focus |
- Source
- To Do
- this function is used by widget should be contributed or removed
Promise of the camera focusing on C3DTiles
- Type:
- Promise |
null
focusCameraOn(view, controls, targetPos, optionsopt) → {Promise}
Makes the camera move to focus on the target position.
Name | Type | Attributes | Description |
---|---|---|---|
view | itowns. | The iTowns view. | |
controls | itowns. | The camera controls. | |
targetPos | THREE. | The target position. | |
options | * | <optional> | Optional parameters for the travel. Accepted entries are :
|
- Source
- To Do
- this function is used by widget should be contributed or removed
Promise of the camera focusing on target
- Type:
- Promise
getUriLocalname(uri) → {string}
Return the localname of a URI
Name | Type | Description |
---|---|---|
uri | string | The URI |
the localname of the URI
- Type:
- string
getUriNamespace(uri) → {string}
Return the namespace of a URI
Name | Type | Description |
---|---|---|
uri | string | The URI |
the namespace of the URI
- Type:
- string
initRenderer(renderer, skyColor, clear)
Initialize the webgl renderer with default values
Name | Type | Description |
---|---|---|
renderer | THREE. | the renderer to init |
skyColor | THREE. | clear color of the scene |
clear | boolean | autoclear, default is false |
- Source
initScene(camera, renderer, scene, config, object3D) → {THREE.DirectionalLight}
Init scene 3D with SceneConfig
Name | Type | Description |
---|---|---|
camera | THREE. | camera rendering scene |
renderer | THREE. | webgl renderer |
scene | THREE. | scene |
config | SceneConfig | | config |
object3D | THREE. | object to focus with shadow map |
- Source
- directional light created
- Type:
- THREE.
DirectionalLight
loadJSON(url) → {Promise}
Request a json file on a distant server
Name | Type | Description |
---|---|---|
url | string | on the distant server |
- promise resolving when .json loaded and pass it as first param
- Type:
- Promise
loadMultipleJSON(urlArray) → {Promise}
Load multiples .json files
Name | Type | Description |
---|---|---|
urlArray | Array.<string> | path of .json files to loaded |
- promise reolving when .json files loaded, each .json file can be access by the filename
- Type:
- Promise
loadMultipleJSON(["./some_folder/filename1.json","./another_folder/filename2.json"])
.then((configs)=>{
const contentFilename1 = configs["filename1"]
const contentFilename2 = configs["filename2"]
})
loadTextFile(url) → {Promise}
Request a text file on a distant server
Name | Type | Description |
---|---|---|
url | string | on the distant server |
- promise resolving when file loaded and pass it as first param
- Type:
- Promise
localStorageSetMatrix4(matrix4, key) → {boolean}
If there was a matrix4 recorded in localStorage restore it matrix4 + when tab is closing record current matrix4 /!\ calling this function make window reference the matrix4 avoiding it to be GC and could cause memory leak
Name | Type | Description |
---|---|---|
matrix4 | THREE. | matrix4 to track |
key | string | key of the item in localstorage |
- Source
true if matrix4 has been setted with localStorage
- Type:
- boolean
localStorageSetVector3(vector3, key) → {boolean}
If there was a vector 3 recorded in localStorage within the key passed copy values in vector3 + when tab is closing record current vector3 values /!\ calling this function make window reference the vector3 avoiding it to be GC and could cause memory leak
Name | Type | Description |
---|---|---|
vector3 | THREE. | vector 3 to track |
key | string | key of the item in localstorage |
- Source
true if vector3 has been setted with localStorage
- Type:
- boolean
readFileAsGltf(e) → {Promise}
change callback of an input file reading gltf
Name | Type | Description |
---|---|---|
e | object | input of type file argument when 'change' |
promise resolving with the gltf loaded
- Type:
- Promise
readSingleFileAsDataUrl(e, onLoad)
To be used with an input of type file
Name | Type | Description |
---|---|---|
e | object | input of type file argument when 'change' |
onLoad | FileReaderCallback | callback when file loaded |
readSingleFileAsText(e, onLoad)
To be used with an input of type file
Name | Type | Description |
---|---|---|
e | object | input of type file argument when 'change' |
onLoad | FileReaderCallback | | callback when file loaded |
tokenizeURI(uri) → {Object}
Tokenize a URI into a namespace and localname A uri is typically composed of a [namespace]#[localname] e.g. http://site.io/test#example_1 here the namespace is 'http://site.io/test#' and the localname is 'example_1'
Name | Type | Description |
---|---|---|
uri | string | The URI to be tokenized |
object of the URI tokenized
- Type:
- Object
Type Definitions
FileReaderCallback(event)
Name | Type | Description |
---|---|---|
event | ProgressEvent.<FileReader> | file reader event |
SceneConfig
PropertiesName | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
cameraFov | number | default camera fov | |||||||||
shadowMapSize | number | size of shadow map | |||||||||
sky | object | sky property Properties
|
- Source
SpriteStringOptions
- object
Name | Type | Description |
---|---|---|
baseHeight | number | height of the canvas and the the font size |
baseWidth | number | width of the canvas |
borderSize | number | border size of the canvas |
font | string | string of font description css style-like |
- Source
cbTickAnimationFrame(dt)
Name | Type | Description |
---|---|---|
dt | number | Delta time between ticks |
- Source