I have finished 95% percent of the raytracer, and since it is written in C# and doesn't use unsafe code, I could use it with asp.net. A parser interprets XML for the raytracer and produces a final image at the bottom of the page. The online sample lacks textures and meshes, which I plan to add later. Also the documentation of the markup language is not complete, but you can get the hang of it by taking a look at the samples. Everyday I will update the raytracer and parser for the bugs. Please use the report page to report any bug or exception that comes up! You can find the website here.
Showing posts with label xna. Show all posts
Showing posts with label xna. Show all posts
Monday, December 24, 2012
Thursday, July 12, 2012
How to create a sphere programmatically in XNA
I "discovered" an easy but silly way to create a sphere programmatically in XNA, it is very simple. The idea came to me when I wanted to create huge planets in XNA to make an endless map. Any way the method is very simple, I don't know If someone knows it or it was used before, but till now it is working and efficient. You can control the resolution or how "round" the sphere is.
The code is written in C# with microsoft's XNA 4.0.
Here is a high resolution sphere in wire frame:
The sphere contains 8100 vertices and 48600 indices.
Code:
public class Sphere { VertexPositionColor[] vertices; //later, I will provide another example with VertexPositionNormalTexture VertexBuffer vbuffer; short[] indices; //my laptop can only afford Reach, no HiDef :( IndexBuffer ibuffer;
Subscribe to:
Posts (Atom)

