Added *very* simple frame transformation.
This commit is contained in:
parent
2ff25d928e
commit
8e181bcae3
16
TODO
16
TODO
@ -14,22 +14,20 @@ Clump & related:
|
||||
texcoord
|
||||
- implement plugins:
|
||||
Clump
|
||||
Collision
|
||||
R* Collision
|
||||
Frame
|
||||
HAnim
|
||||
Atomic
|
||||
Right To Render
|
||||
(Particles)
|
||||
Pipeline Set
|
||||
((Particles))
|
||||
R* Pipeline Set
|
||||
Geometry
|
||||
-Native Data
|
||||
(Morph)
|
||||
((Morph))
|
||||
-Skin
|
||||
2dfx
|
||||
R* 2dfx
|
||||
Material
|
||||
Right To Render
|
||||
Reflection mat
|
||||
Specular Mat
|
||||
R* Reflection mat
|
||||
R* Specular Mat
|
||||
UV Anim
|
||||
Texture
|
||||
(Sky Mipmap Val)
|
||||
|
@ -15,6 +15,7 @@ namespace Rw {
|
||||
|
||||
Frame::Frame(void)
|
||||
{
|
||||
this->parent = NULL;
|
||||
this->child = NULL;
|
||||
this->next = NULL;
|
||||
this->root = NULL;
|
||||
@ -24,6 +25,7 @@ Frame::Frame(void)
|
||||
this->matrix[5] = 1.0f;
|
||||
this->matrix[10] = 1.0f;
|
||||
this->matrix[15] = 1.0f;
|
||||
this->dirty = true;
|
||||
constructPlugins();
|
||||
}
|
||||
|
||||
@ -98,6 +100,33 @@ Frame::count(void)
|
||||
return count;
|
||||
}
|
||||
|
||||
void
|
||||
Frame::updateLTM(void)
|
||||
{
|
||||
if(!this->dirty)
|
||||
return;
|
||||
Frame *parent = (Frame*)this->parent;
|
||||
if(parent){
|
||||
parent->updateLTM();
|
||||
#define L(i,j) this->ltm[i*4+j]
|
||||
#define A(i,j) parent->ltm[i*4+j]
|
||||
#define B(i,j) this->matrix[i*4+j]
|
||||
for(int i = 0; i < 4; i++)
|
||||
for(int j = 0; j < 4; j++)
|
||||
L(i,j) = A(0,j)*B(i,0)
|
||||
+ A(1,j)*B(i,1)
|
||||
+ A(2,j)*B(i,2)
|
||||
+ A(3,j)*B(i,3);
|
||||
#undef L
|
||||
#undef A
|
||||
#undef B
|
||||
this->dirty = false;
|
||||
}else{
|
||||
memcpy(this->ltm, this->matrix, 16*4);
|
||||
this->dirty = false;
|
||||
}
|
||||
}
|
||||
|
||||
static Frame*
|
||||
sizeCB(Frame *f, void *size)
|
||||
{
|
||||
@ -323,9 +352,9 @@ Clump::frameListStreamRead(Stream *stream, Frame ***flp, int32 *nf)
|
||||
f->matrix[13] = buf.pos[1];
|
||||
f->matrix[14] = buf.pos[2];
|
||||
f->matrix[15] = 1.0f;
|
||||
f->matflag = buf.matflag;
|
||||
if(buf.parent >= 0)
|
||||
frameList[buf.parent]->addChild(f);
|
||||
f->matflag = buf.matflag;
|
||||
}
|
||||
for(int32 i = 0; i < numFrames; i++)
|
||||
frameList[i]->streamReadPlugins(stream);
|
||||
@ -447,12 +476,7 @@ Atomic::streamGetSize(void)
|
||||
static void
|
||||
readAtomicRights(Stream *stream, int32, void *, int32, int32)
|
||||
{
|
||||
// uint32 version;
|
||||
//stream->seek(-4);
|
||||
//version = stream->readU32();
|
||||
stream->read(atomicRights, 8);
|
||||
// printf("atomicrights: %s %X %X %X\n", DebugFile, LibraryIDUnpackVersion(version), buffer[0], buffer[1]);
|
||||
// printf("atomicrights: %X %X %X\n", LibraryIDUnpackVersion(version), buffer[0], buffer[1]);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -27,6 +27,7 @@ struct Frame : PluginBase<Frame>, Object
|
||||
|
||||
// temporary
|
||||
int32 matflag;
|
||||
bool dirty;
|
||||
|
||||
Frame(void);
|
||||
Frame(Frame *f);
|
||||
@ -35,6 +36,7 @@ struct Frame : PluginBase<Frame>, Object
|
||||
Frame *removeChild(void);
|
||||
Frame *forAllChildren(Callback cb, void *data);
|
||||
int32 count(void);
|
||||
void updateLTM(void);
|
||||
};
|
||||
|
||||
struct Image
|
||||
|
Loading…
Reference in New Issue
Block a user