Skip to content

Commit a68d602

Browse files
author
Farhad Ghayour
committed
Clean: Update a_normals to a_normal for consistency
1 parent 657db01 commit a68d602

File tree

16 files changed

+38
-38
lines changed

16 files changed

+38
-38
lines changed

webgl-geometries/DynamicGeometry.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ DynamicGeometry.prototype.setVertexPositions = function (value) {
138138
* @return {Object} current geometry.
139139
*/
140140
DynamicGeometry.prototype.setNormals = function (value) {
141-
return this.setVertexBuffer('a_normals', value, 3);
141+
return this.setVertexBuffer('a_normal', value, 3);
142142
};
143143

144144
/**
@@ -190,7 +190,7 @@ DynamicGeometry.prototype.getVertexPositions = function () {
190190
* @return {Array} Vertex Buffer.
191191
*/
192192
DynamicGeometry.prototype.getNormals = function () {
193-
return this.getVertexBuffer('a_normals');
193+
return this.getVertexBuffer('a_normal');
194194
};
195195

196196
/**

webgl-geometries/primitives/Box.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ function BoxGeometry(options) {
8484
buffers: [
8585
{ name: 'a_pos', data: vertices },
8686
{ name: 'a_texCoord', data: textureCoords, size: 2 },
87-
{ name: 'a_normals', data: normals },
87+
{ name: 'a_normal', data: normals },
8888
{ name: 'indices', data: indices, size: 1 }
8989
]
9090
});

webgl-geometries/primitives/Circle.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ function Circle (options) {
5555
buffers: [
5656
{ name: 'a_pos', data: buffers.vertices },
5757
{ name: 'a_texCoord', data: textureCoords, size: 2 },
58-
{ name: 'a_normals', data: normals },
58+
{ name: 'a_normal', data: normals },
5959
{ name: 'indices', data: buffers.indices, size: 1 }
6060
]
6161
});

webgl-geometries/primitives/Cylinder.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ function Cylinder (options) {
6060
buffers: [
6161
{ name: 'a_pos', data: buffers.vertices },
6262
{ name: 'a_texCoord', data: GeometryHelper.getSpheroidUV(buffers.vertices), size: 2 },
63-
{ name: 'a_normals', data: GeometryHelper.computeNormals(buffers.vertices, buffers.indices) },
63+
{ name: 'a_normal', data: GeometryHelper.computeNormals(buffers.vertices, buffers.indices) },
6464
{ name: 'indices', data: buffers.indices, size: 1 }
6565
]
6666
});

webgl-geometries/primitives/GeodesicSphere.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
/**
22
* The MIT License (MIT)
3-
*
3+
*
44
* Copyright (c) 2015 Famous Industries Inc.
5-
*
5+
*
66
* Permission is hereby granted, free of charge, to any person obtaining a copy
77
* of this software and associated documentation files (the "Software"), to deal
88
* in the Software without restriction, including without limitation the rights
99
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1010
* copies of the Software, and to permit persons to whom the Software is
1111
* furnished to do so, subject to the following conditions:
12-
*
12+
*
1313
* The above copyright notice and this permission notice shall be included in
1414
* all copies or substantial portions of the Software.
15-
*
15+
*
1616
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1717
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1818
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -36,7 +36,7 @@ var GeometryHelper = require('../GeometryHelper');
3636
*
3737
* @param {Object} options Parameters that alter the
3838
* vertex buffers of the generated geometry.
39-
*
39+
*
4040
* @return {Object} constructed geometry
4141
*/
4242
function GeodesicSphere (options) {
@@ -69,7 +69,7 @@ function GeodesicSphere (options) {
6969
buffers: [
7070
{ name: 'a_pos', data: vertices },
7171
{ name: 'a_texCoord', data: textureCoords, size: 2 },
72-
{ name: 'a_normals', data: normals },
72+
{ name: 'a_normal', data: normals },
7373
{ name: 'indices', data: indices, size: 1 }
7474
]
7575
});

webgl-geometries/primitives/Icosahedron.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
/**
22
* The MIT License (MIT)
3-
*
3+
*
44
* Copyright (c) 2015 Famous Industries Inc.
5-
*
5+
*
66
* Permission is hereby granted, free of charge, to any person obtaining a copy
77
* of this software and associated documentation files (the "Software"), to deal
88
* in the Software without restriction, including without limitation the rights
99
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1010
* copies of the Software, and to permit persons to whom the Software is
1111
* furnished to do so, subject to the following conditions:
12-
*
12+
*
1313
* The above copyright notice and this permission notice shall be included in
1414
* all copies or substantial portions of the Software.
15-
*
15+
*
1616
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1717
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1818
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -36,7 +36,7 @@ var GeometryHelper = require('../GeometryHelper');
3636
*
3737
* @param {Object} options Parameters that alter the
3838
* vertex buffers of the generated geometry.
39-
*
39+
*
4040
* @return {Object} constructed geometry
4141
*/
4242
function Icosahedron() {
@@ -65,7 +65,7 @@ function Icosahedron() {
6565
buffers: [
6666
{ name: 'a_pos', data: vertices },
6767
{ name: 'a_texCoord', data: textureCoords, size: 2 },
68-
{ name: 'a_normals', data: normals },
68+
{ name: 'a_normal', data: normals },
6969
{ name: 'indices', data: indices, size: 1 }
7070
]
7171
});

webgl-geometries/primitives/ParametricCone.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ function ParametricCone (options) {
5858
buffers: [
5959
{ name: 'a_pos', data: buffers.vertices },
6060
{ name: 'a_texCoord', data: GeometryHelper.getSpheroidUV(buffers.vertices), size: 2 },
61-
{ name: 'a_normals', data: GeometryHelper.computeNormals(buffers.vertices, buffers.indices) },
61+
{ name: 'a_normal', data: GeometryHelper.computeNormals(buffers.vertices, buffers.indices) },
6262
{ name: 'indices', data: buffers.indices, size: 1 }
6363
]
6464
});

webgl-geometries/primitives/Plane.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ function Plane(options) {
8080
buffers: [
8181
{ name: 'a_pos', data: vertices },
8282
{ name: 'a_texCoord', data: textureCoords, size: 2 },
83-
{ name: 'a_normals', data: normals },
83+
{ name: 'a_normal', data: normals },
8484
{ name: 'indices', data: indices, size: 1 }
8585
]
8686
});

webgl-geometries/primitives/Sphere.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ function ParametricSphere (options) {
5656
buffers: [
5757
{ name: 'a_pos', data: buffers.vertices },
5858
{ name: 'a_texCoord', data: GeometryHelper.getSpheroidUV(buffers.vertices), size: 2 },
59-
{ name: 'a_normals', data: GeometryHelper.getSpheroidNormals(buffers.vertices) },
59+
{ name: 'a_normal', data: GeometryHelper.getSpheroidNormals(buffers.vertices) },
6060
{ name: 'indices', data: buffers.indices, size: 1 }
6161
]
6262
});

webgl-geometries/primitives/Tetrahedron.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ function Tetrahedron(options) {
9292
buffers: [
9393
{ name: 'a_pos', data: vertices },
9494
{ name: 'a_texCoord', data: textureCoords, size: 2 },
95-
{ name: 'a_normals', data: normals },
95+
{ name: 'a_normal', data: normals },
9696
{ name: 'indices', data: indices, size: 1 }
9797
]
9898
});

webgl-geometries/primitives/Torus.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ function Torus(options) {
5656
buffers: [
5757
{ name: 'a_pos', data: buffers.vertices },
5858
{ name: 'a_texCoord', data: GeometryHelper.getSpheroidUV(buffers.vertices), size: 2 },
59-
{ name: 'a_normals', data: GeometryHelper.computeNormals(buffers.vertices, buffers.indices) },
59+
{ name: 'a_normal', data: GeometryHelper.computeNormals(buffers.vertices, buffers.indices) },
6060
{ name: 'indices', data: buffers.indices, size: 1 }
6161
]
6262
});

webgl-geometries/primitives/Triangle.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ function Triangle (options) {
6969
buffers: [
7070
{ name: 'a_pos', data: vertices },
7171
{ name: 'a_texCoord', data: textureCoords, size: 2 },
72-
{ name: 'a_normals', data: normals },
72+
{ name: 'a_normal', data: normals },
7373
{ name: 'indices', data: indices, size: 1 }
7474
]
7575
});

webgl-geometries/test/DynamicGeometry.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,13 +151,13 @@ test('DynamicGeometry', function(t) {
151151
geometry.setNormals(vertexNormals);
152152

153153
t.deepEquals(
154-
geometry.spec.bufferValues[geometry.spec.bufferNames.indexOf('a_normals')],
154+
geometry.spec.bufferValues[geometry.spec.bufferNames.indexOf('a_normal')],
155155
vertexNormals,
156156
'Should set vertex data to the "normal" attribute of the geometry'
157157
);
158158

159159
t.equals(
160-
geometry.spec.bufferSpacings[geometry.spec.bufferNames.indexOf('a_normals')],
160+
geometry.spec.bufferSpacings[geometry.spec.bufferNames.indexOf('a_normal')],
161161
3,
162162
'Should set buffer spacing to 3 for normal attribute'
163163
);

webgl-geometries/test/Primitives.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ test('Primitives', function(t) {
4848
t.ok(primitive instanceof Geometry, 'should be an instance of a static geometry');
4949

5050
t.notEquals(primitive.spec.bufferNames.indexOf('a_texCoord'), -1, 'should contain a texCoord buffer');
51-
t.notEquals(primitive.spec.bufferNames.indexOf('a_normals'), -1, 'should contain a normal buffer');
51+
t.notEquals(primitive.spec.bufferNames.indexOf('a_normal'), -1, 'should contain a normal buffer');
5252
t.notEquals(primitive.spec.bufferNames.indexOf('a_pos'), -1, 'should contain a pos buffer');
5353

5454
if (name !== 'Circle') {

webgl-renderers/Program.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ var uniforms = keyValueToArrays({
8989
var attributes = keyValueToArrays({
9090
a_pos: [0, 0, 0],
9191
a_texCoord: [0, 0],
92-
a_normals: [0, 0, 0]
92+
a_normal: [0, 0, 0]
9393
});
9494

9595
/**

webgl-shaders/VertexShader.glsl

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
/**
22
* The MIT License (MIT)
3-
*
3+
*
44
* Copyright (c) 2015 Famous Industries Inc.
5-
*
5+
*
66
* Permission is hereby granted, free of charge, to any person obtaining a copy
77
* of this software and associated documentation files (the "Software"), to deal
88
* in the Software without restriction, including without limitation the rights
99
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1010
* copies of the Software, and to permit persons to whom the Software is
1111
* furnished to do so, subject to the following conditions:
12-
*
12+
*
1313
* The above copyright notice and this permission notice shall be included in
1414
* all copies or substantial portions of the Software.
15-
*
15+
*
1616
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1717
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1818
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -37,7 +37,7 @@
3737
*/
3838

3939
vec4 applyTransform(vec4 pos) {
40-
//TODO: move this multiplication to application code.
40+
//TODO: move this multiplication to application code.
4141

4242
/**
4343
* Currently multiplied in the vertex shader to avoid consuming the complexity of holding an additional
@@ -59,7 +59,7 @@ vec4 applyTransform(vec4 pos) {
5959
*
6060
* where convertToDOMSpace represents the transform matrix:
6161
*
62-
* size.x 0 0 size.x
62+
* size.x 0 0 size.x
6363
* 0 -size.y 0 size.y
6464
* 0 0 1 0
6565
* 0 0 0 1
@@ -71,7 +71,7 @@ vec4 applyTransform(vec4 pos) {
7171
* Later in the transformation chain, the projection transform negates the rigidbody translation.
7272
* Equivalent to (but much faster than) multiplying a translation matrix "origin"
7373
*
74-
* 1 0 0 1
74+
* 1 0 0 1
7575
* 0 1 0 -1
7676
* 0 0 1 0
7777
* 0 0 0 1
@@ -87,7 +87,7 @@ vec4 applyTransform(vec4 pos) {
8787
* by the inverse of the canvas' resolution.
8888
* Equivalent to (but much faster than) multiplying a scale matrix "sizeScale"
8989
*
90-
* size.x 0 0 0
90+
* size.x 0 0 0
9191
* 0 size.y 0 0
9292
* 0 0 size.z 0
9393
* 0 0 0 1
@@ -97,11 +97,11 @@ vec4 applyTransform(vec4 pos) {
9797
pos.xyz *= u_size * 0.5;
9898

9999
/**
100-
* Inverts the object space's y axis in order to match DOM space conventions.
100+
* Inverts the object space's y axis in order to match DOM space conventions.
101101
* Later in the transformation chain, the projection transform reinverts the y axis to convert to clip space.
102102
* Equivalent to (but much faster than) multiplying a scale matrix "invertYAxis"
103103
*
104-
* 1 0 0 0
104+
* 1 0 0 0
105105
* 0 -1 0 0
106106
* 0 0 1 0
107107
* 0 0 0 1
@@ -166,7 +166,7 @@ vec3 calculateOffset(vec3 ID) {
166166
*/
167167
void main() {
168168
v_textureCoordinate = a_texCoord;
169-
vec3 invertedNormals = a_normals + (u_normals.x < 0.0 ? calculateOffset(u_normals) * 2.0 - 1.0 : vec3(0.0));
169+
vec3 invertedNormals = a_normal + (u_normals.x < 0.0 ? calculateOffset(u_normals) * 2.0 - 1.0 : vec3(0.0));
170170
invertedNormals.y *= -1.0;
171171
v_normal = transpose(mat3(inverse(u_transform))) * invertedNormals;
172172
vec3 offsetPos = a_pos + calculateOffset(u_positionOffset);

0 commit comments

Comments
 (0)