()
| 34517 | var gId = 'sphere|'+radius+'|'+detailX+'|'+detailY; |
| 34518 | if(!this._renderer.geometryInHash(gId)){ |
| 34519 | var _sphere = function(){ |
| 34520 | var u,v,p; |
| 34521 | for (var i = 0; i <= this.detailY; i++){ |
| 34522 | v = i / this.detailY; |
| 34523 | for (var j = 0; j <= this.detailX; j++){ |
| 34524 | u = j / this.detailX; |
| 34525 | var theta = 2 * Math.PI * u; |
| 34526 | var phi = Math.PI * v - Math.PI / 2; |
| 34527 | p = new p5.Vector(radius * Math.cos(phi) * Math.sin(theta), |
| 34528 | radius * Math.sin(phi), |
| 34529 | radius * Math.cos(phi) * Math.cos(theta)); |
| 34530 | this.vertices.push(p); |
| 34531 | this.uvs.push([u,v]); |
| 34532 | } |
| 34533 | } |
| 34534 | }; |
| 34535 | var sphereGeom = new p5.Geometry(detailX, detailY, _sphere); |
| 34536 | sphereGeom |
| 34537 | .computeFaces() |
nothing calls this directly
no outgoing calls
no test coverage detected