Skip to content

Commit 8fb7813

Browse files
committed
Updated builds.
1 parent 1c401f7 commit 8fb7813

2 files changed

Lines changed: 249 additions & 208 deletions

File tree

build/three.js

Lines changed: 58 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -20693,7 +20693,7 @@ THREE.WebGLRenderer = function ( parameters ) {
2069320693

2069420694
};
2069520695

20696-
this.renderBufferDirect = function ( camera, lights, fog, material, object ) {
20696+
this.renderBufferDirect = function ( camera, lights, fog, material, object, materialIndex ) {
2069720697

2069820698
if ( material instanceof THREE.MeshFaceMaterial ) {
2069920699

@@ -20705,7 +20705,7 @@ THREE.WebGLRenderer = function ( parameters ) {
2070520705

2070620706
if ( material === null || material.visible === false ) continue;
2070720707

20708-
_this.renderBufferDirect( camera, lights, fog, material, object );
20708+
_this.renderBufferDirect( camera, lights, fog, material, object, i );
2070920709

2071020710
}
2071120711

@@ -20789,15 +20789,15 @@ THREE.WebGLRenderer = function ( parameters ) {
2078920789

2079020790
if ( object instanceof THREE.Mesh ) {
2079120791

20792-
renderMesh( material, geometry, object, program, updateBuffers );
20792+
renderMesh( material, geometry, object, program, updateBuffers, materialIndex );
2079320793

2079420794
} else if ( object instanceof THREE.Line ) {
2079520795

20796-
renderLine( material, geometry, object, program, updateBuffers );
20796+
renderLine( material, geometry, object, program, updateBuffers, materialIndex );
2079720797

2079820798
} else if ( object instanceof THREE.PointCloud ) {
2079920799

20800-
renderPointCloud( material, geometry, object, program, updateBuffers );
20800+
renderPointCloud( material, geometry, object, program, updateBuffers, materialIndex );
2080120801

2080220802
}
2080320803

@@ -20934,7 +20934,7 @@ THREE.WebGLRenderer = function ( parameters ) {
2093420934

2093520935
}
2093620936

20937-
function renderMesh( material, geometry, object, program, updateBuffers ) {
20937+
function renderMesh( material, geometry, object, program, updateBuffers, materialIndex ) {
2093820938

2093920939
var mode = _gl.TRIANGLES;
2094020940

@@ -21012,6 +21012,8 @@ THREE.WebGLRenderer = function ( parameters ) {
2101221012

2101321013
var startIndex = offsets[ i ].index;
2101421014

21015+
if ( materialIndex !== undefined && offsets[ i ].materialIndex !== materialIndex ) continue;
21016+
2101521017
if ( updateBuffers ) {
2101621018

2101721019
setupVertexAttributes( material, program, geometry, startIndex );
@@ -21121,6 +21123,8 @@ THREE.WebGLRenderer = function ( parameters ) {
2112121123

2112221124
// render non-indexed triangles
2112321125

21126+
if ( materialIndex !== undefined && offsets[ i ].materialIndex !== materialIndex ) continue;
21127+
2112421128
if ( geometry instanceof THREE.InstancedBufferGeometry ) {
2112521129

2112621130
console.error( 'THREE.WebGLRenderer.renderMesh: cannot use drawCalls with THREE.InstancedBufferGeometry.' );
@@ -21144,7 +21148,7 @@ THREE.WebGLRenderer = function ( parameters ) {
2114421148

2114521149
}
2114621150

21147-
function renderLine( material, geometry, object, program, updateBuffers ) {
21151+
function renderLine( material, geometry, object, program, updateBuffers, materialIndex ) {
2114821152

2114921153
var mode = object instanceof THREE.LineSegments ? _gl.LINES : _gl.LINE_STRIP;
2115021154

@@ -21203,6 +21207,8 @@ THREE.WebGLRenderer = function ( parameters ) {
2120321207

2120421208
var startIndex = offsets[ i ].index;
2120521209

21210+
if ( materialIndex !== undefined && offsets[ i ].materialIndex === materialIndex ) continue;
21211+
2120621212
if ( updateBuffers ) {
2120721213

2120821214
setupVertexAttributes( material, program, geometry, startIndex );
@@ -21245,6 +21251,8 @@ THREE.WebGLRenderer = function ( parameters ) {
2124521251

2124621252
for ( var i = 0, il = offsets.length; i < il; i ++ ) {
2124721253

21254+
if ( materialIndex !== undefined && offsets[ i ].materialIndex !== materialIndex ) continue;
21255+
2124821256
_gl.drawArrays( mode, offsets[ i ].index, offsets[ i ].count );
2124921257

2125021258
_infoRender.calls ++;
@@ -21258,7 +21266,7 @@ THREE.WebGLRenderer = function ( parameters ) {
2125821266

2125921267
}
2126021268

21261-
function renderPointCloud( material, geometry, object, program, updateBuffers ) {
21269+
function renderPointCloud( material, geometry, object, program, updateBuffers, materialIndex ) {
2126221270

2126321271
var mode = _gl.POINTS;
2126421272

@@ -21312,6 +21320,8 @@ THREE.WebGLRenderer = function ( parameters ) {
2131221320

2131321321
var startIndex = offsets[ i ].index;
2131421322

21323+
if ( materialIndex !== undefined && offsets[ i ].materialIndex !== materialIndex ) continue;
21324+
2131521325
if ( updateBuffers ) {
2131621326

2131721327
setupVertexAttributes( material, program, geometry, startIndex );
@@ -21354,6 +21364,8 @@ THREE.WebGLRenderer = function ( parameters ) {
2135421364

2135521365
for ( var i = 0, il = offsets.length; i < il; i ++ ) {
2135621366

21367+
if ( materialIndex !== undefined && offsets[ i ].materialIndex !== materialIndex ) continue;
21368+
2135721369
_gl.drawArrays( mode, offsets[ i ].index, offsets[ i ].count );
2135821370

2135921371
_infoRender.calls ++;
@@ -28641,24 +28653,24 @@ THREE.Path.prototype.arc = function ( aX, aY, aRadius,
2864128653
};
2864228654

2864328655
THREE.Path.prototype.ellipse = function ( aX, aY, xRadius, yRadius,
28644-
aStartAngle, aEndAngle, aClockwise ) {
28656+
aStartAngle, aEndAngle, aClockwise, aRotation ) {
2864528657

2864628658
var lastargs = this.actions[ this.actions.length - 1 ].args;
2864728659
var x0 = lastargs[ lastargs.length - 2 ];
2864828660
var y0 = lastargs[ lastargs.length - 1 ];
2864928661

2865028662
this.absellipse( aX + x0, aY + y0, xRadius, yRadius,
28651-
aStartAngle, aEndAngle, aClockwise );
28663+
aStartAngle, aEndAngle, aClockwise, aRotation );
2865228664

2865328665
};
2865428666

2865528667

2865628668
THREE.Path.prototype.absellipse = function ( aX, aY, xRadius, yRadius,
28657-
aStartAngle, aEndAngle, aClockwise ) {
28669+
aStartAngle, aEndAngle, aClockwise, aRotation ) {
2865828670

2865928671
var args = Array.prototype.slice.call( arguments );
2866028672
var curve = new THREE.EllipseCurve( aX, aY, xRadius, yRadius,
28661-
aStartAngle, aEndAngle, aClockwise );
28673+
aStartAngle, aEndAngle, aClockwise, aRotation );
2866228674
this.curves.push( curve );
2866328675

2866428676
var lastPoint = curve.getPoint( 1 );
@@ -28874,13 +28886,22 @@ THREE.Path.prototype.getPoints = function( divisions, closedPath ) {
2887428886
xRadius = args[ 2 ],
2887528887
yRadius = args[ 3 ],
2887628888
aStartAngle = args[ 4 ], aEndAngle = args[ 5 ],
28877-
aClockwise = !! args[ 6 ];
28889+
aClockwise = !! args[ 6 ],
28890+
aRotation = args[ 7 ] || 0;
2887828891

2887928892

2888028893
var deltaAngle = aEndAngle - aStartAngle;
2888128894
var angle;
2888228895
var tdivisions = divisions * 2;
2888328896

28897+
var cos, sin;
28898+
if ( aRotation !== 0 ) {
28899+
28900+
cos = Math.cos( aRotation );
28901+
sin = Math.sin( aRotation );
28902+
28903+
}
28904+
2888428905
for ( j = 1; j <= tdivisions; j ++ ) {
2888528906

2888628907
t = j / tdivisions;
@@ -28896,6 +28917,14 @@ THREE.Path.prototype.getPoints = function( divisions, closedPath ) {
2889628917
tx = aX + xRadius * Math.cos( angle );
2889728918
ty = aY + yRadius * Math.sin( angle );
2889828919

28920+
if ( aRotation !== 0 ) {
28921+
28922+
// Rotate the point about the center of the ellipse.
28923+
tx = ( tx - aX ) * cos - ( ty - aY ) * sin + aX;
28924+
ty = ( tx - aX ) * sin + ( ty - aY ) * cos + aY;
28925+
28926+
}
28927+
2889928928
//console.log('t', t, 'angle', angle, 'tx', tx, 'ty', ty);
2890028929

2890128930
points.push( new THREE.Vector2( tx, ty ) );
@@ -30067,7 +30096,7 @@ THREE.SplineCurve.prototype.getPoint = function ( t ) {
3006730096
* Ellipse curve
3006830097
**************************************************************/
3006930098

30070-
THREE.EllipseCurve = function ( aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise ) {
30099+
THREE.EllipseCurve = function ( aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation ) {
3007130100

3007230101
this.aX = aX;
3007330102
this.aY = aY;
@@ -30079,6 +30108,8 @@ THREE.EllipseCurve = function ( aX, aY, xRadius, yRadius, aStartAngle, aEndAngle
3007930108
this.aEndAngle = aEndAngle;
3008030109

3008130110
this.aClockwise = aClockwise;
30111+
30112+
this.aRotation = aRotation || 0;
3008230113

3008330114
};
3008430115

@@ -30104,12 +30135,21 @@ THREE.EllipseCurve.prototype.getPoint = function ( t ) {
3010430135

3010530136
}
3010630137

30107-
var vector = new THREE.Vector2();
30138+
var x = this.aX + this.xRadius * Math.cos( angle );
30139+
var y = this.aY + this.yRadius * Math.sin( angle );
3010830140

30109-
vector.x = this.aX + this.xRadius * Math.cos( angle );
30110-
vector.y = this.aY + this.yRadius * Math.sin( angle );
30141+
if ( this.aRotation !== 0 ) {
3011130142

30112-
return vector;
30143+
var cos = Math.cos( this.aRotation );
30144+
var sin = Math.sin( this.aRotation );
30145+
30146+
// Rotate the point about the center of the ellipse.
30147+
x = ( x - this.aX ) * cos - ( y - this.aY ) * sin + this.aX;
30148+
y = ( x - this.aX ) * sin + ( y - this.aY ) * cos + this.aY;
30149+
30150+
}
30151+
30152+
return new THREE.Vector2( x, y );
3011330153

3011430154
};
3011530155

0 commit comments

Comments
 (0)