MCPcopy Create free account
hub / github.com/nwutils/nw-sample-apps / initCustomAttributes

Function initCustomAttributes

webgl/js/three.min.js:15342–15388  ·  view source on GitHub ↗
( geometry, object )

Source from the content-addressed store, hash-verified

15340 // Buffer initialization
15341
15342 function initCustomAttributes ( geometry, object ) {
15343
15344 var nvertices = geometry.vertices.length;
15345
15346 var material = object.material;
15347
15348 if ( material.attributes ) {
15349
15350 if ( geometry.__webglCustomAttributesList === undefined ) {
15351
15352 geometry.__webglCustomAttributesList = [];
15353
15354 }
15355
15356 for ( var a in material.attributes ) {
15357
15358 var attribute = material.attributes[ a ];
15359
15360 if( !attribute.__webglInitialized || attribute.createUniqueBuffers ) {
15361
15362 attribute.__webglInitialized = true;
15363
15364 var size = 1; // "f" and "i"
15365
15366 if ( attribute.type === "v2" ) size = 2;
15367 else if ( attribute.type === "v3" ) size = 3;
15368 else if ( attribute.type === "v4" ) size = 4;
15369 else if ( attribute.type === "c" ) size = 3;
15370
15371 attribute.size = size;
15372
15373 attribute.array = new Float32Array( nvertices * size );
15374
15375 attribute.buffer = _gl.createBuffer();
15376 attribute.buffer.belongsToAttribute = a;
15377
15378 attribute.needsUpdate = true;
15379
15380 }
15381
15382 geometry.__webglCustomAttributesList.push( attribute );
15383
15384 }
15385
15386 }
15387
15388 };
15389
15390 function initParticleBuffers ( geometry, object ) {
15391

Callers 2

initParticleBuffersFunction · 0.85
initLineBuffersFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected