Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using SharpDX;
- using SharpDX.Direct3D11;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using VoidwalkerEngine.Framework.Maths;
- namespace VoidwalkerEngine.Framework.DirectX.Rendering
- {
- public static class Wireframe
- {
- public static ModelMesh GenerateWireframeSphere(Device device, Vector3 location, float radius)
- {
- float pi = (float)Math.PI;
- List<Vertex> vertices = new List<Vertex>();
- for (float angle = 0f; angle <= 2 * pi; angle += 0.01f)
- {
- float x = radius * (float)Math.Sin(angle);
- float y = radius * (float)Math.Cos(angle);
- float z = 0;
- vertices.Add(new Vertex(location.X + x, location.Y + y, location.Z + z));
- }
- for (float angle = 0f; angle <= 2 * pi; angle += 0.01f)
- {
- float x = radius * (float)Math.Sin(angle);
- float y = 0;
- float z = radius * (float)Math.Cos(angle);
- vertices.Add(new Vertex(location.X + x, location.Y + y, location.Z + z));
- }
- for (float angle = 0f; angle <= 2 * pi; angle += 0.01f)
- {
- float x = 0;
- float y = radius * (float)Math.Sin(angle);
- float z = radius * (float)Math.Cos(angle);
- vertices.Add(new Vertex(location.X + x, location.Y + y, location.Z + z));
- }
- ModelMesh mesh = new ModelMesh(device, vertices.ToArray());
- return mesh;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement