|
@@ -2198,20 +2198,61 @@ THREE.GLTFLoader = ( function () {
|
|
|
|
|
|
}
|
|
|
|
|
|
- } else if ( primitive.mode === WEBGL_CONSTANTS.LINES ) {
|
|
|
+ } else if ( primitive.mode === WEBGL_CONSTANTS.LINES ||
|
|
|
+ primitive.mode === WEBGL_CONSTANTS.LINE_STRIP ||
|
|
|
+ primitive.mode === WEBGL_CONSTANTS.LINE_LOOP ) {
|
|
|
|
|
|
- mesh = new THREE.LineSegments( geometry, material );
|
|
|
+ var cacheKey = 'LineBasicMaterial:' + material.uuid;
|
|
|
|
|
|
- } else if ( primitive.mode === WEBGL_CONSTANTS.LINE_STRIP ) {
|
|
|
+ var lineMaterial = scope.cache.get( cacheKey );
|
|
|
|
|
|
- mesh = new THREE.Line( geometry, material );
|
|
|
+ if ( ! lineMaterial ) {
|
|
|
|
|
|
- } else if ( primitive.mode === WEBGL_CONSTANTS.LINE_LOOP ) {
|
|
|
+ lineMaterial = new THREE.LineBasicMaterial();
|
|
|
+ THREE.Material.prototype.copy.call( lineMaterial, material );
|
|
|
+ lineMaterial.color.copy( material.color );
|
|
|
+ lineMaterial.lights = false; // LineBasicMaterial doesn't support lights yet
|
|
|
|
|
|
- mesh = new THREE.LineLoop( geometry, material );
|
|
|
+ scope.cache.add( cacheKey, lineMaterial );
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ material = lineMaterial;
|
|
|
+
|
|
|
+ if ( primitive.mode === WEBGL_CONSTANTS.LINES ) {
|
|
|
+
|
|
|
+ mesh = new THREE.LineSegments( geometry, material );
|
|
|
+
|
|
|
+ } else if ( primitive.mode === WEBGL_CONSTANTS.LINE_STRIP ) {
|
|
|
+
|
|
|
+ mesh = new THREE.Line( geometry, material );
|
|
|
+
|
|
|
+ } else {
|
|
|
+
|
|
|
+ mesh = new THREE.LineLoop( geometry, material );
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
} else if ( primitive.mode === WEBGL_CONSTANTS.POINTS ) {
|
|
|
|
|
|
+ var cacheKey = 'PointsMaterial:' + material.uuid;
|
|
|
+
|
|
|
+ var pointsMaterial = scope.cache.get( cacheKey );
|
|
|
+
|
|
|
+ if ( ! pointsMaterial ) {
|
|
|
+
|
|
|
+ pointsMaterial = new THREE.PointsMaterial();
|
|
|
+ THREE.Material.prototype.copy.call( pointsMaterial, material );
|
|
|
+ pointsMaterial.color.copy( material.color );
|
|
|
+ pointsMaterial.map = material.map;
|
|
|
+ pointsMaterial.lights = false; // PointsMaterial doesn't support lights yet
|
|
|
+
|
|
|
+ scope.cache.add( cacheKey, pointsMaterial );
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ material = pointsMaterial;
|
|
|
+
|
|
|
mesh = new THREE.Points( geometry, material );
|
|
|
|
|
|
} else {
|