* Performs webgl-based graph rendering. This module does not perform * layout, but only visualizes nodes and edges of the graph. * * @param options - to customize graphics behavior. Currently supported parameter * enableBlending - true by default, allows to use transparency in node/links c
(options)
| 25 | */ |
| 26 | |
| 27 | function webglGraphics(options) { |
| 28 | options = merge(options, { |
| 29 | enableBlending : true, |
| 30 | preserveDrawingBuffer : false, |
| 31 | clearColor: false, |
| 32 | clearColorValue : { |
| 33 | r : 1, |
| 34 | g : 1, |
| 35 | b : 1, |
| 36 | a : 1 |
| 37 | } |
| 38 | }); |
| 39 | |
| 40 | var container, |
| 41 | graphicsRoot, |
| 42 | gl, |
| 43 | width, |
| 44 | height, |
| 45 | nodesCount = 0, |
| 46 | linksCount = 0, |
| 47 | transform = [ |
| 48 | 1, 0, 0, 0, |
| 49 | 0, 1, 0, 0, |
| 50 | 0, 0, 1, 0, |
| 51 | 0, 0, 0, 1 |
| 52 | ], |
| 53 | userPlaceNodeCallback, |
| 54 | userPlaceLinkCallback, |
| 55 | nodes = [], |
| 56 | links = [], |
| 57 | initCallback, |
| 58 | |
| 59 | allNodes = {}, |
| 60 | allLinks = {}, |
| 61 | linkProgram = webglLinkProgram(), |
| 62 | nodeProgram = webglNodeProgram(), |
| 63 | /*jshint unused: false */ |
| 64 | nodeUIBuilder = function (node) { |
| 65 | return webglSquare(); // Just make a square, using provided gl context (a nodeProgram); |
| 66 | }, |
| 67 | |
| 68 | linkUIBuilder = function (link) { |
| 69 | return webglLine(0xb3b3b3ff); |
| 70 | }, |
| 71 | /*jshint unused: true */ |
| 72 | updateTransformUniform = function () { |
| 73 | linkProgram.updateTransform(transform); |
| 74 | nodeProgram.updateTransform(transform); |
| 75 | }, |
| 76 | |
| 77 | resetScaleInternal = function () { |
| 78 | transform = [1, 0, 0, 0, |
| 79 | 0, 1, 0, 0, |
| 80 | 0, 0, 1, 0, |
| 81 | 0, 0, 0, 1]; |
| 82 | }, |
| 83 | |
| 84 | updateSize = function () { |
nothing calls this directly
no test coverage detected