implemented R* pipeline plugin, 2dfx and collision as placehoders, uvanim (no interpolation yet)

This commit is contained in:
aap 2015-09-09 23:26:16 +02:00
parent fed5ea7c9a
commit c7fa3b3b8c
13 changed files with 417 additions and 123 deletions

17
TODO
View File

@ -3,7 +3,7 @@ BUGS:
Clump & related: Clump & related:
- make pointer arrays into lists - make pointer arrays into lists
- work on ref counts, destruction, copying etc. - !!! work on ref counts, destruction, copying etc.
- define and use types: - define and use types:
sphere sphere
matrix matrix
@ -14,33 +14,30 @@ Clump & related:
texcoord texcoord
- implement plugins: - implement plugins:
Clump Clump
R* Collision 0x253F2FA
Animation (old III dffs) Animation (old III dffs)
Frame Frame
Animation (old III dffs) Animation (old III dffs)
Atomic Atomic
((Particles)) 0x118 ((Particles)) 0x118
R* Pipeline 0x253F2F3
Skin (old III dffs) Skin (old III dffs)
Geometry Geometry
((Morph)) 0x105 ((Morph)) 0x105
R* 2dfx 0x253F2F8
Material
UV Anim 0x135
Texture Texture
(Sky Mipmap Val) 0x110 (Sky Mipmap Val) 0x110
UV Anim Dict - only stubs:
R* 2dfx 0x253F2F8
R* Collision 0x253F2FA
Texture Dictionary Texture Dictionary
.anm/.ska .anm/.ska
- properly implement Skin plugin - anim interpolation (only stubs right now)
- PDS Pipelines - Pipelines (PDS, Xbox, PC)
- ADC - ADC
- uninstance geometry (PS2, Xbox; OpenGL done) - uninstance geometry (PS2)

View File

@ -98,6 +98,7 @@
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="src\anim.cpp" />
<ClCompile Include="src\clump.cpp" /> <ClCompile Include="src\clump.cpp" />
<ClCompile Include="src\d3d.cpp" /> <ClCompile Include="src\d3d.cpp" />
<ClCompile Include="src\d3d8.cpp" /> <ClCompile Include="src\d3d8.cpp" />

View File

@ -9,12 +9,40 @@
#include "rwplugin.h" #include "rwplugin.h"
#include "rwpipeline.h" #include "rwpipeline.h"
#include "rwobjects.h" #include "rwobjects.h"
#include "rwps2.h"
#include "rwxbox.h"
#include "gtaplg.h" #include "gtaplg.h"
using namespace std; using namespace std;
namespace gta { namespace gta {
void
attachPlugins(void)
{
rw::ps2::registerPDSPlugin();
rw::registerMeshPlugin();
rw::registerNativeDataPlugin();
rw::registerAtomicRightsPlugin();
rw::registerMaterialRightsPlugin();
rw::xbox::registerVertexFormatPlugin();
rw::registerSkinPlugin();
rw::registerHAnimPlugin();
gta::registerNodeNamePlugin();
rw::registerMatFXPlugin();
rw::registerUVAnimPlugin();
rw::ps2::registerADCPlugin();
gta::registerExtraNormalsPlugin();
gta::registerExtraVertColorPlugin();
gta::registerEnvSpecPlugin();
gta::registerBreakableModelPlugin();
gta::registerCollisionPlugin();
gta::register2dEffectPlugin();
gta::registerPipelinePlugin();
rw::Atomic::init();
}
// //
// Frame // Frame
// //
@ -66,7 +94,7 @@ getSizeNodeName(void *object, int32 offset, int32)
{ {
char *name = PLUGINOFFSET(char, object, offset); char *name = PLUGINOFFSET(char, object, offset);
int32 len = strlen(name); int32 len = strlen(name);
return len > 0 ? len : -1; return len > 0 ? len : 0;
} }
@ -243,7 +271,7 @@ getSizeExtraNormals(void *object, int32 offset, int32)
Geometry *geo = (Geometry*)object; Geometry *geo = (Geometry*)object;
if(*PLUGINOFFSET(float*, object, offset)) if(*PLUGINOFFSET(float*, object, offset))
return geo->numVertices*3*4; return geo->numVertices*3*4;
return -1; return 0;
} }
void void
@ -300,7 +328,6 @@ readExtraVertColors(Stream *stream, int32, void *object, int32 offset, int32)
colordata->dayColors = new uint8[geometry->numVertices*4]; colordata->dayColors = new uint8[geometry->numVertices*4];
colordata->balance = 1.0f; colordata->balance = 1.0f;
stream->read(colordata->nightColors, geometry->numVertices*4); stream->read(colordata->nightColors, geometry->numVertices*4);
printf("extra colors\n");
if(geometry->colors) if(geometry->colors)
memcpy(colordata->dayColors, geometry->colors, memcpy(colordata->dayColors, geometry->colors,
geometry->numVertices*4); geometry->numVertices*4);
@ -326,7 +353,7 @@ getSizeExtraVertColors(void *object, int32 offset, int32)
Geometry *geometry = (Geometry*)object; Geometry *geometry = (Geometry*)object;
if(colordata->nightColors) if(colordata->nightColors)
return 4 + geometry->numVertices*4; return 4 + geometry->numVertices*4;
return -1; return 0;
} }
void void
@ -420,7 +447,7 @@ static int32
getSizeEnvMat(void *object, int32 offset, int32) getSizeEnvMat(void *object, int32 offset, int32)
{ {
EnvMat *env = *PLUGINOFFSET(EnvMat*, object, offset); EnvMat *env = *PLUGINOFFSET(EnvMat*, object, offset);
return env ? (int)sizeof(EnvStream) : -1; return env ? (int)sizeof(EnvStream) : 0;
} }
// Specular mat // Specular mat
@ -490,19 +517,12 @@ static int32
getSizeSpecMat(void *object, int32 offset, int32) getSizeSpecMat(void *object, int32 offset, int32)
{ {
SpecMat *spec = *PLUGINOFFSET(SpecMat*, object, offset); SpecMat *spec = *PLUGINOFFSET(SpecMat*, object, offset);
return spec ? (int)sizeof(SpecStream) : -1; return spec ? (int)sizeof(SpecStream) : 0;
} }
void void
registerEnvSpecPlugin(void) registerEnvSpecPlugin(void)
{ {
specMatOffset = Material::registerPlugin(sizeof(SpecMat*), ID_SPECMAT,
createSpecMat,
destroySpecMat,
copySpecMat);
Material::registerPluginStream(ID_SPECMAT, readSpecMat,
writeSpecMat,
getSizeSpecMat);
envMatOffset = Material::registerPlugin(sizeof(EnvMat*), ID_ENVMAT, envMatOffset = Material::registerPlugin(sizeof(EnvMat*), ID_ENVMAT,
createEnvMat, createEnvMat,
destroyEnvMat, destroyEnvMat,
@ -510,6 +530,226 @@ registerEnvSpecPlugin(void)
Material::registerPluginStream(ID_ENVMAT, readEnvMat, Material::registerPluginStream(ID_ENVMAT, readEnvMat,
writeEnvMat, writeEnvMat,
getSizeEnvMat); getSizeEnvMat);
specMatOffset = Material::registerPlugin(sizeof(SpecMat*), ID_SPECMAT,
createSpecMat,
destroySpecMat,
copySpecMat);
Material::registerPluginStream(ID_SPECMAT, readSpecMat,
writeSpecMat,
getSizeSpecMat);
}
// Pipeline
int32 pipelineOffset;
static void*
createPipeline(void *object, int32 offset, int32)
{
*PLUGINOFFSET(uint32, object, offset) = 0;
return object;
}
static void*
copyPipeline(void *dst, void *src, int32 offset, int32)
{
*PLUGINOFFSET(uint32, dst, offset) = *PLUGINOFFSET(uint32, src, offset);
return dst;
}
static void
readPipeline(Stream *stream, int32, void *object, int32 offset, int32)
{
*PLUGINOFFSET(uint32, object, offset) = stream->readU32();
}
static void
writePipeline(Stream *stream, int32, void *object, int32 offset, int32)
{
stream->writeU32(*PLUGINOFFSET(uint32, object, offset));
}
static int32
getSizePipeline(void *object, int32 offset, int32)
{
if(*PLUGINOFFSET(uint32, object, offset))
return 4;
return 0;
}
void
registerPipelinePlugin(void)
{
pipelineOffset = Atomic::registerPlugin(sizeof(uint32), ID_PIPELINE,
createPipeline,
NULL,
copyPipeline);
Atomic::registerPluginStream(ID_PIPELINE, readPipeline,
writePipeline, getSizePipeline);
}
uint32
getPipelineID(Atomic *atomic)
{
return *PLUGINOFFSET(uint32, atomic, pipelineOffset);
}
void
setPipelineID(Atomic *atomic, uint32 id)
{
*PLUGINOFFSET(uint32, atomic, pipelineOffset) = id;
}
// 2dEffect
struct SizedData
{
uint32 size;
uint8 *data;
};
int32 twodEffectOffset;
static void*
create2dEffect(void *object, int32 offset, int32)
{
SizedData *data;
data = PLUGINOFFSET(SizedData, object, offset);
data->size = 0;
data->data = NULL;
return object;
}
static void*
destroy2dEffect(void *object, int32 offset, int32)
{
SizedData *data;
data = PLUGINOFFSET(SizedData, object, offset);
delete[] data->data;
data->data = NULL;
data->size = 0;
return object;
}
static void*
copy2dEffect(void *dst, void *src, int32 offset, int32)
{
SizedData *srcdata, *dstdata;
dstdata = PLUGINOFFSET(SizedData, dst, offset);
srcdata = PLUGINOFFSET(SizedData, src, offset);
dstdata->size = srcdata->size;
if(dstdata->size != 0){
dstdata->data = new uint8[dstdata->size];
memcpy(dstdata->data, srcdata->data, dstdata->size);
}
return dst;
}
static void
read2dEffect(Stream *stream, int32 size, void *object, int32 offset, int32)
{
SizedData *data = PLUGINOFFSET(SizedData, object, offset);
data->size = size;
data->data = new uint8[data->size];
stream->read(data->data, data->size);
}
static void
write2dEffect(Stream *stream, int32, void *object, int32 offset, int32)
{
SizedData *data = PLUGINOFFSET(SizedData, object, offset);
stream->write(data->data, data->size);
}
static int32
getSize2dEffect(void *object, int32 offset, int32)
{
SizedData *data = PLUGINOFFSET(SizedData, object, offset);
return data->size;
}
void
register2dEffectPlugin(void)
{
twodEffectOffset = Geometry::registerPlugin(sizeof(SizedData), ID_2DEFFECT,
create2dEffect,
destroy2dEffect,
copy2dEffect);
Geometry::registerPluginStream(ID_2DEFFECT, read2dEffect,
write2dEffect, getSize2dEffect);
}
// Collision
int32 collisionOffset;
static void*
createCollision(void *object, int32 offset, int32)
{
SizedData *data;
data = PLUGINOFFSET(SizedData, object, offset);
data->size = 0;
data->data = NULL;
return object;
}
static void*
destroyCollision(void *object, int32 offset, int32)
{
SizedData *data;
data = PLUGINOFFSET(SizedData, object, offset);
delete[] data->data;
data->data = NULL;
data->size = 0;
return object;
}
static void*
copyCollision(void *dst, void *src, int32 offset, int32)
{
SizedData *srcdata, *dstdata;
dstdata = PLUGINOFFSET(SizedData, dst, offset);
srcdata = PLUGINOFFSET(SizedData, src, offset);
dstdata->size = srcdata->size;
if(dstdata->size != 0){
dstdata->data = new uint8[dstdata->size];
memcpy(dstdata->data, srcdata->data, dstdata->size);
}
return dst;
}
static void
readCollision(Stream *stream, int32 size, void *object, int32 offset, int32)
{
SizedData *data = PLUGINOFFSET(SizedData, object, offset);
data->size = size;
data->data = new uint8[data->size];
stream->read(data->data, data->size);
}
static void
writeCollision(Stream *stream, int32, void *object, int32 offset, int32)
{
SizedData *data = PLUGINOFFSET(SizedData, object, offset);
stream->write(data->data, data->size);
}
static int32
getSizeCollision(void *object, int32 offset, int32)
{
SizedData *data = PLUGINOFFSET(SizedData, object, offset);
return data->size;
}
void
registerCollisionPlugin(void)
{
collisionOffset = Clump::registerPlugin(sizeof(SizedData), ID_COLLISION,
createCollision,
destroyCollision,
copyCollision);
Clump::registerPluginStream(ID_COLLISION, readCollision,
writeCollision, getSizeCollision);
} }
} }

View File

@ -4,13 +4,18 @@ using namespace rw;
enum enum
{ {
ID_EXTRANORMALS = 0x253f2f2, ID_EXTRANORMALS = 0x253f2f2,
ID_PIPELINE = 0x253f2f3,
ID_SPECMAT = 0x253f2f6, ID_SPECMAT = 0x253f2f6,
ID_2DEFFECT = 0x253f2f8, // geometry
ID_EXTRAVERTCOLORS = 0x253f2f9, ID_EXTRAVERTCOLORS = 0x253f2f9,
ID_COLLISION = 0x253f2fa, // clump
ID_ENVMAT = 0x253f2fc, ID_ENVMAT = 0x253f2fc,
ID_BREAKABLE = 0x253f2fd, ID_BREAKABLE = 0x253f2fd,
ID_NODENAME = 0x253f2fe ID_NODENAME = 0x253f2fe
}; };
void attachPlugins(void);
// Node name // Node name
extern int32 nodeNameOffset; extern int32 nodeNameOffset;
@ -79,4 +84,36 @@ extern int32 specMatOffset;
void registerEnvSpecPlugin(void); void registerEnvSpecPlugin(void);
// Pipeline
// 0x53F2009A CCustomCarEnvMapPipeline
//
// PC & Mobile:
// 0x53F20098 CCustomBuildingDNPipeline
// 0x53F2009C CCustomBuildingPipeline
//
// Xbox
// 0x53F2009E building !N !EN
// 0x53F20096 building N !EN
// 0x53F200A0 building !N EN (also env) non-DN custom instanceCB!
// 0x53F200A2 building N EN (also env) DN custom instanceCB!
extern int32 pipelineOffset;
void registerPipelinePlugin(void);
uint32 getPipelineID(Atomic *atomic);
void setPipelineID(Atomic *atomic, uint32 id);
// 2dEffect
extern int32 twodEffectOffset;
void register2dEffectPlugin(void);
// Collision
extern int32 collisionOffset;
void registerCollisionPlugin(void);
} }

View File

@ -123,11 +123,11 @@ static int32
getSizeHAnim(void *object, int32 offset, int32) getSizeHAnim(void *object, int32 offset, int32)
{ {
HAnimData *hanim = PLUGINOFFSET(HAnimData, object, offset); HAnimData *hanim = PLUGINOFFSET(HAnimData, object, offset);
if(version >= 0x34000 && hanim->id == -1 && hanim->hierarchy == NULL) // TODO: version correct?
if(version >= 0x35000 && hanim->id == -1 && hanim->hierarchy == NULL)
return -1; return -1;
if(hanim->hierarchy) if(hanim->hierarchy)
return 12 + 8 + hanim->hierarchy->numNodes*12; return 12 + 8 + hanim->hierarchy->numNodes*12;
// TODO: version correct?
return 12; return 12;
} }
@ -712,8 +712,7 @@ getSizeAtomicMatFX(void *object, int32 offset, int32)
{ {
int32 flag = *PLUGINOFFSET(int32, object, offset); int32 flag = *PLUGINOFFSET(int32, object, offset);
// TODO: not sure which version // TODO: not sure which version
return flag && rw::version < 0x35000 ? 4 : -1; return flag || rw::version < 0x35000 ? 4 : -1;
return 4;
} }
// Material // Material

View File

@ -133,11 +133,16 @@ enum PluginID
ID_RIGHTTORENDER = 0x1F, ID_RIGHTTORENDER = 0x1F,
ID_UVANIMDICT = 0x2B, ID_UVANIMDICT = 0x2B,
// Toolkit
ID_SKYMIPMAP = 0x110,
ID_SKIN = 0x116, ID_SKIN = 0x116,
ID_HANIMPLUGIN = 0x11E, ID_HANIMPLUGIN = 0x11E,
ID_MATFX = 0x120, ID_MATFX = 0x120,
ID_PDS = 0x131, ID_PDS = 0x131,
ID_ADC = 0x134, ID_ADC = 0x134,
ID_UVANIMATION = 0x135,
// World
ID_MESH = 0x50E, ID_MESH = 0x50E,
ID_NATIVEDATA = 0x510, ID_NATIVEDATA = 0x510,
ID_VERTEXFMT = 0x511, ID_VERTEXFMT = 0x511,
@ -148,6 +153,14 @@ extern int build;
extern int platform; extern int platform;
extern char *debugFile; extern char *debugFile;
// 0x04000000 3.1
// 0x08000000 3.2
// 0x0C000000 3.3
// 0x10000000 3.4
// 0x14000000 3.5
// 0x18000000 3.6
// 0x1C000000 3.7
inline uint32 inline uint32
libraryIDPack(int version, int build) libraryIDPack(int version, int build)
{ {

View File

@ -409,6 +409,74 @@ struct TexDictionary
Texture *find(const char *name); Texture *find(const char *name);
}; };
struct Animation;
struct AnimInterpolatorInfo
{
int32 id;
int32 keyFrameSize;
int32 customDataSize;
void (*streamRead)(Stream *stream, Animation *anim);
void (*streamWrite)(Stream *stream, Animation *anim);
uint32 (*streamGetSize)(Animation *anim);
};
void registerAnimInterpolatorInfo(AnimInterpolatorInfo *interpInfo);
struct Animation
{
AnimInterpolatorInfo *interpInfo;
int32 numFrames;
int32 flags;
float duration;
void *keyframes;
void *customData;
Animation(AnimInterpolatorInfo*, int32 numFrames, int32 flags, float duration);
static Animation *streamRead(Stream *stream);
bool streamWrite(Stream *stream);
uint32 streamGetSize(void);
};
struct AnimInterpolator
{
// only a stub right now
Animation *anim;
AnimInterpolator(Animation *anim);
};
extern TexDictionary *currentTexDictionary; extern TexDictionary *currentTexDictionary;
struct UVAnimKeyFrame
{
UVAnimKeyFrame *prev;
float time;
float uv[6];
};
struct UVAnimCustomData
{
char name[32];
int32 nodeToUVChannel[8];
// RW has a refcount
};
struct UVAnimDictionary
{
int32 numAnims;
Animation **anims;
static UVAnimDictionary *streamRead(Stream *stream);
bool streamWrite(Stream *stream);
uint32 streamGetSize(void);
Animation *find(const char *name);
};
extern UVAnimDictionary *currentUVAnimDictionary;
extern int32 uvAnimOffset;
void registerUVAnimPlugin(void);
} }

View File

@ -92,7 +92,7 @@ PluginBase<T>::streamReadPlugins(Stream *stream)
readChunkHeaderInfo(stream, &header); readChunkHeaderInfo(stream, &header);
length -= 12; length -= 12;
for(Plugin *p = this->s_plugins; p; p = p->next) for(Plugin *p = this->s_plugins; p; p = p->next)
if(p->id == header.type){ if(p->id == header.type && p->read){
p->read(stream, header.length, p->read(stream, header.length,
(void*)this, p->offset, p->size); (void*)this, p->offset, p->size);
goto cont; goto cont;
@ -111,7 +111,7 @@ PluginBase<T>::streamWritePlugins(Stream *stream)
writeChunkHeader(stream, ID_EXTENSION, size); writeChunkHeader(stream, ID_EXTENSION, size);
for(Plugin *p = this->s_plugins; p; p = p->next){ for(Plugin *p = this->s_plugins; p; p = p->next){
if(p->getSize == NULL || if(p->getSize == NULL ||
(size = p->getSize(this, p->offset, p->size)) < 0) (size = p->getSize(this, p->offset, p->size)) <= 0)
continue; continue;
writeChunkHeader(stream, p->id, size); writeChunkHeader(stream, p->id, size);
p->write(stream, size, this, p->offset, p->size); p->write(stream, size, this, p->offset, p->size);
@ -125,7 +125,7 @@ PluginBase<T>::streamGetPluginSize(void)
int32 plgsize; int32 plgsize;
for(Plugin *p = this->s_plugins; p; p = p->next) for(Plugin *p = this->s_plugins; p; p = p->next)
if(p->getSize && if(p->getSize &&
(plgsize = p->getSize(this, p->offset, p->size)) >= 0) (plgsize = p->getSize(this, p->offset, p->size)) > 0)
size += 12 + plgsize; size += 12 + plgsize;
return size; return size;
} }
@ -160,8 +160,11 @@ PluginBase<T>::registerPlugin(int32 size, uint32 id,
p->getSize = NULL; p->getSize = NULL;
p->rightsCallback = NULL; p->rightsCallback = NULL;
p->next = s_plugins; Plugin **next;
s_plugins = p; for(next = &s_plugins; *next; next = &(*next)->next)
;
*next = p;
p->next = NULL;
return p->offset; return p->offset;
} }

View File

@ -215,28 +215,13 @@ void (*renderCB)(rw::Atomic*) = NULL;
void void
initrw(void) initrw(void)
{ {
gta::attachPlugins();
rw::currentTexDictionary = new rw::TexDictionary; rw::currentTexDictionary = new rw::TexDictionary;
rw::Image::setSearchPath("D:\\rockstargames\\ps2\\gta3\\MODELS\\gta3_archive\\txd_extracted\\;" rw::Image::setSearchPath("D:\\rockstargames\\ps2\\gta3\\MODELS\\gta3_archive\\txd_extracted\\;"
"D:\\rockstargames\\ps2\\gtavc\\MODELS\\gta3_archive\\txd_extracted\\;" "D:\\rockstargames\\ps2\\gtavc\\MODELS\\gta3_archive\\txd_extracted\\;"
"D:\\rockstargames\\ps2\\gtasa\\models\\gta3_archive\\txd_extracted\\"); "D:\\rockstargames\\ps2\\gtasa\\models\\gta3_archive\\txd_extracted\\");
gta::registerEnvSpecPlugin();
rw::registerMatFXPlugin();
rw::registerMaterialRightsPlugin();
rw::registerAtomicRightsPlugin();
rw::registerHAnimPlugin();
gta::registerNodeNamePlugin();
gta::registerExtraNormalsPlugin();
gta::registerBreakableModelPlugin();
gta::registerExtraVertColorPlugin();
rw::ps2::registerADCPlugin();
rw::ps2::registerPDSPlugin();
rw::registerSkinPlugin();
rw::xbox::registerVertexFormatPlugin();
rw::registerNativeDataPlugin();
rw::registerMeshPlugin();
rw::Atomic::init();
rw::d3d::registerNativeRaster(); rw::d3d::registerNativeRaster();
rw::platform = rw::PLATFORM_D3D9; rw::platform = rw::PLATFORM_D3D9;
@ -247,10 +232,12 @@ initrw(void)
// char *filename = "D:\\rockstargames\\pc\\gtavc\\models\\gta3_archive\\od_newscafe_dy.dff"; // char *filename = "D:\\rockstargames\\pc\\gtavc\\models\\gta3_archive\\od_newscafe_dy.dff";
// char *filename = "D:\\rockstargames\\pc\\gtasa\\models\\gta3_archive\\admiral.dff"; // char *filename = "D:\\rockstargames\\pc\\gtasa\\models\\gta3_archive\\admiral.dff";
// char *filename = "D:\\rockstargames\\pc\\gtasa\\models\\gta3_archive\\lae2_roads89.dff"; // char *filename = "D:\\rockstargames\\pc\\gtasa\\models\\gta3_archive\\lae2_roads89.dff";
char *filename = "D:\\rockstargames\\pc\\gtasa\\models\\gta3_archive\\casinoblock41_nt.dff";
// char *filename = "D:\\rockstargames\\pc\\gtasa\\models\\cutscene_archive\\csremington92.dff";
// char *filename = "C:\\gtasa\\test\\hanger.dff"; // char *filename = "C:\\gtasa\\test\\hanger.dff";
// char *filename = "C:\\Users\\aap\\Desktop\\tmp\\out.dff"; // char *filename = "C:\\Users\\aap\\Desktop\\tmp\\out.dff";
// char *filename = "out2.dff"; // char *filename = "out2.dff";
char *filename = "C:\\Users\\aap\\src\\librw\\tools\\insttest\\out.dff"; // char *filename = "C:\\Users\\aap\\src\\librw\\tools\\insttest\\out.dff";
rw::StreamFile in; rw::StreamFile in;
if(in.open(filename, "rb") == NULL){ if(in.open(filename, "rb") == NULL){
MessageBox(0, "couldn't open file\n", 0, 0); MessageBox(0, "couldn't open file\n", 0, 0);
@ -270,10 +257,10 @@ initrw(void)
else if(rw::platform == rw::PLATFORM_D3D9) else if(rw::platform == rw::PLATFORM_D3D9)
renderCB = rw::d3d9::drawAtomic; renderCB = rw::d3d9::drawAtomic;
// rw::StreamFile out; rw::StreamFile out;
// out.open("out.dff", "wb"); out.open("out.dff", "wb");
// clump->streamWrite(&out); clump->streamWrite(&out);
// out.close(); out.close();
} }
bool bool
@ -308,10 +295,10 @@ Setup()
camera = new Camera; camera = new Camera;
camera->setAspectRatio(640.0f/480.0f); camera->setAspectRatio(640.0f/480.0f);
camera->setNearFar(0.1f, 250.0f); camera->setNearFar(0.1f, 450.0f);
camera->setTarget(Vec3(0.0f, 0.0f, 0.0f)); camera->setTarget(Vec3(0.0f, 0.0f, 0.0f));
// camera->setPosition(Vec3(0.0f, 5.0f, 0.0f)); // camera->setPosition(Vec3(0.0f, 5.0f, 0.0f));
camera->setPosition(Vec3(0.0f, -5.0f, 0.0f)); camera->setPosition(Vec3(0.0f, -70.0f, 0.0f));
// camera->setPosition(Vec3(0.0f, -1.0f, 3.0f)); // camera->setPosition(Vec3(0.0f, -1.0f, 3.0f));
return true; return true;

View File

@ -19,23 +19,7 @@ main(int argc, char *argv[])
// rw::version = 0x33002; // rw::version = 0x33002;
// rw::version = 0x30200; // rw::version = 0x30200;
gta::registerEnvSpecPlugin(); gta::attachPlugins();
rw::registerMatFXPlugin();
rw::registerMaterialRightsPlugin();
rw::registerAtomicRightsPlugin();
rw::registerHAnimPlugin();
gta::registerNodeNamePlugin();
gta::registerExtraNormalsPlugin();
gta::registerBreakableModelPlugin();
gta::registerExtraVertColorPlugin();
rw::ps2::registerADCPlugin();
rw::ps2::registerPDSPlugin();
rw::registerSkinPlugin();
rw::xbox::registerVertexFormatPlugin();
rw::registerNativeDataPlugin();
// rw::ps2::registerNativeDataPlugin();
rw::registerMeshPlugin();
rw::Atomic::init();
rw::Clump *c; rw::Clump *c;

View File

@ -189,6 +189,8 @@ init(void)
// camera->setPosition(Vec3(0.0f, 5.0f, 0.0f)); // camera->setPosition(Vec3(0.0f, 5.0f, 0.0f));
camera->setPosition(Vec3(0.0f, -1.0f, 3.0f)); camera->setPosition(Vec3(0.0f, -1.0f, 3.0f));
gta::attachPlugins();
rw::currentTexDictionary = new rw::TexDictionary; rw::currentTexDictionary = new rw::TexDictionary;
// rw::Image::setSearchPath("/home/aap/gamedata/ps2/gtasa/models/gta3_archive/txd_extracted/"); // rw::Image::setSearchPath("/home/aap/gamedata/ps2/gtasa/models/gta3_archive/txd_extracted/");
// rw::Image::setSearchPath("/home/aap/gamedata/ps2/gtavc/MODELS/gta3_archive/txd_extracted/"); // rw::Image::setSearchPath("/home/aap/gamedata/ps2/gtavc/MODELS/gta3_archive/txd_extracted/");
@ -196,24 +198,6 @@ init(void)
"/home/aap/gamedata/ps2/gta3/MODELS/gta3_archive/txd_extracted/;//home/aap/gamedata/ps2/gtavc/MODELS/gta3_archive/txd_extracted/;/home/aap/gamedata/ps2/gtasa/models/gta3_archive/txd_extracted/"); "/home/aap/gamedata/ps2/gta3/MODELS/gta3_archive/txd_extracted/;//home/aap/gamedata/ps2/gtavc/MODELS/gta3_archive/txd_extracted/;/home/aap/gamedata/ps2/gtasa/models/gta3_archive/txd_extracted/");
//"D:\\rockstargames\\ps2\\gtavc\\MODELS\\gta3_archive\\txd_extracted\\;D:\\rockstargames\\ps2\\gtasa\\models\\gta3_archive\\txd_extracted\\"); //"D:\\rockstargames\\ps2\\gtavc\\MODELS\\gta3_archive\\txd_extracted\\;D:\\rockstargames\\ps2\\gtasa\\models\\gta3_archive\\txd_extracted\\");
rw::gl::registerNativeRaster();
gta::registerEnvSpecPlugin();
rw::registerMatFXPlugin();
rw::registerMaterialRightsPlugin();
rw::registerAtomicRightsPlugin();
rw::registerHAnimPlugin();
gta::registerNodeNamePlugin();
gta::registerBreakableModelPlugin();
gta::registerExtraVertColorPlugin();
rw::ps2::registerADCPlugin();
rw::ps2::registerPDSPlugin();
rw::registerSkinPlugin();
rw::xbox::registerVertexFormatPlugin();
rw::registerNativeDataPlugin();
// rw::ps2::registerNativeDataPlugin();
rw::registerMeshPlugin();
rw::Atomic::init();
printf("platform: %d\n", rw::platform); printf("platform: %d\n", rw::platform);
rw::StreamFile in; rw::StreamFile in;

View File

@ -13,21 +13,7 @@ using namespace rw;
int int
main(int argc, char *argv[]) main(int argc, char *argv[])
{ {
gta::registerEnvSpecPlugin(); gta::attachPlugins();
rw::registerMatFXPlugin();
rw::registerMaterialRightsPlugin();
rw::registerAtomicRightsPlugin();
rw::registerHAnimPlugin();
gta::registerNodeNamePlugin();
gta::registerBreakableModelPlugin();
gta::registerExtraVertColorPlugin();
rw::ps2::registerADCPlugin();
rw::ps2::registerPDSPlugin();
rw::registerSkinPlugin();
rw::xbox::registerVertexFormatPlugin();
rw::registerNativeDataPlugin();
rw::registerMeshPlugin();
rw::Atomic::init();
// rw::version = 0x33002; // rw::version = 0x33002;
// rw::platform = rw::PLATFORM_PS2; // rw::platform = rw::PLATFORM_PS2;
@ -59,7 +45,15 @@ main(int argc, char *argv[])
assert(data != NULL); assert(data != NULL);
StreamMemory in; StreamMemory in;
in.open(data, len); in.open(data, len);
findChunk(&in, ID_CLUMP, NULL, NULL);
ChunkHeaderInfo header;
readChunkHeaderInfo(&in, &header);
if(header.type == ID_UVANIMDICT){
UVAnimDictionary *dict = UVAnimDictionary::streamRead(&in);
currentUVAnimDictionary = dict;
readChunkHeaderInfo(&in, &header);
}
assert(header.type == ID_CLUMP);
debugFile = argv[arg]; debugFile = argv[arg];
c = Clump::streamRead(&in); c = Clump::streamRead(&in);
assert(c != NULL); assert(c != NULL);
@ -91,6 +85,8 @@ main(int argc, char *argv[])
data = new rw::uint8[1024*1024]; data = new rw::uint8[1024*1024];
rw::StreamMemory out; rw::StreamMemory out;
out.open(data, 0, 1024*1024); out.open(data, 0, 1024*1024);
if(currentUVAnimDictionary)
currentUVAnimDictionary->streamWrite(&out);
c->streamWrite(&out); c->streamWrite(&out);
FILE *cf = fopen("out.dff", "wb"); FILE *cf = fopen("out.dff", "wb");

View File

@ -227,22 +227,7 @@ main()
gsInit(); gsInit();
gta::registerEnvSpecPlugin(); gta::attachPlugins();
rw::registerMatFXPlugin();
rw::registerMaterialRightsPlugin();
rw::registerAtomicRightsPlugin();
rw::registerHAnimPlugin();
gta::registerNodeNamePlugin();
gta::registerBreakableModelPlugin();
gta::registerExtraVertColorPlugin();
rw::ps2::registerADCPlugin();
rw::ps2::registerPDSPlugin();
rw::registerSkinPlugin();
rw::xbox::registerVertexFormatPlugin();
rw::registerNativeDataPlugin();
// rw::ps2::registerNativeDataPlugin();
rw::registerMeshPlugin();
rw::Atomic::init();
defpipe = rw::ps2::makeDefaultPipeline(); defpipe = rw::ps2::makeDefaultPipeline();