{"action":"created","issue":{"url":"https://api.github.com/repos/Aeva/m.grl/issues/189","labels_url":"https://api.github.com/repos/Aeva/m.grl/issues/189/labels{/name}","comments_url":"https://api.github.com/repos/Aeva/m.grl/issues/189/comments","events_url":"https://api.github.com/repos/Aeva/m.grl/issues/189/events","html_url":"https://github.com/Aeva/m.grl/issues/189","id":128370147,"number":189,"title":"Graph Consolidation into Static Draw Object","user":{"login":"Aeva","id":768449,"avatar_url":"https://avatars.githubusercontent.com/u/768449?v=3","gravatar_id":"","url":"https://api.github.com/users/Aeva","html_url":"https://github.com/Aeva","followers_url":"https://api.github.com/users/Aeva/followers","following_url":"https://api.github.com/users/Aeva/following{/other_user}","gists_url":"https://api.github.com/users/Aeva/gists{/gist_id}","starred_url":"https://api.github.com/users/Aeva/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Aeva/subscriptions","organizations_url":"https://api.github.com/users/Aeva/orgs","repos_url":"https://api.github.com/users/Aeva/repos","events_url":"https://api.github.com/users/Aeva/events{/privacy}","received_events_url":"https://api.github.com/users/Aeva/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Aeva/m.grl/labels/enhancement","name":"enhancement","color":"84b6eb"},{"url":"https://api.github.com/repos/Aeva/m.grl/labels/optimization","name":"optimization","color":"baff00"},{"url":"https://api.github.com/repos/Aeva/m.grl/labels/scene%20graph","name":"scene graph","color":"666666"},{"url":"https://api.github.com/repos/Aeva/m.grl/labels/WebGL","name":"WebGL","color":"ba268f"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/Aeva/m.grl/milestones/1","html_url":"https://github.com/Aeva/m.grl/milestones/Milestone%20One","labels_url":"https://api.github.com/repos/Aeva/m.grl/milestones/1/labels","id":829516,"number":1,"title":"Milestone One","description":"This milestone is complete when the jta model format's file format is stable, and there are enough core features to make this project useful for other people.\r\n\r\nThe estimated completion date is a floating target.","creator":{"login":"Aeva","id":768449,"avatar_url":"https://avatars.githubusercontent.com/u/768449?v=3","gravatar_id":"","url":"https://api.github.com/users/Aeva","html_url":"https://github.com/Aeva","followers_url":"https://api.github.com/users/Aeva/followers","following_url":"https://api.github.com/users/Aeva/following{/other_user}","gists_url":"https://api.github.com/users/Aeva/gists{/gist_id}","starred_url":"https://api.github.com/users/Aeva/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Aeva/subscriptions","organizations_url":"https://api.github.com/users/Aeva/orgs","repos_url":"https://api.github.com/users/Aeva/repos","events_url":"https://api.github.com/users/Aeva/events{/privacy}","received_events_url":"https://api.github.com/users/Aeva/received_events","type":"User","site_admin":false},"open_issues":16,"closed_issues":103,"state":"open","created_at":"2014-10-16T21:22:56Z","updated_at":"2016-01-24T03:43:59Z","due_on":null,"closed_at":null},"comments":2,"created_at":"2016-01-24T03:43:59Z","updated_at":"2016-01-24T20:51:03Z","closed_at":null,"body":"Possibly would be useful for #145, though this feature is intended to allow complex scenes to be drawn rapidly at the expense of making their geometry static.\r\n\r\n---\r\n\r\nA graph tree in instanced, things are positioned, and then the root\r\nnode of the tree is passed into the squash function, and a single\r\ngraph-compatible object is returned.\r\n\r\nThe basic idea is that the resulting object is a flattened call stack\r\nfor drawing the scene.  Only one vertex buffer object is used, and no\r\nindex element arrays.  Uniforms would be diffed so that only things\r\nthat changed would be uploaded.  The call stack might look like so:\r\n\r\nbind vbo\r\nbind texture\r\ndraw range\r\nbind texture\r\ndraw range\r\nupdate uniform\r\nbind texture\r\ndraw range\r\n\r\nMain questions:\r\n - should positions be baked in as vbos, or just uploaded?\r\n\r\n   My leaning here is it should just be baked, and allow redundancy.\r\n   Instancing could be hacked in later, my instinct says that\r\n   instancing isn't really useful unless you want the objects to move.\r\n\r\n   Also, a fat vbo is very likely to not be that big of a problem.\r\n   Basically the point here is that we're trying to cut down the call\r\n   stack as much as possible.\r\n\r\n\r\n - should the resulting command stream be generated via \"function\r\n   constructor\" or a list of closures?\r\n\r\n   I probably can just test both and see which is faster.\r\n\r\n---\r\n\r\nsteps to build\r\n---\r\nsupport:\r\n - [x] expose VBO array data on VBO objects\r\n - [x] standard placement in graph nodes for accessing VBO / IBO data\r\n - [x] helper function to take a VBO and IBO and produce a full array\r\n\r\nsquash constructor:\r\n - [x] graph-like constructor function for squash (StaticDrawNode?)\r\n - [x] call propogate on the node passed in to cache the \"long\" VBO\r\n   for each object (use ibo decode function if necessary) + a map for\r\n   textures + a map for uniforms.\r\n - [ ] throw an error if any of the objects passed in are squash\r\n   nodes\r\n - [ ] throw an error if any of the objects are parented to a scene\r\n   graph root node\r\n - [x] apply respective world matrix to each long VBO\r\n - [x] sort the objects by texture group\r\n - [ ] sort texture group by optimal uniform diff(or some approximation since this is a \"shortest path\" problem)\r\n - [x] generate sequential list of draw objects (VBO+state)\r\n - [x] concatinate VBOs to create the new VBO\r\n - [ ] generate the draw function's command stream: bind vbo, bind\r\n   state, draw range, bind state, draw range, etc\r\n - [x] return graph compatible object"},"comment":{"url":"https://api.github.com/repos/Aeva/m.grl/issues/comments/174340228","html_url":"https://github.com/Aeva/m.grl/issues/189#issuecomment-174340228","issue_url":"https://api.github.com/repos/Aeva/m.grl/issues/189","id":174340228,"user":{"login":"Aeva","id":768449,"avatar_url":"https://avatars.githubusercontent.com/u/768449?v=3","gravatar_id":"","url":"https://api.github.com/users/Aeva","html_url":"https://github.com/Aeva","followers_url":"https://api.github.com/users/Aeva/followers","following_url":"https://api.github.com/users/Aeva/following{/other_user}","gists_url":"https://api.github.com/users/Aeva/gists{/gist_id}","starred_url":"https://api.github.com/users/Aeva/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Aeva/subscriptions","organizations_url":"https://api.github.com/users/Aeva/orgs","repos_url":"https://api.github.com/users/Aeva/repos","events_url":"https://api.github.com/users/Aeva/events{/privacy}","received_events_url":"https://api.github.com/users/Aeva/received_events","type":"User","site_admin":false},"created_at":"2016-01-24T20:51:03Z","updated_at":"2016-01-24T20:51:03Z","body":"Ok, new functionality that was added to m.gl.js has been thoroughly tested.\r\n\r\nA quick run through for the StaticDrawNode constructor shows that the resulting VBO has garbage data ('position' is zero-length, for example).\r\n\r\nNext step will be to construct tests for the component functions of the StaticDrawNode.  This will likely mean creating two graph nodes, attaching the sample vbo/ibo data used from the gl tests, give the second one an arbitrary location/rotation/scale, and parent both to an empty.  The component functions should be called individually in tests (or maybe just 1 test), and then the constructor should also be called to verify that the output matches our expectations."}}