remove glm swizzling for better debugability

This commit is contained in:
2017-11-12 17:39:30 +00:00
parent e280629cf2
commit 4473bc8bd4
9 changed files with 63 additions and 49 deletions

View File

@@ -214,10 +214,10 @@ void ui::Plane::update_vertices(const glm::vec4* data)
static vertex_t vertices[4];
glm::vec2 mid;
segments_intersect(data[0].xy, data[2].xy, data[1].xy, data[3].xy, mid);
segments_intersect(xy(data[0]), xy(data[2]), xy(data[1]), xy(data[3]), mid);
static float d[4];
for (int i = 0; i < 4; i++)
d[i] = glm::distance(data[i].xy(), mid);
d[i] = glm::distance(xy(data[i]), mid);
vertices[0] = { data[0],{ 0, 0 } }; // A
vertices[1] = { data[1],{ 0, 1 } }; // B
@@ -385,8 +385,8 @@ void Rounded::create_impl(float w, float h, float r, int div, GLushort* idx, GLu
for (int i = 1; i < div; i++)
{
float t = (float)(i) / div;
auto p = glm::normalize(glm::mix(v[a].pos.xyz()-v[c].pos.xyz(), v[b].pos.xyz()-v[c].pos.xyz(), t));
v[n].pos = glm::vec4(p * r + v[c].pos.xyz(), 1);
auto p = glm::normalize(glm::mix(xyz(v[a].pos)-xyz(v[c].pos), xyz(v[b].pos)-xyz(v[c].pos), t));
v[n].pos = glm::vec4(p * r + xyz(v[c].pos), 1.0f);
v[n].uvs = glm::normalize(glm::mix(v[a].uvs-v[c].uvs, v[b].uvs-v[c].uvs, t)) * glm::vec2(r/w, r/h) + v[c].uvs;
idx_tmp[i] = n;
n++;