Я рендерил плоскость шестнадцатеричной сетки, получая результат: http://gyazo.com/0a008cc909138c7e3c1368e0078c7695
Сетка искажена.Помогите пожалуйста - в чем может быть причина этого и как это исправить?Я полагаю, что это происходит из-за наложения прозрачных пленок, но я не знаю, как разрешить его, не меняя сетку на гекс.* Фрагмент шейдера:
vec4 textureColor0 = texture2D(uSampler0, vec2(vTextureCoord.s, vTextureCoord.t));
gl_FragColor = vec4(textureColor0.rgb, textureColor0.a);
Положение сетки: -10, -10, -26,99f, а камеры: -5, -2, -20 и угол обзора: -8, 0, -22
Код генерации сетки:
public static MeshData makePlane(int w, int h) {
float[] planeVerts = new float[12 * w * h];
float[] planeNormals = new float[planeVerts.length];
float[] planeTexCoords = new float[8 * w * h];
int[] planeTriangles = new int[6 * w * h];
{
int idx = 0;
for (int x = 0; x < w; x++) {
for (int y = 0; y < h; y++) {
planeVerts[idx] = x * 0.8f;
planeVerts[idx + 1] = y + 0.5f * x;
planeVerts[idx + 2] = 0;
planeVerts[idx + 3] = x * 0.8f;
planeVerts[idx + 4] = y + 1 + 0.5f * x;
planeVerts[idx + 5] = 0;
planeVerts[idx + 6] = x * 0.8f + 1;
planeVerts[idx + 7] = y + 1 + 0.5f * x;
planeVerts[idx + 8] = 0;
planeVerts[idx + 9] = x * 0.8f + 1;
planeVerts[idx + 10] = y + 0.5f * x;
planeVerts[idx + 11] = 0;
idx += 12;
}
}
}
for (int i = 0; i < planeVerts.length; i+=3) {
planeNormals[i] = 0;
planeNormals[i + 1] = 0;
planeNormals[i + 2] = 1;
}
for (int idx = 0; idx < planeTexCoords.length; idx += 8) {
if (idx % 32 == 0) {
planeTexCoords[idx] = 0;
planeTexCoords[idx + 1] = 0.5f;
planeTexCoords[idx + 2] = 0;
planeTexCoords[idx + 3] = 0;
planeTexCoords[idx + 4] = 0.5f;
planeTexCoords[idx + 5] = 0;
planeTexCoords[idx + 6] = 0.5f;
planeTexCoords[idx + 7] = 0.5f;
} else {
planeTexCoords[idx] = 0;
planeTexCoords[idx + 1] = 1;
planeTexCoords[idx + 2] = 0;
planeTexCoords[idx + 3] = 0.5f;
planeTexCoords[idx + 4] = 0.5f;
planeTexCoords[idx + 5] = 0.5f;
planeTexCoords[idx + 6] = 0.5f;
planeTexCoords[idx + 7] = 1;
}
}
for (int idx = 0; idx < planeTriangles.length; idx += 6) {
planeTriangles[idx] = idx * 4 / 6;
planeTriangles[idx + 1] = idx * 4 / 6 + 1;
planeTriangles[idx + 2] = idx * 4 / 6 + 2;
planeTriangles[idx + 3] = idx * 4 / 6;
planeTriangles[idx + 4] = idx * 4 / 6 + 2;
planeTriangles[idx + 5] = idx * 4 / 6 + 3;
}
return new MeshData(planeVerts, planeTriangles, planeNormals, planeTexCoords);
}