Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Zombie

Sphere in D3D

This topic is 6783 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Does someone have a function that creates a 3d sphere in VB (Direct3D)? I need it to do planets, stars etc.

Share this post


Link to post
Share on other sites
Advertisement
I don''t know a d3d function for it, but you could calculate the vertices with
x = r*cos(u)*cos(v)
y = r*sin(u)*cos(v)
z = r*sin(v)

with u and v running from 0° to 360°

Visit our homepage: www.rarebyte.de.st

GA

Share this post


Link to post
Share on other sites
Actually, you forgot to turn degrees into radians.

Try this:

Function Circle3D(Radius As Single, AngleA As Single, AngleB As Single) As D3DVECTOR
On Error Resume Next
Dim AA As Single
Dim AB As Single
AA = AngleA * 3.14 / 180
AB = AngleB * 3.14 / 180

With Circle3D
.X = Radius * Cos(AA) * Cos(AB)
.Y = Radius * Sin(AB)
.Z = Radius * Sin(AA) * Cos(AB)
End With
End Function


AngleAA is Horizontal and AngleAB is Vertical. This is straight from my program so the variables are kinda screwy

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!