goat3d

view src/chunk.cc @ 40:a5c5cec3cb88

- added mesh attribute and face append functions - added Int4 constructor - continued the blender exporter - fixed a bug in clean_filename which made it produce unterminated strings - renamed clean_filename to goat3d_clean_filename and made it extern - added call to goat3d_clean_filename in the mesh XML export code to cleanup ctm filenames
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 13 Oct 2013 10:14:19 +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 }