Skip to content

Commit

Permalink
Merge pull request #4856 from shehzan10/binormal-bitangent
Browse files Browse the repository at this point in the history
Rename all instances of binormal as bitangent
  • Loading branch information
pjcozzi authored Jan 12, 2017
2 parents 2554d15 + 89756c1 commit e440efc
Show file tree
Hide file tree
Showing 36 changed files with 524 additions and 451 deletions.
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ Change Log
### 1.30 - 2017-02-01
* Deprecated
* The properties `url` and `key` will be removed from `GeocoderViewModel` in 1.31. These properties will be available on geocoder services that support them, like `BingMapsGeocoderService`.
* The function `createBinormalAndBitangent` of `GeometryPipeline` will be removed in 1.31. Use the function `createTangentAndBitangent` instead. [#4856](https://github.com/AnalyticalGraphicsInc/cesium/pull/4856)
* Breaking changes
* Removed separate `heading`, `pitch`, `roll` parameters from `Transform.headingPitchRollToFixedFrame` and `Transform.headingPitchRollQuaternion`. Pass a `headingPitchRoll` object instead. [#4843](https://github.com/AnalyticalGraphicsInc/cesium/pull/4843)
* The property `binornmal` has been renamed to `bitangent` for `Geometry` and `VertexFormat`. [#4856](https://github.com/AnalyticalGraphicsInc/cesium/pull/4856)
* Added support for custom geocoder services and autocomplete [#4723](https://github.com/AnalyticalGraphicsInc/cesium/pull/4723).
* Added [Custom Geocoder Sandcastle example](http://localhost:8080/Apps/Sandcastle/index.html?src=Custom%20Geocoder.html)
* Added `GeocoderService`, an interface for geocoders.
Expand All @@ -18,6 +20,7 @@ Change Log
* Fixed a bug that caused all models to use the same highlight color. [#4798] (https://github.com/AnalyticalGraphicsInc/cesium/pull/4798)
* Fixed KML for when color is an empty string [#4826](https://github.com/AnalyticalGraphicsInc/cesium/pull/4826)
* Added support for WMS version 1.3 by using CRS vice SRS query string parameter to request projection. SRS is still used for older versions.
* The attribute `perInstanceAttribute` of `DebugAppearance` has been made optional and defaults to `false`.

### 1.29 - 2017-01-02
* Improved 3D Models
Expand Down
156 changes: 78 additions & 78 deletions Source/Core/BoxGeometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ define([
var positions;

if (vertexFormat.position &&
(vertexFormat.st || vertexFormat.normal || vertexFormat.binormal || vertexFormat.tangent)) {
(vertexFormat.st || vertexFormat.normal || vertexFormat.tangent || vertexFormat.bitangent)) {
if (vertexFormat.position) {
// 8 corner points. Duplicated 3 times each for each incident edge/face.
positions = new Float64Array(6 * 4 * 3);
Expand Down Expand Up @@ -599,97 +599,97 @@ define([
});
}

if (vertexFormat.binormal) {
var binormals = new Float32Array(6 * 4 * 3);
if (vertexFormat.bitangent) {
var bitangents = new Float32Array(6 * 4 * 3);

// +z face
binormals[0] = 0.0;
binormals[1] = 1.0;
binormals[2] = 0.0;
binormals[3] = 0.0;
binormals[4] = 1.0;
binormals[5] = 0.0;
binormals[6] = 0.0;
binormals[7] = 1.0;
binormals[8] = 0.0;
binormals[9] = 0.0;
binormals[10] = 1.0;
binormals[11] = 0.0;
bitangents[0] = 0.0;
bitangents[1] = 1.0;
bitangents[2] = 0.0;
bitangents[3] = 0.0;
bitangents[4] = 1.0;
bitangents[5] = 0.0;
bitangents[6] = 0.0;
bitangents[7] = 1.0;
bitangents[8] = 0.0;
bitangents[9] = 0.0;
bitangents[10] = 1.0;
bitangents[11] = 0.0;

// -z face
binormals[12] = 0.0;
binormals[13] = 1.0;
binormals[14] = 0.0;
binormals[15] = 0.0;
binormals[16] = 1.0;
binormals[17] = 0.0;
binormals[18] = 0.0;
binormals[19] = 1.0;
binormals[20] = 0.0;
binormals[21] = 0.0;
binormals[22] = 1.0;
binormals[23] = 0.0;
bitangents[12] = 0.0;
bitangents[13] = 1.0;
bitangents[14] = 0.0;
bitangents[15] = 0.0;
bitangents[16] = 1.0;
bitangents[17] = 0.0;
bitangents[18] = 0.0;
bitangents[19] = 1.0;
bitangents[20] = 0.0;
bitangents[21] = 0.0;
bitangents[22] = 1.0;
bitangents[23] = 0.0;

// +x face
binormals[24] = 0.0;
binormals[25] = 0.0;
binormals[26] = 1.0;
binormals[27] = 0.0;
binormals[28] = 0.0;
binormals[29] = 1.0;
binormals[30] = 0.0;
binormals[31] = 0.0;
binormals[32] = 1.0;
binormals[33] = 0.0;
binormals[34] = 0.0;
binormals[35] = 1.0;
bitangents[24] = 0.0;
bitangents[25] = 0.0;
bitangents[26] = 1.0;
bitangents[27] = 0.0;
bitangents[28] = 0.0;
bitangents[29] = 1.0;
bitangents[30] = 0.0;
bitangents[31] = 0.0;
bitangents[32] = 1.0;
bitangents[33] = 0.0;
bitangents[34] = 0.0;
bitangents[35] = 1.0;

// -x face
binormals[36] = 0.0;
binormals[37] = 0.0;
binormals[38] = 1.0;
binormals[39] = 0.0;
binormals[40] = 0.0;
binormals[41] = 1.0;
binormals[42] = 0.0;
binormals[43] = 0.0;
binormals[44] = 1.0;
binormals[45] = 0.0;
binormals[46] = 0.0;
binormals[47] = 1.0;
bitangents[36] = 0.0;
bitangents[37] = 0.0;
bitangents[38] = 1.0;
bitangents[39] = 0.0;
bitangents[40] = 0.0;
bitangents[41] = 1.0;
bitangents[42] = 0.0;
bitangents[43] = 0.0;
bitangents[44] = 1.0;
bitangents[45] = 0.0;
bitangents[46] = 0.0;
bitangents[47] = 1.0;

// +y face
binormals[48] = 0.0;
binormals[49] = 0.0;
binormals[50] = 1.0;
binormals[51] = 0.0;
binormals[52] = 0.0;
binormals[53] = 1.0;
binormals[54] = 0.0;
binormals[55] = 0.0;
binormals[56] = 1.0;
binormals[57] = 0.0;
binormals[58] = 0.0;
binormals[59] = 1.0;
bitangents[48] = 0.0;
bitangents[49] = 0.0;
bitangents[50] = 1.0;
bitangents[51] = 0.0;
bitangents[52] = 0.0;
bitangents[53] = 1.0;
bitangents[54] = 0.0;
bitangents[55] = 0.0;
bitangents[56] = 1.0;
bitangents[57] = 0.0;
bitangents[58] = 0.0;
bitangents[59] = 1.0;

// -y face
binormals[60] = 0.0;
binormals[61] = 0.0;
binormals[62] = 1.0;
binormals[63] = 0.0;
binormals[64] = 0.0;
binormals[65] = 1.0;
binormals[66] = 0.0;
binormals[67] = 0.0;
binormals[68] = 1.0;
binormals[69] = 0.0;
binormals[70] = 0.0;
binormals[71] = 1.0;

attributes.binormal = new GeometryAttribute({
bitangents[60] = 0.0;
bitangents[61] = 0.0;
bitangents[62] = 1.0;
bitangents[63] = 0.0;
bitangents[64] = 0.0;
bitangents[65] = 1.0;
bitangents[66] = 0.0;
bitangents[67] = 0.0;
bitangents[68] = 1.0;
bitangents[69] = 0.0;
bitangents[70] = 0.0;
bitangents[71] = 1.0;

attributes.bitangent = new GeometryAttribute({
componentDatatype : ComponentDatatype.FLOAT,
componentsPerAttribute : 3,
values : binormals
values : bitangents
});
}

Expand Down
62 changes: 31 additions & 31 deletions Source/Core/CorridorGeometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,17 @@ define([
function addNormals(attr, normal, left, front, back, vertexFormat) {
var normals = attr.normals;
var tangents = attr.tangents;
var binormals = attr.binormals;
var bitangents = attr.bitangents;
var forward = Cartesian3.normalize(Cartesian3.cross(left, normal, scratch1), scratch1);
if (vertexFormat.normal) {
CorridorGeometryLibrary.addAttribute(normals, normal, front, back);
}
if (vertexFormat.binormal) {
CorridorGeometryLibrary.addAttribute(binormals, left, front, back);
}
if (vertexFormat.tangent) {
CorridorGeometryLibrary.addAttribute(tangents, forward, front, back);
}
if (vertexFormat.bitangent) {
CorridorGeometryLibrary.addAttribute(bitangents, left, front, back);
}
}

function combine(computedPositions, vertexFormat, ellipsoid) {
Expand Down Expand Up @@ -119,11 +119,11 @@ define([
var finalPositions = new Float64Array(size);
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 attr = {
normals : normals,
tangents : tangents,
binormals : binormals
bitangents : bitangents
};
var front = 0;
var back = size - 1;
Expand Down Expand Up @@ -408,11 +408,11 @@ define([
});
}

if (vertexFormat.binormal) {
attributes.binormal = new GeometryAttribute({
if (vertexFormat.bitangent) {
attributes.bitangent = new GeometryAttribute({
componentDatatype : ComponentDatatype.FLOAT,
componentsPerAttribute : 3,
values : attr.binormals
values : attr.bitangents
});
}

Expand All @@ -423,31 +423,31 @@ define([
}

function extrudedAttributes(attributes, vertexFormat) {
if (!vertexFormat.normal && !vertexFormat.binormal && !vertexFormat.tangent && !vertexFormat.st) {
if (!vertexFormat.normal && !vertexFormat.tangent && !vertexFormat.bitangent && !vertexFormat.st) {
return attributes;
}
var positions = attributes.position.values;
var topNormals;
var topBinormals;
if (vertexFormat.normal || vertexFormat.binormal) {
var topBitangents;
if (vertexFormat.normal || vertexFormat.bitangent) {
topNormals = attributes.normal.values;
topBinormals = attributes.binormal.values;
topBitangents = attributes.bitangent.values;
}
var size = attributes.position.values.length / 18;
var threeSize = size * 3;
var twoSize = size * 2;
var sixSize = threeSize * 2;
var i;
if (vertexFormat.normal || vertexFormat.binormal || vertexFormat.tangent) {
if (vertexFormat.normal || vertexFormat.bitangent || vertexFormat.tangent) {
var normals = (vertexFormat.normal) ? new Float32Array(threeSize * 6) : undefined;
var binormals = (vertexFormat.binormal) ? new Float32Array(threeSize * 6) : undefined;
var tangents = (vertexFormat.tangent) ? new Float32Array(threeSize * 6) : undefined;
var bitangents = (vertexFormat.bitangent) ? new Float32Array(threeSize * 6) : undefined;
var topPosition = cartesian1;
var bottomPosition = cartesian2;
var previousPosition = cartesian3;
var normal = cartesian4;
var tangent = cartesian5;
var binormal = cartesian6;
var bitangent = cartesian6;
var attrIndex = sixSize;
for (i = 0; i < threeSize; i += 3) {
var attrIndexOffset = attrIndex + sixSize;
Expand All @@ -463,17 +463,17 @@ define([
CorridorGeometryLibrary.addAttribute(normals, normal, attrIndex);
CorridorGeometryLibrary.addAttribute(normals, normal, attrIndex + 3);
}
if (vertexFormat.tangent || vertexFormat.binormal) {
binormal = Cartesian3.fromArray(topNormals, i, binormal);
if (vertexFormat.binormal) {
CorridorGeometryLibrary.addAttribute(binormals, binormal, attrIndexOffset);
CorridorGeometryLibrary.addAttribute(binormals, binormal, attrIndexOffset + 3);
CorridorGeometryLibrary.addAttribute(binormals, binormal, attrIndex);
CorridorGeometryLibrary.addAttribute(binormals, binormal, attrIndex + 3);
if (vertexFormat.tangent || vertexFormat.bitangent) {
bitangent = Cartesian3.fromArray(topNormals, i, bitangent);
if (vertexFormat.bitangent) {
CorridorGeometryLibrary.addAttribute(bitangents, bitangent, attrIndexOffset);
CorridorGeometryLibrary.addAttribute(bitangents, bitangent, attrIndexOffset + 3);
CorridorGeometryLibrary.addAttribute(bitangents, bitangent, attrIndex);
CorridorGeometryLibrary.addAttribute(bitangents, bitangent, attrIndex + 3);
}

if (vertexFormat.tangent) {
tangent = Cartesian3.normalize(Cartesian3.cross(binormal, normal, tangent), tangent);
tangent = Cartesian3.normalize(Cartesian3.cross(bitangent, normal, tangent), tangent);
CorridorGeometryLibrary.addAttribute(tangents, tangent, attrIndexOffset);
CorridorGeometryLibrary.addAttribute(tangents, tangent, attrIndexOffset + 3);
CorridorGeometryLibrary.addAttribute(tangents, tangent, attrIndex);
Expand All @@ -495,12 +495,12 @@ define([
attributes.normal = undefined;
}

if (vertexFormat.binormal) {
binormals.set(topBinormals); //top
binormals.set(topBinormals, threeSize); //bottom
attributes.binormal.values = binormals;
if (vertexFormat.bitangent) {
bitangents.set(topBitangents); //top
bitangents.set(topBitangents, threeSize); //bottom
attributes.bitangent.values = bitangents;
} else {
attributes.binormal = undefined;
attributes.bitangent = undefined;
}

if (vertexFormat.tangent) {
Expand Down Expand Up @@ -562,9 +562,9 @@ define([
function computePositionsExtruded(params, vertexFormat) {
var topVertexFormat = new VertexFormat({
position : vertexFormat.position,
normal : (vertexFormat.normal || vertexFormat.binormal || params.shadowVolume),
normal : (vertexFormat.normal || vertexFormat.bitangent || params.shadowVolume),
tangent : vertexFormat.tangent,
binormal : (vertexFormat.normal || vertexFormat.binormal),
bitangent : (vertexFormat.normal || vertexFormat.bitangent),
st : vertexFormat.st
});
var ellipsoid = params.ellipsoid;
Expand Down
Loading

0 comments on commit e440efc

Please sign in to comment.