2014-12-18 16:26:57 +00:00
|
|
|
#include <cstdio>
|
|
|
|
#include <cstdlib>
|
|
|
|
#include <cstring>
|
2014-12-25 18:37:36 +00:00
|
|
|
#include <cassert>
|
2014-12-18 16:26:57 +00:00
|
|
|
|
2014-12-27 22:18:10 +00:00
|
|
|
//#include <iostream>
|
|
|
|
//#include <fstream>
|
|
|
|
//#include <list>
|
|
|
|
#include <new>
|
2014-12-18 16:26:57 +00:00
|
|
|
|
|
|
|
#include "rw.h"
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
int
|
|
|
|
main(int argc, char *argv[])
|
|
|
|
{
|
|
|
|
// Rw::Version = 0x31000;
|
|
|
|
// Rw::Build = 0;
|
|
|
|
|
2014-12-19 15:24:29 +00:00
|
|
|
registerNodeNamePlugin();
|
2014-12-24 22:52:03 +00:00
|
|
|
registerBreakableModelPlugin();
|
2014-12-20 17:13:45 +00:00
|
|
|
registerNativeDataPlugin();
|
2014-12-20 19:18:41 +00:00
|
|
|
registerMeshPlugin();
|
2014-12-18 16:26:57 +00:00
|
|
|
Rw::Clump *c;
|
|
|
|
|
2014-12-27 22:18:10 +00:00
|
|
|
// ifstream in(argv[1], ios::binary);
|
|
|
|
Rw::StreamFile in;
|
|
|
|
in.open(argv[1], "rb");
|
|
|
|
Rw::FindChunk(&in, Rw::ID_CLUMP, NULL, NULL);
|
|
|
|
c = Rw::Clump::streamRead(&in);
|
2014-12-25 18:37:36 +00:00
|
|
|
assert(c != NULL);
|
2014-12-18 16:26:57 +00:00
|
|
|
in.close();
|
|
|
|
|
2014-12-25 18:37:36 +00:00
|
|
|
Rw::Image *tga = Rw::readTGA("b.tga");
|
|
|
|
assert(tga != NULL);
|
|
|
|
Rw::writeTGA(tga, "out.tga");
|
|
|
|
|
|
|
|
// for(Rw::int32 i = 0; i < c->numAtomics; i++)
|
|
|
|
// Rw::Gl::Instance(c->atomicList[i]);
|
2014-12-25 10:14:36 +00:00
|
|
|
|
2014-12-27 22:18:10 +00:00
|
|
|
// ofstream out(argv[2], ios::binary);
|
|
|
|
Rw::StreamFile out;
|
|
|
|
out.open(argv[2], "wb");
|
|
|
|
c->streamWrite(&out);
|
2014-12-18 16:26:57 +00:00
|
|
|
out.close();
|
|
|
|
|
|
|
|
delete c;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
}
|