gwenael Posted April 23, 2014 Share Posted April 23, 2014 Hi, I was wondering if a test was not missing in this function. Here's its current implementation:BABYLON.VertexBuffer.prototype.update = function (data) { this._engine.updateDynamicVertexBuffer(this._buffer, data); this._data = data; if (this._kind === BABYLON.VertexBuffer.PositionKind && this._mesh) { this._mesh._resetPointsArrayCache(); } };and here's how I think it should be:BABYLON.VertexBuffer.prototype.update = function (data) { if(!this._updatable) { return; } this._engine.updateDynamicVertexBuffer(this._buffer, data); this._data = data; if (this._kind === BABYLON.VertexBuffer.PositionKind && this._mesh) { this._mesh._resetPointsArrayCache(); } };Or a new parameter 'force' could be used as is:BABYLON.VertexBuffer.prototype.update = function (data, force) { if(!this._updatable && !force) { return; } this._engine.updateDynamicVertexBuffer(this._buffer, data); this._data = data; if (this._kind === BABYLON.VertexBuffer.PositionKind && this._mesh) { this._mesh._resetPointsArrayCache(); } };In this case, should '_updatable' be set to true when force equals true? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted April 23, 2014 Share Posted April 23, 2014 You're right here is the new version:public update(data: number[]): void { if (!this._updatable) { console.log("You cannot update a non-updatable vertex buffer"); return; } this._engine.updateDynamicVertexBuffer(this._buffer, data); this._data = data; if (this._kind === BABYLON.VertexBuffer.PositionKind && this._mesh) { this._mesh._resetPointsArrayCache(); } } Quote Link to comment Share on other sites More sharing options...
gwenael Posted April 23, 2014 Author Share Posted April 23, 2014 Ok. I will check if it's what I did in my code for geometry instances. Coming soon... Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted April 23, 2014 Share Posted April 23, 2014 Please wait for the typescript version before Quote Link to comment Share on other sites More sharing options...
gwenael Posted April 23, 2014 Author Share Posted April 23, 2014 No problem. I'll send you a link to my fork/branch first so you could check the code and see if I need to rename stuff, do stuff differently and so on and then, once typescript version is ready I'll do the pull-request. Quote Link to comment Share on other sites More sharing options...
gwenael Posted April 23, 2014 Author Share Posted April 23, 2014 BTW, geometry instances would be really useful for a LOD system, did you start working on it? I could already modify my code to foresee its integration. Quote Link to comment Share on other sites More sharing options...
gwenael Posted April 23, 2014 Author Share Posted April 23, 2014 Or even start working on the LOD system. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted April 23, 2014 Share Posted April 23, 2014 Not started so feel free (a lot of typescript is already done btw) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.