|
@@ -1014,19 +1014,19 @@ THREE.WebGLRenderer = function ( parameters ) {
|
|
|
|
|
|
renderMesh( material, geometry, object, program, updateBuffers );
|
|
|
|
|
|
- } else if ( object instanceof THREE.PointCloud ) {
|
|
|
-
|
|
|
- renderPointCloud( material, geometry, object, program, updateBuffers );
|
|
|
-
|
|
|
} else if ( object instanceof THREE.Line ) {
|
|
|
|
|
|
renderLine( material, geometry, object, program, updateBuffers );
|
|
|
|
|
|
+ } else if ( object instanceof THREE.PointCloud ) {
|
|
|
+
|
|
|
+ renderPointCloud( material, geometry, object, program, updateBuffers );
|
|
|
+
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
- function renderMesh ( material, geometry, object, program, updateBuffers ) {
|
|
|
+ function renderMesh( material, geometry, object, program, updateBuffers ) {
|
|
|
|
|
|
var mode = material.wireframe === true ? _gl.LINES : _gl.TRIANGLES;
|
|
|
|
|
@@ -1186,21 +1186,26 @@ THREE.WebGLRenderer = function ( parameters ) {
|
|
|
|
|
|
}
|
|
|
|
|
|
- };
|
|
|
+ }
|
|
|
|
|
|
- function renderPointCloud ( material, geometry, object, program, updateBuffers ) {
|
|
|
+ function renderLine( material, geometry, object, program, updateBuffers ) {
|
|
|
|
|
|
- var mode = _gl.POINTS;
|
|
|
+ var mode = ( object.mode === THREE.LineStrip ) ? _gl.LINE_STRIP : _gl.LINES;
|
|
|
+
|
|
|
+ // In case user is not using Line*Material by mistake
|
|
|
+ var lineWidth = material.linewidth !== undefined ? material.linewidth : 1;
|
|
|
+
|
|
|
+ state.setLineWidth( lineWidth * pixelRatio );
|
|
|
|
|
|
var index = geometry.attributes.index;
|
|
|
|
|
|
if ( index ) {
|
|
|
|
|
|
- // indexed points
|
|
|
+ // indexed lines
|
|
|
|
|
|
var type, size;
|
|
|
|
|
|
- if ( index.array instanceof Uint32Array && extensions.get( 'OES_element_index_uint' ) ) {
|
|
|
+ if ( index.array instanceof Uint32Array ) {
|
|
|
|
|
|
type = _gl.UNSIGNED_INT;
|
|
|
size = 4;
|
|
@@ -1223,10 +1228,10 @@ THREE.WebGLRenderer = function ( parameters ) {
|
|
|
|
|
|
}
|
|
|
|
|
|
- _gl.drawElements( mode, index.array.length, type, 0);
|
|
|
+ _gl.drawElements( mode, index.array.length, type, 0 ); // 2 bytes per Uint16Array
|
|
|
|
|
|
_this.info.render.calls ++;
|
|
|
- _this.info.render.points += index.array.length;
|
|
|
+ _this.info.render.vertices += index.array.length; // not really true, here vertices can be shared
|
|
|
|
|
|
} else {
|
|
|
|
|
@@ -1247,12 +1252,12 @@ THREE.WebGLRenderer = function ( parameters ) {
|
|
|
|
|
|
}
|
|
|
|
|
|
- // render indexed points
|
|
|
+ // render indexed lines
|
|
|
|
|
|
- _gl.drawElements( mode, offsets[ i ].count, type, offsets[ i ].start * size );
|
|
|
+ _gl.drawElements( mode, offsets[ i ].count, type, offsets[ i ].start * size ); // 2 bytes per Uint16Array
|
|
|
|
|
|
_this.info.render.calls ++;
|
|
|
- _this.info.render.points += offsets[ i ].count;
|
|
|
+ _this.info.render.vertices += offsets[ i ].count; // not really true, here vertices can be shared
|
|
|
|
|
|
}
|
|
|
|
|
@@ -1260,7 +1265,7 @@ THREE.WebGLRenderer = function ( parameters ) {
|
|
|
|
|
|
} else {
|
|
|
|
|
|
- // non-indexed points
|
|
|
+ // non-indexed lines
|
|
|
|
|
|
if ( updateBuffers ) {
|
|
|
|
|
@@ -1276,7 +1281,7 @@ THREE.WebGLRenderer = function ( parameters ) {
|
|
|
_gl.drawArrays( mode, 0, position.array.length / 3 );
|
|
|
|
|
|
_this.info.render.calls ++;
|
|
|
- _this.info.render.points += position.array.length / 3;
|
|
|
+ _this.info.render.vertices += position.array.length / 3;
|
|
|
|
|
|
} else {
|
|
|
|
|
@@ -1285,7 +1290,7 @@ THREE.WebGLRenderer = function ( parameters ) {
|
|
|
_gl.drawArrays( mode, offsets[ i ].index, offsets[ i ].count );
|
|
|
|
|
|
_this.info.render.calls ++;
|
|
|
- _this.info.render.points += offsets[ i ].count;
|
|
|
+ _this.info.render.vertices += offsets[ i ].count;
|
|
|
|
|
|
}
|
|
|
|
|
@@ -1293,25 +1298,21 @@ THREE.WebGLRenderer = function ( parameters ) {
|
|
|
|
|
|
}
|
|
|
|
|
|
- };
|
|
|
-
|
|
|
- function renderLine ( material, geometry, object, program, updateBuffers ) {
|
|
|
- var mode = ( object.mode === THREE.LineStrip ) ? _gl.LINE_STRIP : _gl.LINES;
|
|
|
+ }
|
|
|
|
|
|
- // In case user is not using Line*Material by mistake
|
|
|
- var lineWidth = material.linewidth !== undefined ? material.linewidth : 1;
|
|
|
+ function renderPointCloud( material, geometry, object, program, updateBuffers ) {
|
|
|
|
|
|
- state.setLineWidth( lineWidth * pixelRatio );
|
|
|
+ var mode = _gl.POINTS;
|
|
|
|
|
|
var index = geometry.attributes.index;
|
|
|
|
|
|
if ( index ) {
|
|
|
|
|
|
- // indexed lines
|
|
|
+ // indexed points
|
|
|
|
|
|
var type, size;
|
|
|
|
|
|
- if ( index.array instanceof Uint32Array ) {
|
|
|
+ if ( index.array instanceof Uint32Array && extensions.get( 'OES_element_index_uint' ) ) {
|
|
|
|
|
|
type = _gl.UNSIGNED_INT;
|
|
|
size = 4;
|
|
@@ -1334,10 +1335,10 @@ THREE.WebGLRenderer = function ( parameters ) {
|
|
|
|
|
|
}
|
|
|
|
|
|
- _gl.drawElements( mode, index.array.length, type, 0 ); // 2 bytes per Uint16Array
|
|
|
+ _gl.drawElements( mode, index.array.length, type, 0);
|
|
|
|
|
|
_this.info.render.calls ++;
|
|
|
- _this.info.render.vertices += index.array.length; // not really true, here vertices can be shared
|
|
|
+ _this.info.render.points += index.array.length;
|
|
|
|
|
|
} else {
|
|
|
|
|
@@ -1358,12 +1359,12 @@ THREE.WebGLRenderer = function ( parameters ) {
|
|
|
|
|
|
}
|
|
|
|
|
|
- // render indexed lines
|
|
|
+ // render indexed points
|
|
|
|
|
|
- _gl.drawElements( mode, offsets[ i ].count, type, offsets[ i ].start * size ); // 2 bytes per Uint16Array
|
|
|
+ _gl.drawElements( mode, offsets[ i ].count, type, offsets[ i ].start * size );
|
|
|
|
|
|
_this.info.render.calls ++;
|
|
|
- _this.info.render.vertices += offsets[ i ].count; // not really true, here vertices can be shared
|
|
|
+ _this.info.render.points += offsets[ i ].count;
|
|
|
|
|
|
}
|
|
|
|
|
@@ -1371,7 +1372,7 @@ THREE.WebGLRenderer = function ( parameters ) {
|
|
|
|
|
|
} else {
|
|
|
|
|
|
- // non-indexed lines
|
|
|
+ // non-indexed points
|
|
|
|
|
|
if ( updateBuffers ) {
|
|
|
|
|
@@ -1387,7 +1388,7 @@ THREE.WebGLRenderer = function ( parameters ) {
|
|
|
_gl.drawArrays( mode, 0, position.array.length / 3 );
|
|
|
|
|
|
_this.info.render.calls ++;
|
|
|
- _this.info.render.vertices += position.array.length / 3;
|
|
|
+ _this.info.render.points += position.array.length / 3;
|
|
|
|
|
|
} else {
|
|
|
|
|
@@ -1396,7 +1397,7 @@ THREE.WebGLRenderer = function ( parameters ) {
|
|
|
_gl.drawArrays( mode, offsets[ i ].index, offsets[ i ].count );
|
|
|
|
|
|
_this.info.render.calls ++;
|
|
|
- _this.info.render.vertices += offsets[ i ].count;
|
|
|
+ _this.info.render.points += offsets[ i ].count;
|
|
|
|
|
|
}
|
|
|
|
|
@@ -1404,9 +1405,9 @@ THREE.WebGLRenderer = function ( parameters ) {
|
|
|
|
|
|
}
|
|
|
|
|
|
- };
|
|
|
+ }
|
|
|
|
|
|
- function setupMorphTargets ( material, geometryGroup, object ) {
|
|
|
+ function setupMorphTargets( material, geometryGroup, object ) {
|
|
|
|
|
|
// set base
|
|
|
|