提交 5c8a0896 编写于 作者: S Szymon Nowak

Fixed implied globals and added few missing semicolons

上级 05dbe81d
......@@ -7,7 +7,7 @@ THREE.Color = function ( hex ) {
this.autoUpdate = true;
this.setHex( hex );
}
};
THREE.Color.prototype = {
......
......@@ -113,7 +113,7 @@ THREE.Geometry.prototype = {
computeVertexNormals: function () {
var v, vertices = [],
var v, vl, vertices = [],
f, fl, face;
for ( v = 0, vl = this.vertices.length; v < vl; v ++ ) {
......@@ -179,7 +179,7 @@ THREE.Geometry.prototype = {
var f, fl, v, vl, face, uv, vA, vB, vC, uvA, uvB, uvC,
x1, x2, y1, y2, z1, z2,
s1, s2, t1, t2, r, t, n,
s1, s2, t1, t2, r, t, test,
tan1 = [], tan2 = [],
sdir = new THREE.Vector3(), tdir = new THREE.Vector3(),
tmp = new THREE.Vector3(), tmp2 = new THREE.Vector3(),
......@@ -355,7 +355,7 @@ THREE.Geometry.prototype = {
// which could then use vertex color attributes instead of each being
// in its separate VBO
var i, l, f, fl, face, material, vertices, mhash, ghash, hash_map = {};
var i, l, f, fl, face, material, materials, vertices, mhash, ghash, hash_map = {};
function materialHash( material ) {
......
......@@ -18,4 +18,4 @@ THREE.Matrix3.prototype = {
}
}
};
......@@ -24,4 +24,4 @@ THREE.UV.prototype = {
}
}
};
......@@ -16,7 +16,7 @@ THREE.Vertex = function ( position, normal ) {
this.__visible = true;
}
};
THREE.Vertex.prototype = {
......
......@@ -28,7 +28,7 @@ var GeometryUtils = {
}
for ( var i = 0, il = faces2.length; i < il; i ++ ) {
for ( i = 0, il = faces2.length; i < il; i ++ ) {
var face = faces2[ i ], faceCopy, normal,
faceVertexNormals = face.vertexNormals;
......@@ -59,7 +59,7 @@ var GeometryUtils = {
}
for ( var i = 0, il = uvs2.length; i < il; i ++ ) {
for ( i = 0, il = uvs2.length; i < il; i ++ ) {
var uv = uvs2[ i ], uvCopy = [];
......@@ -75,4 +75,4 @@ var GeometryUtils = {
}
}
};
......@@ -20,7 +20,7 @@ var ImageUtils = {
images[ i ] = new Image();
images[ i ].loaded = 0;
images[ i ].onload = function () { images.loadCount += 1; this.loaded = true; }
images[ i ].onload = function () { images.loadCount += 1; this.loaded = true; };
images[ i ].src = array[ i ];
}
......@@ -29,4 +29,4 @@ var ImageUtils = {
}
}
};
......@@ -36,7 +36,7 @@ var SceneUtils = {
addPanoramaCube: function( scene, size, images ) {
var materials = [];
var materials = [], mesh;
materials.push( new THREE.MeshBasicMaterial( { map: new THREE.Texture( images[0] ) } ) );
materials.push( new THREE.MeshBasicMaterial( { map: new THREE.Texture( images[1] ) } ) );
materials.push( new THREE.MeshBasicMaterial( { map: new THREE.Texture( images[2] ) } ) );
......@@ -64,4 +64,4 @@ var SceneUtils = {
}
}
};
......@@ -64,7 +64,7 @@ var Cube = function ( width, height, depth, segments_width, segments_height, mat
function buildPlane( u, v, udir, vdir, width, height, depth, material ) {
var w,
var w, ix, iy,
gridX = segments_width || 1,
gridY = segments_height || 1,
gridX1 = gridX + 1,
......@@ -160,7 +160,7 @@ var Cube = function ( width, height, depth, segments_width, segments_height, mat
}
for ( var i = 0, l = scope.faces.length; i < l; i ++ ) {
for ( i = 0, il = scope.faces.length; i < il; i ++ ) {
var face = scope.faces[ i ];
......@@ -179,7 +179,7 @@ var Cube = function ( width, height, depth, segments_width, segments_height, mat
this.computeFaceNormals();
this.sortFacesByMaterial();
}
};
Cube.prototype = new THREE.Geometry();
Cube.prototype.constructor = Cube;
......@@ -76,7 +76,7 @@ var Cylinder = function ( numSegs, topRad, botRad, height, topOffset, botOffset
}
}
};
Cylinder.prototype = new THREE.Geometry();
Cylinder.prototype.constructor = Cylinder;
......@@ -56,7 +56,7 @@ var Plane = function ( width, height, segments_width, segments_height ) {
this.computeFaceNormals();
this.sortFacesByMaterial();
}
};
Plane.prototype = new THREE.Geometry();
Plane.prototype.constructor = Plane;
......@@ -110,7 +110,7 @@ var Sphere = function ( radius, segments_width, segments_height ) {
this.boundingSphere = { radius: radius };
}
};
Sphere.prototype = new THREE.Geometry();
Sphere.prototype.constructor = Sphere;
......@@ -2,7 +2,7 @@ var Uniforms = {
clone: function( uniforms_src ) {
var u, p, parameter, uniforms_dst = {};
var u, p, parameter, parameter_src, uniforms_dst = {};
for ( u in uniforms_src ) {
......@@ -32,4 +32,4 @@ var Uniforms = {
}
}
};
......@@ -6,4 +6,4 @@ THREE.CubeReflectionMapping = function () {
}
};
......@@ -6,4 +6,4 @@ THREE.CubeRefractionMapping = function () {
}
};
......@@ -6,4 +6,4 @@ THREE.LatitudeReflectionMapping = function () {
}
};
......@@ -6,4 +6,4 @@ THREE.LatitudeRefractionMapping = function () {
}
};
......@@ -6,4 +6,4 @@ THREE.SphericalReflectionMapping = function () {
}
};
......@@ -6,4 +6,4 @@ THREE.SphericalRefractionMapping = function () {
}
};
......@@ -6,4 +6,4 @@ THREE.UVMapping = function () {
}
};
......@@ -36,7 +36,7 @@ THREE.WebGLRenderer = function ( parameters ) {
// heuristics to create shader parameters according to lights in the scene
// (not to blow over maxLights budget)
maxLightCount = allocateLights( parameters.scene, 4 );
maxLightCount = allocateLights( parameters.scene, 4 ),
fog = parameters.scene ? parameters.scene.fog : null,
antialias = parameters.antialias != undefined ? parameters.antialias : true,
......@@ -172,7 +172,7 @@ THREE.WebGLRenderer = function ( parameters ) {
this.createBuffers = function ( object, g ) {
var f, fl, fi, face, vertexNormals, normal, uv, v1, v2, v3, v4, t1, t2, t3, t4, m, ml, i,
var f, fl, fi, face, vertexNormals, faceNormal, normal, uv, v1, v2, v3, v4, t1, t2, t3, t4, m, ml, i,
faceArray = [],
lineArray = [],
......@@ -1580,7 +1580,7 @@ THREE.WebGLRenderer = function ( parameters ) {
function bufferNeedsSmoothNormals( geometryChunk, object ) {
var m, ml, i, l, needsSmoothNormals = false;
var m, ml, i, l, meshMaterial, needsSmoothNormals = false;
for ( m = 0, ml = object.materials.length; m < ml; m++ ) {
......@@ -1622,7 +1622,8 @@ THREE.WebGLRenderer = function ( parameters ) {
if ( scene ) {
var l, ll, light, dirLights = pointLights = maxDirLights = maxPointLights = 0;
var l, ll, light, dirLights, pointLights, maxDirLights, maxPointLights;
dirLights = pointLights = maxDirLights = maxPointLights = 0;
for ( l = 0, ll = scene.lights.length; l < ll; l++ ) {
......
......@@ -14,6 +14,7 @@ THREE.WebGLRenderer2 = function ( antialias ) {
_canvas = document.createElement( 'canvas' ),
_gl, _currentProgram,
_modelViewMatrix = new THREE.Matrix4(),
_normalMatrix = new THREE.Matrix4(),
_viewMatrixArray = new Float32Array( 16 ),
_modelViewMatrixArray = new Float32Array( 16 ),
_projectionMatrixArray = new Float32Array( 16 ),
......@@ -100,7 +101,7 @@ THREE.WebGLRenderer2 = function ( antialias ) {
function renderObject( object ) {
var geometry, material, m, nl,
var geometry, material, m, ml,
program, uniforms, attributes;
object.autoUpdateMatrix && object.updateMatrix();
......@@ -283,10 +284,9 @@ THREE.WebGLRenderer2 = function ( antialias ) {
function buildBuffers( geometry ) {
var itemCount = 0, vertexIndex, group,
f, fl, face, v1, v2, v3, vertexNormals, normal, uv,
f, fl, face, v1, v2, v3, v4, vertexNormals, faceNormal, normal, uv,
vertexGroups = [], faceGroups = [], lineGroups = [], normalGroups = [], uvGroups = [],
vertices, faces, lines, normals, uvs,
buffers = {};
vertices, faces, lines, normals, uvs;
for ( f = 0, fl = geometry.faces.length; f < fl; f++ ) {
......@@ -544,9 +544,9 @@ THREE.WebGLRenderer2 = function ( antialias ) {
identifiers.push( 'mColor', 'mOpacity' );
material.map ? identifiers.push( 'tMap' ) : null;
material.env_map ? identifiers.push( 'tSpherical' ) : null;
material.fog ? identifiers.push( 'fog', 'fogColor', 'fogNear', 'fogFar' ) : null;
if ( material.map ) identifiers.push( 'tMap' );
if ( material.env_map ) identifiers.push( 'tSpherical' );
if ( material.fog ) identifiers.push( 'fog', 'fogColor', 'fogNear', 'fogFar' );
} else if ( material instanceof THREE.MeshNormalMaterial ) {
......@@ -622,7 +622,7 @@ THREE.WebGLRenderer2 = function ( antialias ) {
function compileProgram( vertex_shader, fragment_shader ) {
var program = _gl.createProgram(), shader
var program = _gl.createProgram(), shader, prefix_vertex, prefix_fragment;
prefix_vertex = [
maxVertexTextures() > 0 ? "#define VERTEX_TEXTURES" : "",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册