【C++】 DirectX初心者質問スレ 【C++】
■ このスレッドは過去ログ倉庫に格納されています
0626デフォルトの名無しさん
NGNG正五角形の表示させようとしています.
//////////////////////////////
D3DXCreateMeshFVF(3,// 面の数
5,// 頂点の数
D3DXMESH_MANAGED, FVFst, device, &m_pMesh);
// 頂点を設定
struct VERTEX *pVertex;
m_pMesh->GetVertexBuffer(&m_pVB);
m_pVB->Lock(0, 0, (void **)&pVertex, 0);
int i = 0;
pVertex[0].p = D3DXVECTOR3( 1.0f, 0.0f, 0.0f );
pVertex[1].p = D3DXVECTOR3( 0.0f, 0.0f, 0.0f );
for(i = 2; i < 5; i++)
{ pVertex[i].p = D3DXVECTOR3(
cosf(D3DXToRadian(108 * (i - 1))) * pow(-1, i) + pVertex[i - 1].p.x,
sinf(D3DXToRadian(108 * (i - 1))) * pow(-1, i) + pVertex[i - 1].p.z, 0.0f);
}
// インデックスバッファを設定
DWORD *pIndex;
m_pMesh->GetIndexBuffer(&m_pIB);
m_pIB->Lock(0, 0, (void **)&pIndex, 0);
pIndex[i++] = 4; pIndex[i++] = 3; pIndex[i++] = 0;
pIndex[i++] = 3; pIndex[i++] = 2; pIndex[i++] = 0;
pIndex[i++] = 2; pIndex[i++] = 1; pIndex[i++] = 0;
m_pIB->Unlock();
D3DXComputeNormals(m_pMesh, NULL); // 法線ベクトル
/////////////
改行が多いので2度に分けます
■ このスレッドは過去ログ倉庫に格納されています