Browse Source

Merge pull request #19976 from ianpurvis/direct-geometry-es6-class

DirectGeometry: Convert to es6 class
Mr.doob 5 years ago
parent
commit
c36c7e2542
1 changed files with 25 additions and 25 deletions
  1. 25 25
      src/core/DirectGeometry.js

+ 25 - 25
src/core/DirectGeometry.js

@@ -1,38 +1,38 @@
 import { Vector2 } from '../math/Vector2.js';
 import { Vector2 } from '../math/Vector2.js';
 
 
-function DirectGeometry() {
+class DirectGeometry {
 
 
-	this.vertices = [];
-	this.normals = [];
-	this.colors = [];
-	this.uvs = [];
-	this.uvs2 = [];
+	constructor() {
 
 
-	this.groups = [];
+		this.vertices = [];
+		this.normals = [];
+		this.colors = [];
+		this.uvs = [];
+		this.uvs2 = [];
 
 
-	this.morphTargets = {};
+		this.groups = [];
 
 
-	this.skinWeights = [];
-	this.skinIndices = [];
+		this.morphTargets = {};
 
 
-	// this.lineDistances = [];
+		this.skinWeights = [];
+		this.skinIndices = [];
 
 
-	this.boundingBox = null;
-	this.boundingSphere = null;
+		// this.lineDistances = [];
 
 
-	// update flags
+		this.boundingBox = null;
+		this.boundingSphere = null;
 
 
-	this.verticesNeedUpdate = false;
-	this.normalsNeedUpdate = false;
-	this.colorsNeedUpdate = false;
-	this.uvsNeedUpdate = false;
-	this.groupsNeedUpdate = false;
+		// update flags
 
 
-}
+		this.verticesNeedUpdate = false;
+		this.normalsNeedUpdate = false;
+		this.colorsNeedUpdate = false;
+		this.uvsNeedUpdate = false;
+		this.groupsNeedUpdate = false;
 
 
-Object.assign( DirectGeometry.prototype, {
+	}
 
 
-	computeGroups: function ( geometry ) {
+	computeGroups( geometry ) {
 
 
 		const groups = [];
 		const groups = [];
 
 
@@ -76,9 +76,9 @@ Object.assign( DirectGeometry.prototype, {
 
 
 		this.groups = groups;
 		this.groups = groups;
 
 
-	},
+	}
 
 
-	fromGeometry: function ( geometry ) {
+	fromGeometry( geometry ) {
 
 
 		const faces = geometry.faces;
 		const faces = geometry.faces;
 		const vertices = geometry.vertices;
 		const vertices = geometry.vertices;
@@ -277,7 +277,7 @@ Object.assign( DirectGeometry.prototype, {
 
 
 	}
 	}
 
 
-} );
+}
 
 
 
 
 export { DirectGeometry };
 export { DirectGeometry };