goat3d
view src/chunk.cc @ 58:d317eb4f83da
- made everything compile properly on windows again
- removed libanim/libvmath, we'll use them as external dependencies
- added new maxgoat_stub 3dsmax plugin project. Gets loaded as a max plugin and
loads the actual maxgoat (and later maxgoat_anim) exporters on demand, to
allow reloading the actual exporters without having to restart 3dsmax (which
takes AGES).
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Tue, 25 Mar 2014 03:19:55 +0200 |
parents | 6b651613bd9f |
children | dad392c710df |
line source
1 #include "goat3d.h"
2 #include "chunk.h"
4 using namespace g3dimpl;
6 ChunkHeader chunk_header(int id)
7 {
8 ChunkHeader hdr;
9 hdr.id = id;
10 hdr.size = sizeof hdr;
11 return hdr;
12 }
14 bool g3dimpl::write_chunk_header(const ChunkHeader *hdr, goat3d_io *io)
15 {
16 io->seek(-(long)hdr->size, SEEK_CUR, io->cls);
17 if(io->write(hdr, sizeof *hdr, io->cls) < (long)sizeof *hdr) {
18 return false;
19 }
20 return true;
21 }
23 bool g3dimpl::read_chunk_header(ChunkHeader *hdr, goat3d_io *io)
24 {
25 if(io->read(hdr, sizeof *hdr, io->cls) < (long)sizeof *hdr) {
26 return false;
27 }
28 return true;
29 }
31 void g3dimpl::skip_chunk(const ChunkHeader *hdr, goat3d_io *io)
32 {
33 io->seek(hdr->size - sizeof *hdr, SEEK_CUR, io->cls);
34 }