small fixes

This commit is contained in:
aap
2016-01-26 13:53:08 +01:00
parent d20a6c3d04
commit 6d56a23dd1
8 changed files with 60 additions and 11 deletions

View File

@@ -64,6 +64,7 @@ struct ExtraVertColors
};
extern int32 extraVertColorOffset;
void allocateExtraVertColors(Geometry *g);
void registerExtraVertColorPlugin(void);
// Environment mat

View File

@@ -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

View File

@@ -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

View File

@@ -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);

View File

@@ -1,3 +1,5 @@
#include <stddef.h>
namespace rw {
struct RGBA