void CPUTGUIElement::Resize(int x, int y, int width, int height, int windowWidth, int windowHeight) { if(mParentRelative) { mPosX = mRelX + x; mPosY = mRelY + y; if(mRelX < 0) mPosX += width; if(mRelY < 0) mPosY += height; } else { mPosX = mRelX; mPosY = mRelY; if(mRelX < 0) mPosX += windowWidth; if(mRelY < 0) mPosY += windowHeight; } float4x4 m = float4x4Translation((float)mPosX, (float)mPosY, 0); SetParentMatrix(m); CPUTRenderNode* pNode = mpChild; if(pNode) { ((CPUTGUIElement*)pNode)->Resize(mPosX, mPosY, mWidth, mHeight, windowWidth, windowHeight); } pNode = mpSibling; while(pNode) { ((CPUTGUIElement*)pNode)->Resize(x, y, width, height, windowWidth, windowHeight); pNode = pNode->GetSibling(); } }
void CPUTModel::UpdateRecursive( float deltaSeconds ) { if(mSkeleton && mpCurrentAnimation) { std::vector<CPUTNodeAnimation * > *jointAnimation = mpCurrentAnimation->FindJointNodeAnimation(mSkeleton->mJointsList[0].mName); for(UINT i = 0; i < mSkeleton->mNumberOfJoints && jointAnimation != NULL; ++i) { float4x4 worldXform = (*jointAnimation)[i]->Interpolate(mAnimationTime,mSkeleton->mJointsList[i],mIsLoop); UINT parentId = (UINT)mSkeleton->mJointsList[i].mParentIndex; if( parentId < 255) { mSkeleton->mJointsList[i].mRTMatrix = worldXform * mSkeleton->mJointsList[parentId].mRTMatrix; } else { mSkeleton->mJointsList[i].mRTMatrix = worldXform; } } mAnimationTime += deltaSeconds * mPlaybackSpeed; } else if(mpCurrentNodeAnimation != NULL && mpCurrentNodeAnimation->IsValidAnimation()) { SetParentMatrix(mpCurrentNodeAnimation->Interpolate(mAnimationTime,mIsLoop)); mAnimationTime += deltaSeconds * mPlaybackSpeed; } Update(deltaSeconds); if(mpSibling) { mpSibling->UpdateRecursive(deltaSeconds); } if(mpChild) { mpChild->UpdateRecursive(deltaSeconds); } }