This way when the sky is animated, it looks like the cyclone blowing off one way and sucking into the other way. Second problem is the sky seems too small when the dome radius is 11000m long, it is already 11km long. And also the texture looks a bit blurry, the texture size is 1280x720..
if (SUCCEEDED(texMesh->LockVertexBuffer(0, (void**)&pVerts)))
{
std::vector<D3DXVECTOR3> poses;
int numVerts = texMesh->GetNumVertices();
for (int i = 0; i < numVerts; i++)
{
poses.push_back(pVerts[i].pos);
}
D3DXVECTOR3 vMin, vMax;
D3DXComputeBoundingBox(&poses[0], numVerts, sizeof(D3DXVECTOR3) , &vMin, &vMax);
D3DXVECTOR3 vCent;
vCent = (vMax+vMin)*0.5f;
for (int i = 0; i < numVerts; i++)
{
D3DXVECTOR3 v;
v = pVerts[i].pos - vCent;
D3DXVec3Normalize(&v, &v);
pVerts[i].norm = v;
pVerts[i].tu = asinf(v.x)/D3DX_PI+0.5f;
pVerts[i].tv = asinf(v.y)/D3DX_PI+0.5f;
}
}
↧