goat3d

view src/chunk.cc @ 29:3d669155709d

- switched the unix build to use the internal vmath/anim as well - fixed a memory corruption issue which was caused by including the system-wide installed version of the anim.h header file - started the ass2goat assimp->goat3d converter
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 29 Sep 2013 21:53:03 +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 }