almost, rotation shit still

This commit is contained in:
GoaLitiuM
2021-08-15 20:22:25 +03:00
parent 758c6a51f6
commit b703bb93dd
3 changed files with 72 additions and 33 deletions

View File

@@ -24,18 +24,60 @@
}
// brush 2
{
( -32 -32 112 ) ( -32 32 112 ) ( 0 0 144 ) common/slick 0 0 0 1 1 0 0 0
( 0 0 144 ) ( 32 -32 112 ) ( -32 -32 112 ) common/slick 0 0 0 1 1 0 0 0
( 32 32 112 ) ( -32 32 112 ) ( -32 -32 112 ) common/slick 0 0 0 1 1 0 0 0
( 0 0 144 ) ( -32 32 112 ) ( 32 32 112 ) common/slick 0 0 0 1 1 0 0 0
( 0 0 144 ) ( 32 32 112 ) ( 32 -32 112 ) common/slick 0 0 0 1 1 0 0 0
}
// brush 3
{
( 0 0 144 ) ( -32 32 176 ) ( -32 -32 176 ) common/slick 0 0 0 1 1 0 0 0
( 0 0 144 ) ( -32 -32 176 ) ( 32 -32 176 ) common/slick 0 0 0 1 1 0 0 0
( -32 32 176 ) ( 32 32 176 ) ( 32 -32 176 ) common/slick 0 0 0 1 1 0 0 0
( 0 0 144 ) ( 32 32 176 ) ( -32 32 176 ) common/slick 0 0 0 1 1 0 0 0
( 32 -32 176 ) ( 32 32 176 ) ( 0 0 144 ) common/slick 0 0 0 1 1 0 0 0
}
// brush 4
{
( -32 176 112 ) ( -32 176 176 ) ( 0 144 144 ) common/slick 0 0 0 1 1 0 0 0
( 0 144 144 ) ( 32 176 112 ) ( -32 176 112 ) common/slick 0 0 0 1 1 0 0 0
( 0 144 144 ) ( -32 176 176 ) ( 32 176 176 ) common/slick 0 0 0 1 1 0 0 0
( 32 176 176 ) ( -32 176 176 ) ( -32 176 112 ) common/slick 0 0 0 1 1 0 0 0
( 0 144 144 ) ( 32 176 176 ) ( 32 176 112 ) common/slick 0 0 0 1 1 0 0 0
}
// brush 5
{
( 0 144 144 ) ( -32 112 176 ) ( -32 112 112 ) common/slick 0 0 0 1 1 0 0 0
( -32 112 176 ) ( 32 112 176 ) ( 32 112 112 ) common/slick 0 0 0 1 1 0 0 0
( 0 144 144 ) ( -32 112 112 ) ( 32 112 112 ) common/slick 0 0 0 1 1 0 0 0
( 0 144 144 ) ( 32 112 176 ) ( -32 112 176 ) common/slick 0 0 0 1 1 0 0 0
( 32 112 112 ) ( 32 112 176 ) ( 0 144 144 ) common/slick 0 0 0 1 1 0 0 0
}
// brush 6
{
( -32 -32 48 ) ( -32 32 48 ) ( 0 0 80 ) common/slick 0 0 0 1 1 0 0 0
( 0 0 80 ) ( 32 -32 48 ) ( -32 -32 48 ) common/slick 0 0 0 1 1 0 0 0
( 32 32 48 ) ( -32 32 48 ) ( -32 -32 48 ) common/slick 0 0 0 1 1 0 0 0
( 0 0 80 ) ( -32 32 48 ) ( 32 32 48 ) common/slick 0 0 0 1 1 0 0 0
( 0 0 80 ) ( 32 32 48 ) ( 32 -32 48 ) common/slick 0 0 0 1 1 0 0 0
}
// brush 3
// brush 7
{
( 0 0 80 ) ( -32 32 112 ) ( -32 -32 112 ) common/slick 0 0 0 1 1 0 0 0
( 0 0 80 ) ( -32 -32 112 ) ( 32 -32 112 ) common/slick 0 0 0 1 1 0 0 0
( -32 32 112 ) ( 32 32 112 ) ( 32 -32 112 ) common/slick 0 0 0 1 1 0 0 0
( 0 0 80 ) ( 32 32 112 ) ( -32 32 112 ) common/slick 0 0 0 1 1 0 0 0
( 32 -32 112 ) ( 32 32 112 ) ( 0 0 80 ) common/slick 0 0 0 1 1 0 0 0
( 128 352 128 ) ( 128 353 128 ) ( 128 352 129 ) common/slick 64 32 90 -1 1 0 0 0
( 112 352 128 ) ( 112 352 129 ) ( 113 352 128 ) common/slick 0 0 90 1 1 0 0 0
( 112 352 128 ) ( 113 352 128 ) ( 112 353 128 ) common/slick -32 64 90 -1 1 0 0 0
( 192 432 192 ) ( 192 433 192 ) ( 193 432 192 ) common/slick -32 64 90 1 1 0 0 0
( 192 416 136 ) ( 193 416 136 ) ( 192 416 137 ) common/slick 0 0 90 -1 1 0 0 0
( 192 432 136 ) ( 192 432 137 ) ( 192 433 136 ) common/slick 64 32 90 1 1 0 0 0
}
// brush 8
{
( 256 352 128 ) ( 256 353 128 ) ( 256 352 129 ) common/slick 32 0 0 -1 1 0 0 0
( 240 352 128 ) ( 240 352 129 ) ( 241 352 128 ) common/slick 0 0 0 1 1 0 0 0
( 240 352 128 ) ( 241 352 128 ) ( 240 353 128 ) common/slick 0 32 0 -1 1 0 0 0
( 320 432 192 ) ( 320 433 192 ) ( 321 432 192 ) common/slick 0 32 0 1 1 0 0 0
( 320 416 136 ) ( 321 416 136 ) ( 320 416 137 ) common/slick 0 0 0 -1 1 0 0 0
( 320 432 136 ) ( 320 432 137 ) ( 320 433 136 ) common/slick 32 0 0 1 1 0 0 0
}
}

View File

@@ -1,11 +1,11 @@
{
"ID": "a55dc3c04da4ea3744b7f1994565beac",
"TypeName": "FlaxEditor.Content.Settings.TimeSettings",
"EngineBuild": 6221,
"EngineBuild": 6223,
"Data": {
"UpdateFPS": 120.0,
"UpdateFPS": 0.0,
"PhysicsFPS": 60.0,
"DrawFPS": 120.0,
"DrawFPS": 0.0,
"TimeScale": 1.0,
"MaxUpdateDeltaTime": 0.1
}

View File

@@ -1735,61 +1735,58 @@ namespace Game
Vector3 v2 = brushVertices[i+1];
Vector3 v3 = brushVertices[i+2];
Vector3 normal = Vector3.Cross(v3 - v1, v2 - v1).Normalized;
Vector3 normal2 = normal;//new Vector3(normal.X, normal.Z, normal.Y);
Vector3 normal = -Vector3.Cross(v3 - v1, v2 - v1).Normalized;
Vector3 normal2 = new Vector3(-normal.X, -normal.Y, -normal.Z);
// texture is projected to the surface from the closest axis
var dotX = Mathf.Abs(Vector3.Dot(normal2, Vector3.Right));
var dotY = Mathf.Abs(Vector3.Dot(normal2, Vector3.Up));
var dotZ = Mathf.Abs(Vector3.Dot(normal2, Vector3.Forward));
Vector3 theUp = Vector3.Up;
Vector3 theUp;
if (dotX > dotY && dotX > dotZ)
theUp = Vector3.Right;
else if (dotZ > dotX && dotZ > dotY)
theUp = -Vector3.Forward;
else if (dotY > dotX && dotY > dotZ)
theUp = -Vector3.Up;
else
theUp = -Vector3.Up;
//rot = Quaternion.LookRotation(theUp, Vector3.Dot(normal, Vector3.Forward) < -0.01f ? Vector3.Forward : Vector3.Up);
//theUp = Vector3.Right;
//theUp = new Vector3(theUp.X, theUp.Z, theUp.Y);
var up1 = Vector3.Up;
var up2 = -Vector3.Forward;
//theUp = Vector3.Forward;
Quaternion rot = Quaternion.LookRotation(theUp, Mathf.Abs(Vector3.Dot(theUp, up1)) > 0.01f ? up2 : up1);
rot = rot * Quaternion.RotationAxis(Vector3.Forward, 180f * Mathf.DegreesToRadians);
//rot.Invert();
Vector2 uvScale = new Vector2(1f / 1f / 64f);
Vector2 uvScale = new Vector2(0f);
float uvRotation = 0f;
Vector2 uvOffset = new Vector2(0f);
bool found = false;
foreach (var brushPlane in brush.planes)
{
Plane plane = brushPlane.plane;
if ((plane.Normal - normal).Length < 0.01f)
{
uvScale = 1f / brushPlane.scale / 64f;
//uvScale = brushPlane.scale;
uvScale = 1f / brushPlane.scale / 64f; // texture size?
uvRotation = brushPlane.rotation;
//uvScale = 1f / 512f;
uvOffset = brushPlane.offset;
found = true;
break;
}
}
if (!found)
Console.Print("no found:/");
Console.Print("no found, hidden surface?");
/*v1 = new Vector3(v1.X, v1.Z, v1.Y);
v2 = new Vector3(v2.X, v2.Z, v2.Y);
v3 = new Vector3(v3.X, v3.Z, v3.Y);*/
var finalUp = Mathf.Abs(Vector3.Dot(theUp, up1)) > 0.01f ? up2 : up1;
var finalUp2 = Mathf.Abs(Vector3.Dot(theUp, up1)) > 0.01f ? up1 : up2;
Quaternion rot = Quaternion.Identity;
rot = rot * Quaternion.LookRotation(theUp, finalUp);
rot = rot * Quaternion.RotationAxis(Vector3.Forward, 180f * Mathf.DegreesToRadians);
rot = rot * Quaternion.RotationAxis(theUp, uvRotation * Mathf.DegreesToRadians);
brushUvs[i + 0] = (Vector2)(v1 * rot) * uvScale;
brushUvs[i + 1] = (Vector2)(v2 * rot) * uvScale;
brushUvs[i + 2] = (Vector2)(v3 * rot) * uvScale;
brushUvs[i + 0] = ((Vector2)(v1 * rot) * uvScale) + uvOffset / 64f;
brushUvs[i + 1] = ((Vector2)(v2 * rot) * uvScale) + uvOffset / 64f;
brushUvs[i + 2] = ((Vector2)(v3 * rot) * uvScale) + uvOffset / 64f;
brushNormals[i + 0] = normal;
brushNormals[i + 1] = normal;