PageRenderTime 20ms CodeModel.GetById 12ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 1ms

/src/renderer/mesh.h

https://bitbucket.org/vivkin/gam3b00bs/
C++ Header | 61 lines | 29 code | 10 blank | 22 comment | 0 complexity | bafc4bee2b75c8837b01e59fea81ea7b MD5 | raw file
 1/*
 2    ƒва файла, *.mesh и с тем же именем *.blob
 3    
 4    mesh:
 5    
 6        mesh_header_t           20 байт
 7        subset_data             sizeof( subset_t ) * subset_count;
 8    
 9    blob:
10    
11        vertex_data             vertex_size * vertex_count байт
12        index_data              index_size * index_count байт
13*/
14//-----------------------------------------------------------------------------
15
16#pragma once
17
18#include "types.h"
19#include "renderer/device.h"
20//-----------------------------------------------------------------------------
21
22#define MAX_SUBSETS 16
23//-----------------------------------------------------------------------------
24
25//fwd decl
26
27struct buffer_t;
28//-----------------------------------------------------------------------------
29
30struct mesh_header_t
31{
32    uint32  vertex_size;
33    uint32  vertex_count;
34	uint32	vertex_type;
35    uint32  index_size;     // либо 16, либо 32, иначе assert
36    uint32  index_count;
37    uint32  subset_count;
38};
39//-----------------------------------------------------------------------------
40
41struct subset_t
42{
43    uint32  index_offset;
44    uint32  vertex_offset;
45    uint32  index_count;
46};
47//-----------------------------------------------------------------------------
48
49struct mesh_t
50{
51    mesh_header_t   header;
52    subset_t        subsets[MAX_SUBSETS];
53    vbuffer_h       vb;
54    ibuffer_h       ib;
55};
56
57typedef mesh_t* mesh_h;
58//-----------------------------------------------------------------------------
59
60mesh_h mesh_load( const char* dir, const char* name );
61//-----------------------------------------------------------------------------