|
1558 | 1558 | JSROOT.TH2Painter.prototype.DrawContour3D = function(realz) { |
1559 | 1559 | // for contour plots one requires handle with full range |
1560 | 1560 | var main = this.main_painter(), |
1561 | | - handle = this.PrepareColorDraw({rounding: false, use3d: true, extra: 100, middle: 0.0 }); |
1562 | | - |
1563 | | - // get levels |
1564 | | - var histo = this.GetObject(), |
| 1561 | + handle = this.PrepareColorDraw({rounding: false, use3d: true, extra: 100, middle: 0.0 }), |
| 1562 | + histo = this.GetObject(), // get levels |
1565 | 1563 | levels = this.GetContour(), // init contour if not exists |
1566 | 1564 | palette = this.GetPalette(), |
1567 | | - painter = this, |
1568 | | - layerz = 2*main.size_z3d; |
| 1565 | + layerz = 2*main.size_z3d, pnts = []; |
1569 | 1566 |
|
1570 | 1567 | this.BuildContour(handle, levels, palette, |
1571 | 1568 | function(colindx,xp,yp,iminus,iplus,ilevel) { |
|
1577 | 1574 | if ((layerz < 0) || (layerz > 2*main.size_z3d)) return; |
1578 | 1575 | } |
1579 | 1576 |
|
1580 | | - var linepos = new Float32Array((iplus-iminus+1)*3), indx = 0; |
1581 | | - for (var i=iminus;i<=iplus;++i) { |
1582 | | - linepos[indx] = xp[i]; |
1583 | | - linepos[indx+1] = yp[i]; |
1584 | | - linepos[indx+2] = layerz; |
1585 | | - indx+=3; |
| 1577 | + for (var i=iminus;i<iplus;++i) { |
| 1578 | + pnts.push(xp[i], yp[i], layerz); |
| 1579 | + pnts.push(xp[i+1], yp[i+1], layerz); |
1586 | 1580 | } |
1587 | | - |
1588 | | - var geometry = new THREE.BufferGeometry(); |
1589 | | - geometry.addAttribute( 'position', new THREE.BufferAttribute( linepos, 3 ) ); |
1590 | | - |
1591 | | - var material = new THREE.LineBasicMaterial({ color: new THREE.Color(main.get_color(histo.fLineColor)) }); |
1592 | | - |
1593 | | - var line = new THREE.Line(geometry, material); |
1594 | | - main.toplevel.add(line); |
1595 | 1581 | } |
1596 | 1582 | ); |
| 1583 | + |
| 1584 | + var lines = JSROOT.Painter.createLineSegments(pnts, JSROOT.Painter.Create3DLineMaterial(this, histo)); |
| 1585 | + main.toplevel.add(lines); |
1597 | 1586 | } |
1598 | 1587 |
|
1599 | 1588 | JSROOT.TH2Painter.prototype.DrawSurf = function() { |
|
0 commit comments