fix transform commit shader
This commit is contained in:
@@ -173,10 +173,10 @@ bool RectShape::create(float w, float h)
|
||||
3, 0,
|
||||
};
|
||||
static vertex_t vertices[4];
|
||||
vertices[0] = { { -w/2, -h/2, 0, 1 }, { 0, 0 } }; // A
|
||||
vertices[1] = { { -w/2, h/2, 0, 1 }, { 0, 1 } }; // B
|
||||
vertices[2] = { { w/2, 0, 0, 1 }, { 1, 1 } }; // C
|
||||
vertices[3] = { { w/2, -h/2, 0, 1 }, { 1, 0 } }; // D
|
||||
vertices[0] = { { -w/2, -h/2, 0, 1 }, { 0, 0 }, { 0, 0 } }; // A
|
||||
vertices[1] = { { -w/2, h/2, 0, 1 }, { 0, 1 }, { 0, 1 } }; // B
|
||||
vertices[2] = { { w/2, 0, 0, 1 }, { 1, 1 }, { 1, 1 } }; // C
|
||||
vertices[3] = { { w/2, -h/2, 0, 1 }, { 1, 0 }, { 1, 0 } }; // D
|
||||
count[0] = 6;
|
||||
count[1] = 8;
|
||||
ioff[0] = (GLvoid*)0;
|
||||
@@ -269,7 +269,7 @@ bool ui::HeightmapPlane::create(float w, float h, const Image& img, float scale)
|
||||
v.pos.y = oy + dy * (float)y;
|
||||
v.pos.z = (*px++).r / 255.f * scale;
|
||||
v.pos.w = 1;
|
||||
v.uvs = glm::vec2(x, y) / (float)div;
|
||||
v.uvs2 = v.uvs = glm::vec2(x, y) / (float)div;
|
||||
*pv++ = v;
|
||||
}
|
||||
}
|
||||
@@ -371,7 +371,7 @@ void Circle::create_impl(float radius, int div, GLushort* idx, vertex_t* vertice
|
||||
float theta = (float)i / div * (float)M_PI * 2.f;
|
||||
glm::vec2 uv = { sinf(theta), cosf(theta) };
|
||||
v.pos = glm::vec4(uv * radius, 0, 1);
|
||||
v.uvs = uv * 0.5f + 0.5f;
|
||||
v.uvs2 = v.uvs = uv * 0.5f + 0.5f;
|
||||
vertices[i+1] = v;
|
||||
|
||||
*pidx++ = 0;
|
||||
@@ -382,7 +382,7 @@ void Circle::create_impl(float radius, int div, GLushort* idx, vertex_t* vertice
|
||||
*pidx2++ = 1 + ((i+1) % div);
|
||||
}
|
||||
vertices[0].pos = { 0, 0, 0, 1 };
|
||||
vertices[0].uvs = { 0.5f, 0.5f };
|
||||
vertices[0].uvs2 = vertices[0].uvs = { 0.5f, 0.5f };
|
||||
}
|
||||
|
||||
void Circle::create_impl(float radius_out, float radius_in, int div, GLushort* idx, vertex_t* vertices, kUVMapping map)
|
||||
@@ -400,13 +400,13 @@ void Circle::create_impl(float radius_out, float radius_in, int div, GLushort* i
|
||||
glm::vec2 uv = { sinf(theta), cosf(theta) };
|
||||
if (map == kUVMapping::Planar)
|
||||
{
|
||||
vertices[i*2].uvs = uv * (radius_in/radius_out) * 0.5f + 0.5f;
|
||||
vertices[i*2+1].uvs = uv * 0.5f + 0.5f;
|
||||
vertices[i*2].uvs2 = vertices[i*2].uvs = uv * (radius_in/radius_out) * 0.5f + 0.5f;
|
||||
vertices[i*2+1].uvs2 = vertices[i*2+1].uvs = uv * 0.5f + 0.5f;
|
||||
}
|
||||
else
|
||||
{
|
||||
vertices[i*2].uvs = { (float)i / div, 0.f }; // inner
|
||||
vertices[i*2+1].uvs = { (float)i / div, 1.f};// outer
|
||||
vertices[i*2].uvs2 = vertices[i*2].uvs = { (float)i / div, 0.f }; // inner
|
||||
vertices[i*2+1].uvs2 = vertices[i*2+1].uvs = { (float)i / div, 1.f};// outer
|
||||
}
|
||||
vertices[i*2].pos = glm::vec4(uv * radius_in, 0, 1);
|
||||
vertices[i*2+1].pos = glm::vec4(uv * radius_out, 0, 1);
|
||||
@@ -496,7 +496,7 @@ void Rounded::create_impl(float w, float h, float r, int div, GLushort* idx, GLu
|
||||
float t = (float)(i) / div;
|
||||
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;
|
||||
v[n].uvs2 = 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++;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user