add file picking for osx and ios and implement equirectangular import

This commit is contained in:
2017-12-09 09:07:42 +00:00
parent d18b1103bb
commit f4cd7fdc62
20 changed files with 218 additions and 8 deletions

View File

@@ -456,6 +456,37 @@ void Slice9::create_impl(float w, float h, float r, float tr, GLushort *idx, Sha
*idx++ = 12; // D
*idx++ = 0; // A
}
void Sphere::create_impl(int rings, int sectors, float radius, GLushort *idx, Shape::vertex_t *vertices)
{
count[0] = rings * sectors * 6;
count[1] = 0;
ioff[0] = (GLvoid*)0;
ioff[1] = (GLvoid*)0;
float const R = 1.f / (float)(rings-1);
float const S = 1.f / (float)(sectors-1);
int r, s;
auto v = vertices;
for(r = 0; r < rings; r++) for(s = 0; s < sectors; s++) {
float const y = (float)sin( -M_PI_2 + M_PI * r * R );
float const x = (float)cos(2*M_PI * s * S) * (float)sin( M_PI * r * R );
float const z = (float)sin(2*M_PI * s * S) * (float)sin( M_PI * r * R );
*v++ = { glm::vec4(x, y, z, 1) * radius, glm::vec2(s*S, r*R) };
}
auto i = idx;
for(r = 0; r < rings-1; r++) for(s = 0; s < sectors-1; s++) {
*i++ = r * sectors + s;
*i++ = r * sectors + (s+1);
*i++ = (r+1) * sectors + (s+1);
*i++ = r * sectors + s;
*i++ = (r+1) * sectors + (s+1);
*i++ = (r+1) * sectors + s;
}
}
void ui::LineSegment::update_vertices(const glm::vec4 data[2])
{
static vertex_t vertices[2];