@@ -134,29 +134,29 @@ Object.assign(pc.Application.prototype, function () {
134
134
}
135
135
136
136
function _addLines ( position , color , options ) {
137
- if ( options . layer === undefined ) options . layer = this . scene . layers . getLayerById ( pc . LAYERID_IMMEDIATE ) ;
138
- if ( options . depthTest === undefined ) options . depthTest = true ;
137
+ var layer = ( options && options . layer ) ? options . layer : this . scene . layers . getLayerById ( pc . LAYERID_IMMEDIATE ) ;
138
+ var depthTest = ( options && options . depthTest !== undefined ) ? options . depthTest : true ;
139
+ var mask = ( options && options . mask ) ? options . mask : undefined ;
139
140
140
141
this . _initImmediate ( ) ;
141
142
142
- var layer = options . layer ;
143
143
this . _immediateData . addLayer ( layer ) ;
144
144
145
145
var idx = this . _immediateData . getLayerIdx ( layer ) ;
146
146
if ( idx === undefined ) {
147
147
// Init used batch once
148
148
var batch = new LineBatch ( ) ;
149
149
batch . init ( this . graphicsDevice , this . _immediateData . lineVertexFormat , layer , position . length / 2 ) ;
150
- batch . material . depthTest = options . depthTest ;
151
- if ( options . mask ) batch . meshInstance . mask = options . mask ;
150
+ batch . material . depthTest = depthTest ;
151
+ if ( mask ) batch . meshInstance . mask = mask ;
152
152
153
153
idx = this . _immediateData . lineBatches . push ( batch ) - 1 ; // push into list and get index
154
154
this . _immediateData . addLayerIdx ( idx , layer ) ;
155
155
} else {
156
156
// Possibly reallocate buffer if it's small
157
157
this . _immediateData . lineBatches [ idx ] . init ( this . graphicsDevice , this . _immediateData . lineVertexFormat , layer , position . length / 2 ) ;
158
- this . _immediateData . lineBatches [ idx ] . material . depthTest = options . depthTest ;
159
- if ( options . mask ) this . _immediateData . lineBatches [ idx ] . meshInstance . mask = options . mask ;
158
+ this . _immediateData . lineBatches [ idx ] . material . depthTest = depthTest ;
159
+ if ( mask ) this . _immediateData . lineBatches [ idx ] . meshInstance . mask = mask ;
160
160
}
161
161
// Append
162
162
this . _immediateData . lineBatches [ idx ] . addLines ( position , color ) ;
@@ -266,12 +266,6 @@ Object.assign(pc.Application.prototype, function () {
266
266
} else if ( arg3 ) {
267
267
// options passed in
268
268
options = arg3 ;
269
- } else {
270
- // no arg3, use default options
271
- options = {
272
- layer : this . scene . layers . getLayerById ( pc . LAYERID_IMMEDIATE ) ,
273
- depthTest : true
274
- } ;
275
269
}
276
270
277
271
this . _addLines ( [ start , end ] , [ color , endColor ] , options ) ;
0 commit comments