태그 : DirectX
2009/06/26 [3D][DirectX] 물에 잠기는 알파오브젝트
2009/05/25 [3D][DirectX] Solar System
2009/04/23 [3D][DirectX] Cylinder World
2009/04/08 [3D][DirectX] 평면위에 굴러가는 주사위 [6]

# by | 2009/10/27 01:49 | Workshop | 트랙백 | 덧글(0)





# by | 2009/06/26 23:51 | Programming | 트랙백 | 덧글(0)
bool CPlanet::Draw(LPDIRECT3DDEVICE9 pD3DDevice, D3DXMATRIXMotherTranslation) {
pD3DDevice->SetTransform(D3DTS_WORLD,
&(SelfRotation* MotherRotation * MotherTranslation));
this->m_pMesh->Render(pD3DDevice);
for(int Count = 0;Count < Child.size(); Count++)
Child[Count]->Draw(pD3DDevice, this->MotherRotation * MotherTranslation);
return true;
}
부모의 위치좌표를 넘겨 받습니다.
그리고 자전회전 * 공전회전 * 부모위치을 차례로 곱해서 혹성의 위치를 구합니다.
자신을 그리면 자전을 제외한 위치행열을 자식에게 전달합니다.
이렇게하면 모든 혹성을 루프를 통해 일괄적으로 넣을수도 있죠.
# by | 2009/05/25 00:16 | Workshop | 트랙백 | 덧글(0)

if(this->mBreadth== true)
this->mRollCylinder.m_mtxWorldRotation*= this->mAnimationBreadthRollMatrix;
else
this->mRollCylinder.m_mtxWorldRotation*= this->mAnimationNonBreadthRollMatrix;
D3DXMatrixTranslation(&Trans, MovementX, 0.0f,MovementZ);
Trans = this->mRollCylinder.m_mtxWorld* Trans;
// 필요한 버텍스마다 체크
D3DXVec3TransformCoord(&TestVec3, &TestVec3,&Trans);
// 이동 범위검사.
D3DXVECTOR3 TestVec3(0.0f, 0.0f, 0.0f);
D3DXVec3TransformCoord(&TestVec3, &TestVec3, &this->mRollCylinder.m_mtxWorld);
// 회전 범위검사
D3DXVECTOR3 Target(0.0f, 0.0f, 0.0f);
D3DXVec3TransformCoord(&Target, &Target, &this->mRollCylinder.m_mtxWorld);
D3DXVECTOR3 Bullet(NewX, NewY, NewZ);
D3DXVECTOR3 TargetDirection = Target - Bullet;
D3DXVec3Normalize(&TargetDirection, &TargetDirection);
D3DXMatrixTranslation(&mSpeedMatrix[Index], TargetDirection.x* Speed,
TargetDirection.y* Speed, TargetDirection.z * Speed);
D3DXMATRIX NewTrans, NewRot1, NewRot2;
D3DXMatrixTranslation(&NewTrans, NewX, NewY, NewZ);
D3DXVECTOR3 Pos(NewX, NewY, NewZ);
D3DXVECTOR3 LOOK = Target;
D3DXVECTOR3 UP;
D3DXVec3Cross(&UP, &Pos, &LOOK);
D3DXMatrixLookAtLH(&NewRot1, &Pos, &LOOK,&UP);
NewRot1._41 = 0.0f; NewRot1._42= 0.0f; NewRot1._43 = 0.0f;
D3DXMatrixInverse(&NewRot1, NULL, &NewRot1);
D3DXMatrixRotationX(&NewRot2, D3DX_PI / 2);
this->mBulletCylinder[Index].m_mtxWorld = NewRot2 *NewRot1 * NewTrans;
D3DXMatrixInverse(&this->mView,NULL, &this->mBulletCylinder[0].m_mtxWorld);


# by | 2009/04/23 12:36 | Workshop | 트랙백 | 덧글(0)
PS2초기 타이틀중 XI5라는 게임이 있습니다. 

◀ 이전 페이지 다음 페이지 ▶