2
0
Эх сурвалжийг харах

Implemented Object.create( *.prototype ) pattern as per discussion in #2080.

Mr.doob 13 жил өмнө
parent
commit
cdfc4f3b8a
71 өөрчлөгдсөн 100 нэмэгдсэн , 197 устгасан
  1. 1 2
      examples/js/AudioObject.js
  2. 1 2
      examples/js/MarchingCubes.js
  3. 4 9
      examples/js/ParametricGeometries.js
  4. 2 4
      examples/js/loaders/ColladaLoader.js
  5. 1 3
      examples/js/loaders/UTF8Loader.js
  6. 3 7
      examples/js/loaders/ctm/CTMLoader.js
  7. 1 2
      examples/obj/Bird.js
  8. 1 2
      examples/obj/Qrcode.js
  9. 1 2
      src/cameras/Camera.js
  10. 1 2
      src/cameras/OrthographicCamera.js
  11. 1 2
      src/cameras/PerspectiveCamera.js
  12. 1 2
      src/extras/cameras/CombinedCamera.js
  13. 1 2
      src/extras/cameras/CubeCamera.js
  14. 13 26
      src/extras/core/Curve.js
  15. 1 2
      src/extras/core/CurvePath.js
  16. 1 3
      src/extras/core/Gyroscope.js
  17. 1 3
      src/extras/core/Path.js
  18. 1 2
      src/extras/core/Shape.js
  19. 1 2
      src/extras/geometries/ConvexGeometry.js
  20. 1 2
      src/extras/geometries/CubeGeometry.js
  21. 2 2
      src/extras/geometries/CylinderGeometry.js
  22. 1 2
      src/extras/geometries/ExtrudeGeometry.js
  23. 2 2
      src/extras/geometries/IcosahedronGeometry.js
  24. 1 2
      src/extras/geometries/LatheGeometry.js
  25. 2 2
      src/extras/geometries/OctahedronGeometry.js
  26. 1 2
      src/extras/geometries/ParametricGeometry.js
  27. 1 2
      src/extras/geometries/PlaneGeometry.js
  28. 1 2
      src/extras/geometries/PolyhedronGeometry.js
  29. 1 2
      src/extras/geometries/SphereGeometry.js
  30. 2 2
      src/extras/geometries/TetrahedronGeometry.js
  31. 6 5
      src/extras/geometries/TextGeometry.js
  32. 1 2
      src/extras/geometries/TorusGeometry.js
  33. 1 2
      src/extras/geometries/TorusKnotGeometry.js
  34. 1 2
      src/extras/geometries/TubeGeometry.js
  35. 1 2
      src/extras/helpers/ArrowHelper.js
  36. 1 2
      src/extras/helpers/AxisHelper.js
  37. 1 2
      src/extras/helpers/CameraHelper.js
  38. 0 4
      src/extras/modifiers/SubdivisionModifier.js
  39. 2 5
      src/extras/objects/ImmediateRenderObject.js
  40. 1 2
      src/extras/objects/LensFlare.js
  41. 1 2
      src/extras/objects/MorphBlendMesh.js
  42. 1 2
      src/lights/AmbientLight.js
  43. 1 2
      src/lights/DirectionalLight.js
  44. 1 2
      src/lights/Light.js
  45. 1 2
      src/lights/PointLight.js
  46. 1 2
      src/lights/SpotLight.js
  47. 2 5
      src/loaders/BinaryLoader.js
  48. 1 2
      src/loaders/JSONLoader.js
  49. 1 2
      src/materials/LineBasicMaterial.js
  50. 1 2
      src/materials/MeshBasicMaterial.js
  51. 1 2
      src/materials/MeshDepthMaterial.js
  52. 1 3
      src/materials/MeshFaceMaterial.js
  53. 1 2
      src/materials/MeshLambertMaterial.js
  54. 1 2
      src/materials/MeshNormalMaterial.js
  55. 1 2
      src/materials/MeshPhongMaterial.js
  56. 1 2
      src/materials/ParticleBasicMaterial.js
  57. 1 2
      src/materials/ParticleCanvasMaterial.js
  58. 1 2
      src/materials/ShaderMaterial.js
  59. 1 3
      src/objects/Bone.js
  60. 2 2
      src/objects/LOD.js
  61. 1 2
      src/objects/Line.js
  62. 1 2
      src/objects/Mesh.js
  63. 1 2
      src/objects/MorphAnimMesh.js
  64. 1 2
      src/objects/Particle.js
  65. 1 2
      src/objects/ParticleSystem.js
  66. 1 2
      src/objects/Ribbon.js
  67. 1 2
      src/objects/SkinnedMesh.js
  68. 1 3
      src/objects/Sprite.js
  69. 1 2
      src/renderers/WebGLRenderTargetCube.js
  70. 1 2
      src/scenes/Scene.js
  71. 1 2
      src/textures/DataTexture.js

+ 1 - 2
examples/js/AudioObject.js

@@ -164,8 +164,7 @@ THREE.AudioObject = function ( url, volume, playbackRate, loop ) {
 
 };
 
-THREE.AudioObject.prototype = new THREE.Object3D();
-THREE.AudioObject.prototype.constructor = THREE.AudioObject;
+THREE.AudioObject.prototype = Object.create( THREE.Object3D.prototype );
 
 THREE.AudioObject.prototype.context = null;
 THREE.AudioObject.prototype.type = null;

+ 1 - 2
examples/js/MarchingCubes.js

@@ -750,8 +750,7 @@ THREE.MarchingCubes = function ( resolution, material, enableUvs, enableColors )
 
 };
 
-THREE.MarchingCubes.prototype = new THREE.ImmediateRenderObject();
-THREE.MarchingCubes.prototype.constructor = THREE.MarchingCubes;
+THREE.MarchingCubes.prototype = Object.create( THREE.ImmediateRenderObject.prototype );
 
 
 /////////////////////////////////////

+ 4 - 9
examples/js/ParametricGeometries.js

@@ -151,9 +151,7 @@ THREE.ParametricGeometries.TubeGeometry = function(path, segments, radius, segme
 
 };
 
-THREE.ParametricGeometries.TubeGeometry.prototype = new THREE.Geometry();
-THREE.ParametricGeometries.TubeGeometry.prototype.constructor = THREE.ParametricGeometries.TubeGeometry;
-
+THREE.ParametricGeometries.TubeGeometry.prototype = Object.create( THREE.Geometry.prototype );
 
 
  /*********************************************
@@ -203,8 +201,7 @@ THREE.ParametricGeometries.TorusKnotGeometry = function ( radius, tube, segments
 
 };
 
-THREE.ParametricGeometries.TorusKnotGeometry.prototype = new THREE.Geometry();
-THREE.ParametricGeometries.TorusKnotGeometry.prototype.constructor = THREE.ParametricGeometries.TorusKnotGeometry;
+THREE.ParametricGeometries.TorusKnotGeometry.prototype = Object.create( THREE.Geometry.prototype );
 
 
  /*********************************************
@@ -230,8 +227,7 @@ THREE.ParametricGeometries.SphereGeometry = function(size, u, v) {
 
 };
 
-THREE.ParametricGeometries.SphereGeometry.prototype = new THREE.Geometry();
-THREE.ParametricGeometries.SphereGeometry.prototype.constructor = THREE.ParametricGeometries.SphereGeometry;
+THREE.ParametricGeometries.SphereGeometry.prototype = Object.create( THREE.Geometry.prototype );
 
 
  /*********************************************
@@ -255,5 +251,4 @@ THREE.ParametricGeometries.PlaneGeometry = function(width, depth, segmentsWidth,
 
 };
 
-THREE.ParametricGeometries.PlaneGeometry.prototype = new THREE.Geometry();
-THREE.ParametricGeometries.PlaneGeometry.prototype.constructor = THREE.ParametricGeometries.PlaneGeometry;
+THREE.ParametricGeometries.PlaneGeometry.prototype = Object.create( THREE.Geometry.prototype );

+ 2 - 4
examples/js/loaders/ColladaLoader.js

@@ -2651,8 +2651,7 @@ THREE.ColladaLoader = function () {
 
 	};
 
-	Polylist.prototype = new Polygons();
-	Polylist.prototype.constructor = Polylist;
+	Polylist.prototype = Object.create( Polygons.prototype );
 
 	function Triangles () {
 
@@ -2662,8 +2661,7 @@ THREE.ColladaLoader = function () {
 
 	};
 
-	Triangles.prototype = new Polygons();
-	Triangles.prototype.constructor = Triangles;
+	Triangles.prototype = Object.create( Polygons.prototype );
 
 	function Accessor() {
 

+ 1 - 3
examples/js/loaders/UTF8Loader.js

@@ -319,9 +319,7 @@ THREE.UTF8Loader.prototype.createModel = function ( data, callback, scale, offse
 
 	};
 
-
-	Model.prototype = new THREE.Geometry();
-	Model.prototype.constructor = Model;
+	Model.prototype = Object.create( THREE.Geometry.prototype );
 
 	callback( new Model() );
 

+ 3 - 7
examples/js/loaders/ctm/CTMLoader.js

@@ -16,9 +16,7 @@ THREE.CTMLoader = function ( context, showStatus ) {
 
 };
 
-THREE.CTMLoader.prototype = new THREE.Loader();
-THREE.CTMLoader.prototype.constructor = THREE.CTMLoader;
-
+THREE.CTMLoader.prototype = Object.create( THREE.Loader.prototype );
 
 // Load multiple CTM parts defined in JSON
 
@@ -597,8 +595,7 @@ THREE.CTMLoader.prototype.createModelBuffers = function ( file, callback ) {
 
 	}
 
-	Model.prototype = new THREE.BufferGeometry();
-	Model.prototype.constructor = Model;
+	Model.prototype = Object.create( THREE.BufferGeometry.prototype );
 
 	callback( new Model() );
 
@@ -813,8 +810,7 @@ THREE.CTMLoader.prototype.createModelClassic = function ( file, callback ) {
 
 	};
 
-	Model.prototype = new THREE.Geometry();
-	Model.prototype.constructor = Model;
+	Model.prototype = Object.create( THREE.Geometry.prototype );
 
 	callback( new Model() );
 

+ 1 - 2
examples/obj/Bird.js

@@ -37,5 +37,4 @@ var Bird = function () {
 
 }
 
-Bird.prototype = new THREE.Geometry();
-Bird.prototype.constructor = Bird;
+Bird.prototype = Object.create( THREE.Geometry.prototype );

+ 1 - 2
examples/obj/Qrcode.js

@@ -1461,5 +1461,4 @@ var Qrcode = function () {
 
 }
 
-Qrcode.prototype = new THREE.Geometry();
-Qrcode.prototype.constructor = Qrcode;
+Qrcode.prototype = Object.create( THREE.Geometry.prototype );

+ 1 - 2
src/cameras/Camera.js

@@ -14,8 +14,7 @@ THREE.Camera = function () {
 
 };
 
-THREE.Camera.prototype = new THREE.Object3D();
-THREE.Camera.prototype.constructor = THREE.Camera;
+THREE.Camera.prototype = Object.create( THREE.Object3D.prototype );
 
 THREE.Camera.prototype.lookAt = function ( vector ) {
 

+ 1 - 2
src/cameras/OrthographicCamera.js

@@ -18,8 +18,7 @@ THREE.OrthographicCamera = function ( left, right, top, bottom, near, far ) {
 
 };
 
-THREE.OrthographicCamera.prototype = new THREE.Camera();
-THREE.OrthographicCamera.prototype.constructor = THREE.OrthographicCamera;
+THREE.OrthographicCamera.prototype = Object.create( THREE.Camera.prototype );
 
 THREE.OrthographicCamera.prototype.updateProjectionMatrix = function () {
 

+ 1 - 2
src/cameras/PerspectiveCamera.js

@@ -17,8 +17,7 @@ THREE.PerspectiveCamera = function ( fov, aspect, near, far ) {
 
 };
 
-THREE.PerspectiveCamera.prototype = new THREE.Camera();
-THREE.PerspectiveCamera.prototype.constructor = THREE.PerspectiveCamera;
+THREE.PerspectiveCamera.prototype = Object.create( THREE.Camera.prototype );
 
 
 /**

+ 1 - 2
src/extras/cameras/CombinedCamera.js

@@ -33,8 +33,7 @@ THREE.CombinedCamera = function ( width, height, fov, near, far, orthoNear, orth
 
 };
 
-THREE.CombinedCamera.prototype = new THREE.Camera();
-THREE.CombinedCamera.prototype.constructor = THREE.CombinedCamera;
+THREE.CombinedCamera.prototype = Object.create( THREE.Camera.prototype );
 
 THREE.CombinedCamera.prototype.toPerspective = function () {
 

+ 1 - 2
src/extras/cameras/CubeCamera.js

@@ -74,5 +74,4 @@ THREE.CubeCamera = function ( near, far, cubeResolution ) {
 
 };
 
-THREE.CubeCamera.prototype = new THREE.Object3D();
-THREE.CubeCamera.prototype.constructor = THREE.CubeCamera;
+THREE.CubeCamera.prototype = Object.create( THREE.Object3D.prototype );

+ 13 - 26
src/extras/core/Curve.js

@@ -285,8 +285,7 @@ THREE.LineCurve = function ( v1, v2 ) {
 
 };
 
-THREE.LineCurve.prototype = new THREE.Curve();
-THREE.LineCurve.prototype.constructor = THREE.LineCurve;
+THREE.LineCurve.prototype = Object.create( THREE.Curve.prototype );
 
 THREE.LineCurve.prototype.getPoint = function ( t ) {
 
@@ -326,8 +325,7 @@ THREE.QuadraticBezierCurve = function ( v0, v1, v2 ) {
 
 };
 
-THREE.QuadraticBezierCurve.prototype = new THREE.Curve();
-THREE.QuadraticBezierCurve.prototype.constructor = THREE.QuadraticBezierCurve;
+THREE.QuadraticBezierCurve.prototype = Object.create( THREE.Curve.prototype );
 
 
 THREE.QuadraticBezierCurve.prototype.getPoint = function ( t ) {
@@ -372,8 +370,7 @@ THREE.CubicBezierCurve = function ( v0, v1, v2, v3 ) {
 
 };
 
-THREE.CubicBezierCurve.prototype = new THREE.Curve();
-THREE.CubicBezierCurve.prototype.constructor = THREE.CubicBezierCurve;
+THREE.CubicBezierCurve.prototype = Object.create( THREE.Curve.prototype );
 
 THREE.CubicBezierCurve.prototype.getPoint = function ( t ) {
 
@@ -411,8 +408,7 @@ THREE.SplineCurve = function ( points /* array of Vector2 */ ) {
 
 };
 
-THREE.SplineCurve.prototype = new THREE.Curve();
-THREE.SplineCurve.prototype.constructor = THREE.SplineCurve;
+THREE.SplineCurve.prototype = Object.create( THREE.Curve.prototype );
 
 THREE.SplineCurve.prototype.getPoint = function ( t ) {
 
@@ -457,8 +453,7 @@ THREE.EllipseCurve = function ( aX, aY, xRadius, yRadius,
 
 };
 
-THREE.EllipseCurve.prototype = new THREE.Curve();
-THREE.EllipseCurve.prototype.constructor = THREE.EllipseCurve;
+THREE.EllipseCurve.prototype = Object.create( THREE.Curve.prototype );
 
 THREE.EllipseCurve.prototype.getPoint = function ( t ) {
 
@@ -483,16 +478,12 @@ THREE.EllipseCurve.prototype.getPoint = function ( t ) {
  *	Arc curve
  **************************************************************/
 
-THREE.ArcCurve = function ( aX, aY, aRadius,
-							aStartAngle, aEndAngle,
-							aClockwise ) {
+THREE.ArcCurve = function ( aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise ) {
 
-	THREE.EllipseCurve.call(this, aX, aY, aRadius, aRadius,
-		aStartAngle, aEndAngle, aClockwise);
+	THREE.EllipseCurve.call( this, aX, aY, aRadius, aRadius, aStartAngle, aEndAngle, aClockwise );
 };
 
-THREE.ArcCurve.prototype = new THREE.EllipseCurve();
-THREE.ArcCurve.prototype.constructor = THREE.ArcCurve;
+THREE.ArcCurve.prototype = Object.create( THREE.EllipseCurve.prototype );
 
 
 /**************************************************************
@@ -554,16 +545,12 @@ THREE.Curve.Utils = {
 
 // A Factory method for creating new curve subclasses
 
-THREE.Curve.create = function( constructor, getPointFunc ) {
-
-    var subClass = constructor;
+THREE.Curve.create = function ( constructor, getPointFunc ) {
 
-	subClass.prototype = new THREE.Curve();
+	constructor.prototype = Object.create( THREE.Curve.prototype );
+	constructor.prototype.getPoint = getPointFunc;
 
-	subClass.prototype.constructor = constructor;
-    subClass.prototype.getPoint = getPointFunc;
-
-	return subClass;
+	return constructor;
 
 };
 
@@ -768,4 +755,4 @@ THREE.ClosedSplineCurve3 = THREE.Curve.create(
 
     }
 
-);
+);

+ 1 - 2
src/extras/core/CurvePath.js

@@ -16,8 +16,7 @@ THREE.CurvePath = function () {
 	this.autoClose = false; // Automatically closes the path
 };
 
-THREE.CurvePath.prototype = new THREE.Curve();
-THREE.CurvePath.prototype.constructor = THREE.CurvePath;
+THREE.CurvePath.prototype = Object.create( THREE.Curve.prototype );
 
 THREE.CurvePath.prototype.add = function ( curve ) {
 

+ 1 - 3
src/extras/core/Gyroscope.js

@@ -8,9 +8,7 @@ THREE.Gyroscope = function () {
 
 };
 
-
-THREE.Gyroscope.prototype = new THREE.Object3D();
-THREE.Gyroscope.prototype.constructor = THREE.Gyroscope;
+THREE.Gyroscope.prototype = Object.create( THREE.Object3D.prototype );
 
 THREE.Gyroscope.prototype.updateMatrixWorld = function ( force ) {
 

+ 1 - 3
src/extras/core/Path.js

@@ -18,9 +18,7 @@ THREE.Path = function ( points ) {
 
 };
 
-THREE.Path.prototype = new THREE.CurvePath();
-THREE.Path.prototype.constructor = THREE.Path;
-
+THREE.Path.prototype = Object.create( THREE.CurvePath.prototype );
 
 THREE.PathActions = {
 

+ 1 - 2
src/extras/core/Shape.js

@@ -16,8 +16,7 @@ THREE.Shape = function ( ) {
 
 };
 
-THREE.Shape.prototype = new THREE.Path();
-THREE.Shape.prototype.constructor = THREE.Path;
+THREE.Shape.prototype = Object.create( THREE.Path.prototype );
 
 // Convenience method to return ExtrudeGeometry
 

+ 1 - 2
src/extras/geometries/ConvexGeometry.js

@@ -224,5 +224,4 @@ THREE.ConvexGeometry = function( vertices ) {
 
 };
 
-THREE.ConvexGeometry.prototype = new THREE.Geometry();
-THREE.ConvexGeometry.prototype.constructor = THREE.ConvexGeometry;
+THREE.ConvexGeometry.prototype = Object.create( THREE.Geometry.prototype );

+ 1 - 2
src/extras/geometries/CubeGeometry.js

@@ -144,5 +144,4 @@ THREE.CubeGeometry = function ( width, height, depth, segmentsWidth, segmentsHei
 
 };
 
-THREE.CubeGeometry.prototype = new THREE.Geometry();
-THREE.CubeGeometry.prototype.constructor = THREE.CubeGeometry;
+THREE.CubeGeometry.prototype = Object.create( THREE.Geometry.prototype );

+ 2 - 2
src/extras/geometries/CylinderGeometry.js

@@ -147,5 +147,5 @@ THREE.CylinderGeometry = function ( radiusTop, radiusBottom, height, segmentsRad
 	this.computeFaceNormals();
 
 }
-THREE.CylinderGeometry.prototype = new THREE.Geometry();
-THREE.CylinderGeometry.prototype.constructor = THREE.CylinderGeometry;
+
+THREE.CylinderGeometry.prototype = Object.create( THREE.Geometry.prototype );

+ 1 - 2
src/extras/geometries/ExtrudeGeometry.js

@@ -56,8 +56,7 @@ THREE.ExtrudeGeometry = function( shapes, options ) {
 
 };
 
-THREE.ExtrudeGeometry.prototype = new THREE.Geometry();
-THREE.ExtrudeGeometry.prototype.constructor = THREE.ExtrudeGeometry;
+THREE.ExtrudeGeometry.prototype = Object.create( THREE.Geometry.prototype );
 
 THREE.ExtrudeGeometry.prototype.addShapeList = function(shapes, options) {
 	var sl = shapes.length;

+ 2 - 2
src/extras/geometries/IcosahedronGeometry.js

@@ -22,5 +22,5 @@ THREE.IcosahedronGeometry = function ( radius, detail ) {
 	THREE.PolyhedronGeometry.call( this, vertices, faces, radius, detail );
 
 };
-THREE.IcosahedronGeometry.prototype = new THREE.Geometry();
-THREE.IcosahedronGeometry.prototype.constructor = THREE.IcosahedronGeometry;
+
+THREE.IcosahedronGeometry.prototype = Object.create( THREE.Geometry.prototype );

+ 1 - 2
src/extras/geometries/LatheGeometry.js

@@ -63,5 +63,4 @@ THREE.LatheGeometry = function ( points, steps, angle ) {
 
 };
 
-THREE.LatheGeometry.prototype = new THREE.Geometry();
-THREE.LatheGeometry.prototype.constructor = THREE.LatheGeometry;
+THREE.LatheGeometry.prototype = Object.create( THREE.Geometry.prototype );

+ 2 - 2
src/extras/geometries/OctahedronGeometry.js

@@ -14,5 +14,5 @@ THREE.OctahedronGeometry = function ( radius, detail ) {
 
 	THREE.PolyhedronGeometry.call( this, vertices, faces, radius, detail );
 };
-THREE.OctahedronGeometry.prototype = new THREE.Geometry();
-THREE.OctahedronGeometry.prototype.constructor = THREE.OctahedronGeometry;
+
+THREE.OctahedronGeometry.prototype = Object.create( THREE.Geometry.prototype );

+ 1 - 2
src/extras/geometries/ParametricGeometry.js

@@ -84,5 +84,4 @@ THREE.ParametricGeometry = function ( func, slices, stacks, useTris ) {
 
 };
 
-THREE.ParametricGeometry.prototype = new THREE.Geometry();
-THREE.ParametricGeometry.prototype.constructor = THREE.ParametricGeometry;
+THREE.ParametricGeometry.prototype = Object.create( THREE.Geometry.prototype );

+ 1 - 2
src/extras/geometries/PlaneGeometry.js

@@ -60,5 +60,4 @@ THREE.PlaneGeometry = function ( width, depth, segmentsWidth, segmentsDepth ) {
 
 };
 
-THREE.PlaneGeometry.prototype = new THREE.Geometry();
-THREE.PlaneGeometry.prototype.constructor = THREE.PlaneGeometry;
+THREE.PlaneGeometry.prototype = Object.create( THREE.Geometry.prototype );

+ 1 - 2
src/extras/geometries/PolyhedronGeometry.js

@@ -136,5 +136,4 @@ THREE.PolyhedronGeometry = function ( vertices, faces, radius, detail ) {
 
 };
 
-THREE.PolyhedronGeometry.prototype = new THREE.Geometry();
-THREE.PolyhedronGeometry.prototype.constructor = THREE.PolyhedronGeometry;
+THREE.PolyhedronGeometry.prototype = Object.create( THREE.Geometry.prototype );

+ 1 - 2
src/extras/geometries/SphereGeometry.js

@@ -93,5 +93,4 @@ THREE.SphereGeometry = function ( radius, segmentsWidth, segmentsHeight, phiStar
 
 };
 
-THREE.SphereGeometry.prototype = new THREE.Geometry();
-THREE.SphereGeometry.prototype.constructor = THREE.SphereGeometry;
+THREE.SphereGeometry.prototype = Object.create( THREE.Geometry.prototype );

+ 2 - 2
src/extras/geometries/TetrahedronGeometry.js

@@ -15,5 +15,5 @@ THREE.TetrahedronGeometry = function ( radius, detail ) {
 	THREE.PolyhedronGeometry.call( this, vertices, faces, radius, detail );
 
 };
-THREE.TetrahedronGeometry.prototype = new THREE.Geometry();
-THREE.TetrahedronGeometry.prototype.constructor = THREE.TetrahedronGeometry;
+
+THREE.TetrahedronGeometry.prototype = Object.create( THREE.Geometry.prototype );

+ 6 - 5
src/extras/geometries/TextGeometry.js

@@ -58,9 +58,11 @@ THREE.TextGeometry = function ( text, parameters ) {
 		var b = textShapes[ textShapes.length - 1 ].getBoundingBox();
 		var max = b.maxX;
 
-		parameters.bendPath = new THREE.QuadraticBezierCurve( new THREE.Vector2( 0, 0 ),
-															  new THREE.Vector2( max / 2, 120 ),
-															  new THREE.Vector2( max, 0 ) );
+		parameters.bendPath = new THREE.QuadraticBezierCurve(
+			new THREE.Vector2( 0, 0 ),
+			new THREE.Vector2( max / 2, 120 ),
+			new THREE.Vector2( max, 0 )
+		);
 
 	}
 
@@ -68,5 +70,4 @@ THREE.TextGeometry = function ( text, parameters ) {
 
 };
 
-THREE.TextGeometry.prototype = new THREE.ExtrudeGeometry();
-THREE.TextGeometry.prototype.constructor = THREE.TextGeometry;
+THREE.TextGeometry.prototype = Object.create( THREE.ExtrudeGeometry.prototype );

+ 1 - 2
src/extras/geometries/TorusGeometry.js

@@ -69,5 +69,4 @@ THREE.TorusGeometry = function ( radius, tube, segmentsR, segmentsT, arc ) {
 
 };
 
-THREE.TorusGeometry.prototype = new THREE.Geometry();
-THREE.TorusGeometry.prototype.constructor = THREE.TorusGeometry;
+THREE.TorusGeometry.prototype = Object.create( THREE.Geometry.prototype );

+ 1 - 2
src/extras/geometries/TorusKnotGeometry.js

@@ -106,5 +106,4 @@ THREE.TorusKnotGeometry = function ( radius, tube, segmentsR, segmentsT, p, q, h
 
 };
 
-THREE.TorusKnotGeometry.prototype = new THREE.Geometry();
-THREE.TorusKnotGeometry.prototype.constructor = THREE.TorusKnotGeometry;
+THREE.TorusKnotGeometry.prototype = Object.create( THREE.Geometry.prototype );

+ 1 - 2
src/extras/geometries/TubeGeometry.js

@@ -134,8 +134,7 @@ THREE.TubeGeometry = function( path, segments, radius, segmentsRadius, closed, d
 
 };
 
-THREE.TubeGeometry.prototype = new THREE.Geometry();
-THREE.TubeGeometry.prototype.constructor = THREE.TubeGeometry;
+THREE.TubeGeometry.prototype = Object.create( THREE.Geometry.prototype );
 
 
 // For computing of Frenet frames, exposing the tangents, normals and binormals the spline

+ 1 - 2
src/extras/helpers/ArrowHelper.js

@@ -38,8 +38,7 @@ THREE.ArrowHelper = function ( dir, origin, length, hex ) {
 
 };
 
-THREE.ArrowHelper.prototype = new THREE.Object3D();
-THREE.ArrowHelper.prototype.constructor = THREE.ArrowHelper;
+THREE.ArrowHelper.prototype = Object.create( THREE.Object3D.prototype );
 
 THREE.ArrowHelper.prototype.setDirection = function ( dir ) {
 

+ 1 - 2
src/extras/helpers/AxisHelper.js

@@ -48,5 +48,4 @@ THREE.AxisHelper = function () {
 
 };
 
-THREE.AxisHelper.prototype = new THREE.Object3D();
-THREE.AxisHelper.prototype.constructor = THREE.AxisHelper;
+THREE.AxisHelper.prototype = Object.create( THREE.Object3D.prototype );

+ 1 - 2
src/extras/helpers/CameraHelper.js

@@ -99,8 +99,7 @@ THREE.CameraHelper = function ( camera ) {
 
 };
 
-THREE.CameraHelper.prototype = new THREE.Object3D();
-THREE.CameraHelper.prototype.constructor = THREE.CameraHelper;
+THREE.CameraHelper.prototype = Object.create( THREE.Object3D.prototype );
 
 THREE.CameraHelper.prototype.update = function () {
 

+ 0 - 4
src/extras/modifiers/SubdivisionModifier.js

@@ -33,10 +33,6 @@ THREE.SubdivisionModifier = function( subdivisions ) {
 	
 };
 
-//THREE.SubdivisionModifier.prototype = new THREE.Modifier();
-
-THREE.SubdivisionModifier.prototype.constructor = THREE.SubdivisionModifier;
-
 // Applies the "modify" pattern
 THREE.SubdivisionModifier.prototype.modify = function ( geometry ) {
 	

+ 2 - 5
src/extras/objects/ImmediateRenderObject.js

@@ -6,11 +6,8 @@ THREE.ImmediateRenderObject = function ( ) {
 
 	THREE.Object3D.call( this );
 
-	this.render = function( renderCallback ) {
-	};
+	this.render = function ( renderCallback ) { };
 
 };
 
-THREE.ImmediateRenderObject.prototype = new THREE.Object3D();
-THREE.ImmediateRenderObject.prototype.constructor = THREE.ImmediateRenderObject;
-
+THREE.ImmediateRenderObject.prototype = Object.create( THREE.Object3D.prototype );

+ 1 - 2
src/extras/objects/LensFlare.js

@@ -20,8 +20,7 @@ THREE.LensFlare = function ( texture, size, distance, blending, color ) {
 
 };
 
-THREE.LensFlare.prototype = new THREE.Object3D();
-THREE.LensFlare.prototype.constructor = THREE.LensFlare;
+THREE.LensFlare.prototype = Object.create( THREE.Object3D.prototype );
 
 
 /*

+ 1 - 2
src/extras/objects/MorphBlendMesh.js

@@ -26,8 +26,7 @@ THREE.MorphBlendMesh = function( geometry, material ) {
 
 };
 
-THREE.MorphBlendMesh.prototype = new THREE.Mesh();
-THREE.MorphBlendMesh.prototype.constructor = THREE.MorphBlendMesh;
+THREE.MorphBlendMesh.prototype = Object.create( THREE.Mesh.prototype );
 
 THREE.MorphBlendMesh.prototype.createAnimation = function ( name, start, end, fps ) {
 

+ 1 - 2
src/lights/AmbientLight.js

@@ -8,5 +8,4 @@ THREE.AmbientLight = function ( hex ) {
 
 };
 
-THREE.AmbientLight.prototype = new THREE.Light();
-THREE.AmbientLight.prototype.constructor = THREE.AmbientLight; 
+THREE.AmbientLight.prototype = Object.create( THREE.Light.prototype );

+ 1 - 2
src/lights/DirectionalLight.js

@@ -59,5 +59,4 @@ THREE.DirectionalLight = function ( hex, intensity, distance ) {
 
 };
 
-THREE.DirectionalLight.prototype = new THREE.Light();
-THREE.DirectionalLight.prototype.constructor = THREE.DirectionalLight;
+THREE.DirectionalLight.prototype = Object.create( THREE.Light.prototype );

+ 1 - 2
src/lights/Light.js

@@ -11,5 +11,4 @@ THREE.Light = function ( hex ) {
 
 };
 
-THREE.Light.prototype = new THREE.Object3D();
-THREE.Light.prototype.constructor = THREE.Light;
+THREE.Light.prototype = Object.create( THREE.Object3D.prototype );

+ 1 - 2
src/lights/PointLight.js

@@ -12,5 +12,4 @@ THREE.PointLight = function ( hex, intensity, distance ) {
 
 };
 
-THREE.PointLight.prototype = new THREE.Light();
-THREE.PointLight.prototype.constructor = THREE.PointLight;
+THREE.PointLight.prototype = Object.create( THREE.Light.prototype );

+ 1 - 2
src/lights/SpotLight.js

@@ -40,5 +40,4 @@ THREE.SpotLight = function ( hex, intensity, distance, angle, exponent ) {
 
 };
 
-THREE.SpotLight.prototype = new THREE.Light();
-THREE.SpotLight.prototype.constructor = THREE.SpotLight;
+THREE.SpotLight.prototype = Object.create( THREE.Light.prototype );

+ 2 - 5
src/loaders/BinaryLoader.js

@@ -8,9 +8,7 @@ THREE.BinaryLoader = function ( showStatus ) {
 
 };
 
-THREE.BinaryLoader.prototype = new THREE.Loader();
-THREE.BinaryLoader.prototype.constructor = THREE.BinaryLoader;
-
+THREE.BinaryLoader.prototype = Object.create( THREE.Loader.prototype );
 
 // Load models generated by slim OBJ converter with BINARY option (converter_obj_three_slim.py -t binary)
 //  - binary models consist of two files: JS and BIN
@@ -760,8 +758,7 @@ THREE.BinaryLoader.prototype.createBinModel = function ( data, callback, texture
 
 	};
 
-	Model.prototype = new THREE.Geometry();
-	Model.prototype.constructor = Model;
+	Model.prototype = Object.create( THREE.Geometry.prototype );
 
 	callback( new Model( texturePath ) );
 

+ 1 - 2
src/loaders/JSONLoader.js

@@ -9,8 +9,7 @@ THREE.JSONLoader = function ( showStatus ) {
 
 };
 
-THREE.JSONLoader.prototype = new THREE.Loader();
-THREE.JSONLoader.prototype.constructor = THREE.JSONLoader;
+THREE.JSONLoader.prototype = Object.create( THREE.Loader.prototype );
 
 THREE.JSONLoader.prototype.load = function ( url, callback, texturePath ) {
 

+ 1 - 2
src/materials/LineBasicMaterial.js

@@ -37,5 +37,4 @@ THREE.LineBasicMaterial = function ( parameters ) {
 
 };
 
-THREE.LineBasicMaterial.prototype = new THREE.Material();
-THREE.LineBasicMaterial.prototype.constructor = THREE.LineBasicMaterial;
+THREE.LineBasicMaterial.prototype = Object.create( THREE.Material.prototype );

+ 1 - 2
src/materials/MeshBasicMaterial.js

@@ -65,5 +65,4 @@ THREE.MeshBasicMaterial = function ( parameters ) {
 
 };
 
-THREE.MeshBasicMaterial.prototype = new THREE.Material();
-THREE.MeshBasicMaterial.prototype.constructor = THREE.MeshBasicMaterial;
+THREE.MeshBasicMaterial.prototype = Object.create( THREE.Material.prototype );

+ 1 - 2
src/materials/MeshDepthMaterial.js

@@ -26,5 +26,4 @@ THREE.MeshDepthMaterial = function ( parameters ) {
 
 };
 
-THREE.MeshDepthMaterial.prototype = new THREE.Material();
-THREE.MeshDepthMaterial.prototype.constructor = THREE.MeshDepthMaterial;
+THREE.MeshDepthMaterial.prototype = Object.create( THREE.Material.prototype );

+ 1 - 3
src/materials/MeshFaceMaterial.js

@@ -2,6 +2,4 @@
  * @author mr.doob / http://mrdoob.com/
  */
 
-THREE.MeshFaceMaterial = function () {
-
-};
+THREE.MeshFaceMaterial = function () {};

+ 1 - 2
src/materials/MeshLambertMaterial.js

@@ -75,5 +75,4 @@ THREE.MeshLambertMaterial = function ( parameters ) {
 
 };
 
-THREE.MeshLambertMaterial.prototype = new THREE.Material();
-THREE.MeshLambertMaterial.prototype.constructor = THREE.MeshLambertMaterial;
+THREE.MeshLambertMaterial.prototype = Object.create( THREE.Material.prototype );

+ 1 - 2
src/materials/MeshNormalMaterial.js

@@ -26,5 +26,4 @@ THREE.MeshNormalMaterial = function ( parameters ) {
 
 };
 
-THREE.MeshNormalMaterial.prototype = new THREE.Material();
-THREE.MeshNormalMaterial.prototype.constructor = THREE.MeshNormalMaterial;
+THREE.MeshNormalMaterial.prototype = Object.create( THREE.Material.prototype );

+ 1 - 2
src/materials/MeshPhongMaterial.js

@@ -82,5 +82,4 @@ THREE.MeshPhongMaterial = function ( parameters ) {
 
 };
 
-THREE.MeshPhongMaterial.prototype = new THREE.Material();
-THREE.MeshPhongMaterial.prototype.constructor = THREE.MeshPhongMaterial;
+THREE.MeshPhongMaterial.prototype = Object.create( THREE.Material.prototype );

+ 1 - 2
src/materials/ParticleBasicMaterial.js

@@ -37,5 +37,4 @@ THREE.ParticleBasicMaterial = function ( parameters ) {
 
 };
 
-THREE.ParticleBasicMaterial.prototype = new THREE.Material();
-THREE.ParticleBasicMaterial.prototype.constructor = THREE.ParticleBasicMaterial;
+THREE.ParticleBasicMaterial.prototype = Object.create( THREE.Material.prototype );

+ 1 - 2
src/materials/ParticleCanvasMaterial.js

@@ -20,5 +20,4 @@ THREE.ParticleCanvasMaterial = function ( parameters ) {
 
 };
 
-THREE.ParticleCanvasMaterial.prototype = new THREE.Material();
-THREE.ParticleCanvasMaterial.prototype.constructor = THREE.ParticleCanvasMaterial;
+THREE.ParticleCanvasMaterial.prototype = Object.create( THREE.Material.prototype );

+ 1 - 2
src/materials/ShaderMaterial.js

@@ -55,5 +55,4 @@ THREE.ShaderMaterial = function ( parameters ) {
 
 };
 
-THREE.ShaderMaterial.prototype = new THREE.Material();
-THREE.ShaderMaterial.prototype.constructor = THREE.ShaderMaterial;
+THREE.ShaderMaterial.prototype = Object.create( THREE.Material.prototype );

+ 1 - 3
src/objects/Bone.js

@@ -12,9 +12,7 @@ THREE.Bone = function( belongsToSkin ) {
 
 };
 
-THREE.Bone.prototype = new THREE.Object3D();
-THREE.Bone.prototype.constructor = THREE.Bone;
-
+THREE.Bone.prototype = Object.create( THREE.Object3D.prototype );
 
 THREE.Bone.prototype.update = function( parentSkinMatrix, forceUpdate ) {
 

+ 2 - 2
src/objects/LOD.js

@@ -12,8 +12,8 @@ THREE.LOD = function () {
 
 };
 
-THREE.LOD.prototype = new THREE.Object3D();
-THREE.LOD.prototype.constructor = THREE.LOD;
+
+THREE.LOD.prototype = Object.create( THREE.Object3D.prototype );
 
 THREE.LOD.prototype.addLevel = function ( object3D, visibleAtDistance ) {
 

+ 1 - 2
src/objects/Line.js

@@ -25,5 +25,4 @@ THREE.Line = function ( geometry, material, type ) {
 THREE.LineStrip = 0;
 THREE.LinePieces = 1;
 
-THREE.Line.prototype = new THREE.Object3D();
-THREE.Line.prototype.constructor = THREE.Line;
+THREE.Line.prototype = Object.create( THREE.Object3D.prototype );

+ 1 - 2
src/objects/Mesh.js

@@ -46,8 +46,7 @@ THREE.Mesh = function ( geometry, material ) {
 
 }
 
-THREE.Mesh.prototype = new THREE.Object3D();
-THREE.Mesh.prototype.constructor = THREE.Mesh;
+THREE.Mesh.prototype = Object.create( THREE.Object3D.prototype );
 
 
 /*

+ 1 - 2
src/objects/MorphAnimMesh.js

@@ -24,8 +24,7 @@ THREE.MorphAnimMesh = function ( geometry, material ) {
 
 };
 
-THREE.MorphAnimMesh.prototype = new THREE.Mesh();
-THREE.MorphAnimMesh.prototype.constructor = THREE.MorphAnimMesh;
+THREE.MorphAnimMesh.prototype = Object.create( THREE.Mesh.prototype );
 
 THREE.MorphAnimMesh.prototype.setFrameRange = function ( start, end ) {
 

+ 1 - 2
src/objects/Particle.js

@@ -10,5 +10,4 @@ THREE.Particle = function ( material ) {
 
 };
 
-THREE.Particle.prototype = new THREE.Object3D();
-THREE.Particle.prototype.constructor = THREE.Particle;
+THREE.Particle.prototype = Object.create( THREE.Object3D.prototype );

+ 1 - 2
src/objects/ParticleSystem.js

@@ -29,5 +29,4 @@ THREE.ParticleSystem = function ( geometry, material ) {
 
 };
 
-THREE.ParticleSystem.prototype = new THREE.Object3D();
-THREE.ParticleSystem.prototype.constructor = THREE.ParticleSystem;
+THREE.ParticleSystem.prototype = Object.create( THREE.Object3D.prototype );

+ 1 - 2
src/objects/Ribbon.js

@@ -11,5 +11,4 @@ THREE.Ribbon = function ( geometry, material ) {
 
 };
 
-THREE.Ribbon.prototype = new THREE.Object3D();
-THREE.Ribbon.prototype.constructor = THREE.Ribbon;
+THREE.Ribbon.prototype = Object.create( THREE.Object3D.prototype );

+ 1 - 2
src/objects/SkinnedMesh.js

@@ -70,8 +70,7 @@ THREE.SkinnedMesh = function ( geometry, material ) {
 
 };
 
-THREE.SkinnedMesh.prototype = new THREE.Mesh();
-THREE.SkinnedMesh.prototype.constructor = THREE.SkinnedMesh;
+THREE.SkinnedMesh.prototype = Object.create( THREE.Mesh.prototype );
 
 THREE.SkinnedMesh.prototype.addBone = function( bone ) {
 

+ 1 - 3
src/objects/Sprite.js

@@ -30,9 +30,7 @@ THREE.Sprite = function ( parameters ) {
 
 };
 
-THREE.Sprite.prototype = new THREE.Object3D();
-THREE.Sprite.prototype.constructor = THREE.Sprite;
-
+THREE.Sprite.prototype = Object.create( THREE.Object3D.prototype );
 
 /*
  * Custom update matrix

+ 1 - 2
src/renderers/WebGLRenderTargetCube.js

@@ -10,5 +10,4 @@ THREE.WebGLRenderTargetCube = function ( width, height, options ) {
 
 };
 
-THREE.WebGLRenderTargetCube.prototype = new THREE.WebGLRenderTarget();
-THREE.WebGLRenderTargetCube.prototype.constructor = THREE.WebGLRenderTargetCube;
+THREE.WebGLRenderTargetCube.prototype = Object.create( THREE.WebGLRenderTarget.prototype );

+ 1 - 2
src/scenes/Scene.js

@@ -19,8 +19,7 @@ THREE.Scene = function () {
 
 };
 
-THREE.Scene.prototype = new THREE.Object3D();
-THREE.Scene.prototype.constructor = THREE.Scene;
+THREE.Scene.prototype = Object.create( THREE.Object3D.prototype );
 
 THREE.Scene.prototype.__addObject = function ( object ) {
 

+ 1 - 2
src/textures/DataTexture.js

@@ -10,8 +10,7 @@ THREE.DataTexture = function ( data, width, height, format, type, mapping, wrapS
 
 };
 
-THREE.DataTexture.prototype = new THREE.Texture();
-THREE.DataTexture.prototype.constructor = THREE.DataTexture;
+THREE.DataTexture.prototype = Object.create( THREE.Texture.prototype );
 
 THREE.DataTexture.prototype.clone = function () {