-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added local tmt copy till FCL is updated.
- Loading branch information
Showing
26 changed files
with
2,376 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package net.fexcraft.app.fmt.utils; | ||
|
||
import org.joml.Matrix4f; | ||
import org.joml.Vector3f; | ||
|
||
import net.fexcraft.lib.common.math.Vec3f; | ||
|
||
/** Taken from FVTM and adjusted/shortened. "Lite" Version. */ | ||
public class Axis3DL { | ||
|
||
private Matrix4f matrix; | ||
private float yaw, pitch, roll; | ||
|
||
public Axis3DL(){ matrix = new Matrix4f(); } | ||
|
||
@Override public String toString(){ return "[ " + yaw + "y, " + pitch + "p, " + roll + "r ]"; } | ||
|
||
public Vec3f getRelativeVector(Vec3f vec){ | ||
Matrix4f mat = new Matrix4f(); | ||
mat.m00(vec.xCoord); mat.m10(vec.yCoord); mat.m20(vec.zCoord); | ||
mat.rotate(roll * 3.14159265F / 180f, new Vector3f(1F, 0F, 0F), mat); | ||
mat.rotate(pitch * 3.14159265F / 180f, new Vector3f(0F, 0F, 1F), mat); | ||
mat.rotate(yaw * 3.14159265F / 180f, new Vector3f(0F, 1F, 0F), mat); | ||
return new Vec3f(mat.m00(), mat.m10(), mat.m20()); | ||
} | ||
|
||
private final void convertMatrixToAngles(){ | ||
yaw = (float)(Math.atan2(matrix.m20(), matrix.m00()) * 180F / 3.14159265F); | ||
pitch = (float)(Math.atan2(-matrix.m10(), Math.sqrt(matrix.m12() * matrix.m12() + matrix.m11() * matrix.m11())) * 180F / 3.14159265F); | ||
roll = (float)(Math.atan2(matrix.m12(), matrix.m11()) * 180F / 3.14159265F); | ||
} | ||
|
||
private final void convertToMatrix(boolean rad){ | ||
matrix = new Matrix4f(); | ||
matrix.rotate((float)(rad ? roll : roll * 3.14159265F / 180F), new Vector3f(1F, 0F, 0F)); | ||
matrix.rotate((float)(rad ? pitch : pitch * 3.14159265F / 180F), new Vector3f(0F, 0F, 1F)); | ||
matrix.rotate((float)(rad ? yaw : yaw * 3.14159265F / 180F), new Vector3f(0F, 1F, 0F)); | ||
convertMatrixToAngles(); | ||
} | ||
|
||
public void setAngles(float yaw, float pitch, float roll){ | ||
this.yaw = yaw; this.pitch = pitch; this.roll = roll; convertToMatrix(false); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package net.fexcraft.lib.local_tmt; | ||
|
||
/** | ||
* This class represents a coordinate space and its UV coordinates. This allows for | ||
* easier flat shape planning. | ||
* @author GaryCXJk | ||
* | ||
*/ | ||
public class Coord2D { | ||
|
||
public float xCoord; | ||
public float yCoord; | ||
public int uCoord; | ||
public int vCoord; | ||
|
||
public Coord2D(float x, float y){ | ||
xCoord = x; | ||
yCoord = y; | ||
uCoord = (int)Math.floor(x); | ||
vCoord = (int)Math.floor(y); | ||
} | ||
|
||
|
||
public Coord2D(float x, float y, int u, int v){ | ||
this(x, y); | ||
uCoord = u; | ||
vCoord = v; | ||
} | ||
|
||
} |
Oops, something went wrong.