Mega link:
some code snippets lol
D3Device.cpp
TachyonObject.cpp
You must be registered to see links
some code snippets lol
D3Device.cpp
You must be registered to see links
Code:
void CD3DDevice::SetTransforms(size_t count, LPD3DXMATRIX matrices){ static LPDIRECT3DTEXTURE9 boneTexture = nullptr; DWORD NumBones = MAX_PIVOT + 1; DWORD BonesMat = 4; // pixels per bone DWORD TexWidth = NumBones * BonesMat; DWORD TexHeight = 1; // skeletons if(!boneTexture) m_pDevice->CreateTexture(TexWidth, TexHeight, 1, D3DUSAGE_DYNAMIC, D3DFMT_A32B32G32R32F, D3DPOOL_DEFAULT, &boneTexture, NULL); D3DLOCKED_RECT rect; boneTexture->LockRect(0, &rect, NULL, D3DLOCK_DISCARD); ZeroMemory(rect.pBits, NumBones * sizeof(D3DXMATRIX)); memcpy(rect.pBits, &matrices[0], count * sizeof(D3DXMATRIX)); boneTexture->UnlockRect(0); if (FAILED(m_pEffect->SetFloat("OneOverWidth", 1.0f / TexWidth))) { CTConsole::GetInstance()->Output("Failed to set OneOverAnimTexWidth!\n"); } if (FAILED(m_pEffect->SetFloat("OneOverHeight", 1.0f / TexHeight))) { CTConsole::GetInstance()->Output("Failed to set OneOverAnimTexHeight!\n"); } if (FAILED(m_pEffect->SetTexture("bonetexture", boneTexture))) { CTConsole::GetInstance()->Output("Failed to set bone texture!\n"); }}
TachyonObject.cpp
You must be registered to see links
Code:
void CTachyonObject::ApplyMatrix(CD3DDevice *pDevice){ LPANI pANI = GetCurANI(); if (pANI && pANI->m_pANI) { pANI->m_pANI->m_fCurTime = m_fActTime; LPANIDATA pDATA = pANI->m_pANI->GetAniData(); if (pDATA && pDATA->m_pAni) { D3DXMATRIX* vWORLD = new D3DXMATRIX[MAX_PIVOT + 1]; FLOAT fBlendTime = FLOAT(m_dwBlendTick) / FLOAT(m_dwBlend); BYTE bBlend = (m_dwBlendTick < m_dwBlend ? TRUE : FALSE) && m_bBlend; LPD3DXMATRIX pInit = GetMeshMatrix(); pDATA->m_pAni->GetFrameMatrix( m_pBone, bBlend ? m_pBlend : NULL, bBlend ? m_pBlendKEY : NULL, m_pPivot, m_vPosition, 0, pANI->m_pANI->m_fLocalTime, fBlendTime); int nNodes = pDATA->m_pAni->GetNodeCount(); vWORLD[0] = m_pBone[0]; for (int i = 0; i < nNodes; i++) vWORLD[1 + i] = pInit ? (pInit[i] * m_pBone[i + 1]) : m_pBone[i + 1]; pDevice->SetTransforms(MAX_PIVOT + 1, vWORLD); delete[] vWORLD; vWORLD = NULL; } else { pDevice->SetTransforms(1, &m_vPosition); } } else { pDevice->SetTransforms(1, &m_vPosition); }}
Last edited: