struct NewObj : Game::Obj {
Vec position;
MeshPtr mesh;
CSkeleton cskel;
Matrix m;
virtual void create(Game::ObjParams &obj);
virtual Vec pos() {return position;}
virtual void pos(C Vec &pos) {T.position=pos;}
virtual Matrix matrix() {return position;}
virtual void matrix(C Matrix &matrix) { T.position=matrix.pos;}
virtual Bool update();
virtual UInt drawPrepare();
virtual void drawShadow();
NewObj();
};
NewObj::NewObj() {
position.zero();
}
void NewObj::create(Game::ObjParams &obj) {
position = obj.matrixFinal().pos;
mesh = obj.mesh();
Skeleton *skel = obj.skeleton();
m = obj.matrixFinal();
cskel.create(*skel, obj.scale(), m);
}
UInt NewObj::drawPrepare() {
mesh->draw(cskel);
C OrientP &light = cskel.getPoint("light");
LightPoint(20, light.pos, Vec(0.8, 1, 1)).add();
return 0;
}
void NewObj::drawShadow() {
mesh->drawShadow(cskel);
}
Bool NewObj::update() {
cskel.clear();
cskel.animate(L"obj/lamps/victorian/victorian.anim", Time.time()/10);
cskel.updateMatrix(m);
return true;
}