nuclear@13: #include "goat3d.h" nuclear@13: #include "chunk.h" nuclear@13: nuclear@47: using namespace g3dimpl; nuclear@47: nuclear@13: ChunkHeader chunk_header(int id) nuclear@13: { nuclear@13: ChunkHeader hdr; nuclear@13: hdr.id = id; nuclear@13: hdr.size = sizeof hdr; nuclear@13: return hdr; nuclear@13: } nuclear@13: nuclear@47: bool g3dimpl::write_chunk_header(const ChunkHeader *hdr, goat3d_io *io) nuclear@13: { nuclear@24: io->seek(-(long)hdr->size, SEEK_CUR, io->cls); nuclear@24: if(io->write(hdr, sizeof *hdr, io->cls) < (long)sizeof *hdr) { nuclear@13: return false; nuclear@13: } nuclear@13: return true; nuclear@13: } nuclear@13: nuclear@47: bool g3dimpl::read_chunk_header(ChunkHeader *hdr, goat3d_io *io) nuclear@13: { nuclear@24: if(io->read(hdr, sizeof *hdr, io->cls) < (long)sizeof *hdr) { nuclear@13: return false; nuclear@13: } nuclear@13: return true; nuclear@13: } nuclear@13: nuclear@47: void g3dimpl::skip_chunk(const ChunkHeader *hdr, goat3d_io *io) nuclear@13: { nuclear@13: io->seek(hdr->size - sizeof *hdr, SEEK_CUR, io->cls); nuclear@13: }