mirror of
https://github.com/isledecomp/isle.git
synced 2026-01-27 10:11:15 +00:00
Match FUN_1003e050
This commit is contained in:
parent
c175fa57c5
commit
1be6d5a118
@ -62,22 +62,21 @@ void FUN_1003e050(LegoAnimPresenter* p_presenter)
|
|||||||
{
|
{
|
||||||
MxMatrix viewMatrix;
|
MxMatrix viewMatrix;
|
||||||
LegoTreeNode* rootNode = p_presenter->GetAnimation()->GetRoot();
|
LegoTreeNode* rootNode = p_presenter->GetAnimation()->GetRoot();
|
||||||
|
LegoAnimNodeData* camData = NULL;
|
||||||
|
LegoAnimNodeData* targetData = NULL;
|
||||||
MxS16 nodesCount = CountTotalTreeNodes(rootNode);
|
MxS16 nodesCount = CountTotalTreeNodes(rootNode);
|
||||||
|
|
||||||
MxFloat cam;
|
MxFloat cam;
|
||||||
LegoAnimNodeData* camData = NULL;
|
|
||||||
LegoAnimNodeData* targetData = NULL;
|
|
||||||
for (MxS16 i = 0; i < nodesCount; i++) {
|
for (MxS16 i = 0; i < nodesCount; i++) {
|
||||||
if (targetData && camData) {
|
if (camData && targetData) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
LegoTreeNode* node = GetTreeNode(rootNode, i);
|
LegoAnimNodeData* data = (LegoAnimNodeData*) GetTreeNode(rootNode, i)->GetData();
|
||||||
LegoAnimNodeData* data = (LegoAnimNodeData*) node->GetData();
|
|
||||||
|
|
||||||
if (!strnicmp(data->GetName(), "CAM", strlen("CAM"))) {
|
if (!strnicmp(data->GetName(), "CAM", strlen("CAM"))) {
|
||||||
camData = data;
|
camData = data;
|
||||||
cam = atof(strlen((data->GetName())) + 1 + data->GetName() - 3);
|
cam = atof(&data->GetName()[strlen(data->GetName()) - 2]);
|
||||||
}
|
}
|
||||||
else if (!strcmpi(data->GetName(), "TARGET")) {
|
else if (!strcmpi(data->GetName(), "TARGET")) {
|
||||||
targetData = data;
|
targetData = data;
|
||||||
@ -89,30 +88,23 @@ void FUN_1003e050(LegoAnimPresenter* p_presenter)
|
|||||||
matrixCam.SetIdentity();
|
matrixCam.SetIdentity();
|
||||||
matrixTarget.SetIdentity();
|
matrixTarget.SetIdentity();
|
||||||
|
|
||||||
camData->CreateLocalTransform((LegoFloat) 0, matrixCam);
|
camData->CreateLocalTransform(0.0f, matrixCam);
|
||||||
targetData->CreateLocalTransform((LegoFloat) 0, matrixTarget);
|
targetData->CreateLocalTransform(0.0f, matrixTarget);
|
||||||
|
|
||||||
Mx3DPointFloat dir;
|
Mx3DPointFloat dir;
|
||||||
dir[0] = matrixTarget[3][0] - matrixCam[3][0];
|
dir[0] = matrixTarget[3][0] - matrixCam[3][0];
|
||||||
dir[1] = matrixTarget[3][1] - matrixCam[3][1];
|
dir[1] = matrixTarget[3][1] - matrixCam[3][1];
|
||||||
dir[2] = matrixTarget[3][2] - matrixCam[3][2];
|
dir[2] = matrixTarget[3][2] - matrixCam[3][2];
|
||||||
|
dir.Unitize();
|
||||||
|
|
||||||
MxFloat lensSquared = dir.LenSquared();
|
CalcLocalTransform(matrixCam[3], dir, matrixCam[1], viewMatrix);
|
||||||
if (lensSquared > 0.0f) {
|
|
||||||
float x = sqrt(lensSquared);
|
|
||||||
if (x > 0.0f) {
|
|
||||||
dir.DivScalarImpl(&x);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Vector3 position(matrixCam[3]);
|
|
||||||
Vector3 up(matrixCam[1]);
|
|
||||||
CalcLocalTransform(position, dir, up, viewMatrix);
|
|
||||||
|
|
||||||
LegoVideoManager* video = VideoManager();
|
LegoVideoManager* video = VideoManager();
|
||||||
LegoROI* view = video->GetViewROI();
|
LegoROI* roi = video->GetViewROI();
|
||||||
view->WrappedSetLocalTransform(viewMatrix);
|
Lego3DView* view = video->Get3DManager()->GetLego3DView();
|
||||||
video->Get3DManager()->GetLego3DView()->Moved(*view);
|
|
||||||
|
roi->WrappedSetLocalTransform(viewMatrix);
|
||||||
|
view->Moved(*roi);
|
||||||
FUN_1003eda0();
|
FUN_1003eda0();
|
||||||
video->Get3DManager()->SetFrustrum(cam, 0.1, 250.0);
|
video->Get3DManager()->SetFrustrum(cam, 0.1, 250.0);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user