浏览代码

Corrected DrawSphereWires() function

pull/3/head
raysan5 10 年前
父节点
当前提交
aff8d151a4
共有 1 个文件被更改,包括 20 次插入20 次删除
  1. +20
    -20
      src/models.c

+ 20
- 20
src/models.c 查看文件

@ -285,7 +285,7 @@ void DrawSphereEx(Vector3 centerPos, float radius, int rings, int slices, Color
rlBegin(RL_TRIANGLES); rlBegin(RL_TRIANGLES);
rlColor4ub(color.r, color.g, color.b, color.a); rlColor4ub(color.r, color.g, color.b, color.a);
for(int i = 0; i < mi">2 * rings + (rings / 3); i++)
for(int i = 0; i < p">(rings + 2); i++)
{ {
for(int j = 0; j < slices; j++) for(int j = 0; j < slices; j++)
{ {
@ -319,7 +319,7 @@ void DrawSphereWires(Vector3 centerPos, float radius, int rings, int slices, Col
{ {
rlPushMatrix(); rlPushMatrix();
rlTranslatef(centerPos.x, centerPos.y, centerPos.z); rlTranslatef(centerPos.x, centerPos.y, centerPos.z);
o">//rlScalef(radius, radius, radius);
rlScalef(radius, radius, radius);
//rlRotatef(rotation, 0, 1, 0); //rlRotatef(rotation, 0, 1, 0);
rlBegin(RL_LINES); rlBegin(RL_LINES);
@ -329,26 +329,26 @@ void DrawSphereWires(Vector3 centerPos, float radius, int rings, int slices, Col
{ {
for(int j = 0; j < slices; j++) for(int j = 0; j < slices; j++)
{ {
rlVertex3f(cos(DEG2RAD*(270+(180/(rings + 1))*i)) * sin(DEG2RAD*(j*360/slices)) * radius,
sin(DEG2RAD*(270+(180/(rings + 1))*i)) * radius,
cos(DEG2RAD*(270+(180/(rings + 1))*i)) * cos(DEG2RAD*(j*360/slices)) * radius);
rlVertex3f(cos(DEG2RAD*(270+(180/(rings + 1))*(i+1))) * sin(DEG2RAD*((j+1)*360/slices)) * radius,
sin(DEG2RAD*(270+(180/(rings + 1))*(i+1))) * radius,
cos(DEG2RAD*(270+(180/(rings + 1))*(i+1))) * cos(DEG2RAD*((j+1)*360/slices)) * radius);
rlVertex3f(cos(DEG2RAD*(270+(180/(rings + 1))*i)) * sin(DEG2RAD*(j*360/slices)),
sin(DEG2RAD*(270+(180/(rings + 1))*i)),
cos(DEG2RAD*(270+(180/(rings + 1))*i)) * cos(DEG2RAD*(j*360/slices)));
rlVertex3f(cos(DEG2RAD*(270+(180/(rings + 1))*(i+1))) * sin(DEG2RAD*((j+1)*360/slices)),
sin(DEG2RAD*(270+(180/(rings + 1))*(i+1))),
cos(DEG2RAD*(270+(180/(rings + 1))*(i+1))) * cos(DEG2RAD*((j+1)*360/slices)));
rlVertex3f(cos(DEG2RAD*(270+(180/(rings + 1))*(i+1))) * sin(DEG2RAD*((j+1)*360/slices)) * radius,
sin(DEG2RAD*(270+(180/(rings + 1))*(i+1))) * radius,
cos(DEG2RAD*(270+(180/(rings + 1))*(i+1))) * cos(DEG2RAD*((j+1)*360/slices)) * radius);
rlVertex3f(cos(DEG2RAD*(270+(180/(rings + 1))*(i+1))) * sin(DEG2RAD*(j*360/slices)) * radius,
sin(DEG2RAD*(270+(180/(rings + 1))*(i+1))) * radius,
cos(DEG2RAD*(270+(180/(rings + 1))*(i+1))) * cos(DEG2RAD*(j*360/slices)) * radius);
rlVertex3f(cos(DEG2RAD*(270+(180/(rings + 1))*(i+1))) * sin(DEG2RAD*((j+1)*360/slices)),
sin(DEG2RAD*(270+(180/(rings + 1))*(i+1))),
cos(DEG2RAD*(270+(180/(rings + 1))*(i+1))) * cos(DEG2RAD*((j+1)*360/slices)));
rlVertex3f(cos(DEG2RAD*(270+(180/(rings + 1))*(i+1))) * sin(DEG2RAD*(j*360/slices)),
sin(DEG2RAD*(270+(180/(rings + 1))*(i+1))),
cos(DEG2RAD*(270+(180/(rings + 1))*(i+1))) * cos(DEG2RAD*(j*360/slices)));
rlVertex3f(cos(DEG2RAD*(270+(180/(rings + 1))*(i+1))) * sin(DEG2RAD*(j*360/slices)) * radius,
sin(DEG2RAD*(270+(180/(rings + 1))*(i+1))) * radius,
cos(DEG2RAD*(270+(180/(rings + 1))*(i+1))) * cos(DEG2RAD*(j*360/slices)) * radius);
rlVertex3f(cos(DEG2RAD*(270+(180/(rings + 1))*i)) * sin(DEG2RAD*(j*360/slices)) * radius,
sin(DEG2RAD*(270+(180/(rings + 1))*i)) * radius,
cos(DEG2RAD*(270+(180/(rings + 1))*i)) * cos(DEG2RAD*(j*360/slices)) * radius);
rlVertex3f(cos(DEG2RAD*(270+(180/(rings + 1))*(i+1))) * sin(DEG2RAD*(j*360/slices)),
sin(DEG2RAD*(270+(180/(rings + 1))*(i+1))),
cos(DEG2RAD*(270+(180/(rings + 1))*(i+1))) * cos(DEG2RAD*(j*360/slices)));
rlVertex3f(cos(DEG2RAD*(270+(180/(rings + 1))*i)) * sin(DEG2RAD*(j*360/slices)),
sin(DEG2RAD*(270+(180/(rings + 1))*i)),
cos(DEG2RAD*(270+(180/(rings + 1))*i)) * cos(DEG2RAD*(j*360/slices)));
} }
} }
rlEnd(); rlEnd();

正在加载...
取消
保存