annotate 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 |
rev |
line source |
nuclear@13
|
1 #include "goat3d.h"
|
nuclear@13
|
2 #include "chunk.h"
|
nuclear@13
|
3
|
nuclear@47
|
4 using namespace g3dimpl;
|
nuclear@47
|
5
|
nuclear@13
|
6 ChunkHeader chunk_header(int id)
|
nuclear@13
|
7 {
|
nuclear@13
|
8 ChunkHeader hdr;
|
nuclear@13
|
9 hdr.id = id;
|
nuclear@13
|
10 hdr.size = sizeof hdr;
|
nuclear@13
|
11 return hdr;
|
nuclear@13
|
12 }
|
nuclear@13
|
13
|
nuclear@47
|
14 bool g3dimpl::write_chunk_header(const ChunkHeader *hdr, goat3d_io *io)
|
nuclear@13
|
15 {
|
nuclear@24
|
16 io->seek(-(long)hdr->size, SEEK_CUR, io->cls);
|
nuclear@24
|
17 if(io->write(hdr, sizeof *hdr, io->cls) < (long)sizeof *hdr) {
|
nuclear@13
|
18 return false;
|
nuclear@13
|
19 }
|
nuclear@13
|
20 return true;
|
nuclear@13
|
21 }
|
nuclear@13
|
22
|
nuclear@47
|
23 bool g3dimpl::read_chunk_header(ChunkHeader *hdr, goat3d_io *io)
|
nuclear@13
|
24 {
|
nuclear@24
|
25 if(io->read(hdr, sizeof *hdr, io->cls) < (long)sizeof *hdr) {
|
nuclear@13
|
26 return false;
|
nuclear@13
|
27 }
|
nuclear@13
|
28 return true;
|
nuclear@13
|
29 }
|
nuclear@13
|
30
|
nuclear@47
|
31 void g3dimpl::skip_chunk(const ChunkHeader *hdr, goat3d_io *io)
|
nuclear@13
|
32 {
|
nuclear@13
|
33 io->seek(hdr->size - sizeof *hdr, SEEK_CUR, io->cls);
|
nuclear@13
|
34 }
|