Archived

This topic is now archived and is closed to further replies.

Dirge

Efficient vertex format

Recommended Posts

DirectX makes you make a vertex format for you vertex buffer. class VERTEX { vertices normals tex coords }; The problem for me is the way I read in my data (from a 3ds file right now) is in the form of an array of sequential floats (3 a piece representing a vertex). So if I wanted to read (fread) in those values into an array of VERTEX''s, it would also fill up normals and tex coords. On the other hand, I could just use a for loop to just get the vertices, BUT that would require an fread per vertex (very wasteful). Is there a way to stride the structure so I only read in the first 12 bytes (3 floats, the vertex) then skip the other 20 bytes (normals and tex coords, 6 floats)??? "Love all, trust a few. Do wrong to none." - Shakespeare Dirge - Aurelio Reis www.CodeFortress.com Current Causes: Nissan sues Nissan

Share this post


Link to post
Share on other sites
1. DirectX forum

2. Multiple Streams (where supported)

3. Strided Vertices (though can be slower)

4. What''s more important to you, load time or frame rate? If it''s frame rate, then load into a block of temporary memory, then reformat into the more usual interleaved format in another block of memory and free the first block. It really doesn''t take that much longer, particularly if you use better loading methods and stuff like compression.

--
Simon O''Connor
Creative Asylum Ltd
www.creative-asylum.com

Share this post


Link to post
Share on other sites