mirror of https://github.com/aap/librw.git
small fixes
This commit is contained in:
parent
d20a6c3d04
commit
6d56a23dd1
|
@ -5,10 +5,11 @@ BUILD=null
|
|||
BUILDDEF:=$(shell echo $(BUILD) | tr a-z A-Z | sed 's/^/-DRW_/')
|
||||
BUILDDIR=build-$(BUILD)
|
||||
SRCDIR=src
|
||||
SRC := $(patsubst %.cpp,$(SRCDIR)/%.cpp, rwbase.cpp clump.cpp\
|
||||
geometry.cpp plugins.cpp pipeline.cpp\
|
||||
ps2.cpp ogl.cpp xbox.cpp\
|
||||
image.cpp gtaplg.cpp)
|
||||
#SRC := $(patsubst %.cpp,$(SRCDIR)/%.cpp, rwbase.cpp clump.cpp\
|
||||
# geometry.cpp plugins.cpp pipeline.cpp\
|
||||
# ps2.cpp ogl.cpp xbox.cpp\
|
||||
# image.cpp gtaplg.cpp)
|
||||
SRC := $(wildcard $(SRCDIR)/*.cpp)
|
||||
OBJ := $(patsubst $(SRCDIR)/%.cpp,$(BUILDDIR)/%.o,$(SRC))
|
||||
DEP := $(patsubst $(SRCDIR)/%.cpp,$(BUILDDIR)/%.d,$(SRC))
|
||||
CFLAGS=-Wall -Wextra -g -DGLEW_STATIC $(BUILDDEF) -Wno-parentheses #-Wconversion
|
||||
|
|
|
@ -64,6 +64,7 @@ struct ExtraVertColors
|
|||
};
|
||||
|
||||
extern int32 extraVertColorOffset;
|
||||
void allocateExtraVertColors(Geometry *g);
|
||||
void registerExtraVertColorPlugin(void);
|
||||
|
||||
// Environment mat
|
||||
|
|
|
@ -203,7 +203,6 @@ static int32
|
|||
getSizeHAnim(void *object, int32 offset, int32)
|
||||
{
|
||||
HAnimData *hanim = PLUGINOFFSET(HAnimData, object, offset);
|
||||
// TODO: version correct?
|
||||
if(!hAnimDoStream ||
|
||||
version >= 0x35000 && hanim->id == -1 && hanim->hierarchy == NULL)
|
||||
return 0;
|
||||
|
@ -593,6 +592,18 @@ readSkin(Stream *stream, int32 len, void *object, int32 offset, int32)
|
|||
if(oldFormat)
|
||||
stream->seek(4); // skip 0xdeaddead
|
||||
stream->read(&skin->inverseMatrices[i*16], 64);
|
||||
|
||||
//{
|
||||
//float *mat = &skin->inverseMatrices[i*16];
|
||||
//printf("[ [ %8.4f, %8.4f, %8.4f, %8.4f ]\n"
|
||||
// " [ %8.4f, %8.4f, %8.4f, %8.4f ]\n"
|
||||
// " [ %8.4f, %8.4f, %8.4f, %8.4f ]\n"
|
||||
// " [ %8.4f, %8.4f, %8.4f, %8.4f ] ]\n",
|
||||
// mat[0], mat[4], mat[8], mat[12],
|
||||
// mat[1], mat[5], mat[9], mat[13],
|
||||
// mat[2], mat[6], mat[10], mat[14],
|
||||
// mat[3], mat[7], mat[11], mat[15]);
|
||||
//}
|
||||
}
|
||||
|
||||
if(oldFormat){
|
||||
|
@ -842,7 +853,7 @@ getSizeAtomicMatFX(void *object, int32 offset, int32)
|
|||
{
|
||||
int32 flag = *PLUGINOFFSET(int32, object, offset);
|
||||
// TODO: not sure which version
|
||||
return flag || rw::version < 0x35000 ? 4 : -1;
|
||||
return flag || rw::version < 0x34000 ? 4 : 0;
|
||||
}
|
||||
|
||||
// Material
|
||||
|
|
|
@ -26,13 +26,32 @@ int32 build = 0xFFFF;
|
|||
char *debugFile = NULL;
|
||||
|
||||
void
|
||||
matrixIdentify(float32 *mat)
|
||||
matrixIdentity(float32 *mat)
|
||||
{
|
||||
memset(mat, 0, 64);
|
||||
mat[0] = 1.0f;
|
||||
mat[5] = 1.0f;
|
||||
mat[10] = 1.0f;
|
||||
mat[16] = 1.0f;
|
||||
mat[15] = 1.0f;
|
||||
}
|
||||
|
||||
int
|
||||
matrixEqual(float32 *m1, float32 *m2)
|
||||
{
|
||||
for(int i = 0; i < 16; i++)
|
||||
if(m1[i] != m2[i])
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
matrixIsIdentity(float32 *mat)
|
||||
{
|
||||
for(int32 i = 0; i < 4; i++)
|
||||
for(int32 j = 0; j < 4; j++)
|
||||
if(mat[i*4+j] != (i == j ? 1.0f : 0.0))
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -153,7 +153,9 @@ extern int build;
|
|||
extern int platform;
|
||||
extern char *debugFile;
|
||||
|
||||
void matrixIdentify(float32 *mat);
|
||||
void matrixIdentity(float32 *mat);
|
||||
int matrixEqual(float32 *m1, float32 *m2);
|
||||
int matrixIsIdentity(float32 *mat);
|
||||
void matrixMult(float32 *out, float32 *a, float32 *b);
|
||||
void vecTrans(float32 *out, float32 *mat, float32 *vec);
|
||||
void matrixTranspose(float32 *out, float32 *in);
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#include <stddef.h>
|
||||
|
||||
namespace rw {
|
||||
|
||||
struct RGBA
|
||||
|
|
|
@ -65,6 +65,19 @@ dumpFrameHier(Frame *frame, int ind = 0)
|
|||
for(int i = 0; i < h->numNodes; i++){
|
||||
name = h->nodeInfo[i].frame ? gta::getNodeName(h->nodeInfo[i].frame) : "";
|
||||
printf("\t\t%d %d\t%p %s\n", h->nodeInfo[i].id, h->nodeInfo[i].flags, h->nodeInfo[i].frame, name);
|
||||
|
||||
{
|
||||
h->nodeInfo[i].frame->updateLTM();
|
||||
float *mat = h->nodeInfo[i].frame->ltm;
|
||||
printf("[ [ %8.4f, %8.4f, %8.4f, %8.4f ]\n"
|
||||
" [ %8.4f, %8.4f, %8.4f, %8.4f ]\n"
|
||||
" [ %8.4f, %8.4f, %8.4f, %8.4f ]\n"
|
||||
" [ %8.4f, %8.4f, %8.4f, %8.4f ] ]\n",
|
||||
mat[0], mat[4], mat[8], mat[12],
|
||||
mat[1], mat[5], mat[9], mat[13],
|
||||
mat[2], mat[6], mat[10], mat[14],
|
||||
mat[3], mat[7], mat[11], mat[15]);
|
||||
}
|
||||
}
|
||||
}
|
||||
for(Frame *child = frame->child;
|
||||
|
|
|
@ -17,7 +17,6 @@ struct {
|
|||
char *str;
|
||||
uint32 val;
|
||||
} platforms[] = {
|
||||
{ "mobile", PLATFORM_OGL },
|
||||
{ "ps2", PLATFORM_PS2 },
|
||||
{ "xbox", PLATFORM_XBOX },
|
||||
{ "d3d8", PLATFORM_D3D8 },
|
||||
|
@ -99,7 +98,7 @@ main(int argc, char *argv[])
|
|||
// rw::platform = rw::PLATFORM_XBOX;
|
||||
// rw::platform = rw::PLATFORM_D3D8;
|
||||
// rw::platform = rw::PLATFORM_D3D9;
|
||||
int outplatform = rw::PLATFORM_PS2;
|
||||
int outplatform = rw::PLATFORM_XBOX;
|
||||
|
||||
char *s;
|
||||
ARGBEGIN{
|
||||
|
@ -151,6 +150,7 @@ main(int argc, char *argv[])
|
|||
}
|
||||
// for(Texture *tex = txd->first; tex; tex = tex->next)
|
||||
// tex->filterAddressing = (tex->filterAddressing&~0xF) | 0x2;
|
||||
rw::platform = outplatform;
|
||||
|
||||
rw::StreamFile out;
|
||||
if(argc > 1)
|
||||
|
|
Loading…
Reference in New Issue