goat3d

view src/chunk.cc @ 33:f43f4849c86a

started writing blender exporter
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 05 Oct 2013 03:07:45 +0300
parents 798df5111b56
children 498ca7ac7047
line source
1 #include "goat3d.h"
2 #include "chunk.h"
4 ChunkHeader chunk_header(int id)
5 {
6 ChunkHeader hdr;
7 hdr.id = id;
8 hdr.size = sizeof hdr;
9 return hdr;
10 }
12 bool write_chunk_header(const ChunkHeader *hdr, goat3d_io *io)
13 {
14 io->seek(-(long)hdr->size, SEEK_CUR, io->cls);
15 if(io->write(hdr, sizeof *hdr, io->cls) < (long)sizeof *hdr) {
16 return false;
17 }
18 return true;
19 }
21 bool read_chunk_header(ChunkHeader *hdr, goat3d_io *io)
22 {
23 if(io->read(hdr, sizeof *hdr, io->cls) < (long)sizeof *hdr) {
24 return false;
25 }
26 return true;
27 }
29 void skip_chunk(const ChunkHeader *hdr, goat3d_io *io)
30 {
31 io->seek(hdr->size - sizeof *hdr, SEEK_CUR, io->cls);
32 }