From 0947d0017594d58c81e9fc357dbc8a7ff2ec5dc2 Mon Sep 17 00:00:00 2001
From: Shehzan Mohammed position
- 3D vertex position. 64-bit floating-point (for precision). 3 components per attribute. See {@link VertexFormat#position}.normal
- Normal (normalized), commonly used for lighting. 32-bit floating-point. 3 components per attribute. See {@link VertexFormat#normal}.st
- 2D texture coordinate. 32-bit floating-point. 2 components per attribute. See {@link VertexFormat#st}.binormal
- Binormal (normalized), used for tangent-space effects like bump mapping. 32-bit floating-point. 3 components per attribute. See {@link VertexFormat#binormal}.bitangent
- Bitangent (normalized), used for tangent-space effects like bump mapping. 32-bit floating-point. 3 components per attribute. See {@link VertexFormat#bitangent}.tangent
- Tangent (normalized), used for tangent-space effects like bump mapping. 32-bit floating-point. 3 components per attribute. See {@link VertexFormat#tangent}.
* 32-bit floating-point. 3 components per attribute. *
@@ -64,7 +64,7 @@ define([ * * @default undefined */ - this.binormal = options.binormal; + this.bitangent = options.bitangent; /** * The tangent attribute (normalized), which is used for tangent-space effects like bump mapping. diff --git a/Source/Core/GeometryPipeline.js b/Source/Core/GeometryPipeline.js index 23bbeb25a91a..ed8427ec4602 100644 --- a/Source/Core/GeometryPipeline.js +++ b/Source/Core/GeometryPipeline.js @@ -10,6 +10,7 @@ define([ './ComponentDatatype', './defaultValue', './defined', + './deprecationWarning', './DeveloperError', './EncodedCartesian3', './GeographicProjection', @@ -36,6 +37,7 @@ define([ ComponentDatatype, defaultValue, defined, + deprecationWarning, DeveloperError, EncodedCartesian3, GeographicProjection, @@ -173,7 +175,7 @@ define([ /** * Creates a new {@link Geometry} withLINES
representing the provided
* attribute (attributeName
) for the provided geometry. This is used to
- * visualize vector attributes like normals, binormals, and tangents.
+ * visualize vector attributes like normals, tangents, and bitangents.
*
* @param {Geometry} geometry The Geometry
instance with the attribute.
* @param {String} [attributeName='normal'] The name of the attribute.
@@ -183,7 +185,7 @@ define([
* @exception {DeveloperError} geometry.attributes must have an attribute with the same name as the attributeName parameter.
*
* @example
- * var geometry = Cesium.GeometryPipeline.createLineSegmentsForVectors(instance.geometry, 'binormal', 100000.0);
+ * var geometry = Cesium.GeometryPipeline.createLineSegmentsForVectors(instance.geometry, 'bitangent', 100000.0);
*/
GeometryPipeline.createLineSegmentsForVectors = function(geometry, attributeName, length) {
attributeName = defaultValue(attributeName, 'normal');
@@ -279,8 +281,8 @@ define([
// From VertexFormat
'normal',
'st',
- 'binormal',
'tangent',
+ 'bitangent',
// For shadow volumes
'extrudeDirection',
@@ -325,7 +327,7 @@ define([
*
* @example
* geometry = Cesium.GeometryPipeline.reorderForPreVertexCache(geometry);
- *
+ *
* @see GeometryPipeline.reorderForPostVertexCache
*/
GeometryPipeline.reorderForPreVertexCache = function(geometry) {
@@ -412,7 +414,7 @@ define([
*
* @example
* geometry = Cesium.GeometryPipeline.reorderForPostVertexCache(geometry);
- *
+ *
* @see GeometryPipeline.reorderForPreVertexCache
* @see {@link http://gfx.cs.princ0eton.edu/pubs/Sander_2007_%3ETR/tipsy.pdf|Fast Triangle Reordering for Vertex Locality and Reduced Overdraw}
* by Sander, Nehab, and Barczak
@@ -774,7 +776,7 @@ define([
* Transforms a geometry instance to world coordinates. This changes
* the instance's modelMatrix
to {@link Matrix4.IDENTITY} and transforms the
* following attributes if they are present: position
, normal
,
- * binormal
, and tangent
.
+ * tangent
, and bitangent
.
*
* @param {GeometryInstance} instance The geometry instance to modify.
* @returns {GeometryInstance} The modified instance
argument, with its attributes transforms to world coordinates.
@@ -804,16 +806,16 @@ define([
transformPoint(modelMatrix, attributes.nextPosition);
if ((defined(attributes.normal)) ||
- (defined(attributes.binormal)) ||
- (defined(attributes.tangent))) {
+ (defined(attributes.tangent)) ||
+ (defined(attributes.bitangent))) {
Matrix4.inverse(modelMatrix, inverseTranspose);
Matrix4.transpose(inverseTranspose, inverseTranspose);
Matrix4.getRotation(inverseTranspose, normalMatrix);
transformVector(normalMatrix, attributes.normal);
- transformVector(normalMatrix, attributes.binormal);
transformVector(normalMatrix, attributes.tangent);
+ transformVector(normalMatrix, attributes.bitangent);
}
var boundingSphere = instance.geometry.boundingSphere;
@@ -1005,7 +1007,7 @@ define([
* * This is used by {@link Primitive} to efficiently render a large amount of static data. *
- * + * * @private * * @param {GeometryInstance[]} [instances] The array of {@link GeometryInstance} objects whose geometry will be combined. @@ -1021,7 +1023,7 @@ define([ * Cesium.GeometryPipeline.transformToWorldCoordinates(instances[i]); * } * var geometries = Cesium.GeometryPipeline.combineInstances(instances); - * + * * @see GeometryPipeline.transformToWorldCoordinates */ GeometryPipeline.combineInstances = function(instances) { @@ -1201,8 +1203,8 @@ define([ var tScratch = new Cartesian3(); /** - * Computes per-vertex binormals and tangents for a geometry containingTRIANGLES
.
- * The result is new binormal
and tangent
attributes added to the geometry.
+ * Computes per-vertex tangents and bitangents for a geometry containing TRIANGLES
.
+ * The result is new tangent
and bitangent
attributes added to the geometry.
* This assumes a counter-clockwise winding order.
* * Based on Computing Tangent Space Basis Vectors @@ -1210,15 +1212,15 @@ define([ *
* * @param {Geometry} geometry The geometry to modify. - * @returns {Geometry} The modifiedgeometry
argument with the computed binormal
and tangent
attributes.
+ * @returns {Geometry} The modified geometry
argument with the computed tangent
and bitangent
attributes.
*
* @exception {DeveloperError} geometry.indices length must be greater than 0 and be a multiple of 3.
* @exception {DeveloperError} geometry.primitiveType must be {@link PrimitiveType.TRIANGLES}.
*
* @example
- * Cesium.GeometryPipeline.computeBinormalAndTangent(geometry);
+ * Cesium.GeometryPipeline.computeTangentAndBiTangent(geometry);
*/
- GeometryPipeline.computeBinormalAndTangent = function(geometry) {
+ GeometryPipeline.computeTangentAndBitangent = function(geometry) {
//>>includeStart('debug', pragmas.debug);
if (!defined(geometry)) {
throw new DeveloperError('geometry is required.');
@@ -1302,8 +1304,8 @@ define([
tan1[i23 + 2] += sdirz;
}
- var binormalValues = new Float32Array(numVertices * 3);
var tangentValues = new Float32Array(numVertices * 3);
+ var bitangentValues = new Float32Array(numVertices * 3);
for (i = 0; i < numVertices; i++) {
i03 = i * 3;
@@ -1322,9 +1324,9 @@ define([
Cartesian3.normalize(Cartesian3.cross(n, t, t), t);
- binormalValues[i03] = t.x;
- binormalValues[i13] = t.y;
- binormalValues[i23] = t.z;
+ bitangentValues[i03] = t.x;
+ bitangentValues[i13] = t.y;
+ bitangentValues[i23] = t.z;
}
geometry.attributes.tangent = new GeometryAttribute({
@@ -1333,15 +1335,43 @@ define([
values : tangentValues
});
- geometry.attributes.binormal = new GeometryAttribute({
+ geometry.attributes.bitangent = new GeometryAttribute({
componentDatatype : ComponentDatatype.FLOAT,
componentsPerAttribute : 3,
- values : binormalValues
+ values : bitangentValues
});
return geometry;
};
+ /**
+ * Computes per-vertex binormal and tangents for a geometry containing TRIANGLES
.
+ * The result is new binormal
and tangent
attributes added to the geometry.
+ * This assumes a counter-clockwise winding order.
+ * + * Based on Computing Tangent Space Basis Vectors + * for an Arbitrary Mesh by Eric Lengyel. + *
+ * + * @param {Geometry} geometry The geometry to modify. + * @returns {Geometry} The modifiedgeometry
argument with the computed binormal
and tangent
attributes.
+ *
+ * @exception {DeveloperError} geometry.indices length must be greater than 0 and be a multiple of 3.
+ * @exception {DeveloperError} geometry.primitiveType must be {@link PrimitiveType.TRIANGLES}.
+ *
+ * @example
+ * Cesium.GeometryPipeline.computeBinormalAndTangent(geometry);
+ *
+ * @see GeometryPipeline.computeTangentAndBitangent
+ */
+ GeometryPipeline.computeBinormalAndTangent = function(geometry) {
+ deprecationWarning('computeBinormalAndTangent', 'computeBinormalAndTangent was deprecated in 1.30. It will be removed in 1.31. Use a computeTangentAndBitangent.');
+ GeometryPipeline.computeTangentAndBitangent(geometry);
+ geometry.attributes.binormal = geometry.attributes.bitangent;
+
+ return geometry;
+ };
+
var scratchCartesian2 = new Cartesian2();
var toEncode1 = new Cartesian3();
var toEncode2 = new Cartesian3();
@@ -1403,15 +1433,15 @@ define([
}
var tangentAttribute = geometry.attributes.tangent;
- var binormalAttribute = geometry.attributes.binormal;
+ var bitangentAttribute = geometry.attributes.bitangent;
var hasTangent = defined(tangentAttribute);
- var hasBinormal = defined(binormalAttribute);
+ var hasBitangent = defined(bitangentAttribute);
var normals;
var st;
var tangents;
- var binormals;
+ var bitangents;
if (hasNormal) {
normals = normalAttribute.values;
@@ -1422,8 +1452,8 @@ define([
if (hasTangent) {
tangents = tangentAttribute.values;
}
- if (hasBinormal) {
- binormals = binormalAttribute.values;
+ if (hasBitangent) {
+ bitangents = bitangentAttribute.values;
}
var length = hasNormal ? normals.length : st.length;
@@ -1432,7 +1462,7 @@ define([
var compressedLength = numVertices;
var numCompressedComponents = hasSt && hasNormal ? 2.0 : 1.0;
- numCompressedComponents += hasTangent || hasBinormal ? 1.0 : 0.0;
+ numCompressedComponents += hasTangent || hasBitangent ? 1.0 : 0.0;
compressedLength *= numCompressedComponents;
var compressedAttributes = new Float32Array(compressedLength);
@@ -1445,10 +1475,10 @@ define([
}
var index = i * 3.0;
- if (hasNormal && defined(tangents) && defined(binormals)) {
+ if (hasNormal && defined(tangents) && defined(bitangents)) {
Cartesian3.fromArray(normals, index, toEncode1);
Cartesian3.fromArray(tangents, index, toEncode2);
- Cartesian3.fromArray(binormals, index, toEncode3);
+ Cartesian3.fromArray(bitangents, index, toEncode3);
AttributeCompression.octPack(toEncode1, toEncode2, toEncode3, scratchCartesian2);
compressedAttributes[normalIndex++] = scratchCartesian2.x;
@@ -1464,8 +1494,8 @@ define([
compressedAttributes[normalIndex++] = AttributeCompression.octEncodeFloat(toEncode1);
}
- if (hasBinormal) {
- Cartesian3.fromArray(binormals, index, toEncode1);
+ if (hasBitangent) {
+ Cartesian3.fromArray(bitangents, index, toEncode1);
compressedAttributes[normalIndex++] = AttributeCompression.octEncodeFloat(toEncode1);
}
}
@@ -1483,12 +1513,12 @@ define([
if (hasSt) {
delete geometry.attributes.st;
}
+ if (hasBitangent) {
+ delete geometry.attributes.bitangent;
+ }
if (hasTangent) {
delete geometry.attributes.tangent;
}
- if (hasBinormal) {
- delete geometry.attributes.binormal;
- }
return geometry;
};
@@ -1916,8 +1946,8 @@ define([
var s1Scratch = new Cartesian2();
var s2Scratch = new Cartesian2();
- function computeTriangleAttributes(i0, i1, i2, point, positions, normals, binormals, tangents, texCoords, extrudeDirections, currentAttributes, insertedIndex) {
- if (!defined(normals) && !defined(binormals) && !defined(tangents) && !defined(texCoords) && !defined(extrudeDirections)) {
+ function computeTriangleAttributes(i0, i1, i2, point, positions, normals, tangents, bitangents, texCoords, extrudeDirections, currentAttributes, insertedIndex) {
+ if (!defined(normals) && !defined(tangents) && !defined(bitangents) && !defined(texCoords) && !defined(extrudeDirections)) {
return;
}
@@ -1965,22 +1995,6 @@ define([
Cartesian3.pack(direction, currentAttributes.extrudeDirection.values, insertedIndex * 3);
}
- if (defined(binormals)) {
- var b0 = Cartesian3.fromArray(binormals, i0 * 3, p0Scratch);
- var b1 = Cartesian3.fromArray(binormals, i1 * 3, p1Scratch);
- var b2 = Cartesian3.fromArray(binormals, i2 * 3, p2Scratch);
-
- Cartesian3.multiplyByScalar(b0, coords.x, b0);
- Cartesian3.multiplyByScalar(b1, coords.y, b1);
- Cartesian3.multiplyByScalar(b2, coords.z, b2);
-
- var binormal = Cartesian3.add(b0, b1, b0);
- Cartesian3.add(binormal, b2, binormal);
- Cartesian3.normalize(binormal, binormal);
-
- Cartesian3.pack(binormal, currentAttributes.binormal.values, insertedIndex * 3);
- }
-
if (defined(tangents)) {
var t0 = Cartesian3.fromArray(tangents, i0 * 3, p0Scratch);
var t1 = Cartesian3.fromArray(tangents, i1 * 3, p1Scratch);
@@ -1997,6 +2011,22 @@ define([
Cartesian3.pack(tangent, currentAttributes.tangent.values, insertedIndex * 3);
}
+ if (defined(bitangents)) {
+ var b0 = Cartesian3.fromArray(bitangents, i0 * 3, p0Scratch);
+ var b1 = Cartesian3.fromArray(bitangents, i1 * 3, p1Scratch);
+ var b2 = Cartesian3.fromArray(bitangents, i2 * 3, p2Scratch);
+
+ Cartesian3.multiplyByScalar(b0, coords.x, b0);
+ Cartesian3.multiplyByScalar(b1, coords.y, b1);
+ Cartesian3.multiplyByScalar(b2, coords.z, b2);
+
+ var bitangent = Cartesian3.add(b0, b1, b0);
+ Cartesian3.add(bitangent, b2, bitangent);
+ Cartesian3.normalize(bitangent, bitangent);
+
+ Cartesian3.pack(bitangent, currentAttributes.bitangent.values, insertedIndex * 3);
+ }
+
if (defined(texCoords)) {
var s0 = Cartesian2.fromArray(texCoords, i0 * 2, s0Scratch);
var s1 = Cartesian2.fromArray(texCoords, i1 * 2, s1Scratch);
@@ -2041,7 +2071,7 @@ define([
var attributes = geometry.attributes;
var positions = attributes.position.values;
var normals = (defined(attributes.normal)) ? attributes.normal.values : undefined;
- var binormals = (defined(attributes.binormal)) ? attributes.binormal.values : undefined;
+ var bitangents = (defined(attributes.bitangent)) ? attributes.bitangent.values : undefined;
var tangents = (defined(attributes.tangent)) ? attributes.tangent.values : undefined;
var texCoords = (defined(attributes.st)) ? attributes.st.values : undefined;
var extrudeDirections = (defined(attributes.extrudeDirection)) ? attributes.extrudeDirection.values : undefined;
@@ -2098,7 +2128,7 @@ define([
}
insertedIndex = insertSplitPoint(currentAttributes, currentIndices, currentIndexMap, indices, resultIndex < 3 ? i + resultIndex : -1, point);
- computeTriangleAttributes(i0, i1, i2, point, positions, normals, binormals, tangents, texCoords, extrudeDirections, currentAttributes, insertedIndex);
+ computeTriangleAttributes(i0, i1, i2, point, positions, normals, tangents, bitangents, texCoords, extrudeDirections, currentAttributes, insertedIndex);
}
} else {
if (defined(result)) {
@@ -2118,13 +2148,13 @@ define([
}
insertedIndex = insertSplitPoint(currentAttributes, currentIndices, currentIndexMap, indices, i, p0);
- computeTriangleAttributes(i0, i1, i2, p0, positions, normals, binormals, tangents, texCoords, extrudeDirections, currentAttributes, insertedIndex);
+ computeTriangleAttributes(i0, i1, i2, p0, positions, normals, tangents, bitangents, texCoords, extrudeDirections, currentAttributes, insertedIndex);
insertedIndex = insertSplitPoint(currentAttributes, currentIndices, currentIndexMap, indices, i + 1, p1);
- computeTriangleAttributes(i0, i1, i2, p1, positions, normals, binormals, tangents, texCoords, extrudeDirections, currentAttributes, insertedIndex);
+ computeTriangleAttributes(i0, i1, i2, p1, positions, normals, tangents, bitangents, texCoords, extrudeDirections, currentAttributes, insertedIndex);
insertedIndex = insertSplitPoint(currentAttributes, currentIndices, currentIndexMap, indices, i + 2, p2);
- computeTriangleAttributes(i0, i1, i2, p2, positions, normals, binormals, tangents, texCoords, extrudeDirections, currentAttributes, insertedIndex);
+ computeTriangleAttributes(i0, i1, i2, p2, positions, normals, tangents, bitangents, texCoords, extrudeDirections, currentAttributes, insertedIndex);
}
}
diff --git a/Source/Core/PolygonGeometry.js b/Source/Core/PolygonGeometry.js
index 44c569bde91d..18574458d2f3 100644
--- a/Source/Core/PolygonGeometry.js
+++ b/Source/Core/PolygonGeometry.js
@@ -107,12 +107,12 @@ define([
var scratchPosition = new Cartesian3();
var scratchNormal = new Cartesian3();
var scratchTangent = new Cartesian3();
- var scratchBinormal = new Cartesian3();
+ var scratchBitangent = new Cartesian3();
var p1Scratch = new Cartesian3();
var p2Scratch = new Cartesian3();
var scratchPerPosNormal = new Cartesian3();
var scratchPerPosTangent = new Cartesian3();
- var scratchPerPosBinormal = new Cartesian3();
+ var scratchPerPosBitangent = new Cartesian3();
var appendTextureCoordinatesOrigin = new Cartesian2();
var appendTextureCoordinatesCartesian2 = new Cartesian2();
@@ -124,7 +124,7 @@ define([
var vertexFormat = options.vertexFormat;
var geometry = options.geometry;
var shadowVolume = options.shadowVolume;
- if (vertexFormat.st || vertexFormat.normal || vertexFormat.tangent || vertexFormat.binormal || shadowVolume) {
+ if (vertexFormat.st || vertexFormat.normal || vertexFormat.tangent || vertexFormat.bitangent || shadowVolume) {
// PERFORMANCE_IDEA: Compute before subdivision, then just interpolate during subdivision.
// PERFORMANCE_IDEA: Compute with createGeometryFromPositions() for fast path when there's no holes.
var boundingRectangle = options.boundingRectangle;
@@ -153,7 +153,7 @@ define([
}
}
var tangents = vertexFormat.tangent ? new Float32Array(length) : undefined;
- var binormals = vertexFormat.binormal ? new Float32Array(length) : undefined;
+ var bitangents = vertexFormat.bitangent ? new Float32Array(length) : undefined;
var extrudeNormals = shadowVolume ? new Float32Array(length) : undefined;
var textureCoordIndex = 0;
@@ -161,7 +161,7 @@ define([
var normal = scratchNormal;
var tangent = scratchTangent;
- var binormal = scratchBinormal;
+ var bitangent = scratchBitangent;
var recomputeNormal = true;
var rotation = Quaternion.fromAxisAngle(tangentPlane._plane.normal, stRotation, appendTextureCoordinatesQuaternion);
@@ -200,7 +200,7 @@ define([
textureCoordIndex += 2;
}
- if (vertexFormat.normal || vertexFormat.tangent || vertexFormat.binormal || shadowVolume) {
+ if (vertexFormat.normal || vertexFormat.tangent || vertexFormat.bitangent || shadowVolume) {
var attrIndex1 = attrIndex + 1;
var attrIndex2 = attrIndex + 2;
@@ -224,28 +224,28 @@ define([
}
}
- if (vertexFormat.tangent || vertexFormat.binormal) {
- binormal = ellipsoid.geodeticSurfaceNormal(position, binormal);
+ if (vertexFormat.tangent || vertexFormat.bitangent) {
+ bitangent = ellipsoid.geodeticSurfaceNormal(position, bitangent);
if (vertexFormat.tangent) {
- tangent = Cartesian3.normalize(Cartesian3.cross(binormal, normal, tangent), tangent);
+ tangent = Cartesian3.normalize(Cartesian3.cross(bitangent, normal, tangent), tangent);
}
}
} else {
normal = ellipsoid.geodeticSurfaceNormal(position, normal);
- if (vertexFormat.tangent || vertexFormat.binormal) {
+ if (vertexFormat.tangent || vertexFormat.bitangent) {
if (perPositionHeight) {
scratchPerPosNormal = Cartesian3.fromArray(normals, attrIndex, scratchPerPosNormal);
scratchPerPosTangent = Cartesian3.cross(Cartesian3.UNIT_Z, scratchPerPosNormal, scratchPerPosTangent);
scratchPerPosTangent = Cartesian3.normalize(Matrix3.multiplyByVector(textureMatrix, scratchPerPosTangent, scratchPerPosTangent), scratchPerPosTangent);
- if (vertexFormat.binormal) {
- scratchPerPosBinormal = Cartesian3.normalize(Cartesian3.cross(scratchPerPosNormal, scratchPerPosTangent, scratchPerPosBinormal), scratchPerPosBinormal);
+ if (vertexFormat.bitangent) {
+ scratchPerPosBitangent = Cartesian3.normalize(Cartesian3.cross(scratchPerPosNormal, scratchPerPosTangent, scratchPerPosBitangent), scratchPerPosBitangent);
}
}
tangent = Cartesian3.cross(Cartesian3.UNIT_Z, normal, tangent);
tangent = Cartesian3.normalize(Matrix3.multiplyByVector(textureMatrix, tangent, tangent), tangent);
- if (vertexFormat.binormal) {
- binormal = Cartesian3.normalize(Cartesian3.cross(normal, tangent, binormal), binormal);
+ if (vertexFormat.bitangent) {
+ bitangent = Cartesian3.normalize(Cartesian3.cross(normal, tangent, bitangent), bitangent);
}
}
}
@@ -301,21 +301,21 @@ define([
}
}
- if (vertexFormat.binormal) {
+ if (vertexFormat.bitangent) {
if (bottom) {
- binormals[attrIndex + bottomOffset] = binormal.x;
- binormals[attrIndex1 + bottomOffset] = binormal.y;
- binormals[attrIndex2 + bottomOffset] = binormal.z;
+ bitangents[attrIndex + bottomOffset] = bitangent.x;
+ bitangents[attrIndex1 + bottomOffset] = bitangent.y;
+ bitangents[attrIndex2 + bottomOffset] = bitangent.z;
}
if (top) {
if (perPositionHeight) {
- binormals[attrIndex] = scratchPerPosBinormal.x;
- binormals[attrIndex1] = scratchPerPosBinormal.y;
- binormals[attrIndex2] = scratchPerPosBinormal.z;
+ bitangents[attrIndex ] = scratchPerPosBitangent.x;
+ bitangents[attrIndex1] = scratchPerPosBitangent.y;
+ bitangents[attrIndex2] = scratchPerPosBitangent.z;
} else {
- binormals[attrIndex] = binormal.x;
- binormals[attrIndex1] = binormal.y;
- binormals[attrIndex2] = binormal.z;
+ bitangents[attrIndex ] = bitangent.x;
+ bitangents[attrIndex1] = bitangent.y;
+ bitangents[attrIndex2] = bitangent.z;
}
}
}
@@ -347,11 +347,11 @@ define([
});
}
- if (vertexFormat.binormal) {
- geometry.attributes.binormal = new GeometryAttribute({
+ if (vertexFormat.bitangent) {
+ geometry.attributes.bitangent = new GeometryAttribute({
componentDatatype : ComponentDatatype.FLOAT,
componentsPerAttribute : 3,
- values : binormals
+ values : bitangents
});
}
diff --git a/Source/Core/PolylineVolumeGeometry.js b/Source/Core/PolylineVolumeGeometry.js
index 4f65fbd941a6..27ab9b72c452 100644
--- a/Source/Core/PolylineVolumeGeometry.js
+++ b/Source/Core/PolylineVolumeGeometry.js
@@ -96,7 +96,7 @@ define([
indices[index++] = lr;
}
- if (vertexFormat.st || vertexFormat.tangent || vertexFormat.binormal) { // st required for tangent/binormal calculation
+ if (vertexFormat.st || vertexFormat.tangent || vertexFormat.bitangent) { // st required for tangent/bitangent calculation
var st = new Float32Array(vertexCount * 2);
var lengthSt = 1 / (length - 1);
var heightSt = 1 / (boundingRectangle.height);
@@ -164,19 +164,19 @@ define([
geometry = GeometryPipeline.computeNormal(geometry);
}
- if (vertexFormat.tangent || vertexFormat.binormal) {
+ if (vertexFormat.tangent || vertexFormat.bitangent) {
try {
- geometry = GeometryPipeline.computeBinormalAndTangent(geometry);
+ geometry = GeometryPipeline.computeTangentAndBitangent(geometry);
} catch (e) {
- oneTimeWarning('polyline-volume-tangent-binormal', 'Unable to compute tangents and binormals for polyline volume geometry');
+ oneTimeWarning('polyline-volume-tangent-bitangent', 'Unable to compute tangents and bitangents for polyline volume geometry');
//TODO https://github.com/AnalyticalGraphicsInc/cesium/issues/3609
}
if (!vertexFormat.tangent) {
geometry.attributes.tangent = undefined;
}
- if (!vertexFormat.binormal) {
- geometry.attributes.binormal = undefined;
+ if (!vertexFormat.bitangent) {
+ geometry.attributes.bitangent = undefined;
}
if (!vertexFormat.st) {
geometry.attributes.st = undefined;
diff --git a/Source/Core/RectangleGeometry.js b/Source/Core/RectangleGeometry.js
index 4ee7ff3bb69d..b9fbba1e0884 100644
--- a/Source/Core/RectangleGeometry.js
+++ b/Source/Core/RectangleGeometry.js
@@ -56,7 +56,7 @@ define([
var positionScratch = new Cartesian3();
var normalScratch = new Cartesian3();
var tangentScratch = new Cartesian3();
- var binormalScratch = new Cartesian3();
+ var bitangentScratch = new Cartesian3();
var rectangleScratch = new Rectangle();
var stScratch = new Cartesian2();
var bottomBoundingSphere = new BoundingSphere();
@@ -87,11 +87,11 @@ define([
values : attributes.tangents
});
}
- if (vertexFormat.binormal) {
- geo.attributes.binormal = new GeometryAttribute({
+ if (vertexFormat.bitangent) {
+ geo.attributes.bitangent = new GeometryAttribute({
componentDatatype : ComponentDatatype.FLOAT,
componentsPerAttribute : 3,
- values : attributes.binormals
+ values : attributes.bitangents
});
}
return geo;
@@ -102,10 +102,10 @@ define([
var normals = (vertexFormat.normal) ? new Float32Array(length) : undefined;
var tangents = (vertexFormat.tangent) ? new Float32Array(length) : undefined;
- var binormals = (vertexFormat.binormal) ? new Float32Array(length) : undefined;
+ var bitangents = (vertexFormat.bitangent) ? new Float32Array(length) : undefined;
var attrIndex = 0;
- var binormal = binormalScratch;
+ var bitangent = bitangentScratch;
var tangent = tangentScratch;
var normal = normalScratch;
for (var i = 0; i < length; i += 3) {
@@ -113,32 +113,32 @@ define([
var attrIndex1 = attrIndex + 1;
var attrIndex2 = attrIndex + 2;
- if (vertexFormat.normal || vertexFormat.tangent || vertexFormat.binormal) {
+ if (vertexFormat.normal || vertexFormat.tangent || vertexFormat.bitangent) {
normal = ellipsoid.geodeticSurfaceNormal(p, normal);
- if (vertexFormat.tangent || vertexFormat.binormal) {
+ if (vertexFormat.tangent || vertexFormat.bitangent) {
Cartesian3.cross(Cartesian3.UNIT_Z, normal, tangent);
Matrix3.multiplyByVector(tangentRotationMatrix, tangent, tangent);
Cartesian3.normalize(tangent, tangent);
- if (vertexFormat.binormal) {
- Cartesian3.normalize(Cartesian3.cross(normal, tangent, binormal), binormal);
+ if (vertexFormat.bitangent) {
+ Cartesian3.normalize(Cartesian3.cross(normal, tangent, bitangent), bitangent);
}
}
if (vertexFormat.normal) {
- normals[attrIndex] = normal.x;
+ normals[attrIndex ] = normal.x;
normals[attrIndex1] = normal.y;
normals[attrIndex2] = normal.z;
}
if (vertexFormat.tangent) {
- tangents[attrIndex] = tangent.x;
+ tangents[attrIndex ] = tangent.x;
tangents[attrIndex1] = tangent.y;
tangents[attrIndex2] = tangent.z;
}
- if (vertexFormat.binormal) {
- binormals[attrIndex] = binormal.x;
- binormals[attrIndex1] = binormal.y;
- binormals[attrIndex2] = binormal.z;
+ if (vertexFormat.bitangent) {
+ bitangents[attrIndex ] = bitangent.x;
+ bitangents[attrIndex1] = bitangent.y;
+ bitangents[attrIndex2] = bitangent.z;
}
}
attrIndex += 3;
@@ -147,7 +147,7 @@ define([
positions : positions,
normals : normals,
tangents : tangents,
- binormals : binormals
+ bitangents : bitangents
});
}
@@ -158,20 +158,20 @@ define([
var normals = (vertexFormat.normal) ? new Float32Array(length) : undefined;
var tangents = (vertexFormat.tangent) ? new Float32Array(length) : undefined;
- var binormals = (vertexFormat.binormal) ? new Float32Array(length) : undefined;
+ var bitangents = (vertexFormat.bitangent) ? new Float32Array(length) : undefined;
var normalIndex = 0;
var tangentIndex = 0;
- var binormalIndex = 0;
+ var bitangentIndex = 0;
var recomputeNormal = true;
- var binormal = binormalScratch;
+ var bitangent = bitangentScratch;
var tangent = tangentScratch;
var normal = normalScratch;
for (var i = 0; i < length; i += 6) {
var p = Cartesian3.fromArray(positions, i, positionScratch);
- if (vertexFormat.normal || vertexFormat.tangent || vertexFormat.binormal) {
+ if (vertexFormat.normal || vertexFormat.tangent || vertexFormat.bitangent) {
var p1 = Cartesian3.fromArray(positions, (i + 6) % length, v1Scratch);
if (recomputeNormal) {
var p2 = Cartesian3.fromArray(positions, (i + 3) % length, v2Scratch);
@@ -185,10 +185,10 @@ define([
recomputeNormal = true;
}
- if (vertexFormat.tangent || vertexFormat.binormal) {
- binormal = ellipsoid.geodeticSurfaceNormal(p, binormal);
+ if (vertexFormat.tangent || vertexFormat.bitangent) {
+ bitangent = ellipsoid.geodeticSurfaceNormal(p, bitangent);
if (vertexFormat.tangent) {
- tangent = Cartesian3.normalize(Cartesian3.cross(binormal, normal, tangent), tangent);
+ tangent = Cartesian3.normalize(Cartesian3.cross(bitangent, normal, tangent), tangent);
}
}
@@ -210,13 +210,13 @@ define([
tangents[tangentIndex++] = tangent.z;
}
- if (vertexFormat.binormal) {
- binormals[binormalIndex++] = binormal.x;
- binormals[binormalIndex++] = binormal.y;
- binormals[binormalIndex++] = binormal.z;
- binormals[binormalIndex++] = binormal.x;
- binormals[binormalIndex++] = binormal.y;
- binormals[binormalIndex++] = binormal.z;
+ if (vertexFormat.bitangent) {
+ bitangents[bitangentIndex++] = bitangent.x;
+ bitangents[bitangentIndex++] = bitangent.y;
+ bitangents[bitangentIndex++] = bitangent.z;
+ bitangents[bitangentIndex++] = bitangent.x;
+ bitangents[bitangentIndex++] = bitangent.y;
+ bitangents[bitangentIndex++] = bitangent.z;
}
}
}
@@ -225,7 +225,7 @@ define([
positions : positions,
normals : normals,
tangents : tangents,
- binormals : binormals
+ bitangents : bitangents
});
}
@@ -365,7 +365,7 @@ define([
var normals = (vertexFormat.normal) ? new Float32Array(newLength) : undefined;
var tangents = (vertexFormat.tangent) ? new Float32Array(newLength) : undefined;
- var binormals = (vertexFormat.binormal) ? new Float32Array(newLength) : undefined;
+ var bitangents = (vertexFormat.bitangent) ? new Float32Array(newLength) : undefined;
var textures = (vertexFormat.st) ? new Float32Array(newLength/3*2) : undefined;
var topSt;
var topNormals;
@@ -404,11 +404,11 @@ define([
tangents.set(topTangents, length);
topBottomGeo.attributes.tangent.values = tangents;
}
- if (vertexFormat.binormal) {
- var topBinormals = topBottomGeo.attributes.binormal.values;
- binormals.set(topBinormals);
- binormals.set(topBinormals, length);
- topBottomGeo.attributes.binormal.values = binormals;
+ if (vertexFormat.bitangent) {
+ var topBitangents = topBottomGeo.attributes.bitangent.values;
+ bitangents.set(topBitangents);
+ bitangents.set(topBitangents, length);
+ topBottomGeo.attributes.bitangent.values = bitangents;
}
if (vertexFormat.st) {
topSt = topBottomGeo.attributes.st.values;
diff --git a/Source/Core/VertexFormat.js b/Source/Core/VertexFormat.js
index 50a8a0c835b2..98d2f5b24620 100644
--- a/Source/Core/VertexFormat.js
+++ b/Source/Core/VertexFormat.js
@@ -71,7 +71,7 @@ define([
this.st = defaultValue(options.st, false);
/**
- * When true
, the vertex has a binormal attribute (normalized), which is used for tangent-space effects like bump mapping.
+ * When true
, the vertex has a bitangent attribute (normalized), which is used for tangent-space effects like bump mapping.
* * 32-bit floating-point. 3 components per attribute. *
@@ -80,7 +80,7 @@ define([ * * @default false */ - this.binormal = defaultValue(options.binormal, false); + this.bitangent = defaultValue(options.bitangent, false); /** * Whentrue
, the vertex has a tangent attribute (normalized), which is used for tangent-space effects like bump mapping.
@@ -182,7 +182,7 @@ define([
}));
/**
- * An immutable vertex format with well-known attributes: position, normal, st, binormal, and tangent.
+ * An immutable vertex format with well-known attributes: position, normal, st, tangent, and bitangent.
*
* @type {VertexFormat}
* @constant
@@ -190,15 +190,15 @@ define([
* @see VertexFormat#position
* @see VertexFormat#normal
* @see VertexFormat#st
- * @see VertexFormat#binormal
* @see VertexFormat#tangent
+ * @see VertexFormat#bitangent
*/
VertexFormat.ALL = freezeObject(new VertexFormat({
position : true,
normal : true,
st : true,
- binormal : true,
- tangent : true
+ tangent : true,
+ bitangent : true
}));
/**
@@ -245,8 +245,8 @@ define([
array[startingIndex++] = value.position ? 1.0 : 0.0;
array[startingIndex++] = value.normal ? 1.0 : 0.0;
array[startingIndex++] = value.st ? 1.0 : 0.0;
- array[startingIndex++] = value.binormal ? 1.0 : 0.0;
array[startingIndex++] = value.tangent ? 1.0 : 0.0;
+ array[startingIndex++] = value.bitangent ? 1.0 : 0.0;
array[startingIndex++] = value.color ? 1.0 : 0.0;
return array;
@@ -273,12 +273,12 @@ define([
result = new VertexFormat();
}
- result.position = array[startingIndex++] === 1.0;
- result.normal = array[startingIndex++] === 1.0;
- result.st = array[startingIndex++] === 1.0;
- result.binormal = array[startingIndex++] === 1.0;
- result.tangent = array[startingIndex++] === 1.0;
- result.color = array[startingIndex++] === 1.0;
+ result.position = array[startingIndex++] === 1.0;
+ result.normal = array[startingIndex++] === 1.0;
+ result.st = array[startingIndex++] === 1.0;
+ result.tangent = array[startingIndex++] === 1.0;
+ result.bitangent = array[startingIndex++] === 1.0;
+ result.color = array[startingIndex++] === 1.0;
return result;
};
@@ -300,8 +300,8 @@ define([
result.position = vertexFormat.position;
result.normal = vertexFormat.normal;
result.st = vertexFormat.st;
- result.binormal = vertexFormat.binormal;
result.tangent = vertexFormat.tangent;
+ result.bitangent = vertexFormat.bitangent;
result.color = vertexFormat.color;
return result;
};
diff --git a/Source/Core/WallGeometry.js b/Source/Core/WallGeometry.js
index 45824065fb0f..590e8e9a7678 100644
--- a/Source/Core/WallGeometry.js
+++ b/Source/Core/WallGeometry.js
@@ -38,7 +38,7 @@ define([
var scratchCartesian3Position3 = new Cartesian3();
var scratchCartesian3Position4 = new Cartesian3();
var scratchCartesian3Position5 = new Cartesian3();
- var scratchBinormal = new Cartesian3();
+ var scratchBitangent = new Cartesian3();
var scratchTangent = new Cartesian3();
var scratchNormal = new Cartesian3();
@@ -377,12 +377,12 @@ define([
var positions = vertexFormat.position ? new Float64Array(size) : undefined;
var normals = vertexFormat.normal ? new Float32Array(size) : undefined;
var tangents = vertexFormat.tangent ? new Float32Array(size) : undefined;
- var binormals = vertexFormat.binormal ? new Float32Array(size) : undefined;
+ var bitangents = vertexFormat.bitangent ? new Float32Array(size) : undefined;
var textureCoordinates = vertexFormat.st ? new Float32Array(size / 3 * 2) : undefined;
var positionIndex = 0;
var normalIndex = 0;
- var binormalIndex = 0;
+ var bitangentIndex = 0;
var tangentIndex = 0;
var stIndex = 0;
@@ -390,7 +390,7 @@ define([
// points being even and upper points being odd
var normal = scratchNormal;
var tangent = scratchTangent;
- var binormal = scratchBinormal;
+ var bitangent = scratchBitangent;
var recomputeNormal = true;
length /= 3;
var i;
@@ -420,7 +420,7 @@ define([
textureCoordinates[stIndex++] = 1.0;
}
- if (vertexFormat.normal || vertexFormat.tangent || vertexFormat.binormal) {
+ if (vertexFormat.normal || vertexFormat.tangent || vertexFormat.bitangent) {
var nextPosition;
var nextTop = Cartesian3.clone(Cartesian3.ZERO, scratchCartesian3Position5);
var groundPosition = ellipsoid.scaleToGeodeticSurface(Cartesian3.fromArray(topPositions, i3, scratchCartesian3Position2), scratchCartesian3Position2);
@@ -443,8 +443,8 @@ define([
if (vertexFormat.tangent) {
tangent = Cartesian3.normalize(Cartesian3.subtract(nextPosition, groundPosition, tangent), tangent);
}
- if (vertexFormat.binormal) {
- binormal = Cartesian3.normalize(Cartesian3.cross(normal, tangent, binormal), binormal);
+ if (vertexFormat.bitangent) {
+ bitangent = Cartesian3.normalize(Cartesian3.cross(normal, tangent, bitangent), bitangent);
}
}
@@ -468,14 +468,14 @@ define([
tangents[tangentIndex++] = tangent.z;
}
- if (vertexFormat.binormal) {
- binormals[binormalIndex++] = binormal.x;
- binormals[binormalIndex++] = binormal.y;
- binormals[binormalIndex++] = binormal.z;
+ if (vertexFormat.bitangent) {
+ bitangents[bitangentIndex++] = bitangent.x;
+ bitangents[bitangentIndex++] = bitangent.y;
+ bitangents[bitangentIndex++] = bitangent.z;
- binormals[binormalIndex++] = binormal.x;
- binormals[binormalIndex++] = binormal.y;
- binormals[binormalIndex++] = binormal.z;
+ bitangents[bitangentIndex++] = bitangent.x;
+ bitangents[bitangentIndex++] = bitangent.y;
+ bitangents[bitangentIndex++] = bitangent.z;
}
}
}
@@ -506,11 +506,11 @@ define([
});
}
- if (vertexFormat.binormal) {
- attributes.binormal = new GeometryAttribute({
+ if (vertexFormat.bitangent) {
+ attributes.bitangent = new GeometryAttribute({
componentDatatype : ComponentDatatype.FLOAT,
componentsPerAttribute : 3,
- values : binormals
+ values : bitangents
});
}
diff --git a/Source/Scene/DebugAppearance.js b/Source/Scene/DebugAppearance.js
index e63c7e42462d..9e4137483a7b 100644
--- a/Source/Scene/DebugAppearance.js
+++ b/Source/Scene/DebugAppearance.js
@@ -17,7 +17,7 @@ define([
* Visualizes a vertex attribute by displaying it as a color for debugging.
*
* Components for well-known unit-length vectors, i.e., normal
,
- * binormal
, and tangent
, are scaled and biased
+ * tangent
, and bitangent
, are scaled and biased
* from [-1.0, 1.0] to (-1.0, 1.0).
*
normal
,
- * binormal
, and tangent
.
+ * tangent
, and bitangent
.
*
* @alias EllipsoidSurfaceAppearance
* @constructor
diff --git a/Source/Scene/MaterialAppearance.js b/Source/Scene/MaterialAppearance.js
index 234b22cb804f..b6b1dc533927 100644
--- a/Source/Scene/MaterialAppearance.js
+++ b/Source/Scene/MaterialAppearance.js
@@ -311,7 +311,7 @@ define([
/**
* All materials, including those that work in tangent space, are supported.
* This requires position
, normal
, st
,
- * binormal
, and tangent
vertex attributes.
+ * tangent
, and bitangent
vertex attributes.
*
* @constant
*/
diff --git a/Source/Scene/Primitive.js b/Source/Scene/Primitive.js
index 23b812e41b38..90968e3ba53e 100644
--- a/Source/Scene/Primitive.js
+++ b/Source/Scene/Primitive.js
@@ -889,10 +889,10 @@ define([
}
var containsTangent = vertexShaderSource.search(/attribute\s+vec3\s+tangent;/g) !== -1;
- var containsBinormal = vertexShaderSource.search(/attribute\s+vec3\s+binormal;/g) !== -1;
+ var containsBitangent = vertexShaderSource.search(/attribute\s+vec3\s+bitangent;/g) !== -1;
var numComponents = containsSt && containsNormal ? 2.0 : 1.0;
- numComponents += containsTangent || containsBinormal ? 1 : 0;
+ numComponents += containsTangent || containsBitangent ? 1 : 0;
var type = (numComponents > 1) ? 'vec' + numComponents : 'float';
@@ -908,12 +908,12 @@ define([
decode += ' st = czm_decompressTextureCoordinates(' + stComponent + ');\n';
}
- if (containsNormal && containsTangent && containsBinormal) {
+ if (containsNormal && containsTangent && containsBitangent) {
globalDecl +=
'vec3 normal;\n' +
'vec3 tangent;\n' +
- 'vec3 binormal;\n';
- decode += ' czm_octDecode(' + attributeName + '.' + (containsSt ? 'yz' : 'xy') + ', normal, tangent, binormal);\n';
+ 'vec3 bitangent;\n';
+ decode += ' czm_octDecode(' + attributeName + '.' + (containsSt ? 'yz' : 'xy') + ', normal, tangent, bitangent);\n';
} else {
if (containsNormal) {
globalDecl += 'vec3 normal;\n';
@@ -925,9 +925,9 @@ define([
decode += ' tangent = czm_octDecode(' + attributeName + '.' + (containsSt && containsNormal ? 'z' : 'y') + ');\n';
}
- if (containsBinormal) {
- globalDecl += 'vec3 binormal;\n';
- decode += ' binormal = czm_octDecode(' + attributeName + '.' + (containsSt && containsNormal ? 'z' : 'y') + ');\n';
+ if (containsBitangent) {
+ globalDecl += 'vec3 bitangent;\n';
+ decode += ' bitangent = czm_octDecode(' + attributeName + '.' + (containsSt && containsNormal ? 'z' : 'y') + ');\n';
}
}
@@ -935,7 +935,7 @@ define([
modifiedVS = modifiedVS.replace(/attribute\s+vec3\s+normal;/g, '');
modifiedVS = modifiedVS.replace(/attribute\s+vec2\s+st;/g, '');
modifiedVS = modifiedVS.replace(/attribute\s+vec3\s+tangent;/g, '');
- modifiedVS = modifiedVS.replace(/attribute\s+vec3\s+binormal;/g, '');
+ modifiedVS = modifiedVS.replace(/attribute\s+vec3\s+bitangent;/g, '');
modifiedVS = ShaderSource.replaceMain(modifiedVS, 'czm_non_compressed_main');
var compressedMain =
'void main() \n' +
diff --git a/Source/Scene/createTangentSpaceDebugPrimitive.js b/Source/Scene/createTangentSpaceDebugPrimitive.js
index 870f61aec175..36954a59818c 100644
--- a/Source/Scene/createTangentSpaceDebugPrimitive.js
+++ b/Source/Scene/createTangentSpaceDebugPrimitive.js
@@ -23,8 +23,8 @@ define([
/**
* Creates a {@link Primitive} to visualize well-known vector vertex attributes:
- * normal
, binormal
, and tangent
. Normal
- * is red; binormal is green; and tangent is blue. If an attribute is not
+ * normal
, tangent
, and bitangent
. Normal
+ * is red; tangent is green; and bitangent is blue. If an attribute is not
* present, it is not drawn.
*
* @exports createTangentSpaceDebugPrimitive
@@ -73,9 +73,9 @@ define([
}));
}
- if (defined(attributes.binormal)) {
+ if (defined(attributes.tangent)) {
instances.push(new GeometryInstance({
- geometry : GeometryPipeline.createLineSegmentsForVectors(geometry, 'binormal', length),
+ geometry : GeometryPipeline.createLineSegmentsForVectors(geometry, 'tangent', length),
attributes : {
color : new ColorGeometryInstanceAttribute(0.0, 1.0, 0.0, 1.0)
},
@@ -83,9 +83,9 @@ define([
}));
}
- if (defined(attributes.tangent)) {
+ if (defined(attributes.bitangent)) {
instances.push(new GeometryInstance({
- geometry : GeometryPipeline.createLineSegmentsForVectors(geometry, 'tangent', length),
+ geometry : GeometryPipeline.createLineSegmentsForVectors(geometry, 'bitangent', length),
attributes : {
color : new ColorGeometryInstanceAttribute(0.0, 0.0, 1.0, 1.0)
},
diff --git a/Source/Shaders/Appearances/AllMaterialAppearanceFS.glsl b/Source/Shaders/Appearances/AllMaterialAppearanceFS.glsl
index 60288dae012d..672750f1f023 100644
--- a/Source/Shaders/Appearances/AllMaterialAppearanceFS.glsl
+++ b/Source/Shaders/Appearances/AllMaterialAppearanceFS.glsl
@@ -1,13 +1,13 @@
varying vec3 v_positionEC;
varying vec3 v_normalEC;
varying vec3 v_tangentEC;
-varying vec3 v_binormalEC;
+varying vec3 v_bitangentEC;
varying vec2 v_st;
void main()
{
- vec3 positionToEyeEC = -v_positionEC;
- mat3 tangentToEyeMatrix = czm_tangentToEyeSpaceMatrix(v_normalEC, v_tangentEC, v_binormalEC);
+ vec3 positionToEyeEC = -v_positionEC;
+ mat3 tangentToEyeMatrix = czm_tangentToEyeSpaceMatrix(v_normalEC, v_tangentEC, v_bitangentEC);
vec3 normalEC = normalize(v_normalEC);
#ifdef FACE_FORWARD
@@ -20,8 +20,8 @@ void main()
materialInput.positionToEyeEC = positionToEyeEC;
materialInput.st = v_st;
czm_material material = czm_getMaterial(materialInput);
-
-#ifdef FLAT
+
+#ifdef FLAT
gl_FragColor = vec4(material.diffuse + material.emission, material.alpha);
#else
gl_FragColor = czm_phong(normalize(positionToEyeEC), material);
diff --git a/Source/Shaders/Appearances/AllMaterialAppearanceVS.glsl b/Source/Shaders/Appearances/AllMaterialAppearanceVS.glsl
index 72e2081604ef..33d9d300a304 100644
--- a/Source/Shaders/Appearances/AllMaterialAppearanceVS.glsl
+++ b/Source/Shaders/Appearances/AllMaterialAppearanceVS.glsl
@@ -2,25 +2,25 @@ attribute vec3 position3DHigh;
attribute vec3 position3DLow;
attribute vec3 normal;
attribute vec3 tangent;
-attribute vec3 binormal;
+attribute vec3 bitangent;
attribute vec2 st;
attribute float batchId;
varying vec3 v_positionEC;
varying vec3 v_normalEC;
varying vec3 v_tangentEC;
-varying vec3 v_binormalEC;
+varying vec3 v_bitangentEC;
varying vec2 v_st;
-void main()
+void main()
{
vec4 p = czm_computePosition();
v_positionEC = (czm_modelViewRelativeToEye * p).xyz; // position in eye coordinates
v_normalEC = czm_normal * normal; // normal in eye coordinates
v_tangentEC = czm_normal * tangent; // tangent in eye coordinates
- v_binormalEC = czm_normal * binormal; // binormal in eye coordinates
+ v_bitangentEC = czm_normal * bitangent; // bitangent in eye coordinates
v_st = st;
-
+
gl_Position = czm_modelViewProjectionRelativeToEye * p;
}
diff --git a/Source/Shaders/Builtin/Functions/tangentToEyeSpaceMatrix.glsl b/Source/Shaders/Builtin/Functions/tangentToEyeSpaceMatrix.glsl
index 23f180f60ff5..46aae7308ea1 100644
--- a/Source/Shaders/Builtin/Functions/tangentToEyeSpaceMatrix.glsl
+++ b/Source/Shaders/Builtin/Functions/tangentToEyeSpaceMatrix.glsl
@@ -3,23 +3,23 @@
*
* @name czm_tangentToEyeSpaceMatrix
* @glslFunction
- *
+ *
* @param {vec3} normalEC The normal vector in eye coordinates.
* @param {vec3} tangentEC The tangent vector in eye coordinates.
- * @param {vec3} binormalEC The binormal vector in eye coordinates.
+ * @param {vec3} bitangentEC The bitangent vector in eye coordinates.
*
* @returns {mat3} The matrix that transforms from tangent space to eye space.
*
* @example
- * mat3 tangentToEye = czm_tangentToEyeSpaceMatrix(normalEC, tangentEC, binormalEC);
+ * mat3 tangentToEye = czm_tangentToEyeSpaceMatrix(normalEC, tangentEC, bitangentEC);
* vec3 normal = tangentToEye * texture2D(normalMap, st).xyz;
*/
-mat3 czm_tangentToEyeSpaceMatrix(vec3 normalEC, vec3 tangentEC, vec3 binormalEC)
+mat3 czm_tangentToEyeSpaceMatrix(vec3 normalEC, vec3 tangentEC, vec3 bitangentEC)
{
vec3 normal = normalize(normalEC);
vec3 tangent = normalize(tangentEC);
- vec3 binormal = normalize(binormalEC);
- return mat3(tangent.x, tangent.y, tangent.z,
- binormal.x, binormal.y, binormal.z,
- normal.x, normal.y, normal.z);
+ vec3 bitangent = normalize(bitangentEC);
+ return mat3(tangent.x , tangent.y , tangent.z,
+ bitangent.x, bitangent.y, bitangent.z,
+ normal.x , normal.y , normal.z);
}
diff --git a/Specs/Core/BoxGeometrySpec.js b/Specs/Core/BoxGeometrySpec.js
index 7af68804cfdf..10167f44166a 100644
--- a/Specs/Core/BoxGeometrySpec.js
+++ b/Specs/Core/BoxGeometrySpec.js
@@ -54,7 +54,7 @@ defineSuite([
expect(m.attributes.position.values.length).toEqual(numVertices * 3);
expect(m.attributes.normal.values.length).toEqual(numVertices * 3);
expect(m.attributes.tangent.values.length).toEqual(numVertices * 3);
- expect(m.attributes.binormal.values.length).toEqual(numVertices * 3);
+ expect(m.attributes.bitangent.values.length).toEqual(numVertices * 3);
expect(m.attributes.st.values.length).toEqual(numVertices * 2);
expect(m.indices.length).toEqual(numTriangles * 3);
diff --git a/Specs/Core/CircleGeometrySpec.js b/Specs/Core/CircleGeometrySpec.js
index ec7fdac5fb63..d59bb4cdc40a 100644
--- a/Specs/Core/CircleGeometrySpec.js
+++ b/Specs/Core/CircleGeometrySpec.js
@@ -74,7 +74,7 @@ defineSuite([
expect(m.attributes.st.values.length).toEqual(numVertices * 2);
expect(m.attributes.normal.values.length).toEqual(numVertices * 3);
expect(m.attributes.tangent.values.length).toEqual(numVertices * 3);
- expect(m.attributes.binormal.values.length).toEqual(numVertices * 3);
+ expect(m.attributes.bitangent.values.length).toEqual(numVertices * 3);
expect(m.indices.length).toEqual(numTriangles * 3);
});
@@ -110,7 +110,7 @@ defineSuite([
expect(m.attributes.st.values.length).toEqual(numVertices * 2);
expect(m.attributes.normal.values.length).toEqual(numVertices * 3);
expect(m.attributes.tangent.values.length).toEqual(numVertices * 3);
- expect(m.attributes.binormal.values.length).toEqual(numVertices * 3);
+ expect(m.attributes.bitangent.values.length).toEqual(numVertices * 3);
expect(m.indices.length).toEqual(numTriangles * 3);
});
diff --git a/Specs/Core/CorridorGeometrySpec.js b/Specs/Core/CorridorGeometrySpec.js
index 4bac8615e1ba..262b39282e6d 100644
--- a/Specs/Core/CorridorGeometrySpec.js
+++ b/Specs/Core/CorridorGeometrySpec.js
@@ -78,7 +78,7 @@ defineSuite([
expect(m.attributes.st.values.length).toEqual(numVertices * 2);
expect(m.attributes.normal.values.length).toEqual(numVertices * 3);
expect(m.attributes.tangent.values.length).toEqual(numVertices * 3);
- expect(m.attributes.binormal.values.length).toEqual(numVertices * 3);
+ expect(m.attributes.bitangent.values.length).toEqual(numVertices * 3);
expect(m.indices.length).toEqual(numTriangles * 3);
});
@@ -118,7 +118,7 @@ defineSuite([
expect(m.attributes.st.values.length).toEqual(numVertices * 2);
expect(m.attributes.normal.values.length).toEqual(numVertices * 3);
expect(m.attributes.tangent.values.length).toEqual(numVertices * 3);
- expect(m.attributes.binormal.values.length).toEqual(numVertices * 3);
+ expect(m.attributes.bitangent.values.length).toEqual(numVertices * 3);
expect(m.indices.length).toEqual(numTriangles * 3);
});
diff --git a/Specs/Core/CylinderGeometrySpec.js b/Specs/Core/CylinderGeometrySpec.js
index d3f459a72f98..27ba87a01d06 100644
--- a/Specs/Core/CylinderGeometrySpec.js
+++ b/Specs/Core/CylinderGeometrySpec.js
@@ -73,7 +73,7 @@ defineSuite([
expect(m.attributes.st.values.length).toEqual(numVertices * 2);
expect(m.attributes.normal.values.length).toEqual(numVertices * 3);
expect(m.attributes.tangent.values.length).toEqual(numVertices * 3);
- expect(m.attributes.binormal.values.length).toEqual(numVertices * 3);
+ expect(m.attributes.bitangent.values.length).toEqual(numVertices * 3);
expect(m.indices.length).toEqual(numTriangles * 3);
});
diff --git a/Specs/Core/EllipseGeometrySpec.js b/Specs/Core/EllipseGeometrySpec.js
index 0af786c8bf03..938bba921cd1 100644
--- a/Specs/Core/EllipseGeometrySpec.js
+++ b/Specs/Core/EllipseGeometrySpec.js
@@ -96,7 +96,7 @@ defineSuite([
expect(m.attributes.st.values.length).toEqual(numVertices * 2);
expect(m.attributes.normal.values.length).toEqual(numVertices * 3);
expect(m.attributes.tangent.values.length).toEqual(numVertices * 3);
- expect(m.attributes.binormal.values.length).toEqual(numVertices * 3);
+ expect(m.attributes.bitangent.values.length).toEqual(numVertices * 3);
expect(m.indices.length).toEqual(numTriangles * 3);
});
@@ -159,7 +159,7 @@ defineSuite([
expect(m.attributes.st.values.length).toEqual(numVertices * 2);
expect(m.attributes.normal.values.length).toEqual(numVertices * 3);
expect(m.attributes.tangent.values.length).toEqual(numVertices * 3);
- expect(m.attributes.binormal.values.length).toEqual(numVertices * 3);
+ expect(m.attributes.bitangent.values.length).toEqual(numVertices * 3);
expect(m.indices.length).toEqual(numTriangles * 3);
});
@@ -230,7 +230,7 @@ defineSuite([
expect(sv._extrudedHeight).toBe(minHeightFunc());
expect(sv._height).toBe(maxHeightFunc());
- expect(sv._vertexFormat.binormal).toBe(VertexFormat.POSITION_ONLY.binormal);
+ expect(sv._vertexFormat.bitangent).toBe(VertexFormat.POSITION_ONLY.bitangent);
expect(sv._vertexFormat.color).toBe(VertexFormat.POSITION_ONLY.color);
expect(sv._vertexFormat.normal).toBe(VertexFormat.POSITION_ONLY.normal);
expect(sv._vertexFormat.position).toBe(VertexFormat.POSITION_ONLY.position);
diff --git a/Specs/Core/EllipsoidGeometrySpec.js b/Specs/Core/EllipsoidGeometrySpec.js
index 65f10f5c5ea7..cf1f4a2a62a1 100644
--- a/Specs/Core/EllipsoidGeometrySpec.js
+++ b/Specs/Core/EllipsoidGeometrySpec.js
@@ -56,7 +56,7 @@ defineSuite([
expect(m.attributes.st.values.length).toEqual(numVertices * 2);
expect(m.attributes.normal.values.length).toEqual(numVertices * 3);
expect(m.attributes.tangent.values.length).toEqual(numVertices * 3);
- expect(m.attributes.binormal.values.length).toEqual(numVertices * 3);
+ expect(m.attributes.bitangent.values.length).toEqual(numVertices * 3);
expect(m.indices.length).toEqual(numTriangles * 3);
});
@@ -70,18 +70,18 @@ defineSuite([
var positions = m.attributes.position.values;
var normals = m.attributes.normal.values;
var tangents = m.attributes.tangent.values;
- var binormals = m.attributes.binormal.values;
+ var bitangents = m.attributes.bitangent.values;
for ( var i = 0; i < positions.length; i += 3) {
var position = Cartesian3.fromArray(positions, i);
var normal = Cartesian3.fromArray(normals, i);
var tangent = Cartesian3.fromArray(tangents, i);
- var binormal = Cartesian3.fromArray(binormals, i);
+ var bitangent = Cartesian3.fromArray(bitangents, i);
expect(Cartesian3.magnitude(position)).toEqualEpsilon(1.0, CesiumMath.EPSILON10);
expect(normal).toEqualEpsilon(Cartesian3.normalize(position, new Cartesian3()), CesiumMath.EPSILON7);
expect(Cartesian3.dot(Cartesian3.UNIT_Z, tangent)).not.toBeLessThan(0.0);
- expect(binormal).toEqualEpsilon(Cartesian3.cross(normal, tangent, new Cartesian3()), CesiumMath.EPSILON7);
+ expect(bitangent).toEqualEpsilon(Cartesian3.cross(normal, tangent, new Cartesian3()), CesiumMath.EPSILON7);
}
});
diff --git a/Specs/Core/GeometryPipelineSpec.js b/Specs/Core/GeometryPipelineSpec.js
index 6311f1d637dc..17eff035cb57 100644
--- a/Specs/Core/GeometryPipelineSpec.js
+++ b/Specs/Core/GeometryPipelineSpec.js
@@ -195,7 +195,7 @@ defineSuite([
});
expect(function() {
- GeometryPipeline.createLineSegmentsForVectors(geometry, 'binormal');
+ GeometryPipeline.createLineSegmentsForVectors(geometry, 'bitangent');
}).toThrowDeveloperError();
});
@@ -1410,13 +1410,13 @@ defineSuite([
expect(Cartesian3.fromArray(normals, 18)).toEqualEpsilon(Cartesian3.negate(Cartesian3.UNIT_Z, new Cartesian3()), CesiumMath.EPSILON7);
});
- it('computeBinormalAndTangent throws when geometry is undefined', function() {
+ it('computeTangentAndBitangent throws when geometry is undefined', function() {
expect(function() {
- GeometryPipeline.computeBinormalAndTangent();
+ GeometryPipeline.computeTangentAndBitangent();
}).toThrowDeveloperError();
});
- it('computeBinormalAndTangent throws when position is undefined', function() {
+ it('computeTangentAndBitangent throws when position is undefined', function() {
var geometry = new Geometry({
attributes: {
normal: new GeometryAttribute({
@@ -1436,11 +1436,11 @@ defineSuite([
});
expect(function() {
- GeometryPipeline.computeBinormalAndTangent(geometry);
+ GeometryPipeline.computeTangentAndBitangent(geometry);
}).toThrowDeveloperError();
});
- it('computeBinormalAndTangent throws when normal is undefined', function() {
+ it('computeTangentAndBitangent throws when normal is undefined', function() {
var geometry = new Geometry({
attributes: {
position: new GeometryAttribute({
@@ -1460,11 +1460,11 @@ defineSuite([
});
expect(function() {
- GeometryPipeline.computeBinormalAndTangent(geometry);
+ GeometryPipeline.computeTangentAndBitangent(geometry);
}).toThrowDeveloperError();
});
- it('computeBinormalAndTangent throws when st is undefined', function() {
+ it('computeTangentAndBitangent throws when st is undefined', function() {
var geometry = new Geometry({
attributes: {
position: new GeometryAttribute({
@@ -1485,11 +1485,11 @@ defineSuite([
});
expect(function() {
- GeometryPipeline.computeBinormalAndTangent(geometry);
+ GeometryPipeline.computeTangentAndBitangent(geometry);
}).toThrowDeveloperError();
});
- it('computeBinormalAndTangent throws when geometry.indices is undefined', function() {
+ it('computeTangentAndBitangent throws when geometry.indices is undefined', function() {
var geometry = new Geometry({
attributes: {
position: new GeometryAttribute({
@@ -1513,11 +1513,11 @@ defineSuite([
});
expect(function() {
- GeometryPipeline.computeBinormalAndTangent(geometry);
+ GeometryPipeline.computeTangentAndBitangent(geometry);
}).toThrowDeveloperError();
});
- it('computeBinormalAndTangent throws when indices is not a multiple of 3', function() {
+ it('computeTangentAndBitangent throws when indices is not a multiple of 3', function() {
var geometry = new Geometry({
attributes: {
position: new GeometryAttribute({
@@ -1543,11 +1543,11 @@ defineSuite([
});
expect(function() {
- GeometryPipeline.computeBinormalAndTangent(geometry);
+ GeometryPipeline.computeTangentAndBitangent(geometry);
}).toThrowDeveloperError();
});
- it('computeBinormalAndTangent throws when primitive type is not triangle', function() {
+ it('computeTangentAndBitangent throws when primitive type is not triangle', function() {
var geometry = new Geometry({
attributes: {
position: new GeometryAttribute({
@@ -1573,11 +1573,11 @@ defineSuite([
});
expect(function() {
- GeometryPipeline.computeBinormalAndTangent(geometry);
+ GeometryPipeline.computeTangentAndBitangent(geometry);
}).toThrowDeveloperError();
});
- it('computeBinormalAndTangent computes tangent and binormal for one triangle', function() {
+ it('computeTangentAndBitangent computes tangent and bitangent for one triangle', function() {
var geometry = new Geometry({
attributes: {
position: new GeometryAttribute({
@@ -1596,13 +1596,13 @@ defineSuite([
});
geometry = GeometryPipeline.computeNormal(geometry);
- geometry = GeometryPipeline.computeBinormalAndTangent(geometry);
+ geometry = GeometryPipeline.computeTangentAndBitangent(geometry);
expect(geometry.attributes.tangent.values).toEqual([1, 0, 0, 1, 0, 0, 1, 0, 0]);
- expect(geometry.attributes.binormal.values).toEqual([0, 1, 0, 0, 1, 0, 0, 1, 0]);
+ expect(geometry.attributes.bitangent.values).toEqual([0, 1, 0, 0, 1, 0, 0, 1, 0]);
});
- it('computeBinormalAndTangent computes tangent and binormal for two triangles', function() {
+ it('computeTangentAndBitangent computes tangent and bitangent for two triangles', function() {
var geometry = new Geometry({
attributes: {
position: new GeometryAttribute({
@@ -1621,18 +1621,57 @@ defineSuite([
});
geometry = GeometryPipeline.computeNormal(geometry);
- geometry = GeometryPipeline.computeBinormalAndTangent(geometry);
+ geometry = GeometryPipeline.computeTangentAndBitangent(geometry);
expect(geometry.attributes.tangent.values).toEqualEpsilon([0.7071067811865475, 0, 0.7071067811865475,
0, 1, 0,
0, 1, 0,
-0.5773502691896258, 0.5773502691896258, 0.5773502691896258], CesiumMath.EPSILON7);
- expect(geometry.attributes.binormal.values).toEqualEpsilon([0, 1, 0,
+ expect(geometry.attributes.bitangent.values).toEqualEpsilon([0, 1, 0,
-1, 0, 0,
-1, 0, 0,
-0.4082482904638631, -0.8164965809277261, 0.4082482904638631], CesiumMath.EPSILON7);
});
+ it ('computeTangentAndBitangent computes tangent and bitangent for an BoxGeometry', function() {
+ var geometry = BoxGeometry.createGeometry(new BoxGeometry({
+ vertexFormat : new VertexFormat({
+ position : true,
+ normal : true,
+ st : true
+ }),
+ maximum : new Cartesian3(250000.0, 250000.0, 250000.0),
+ minimum : new Cartesian3(-250000.0, -250000.0, -250000.0)
+ }));
+ geometry = GeometryPipeline.computeTangentAndBitangent(geometry);
+ var actualTangents = geometry.attributes.tangent.values;
+ var actualBitangents = geometry.attributes.bitangent.values;
+
+ var expectedGeometry = BoxGeometry.createGeometry(new BoxGeometry({
+ vertexFormat: VertexFormat.ALL,
+ maximum : new Cartesian3(250000.0, 250000.0, 250000.0),
+ minimum : new Cartesian3(-250000.0, -250000.0, -250000.0)
+ }));
+ var expectedTangents = expectedGeometry.attributes.tangent.values;
+ var expectedBitangents = expectedGeometry.attributes.bitangent.values;
+
+ expect(actualTangents.length).toEqual(expectedTangents.length);
+ expect(actualBitangents.length).toEqual(expectedBitangents.length);
+
+ for (var i = 0; i < actualTangents.length; i += 3) {
+ var actual = Cartesian3.fromArray(actualTangents, i);
+ var expected = Cartesian3.fromArray(expectedTangents, i);
+ expect(actual).toEqualEpsilon(expected, CesiumMath.EPSILON1);
+
+ actual = Cartesian3.fromArray(actualBitangents, i);
+ expected = Cartesian3.fromArray(expectedBitangents, i);
+ expect(actual).toEqualEpsilon(expected, CesiumMath.EPSILON1);
+ }
+ });
+
it ('computeBinormalAndTangent computes tangent and binormal for an BoxGeometry', function() {
+ // This test is for the deprecated computeBinormalAndTangent API
+ // It tests to assert that the binormal attribute is set correctly and
+ // is a copy of the bitangent attribute
var geometry = BoxGeometry.createGeometry(new BoxGeometry({
vertexFormat : new VertexFormat({
position : true,
@@ -1652,10 +1691,10 @@ defineSuite([
minimum : new Cartesian3(-250000.0, -250000.0, -250000.0)
}));
var expectedTangents = expectedGeometry.attributes.tangent.values;
- var expectedBinormals = expectedGeometry.attributes.binormal.values;
+ var expectedBitangents = expectedGeometry.attributes.bitangent.values;
expect(actualTangents.length).toEqual(expectedTangents.length);
- expect(actualBinormals.length).toEqual(expectedBinormals.length);
+ expect(actualBinormals.length).toEqual(expectedBitangents.length);
for (var i = 0; i < actualTangents.length; i += 3) {
var actual = Cartesian3.fromArray(actualTangents, i);
@@ -1663,7 +1702,7 @@ defineSuite([
expect(actual).toEqualEpsilon(expected, CesiumMath.EPSILON1);
actual = Cartesian3.fromArray(actualBinormals, i);
- expected = Cartesian3.fromArray(expectedBinormals, i);
+ expected = Cartesian3.fromArray(expectedBitangents, i);
expect(actual).toEqualEpsilon(expected, CesiumMath.EPSILON1);
}
});
@@ -1770,28 +1809,28 @@ defineSuite([
}
});
- it('compressVertices packs compressed tangents and binormals', function() {
+ it('compressVertices packs compressed tangents and bitangents', function() {
var geometry = BoxGeometry.createGeometry(new BoxGeometry({
vertexFormat : new VertexFormat({
position : true,
normal : true,
tangent : true,
- binormal : true
+ bitangent : true
}),
maximum : new Cartesian3(250000.0, 250000.0, 250000.0),
minimum : new Cartesian3(-250000.0, -250000.0, -250000.0)
}));
expect(geometry.attributes.normal).toBeDefined();
expect(geometry.attributes.tangent).toBeDefined();
- expect(geometry.attributes.binormal).toBeDefined();
+ expect(geometry.attributes.bitangent).toBeDefined();
var originalNormals = Array.prototype.slice.call(geometry.attributes.normal.values);
var originalTangents = Array.prototype.slice.call(geometry.attributes.tangent.values);
- var originalBinormals = Array.prototype.slice.call(geometry.attributes.binormal.values);
+ var originalBitangents = Array.prototype.slice.call(geometry.attributes.bitangent.values);
geometry = GeometryPipeline.compressVertices(geometry);
expect(geometry.attributes.tangent).not.toBeDefined();
- expect(geometry.attributes.binormal).not.toBeDefined();
+ expect(geometry.attributes.bitangent).not.toBeDefined();
expect(geometry.attributes.compressedAttributes).toBeDefined();
var compressedNormals = geometry.attributes.compressedAttributes.values;
@@ -1799,15 +1838,15 @@ defineSuite([
var normal = new Cartesian3();
var tangent = new Cartesian3();
- var binormal = new Cartesian3();
+ var bitangent = new Cartesian3();
for (var i = 0; i < compressedNormals.length; i += 2) {
var compressed = Cartesian2.fromArray(compressedNormals, i, new Cartesian2());
- AttributeCompression.octUnpack(compressed, normal, tangent, binormal);
+ AttributeCompression.octUnpack(compressed, normal, tangent, bitangent);
expect(normal).toEqualEpsilon(Cartesian3.fromArray(originalNormals, i / 2 * 3), CesiumMath.EPSILON2);
expect(tangent).toEqualEpsilon(Cartesian3.fromArray(originalTangents, i / 2 * 3), CesiumMath.EPSILON2);
- expect(binormal).toEqualEpsilon(Cartesian3.fromArray(originalBinormals, i / 2 * 3), CesiumMath.EPSILON2);
+ expect(bitangent).toEqualEpsilon(Cartesian3.fromArray(originalBitangents, i / 2 * 3), CesiumMath.EPSILON2);
}
});
@@ -2433,7 +2472,7 @@ defineSuite([
componentsPerAttribute : 3,
values : new Float32Array([-1.0, 0.0, 0.0, -1.0, 0.0, 0.0, -1.0, 0.0, 0.0])
}),
- binormal : new GeometryAttribute({
+ bitangent : new GeometryAttribute({
componentDatatype : ComponentDatatype.FLOAT,
componentsPerAttribute : 3,
values : new Float32Array([0.0, -1.0, 0.0, 0.0, -1.0, 0.0, 0.0, -1.0, 0.0])
@@ -2458,8 +2497,8 @@ defineSuite([
expect(instance.westHemisphereGeometry.attributes.position.values.length).toEqual(3 * 3);
expect(instance.westHemisphereGeometry.attributes.normal).toBeDefined();
expect(instance.westHemisphereGeometry.attributes.normal.values.length).toEqual(3 * 3);
- expect(instance.westHemisphereGeometry.attributes.binormal).toBeDefined();
- expect(instance.westHemisphereGeometry.attributes.binormal.values.length).toEqual(3 * 3);
+ expect(instance.westHemisphereGeometry.attributes.bitangent).toBeDefined();
+ expect(instance.westHemisphereGeometry.attributes.bitangent.values.length).toEqual(3 * 3);
expect(instance.westHemisphereGeometry.attributes.tangent).toBeDefined();
expect(instance.westHemisphereGeometry.attributes.tangent.values.length).toEqual(3 * 3);
expect(instance.westHemisphereGeometry.attributes.st).toBeDefined();
@@ -2472,8 +2511,8 @@ defineSuite([
expect(instance.eastHemisphereGeometry.attributes.position.values.length).toEqual(5 * 3);
expect(instance.eastHemisphereGeometry.attributes.normal).toBeDefined();
expect(instance.eastHemisphereGeometry.attributes.normal.values.length).toEqual(5 * 3);
- expect(instance.eastHemisphereGeometry.attributes.binormal).toBeDefined();
- expect(instance.eastHemisphereGeometry.attributes.binormal.values.length).toEqual(5 * 3);
+ expect(instance.eastHemisphereGeometry.attributes.bitangent).toBeDefined();
+ expect(instance.eastHemisphereGeometry.attributes.bitangent.values.length).toEqual(5 * 3);
expect(instance.eastHemisphereGeometry.attributes.tangent).toBeDefined();
expect(instance.eastHemisphereGeometry.attributes.tangent.values.length).toEqual(5 * 3);
expect(instance.eastHemisphereGeometry.attributes.st).toBeDefined();
diff --git a/Specs/Core/PolygonGeometrySpec.js b/Specs/Core/PolygonGeometrySpec.js
index d29fdb8bbc43..cddcf5c98a6b 100644
--- a/Specs/Core/PolygonGeometrySpec.js
+++ b/Specs/Core/PolygonGeometrySpec.js
@@ -150,7 +150,7 @@ defineSuite([
expect(p.attributes.st.values.length).toEqual(numVertices * 2);
expect(p.attributes.normal.values.length).toEqual(numVertices * 3);
expect(p.attributes.tangent.values.length).toEqual(numVertices * 3);
- expect(p.attributes.binormal.values.length).toEqual(numVertices * 3);
+ expect(p.attributes.bitangent.values.length).toEqual(numVertices * 3);
expect(p.indices.length).toEqual(numTriangles * 3);
});
@@ -502,7 +502,7 @@ defineSuite([
expect(p.attributes.st.values.length).toEqual(numVertices * 2);
expect(p.attributes.normal.values.length).toEqual(numVertices * 3);
expect(p.attributes.tangent.values.length).toEqual(numVertices * 3);
- expect(p.attributes.binormal.values.length).toEqual(numVertices * 3);
+ expect(p.attributes.bitangent.values.length).toEqual(numVertices * 3);
expect(p.indices.length).toEqual(numTriangles * 3);
});
diff --git a/Specs/Core/PolylineVolumeGeometrySpec.js b/Specs/Core/PolylineVolumeGeometrySpec.js
index 6dd11a5b8645..8b8c62da7ca9 100644
--- a/Specs/Core/PolylineVolumeGeometrySpec.js
+++ b/Specs/Core/PolylineVolumeGeometrySpec.js
@@ -121,7 +121,7 @@ defineSuite([
expect(m.attributes.st.values.length).toEqual(numVertices * 2);
expect(m.attributes.normal.values.length).toEqual(numVertices * 3);
expect(m.attributes.tangent.values.length).toEqual(numVertices * 3);
- expect(m.attributes.binormal.values.length).toEqual(numVertices * 3);
+ expect(m.attributes.bitangent.values.length).toEqual(numVertices * 3);
expect(m.indices.length).toEqual(numTriangles * 3);
});
diff --git a/Specs/Core/RectangleGeometrySpec.js b/Specs/Core/RectangleGeometrySpec.js
index 0e1e51f92d7e..c3138f4c80c8 100644
--- a/Specs/Core/RectangleGeometrySpec.js
+++ b/Specs/Core/RectangleGeometrySpec.js
@@ -72,7 +72,7 @@ defineSuite([
expect(m.attributes.st.values.length).toEqual(numVertices * 2);
expect(m.attributes.normal.values.length).toEqual(numVertices * 3);
expect(m.attributes.tangent.values.length).toEqual(numVertices * 3);
- expect(m.attributes.binormal.values.length).toEqual(numVertices * 3);
+ expect(m.attributes.bitangent.values.length).toEqual(numVertices * 3);
expect(m.indices.length).toEqual(numTriangles * 3);
});
@@ -217,7 +217,7 @@ defineSuite([
expect(m.attributes.st.values.length).toEqual(numVertices * 2);
expect(m.attributes.normal.values.length).toEqual(numVertices * 3);
expect(m.attributes.tangent.values.length).toEqual(numVertices * 3);
- expect(m.attributes.binormal.values.length).toEqual(numVertices * 3);
+ expect(m.attributes.bitangent.values.length).toEqual(numVertices * 3);
expect(m.indices.length).toEqual(numTriangles * 3);
});
diff --git a/Specs/Core/SphereGeometrySpec.js b/Specs/Core/SphereGeometrySpec.js
index af309d616468..763b8185398c 100644
--- a/Specs/Core/SphereGeometrySpec.js
+++ b/Specs/Core/SphereGeometrySpec.js
@@ -56,7 +56,7 @@ defineSuite([
expect(m.attributes.st.values.length).toEqual(numVertices * 2);
expect(m.attributes.normal.values.length).toEqual(numVertices * 3);
expect(m.attributes.tangent.values.length).toEqual(numVertices * 3);
- expect(m.attributes.binormal.values.length).toEqual(numVertices * 3);
+ expect(m.attributes.bitangent.values.length).toEqual(numVertices * 3);
expect(m.indices.length).toEqual(numTriangles * 3);
});
@@ -71,18 +71,18 @@ defineSuite([
var positions = m.attributes.position.values;
var normals = m.attributes.normal.values;
var tangents = m.attributes.tangent.values;
- var binormals = m.attributes.binormal.values;
+ var bitangents = m.attributes.bitangent.values;
for ( var i = 0; i < positions.length; i += 3) {
var position = Cartesian3.fromArray(positions, i);
var normal = Cartesian3.fromArray(normals, i);
var tangent = Cartesian3.fromArray(tangents, i);
- var binormal = Cartesian3.fromArray(binormals, i);
+ var bitangent = Cartesian3.fromArray(bitangents, i);
expect(Cartesian3.magnitude(position)).toEqualEpsilon(1.0, CesiumMath.EPSILON10);
expect(normal).toEqualEpsilon(Cartesian3.normalize(position, position), CesiumMath.EPSILON7);
expect(Cartesian3.dot(Cartesian3.UNIT_Z, tangent)).not.toBeLessThan(0.0);
- expect(binormal).toEqualEpsilon(Cartesian3.cross(normal, tangent, normal), CesiumMath.EPSILON7);
+ expect(bitangent).toEqualEpsilon(Cartesian3.cross(normal, tangent, normal), CesiumMath.EPSILON7);
}
});
diff --git a/Specs/Core/WallGeometrySpec.js b/Specs/Core/WallGeometrySpec.js
index 8afe7c9015a1..5575f745e006 100644
--- a/Specs/Core/WallGeometrySpec.js
+++ b/Specs/Core/WallGeometrySpec.js
@@ -228,7 +228,7 @@ defineSuite([
expect(w.attributes.position.values.length).toEqual(numPositions * 3);
expect(w.attributes.normal.values.length).toEqual(numPositions * 3);
expect(w.attributes.tangent.values.length).toEqual(numPositions * 3);
- expect(w.attributes.binormal.values.length).toEqual(numPositions * 3);
+ expect(w.attributes.bitangent.values.length).toEqual(numPositions * 3);
expect(w.attributes.st.values.length).toEqual(numPositions * 2);
expect(w.indices.length).toEqual(numTriangles * 3);
});
diff --git a/Specs/Renderer/BuiltinFunctionsSpec.js b/Specs/Renderer/BuiltinFunctionsSpec.js
index 24387af25124..323f97006725 100644
--- a/Specs/Renderer/BuiltinFunctionsSpec.js
+++ b/Specs/Renderer/BuiltinFunctionsSpec.js
@@ -114,10 +114,10 @@ defineSuite([
var fs =
'void main() { ' +
' vec3 tangent = vec3(1.0, 0.0, 0.0); ' +
- ' vec3 binormal = vec3(0.0, 1.0, 0.0); ' +
+ ' vec3 bitangent = vec3(0.0, 1.0, 0.0); ' +
' vec3 normal = vec3(0.0, 0.0, 1.0); ' +
' mat3 expected = mat3(1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0); ' +
- ' mat3 actual = czm_tangentToEyeSpaceMatrix(normal, tangent, binormal); ' +
+ ' mat3 actual = czm_tangentToEyeSpaceMatrix(normal, tangent, bitangent); ' +
' gl_FragColor = vec4(actual == expected); ' +
'}';
context.verifyDrawForSpecs(fs);
diff --git a/Specs/Scene/DebugAppearanceSpec.js b/Specs/Scene/DebugAppearanceSpec.js
index ce9f5d1cd096..5b2fda8b3ef9 100644
--- a/Specs/Scene/DebugAppearanceSpec.js
+++ b/Specs/Scene/DebugAppearanceSpec.js
@@ -63,7 +63,7 @@ defineSuite([
}).toThrowDeveloperError();
});
- it('default construct with normal, binormal, or tangent attribute name', function() {
+ it('default construct with normal, bitangent, or tangent attribute name', function() {
var a = new DebugAppearance({
attributeName : 'normal',
perInstanceAttribute : false
@@ -202,16 +202,16 @@ defineSuite([
expect(scene.renderForSpecs()).not.toEqual([0, 0, 0, 255]);
});
- it('renders binormal', function() {
+ it('renders bitangent', function() {
var vertexFormat = new VertexFormat({
position : true,
normal : true,
- binormal : true
+ bitangent : true
});
primitive = new Primitive({
geometryInstances : createInstance(vertexFormat),
appearance : new DebugAppearance({
- attributeName : 'binormal',
+ attributeName : 'bitangent',
perInstanceAttribute : false
}),
asynchronous : false,
From 4b6e92798536db98321016dfab250f783bf402db Mon Sep 17 00:00:00 2001
From: Shehzan Mohammed float
, vec2
, vec3
, and vec4
.
* @param {String} [options.vertexShaderSource] Optional GLSL vertex shader source to override the default vertex shader.
* @param {String} [options.fragmentShaderSource] Optional GLSL fragment shader source to override the default fragment shader.
@@ -51,10 +51,11 @@ define([
if (!defined(attributeName)) {
throw new DeveloperError('options.attributeName is required.');
}
+ //>>includeEnd('debug');
+
if (!defined(perInstanceAttribute)) {
- throw new DeveloperError('options.perInstanceAttribute is required.');
+ perInstanceAttribute = false;
}
- //>>includeEnd('debug');
var glslDatatype = defaultValue(options.glslDatatype, 'vec3');
var varyingName = 'v_' + attributeName;
From 89756c1398f7cb842a9a5edc793fd88f56e8d23d Mon Sep 17 00:00:00 2001
From: Shehzan Mohammed