http://ru.wikipedia.org/wiki/Сфериче...тема_координат
я сферу создавал так :
case PMT_SPHERE:
{
s32 Detail = 50;
f32 R = 1;
s32 VtSize = Detail * Detail;
video::jeVertex_T2F_C4F_N3F_V3F * Vt = NULL;
JENEW_A(Vt,video::jeVertex_T2F_C4F_N3F_V3F,VtSize)
for(s32 V = 0; V < Detail; V++)
{
for(s32 U = 0; U < Detail; U++)
{
f32 Th = ((f32)V / (f32)(Detail-1)) * jePi;
f32 Ph = ((f32)U / (f32)(Detail-1)) * jePi * 2;
f32 STh,CTh,SPh,CPh;
jeSinCos(Th,STh,CTh);
jeSinCos(Ph,SPh,CPh);
s32 i = V*Detail + U;
Vt[i].Position.SetXYZ(R*STh*CPh,R*CTh,R*STh*SPh);
Vt[i].Color.SetColor(1,1,1,1);
Vt[i].u = ((f32)V / (f32)(Detail-1));
Vt[i].v = ((f32)U / (f32)(Detail-1));
}
}
s32 ItSize = (Detail-1)*(Detail-1)*6;
u32 * It;
JENEW_A(It,u32,ItSize)
s32 i = 0;
for(s32 V = 0; V < Detail-1; V++)
{
for(s32 U = 0; U < Detail-1; U++)
{
It[i++] = V*Detail + (U+1);
It[i++] = (V+1)*Detail + (U+1);
It[i++] = V*Detail + U;
It[i++] = (V+1)*Detail + (U+1);
It[i++] = (V+1)*Detail + U;
It[i++] = V*Detail + U;
}
}
video::jeMaterial * Material;
JENEW(Material,video::jeMaterial)
CSurface * Surface;
JENEW(Surface,CSurface)
Surface->SetSurface(CurrentRender,Material,EnableRenderOptimization);
Surface->CreateRenderOperations(video::VT_T2F_C4F_N3F_V3F,VtSize,Vt,video::IT_U32,ItSize,It);
JEDELETE_A(Vt)
JEDELETE_A(It)
CMesh * Mesh;
JENEW(Mesh,CMesh(CurrentRender))
Mesh->AddSurface(Surface);
Surface->Drop();
return Mesh;
}