faces working properly
This commit is contained in:
@@ -186,7 +186,7 @@ namespace Tetrahedrons
|
||||
|
||||
_transView.Projection = Matrix4.CreateOrthographic(w, w * Height / Width, -w, w);
|
||||
_transView.View = Matrix4.LookAt(Vector3.Zero, -new Vector3(1, -1, 1), Vector3.UnitZ);
|
||||
_transView.Model = Matrix4.CreateRotationZ(_t / 10);
|
||||
_transView.Model = Matrix4.CreateRotationZ(_t / 3);
|
||||
|
||||
_bufTransView = GL.GenBuffer();
|
||||
GL.BindBuffer(BufferTarget.UniformBuffer, _bufTransView);
|
||||
@@ -196,11 +196,13 @@ namespace Tetrahedrons
|
||||
|
||||
_transPent.Pivot.W = .3f;
|
||||
// _transPent.Pivot.W = (float) (Math.Sin(_t) * .6);
|
||||
var a = 3f;
|
||||
a = _t;
|
||||
_transPent.Rotate = new Matrix4(
|
||||
1, 0, 0, 0,
|
||||
0, 1, 0, 0,
|
||||
0, 0, (float) Math.Sin(_t / 5), (float) -Math.Cos(_t / 5),
|
||||
0, 0, (float) Math.Cos(_t / 5), (float) Math.Sin(_t / 5));
|
||||
0, 0, (float) Math.Sin(a / 5), (float) -Math.Cos(a / 5),
|
||||
0, 0, (float) Math.Cos(a / 5), (float) Math.Sin(a / 5));
|
||||
|
||||
_bufTransPent = GL.GenBuffer();
|
||||
GL.BindBuffer(BufferTarget.ShaderStorageBuffer, _bufTransPent);
|
||||
|
||||
@@ -66,21 +66,48 @@ void main() {
|
||||
|
||||
if (vi == 4) // points form a tetrahedron
|
||||
{
|
||||
// for(int i = 0; i < 5; i++)
|
||||
// for(int j = i + 1; j < 5; j++)
|
||||
// for(int k = j + 1; j < 5; j++)
|
||||
// {
|
||||
// hullInds[hi0 + ii++] = i;
|
||||
// hullInds[hi0 + ii++] = j;
|
||||
// hullInds[hi0 + ii++] = k;
|
||||
// }
|
||||
for(int i = 0; i < 4; i++)
|
||||
for(int j = i + 1; j < 4; j++)
|
||||
for(int k = j + 1; k < 4; k++)
|
||||
{
|
||||
hullInds[hi0 + ii++] = i;
|
||||
hullInds[hi0 + ii++] = j;
|
||||
hullInds[hi0 + ii++] = k;
|
||||
}
|
||||
}
|
||||
else if (vi == 6) { // points form a triangular prism
|
||||
for(int i = 0; i < 6; i++)
|
||||
for(int j = i + 1; j < 6; j++)
|
||||
for(int k = j + 1; k < 6; k++)
|
||||
for(int f = 0; f < 5; f++)
|
||||
{
|
||||
for(int i = 0; i < 6; i++)
|
||||
for(int j = i + 1; j < 6; j++)
|
||||
for(int k = j + 1; k < 6; k++)
|
||||
if (
|
||||
(hullInds[hi0 + 23 - 2 * i] == f ||
|
||||
hullInds[hi0 + 22 - 2 * i] == f) &&
|
||||
(hullInds[hi0 + 23 - 2 * j] == f ||
|
||||
hullInds[hi0 + 22 - 2 * j] == f) &&
|
||||
(hullInds[hi0 + 23 - 2 * k] == f ||
|
||||
hullInds[hi0 + 22 - 2 * k] == f))
|
||||
{
|
||||
hullInds[hi0 + ii++] = hv0 + i;
|
||||
hullInds[hi0 + ii++] = hv0 + j;
|
||||
hullInds[hi0 + ii++] = hv0 + k;
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
int a = hullInds[hi0 + i];
|
||||
int b = hullInds[hi0 + (1 + i) % 3];
|
||||
int c = hullInds[hi0 + 3 + i];
|
||||
int d = hullInds[hi0 + 3 + (1 + i) % 3];
|
||||
|
||||
hullInds[hi0 + ii++] = c;
|
||||
hullInds[hi0 + ii++] = a;
|
||||
hullInds[hi0 + ii++] = b;
|
||||
hullInds[hi0 + ii++] = b;
|
||||
hullInds[hi0 + ii++] = d;
|
||||
hullInds[hi0 + ii++] = c;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user