Sign in to follow this  
  • entries
    235
  • comments
    509
  • views
    171829

Camera, IDs & Objs

Sign in to follow this  
SimmerD

76 views

Fixed some issues with the cameras, and got them loading in game, so designers can now place them in the levels, although they aren't used by the game engine right yet.



I also fixed a lingering bug with the level editor that was causing some issues on large levels with > 250k triangles.

Basically, to speed up sorting triangles, I am embedding the material id into the upper bits of the 32-bit triangle id, making only 20 bits available for the id itself. Since I was using a simple sequential id allocation scheme, I was running into wrap around issues on very large levels, b/c ids were never re-used on purpose.

I needed a way to fix this that wouldn't require rebuilding any levels, and would allow at least 1 million triangles in a level at once.

What I ended up doing was keeping the same id scheme, but re-using ids. Rather than keeping a list of all available ids, I just have a bit stored for each id, to say if its used or not. I track the last known partly open 32-bit word, and when I need a new id, I scan through it for an available bit. If I can't find one, I scan through all dword flags sequentially, skipping all that == 0xffffffff. Once I either wrap around to the start ( > 1 M triangles ), or find an open bit, I use that ID for the new tri, and save this one as the last known open dword.

Deleting a tri causes its id bit to be cleared. The bit flags take up 128k and ensure that no more triangles can share ids at once.

Just now I added .OBJ importing to the level editor. Up to now there was no way to load a mesh with multiple materials in it, other than importing an existing level section, so I added obj support to handle this case.

Here is a shot of a bridge .obj with 2 materials attached.


Sign in to follow this  


1 Comment


Recommended Comments

Good to see you making progress, I really love reading your journal. It's like a mini soap opera to me - from an addiction point of view, not a cheesy/tacky point of view :D

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now