Render_Entity alone wouldn't give any advantages, unless mark also added control when texture locking.
How I did it was, simply create a batch type, each batch element = pointer to surface and a pointer to the entity it's being referenced from.
Now, you just sort by surface, and still retain per-entity attribs. Basically,
for each batchObj
if bat\surf<>lastSurf Locksurface:lastSurf=bat\surf
lockEntity bat\ent
renderSurface bat\surf
next
And you sort before hand.
a cooler way, which I'll probably implement in vivid having just thought of it, is for each surface, generate a 8/12 byte buffer, each 4bytes = texture handle int, and generate a CRC from that.
Now for each surface, you have a single unique int for it's texture set up.
But since it's a crc, you can do cool things, like sort by any data value you'd like.
Say you wanted to share surface locks that share texture binds AND a entity name.
Insert the entity name into the buffer, then the texture look ups, then generate the crc for each one.
Right, i'm off to implement that in vivid..hands off mark ;)
How I did it was, simply create a batch type, each batch element = pointer to surface and a pointer to the entity it's being referenced from.
Now, you just sort by surface, and still retain per-entity attribs. Basically,
for each batchObj
if bat\surf<>lastSurf Locksurface:lastSurf=bat\surf
lockEntity bat\ent
renderSurface bat\surf
next
And you sort before hand.
a cooler way, which I'll probably implement in vivid having just thought of it, is for each surface, generate a 8/12 byte buffer, each 4bytes = texture handle int, and generate a CRC from that.
Now for each surface, you have a single unique int for it's texture set up.
But since it's a crc, you can do cool things, like sort by any data value you'd like.
Say you wanted to share surface locks that share texture binds AND a entity name.
Insert the entity name into the buffer, then the texture look ups, then generate the crc for each one.
Right, i'm off to implement that in vivid..hands off mark ;)