Entity ground collision is fixed and jsdoc is improved.

This commit is contained in:
Zemledelec 2018-07-24 10:30:12 +03:00
parent d50b396493
commit 2a6f08cc67
51 changed files with 665 additions and 483 deletions

View File

@ -6,13 +6,132 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="./osm.js" type="module"></script>
<link rel="stylesheet" href="../../css/og.css" type="text/css" />
<style>
.color-options {
position: absolute;
top: 0;
right: 0;
background-color: white;
padding: 15px;
width: 250px;
}
.caption {
width: 100%;
height: 20px;
position: relative;
}
.option {
width: 100%;
position: relative;
display: flex;
}
.label {
float: left;
}
.slider {
float: left;
width: calc(100% - 50px);
}
.slider input {
width: 100%;
position: relative;
}
.value{
float:left;
}
</style>
</head>
<body>
<div id="earth" style="width:100%;height:100%"/>
<div id="debug" class="defaultText"/>
<div id="bounds" class="defaultText"/>
<div id="curr" class="defaultText"/>
<div id="earth" style="width:100%;height:100%"></div>
<div class="color-options">
<div class="caption">Ambient</div>
<div class="option">
<div class="label">R</div>
<div class="slider">
<input type="range" id="ambient-r" name="ambient-r" value="0.0" min="0.0" max="2.0" step="0.01" />
</div>
<div class="value ambient-r">0.888</div>
</div>
<div class="option">
<div class="label">G</div>
<div class="slider">
<input type="range" id="ambient-g" name="ambient-g" value="0.0" min="0.0" max="2.0" step="0.01" />
</div>
<div class="value ambient-g">0.888</div>
</div>
<div class="option">
<div class="label">B</div>
<div class="slider">
<input type="range" id="ambient-b" name="ambient-b" value="0.0" min="0.0" max="2.0" step="0.01" />
</div>
<div class="value ambient-b">0.888</div>
</div>
<div class="caption">Diffuse</div>
<div class="option">
<div class="label">R</div>
<div class="slider">
<input type="range" id="diffuse-r" name="diffuse-r" value="0.0" min="0.0" max="2.0" step="0.01" />
</div>
<div class="value diffuse-r">0.888</div>
</div>
<div class="option">
<div class="label">G</div>
<div class="slider">
<input type="range" id="diffuse-g" name="diffuse-g" value="0.0" min="0.0" max="2.0" step="0.01" />
</div>
<div class="value diffuse-g">0.888</div>
</div>
<div class="option">
<div class="label">B</div>
<div class="slider">
<input type="range" id="diffuse-b" name="diffuse-b" value="0.0" min="0.0" max="2.0" step="0.01" />
</div>
<div class="value diffuse-b">0.888</div>
</div>
<div class="caption">Specular</div>
<div class="option">
<div class="label">R</div>
<div class="slider">
<input type="range" id="specular-r" name="specular-r" value="0.0" min="0.0" max="1.0" step="0.0001" />
</div>
<div class="value specular-r">0.888</div>
</div>
<div class="option">
<div class="label">G</div>
<div class="slider">
<input type="range" id="specular-g" name="specular-g" value="0.0" min="0.0" max="1.0" step="0.0001" />
</div>
<div class="value specular-g">0.888</div>
</div>
<div class="option">
<div class="label">B</div>
<div class="slider">
<input type="range" id="specular-b" name="specular-b" value="0.0" min="0.0" max="1.0" step="0.0001" />
</div>
<div class="value specular-b">0.888</div>
</div>
<div class="caption">Shininess</div>
<div class="option">
<div class="label">R</div>
<div class="slider">
<input type="range" id="shininess" name="shininess" value="0.0" min="0.0" max="1000.0" step="1" />
</div>
<div class="value shininess">0.888</div>
</div>
</div>
</body>
</html>

View File

@ -11,6 +11,60 @@ import { DebugInfo } from '../../src/og/control/DebugInfo.js';
import { ToggleWireframe } from '../../src/og/control/ToggleWireframe.js';
import * as math from '../../src/og/math.js';
document.getElementById("ambient-r").addEventListener("input", function (e) {
osm.ambient.x = this.value;
document.querySelector(".value.ambient-r").innerHTML = this.value;
});
document.getElementById("ambient-g").addEventListener("input", function (e) {
osm.ambient.y = this.value;
document.querySelector(".value.ambient-g").innerHTML = this.value;
});
document.getElementById("ambient-b").addEventListener("input", function (e) {
osm.ambient.z = this.value;
document.querySelector(".value.ambient-b").innerHTML = this.value;
});
document.getElementById("diffuse-r").addEventListener("input", function (e) {
osm.diffuse.x = this.value;
document.querySelector(".value.diffuse-r").innerHTML = this.value;
});
document.getElementById("diffuse-g").addEventListener("input", function (e) {
osm.diffuse.y = this.value;
document.querySelector(".value.diffuse-g").innerHTML = this.value;
});
document.getElementById("diffuse-b").addEventListener("input", function (e) {
osm.diffuse.z = this.value;
document.querySelector(".value.diffuse-b").innerHTML = this.value;
});
document.getElementById("specular-r").addEventListener("input", function (e) {
osm.specular.x = this.value;
document.querySelector(".value.specular-r").innerHTML = this.value;
});
document.getElementById("specular-g").addEventListener("input", function (e) {
osm.specular.y = this.value;
document.querySelector(".value.specular-g").innerHTML = this.value;
});
document.getElementById("specular-b").addEventListener("input", function (e) {
osm.specular.z = this.value;
document.querySelector(".value.specular-b").innerHTML = this.value;
});
document.getElementById("shininess").addEventListener("input", function (e) {
osm.shininess = this.value;
document.querySelector(".value.shininess").innerHTML = this.value;
});
let cnv = document.createElement("canvas");
let ctx = cnv.getContext("2d");
cnv.width = 256;

View File

@ -84,7 +84,7 @@ class Frustum {
/**
* Returns true if a point in the frustum.
* @public
* @param {og.math.Vec3} point - Cartesian point.
* @param {og.Vec3} point - Cartesian point.
* @returns {boolean}
*/
containsPoint(point) {

View File

@ -53,7 +53,7 @@ const PLANET_NAME_PREFIX = "globus_planet_";
* @param {string} [options.name] - Planet name. Default is unic identifier.
* @param {og.terrain.Terrain} [options.terrain] - Terrain provider. Default no terrain - og.terrain.EmptyTerrain.
* @param {Array.<og.control.Control>} [options.controls] - Renderer controls array.
* @param {Array.<og.layer.Layer>} [options.layers] - Planet layers.
* @param {Array.<og.Layer>} [options.layers] - Planet layers.
* @param {og.Extent} [options.viewExtent] - Viewable starting extent.
* @param {boolean} [options.autoActivate] - Globe rendering auto activation flag. True is default.
*/

View File

@ -14,7 +14,7 @@ import { Vec3 } from '../math/Vec3.js';
/**
* Returns Sun position in the geocentric coordinate system by the time.
* @param {Number} jDate - Julian date time.
* @returns {og.math.Vector3} - Sun geocentric coordinates.
* @returns {og.Vec3} - Sun geocentric coordinates.
*/
export function getSunPosition(jDate) {
//http://stjarnhimlen.se/comp/tutorial.html

View File

@ -15,7 +15,7 @@ class Box {
/**
* Vertices array.
* @public
* @type{Array.<og.math.Vector3>}
* @type{Array.<og.Vec3>}
*/
this.vertices = [new Vec3(), new Vec3(), new Vec3(), new Vec3(), new Vec3(), new Vec3(), new Vec3(), new Vec3()];
}

View File

@ -10,7 +10,7 @@ import { Vec3 } from '../math/Vec3.js';
* Bounding sphere class.
* @class
* @param {Number} [radius] - Bounding sphere radius.
* @param {og.math.Vector3} [center] - Bounding sphere coordiantes.
* @param {og.Vec3} [center] - Bounding sphere coordiantes.
*/
class Sphere {
constructor(radius, center) {
@ -25,7 +25,7 @@ class Sphere {
/**
* Sphere coordiantes.
* @public
* @type {og.math.Vector3}
* @type {og.Vec3}
*/
this.center = center ? center.clone() : new Vec3();
}

View File

@ -22,9 +22,9 @@ import { Mat4 } from '../math/Mat4.js';
* @param {number} [options.viewAngle=30] - Camera angle of view. Default is 30.0
* @param {number} [options.near=1] - Camera near plane distance. Default is 1.0
* @param {number} [options.far=og.math.MAX] - Camera far plane distance. Deafult is og.math.MAX
* @param {og.math.Vector3} [options.eye=[0,0,0]] - Camera eye position. Default (0,0,0)
* @param {og.math.Vector3} [options.look=[0,0,0]] - Camera look position. Default (0,0,0)
* @param {og.math.Vector3} [options.up=[0,1,0]] - Camera eye position. Default (0,1,0)
* @param {og.Vec3} [options.eye=[0,0,0]] - Camera eye position. Default (0,0,0)
* @param {og.Vec3} [options.look=[0,0,0]] - Camera look position. Default (0,0,0)
* @param {og.Vec3} [options.up=[0,1,0]] - Camera eye position. Default (0,1,0)
*
* @fires og.Camera#viewchange
*/
@ -48,7 +48,7 @@ class Camera {
/**
* Camera position.
* @public
* @type {og.math.Vector3}
* @type {og.Vec3}
*/
this.eye = new Vec3();
@ -90,56 +90,56 @@ class Camera {
/**
* Camera normal matrix.
* @protected
* @type {og.math.Matrix3}
* @type {og.Mat3}
*/
this._normalMatrix = new Mat3();
/**
* Camera projection matrix.
* @protected
* @type {og.math.Matrix4}
* @type {og.Mat4}
*/
this._projectionMatrix = new Mat4();
/**
* Camera view matrix.
* @protected
* @type {og.math.Matrix4}
* @type {og.Mat4}
*/
this._viewMatrix = new Mat4();
/**
* Product of projection and view matrices.
* @protected
* @type {og.math.Matrix4}
* @type {og.Mat4}
*/
this._projectionViewMatrix = new Mat4();
/**
* Inverse projectionView Matrix.
* @protected
* @type {og.math.Matrix4}
* @type {og.Mat4}
*/
this._inverseProjectionViewMatrix = new Mat4();
/**
* Camera projection matrix for small near and far distances.
* @protected
* @type {og.math.Matrix4}
* @type {og.Mat4}
*/
this._projectionMatrixPrecise = new Mat4();
/**
* Camera right vector.
* @protected
* @type {og.math.Vector3}
* @type {og.Vec3}
*/
this._u = new Vec3(0, 1, 0); //up x n
/**
* Camera up vector.
* @protected
* @type {og.math.Vector3}
* @type {og.Vec3}
*/
this._v = new Vec3(1, 0, 0); //n x u - UP
@ -148,7 +148,7 @@ class Camera {
/**
* Camera forward vector.
* @protected
* @type {og.math.Vector3}
* @type {og.Vec3}
*/
this._n = new Vec3(0, 0, 1); //eye - look - FORWARD
@ -216,9 +216,9 @@ class Camera {
* @param {number} [options.viewAngle] - Camera angle of view. Default is 30.0
* @param {number} [options.near] - Camera near plane distance. Default is 1.0
* @param {number} [options.far] - Camera far plane distance. Deafult is og.math.MAX
* @param {og.math.Vector3} [options.eye] - Camera eye position. Default (0,0,0)
* @param {og.math.Vector3} [options.look] - Camera look position. Default (0,0,0)
* @param {og.math.Vector3} [options.up] - Camera eye position. Default (0,1,0)
* @param {og.Vec3} [options.eye] - Camera eye position. Default (0,0,0)
* @param {og.Vec3} [options.look] - Camera look position. Default (0,0,0)
* @param {og.Vec3} [options.up] - Camera eye position. Default (0,1,0)
*/
_initialize(options) {
@ -399,9 +399,9 @@ class Camera {
/**
* Sets camera to eye position.
* @public
* @param {og.math.Vector3} eye - Camera position.
* @param {og.math.Vector3} look - Look point.
* @param {og.math.Vector3} up - Camera up vector.
* @param {og.Vec3} eye - Camera position.
* @param {og.Vec3} look - Look point.
* @param {og.Vec3} up - Camera up vector.
* @returns {og.Camera} - This camera.
*/
set(eye, look, up) {
@ -423,8 +423,8 @@ class Camera {
/**
* Sets camera look point.
* @public
* @param {og.math.Vector3} look - Look point.
* @param {og.math.Vector3} [up] - Camera up vector otherwise camera current up vector(this._v)
* @param {og.Vec3} look - Look point.
* @param {og.Vec3} [up] - Camera up vector otherwise camera current up vector(this._v)
*/
look(look, up) {
this._n.set(this.eye.x - look.x, this.eye.y - look.y, this.eye.z - look.z);
@ -491,7 +491,7 @@ class Camera {
* @public
* @param {number} x - Scren X coordinate.
* @param {number} y - Scren Y coordinate.
* @returns {og.math.Vector3} - Direction vector.
* @returns {og.Vec3} - Direction vector.
*/
unproject(x, y) {
var c = this.renderer.handler.canvas,
@ -510,8 +510,8 @@ class Camera {
/**
* Gets projected 3d point to the 2d screen coordiantes.
* @public
* @param {og.math.Vector3} v - Cartesian 3d coordiantes.
* @returns {og.math.Vector2} - Screen point coordinates.
* @param {og.Vec3} v - Cartesian 3d coordiantes.
* @returns {og.Vec2} - Screen point coordinates.
*/
project(v) {
var r = this._projectionViewMatrix.mulVec4(v.toVec4()),
@ -525,7 +525,7 @@ class Camera {
* @param {number} angle - Rotation angle in radians.
* @param {boolaen} isArc - If true camera up vector gets from current up vector every frame,
* otherwise up is always input parameter.
* @param {og.math.Vector3} center - Point that the camera rotates around.
* @param {og.Vec3} center - Point that the camera rotates around.
* @param {og.math.Vecto3} [up] - Camera up vector.
*/
rotateAround(angle, isArc, center, up) {
@ -550,8 +550,8 @@ class Camera {
* @param {number} angle - Rotation angle in radians.
* @param {boolaen} isArc - If true camera up vector gets from current up vector every frame,
* otherwise up is always input parameter.
* @param {og.math.Vector3} center - Point that the camera rotates around.
* @param {og.math.Vector3} [up] - Camera up vector.
* @param {og.Vec3} center - Point that the camera rotates around.
* @param {og.Vec3} [up] - Camera up vector.
*/
rotateHorizontal(angle, isArc, center, up) {
this.rotateAround(angle, isArc, center, up);
@ -560,7 +560,7 @@ class Camera {
/**
* Rotates camera around center point by vecrtical.
* @param {number} angle - Rotation angle in radians.
* @param {og.math.Vector3} center - Point that the camera rotates around.
* @param {og.Vec3} center - Point that the camera rotates around.
*/
rotateVertical(angle, center) {
this.rotateAround(angle, false, center, this._u);
@ -569,8 +569,8 @@ class Camera {
/**
* Gets 3d size factor. Uses in LOD distance calculation.
* @public
* @param {og.math.Vector3} p - Far point.
* @param {og.math.Vector3} r - Far point.
* @param {og.Vec3} p - Far point.
* @param {og.Vec3} r - Far point.
* @returns {number} - Size factor.
*/
projectedSize(p, r) {
@ -580,7 +580,7 @@ class Camera {
/**
* Returns normal matrix.
* @public
* @returns {og.math.Matrix3} - Normal matrix.
* @returns {og.Mat3} - Normal matrix.
*/
getNormalMatrix() {
return this._normalMatrix;
@ -589,7 +589,7 @@ class Camera {
/**
* Returns projection matrix.
* @public
* @returns {og.math.Matrix4} - Projection matrix.
* @returns {og.Mat4} - Projection matrix.
*/
getProjectionMatrix() {
return this._projectionMatrix;
@ -598,7 +598,7 @@ class Camera {
/**
* Returns model matrix.
* @public
* @returns {og.math.Matrix4} - View matrix.
* @returns {og.Mat4} - View matrix.
*/
getViewMatrix() {
return this._viewMatrix;
@ -607,7 +607,7 @@ class Camera {
/**
* Returns projection and model matrix product.
* @public
* @return {og.math.Matrix4} - Projection-view matrix.
* @return {og.Mat4} - Projection-view matrix.
*/
getProjectionViewMatrix() {
return this._projectionViewMatrix;
@ -616,7 +616,7 @@ class Camera {
/**
* Returns inverse projection and model matrix product.
* @public
* @returns {og.math.Matrix4} - Inversed projection-view matrix.
* @returns {og.Mat4} - Inversed projection-view matrix.
*/
getInverseProjecttionViewMatrix() {
return this._inverseProjectionViewMatrix;

View File

@ -24,9 +24,9 @@ import { Ray } from '../math/Ray.js';
* @param {number} [options.near] - Camera near plane distance. Default is 1.0
* @param {number} [options.far] - Camera far plane distance. Deafult is og.math.MAX
* @param {number} [options.minAltitude] - Minimal altitude for the camera. Deafult is 50
* @param {og.math.Vector3} [options.eye] - Camera eye position. Default (0,0,0)
* @param {og.math.Vector3} [options.look] - Camera look position. Default (0,0,0)
* @param {og.math.Vector3} [options.up] - Camera eye position. Default (0,1,0)
* @param {og.Vec3} [options.eye] - Camera eye position. Default (0,0,0)
* @param {og.Vec3} [options.look] - Camera look position. Default (0,0,0)
* @param {og.Vec3} [options.up] - Camera eye position. Default (0,1,0)
*/
class PlanetCamera extends Camera {
constructor(planet, options) {
@ -69,7 +69,7 @@ class PlanetCamera extends Camera {
/**
* Cartesian coordinates on the terrain.
* @protected
* @type {og.math.Vector3}
* @type {og.Vec3}
*/
this._terrainPoint = new Vec3();
@ -88,7 +88,7 @@ class PlanetCamera extends Camera {
* @protected
* @type {og.LonLat}
*/
this._insideSegmentPosition = null;
this._insideSegmentPosition = new LonLat();
this._keyLock = new Key();
@ -184,7 +184,7 @@ class PlanetCamera extends Camera {
* @public
* @param {og.LonLat} lonlat - New camera and camera view position.
* @param {og.LonLat} [lookLonLat] - Look up coordinates.
* @param {og.math.Vector3} [up] - Camera UP vector. Default (0,1,0)
* @param {og.Vec3} [up] - Camera UP vector. Default (0,1,0)
*/
setLonLat(lonlat, lookLonLat, up) {
this.stopFlying();
@ -218,7 +218,7 @@ class PlanetCamera extends Camera {
* Gets position by viewable extent.
* @public
* @param {og.Extent} extent - Viewable extent.
* @returns {og.math.Vector3}
* @returns {og.Vec3}
*/
getExtentPosition(extent) {
@ -298,7 +298,7 @@ class PlanetCamera extends Camera {
* Flies to the current extent.
* @public
* @param {og.Extent} extent - Current extent.
* @param {og.math.Vector3} [up] - Camera UP in the end of flying. Default - (0,1,0)
* @param {og.Vec3} [up] - Camera UP in the end of flying. Default - (0,1,0)
* @param {cameraCallback} [completeCallback] - Callback that calls after flying when flying is finished.
* @param {cameraCallback} [startCallback] - Callback that calls befor the flying begins.
*/
@ -310,9 +310,9 @@ class PlanetCamera extends Camera {
/**
* Flies to the cartesian coordinates.
* @public
* @param {og.math.Vector3} cartesian - Finish cartesian coordinates.
* @param {og.math.Vector3} [look] - Camera LOOK in the end of flying. Default - (0,0,0)
* @param {og.math.Vector3} [up] - Camera UP vector in the end of flying. Default - (0,1,0)
* @param {og.Vec3} cartesian - Finish cartesian coordinates.
* @param {og.Vec3} [look] - Camera LOOK in the end of flying. Default - (0,0,0)
* @param {og.Vec3} [up] - Camera UP vector in the end of flying. Default - (0,1,0)
* @param {cameraCallback} [completeCallback] - Callback that calls after flying when flying is finished.
* @param {cameraCallback} [startCallback] - Callback that calls befor the flying begins.
*/
@ -401,8 +401,8 @@ class PlanetCamera extends Camera {
* Flies to the geo coordiantes.
* @public
* @param {og.LonLat} lonlat - Finish coordinates.
* @param {og.math.Vector3} [look] - Camera LOOK in the end of flying. Default - (0,0,0)
* @param {og.math.Vector3} [up] - Camera UP vector in the end of flying. Default - (0,1,0)
* @param {og.Vec3} [look] - Camera LOOK in the end of flying. Default - (0,0,0)
* @param {og.Vec3} [up] - Camera UP vector in the end of flying. Default - (0,1,0)
* @param {cameraCallback} [completeCallback] - Callback that calls after flying when flying is finished.
* @param {cameraCallback} [startCallback] - Callback that calls befor the flying begins.
*/
@ -506,7 +506,7 @@ class PlanetCamera extends Camera {
}
} else {
this._terrainAltitude = this._lonLat.height;
if (this._lonLat.height < 1000000) {
if (this._lonLat.height < 1000000 && this._insideSegment) {
this._terrainAltitude = this._insideSegment.getTerrainPoint(this._terrainPoint, this.eye, this._insideSegmentPosition);
if (this._terrainAltitude < this.minAltitude) {
this.setAltitude(this.minAltitude);

View File

@ -96,7 +96,7 @@ class EarthCoordinates extends Control {
/**
* Current position.
* @public
* @type {og.math.Vector3}
* @type {og.Vec3}
*/
this.position = null;
}

View File

@ -191,10 +191,10 @@ class TouchNavigation extends Control {
//var targetPointC = this.planet.getCartesianFromPixelTerrain(new og.math.Pixel(center_x, center_y));
//var dir0 = cam.unproject(t0.x, t0.y);
//var targetPoint0 = new og.math.Ray(cam.eye, dir0).hitSphere(t0.grabbedSpheroid);
//var targetPoint0 = new og.Ray(cam.eye, dir0).hitSphere(t0.grabbedSpheroid);
//var dir1 = cam.unproject(t1.x, t1.y);
//var targetPoint1 = new og.math.Ray(cam.eye, dir1).hitSphere(t1.grabbedSpheroid);
//var targetPoint1 = new og.Ray(cam.eye, dir1).hitSphere(t1.grabbedSpheroid);
//print2d("t1", center_x + "," + center_y, 100, 100);
//print2d("t2", targetPointC.x + "," + targetPointC.y + "," + targetPointC.z, 100, 120);

View File

@ -61,7 +61,7 @@ class Ellipsoid {
* Gets cartesian ECEF from Wgs84 geodetic coordiantes.
* @public
* @param {og.LonLat} lonlat - Degrees geodetic coordiantes.
* @returns {og.math.Vector3} -
* @returns {og.Vec3} -
*/
lonLatToCartesian(lonlat) {
var latrad = math.RADIANS * lonlat.lat,
@ -84,7 +84,7 @@ class Ellipsoid {
* @param {Number} lon - Longitude.
* @param {Number} lat - Latitude.
* @param {Number} height - Height.
* @returns {og.math.Vector3} -
* @returns {og.Vec3} -
*/
geodeticToCartesian(lon, lat, height) {
height = height || 0;
@ -105,7 +105,7 @@ class Ellipsoid {
/**
* Gets Wgs84 geodetic coordiantes from cartesian ECEF.
* @public
* @param {og.math.Vector3} cartesian - Cartesian coordinates.
* @param {og.Vec3} cartesian - Cartesian coordinates.
* @returns {og.LonLat} -
*/
cartesianToLonLat(cartesian) {
@ -140,8 +140,8 @@ class Ellipsoid {
/**
* Gets ellipsoid surface normal.
* @public
* @param {og.math.Vector3} coord - Spatial coordiantes.
* @returns {og.math.Vector3} -
* @param {og.Vec3} coord - Spatial coordiantes.
* @returns {og.Vec3} -
*/
getSurfaceNormal3v(coord) {
var r2 = this._invRadii2;
@ -155,9 +155,9 @@ class Ellipsoid {
/**
* Gets the cartesian point on the height over the ellipsoid surface.
* @public
* @param {og.math.Vector3} coord - Spatial ellipsoid coordiantes.
* @param {og.Vec3} coord - Spatial ellipsoid coordiantes.
* @param {number} h - Height this spatial coordinates.
* @return {og.math.Vector3} -
* @return {og.Vec3} -
*/
getSurfaceHeight3v(coord, h) {
var r2 = this._invRadii2;
@ -352,9 +352,9 @@ class Ellipsoid {
* Returns ray vector hit ellipsoid coordinates.
* If the ray doesn't hit ellipsoid returns null.
* @public
* @param {og.math.Vector3} origin - Ray origin point.
* @param {og.math.Vector3} direction - Ray direction.
* @returns {og.math.Vector3} -
* @param {og.Vec3} origin - Ray origin point.
* @param {og.Vec3} direction - Ray direction.
* @returns {og.Vec3} -
*/
hitRay(origin, direction) {

View File

@ -10,11 +10,11 @@ import * as utils from '../utils/shared.js';
* Base prototype for billboard and label classes.
* @class
* @param {Object} [options] - Options:
* @param {og.math.Vector3|Array.<number>} [options.position] - Billboard spatial position.
* @param {og.Vec3|Array.<number>} [options.position] - Billboard spatial position.
* @param {number} [options.rotation] - Screen angle rotaion.
* @param {og.math.Vector4|string|Array.<number>} [options.color] - Billboard color.
* @param {og.math.Vector3|Array.<number>} [options.alignedAxis] - Billboard aligned vector.
* @param {og.math.Vector3|Array.<number>} [options.offset] - Billboard center screen offset.
* @param {og.Vec4|string|Array.<number>} [options.color] - Billboard color.
* @param {og.Vec3|Array.<number>} [options.alignedAxis] - Billboard aligned vector.
* @param {og.Vec3|Array.<number>} [options.offset] - Billboard center screen offset.
* @param {boolean} [options.visibility] - Visibility.
*/
class BaseBillboard {
@ -32,7 +32,7 @@ class BaseBillboard {
/**
* Billboard center cartesian position.
* @protected
* @type {og.math.Vector3}
* @type {og.Vec3}
*/
this._position = utils.createVector3(options.position);
@ -46,14 +46,14 @@ class BaseBillboard {
/**
* RGBA color.
* @protected
* @type {og.math.Vector4}
* @type {og.Vec4}
*/
this._color = utils.createColorRGBA(options.color);
/**
* Cartesian aligned axis vector.
* @protected
* @type {og.math.Vector3}
* @type {og.Vec3}
*/
this._alignedAxis = utils.createVector3(options.alignedAxis);
@ -128,7 +128,7 @@ class BaseBillboard {
/**
* Sets billboard position.
* @public
* @param {og.math.Vector3} position - Cartesian coordinates.
* @param {og.Vec3} position - Cartesian coordinates.
*/
setPosition3v(position) {
this._position.x = position.x;
@ -140,7 +140,7 @@ class BaseBillboard {
/**
* Returns billboard position.
* @public
* @returns {og.math.Vector3}
* @returns {og.Vec3}
*/
getPosition() {
return this._position;
@ -182,7 +182,7 @@ class BaseBillboard {
/**
* Sets screen space offset.
* @public
* @param {og.math.Vector2} offset - Offset size.
* @param {og.Vec2} offset - Offset size.
*/
setOffset3v(offset) {
this._offset.x = offset.x;
@ -194,7 +194,7 @@ class BaseBillboard {
/**
* Returns billboard screen space offset size.
* @public
* @returns {og.math.Vector3}
* @returns {og.Vec3}
*/
getOffset() {
return this._offset;
@ -248,7 +248,7 @@ class BaseBillboard {
/**
* Sets RGBA color. Each channel from 0.0 to 1.0.
* @public
* @param {og.math.Vector4} color - RGBA vector.
* @param {og.Vec4} color - RGBA vector.
*/
setColor4v(color) {
this._color.x = color.x;
@ -270,7 +270,7 @@ class BaseBillboard {
/**
* Returns RGBA color.
* @public
* @returns {og.math.Vector4}
* @returns {og.Vec4}
*/
getColor() {
return this._color;
@ -324,7 +324,7 @@ class BaseBillboard {
/**
* Returns aligned vector.
* @public
* @returns {og.math.Vector3}
* @returns {og.Vec3}
*/
getAlignedAxis() {
return this._alignedAxis;
@ -342,7 +342,7 @@ class BaseBillboard {
/**
* Sets billboard picking color.
* @public
* @param {og.math.Vector3} color - Picking color.
* @param {og.Vec3} color - Picking color.
*/
setPickingColor3v(color) {
this._handler && this._handler.setPickingColorArr(this._handlerIndex, color);

View File

@ -12,11 +12,11 @@ import { BaseBillboard } from './BaseBillboard.js';
* @class
* @extends {og.BaseBillboard}
* @param {Object} [options] - Options:
* @param {og.math.Vector3|Array.<number>} [options.position] - Billboard spatial position.
* @param {og.Vec3|Array.<number>} [options.position] - Billboard spatial position.
* @param {number} [options.rotation] - Screen angle rotaion.
* @param {og.math.Vector4|string|Array.<number>} [options.color] - Billboard color.
* @param {og.math.Vector3|Array.<number>} [options.alignedAxis] - Billboard aligned vector.
* @param {og.math.Vector3|Array.<number>} [options.offset] - Billboard center screen offset.
* @param {og.Vec4|string|Array.<number>} [options.color] - Billboard color.
* @param {og.Vec3|Array.<number>} [options.alignedAxis] - Billboard aligned vector.
* @param {og.Vec3|Array.<number>} [options.offset] - Billboard center screen offset.
* @param {boolean} [options.visibility] - Visibility.
* @param {string} [options.src] - Billboard image url source.
* @param {Image} [options.image] - Billboard image object.

View File

@ -25,7 +25,7 @@ import { Vec3 } from '../math/Vec3.js';
* @class
* @param {Object} [options] - Entity options:
* @param {string} [options.name] - A human readable name to display to users. It does not have to be unique.
* @param {og.math.Vector3|Array.<number>} [options.cartesian] - Spatial entities like billboard, label, sphere etc. cartesian position.
* @param {og.Vec3|Array.<number>} [options.cartesian] - Spatial entities like billboard, label, sphere etc. cartesian position.
* @param {og.LonLat} [options.lonlat] - Geodetic coordiantes for an entities like billboard, label, sphere etc.
* @param {boolean} [options.aground] - True for entities that have to be placed on the relief.
* @param {boolean} [options.visibility] - Entity visibility.
@ -83,7 +83,7 @@ class Entity {
/**
* Entity cartesian position.
* @protected
* @type {og.math.Vector3}
* @type {og.Vec3}
*/
this._cartesian = utils.createVector3(options.cartesian);
@ -146,7 +146,7 @@ class Entity {
/**
* Picking color.
* @protected
* @type {og.math.Vector3}
* @type {og.Vec3}
*/
this._pickingColor = new Vec3(0, 0, 0);
@ -291,7 +291,7 @@ class Entity {
/**
* Sets entity cartesian position.
* @public
* @param {og.math.Vector3} cartesian - Cartesian position in 3d space.
* @param {og.Vec3} cartesian - Cartesian position in 3d space.
*/
setCartesian3v(cartesian) {
this.setCartesian(cartesian.x, cartesian.y, cartesian.z);
@ -344,7 +344,7 @@ class Entity {
/**
* Sets entity cartesian position without moveentity event dispatching.
* @protected
* @param {og.math.Vector3} cartesian - Cartesian position in 3d space.
* @param {og.Vec3} cartesian - Cartesian position in 3d space.
*/
_setCartesian3vSilent(cartesian) {
@ -415,7 +415,7 @@ class Entity {
/**
* Returns carteain position.
* @public
* @returns {og.math.Vector3} -
* @returns {og.Vec3} -
*/
getCartesian() {
return this._cartesian;

View File

@ -31,11 +31,11 @@ const STR2ALIGN = {
* @class
* @extends {og.BaseBillboard}
* @param {Object} [options] - Label options:
* @param {og.math.Vector3|Array.<number>} [options.position] - Billboard spatial position.
* @param {og.Vec3|Array.<number>} [options.position] - Billboard spatial position.
* @param {number} [options.rotation] - Screen angle rotaion.
* @param {og.math.Vector4|string|Array.<number>} [options.color] - Billboard color.
* @param {og.math.Vector3|Array.<number>} [options.alignedAxis] - Billboard aligned vector.
* @param {og.math.Vector3|Array.<number>} [options.offset] - Billboard center screen offset.
* @param {og.Vec4|string|Array.<number>} [options.color] - Billboard color.
* @param {og.Vec3|Array.<number>} [options.alignedAxis] - Billboard aligned vector.
* @param {og.Vec3|Array.<number>} [options.offset] - Billboard center screen offset.
* @param {boolean} [options.visibility] - Visibility.
* @param {string} [options.text] - Text string.
* @param {string} [options.face] - HTML5 font face.
@ -43,7 +43,7 @@ const STR2ALIGN = {
* @param {string} [options.style] - HTML5 font style. Example 'normal', 'italic'.
* @param {string} [options.weight] - HTML5 font weight. Example 'normal', 'bold'.
* @param {number} [options.outline] - Text outline size. 0 - no outline, 1 - maximum outline. Default 0.58.
* @param {og.math.Vector4|string|Array.<number>} [options.outlineColor] - Outline color.
* @param {og.Vec4|string|Array.<number>} [options.outlineColor] - Outline color.
* @param {og.Label.ALIGN} [options.align] - Text horizontal align: "left", "right" and "center".
*/
class Label extends BaseBillboard {
@ -97,7 +97,7 @@ class Label extends BaseBillboard {
/**
* Label outline color.
* @private
* @type {og.math.Vector4}
* @type {og.Vec4}
*/
this._outlineColor = utils.createColorRGBA(options.outlineColor, new Vec4(0.0, 0.0, 0.0, 1.0));
@ -288,7 +288,7 @@ class Label extends BaseBillboard {
/**
* Sets text outline color.
* @public
* @param {og.math.Vector4} rgba - Color vector.
* @param {og.Vec4} rgba - Color vector.
*/
setOutlineColor4v(rgba) {
this._outlineColor.x = rgba.x;
@ -310,7 +310,7 @@ class Label extends BaseBillboard {
/**
* Gets outline color vector.
* @public
* @returns {og.math.Vector4}
* @returns {og.Vec4}
*/
getOutlineColor() {
return this._outlineColor;

View File

@ -18,7 +18,7 @@ const INDEX_BUFFER = 1;
* @class
* @param {Object} [options] - Polyline options:
* @param {number} [options.thickness] - Thickness in screen pixels 1.5 is default.
* @param {og.math.Vector4} [options.color] - RGBA color.
* @param {og.Vec4} [options.color] - RGBA color.
* @param {Boolean} [options.visibility] - Polyline visibility. True default.
* @param {Boolean} [options.isClosed] - Closed geometry type identificator.
* @param {Array.<Array.<number,number,number>>} [options.pathLonLat] - Polyline geodetic coordinates array.
@ -49,7 +49,7 @@ class Polyline {
/**
* Polyline RGBA color.
* @public
* @type {og.math.Vector4}
* @type {og.Vec4}
*/
this.color = utils.createColorRGBA(options.color, new Vec4(1.0, 1.0, 1.0, 1.0));
@ -70,7 +70,7 @@ class Polyline {
/**
* Polyline cartesian coordinates.
* @private
* @type {Array.<og.math.Vector3>}
* @type {Array.<og.Vec3>}
*/
this._path3v = [];
@ -712,7 +712,7 @@ class Polyline {
/**
* Adds a new cartesian point in the end of the path.
* @public
* @param {og.math.Vector3} point3v - New coordinate.
* @param {og.Vec3} point3v - New coordinate.
* @param {number} [multiLineIndex=0] - Path part index, first by default.
*/
addPoint3v(point3v, multiLineIndex) {
@ -774,7 +774,7 @@ class Polyline {
/**
* Sets Polyline RGB color.
* @public
* @param {og.math.Vector3} color - RGB color.
* @param {og.Vec3} color - RGB color.
*/
setColor3v(color) {
this.color.x = color.x;
@ -785,7 +785,7 @@ class Polyline {
/**
* Sets Polyline RGBA color.
* @public
* @param {og.math.Vector4} color - RGBA color.
* @param {og.Vec4} color - RGBA color.
*/
setColor4v(color) {
this.color.x = color.x;
@ -913,7 +913,7 @@ class Polyline {
/**
* Returns path cartesian coordinates.
* @return {Array.<og.math.Vector3>} Polyline path.
* @return {Array.<og.Vec3>} Polyline path.
*/
getPath3v() {
return this._path3v;

View File

@ -12,7 +12,7 @@ import { LonLat } from '../LonLat.js';
/**
* BaseGeoImage layer represents square imagery layer that could be an static image, or animated video or webgl buffer object displayed on the globe.
* @class
* @extends {og.layer.Layer}
* @extends {og.Layer}
*/
class BaseGeoImage extends Layer {
constructor(name, options) {

View File

@ -32,7 +32,7 @@ const EVENT_NAMES = [
/**
* Layer used to rendering each tile as a separate canvas object.
* @class
* @extends {og.layer.Layer}
* @extends {og.Layer}
* //TODO: make asynchronous handler.
* @param {String} [name="noname"] - Layer name.
* @param {Object} options:

View File

@ -30,14 +30,14 @@ export const FADING_FACTOR = 0.33;
* @param {boolean} [options.isBaseLayer=false] - This is a base layer.
* @param {boolean} [options.visibility=true] - Layer visibility.
* @param {og.Extent} [options.extent=[[-180.0, -90.0], [180.0, 90.0]]] - Visible extent.
* @param {og.math.Vector3} [options.ambient=[0.1, 0.1, 0.21]] - Ambient RGB color.
* @param {og.math.Vector3} [options.diffuse=[1.0, 1.0, 1.0]] - Diffuse RGB color.
* @param {og.math.Vector3} [options.specular=[0.00025, 0.00015, 0.0001]] - Specular RGB color.
* @param {og.Vec3} [options.ambient=[0.1, 0.1, 0.21]] - Ambient RGB color.
* @param {og.Vec3} [options.diffuse=[1.0, 1.0, 1.0]] - Diffuse RGB color.
* @param {og.Vec3} [options.specular=[0.00025, 0.00015, 0.0001]] - Specular RGB color.
* @param {Number} [options.shininess=100] - Shininess.
*
* @fires og.layer.Layer#visibilitychange
* @fires og.layer.Layer#add
* @fires og.layer.Layer#remove
* @fires og.Layer#visibilitychange
* @fires og.Layer#add
* @fires og.Layer#remove
* @fires og.layer.Vector#mousemove
* @fires og.layer.Vector#mouseenter
* @fires og.layer.Vector#mouseleave
@ -193,7 +193,7 @@ class Layer {
/**
* Layer picking color. Assign when added to the planet.
* @protected
* @type {og.math.Vector3}
* @type {og.Vec3}
*/
this._pickingColor = new Vec3();
@ -290,7 +290,7 @@ class Layer {
/**
* Compares layers instances.
* @public
* @param {og.layer.Layer} layer - Layer instance to compare.
* @param {og.Layer} layer - Layer instance to compare.
* @returns {boolean} - Returns true if the layers is the same instance of the input.
*/
isEqual(layer) {
@ -337,7 +337,7 @@ class Layer {
/**
* Removes from planet.
* @public
* @returns {og.layer.Layer} -This layer.
* @returns {og.Layer} -This layer.
*/
remove() {
var p = this._planet;
@ -572,169 +572,169 @@ class Layer {
const EVENT_NAMES = [
/**
* Triggered when layer visibilty chanched.
* @event og.layer.Layer#visibilitychange
* @event og.Layer#visibilitychange
*/
"visibilitychange",
/**
* Triggered when layer has added to the planet.
* @event og.layer.Layer#add
* @event og.Layer#add
*/
"add",
/**
* Triggered when layer has removed from the planet.
* @event og.layer.Layer#remove
* @event og.Layer#remove
*/
"remove",
/**
* Triggered when mouse moves over the layer.
* @event og.layer.Layer#mousemove
* @event og.Layer#mousemove
*/
"mousemove",
/**
* Triggered when mouse has entered over the layer.
* @event og.layer.Layer#mouseenter
* @event og.Layer#mouseenter
*/
"mouseenter",
/**
* Triggered when mouse leaves the layer.
* @event og.layer.Layer#mouseenter
* @event og.Layer#mouseenter
*/
"mouseleave",
/**
* Mouse left button clicked.
* @event og.layer.Layer#lclick
* @event og.Layer#lclick
*/
"lclick",
/**
* Mouse right button clicked.
* @event og.layer.Layer#rclick
* @event og.Layer#rclick
*/
"rclick",
/**
* Mouse right button clicked.
* @event og.layer.Layer#mclick
* @event og.Layer#mclick
*/
"mclick",
/**
* Mouse left button double click.
* @event og.layer.Layer#ldblclick
* @event og.Layer#ldblclick
*/
"ldblclick",
/**
* Mouse right button double click.
* @event og.layer.Layer#rdblclick
* @event og.Layer#rdblclick
*/
"rdblclick",
/**
* Mouse middle button double click.
* @event og.layer.Layer#mdblclick
* @event og.Layer#mdblclick
*/
"mdblclick",
/**
* Mouse left button up(stop pressing).
* @event og.layer.Layer#lup
* @event og.Layer#lup
*/
"lup",
/**
* Mouse right button up(stop pressing).
* @event og.layer.Layer#rup
* @event og.Layer#rup
*/
"rup",
/**
* Mouse middle button up(stop pressing).
* @event og.layer.Layer#mup
* @event og.Layer#mup
*/
"mup",
/**
* Mouse left button is just pressed down(start pressing).
* @event og.layer.Layer#ldown
* @event og.Layer#ldown
*/
"ldown",
/**
* Mouse right button is just pressed down(start pressing).
* @event og.layer.Layer#rdown
* @event og.Layer#rdown
*/
"rdown",
/**
* Mouse middle button is just pressed down(start pressing).
* @event og.layer.Layer#mdown
* @event og.Layer#mdown
*/
"mdown",
/**
* Mouse left button is pressing.
* @event og.layer.Layer#lhold
* @event og.Layer#lhold
*/
"lhold",
/**
* Mouse right button is pressing.
* @event og.layer.Layer#rhold
* @event og.Layer#rhold
*/
"rhold",
/**
* Mouse middle button is pressing.
* @event og.layer.Layer#mhold
* @event og.Layer#mhold
*/
"mhold",
/**
* Mouse wheel is rotated.
* @event og.layer.Layer#mousewheel
* @event og.Layer#mousewheel
*/
"mousewheel",
/**
* Triggered when touching moves over the layer.
* @event og.layer.Layer#touchmove
* @event og.Layer#touchmove
*/
"touchmove",
/**
* Triggered when layer begins to touch.
* @event og.layer.Layer#touchstart
* @event og.Layer#touchstart
*/
"touchstart",
/**
* Triggered when layer has finished touching.
* @event og.layer.Layer#touchend
* @event og.Layer#touchend
*/
"touchend",
/**
* Triggered layer has double touched.
* @event og.layer.Layer#doubletouch
* @event og.Layer#doubletouch
*/
"doubletouch",
/**
* Triggered when touching leaves layer borders.
* @event og.layer.Layer#touchleave
* @event og.Layer#touchleave
*/
"touchleave",
/**
* Triggered when touch enters over the layer.
* @event og.layer.Layer#touchenter
* @event og.Layer#touchenter
*/
"touchenter"
];

View File

@ -42,7 +42,7 @@ function _entitiesConstructor(entities) {
* Vector layer represents alternative entities store. Used for geospatial data rendering like
* points, lines, polygons, geometry objects etc.
* @class
* @extends {og.layer.Layer}
* @extends {og.Layer}
* @param {string} [name="noname"] - Layer name.
* @param {Object} [options] - Layer options:
* @param {number} [options.minZoom=0] - Minimal visible zoom. 0 is default
@ -573,24 +573,24 @@ class Vector extends Layer {
var visibleExtent = this._planet.getViewExtent();
var e = this._polylineEntityCollection._entities;
var e_i = e.length;
let res = new Vec3();
while (e_i--) {
var p = e[e_i].polyline;
if (visibleExtent.overlaps(p._extent)) {
var coords = p._pathLonLatMerc;
var c_j = coords.length;
let coords = p._pathLonLatMerc,
c_j = coords.length;
while (c_j--) {
var c_j_h = coords[c_j].length;
while (c_j_h--) {
var ll = coords[c_j][c_j_h];
var n_k = nodes.length;
let ll = coords[c_j][c_j_h],
n_k = nodes.length;
while (n_k--) {
var seg = nodes[n_k].segment;
if (seg._extent.isInside(ll)) {
var cart = p._path3v[c_j][c_j_h];
var res = new Vec3();
let cart = p._path3v[c_j][c_j_h];
seg.getTerrainPoint(res, cart, ll);
p.setPoint3v(res.addA(res.normal().scale(rtg && p.altitude || 1.0)), c_j_h, c_j, true);
p.setPoint3v(res.addA(res.normal().scale(rtg && p.altitude || 0.0)), c_j_h, c_j, true);
break;
}
}
@ -782,7 +782,6 @@ class Vector extends Layer {
update() {
this._geometryHandler.update();
this.collectVisibleCollections(this._planet._frustumEntityCollections);
this.events.dispatch(this.events.draw, this);
}
};

View File

@ -15,7 +15,7 @@ import { RENDERING } from '../quadTree/quadTree.js';
/**
* Represents an imagery tiles source provider.
* @class
* @extends {og.layer.Layer}
* @extends {og.Layer}
* @param {string} name - Layer name.
* @param {Object} options:
* @param {number} [options.opacity=1.0] - Layer opacity.

View File

@ -11,10 +11,10 @@ import { Vec3 } from '../math/Vec3.js';
* @class
* @param {string} [name] - Light source name.
* @param {Object} [params] - Light parameters:
* @param {og.math.Vector3} [params.position] - Light source position if it is a point light, otherwise it is a light direction vector.
* @param {og.math.Vector3} [params.ambient] - Ambient RGB color.
* @param {og.math.Vector3} [params.diffuse] - Diffuse RGB color.
* @param {og.math.Vector3} [params.specular] - Specular RGB color.
* @param {og.Vec3} [params.position] - Light source position if it is a point light, otherwise it is a light direction vector.
* @param {og.Vec3} [params.ambient] - Ambient RGB color.
* @param {og.Vec3} [params.diffuse] - Diffuse RGB color.
* @param {og.Vec3} [params.specular] - Specular RGB color.
* @param {number} [params.shininess] - Specular shininess.
*/
class LightSource {
@ -49,7 +49,7 @@ class LightSource {
/**
* Light position.
* @protected
* @type {og.math.Vector3}
* @type {og.Vec3}
*/
this._position = params.position || new Vec3();
@ -63,21 +63,21 @@ class LightSource {
/**
* Ambient color.
* @protected
* @type {og.math.Vector3}
* @type {og.Vec3}
*/
this._ambient = params.ambient || new Vec3();
/**
* Diffuse color.
* @protected
* @type {og.math.Vector3}
* @type {og.Vec3}
*/
this._diffuse = params.diffuse || new Vec3(0.8, 0.8, 0.8);
/**
* Specular color.
* @protected
* @type {og.math.Vector3}
* @type {og.Vec3}
*/
this._specular = params.specular || new Vec3(0.18, 0.18, 0.18);
@ -158,7 +158,7 @@ class LightSource {
/**
* Set light source position, or if it is a directional type sets light direction vector.
* @public
* @param {og.math.Vector3} position - Light position or direction vector.
* @param {og.Vec3} position - Light position or direction vector.
* @returns {og.LightSource}
*/
setPosition(position) {
@ -171,7 +171,7 @@ class LightSource {
/**
* Returns light source position, or if it is a directional type sets light direction vector.
* @public
* @returns {og.math.Vector3} - Light source position/direction.
* @returns {og.Vec3} - Light source position/direction.
*/
getPosition() {
return this._position.clone();
@ -180,7 +180,7 @@ class LightSource {
/**
* Set ambient color.
* @public
* @param {og.math.Vector3} rgb - Ambient color.
* @param {og.Vec3} rgb - Ambient color.
* @returns {og.LightSource}
*/
setAmbient(rgb) {
@ -200,7 +200,7 @@ class LightSource {
/**
* Set diffuse color.
* @public
* @param {og.math.Vector3} rgb - Diffuse color.
* @param {og.Vec3} rgb - Diffuse color.
* @returns {og.LightSource}
*/
setDiffuse(rgb) {
@ -220,7 +220,7 @@ class LightSource {
/**
* Set specular color.
* @public
* @param {og.math.Vector3} rgb - Specular color.
* @param {og.Vec3} rgb - Specular color.
* @returns {og.LightSource}
*/
setSpecular(rgb) {

View File

@ -285,11 +285,11 @@ export function lerp(t, h1, h0) {
* Performs a 3D bezier interpolation.
* @function
* @param {number} t - Interpolation value.
* @param {og.math.Vector3} p0 - First control point.
* @param {og.math.Vector3} p1 - Second control point.
* @param {og.math.Vector3} p2 - Third control point.
* @param {og.math.Vector3} p3 - Fourth control point.
* @returns {og.math.Vector3} -
* @param {og.Vec3} p0 - First control point.
* @param {og.Vec3} p1 - Second control point.
* @param {og.Vec3} p2 - Third control point.
* @param {og.Vec3} p3 - Fourth control point.
* @returns {og.Vec3} -
*/
export function bezier(t, p0, p1, p2, p3) {
var u = 1 - t;

View File

@ -24,7 +24,7 @@ const Mat3 = function () {
/**
* Mat3 factory.
* @static
* @return {og.math.Mat3}
* @return {og.Mat3}
*/
export function mat3() {
@ -35,7 +35,7 @@ export function mat3() {
* Sets column-major order array matrix.
* @public
* @param {Array.<number>} m - Matrix array.
* @returns {og.math.Mat3}
* @returns {og.Mat3}
*/
Mat3.prototype.set = function (m) {
this._m[0] = m[0];
@ -53,7 +53,7 @@ Mat3.prototype.set = function (m) {
/**
* Duplicates a Mat3 instance.
* @public
* @returns {og.math.Mat3}
* @returns {og.Mat3}
*/
Mat3.prototype.clone = function () {
var res = new Mat3();
@ -64,8 +64,8 @@ Mat3.prototype.clone = function () {
/**
* Copy matrix.
* @public
* @param {og.math.Mat3} a - Matrix to copy.
* @returns {og.math.Mat3}
* @param {og.Mat3} a - Matrix to copy.
* @returns {og.Mat3}
*/
Mat3.prototype.copy = function (a) {
return this.set(a._m);
@ -74,7 +74,7 @@ Mat3.prototype.copy = function (a) {
/**
* Creates trasposed matrix from the current.
* @public
* @returns {og.math.Mat3}
* @returns {og.Mat3}
*/
Mat3.prototype.transposeTo = function () {
var res = new Mat3();
@ -88,7 +88,7 @@ Mat3.prototype.transposeTo = function () {
/**
* Sets matrix to identity.
* @public
* @returns {og.math.Mat3}
* @returns {og.Mat3}
*/
Mat3.prototype.setIdentity = function () {
this._m[0] = 1; this._m[1] = 0; this._m[2] = 0;
@ -100,8 +100,8 @@ Mat3.prototype.setIdentity = function () {
/**
* Multiply to 3d vector.
* @public
* @params {og.math.Vector3} p - 3d vector.
* @returns {og.math.Vector3}
* @params {og.Vec3} p - 3d vector.
* @returns {og.Vec3}
*/
Mat3.prototype.mulVec = function (p) {
var d = p.x, e = p.y, g = p.z;
@ -116,7 +116,7 @@ Mat3.prototype.mulVec = function (p) {
/**
* Converts to 4x4 matrix.
* @public
* @returns {og.math.Matrix4}
* @returns {og.Mat4}
*/
Mat3.prototype.toMatrix4 = function () {
var res = new Mat4();

View File

@ -56,16 +56,16 @@ const Mat4 = function () {
/**
* Mat4 factory.
* @static
* @returns {og.math.Mat4}
* @returns {og.Mat4}
*/
export function mat4() {
return new og.math.Mat4();
return new og.Mat4();
};
/**
* Returns identity matrix instance.
* @static
* @returns {og.math.Mat4}
* @returns {og.Mat4}
*/
Mat4.identity = function () {
var res = new Mat4();
@ -80,7 +80,7 @@ Mat4.identity = function () {
* Sets column-major order array matrix.
* @public
* @param {Array.<number>} m - Matrix array.
* @returns {og.math.Mat4}
* @returns {og.Mat4}
*/
Mat4.prototype.set = function (m) {
this._m[0] = m[0];
@ -105,7 +105,7 @@ Mat4.prototype.set = function (m) {
/**
* Duplicates a Matrix3 instance.
* @public
* @returns {og.math.Mat4}
* @returns {og.Mat4}
*/
Mat4.prototype.clone = function () {
var res = new Mat4();
@ -116,8 +116,8 @@ Mat4.prototype.clone = function () {
/**
* Copy matrix.
* @public
* @param {og.math.Matrix3} a - Matrix to copy.
* @returns {og.math.Mat4}
* @param {og.Mat3} a - Matrix to copy.
* @returns {og.Mat4}
*/
Mat4.prototype.copy = function (a) {
this.set(a._m);
@ -126,7 +126,7 @@ Mat4.prototype.copy = function (a) {
/**
* Converts to 3x3 matrix.
* @public
* @returns {og.math.Matrix3}
* @returns {og.Mat3}
*/
Mat4.prototype.toMatrix3 = function () {
var res = new Mat3();
@ -147,8 +147,8 @@ Mat4.prototype.toMatrix3 = function () {
/**
* Multiply to 3d vector.
* @public
* @param {og.math.Vector3} p - 3d vector.
* @returns {og.math.Vector3}
* @param {og.Vec3} p - 3d vector.
* @returns {og.Vec3}
*/
Mat4.prototype.mulVec3 = function (p) {
var d = p.x, e = p.y, g = p.z;
@ -162,8 +162,8 @@ Mat4.prototype.mulVec3 = function (p) {
/**
* Multiply to 4d vector.
* @public
* @param {og.math.Vector4} p - 4d vector.
* @returns {og.math.Vector4}
* @param {og.Vec4} p - 4d vector.
* @returns {og.Vec4}
*/
Mat4.prototype.mulVec4 = function (p) {
var d = p.x, e = p.y, g = p.z, f = p.w;
@ -178,7 +178,7 @@ Mat4.prototype.mulVec4 = function (p) {
/**
* Creates an inversed 3x3 matrix of the current.
* @public
* @returns {og.math.Matrix3}
* @returns {og.Mat3}
*/
Mat4.prototype.toInverseMatrix3 = function () {
var a = this._m;
@ -209,7 +209,7 @@ Mat4.prototype.toInverseMatrix3 = function () {
/**
* Creates an inversed matrix of the current.
* @public
* @returns {og.math.Mat4}
* @returns {og.Mat4}
*/
Mat4.prototype.inverseTo = function () {
var c = this._m[0], d = this._m[1], e = this._m[2], g = this._m[3],
@ -241,7 +241,7 @@ Mat4.prototype.inverseTo = function () {
/**
* Creates a trasposed matrix of the current.
* @public
* @returns {og.math.Mat4}
* @returns {og.Mat4}
*/
Mat4.prototype.transposeTo = function () {
var res = new Mat4();
@ -255,7 +255,7 @@ Mat4.prototype.transposeTo = function () {
/**
* Sets matrix to identity.
* @public
* @returns {og.math.Mat4}
* @returns {og.Mat4}
*/
Mat4.prototype.setIdentity = function () {
this._m[0] = 1; this._m[1] = 0; this._m[2] = 0; this._m[3] = 0;
@ -268,8 +268,8 @@ Mat4.prototype.setIdentity = function () {
/**
* Computes the product of two matrices.
* @public
* @param {og.math.Mat4} mx - Matrix to multiply.
* @returns {og.math.Mat4}
* @param {og.Mat4} mx - Matrix to multiply.
* @returns {og.Mat4}
*/
Mat4.prototype.mul = function (mx) {
let d = this._m[0], e = this._m[1], g = this._m[2], f = this._m[3],
@ -293,8 +293,8 @@ Mat4.prototype.mul = function (mx) {
/**
* Add translation vector to the current matrix.
* @public
* @param {og.math.Vector3} v - Translate vector.
* @returns {og.math.Mat4}
* @param {og.Vec3} v - Translate vector.
* @returns {og.Mat4}
*/
Mat4.prototype.translate = function (v) {
var d = v.x, e = v.y, b = v.z;
@ -309,8 +309,8 @@ Mat4.prototype.translate = function (v) {
/**
* Sets translation matrix to the position.
* @public
* @param {og.math.Vector3} v - Translate to position.
* @returns {og.math.Mat4}
* @param {og.Vec3} v - Translate to position.
* @returns {og.Mat4}
*/
Mat4.prototype.translateToPosition = function (v) {
var a = this._m;
@ -323,9 +323,9 @@ Mat4.prototype.translateToPosition = function (v) {
/**
* Rotate currrent matrix around the aligned axis and angle.
* @public
* @param {og.math.Vector3} u - Aligned axis.
* @param {og.Vec3} u - Aligned axis.
* @param {number} angle - Aligned axis angle in radians.
* @returns {og.math.Mat4}
* @returns {og.Mat4}
* @todo: OPTIMIZE: reveal multiplication
*/
Mat4.prototype.rotate = function (u, angle) {
@ -343,9 +343,9 @@ Mat4.prototype.rotate = function (u, angle) {
/**
* Sets current rotation matrix around the aligned axis and angle.
* @public
* @param {og.math.Vector3} u - Aligned axis.
* @param {og.Vec3} u - Aligned axis.
* @param {number} angle - Aligned axis angle in radians.
* @returns {og.math.Mat4}
* @returns {og.Mat4}
*/
Mat4.prototype.setRotation = function (u, angle) {
var c = Math.cos(angle),
@ -361,9 +361,9 @@ Mat4.prototype.setRotation = function (u, angle) {
/**
* Gets the rotation matrix from one vector to another.
* @public
* @param {og.math.Vector3} a - Firtst vector.
* @param {og.math.Vector3} b - Second vector.
* @returns {og.math.Mat4}
* @param {og.Vec3} a - Firtst vector.
* @param {og.Vec3} b - Second vector.
* @returns {og.Mat4}
*/
Mat4.prototype.rotateBetweenVectors = function (a, b) {
var q = Quat.getRotationBetweenVectors(a, b);
@ -373,8 +373,8 @@ Mat4.prototype.rotateBetweenVectors = function (a, b) {
/**
* Scale current matrix to the vector values.
* @public
* @param {og.math.Vector3} v - Scale vector.
* @returns {og.math.Mat4}
* @param {og.Vec3} v - Scale vector.
* @returns {og.Mat4}
*/
Mat4.prototype.scale = function (v) {
var mx = this._m;
@ -394,7 +394,7 @@ Mat4.prototype.scale = function (v) {
* @param {number} top
* @param {number} near
* @param {number} far
* @returns {og.math.Mat4}
* @returns {og.Mat4}
*/
Mat4.prototype.setFrustum = function (left, right, bottom, top, near, far) {
@ -432,7 +432,7 @@ Mat4.prototype.setFrustum = function (left, right, bottom, top, near, far) {
* @param {number} aspect - Screen aspect ratio.
* @param {number} near - Near clip plane.
* @param {number} far - Far clip plane.
* @retuns {og.math.Mat4}
* @retuns {og.Mat4}
*/
Mat4.prototype.setPerspective = function (angle, aspect, near, far) {
angle = near * Math.tan(angle * Math.PI / 360);
@ -449,7 +449,7 @@ Mat4.prototype.setPerspective = function (angle, aspect, near, far) {
* @param {number} top
* @param {number} near
* @param {number} far
* @retuns {og.math.Mat4}
* @retuns {og.Mat4}
*/
Mat4.prototype.setOrtho = function (left, right, bottom, top, near, far) {
this.left = left;
@ -489,7 +489,7 @@ Mat4.prototype.setOrtho = function (left, right, bottom, top, near, far) {
* @param {number} ax - Rotation angle in radians arond X axis.
* @param {number} ay - Rotation angle in radians arond Y axis.
* @param {number} az - Rotation angle in radians arond Z axis.
* @returns {og.math.Mat4}
* @returns {og.Mat4}
*/
Mat4.prototype.eulerToMatrix = function (ax, ay, az) {
var a = Math.cos(ax),

View File

@ -58,7 +58,7 @@ const Quat = function (x, y, z, w) {
* @param {Number} [y=0.0] The Y component.
* @param {Number} [z=0.0] The Z component.
* @param {Number} [w=0.0] The W component.
* @returns {og.math.Quat}
* @returns {og.Quat}
*/
export function quat(x, y, z, w) {
return new Quat(x, y, z, w);
@ -67,7 +67,7 @@ export function quat(x, y, z, w) {
/**
* Identity Quat.
* @const
* @type {og.math.Quat}
* @type {og.Quat}
*/
Quat.IDENTITY = new Quat(0.0, 0.0, 0.0, 1.0);
@ -75,7 +75,7 @@ Quat.IDENTITY = new Quat(0.0, 0.0, 0.0, 1.0);
* Returns a Quat represents rotation around X axis.
* @static
* @param {number} a - The angle in radians to rotate around the axis.
* @returns {og.math.Quat}
* @returns {og.Quat}
*/
Quat.xRotation = function (a) {
a *= 0.5;
@ -86,7 +86,7 @@ Quat.xRotation = function (a) {
* Returns a Quat represents rotation around Y axis.
* @static
* @param {number} a - The angle in radians to rotate around the axis.
* @returns {og.math.Quat}
* @returns {og.Quat}
*/
Quat.yRotation = function (a) {
a *= 0.5;
@ -97,7 +97,7 @@ Quat.yRotation = function (a) {
* Returns a Quat represents rotation around Z axis.
* @static
* @param {number} a - The angle in radians to rotate around the axis.
* @returns {og.math.Quat}
* @returns {og.Quat}
*/
Quat.zRotation = function (a) {
a *= 0.5;
@ -107,9 +107,9 @@ Quat.zRotation = function (a) {
/**
* Computes a Quat representing a rotation around an axis.
* @static
* @param {og.math.Vector3} axis - The axis of rotation.
* @param {og.Vec3} axis - The axis of rotation.
* @param {number} angle The angle in radians to rotate around the axis.
* @returns {og.math.Quat}
* @returns {og.Quat}
*/
Quat.axisAngleToQuat = function (axis, angle) {
var res = new Quat();
@ -123,9 +123,9 @@ Quat.axisAngleToQuat = function (axis, angle) {
/**
* Computes a rotation from the given heading and up vector.
* @static
* @param {og.math.Vector3} target - Heading target coordinates.
* @param {og.math.Vector3} up - Up vector.
* @returns {og.math.Quat}
* @param {og.Vec3} target - Heading target coordinates.
* @param {og.Vec3} up - Up vector.
* @returns {og.Quat}
*/
Quat.getLookAtTargetUp = function (target, up) {
var forward = target.normal();
@ -143,9 +143,9 @@ Quat.getLookAtTargetUp = function (target, up) {
/**
* Computes a Quat from from source point heading to the destination point.
* @static
* @param {og.math.Vector3} sourcePoint - Source coordinate.
* @param {og.math.Vector3} destPoint - Destination coordinate.
* @returns {og.math.Quat}
* @param {og.Vec3} sourcePoint - Source coordinate.
* @param {og.Vec3} destPoint - Destination coordinate.
* @returns {og.Quat}
*/
Quat.getLookAtSourceDest = function (sourcePoint, destPoint) {
var forwardVector = destPoint.subA(sourcePoint).normalize();
@ -164,9 +164,9 @@ Quat.getLookAtSourceDest = function (sourcePoint, destPoint) {
/**
* Compute rotation between two vectors.
* @static
* @param {og.math.Vector3} u - First vector.
* @param {og.math.Vector3} v - Second vector.
* @returns {og.math.Quat}
* @param {og.Vec3} u - First vector.
* @param {og.Vec3} v - Second vector.
* @returns {og.Quat}
*/
Quat.getRotationBetweenVectors = function (u, v) {
var w = u.cross(v);
@ -177,10 +177,10 @@ Quat.getRotationBetweenVectors = function (u, v) {
/**
* Compute rotation between two vectors with around vector up for exactly opposite vectors. If vectors exaclty in the same direction than returns identity Quat.
* @static
* @param {og.math.Vector3} source - First vector.
* @param {og.math.Vector3} dest - Second vector.
* @param {og.math.Vector3} up - Up vector.
* @returns {og.math.Quat}
* @param {og.Vec3} source - First vector.
* @param {og.Vec3} dest - Second vector.
* @param {og.Vec3} up - Up vector.
* @returns {og.Quat}
*/
Quat.getRotationBetweenVectorsUp = function (source, dest, up) {
var dot = source.dot(dest);
@ -202,7 +202,7 @@ Quat.getRotationBetweenVectorsUp = function (source, dest, up) {
/**
* Clear Quat. Sets zeroes.
* @public
* @returns {og.math.Quat}
* @returns {og.Quat}
*/
Quat.prototype.clear = function () {
this.x = this.y = this.z = this.w = 0;
@ -216,7 +216,7 @@ Quat.prototype.clear = function () {
* @param {Number} [y=0.0] The Y component.
* @param {Number} [z=0.0] The Z component.
* @param {Number} [w=0.0] The W component.
* @returns {og.math.Quat}
* @returns {og.Quat}
*/
Quat.prototype.set = function (x, y, z, w) {
this.x = x;
@ -229,8 +229,8 @@ Quat.prototype.set = function (x, y, z, w) {
/**
* Copy Quat values.
* @public
* @param {og.math.Quat} q - Copy Quat.
* @returns {og.math.Quat}
* @param {og.Quat} q - Copy Quat.
* @returns {og.Quat}
*/
Quat.prototype.copy = function (q) {
this.x = q.x;
@ -243,7 +243,7 @@ Quat.prototype.copy = function (q) {
/**
* Set current Quat instance to identity Quat.
* @public
* @returns {og.math.Quat}
* @returns {og.Quat}
*/
Quat.prototype.setIdentity = function () {
this.x = 0.0;
@ -256,7 +256,7 @@ Quat.prototype.setIdentity = function () {
/**
* Duplicates a Quat instance.
* @public
* @returns {og.math.Quat}
* @returns {og.Quat}
*/
Quat.prototype.clone = function () {
return new Quat(this.x, this.y, this.z, this.w);
@ -265,8 +265,8 @@ Quat.prototype.clone = function () {
/**
* Computes the componentwise sum of two Quats.
* @public
* @param {og.math.Quat} q - Quat to add.
* @returns {og.math.Quat}
* @param {og.Quat} q - Quat to add.
* @returns {og.Quat}
*/
Quat.prototype.add = function (q) {
return new Quat(this.x + q.x, this.y + q.y, this.z + q.z, this.w + q.w);
@ -275,8 +275,8 @@ Quat.prototype.add = function (q) {
/**
* Computes the componentwise difference of two Quats.
* @public
* @param {og.math.Quat} q - Quat to subtract.
* @returns {og.math.Quat}
* @param {og.Quat} q - Quat to subtract.
* @returns {og.Quat}
*/
Quat.prototype.sub = function (q) {
return new Quat(this.x - q.x, this.y - q.y, this.z - q.z, this.w - q.w);
@ -286,7 +286,7 @@ Quat.prototype.sub = function (q) {
* Multiplies the provided Quat componentwise by the provided scalar.
* @public
* @param {Number} scale - The scalar to multiply with.
* @returns {og.math.Quat}
* @returns {og.Quat}
*/
Quat.prototype.scaleTo = function (scale) {
return new Quat(this.x * scale, this.y * scale, this.z * scale, this.w * scale);
@ -307,7 +307,7 @@ Quat.prototype.toVec = function () {
* @param {number} lat - Latitude.
* @param {number} lon - Longitude.
* @param {number} angle - Angle in radians.
* @returns {og.math.Quat}
* @returns {og.Quat}
*/
Quat.prototype.setFromSphericalCoords = function (lat, lon, angle) {
var sin_a = Math.sin(angle / 2);
@ -352,9 +352,9 @@ Quat.prototype.toSphericalCoords = function () {
/**
* Sets current Quat representing a rotation around an axis.
* @public
* @param {og.math.Vector3} axis - The axis of rotation.
* @param {og.Vec3} axis - The axis of rotation.
* @param {number} angle The angle in radians to rotate around the axis.
* @returns {og.math.Quat}
* @returns {og.Quat}
*/
Quat.prototype.setFromAxisAngle = function (axis, angle) {
var v = axis.normal();
@ -392,7 +392,7 @@ Quat.prototype.getAxisAngle = function () {
* @param {number} pitch - Pitch angle in degrees.
* @param {number} yaw - Yaw angle in degrees.
* @param {number} roll - Roll angle in degrees.
* @returns {og.math.Quat}
* @returns {og.Quat}
*/
Quat.prototype.setFromEulerAngles = function (pitch, yaw, roll) {
var ex, ey, ez;
@ -434,7 +434,7 @@ Quat.prototype.getEulerAngles = function () {
/**
* Computes a Quat from the provided 4x4 matrix instance.
* @public
* @param {og.math.Matrix4} m - The rotation matrix.
* @param {og.Mat4} m - The rotation matrix.
*/
Quat.prototype.setFromMatrix4 = function (m) {
var tr, s, q = [];
@ -480,7 +480,7 @@ Quat.prototype.setFromMatrix4 = function (m) {
/**
* Converts current Quat to the rotation matrix.
* @public
* @returns {og.math.Matrix4}
* @returns {og.Mat4}
*/
Quat.prototype.getMat4 = function () {
var m = new Mat4();
@ -503,8 +503,8 @@ Quat.prototype.getMat4 = function () {
/**
* Returns quatrenion and vector production.
* @public
* @param {og.math.Vector3} v - 3d Vector.
* @returns {og.math.Vector3}
* @param {og.Vec3} v - 3d Vector.
* @returns {og.Vec3}
*/
Quat.prototype.mulVec3 = function (v) {
var d = v.x, e = v.y, g = v.z;
@ -522,8 +522,8 @@ Quat.prototype.mulVec3 = function (v) {
/**
* Computes the product of two Quats.
* @public
* @param {og.math.Quat} q - Quat to multiply.
* @returns {og.math.Quat}
* @param {og.Quat} q - Quat to multiply.
* @returns {og.Quat}
*/
Quat.prototype.mul = function (q) {
var d = this.x, e = this.y, g = this.z, a = this.w;
@ -538,7 +538,7 @@ Quat.prototype.mul = function (q) {
/**
* Gets the conjugate of the Quat.
* @public
* @returns {og.math.Quat}
* @returns {og.Quat}
*/
Quat.prototype.conjugate = function () {
return new Quat(-this.x, -this.y, -this.z, this.w);
@ -547,7 +547,7 @@ Quat.prototype.conjugate = function () {
/**
* Computes the inverse of the Quat.
* @public
* @retuns {og.math.Quat}
* @retuns {og.Quat}
*/
Quat.prototype.inverse = function () {
var n = 1 / this.magnitude2();
@ -577,7 +577,7 @@ Quat.prototype.magnitude2 = function () {
/**
* Computes the dot (scalar) product of two Quats.
* @public
* @param {og.math.Quat} q - Second quatrnion.
* @param {og.Quat} q - Second quatrnion.
* @returns {number}
*/
Quat.prototype.dot = function (q) {
@ -587,7 +587,7 @@ Quat.prototype.dot = function (q) {
/**
* Current Quat normalization.
* @public
* @returns {og.math.Quat}
* @returns {og.Quat}
*/
Quat.prototype.normalize = function () {
var c = this.x, d = this.y, e = this.z, g = this.w,
@ -610,7 +610,7 @@ Quat.prototype.normalize = function () {
/**
* Compares two Quats.
* @public
* @param {og.math.Quat} q - Second quatrnion.
* @param {og.Quat} q - Second quatrnion.
* @returns {boolean}
*/
Quat.prototype.isEqual = function (q) {
@ -624,9 +624,9 @@ Quat.prototype.isEqual = function (q) {
/**
* Performs a spherical linear interpolation between two Quats.
* @public
* @param {og.math.Quat} b - The end rotation Quat.
* @param {og.Quat} b - The end rotation Quat.
* @param {number} t - interpolation amount between the two Quats.
* @returns {og.math.Quat}
* @returns {og.Quat}
*/
Quat.prototype.slerp = function (b, t) {

View File

@ -11,22 +11,22 @@ import { Vec3 } from './Vec3.js';
/**
* Represents a ray that extends infinitely from the provided origin in the provided direction.
* @class
* @param {og.math.Vec3} origin - The origin of the ray.
* @param {og.math.Vec3} direction - The direction of the ray.
* @param {og.Vec3} origin - The origin of the ray.
* @param {og.Vec3} direction - The direction of the ray.
*/
const Ray = function (origin, direction) {
/**
* The origin of the ray.
* @public
* @type {og.math.Vec3}
* @type {og.Vec3}
*/
this.origin = origin.clone();
/**
* The direction of the ray.
* @public
* @type {og.math.Vec3}
* @type {og.Vec3}
*/
this.direction = direction.clone();
};
@ -34,9 +34,9 @@ const Ray = function (origin, direction) {
/**
* Ray object creator.
* @function
* @param {og.math.Vec3} origin - The origin of the ray.
* @param {og.math.Vec3} direction - The direction of the ray.
* @returns {og.math.Ray}
* @param {og.Vec3} origin - The origin of the ray.
* @param {og.Vec3} direction - The direction of the ray.
* @returns {og.Ray}
*/
export function ray(origin, direction) {
return new Ray(origin, direction);
@ -54,9 +54,9 @@ Ray.AWAY = 3;
/**
* Sets a ray parameters.
* @public
* @param {og.math.Vec3} origin - The origin of the ray.
* @param {og.math.Vec3} direction - The direction of the ray.
* @returns {og.math.Ray}
* @param {og.Vec3} origin - The origin of the ray.
* @param {og.Vec3} direction - The direction of the ray.
* @returns {og.Ray}
*/
Ray.prototype.set = function (origin, direction) {
this.origin = origin.clone();
@ -68,7 +68,7 @@ Ray.prototype.set = function (origin, direction) {
* Computes the point along the ray on the distance.
* @public
* @param {number} distance - Point distance.
* @returns {og.math.Vec3}
* @returns {og.Vec3}
*/
Ray.prototype.getPoint = function (distance) {
return Vec3.add(this.origin, this.direction.scaleTo(distance));
@ -77,12 +77,12 @@ Ray.prototype.getPoint = function (distance) {
/**
* Returns ray hit a triange result.
* @public
* @param {og.math.Vec3} v0 - First triangle corner coordinate.
* @param {og.math.Vec3} v1 - Second triangle corner coordinate.
* @param {og.math.Vec3} v2 - Third triangle corner coordinate.
* @param {og.math.Vec3} res - Hit point object pointer that stores hit result.
* @returns {number} - Hit code, could 0 - og.math.Ray.OUTSIDE, 1 - og.math.Ray.INSIDE,
* 2 - og.math.Ray.INPLANE and 3 - og.math.Ray.AWAY(ray goes away from triangle).
* @param {og.Vec3} v0 - First triangle corner coordinate.
* @param {og.Vec3} v1 - Second triangle corner coordinate.
* @param {og.Vec3} v2 - Third triangle corner coordinate.
* @param {og.Vec3} res - Hit point object pointer that stores hit result.
* @returns {number} - Hit code, could 0 - og.Ray.OUTSIDE, 1 - og.Ray.INSIDE,
* 2 - og.Ray.INPLANE and 3 - og.Ray.AWAY(ray goes away from triangle).
*/
Ray.prototype.hitTriangle = function (v0, v1, v2, res) {
var state;
@ -136,12 +136,12 @@ Ray.prototype.hitTriangle = function (v0, v1, v2, res) {
};
/**
* Gets a ray hit a plane result. If the ray cross the plane returns 1 - og.math.Ray.INSIDE otherwise returns 0 - og.math.Ray.OUTSIDE.
* Gets a ray hit a plane result. If the ray cross the plane returns 1 - og.Ray.INSIDE otherwise returns 0 - og.Ray.OUTSIDE.
* @public
* @param {og.math.Vec3} v0 - First plane point.
* @param {og.math.Vec3} v1 - Second plane point.
* @param {og.math.Vec3} v2 - Third plane point.
* @param {og.math.Vec3} res - Hit point object pointer that stores hit result.
* @param {og.Vec3} v0 - First plane point.
* @param {og.Vec3} v1 - Second plane point.
* @param {og.Vec3} v2 - Third plane point.
* @param {og.Vec3} res - Hit point object pointer that stores hit result.
* @returns {number}
*/
Ray.prototype.hitPlane = function (v0, v1, v2, res) {
@ -180,7 +180,7 @@ Ray.prototype.hitPlane = function (v0, v1, v2, res) {
* Returns a ray hit sphere coordiante. If there isn't hit returns null.
* @public
* @param {og.bv.Sphere} sphere - Sphere object.
* @returns {og.math.Vec3}
* @returns {og.Vec3}
*/
Ray.prototype.hitSphere = function (sphere) {
var r = sphere.radius,

View File

@ -152,7 +152,7 @@ Vec2.orthoNormalize = function (normal, tangent) {
/**
* Converts to 3d vector, third value is 0.0.
* @public
* @returns {og.math.Vector3}
* @returns {og.Vec3}
*/
Vec2.prototype.toVector3 = function () {
return new Vec3(this.x, this.y, 0);

View File

@ -56,7 +56,7 @@ Vec3.ZERO = new Vec3();
* @param {number} [x] - First cvalue.
* @param {number} [y] - Second value.
* @param {number} [z] - Third value.
* @returns {og.math.Vec3} -
* @returns {og.Vec3} -
*/
export function vec3(x, y, z) {
return new Vec3(x, y, z);
@ -66,7 +66,7 @@ export function vec3(x, y, z) {
* Creates 3d vector from array.
* @function
* @param {Array.<number,number,number>}
* @returns {og.math.Vec3} -
* @returns {og.Vec3} -
*/
Vec3.fromVec = function (arr) {
return new Vec3(arr[0], arr[1], arr[2]);
@ -75,8 +75,8 @@ Vec3.fromVec = function (arr) {
/**
* Gets angle between two vectors.
* @static
* @param {og.math.Vec3} a - First vector.
* @param {og.math.Vec3} b - Second vector.
* @param {og.Vec3} a - First vector.
* @param {og.Vec3} b - Second vector.
* @returns {number} -
*/
Vec3.angle = function (a, b) {
@ -86,10 +86,10 @@ Vec3.angle = function (a, b) {
/**
* Returns two vectors linear interpolation.
* @static
* @param {og.math.Vec3} v1 - Start vector.
* @param {og.math.Vec3} v2 - End vector.
* @param {og.Vec3} v1 - Start vector.
* @param {og.Vec3} v2 - End vector.
* @param {number} l - Interpolate value.
* @returns {og.math.Vec3} -
* @returns {og.Vec3} -
*/
Vec3.lerp = function (v1, v2, l) {
return Vec3(v1.x + (v2.x - v1.x) * l, v1.y + (v2.y - v1.y) * l, v1.z + (v2.z - v1.z) * l);
@ -98,9 +98,9 @@ Vec3.lerp = function (v1, v2, l) {
/**
* Returns summary vector.
* @static
* @param {og.math.Vec3} a - First vector.
* @param {og.math.Vec3} b - Second vector.
* @returns {og.math.Vec3} - Summary vector.
* @param {og.Vec3} a - First vector.
* @param {og.Vec3} b - Second vector.
* @returns {og.Vec3} - Summary vector.
*/
Vec3.add = function (a, b) {
var res = new Vec3(a.x, a.y, a.z);
@ -111,9 +111,9 @@ Vec3.add = function (a, b) {
/**
* Returns two vectors subtraction.
* @static
* @param {og.math.Vec3} a - First vector.
* @param {og.math.Vec3} b - Second vector.
* @returns {og.math.Vec3} - Vectors subtraction.
* @param {og.Vec3} a - First vector.
* @param {og.Vec3} b - Second vector.
* @returns {og.Vec3} - Vectors subtraction.
*/
Vec3.sub = function (a, b) {
var res = new Vec3(a.x, a.y, a.z);
@ -124,9 +124,9 @@ Vec3.sub = function (a, b) {
/**
* Returns scaled vector.
* @static
* @param {og.math.Vec3} a - Input vector.
* @param {og.Vec3} a - Input vector.
* @param {number} scale - Scale value.
* @returns {og.math.Vec3} -
* @returns {og.Vec3} -
*/
Vec3.scale = function (a, scale) {
var res = new Vec3(a.x, a.y, a.z);
@ -137,9 +137,9 @@ Vec3.scale = function (a, scale) {
/**
* Returns two vectors production.
* @static
* @param {og.math.Vec3} a - First vector.
* @param {og.math.Vec3} b - Second vector.
* @returns {og.math.Vec3} -
* @param {og.Vec3} a - First vector.
* @param {og.Vec3} b - Second vector.
* @returns {og.Vec3} -
*/
Vec3.mul = function (a, b) {
var res = new Vec3(a.x, a.y, a.z);
@ -150,9 +150,9 @@ Vec3.mul = function (a, b) {
/**
* Returns true if two vectors are non collinear.
* @public
* @param {og.math.Vec3} a - First vector.
* @param {og.math.Vec3} b - Second vector.
* @returns {og.math.Vec3} -
* @param {og.Vec3} a - First vector.
* @param {og.Vec3} b - Second vector.
* @returns {og.Vec3} -
*/
Vec3.noncollinear = function (a, b) {
return a.y * b.z - a.z * b.y || a.z * b.x - a.x * b.z || a.x * b.y - a.y * b.z;
@ -161,10 +161,10 @@ Vec3.noncollinear = function (a, b) {
/**
* Get projection of the vector to plane where n - normal to the plane.
* @static
* @param {og.math.Vec3} b - Vector to project.
* @param {og.math.Vec3} n - Plane normal.
* @param {og.math.Vec3} [def] - Default value for non existed result.
* @returns {og.math.Vec3} -
* @param {og.Vec3} b - Vector to project.
* @param {og.Vec3} n - Plane normal.
* @param {og.Vec3} [def] - Default value for non existed result.
* @returns {og.Vec3} -
*/
Vec3.proj_b_to_plane = function (b, n, def) {
var res = b.sub(n.scaleTo(n.dot(b) / n.dot(n)));
@ -177,9 +177,9 @@ Vec3.proj_b_to_plane = function (b, n, def) {
/**
* Get projection of the first vector to the second.
* @static
* @param {og.math.Vec3} b - First vector.
* @param {og.math.Vec3} a - Second vector.
* @returns {og.math.Vec3} -
* @param {og.Vec3} b - First vector.
* @param {og.Vec3} a - Second vector.
* @returns {og.Vec3} -
*/
Vec3.proj_b_to_a = function (b, a) {
return a.scaleTo(a.dot(b) / a.dot(a));
@ -189,9 +189,9 @@ Vec3.proj_b_to_a = function (b, a) {
* Makes vectors normalized and orthogonal to each other.
* Normalizes normal. Normalizes tangent and makes sure it is orthogonal to normal (that is, angle between them is 90 degrees).
* @static
* @param {og.math.Vec3} normal - Normal vector.
* @param {og.math.Vec3} tangent - Tangent vector.
* @returns {og.math.Vec3} -
* @param {og.Vec3} normal - Normal vector.
* @param {og.Vec3} tangent - Tangent vector.
* @returns {og.Vec3} -
*/
Vec3.orthoNormalize = function (normal, tangent) {
normal = normal.normal();
@ -202,9 +202,9 @@ Vec3.orthoNormalize = function (normal, tangent) {
/**
* Returns vector components division product one to another.
* @static
* @param {og.math.Vec3} a - First vector.
* @param {og.math.Vec3} b - Second vector.
* @returns {og.math.Vec3} -
* @param {og.Vec3} a - First vector.
* @param {og.Vec3} b - Second vector.
* @returns {og.Vec3} -
*/
Vec3.div = function (a, b) {
var res = new Vec3(a.x, a.y, a.z);
@ -215,7 +215,7 @@ Vec3.div = function (a, b) {
/**
* Converts to 4d vector, Fourth value is 1.0.
* @public
* @returns {og.math.Vector4} -
* @returns {og.Vec4} -
*/
Vec3.prototype.toVec4 = function () {
return new Vec4(this.x, this.y, this.z, 1.0);
@ -224,7 +224,7 @@ Vec3.prototype.toVec4 = function () {
/**
* Returns clone vector.
* @public
* @returns {og.math.Vec3} -
* @returns {og.Vec3} -
*/
Vec3.prototype.clone = function () {
return new Vec3(this.x, this.y, this.z);
@ -251,8 +251,8 @@ Vec3.prototype.isZero = function () {
/**
* Get projection of the first vector to the second.
* @static
* @param {og.math.Vec3} a - Project vector.
* @returns {og.math.Vec3} -
* @param {og.Vec3} a - Project vector.
* @returns {og.Vec3} -
*/
Vec3.prototype.projToVec = function (a) {
return a.scaleTo(a.dot(this) / a.dot(a));
@ -261,7 +261,7 @@ Vec3.prototype.projToVec = function (a) {
/**
* Compares with vector. Returns true if it equals another.
* @public
* @param {og.math.Vec3} p - Vector to compare.
* @param {og.Vec3} p - Vector to compare.
* @returns {boolean} -
*/
Vec3.prototype.equal = function (p) {
@ -270,8 +270,8 @@ Vec3.prototype.equal = function (p) {
/**
* Copy input vector's values.
* @param {og.math.Vec3} point3 - Vector to copy.
* @returns {og.math.Vec3} -
* @param {og.Vec3} point3 - Vector to copy.
* @returns {og.Vec3} -
*/
Vec3.prototype.copy = function (point3) {
this.x = point3.x;
@ -301,7 +301,7 @@ Vec3.prototype.length2 = function () {
/**
* Converts vector's values to a quaternion object.
* @public
* @returns {og.math.Quat} -
* @returns {og.Quat} -
*/
Vec3.prototype.getQuat = function () {
return new Quat(this.x, this.y, this.z);
@ -310,8 +310,8 @@ Vec3.prototype.getQuat = function () {
/**
* Adds vector to the current.
* @public
* @param {og.math.Vec3} point3 - Point to add.
* @returns {og.math.Vec3} -
* @param {og.Vec3} point3 - Point to add.
* @returns {og.Vec3} -
*/
Vec3.prototype.addA = function (point3) {
this.x += point3.x;
@ -323,8 +323,8 @@ Vec3.prototype.addA = function (point3) {
/**
* Gets two vectors summarization.
* @public
* @param {og.math.Vec3} point3 - Vector to add.
* @returns {og.math.Vec3} Returns a sum vector.
* @param {og.Vec3} point3 - Vector to add.
* @returns {og.Vec3} Returns a sum vector.
*/
Vec3.prototype.add = function (point3) {
return new Vec3(this.x + point3.x, this.y + point3.y, this.z + point3.z);
@ -333,8 +333,8 @@ Vec3.prototype.add = function (point3) {
/**
* Subtract vector from the current.
* @public
* @param {og.math.Vec3} point3 - Subtract vector.
* @returns {og.math.Vec3} -
* @param {og.Vec3} point3 - Subtract vector.
* @returns {og.Vec3} -
*/
Vec3.prototype.subA = function (point3) {
this.x -= point3.x;
@ -346,8 +346,8 @@ Vec3.prototype.subA = function (point3) {
/**
* Gets vector subtraction.
* @public
* @param {og.math.Vec3} point3 - Subtract vector.
* @return {og.math.Vec3} Returns new instance of a subtraction
* @param {og.Vec3} point3 - Subtract vector.
* @return {og.Vec3} Returns new instance of a subtraction
*/
Vec3.prototype.sub = function (point3) {
return new Vec3(this.x - point3.x, this.y - point3.y, this.z - point3.z);
@ -357,7 +357,7 @@ Vec3.prototype.sub = function (point3) {
* Scale current vector.
* @public
* @param {number} scale - Scale value.
* @returns {og.math.Vec3} -
* @returns {og.Vec3} -
*/
Vec3.prototype.scale = function (scale) {
this.x *= scale;
@ -370,7 +370,7 @@ Vec3.prototype.scale = function (scale) {
* Scale current vector to another instance.
* @public
* @param {number} scale - Scale value.
* @returns {og.math.Vec3} -
* @returns {og.Vec3} -
*/
Vec3.prototype.scaleTo = function (scale) {
return new Vec3(this.x * scale, this.y * scale, this.z * scale);
@ -379,8 +379,8 @@ Vec3.prototype.scaleTo = function (scale) {
/**
* Multiply current vector object to another and store result in the current instance.
* @public
* @param {og.math.Vec3} vec - Multiply vector.
* @returns {og.math.Vec3} -
* @param {og.Vec3} vec - Multiply vector.
* @returns {og.Vec3} -
*/
Vec3.prototype.mulA = function (vec) {
this.x *= vec.x;
@ -392,8 +392,8 @@ Vec3.prototype.mulA = function (vec) {
/**
* Multiply current vector object to another and returns new vector instance.
* @public
* @param {og.math.Vec3} vec - Multiply vector.
* @returns {og.math.Vec3} -
* @param {og.Vec3} vec - Multiply vector.
* @returns {og.Vec3} -
*/
Vec3.prototype.mul = function (vec) {
return new Vec3(this.x * vec.x, this.y * vec.y, this.z * vec.z);
@ -402,8 +402,8 @@ Vec3.prototype.mul = function (vec) {
/**
* Divide current vector's components to another. Results stores in the current vector object.
* @public
* @param {og.math.Vec3} vec - Div vector.
* @returns {og.math.Vec3} -
* @param {og.Vec3} vec - Div vector.
* @returns {og.Vec3} -
*/
Vec3.prototype.divA = function (vec) {
this.x /= vec.x;
@ -415,8 +415,8 @@ Vec3.prototype.divA = function (vec) {
/**
* Divide current vector's components to another and returns new vector instance.
* @public
* @param {og.math.Vec3} vec - Div vector.
* @returns {og.math.Vec3} -
* @param {og.Vec3} vec - Div vector.
* @returns {og.Vec3} -
*/
Vec3.prototype.div = function (vec) {
return new Vec3(this.x / vec.x, this.y / vec.y, this.z / vec.z);
@ -425,7 +425,7 @@ Vec3.prototype.div = function (vec) {
/**
* Gets vectors dot production.
* @public
* @param {og.math.Vec3} point3 - Another vector.
* @param {og.Vec3} point3 - Another vector.
* @returns {number} -
*/
Vec3.prototype.dot = function (point3) {
@ -446,8 +446,8 @@ Vec3.prototype.dotArr = function (arr) {
/**
* Gets vectors cross production.
* @public
* @param {og.math.Vec3} point3 - Another vector.
* @returns {og.math.Vec3} -
* @param {og.Vec3} point3 - Another vector.
* @returns {og.Vec3} -
*/
Vec3.prototype.cross = function (point3) {
return new Vec3(
@ -460,7 +460,7 @@ Vec3.prototype.cross = function (point3) {
/**
* Sets vector to zero.
* @public
* @returns {og.math.Vec3} -
* @returns {og.Vec3} -
*/
Vec3.prototype.clear = function () {
this.x = this.y = this.z = 0;
@ -470,7 +470,7 @@ Vec3.prototype.clear = function () {
/**
* Returns normalized vector.
* @public
* @returns {og.math.Vec3} -
* @returns {og.Vec3} -
*/
Vec3.prototype.normal = function () {
var res = new Vec3();
@ -488,7 +488,7 @@ Vec3.prototype.normal = function () {
/**
* Normalize current vector.
* @public
* @returns {og.math.Vec3} -
* @returns {og.Vec3} -
*/
Vec3.prototype.normalize = function () {
var length = 1.0 / this.length();
@ -522,7 +522,7 @@ Vec3.prototype.toArray = function () {
/**
* Gets distance to point.
* @public
* @param {og.math.Vec3} point3 - Distant point.
* @param {og.Vec3} point3 - Distant point.
* @returns {number} -
*/
Vec3.prototype.distance = function (point3) {
@ -535,7 +535,7 @@ Vec3.prototype.distance = function (point3) {
* @param {number} x - Value X.
* @param {number} y - Value Y.
* @param {number} z - Value Z.
* @returns {og.math.Vec3} -
* @returns {og.Vec3} -
*/
Vec3.prototype.set = function (x, y, z) {
this.x = x;
@ -547,7 +547,7 @@ Vec3.prototype.set = function (x, y, z) {
/**
* Negate current vector.
* @public
* @returns {og.math.Vec3} -
* @returns {og.Vec3} -
*/
Vec3.prototype.negate = function () {
this.x = -this.x;
@ -559,7 +559,7 @@ Vec3.prototype.negate = function () {
/**
* Negate current vector to another instance.
* @public
* @returns {og.math.Vec3} -
* @returns {og.Vec3} -
*/
Vec3.prototype.negateTo = function () {
return new Vec3(-this.x, -this.y, -this.z);
@ -568,9 +568,9 @@ Vec3.prototype.negateTo = function () {
/**
* Gets projected point coordinates of the current vector on the ray.
* @public
* @param {og.math.Vec3} pos - Ray position.
* @param {og.math.Vec3} direction - Ray direction.
* @returns {og.math.Vec3} -
* @param {og.Vec3} pos - Ray position.
* @param {og.Vec3} direction - Ray direction.
* @returns {og.Vec3} -
*/
Vec3.prototype.projToRay = function (pos, direction) {
var v = Vec3.proj_b_to_a(Vec3.sub(this, pos), direction);
@ -581,7 +581,7 @@ Vec3.prototype.projToRay = function (pos, direction) {
/**
* Gets angle between two vectors.
* @public
* @param {og.math.Vec3} a - Another vector.
* @param {og.Vec3} a - Another vector.
* @returns {number} -
*/
Vec3.prototype.angle = function (a) {
@ -591,9 +591,9 @@ Vec3.prototype.angle = function (a) {
/**
* Returns two vectors linear interpolation.
* @public
* @param {og.math.Vec3} v2 - End vector.
* @param {og.Vec3} v2 - End vector.
* @param {number} l - Interpolate value.
* @returns {og.math.Vec3} -
* @returns {og.Vec3} -
*/
Vec3.prototype.lerp = function (v2, l) {
return new Vec3(this.x + (v2.x - this.x) * l, this.y + (v2.y - this.y) * l, this.z + (v2.z - this.z) * l);
@ -602,9 +602,9 @@ Vec3.prototype.lerp = function (v2, l) {
/**
* Returns vector interpolation by v(t) = v1 * t + v2 * (1 - t)
* @public
* @param {og.math.Vec3} v2 - End vector.
* @param {og.Vec3} v2 - End vector.
* @param {number} t - Interpolate value.
* @returns {og.math.Vec3} -
* @returns {og.Vec3} -
*/
Vec3.prototype.smerp = function (v2, t) {
var one_d = 1 - t;
@ -619,9 +619,9 @@ Vec3.LERP_DELTA = 1e-6;
* the vectors are treated as directions rather than points in space. The direction of the returned vector is interpolated
* by the angle and its magnitude is interpolated between the magnitudes of from and to.
* @public
* @param {og.math.Vec3} v2 -
* @param {og.Vec3} v2 -
* @param {number} t - The parameter t is clamped to the range [0, 1].
* @returns {og.math.Vec3} -
* @returns {og.Vec3} -
*/
Vec3.prototype.slerp = function (v2, t) {
var res = new Vec3();

View File

@ -74,7 +74,7 @@ Vec4.fromVec = function (arr) {
/**
* Converts to 3d vector, without fourth value.
* @public
* @returns {og.math.Vector3}
* @returns {og.Vec3}
*/
Vec4.prototype.toVec3 = function () {
return new Vec3(this.x, this.y, this.z);
@ -209,7 +209,7 @@ Vec4.prototype.affinity = function () {
* Scale current vector to another instance.
* @public
* @param {number} scale - Scale value.
* @returns {og.math.Vector3}
* @returns {og.Vec3}
*/
Vec4.prototype.scaleTo = function (scale) {
return new Vec4(this.x * scale, this.y * scale, this.z * scale, this.w * scale);

View File

@ -10,7 +10,7 @@ import { Vec4 } from './Vec4.js';
/**
* Encode 32 bit float value to the RGBA vector.
* @function
* @param {nummer} v - 32 bit float value.
* @param {number} v - 32 bit float value.
* @returns {og.math.Vec4} - RGBA vector value.
*/
export function encodeFloatToRGBA(v) {
@ -22,7 +22,7 @@ export function encodeFloatToRGBA(v) {
/**
* Decode RGBA vector to 32 bit float value.
* @function
* @param {og.math.Vector4} rgba - RGBA encoded 32 bit float value.
* @param {og.Vec4} rgba - RGBA encoded 32 bit float value.
* @returns {number} - Float value.
*/
export function decodeFloatFromRGBA(rgba) {

View File

@ -50,7 +50,7 @@ const EVENT_NAMES = [
* @class
* @param {String} name - Layer user name.
* @param {Object} options:
* @extends {og.layer.Layer}
* @extends {og.Layer}
*/
class GmxVector extends Layer {
constructor(name, options) {

View File

@ -8,6 +8,6 @@ import { Units, Proj } from './Proj.js';
/**
* EPSG:3857 projection object.
* @type {og.proj.Projection}
* @type {og.Proj}
*/
export const EPSG3857 = new Proj({ code: "epsg:3857", units: Units.METERS });

View File

@ -8,6 +8,6 @@ import { Units, Proj } from './Proj.js';
/**
* EPSG:4326 projection object.
* @type {og.proj.Proj}
* @type {og.Proj}
*/
export const EPSG4326 = new Proj({ code: "epsg:4326", units: Units.DEGREES });

View File

@ -51,7 +51,7 @@ const Proj = function (options) {
/**
* Compare projections.
* @public
* @param {og.proj.Projection} proj - Projetion object.
* @param {og.Proj} proj - Projetion object.
* @returns {boolean}
*/
Proj.prototype.equal = function (proj) {

View File

@ -317,8 +317,9 @@ EntityCollectionNode.prototype.renderCollection = function (outArr, visibleNodes
};
EntityCollectionNode.prototype.alignEntityToTheGround = function (entity, segment) {
segment.getEntityTerrainPoint(entity, entity._cartesian);
entity._setCartesian3vSilent(entity._cartesian.addA(entity._cartesian.normal().scale(this.layer.relativeToGround && entity._altitude || 1.0)));
var res = new Vec3();
segment.getEntityTerrainPoint(entity, res);
entity._setCartesian3vSilent(res.addA(res.normal().scale(Number(this.layer.relativeToGround) && entity._altitude || 0.0)));
};
EntityCollectionNode.prototype.isVisible = function () {

View File

@ -4,7 +4,6 @@
'use strict';
//import * as quadTree from './quadTree.js';
import { Extent } from '../Extent.js';
import { LonLat } from '../LonLat.js';
import { EPSG4326 } from '../proj/EPSG4326.js';
@ -363,10 +362,12 @@ Node.prototype.renderTree = function (maxZoom) {
if (Math.abs(cam._lonLat.lat) <= MAX_LAT &&
seg._projection.id === EPSG3857.id) {
inside = seg._extent.isInside(cam._lonLatMerc);
cam._insideSegmentPosition = cam._lonLatMerc;
cam._insideSegmentPosition.lon = cam._lonLatMerc.lon;
cam._insideSegmentPosition.lat = cam._lonLatMerc.lat;
} else if (seg._projection.id === EPSG4326.id) {
inside = seg._extent.isInside(cam._lonLat);
cam._insideSegmentPosition = cam._lonLat;
cam._insideSegmentPosition.lon = cam._lonLat.lon;
cam._insideSegmentPosition.lat = cam._lonLat.lat;
}
if (inside) {
@ -380,9 +381,12 @@ Node.prototype.renderTree = function (maxZoom) {
var inFrustum = cam.frustum.containsSphere(seg.bsphere);
//TODO: check up *
const altVis = cam.eye.distance(seg.bsphere.center) - seg.bsphere.radius < 3570.0 * Math.sqrt(cam._lonLat.height);
if (inFrustum && (altVis || cam._lonLat.height > 10000.0) || this._cameraInside) {
seg._collectVisibleNodes();
}
if (inFrustum || this._cameraInside) {
//First skip lowest zoom nodes
@ -410,11 +414,6 @@ Node.prototype.renderTree = function (maxZoom) {
} else {
this.state = NOTRENDERING;
}
//TODO: check up * and this
if (this.state !== NOTRENDERING && inFrustum && (altVis || cam._lonLat.height > 10000.0)) {
seg._collectVisibleNodes();
}
};
Node.prototype.traverseNodes = function (maxZoom) {

View File

@ -22,7 +22,7 @@ class BaseNode {
/**
* Top scene tree node pointer.
* @public
* @type {og.scene.Node}
* @type {og.RenderNode}
*/
this.topNode = this;
@ -32,14 +32,14 @@ class BaseNode {
/**
* Children nodes.
* @public
* @type {Array.<og.scene.Node>}
* @type {Array.<og.RenderNode>}
*/
this.childNodes = [];
/**
* Parent node pointer.
* @public
* @type {og.scene.Node}
* @type {og.RenderNode}
*/
this.parentNode = null;
@ -61,7 +61,7 @@ class BaseNode {
/**
* Adds node to the current hierarchy.
* @public
* @type {og.scene.Node}
* @type {og.RenderNode}
*/
addNode(node) {
if (this.parentNode == null) {
@ -91,7 +91,7 @@ class BaseNode {
* Gets node by name in the current.
* @public
* @param {string} name - Node name.
* @return {og.scene.Node} Node object in the current node.
* @return {og.RenderNode} Node object in the current node.
*/
getNodeByName(name) {
return this._dictionary[name];

View File

@ -112,14 +112,14 @@ class Planet extends RenderNode {
/**
* All layers array.
* @public
* @type {Array.<og.layer.Layer>}
* @type {Array.<og.Layer>}
*/
this.layers = [];
/**
* Current visible imagery tile layers array.
* @public
* @type {Array.<og.layer.Layer>}
* @type {Array.<og.Layer>}
*/
this.visibleTileLayers = [];
@ -142,7 +142,7 @@ class Planet extends RenderNode {
/**
* There is only one base layer on the globe when layer.isBaseLayer is true.
* @public
* @type {og.layer.Layer}
* @type {og.Layer}
*/
this.baseLayer = null;
@ -163,7 +163,7 @@ class Planet extends RenderNode {
/**
* Screen mouse pointer projected to planet cartesian position.
* @public
* @type {og.math.Vector3}
* @type {og.Vec3}
*/
this.mousePositionOnEarth = new Vec3();
@ -418,9 +418,9 @@ class Planet extends RenderNode {
/**
* Return layer by it name
* @param {string} name - Name of the layer. og.layer.Layer.prototype.name
* @param {string} name - Name of the layer. og.Layer.prototype.name
* @public
* @returns {og.layer.Layer} -
* @returns {og.Layer} -
*/
getLayerByName(name) {
var i = this.layers.length;
@ -432,7 +432,7 @@ class Planet extends RenderNode {
/**
* Adds the given layer to the planet.
* @param {og.layer.Layer} layer - Layer object.
* @param {og.Layer} layer - Layer object.
* @public
*/
addLayer(layer) {
@ -441,7 +441,7 @@ class Planet extends RenderNode {
/**
* Dispatch layer visibility changing event.
* @param {og.layer.Layer} layer - Changed layer.
* @param {og.Layer} layer - Changed layer.
* @protected
*/
_onLayerVisibilityChanged(layer) {
@ -450,7 +450,7 @@ class Planet extends RenderNode {
/**
* Adds the given layers array to the planet.
* @param {Array.<og.layer.Layer>} layers - Layers array.
* @param {Array.<og.Layer>} layers - Layers array.
* @public
*/
addLayers(layers) {
@ -461,8 +461,8 @@ class Planet extends RenderNode {
/**
* Removes the given layer from the planet.
* @param {og.layer.Layer} layer - Layer to remove.
* @return {og.layer.Layer|undefined} The removed layer or undefined if the layer was not found.
* @param {og.Layer} layer - Layer to remove.
* @return {og.Layer|undefined} The removed layer or undefined if the layer was not found.
* @public
*/
removeLayer(layer) {
@ -472,7 +472,7 @@ class Planet extends RenderNode {
/**
*
* @protected
* @param {og.layer.Layer} layer - Material layer.
* @param {og.Layer} layer - Material layer.
*/
_clearLayerMaterial(layer) {
var lid = layer._id;
@ -487,7 +487,7 @@ class Planet extends RenderNode {
/**
* Get the collection of layers associated with this planet.
* @return {Array.<og.layer.Layer>} Layers array.
* @return {Array.<og.Layer>} Layers array.
* @public
*/
getLayers() {
@ -496,7 +496,7 @@ class Planet extends RenderNode {
/**
* Sets base layer coverage to the planet.
* @param {og.layer.Layer} layer - Layer object.
* @param {og.Layer} layer - Layer object.
* @public
*/
setBaseLayer(layer) {
@ -859,6 +859,8 @@ class Planet extends RenderNode {
this._quadTree.renderTree();
//this.renderer.activeCamera._insideSegment.node.renderNode(true);
if (this.renderer.activeCamera.slope > 0.72 && this.renderer.activeCamera._lonLat.height < 850000) {
this.minCurrZoom = this.maxCurrZoom;
@ -890,13 +892,13 @@ class Planet extends RenderNode {
this._lodRatio = math.lerp(this.camera.slope, this._maxLodRatio, this._minLodRatio);
this.renderer.activeCamera.prepareFrame();
this._collectRenderNodes();
//Here is the planet node dispatches a draw event before rendering begins.
this.events.dispatch(this.events.draw, this);
this.renderer.activeCamera.prepareFrame();
this.transformLights();
this._normalMapCreator.frame();
@ -1269,6 +1271,7 @@ class Planet extends RenderNode {
var i = this.visibleVectorLayers.length;
while (i--) {
this.visibleVectorLayers[i].collectVisibleCollections(this._frustumEntityCollections);
this.visibleVectorLayers[i].update();
}
@ -1318,8 +1321,8 @@ class Planet extends RenderNode {
* Returns ray vector hit ellipsoid coordinates.
* If the ray doesn't hit ellipsoit returns null.
* @public
* @param {og.math.Ray} ray - Ray 3d.
* @returns {og.math.Vector3} -
* @param {og.Ray} ray - Ray 3d.
* @returns {og.Vec3} -
*/
getRayIntersectionEllipsoid(ray) {
return this.ellipsoid.hitRay(ray.origin, ray.direction);
@ -1329,7 +1332,7 @@ class Planet extends RenderNode {
* Returns 2d screen coordanates projection point to the planet ellipsoid 3d coordinates.
* @public
* @param {og.math.Pixel} px - 2D sreen coordinates.
* @returns {og.math.Vector3} -
* @returns {og.Vec3} -
*/
getCartesianFromPixelEllipsoid(px) {
var cam = this.renderer.activeCamera;
@ -1355,7 +1358,7 @@ class Planet extends RenderNode {
* position or null if mouse cursor is outside the planet.
* @public
* @param {Boolean} [force=false] - Force framebuffer rendering.
* @returns {og.math.Vector3} -
* @returns {og.Vec3} -
*/
getCartesianFromMouseTerrain(force) {
var ms = this.renderer.events.mouseState;
@ -1370,9 +1373,9 @@ class Planet extends RenderNode {
* Returns 3d cartesian coordinates on the relief planet by 2d screen coordinates.
* position or null if input coordinates is outside the planet.
* @public
* @param {og.math.Vector2} px - Pixel screen 2d coordinates.
* @param {og.Vec2} px - Pixel screen 2d coordinates.
* @param {Boolean} [force=false] - Force framebuffer rendering.
* @returns {og.math.Vector3} -
* @returns {og.Vec3} -
*/
getCartesianFromPixelTerrain(px, force) {
var distance = this.getDistanceFromPixel(px, force);
@ -1387,7 +1390,7 @@ class Planet extends RenderNode {
* Returns geographical coordinates on the relief planet by 2d screen coordinates.
* position or null if input coordinates is outside the planet.
* @public
* @param {og.math.Vector2} px - Pixel screen 2d coordinates.
* @param {og.Vec2} px - Pixel screen 2d coordinates.
* @param {Boolean} [force=false] - Force framebuffer rendering.
* @returns {og.LonLat} -
*/
@ -1402,8 +1405,8 @@ class Planet extends RenderNode {
/**
* Returns projected 2d screen coordinates by 3d cartesian coordiantes.
* @public
* @param {og.math.Vector3} coords - Cartesian coordinates.
* @returns {og.math.Vector2} -
* @param {og.Vec3} coords - Cartesian coordinates.
* @returns {og.Vec2} -
*/
getPixelFromCartesian(coords) {
return this.renderer.activeCamera.project(coords);
@ -1413,7 +1416,7 @@ class Planet extends RenderNode {
* Returns projected 2d screen coordinates by geographical coordinates.
* @public
* @param {og.LonLat} lonlat - Geographical coordinates.
* @returns {og.math.Vector2} -
* @returns {og.Vec2} -
*/
getPixelFromLonLat(lonlat) {
var coords = this.ellipsoid.lonLatToCartesian(lonlat);
@ -1426,7 +1429,7 @@ class Planet extends RenderNode {
* Returns distance from active camera to the the planet ellipsoid
* coordiantes unprojected by 2d screen coordiantes, or null if screen coordinates outside the planet.
* @public
* @param {og.math.Vector2} px - Screen coordinates.
* @param {og.Vec2} px - Screen coordinates.
* @returns {number} -
*/
getDistanceFromPixelEllipsoid(px) {
@ -1440,7 +1443,7 @@ class Planet extends RenderNode {
* If screen coordinates inside the planet but relief is not exists in the
* point than function returns distance to the planet ellipsoid.
* @public
* @param {og.math.Vector2} px - Screen coordinates.
* @param {og.Vec2} px - Screen coordinates.
* @param {Boolean} [force=false] - Force framebuffer rendering.
* @returns {number} -
*/
@ -1518,7 +1521,7 @@ class Planet extends RenderNode {
* Sets camera to the planet geographical position.
* @public
* @param {og.LonLat} lonlat - New geographical position.
* @param {og.math.Vector3} [up] - Camera UP vector.
* @param {og.Vec3} [up] - Camera UP vector.
*/
viewLonLat(lonlat, up) {
this.renderer.activeCamera.setLonLat(lonlat, up);
@ -1528,7 +1531,7 @@ class Planet extends RenderNode {
* Fly camera to the planet geographical extent.
* @public
* @param {og.Extent} extent - Geographical extent.
* @param {og.math.Vector3} [up] - Camera UP vector on the end of a flying.
* @param {og.Vec3} [up] - Camera UP vector on the end of a flying.
*/
flyExtent(extent, up) {
this.renderer.activeCamera.flyExtent(extent, up);
@ -1537,9 +1540,9 @@ class Planet extends RenderNode {
/**
* Fly camera to the new point.
* @public
* @param {og.math.Vector3} cartesian - Fly coordiantes.
* @param {og.math.Vector3} [look] - Camera "look at" point.
* @param {og.math.Vector3} [up] - Camera UP vector on the end of a flying.
* @param {og.Vec3} cartesian - Fly coordiantes.
* @param {og.Vec3} [look] - Camera "look at" point.
* @param {og.Vec3} [up] - Camera UP vector on the end of a flying.
*/
flyCartesian(cartesian, look, up) {
this.renderer.activeCamera.flyCartesian(cartesian, look, up);
@ -1549,8 +1552,8 @@ class Planet extends RenderNode {
* Fly camera to the new geographical position.
* @public
* @param {og.LonLat} lonlat - Fly geographical coordiantes.
* @param {og.math.Vector3} [look] - Camera "look at" point on the end of a flying.
* @param {og.math.Vector3} [up] - Camera UP vector on the end of a flying.
* @param {og.Vec3} [look] - Camera "look at" point on the end of a flying.
* @param {og.Vec3} [up] - Camera UP vector on the end of a flying.
*/
flyLonLat(lonlat, look, up) {
this.renderer.activeCamera.flyLonLat(lonlat, look, up);

View File

@ -16,7 +16,7 @@ import { TextureAtlas } from '../utils/TextureAtlas.js';
* There are collections of ligh sources, entities and so on in the node.
* Access to the node is renderer.renderNodes["Earth"]
* @class
* @extends {og.scene.Node}
* @extends {og.RenderNode}
* @param {string} name - Node name.
*/
class RenderNode extends BaseNode {

View File

@ -86,12 +86,6 @@ const Segment = function (node, planet, tileZoom, extent) {
this._seNorm = null;
this._neNorm = null;
/**
* experimental
*/
this._deltaHeight = 0;
/**
* Geographical extent.
* @type {og.Extent}
@ -231,7 +225,7 @@ Segment.prototype.acceptForRendering = function (camera) {
* @public
* @param {og.Entity} entity - Entity.
* @param {og.Vec3} res - Point coordinates.
* @returns {og.math.Vector3} -
* @returns {og.Vec3} -
*/
Segment.prototype.getEntityTerrainPoint = function (entity, res) {
return this.getTerrainPoint(res, entity._cartesian, entity._lonlatMerc);
@ -244,8 +238,8 @@ Segment.prototype.isEntityInside = function (e) {
/**
* Returns distance from object to terrain coordinates and terrain point that calculates out in the res parameter.
* @public
* @param {og.math.Vector3} res - Result cartesian coordiantes on the terrain.
* @param {og.math.Vector3} xyz - Cartesian object position.
* @param {og.Vec3} res - Result cartesian coordiantes on the terrain.
* @param {og.Vec3} xyz - Cartesian object position.
* @param {og.LonLat} insideSegmentPosition - Geodetic object position.
* @returns {number} -
*/
@ -287,9 +281,16 @@ Segment.prototype.getTerrainPoint = function (res, xyz, insideSegmentPosition) {
v1 = new Vec3(verts[ind_v0 + 3], verts[ind_v0 + 4], verts[ind_v0 + 5]),
v2 = new Vec3(verts[ind_v2], verts[ind_v2 + 1], verts[ind_v2 + 2]);
var d = ray.hitTriangle(v0, v1, v2, res);
let d = ray.hitTriangle(v0, v1, v2, res);
if (d === Ray.INSIDE) {
return xyz.distance(res);
} else if (d === Ray.AWAY) {
let ray = new Ray(xyz, xyz);
let d = ray.hitTriangle(v0, v1, v2, res);
if (d === Ray.INSIDE) {
return -xyz.distance(res);
}
}
var v3 = new Vec3(verts[ind_v2 + 3], verts[ind_v2 + 4], verts[ind_v2 + 5]);
@ -297,6 +298,12 @@ Segment.prototype.getTerrainPoint = function (res, xyz, insideSegmentPosition) {
d = ray.hitTriangle(v1, v3, v2, res);
if (d === Ray.INSIDE) {
return xyz.distance(res);
} else if (d === Ray.AWAY) {
let ray = new Ray(xyz, xyz);
let d = ray.hitTriangle(v1, v3, v2, res);
if (d === Ray.INSIDE) {
return -xyz.distance(res);
}
}
if (d === Ray.AWAY) {
@ -1163,7 +1170,7 @@ Segment.prototype._createPlainVertices = function () {
/**
* Gets specific layer material.
* @public
* @param {og.layer.Layer} layer - Layer object.
* @param {og.Layer} layer - Layer object.
* @returns {og.planetSegment.Material} - Segment material.
*/
Segment.prototype.getMaterialByLayer = function (layer) {

View File

@ -12,9 +12,9 @@ import { Mat4 } from '../math/Mat4.js';
* Base geometry shape class.
* @class
* @param {Object} options - Shape parameters:
* @param {og.math.Vector3} [options.position] - Shape position.
* @param {og.math.Quaternion} [options.orientation] - Shape orientation(rotation).
* @param {og.math.Vector3} [options.scale] - Scale vector.
* @param {og.Vec3} [options.position] - Shape position.
* @param {og.Quat} [options.orientation] - Shape orientation(rotation).
* @param {og.Vec3} [options.scale] - Scale vector.
* @param {Array.<number,number,number,number>} [options.color] - Shape RGBA color.
* @param {string} [options.src] - Texture image url source.
* @param {boolean} [options.visibility] - Shape visibility.
@ -36,21 +36,21 @@ class BaseShape {
/**
* Shape position.
* @public
* @type {og.math.Vector3}
* @type {og.Vec3}
*/
this.position = options.position || new Vec3();
/**
* Shape orientation(rotation)
* @public
* @type {og.math.Quaternion}
* @type {og.Quat}
*/
this.orientation = options.orientation || new Quat(0.0, 0.0, 0.0, 1.0);
/**
* Scale.
* @public
* @type {og.math.Vector3}
* @type {og.Vec3}
*/
this.scale = options.scale || new Vec3(1.0, 1.0, 1.0);
@ -130,21 +130,21 @@ class BaseShape {
/**
* Scale matrix.
* @protected
* @type {og.math.Matrix4}
* @type {og.Mat4}
*/
this._mxScale = new Mat4().setIdentity();
/**
* Translation matrix.
* @protected
* @type {og.math.Matrix4}
* @type {og.Mat4}
*/
this._mxTranslation = new Mat4().setIdentity();
/**
* Model matrix.
* @protected
* @type {og.math.Matrix4}
* @type {og.Mat4}
*/
this._mxModel = new Mat4().setIdentity();
@ -240,7 +240,7 @@ class BaseShape {
/**
* Sets shape color.
* @public
* @param {og.math.Vector4} color - RGBA color vector.
* @param {og.Vec4} color - RGBA color vector.
*/
setColor4v(color) {
this.color[0] = color.x;
@ -314,7 +314,7 @@ class BaseShape {
/**
* Sets shape position.
* @public
* @param {og.math.Vector3} position - Shape position.
* @param {og.Vec3} position - Shape position.
*/
setPosition3v(position) {
this.position.copy(position);
@ -325,7 +325,7 @@ class BaseShape {
/**
* Translate shape position to vector.
* @public
* @param {og.math.Vector3} vec - Translation vector.
* @param {og.Vec3} vec - Translation vector.
*/
translate3v(vec) {
this.position.addA(vec);
@ -334,7 +334,7 @@ class BaseShape {
/**
* Sets shape scale.
* @param {og.math.Vector3} scale - Scale vector.
* @param {og.Vec3} scale - Scale vector.
*/
setScale3v(scale) {
this.scale.copy(scale);
@ -353,7 +353,7 @@ class BaseShape {
/**
* Assign picking color.
* @protected
* @param {og.math.Vector3} color - Picking RGB color.
* @param {og.Vec3} color - Picking RGB color.
*/
setPickingColor3v(color) {
//...

View File

@ -10,9 +10,9 @@ import { BaseShape } from './BaseShape.js';
* @class
* @extends {og.shape.BaseShape}
* @param {Object} options - Icosphere parameters:
* @param {og.math.Vector3} [options.position] - Icosphere position.
* @param {og.math.Quaternion} [options.orientation] - Icosphere orientation(rotation).
* @param {og.math.Vector3} [options.scale] - Scale vector.
* @param {og.Vec3} [options.position] - Icosphere position.
* @param {og.Quat} [options.orientation] - Icosphere orientation(rotation).
* @param {og.Vec3} [options.scale] - Scale vector.
* @param {Array.<number,number,number,number>} [options.color] - Icosphere RGBA color.
* @param {string} [options.src] - Texture image url source.
* @param {boolean} [options.visibility] - Icosphere visibility.

View File

@ -10,9 +10,9 @@ import { BaseShape } from './BaseShape.js';
* @class
* @extends {og.shape.BaseShape}
* @param {Object} options - Sphere parameters:
* @param {og.math.Vector3} [options.position] - Sphere position.
* @param {og.math.Quaternion} [options.orientation] - Sphere orientation(rotation).
* @param {og.math.Vector3} [options.scale] - Scale vector.
* @param {og.Vec3} [options.position] - Sphere position.
* @param {og.Quat} [options.orientation] - Sphere orientation(rotation).
* @param {og.Vec3} [options.scale] - Scale vector.
* @param {Array.<number,number,number,number>} [options.color] - Sphere RGBA color.
* @param {string} [options.src] - Texture image url source.
* @param {boolean} [options.visibility] - Sphere visibility.

View File

@ -29,14 +29,14 @@ class EmptyTerrain {
* @public
* @type {number}
*/
this.minZoom = 50;
this.minZoom = 1000000;
/**
* Maximal z-index value for segment elevation data handling.
* @public
* @type {number}
*/
this.maxZoom = 50;
this.maxZoom = 21;
/**
* @public

View File

@ -15,13 +15,13 @@ import { stringTemplate } from '../utils/shared.js';
const EVENT_NAMES = [
/**
* Triggered when current elevation tile has loaded but before rendereing.
* @event og.terrainProvider.TerrainProvider#load
* @event og.terrain.GlobusTerrain#load
*/
"load",
/**
* Triggered when all elevation tiles have loaded or loading has stopped.
* @event og.terrainProvider.TerrainProvider#loadend
* @event og.terrain.GlobusTerrain#loadend
*/
"loadend"
];
@ -29,7 +29,7 @@ const EVENT_NAMES = [
/**
* Class that loads segment elevation data, converts it to the array and passes it to the planet segment.
* @class
* @extends {og.terrainProvider.EmptyTerrainProvider}
* @extends {og.terrain.EmptyTerrain}
* @param {string} [name=""] - Terrain provider name.
* @param {Object} [options] - Provider options:
* @param {number} [options.minZoom=3] - Minimal visible zoom index when terrain handler works.
@ -39,8 +39,8 @@ const EVENT_NAMES = [
* @param {number} [options.fileGridSize=32] - Elevation tile grid size. Default is 32x32.
* @param {string} [options.responseType="arraybuffer"] - Ajax responce type.
* @param {number} [options.MAX_LOADING_TILES] - Maximum at one time loading tiles.
* @fires og.terrainProvider.TerrainProvider#load
* @fires og.terrainProvider.TerrainProvider#loadend
* @fires og.terrain.GlobusTerrain#load
* @fires og.terrain.GlobusTerrain#loadend
*/
class GlobusTerrain extends EmptyTerrain {
constructor(name, options) {
@ -109,7 +109,7 @@ class GlobusTerrain extends EmptyTerrain {
/**
* Rewrites elevation storage url query.
* @private
* @callback og.terrainProvider.TerrainProvider~_urlRewriteCallback
* @callback og.terrain.GlobusTerrain~_urlRewriteCallback
* @param {og.planetSegment.Segment} segment - Segment to load.
* @param {string} url - Created url.
* @returns {string} - Url query string.
@ -217,7 +217,7 @@ class GlobusTerrain extends EmptyTerrain {
/**
* Sets url rewrite callback, used for custom url rewriting for every tile laoding.
* @public
* @param {og.terrainProvider.TerrainProvider~_urlRewriteCallback} ur - The callback that returns tile custom created url.
* @param {og.terrain.GlobusTerrain~_urlRewriteCallback} ur - The callback that returns tile custom created url.
*/
setUrlRewriteCallback(ur) {
this._urlRewriteCallback = ur;

View File

@ -91,7 +91,7 @@ export function htmlColorToRgba(htmlColor, opacity) {
* Convert html color string to the RGB number vector.
* @param {string} htmlColor - HTML string("#C6C6C6" or "#EF5" or "rgb(8,8,8)" or "rgba(8,8,8)") color.
* @param {number} [opacity] - Opacity for the output vector.
* @returns {og.math.Vec3} -
* @returns {og.Vec3} -
*/
export function htmlColorToRgb(htmlColor) {
var hColor = colorTable[htmlColor];

View File

@ -421,7 +421,7 @@ Handler.prototype.loadCubeMapTexture = function (params) {
/**
* Adds shader program to the handler.
* @public
* @param {og.shaderProgram.ShaderProgram} program - Shader program.
* @param {og.webgl.ShaderProgram} program - Shader program.
* @param {boolean} [notActivate] - If it's true program will not compile.
*/
Handler.prototype.addShaderProgram = function (program, notActivate) {
@ -449,7 +449,7 @@ Handler.prototype.removeShaderProgram = function (name) {
/**
* Adds shader programs to the handler.
* @public
* @param {Array.<og.shaderProgram.ShaderProgram>} programsArr - Shader program array.
* @param {Array.<og.webgl.ShaderProgram>} programsArr - Shader program array.
*/
Handler.prototype.addShaderPrograms = function (programsArr) {
for (var i = 0; i < programsArr.length; i++) {

View File

@ -10,14 +10,14 @@
* Get access to the program from ...handler.shaderPrograms.<program name> etc.
* @class
* @param {og.webgl.Handler} handler - Handler.
* @param {og.shaderProgram.ShaderProgram} shaderProgram - Shader program.
* @param {og.webgl.ShaderProgram} shaderProgram - Shader program.
*/
const ShaderController = function (handler, shaderProgram) {
/**
* Shader program.
* @private
* @type {og.shaderProgram.ShaderProgram}
* @type {og.webgl.ShaderProgram}
*/
this._program = shaderProgram;
@ -48,7 +48,7 @@ ShaderController.prototype.initialize = function () {
/**
* Returns controller's shader program.
* @public
* @return {og.shaderProgram.ShaderProgram} -
* @return {og.webgl.ShaderProgram} -
*/
ShaderController.prototype.getProgram = function () {
return this._program;

View File

@ -329,7 +329,7 @@ class ShaderProgram {
/**
* Bind program buffer.
* @function
* @param {og.shaderProgram.ShaderProgram} program - Used program.
* @param {og.webgl.ShaderProgram} program - Used program.
* @param {Object} variable - Variable represents buffer data.
*/
static bindBuffer(program, variable) {