I have a quick question. I’m using TexCoord8 to hold light source levels in my game. I have a bunch of objects that I break down into 4 chunks. I then batch the objects together using SimpleBatchNode.
Everything works great when I start, it finds all the torches (static, using this for lights). In the game when I need to place a new torch into the world. I need to update a few block (Forgot to mention, it is grid based, x and y + height, but reality is it is really flat) .
Is there an example of updating vertex buffer from time to time. So I can check it out.
What is the proper why of getting those TexCoord8 values updated. The shader does not see the changes.
I cleared my array of batched nodes.
I just loop through the torches in the world to determine position, and then got the surrounding grids and update the texcoord8 variable with the new light level for each spatial. Then called batch again, but I made sure to call zoneNode[x].onGeometryUnassociated(null);. to force the rebuild of the batch.
Now it is time to optimize this. Find which chunk needs updating and just update that one only, instead of the whole world. Also, find a way to optimize torch removal. Right now it only updates spatial based on the area to a torch, if I remove a torch, the light stays because it doesn’t update it. It only updates area close to the torch. The loop is based on the torch and then getting grid coords based on torch grid coords.
Thinks of keeping an old copy, looping through that to erase light levels and then grab the new torch array and then go through the process.