• API
• FAQ
• Tools
• Archive
daily pastebin goal
89%
SHARE
TWEET

# Untitled

a guest Sep 19th, 2017 51 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1.     int segments = 32;
2.     int sides = 32;
5.
6.     for (int i = 0; i < segments; ++i)
7.     {
8.         for (int j = 0; j < sides; ++j)
9.         {
10.             float theta1 = -DirectX::XM_2PI * i / (segments - 1) + 2 * DirectX::XM_PIDIV2;
11.             float phi1 = -DirectX::XM_2PI * j / sides;
12.
13.             float theta2 = DirectX::XM_PI * i / (segments - 1);
14.             float phi2 = -DirectX::XM_2PI * j / sides;
15.
17.             Vertex v2(std::cosf(phi2) * std::sinf(theta2) * radius1, std::sinf(phi2) * std::sinf(theta2) * radius1, std::cosf(theta2) * radius1, (float)i / segments, (float)j / sides);
18.             m_Vertices.push_back(VertexLerp(v1, v2, morphFactor));
19.
20.             if (i < sides - 1)
21.             {
22.                 unsigned int jplus1 = (j == sides - 1) ? 0 : (j + 1);
23.                 m_Indices.push_back((i + 1) * sides + j);
24.                 m_Indices.push_back(i * sides + j);
25.                 m_Indices.push_back(i * sides + jplus1);
26.
27.                 m_Indices.push_back((i + 1) * sides + j);
28.                 m_Indices.push_back(i * sides + jplus1);
29.                 m_Indices.push_back((i + 1) * sides + jplus1);
30.             }
31.         }
32.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.

Top