Skip to content

Commit

Permalink
Added local tmt copy till FCL is updated.
Browse files Browse the repository at this point in the history
  • Loading branch information
Fexcraft committed Feb 20, 2020
1 parent b9a9046 commit aa8eabe
Show file tree
Hide file tree
Showing 26 changed files with 2,376 additions and 32 deletions.
4 changes: 2 additions & 2 deletions src/net/fexcraft/app/fmt/FMTB.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
import net.fexcraft.lib.common.math.Time;
import net.fexcraft.lib.common.utils.HttpUtil;
import net.fexcraft.lib.common.utils.Print;
import net.fexcraft.lib.tmt.ModelRendererTurbo;
import net.fexcraft.lib.local_tmt.ModelRendererTurbo;

/**
* @author Ferdinand Calo' (FEX___96)
Expand All @@ -88,7 +88,7 @@ public class FMTB {

public static final String deftitle = "[FPS:%s] Fexcraft Modelling Toolbox - %s";
public static final String deftitle0 = "Fexcraft Modelling Toolbox - %s";
public static final String version = "2.0.1";
public static final String version = "2.0.2";
public static final String CLID = "587016218196574209";
//
public static GGR ggr;
Expand Down
2 changes: 1 addition & 1 deletion src/net/fexcraft/app/fmt/demo/ModelSteve.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import org.lwjgl.opengl.GL11;

import net.fexcraft.lib.tmt.ModelRendererTurbo;
import net.fexcraft.lib.local_tmt.ModelRendererTurbo;

public class ModelSteve {

Expand Down
18 changes: 7 additions & 11 deletions src/net/fexcraft/app/fmt/demo/ModelT1P.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import net.fexcraft.lib.common.Static;
import net.fexcraft.lib.common.math.RGB;
import net.fexcraft.lib.local_tmt.ModelRendererTurbo;
import net.fexcraft.lib.tmt.ModelBase;
import net.fexcraft.lib.tmt.ModelRendererTurbo;


/**
Expand Down Expand Up @@ -1236,22 +1236,18 @@ public void render(){
} bodyLines.render();*/
}

private void render(ModelRendererTurbo[] model){
for(ModelRendererTurbo turbo : model) turbo.render();
}

@Override
public void translate(float x, float y, float z){
translate(body, x, y, z);
translate(body_door_open_colored_primary, x, y, z);
translate(body_door_close_colored_primary, x, y, z);
translate(body_colored_primary, x, y, z);
translate(body_colored_secondary, x, y, z);
//
}

@Override
public void rotate(float x, float y, float z){
rotate(body, x, y, z);
rotate(body_door_open_colored_primary, x, y, z);
rotate(body_door_close_colored_primary, x, y, z);
rotate(body_colored_primary, x, y, z);
rotate(body_colored_secondary, x, y, z);
//
}

}
2 changes: 1 addition & 1 deletion src/net/fexcraft/app/fmt/porters/DFMExporter.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import net.fexcraft.app.fmt.wrappers.TurboList;
import net.fexcraft.lib.common.math.TexturedPolygon;
import net.fexcraft.lib.common.math.TexturedVertex;
import net.fexcraft.lib.tmt.ModelRendererTurbo;
import net.fexcraft.lib.local_tmt.ModelRendererTurbo;

/**
*
Expand Down
2 changes: 1 addition & 1 deletion src/net/fexcraft/app/fmt/porters/MTBImporter.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import net.fexcraft.lib.common.math.Vec3f;
import net.fexcraft.lib.common.utils.Print;
import net.fexcraft.lib.common.utils.ZipUtil;
import net.fexcraft.lib.tmt.ModelRendererTurbo;
import net.fexcraft.lib.local_tmt.ModelRendererTurbo;

/**
* @author EternalBlueFlame, FEX___96
Expand Down
2 changes: 1 addition & 1 deletion src/net/fexcraft/app/fmt/porters/OBJPrototypeExporter.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

import net.fexcraft.app.fmt.FMTB;
import net.fexcraft.app.fmt.porters.PorterManager.ExImPorter;
import net.fexcraft.app.fmt.utils.Axis3DL;
import net.fexcraft.app.fmt.utils.Settings.Setting;
import net.fexcraft.app.fmt.utils.Settings.Type;
import net.fexcraft.app.fmt.wrappers.GroupCompound;
Expand All @@ -19,7 +20,6 @@
import net.fexcraft.lib.common.math.TexturedPolygon;
import net.fexcraft.lib.common.math.TexturedVertex;
import net.fexcraft.lib.common.math.Vec3f;
import net.fexcraft.lib.tmt.Axis3DL;

/**
* ALL RIGHTS RESERVED. © 2019 Fexcraft.net
Expand Down
2 changes: 1 addition & 1 deletion src/net/fexcraft/app/fmt/ui/tree/SubTreeGroup.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public SubTreeGroup(TreeBase base, PolygonWrapper wrapper){
Editors.show("general");
}, "edit"));
label.getListenerMap().addListener(MouseClickEvent.class, listener -> {
if(listener.getAction() != CLICK || listener.getButton() != MouseButton.MOUSE_BUTTON_LEFT) return;
if(list == null || listener.getAction() != CLICK || listener.getButton() != MouseButton.MOUSE_BUTTON_LEFT) return;
boolean sell = list.selected; if(!GGR.isShiftDown()){ FMTB.MODEL.clearSelection(); }
list.selected = !sell; FMTB.MODEL.updateFields(); FMTB.MODEL.lastselected = null; updateColor();
GroupCompound.SELECTED_POLYGONS = FMTB.MODEL.countSelectedMRTs();
Expand Down
45 changes: 45 additions & 0 deletions src/net/fexcraft/app/fmt/utils/Axis3DL.java
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);
}

}
2 changes: 1 addition & 1 deletion src/net/fexcraft/app/fmt/wrappers/BoxWrapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import com.google.gson.JsonObject;

import net.fexcraft.lib.common.math.Vec3f;
import net.fexcraft.lib.tmt.ModelRendererTurbo;
import net.fexcraft.lib.local_tmt.ModelRendererTurbo;

public class BoxWrapper extends PolygonWrapper {

Expand Down
2 changes: 1 addition & 1 deletion src/net/fexcraft/app/fmt/wrappers/CylinderWrapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import net.fexcraft.app.fmt.ui.editor.GeneralEditor;
import net.fexcraft.lib.common.math.Vec3f;
import net.fexcraft.lib.tmt.ModelRendererTurbo;
import net.fexcraft.lib.local_tmt.ModelRendererTurbo;

public class CylinderWrapper extends PolygonWrapper {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import com.google.gson.JsonObject;

import net.fexcraft.lib.common.math.Vec3f;
import net.fexcraft.lib.tmt.ModelRendererTurbo;
import net.fexcraft.lib.local_tmt.ModelRendererTurbo;

public class FlexTrapezoidWrapper extends BoxWrapper {

Expand Down
2 changes: 1 addition & 1 deletion src/net/fexcraft/app/fmt/wrappers/FlexboxWrapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import com.google.gson.JsonObject;

import net.fexcraft.lib.common.math.Vec3f;
import net.fexcraft.lib.tmt.ModelRendererTurbo;
import net.fexcraft.lib.local_tmt.ModelRendererTurbo;

public class FlexboxWrapper extends BoxWrapper {

Expand Down
2 changes: 1 addition & 1 deletion src/net/fexcraft/app/fmt/wrappers/MarkerWrapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import net.fexcraft.app.fmt.utils.TextureManager;
import net.fexcraft.lib.common.Static;
import net.fexcraft.lib.common.math.RGB;
import net.fexcraft.lib.tmt.ModelRendererTurbo;
import net.fexcraft.lib.local_tmt.ModelRendererTurbo;

public class MarkerWrapper extends PolygonWrapper {

Expand Down
2 changes: 1 addition & 1 deletion src/net/fexcraft/app/fmt/wrappers/ObjPreviewWrapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import com.google.gson.JsonObject;

import net.fexcraft.lib.common.utils.WavefrontObjUtil;
import net.fexcraft.lib.tmt.ModelRendererTurbo;
import net.fexcraft.lib.local_tmt.ModelRendererTurbo;

public class ObjPreviewWrapper extends PolygonWrapper {

Expand Down
2 changes: 1 addition & 1 deletion src/net/fexcraft/app/fmt/wrappers/PolygonWrapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import net.fexcraft.lib.common.math.RGB;
import net.fexcraft.lib.common.math.Vec3f;
import net.fexcraft.lib.common.utils.Print;
import net.fexcraft.lib.tmt.ModelRendererTurbo;
import net.fexcraft.lib.local_tmt.ModelRendererTurbo;

public abstract class PolygonWrapper {

Expand Down
2 changes: 1 addition & 1 deletion src/net/fexcraft/app/fmt/wrappers/QuadWrapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import com.google.gson.JsonObject;

import net.fexcraft.lib.common.math.Vec3f;
import net.fexcraft.lib.tmt.ModelRendererTurbo;
import net.fexcraft.lib.local_tmt.ModelRendererTurbo;

public class QuadWrapper extends BoxWrapper {

Expand Down
2 changes: 1 addition & 1 deletion src/net/fexcraft/app/fmt/wrappers/ShapeQuadWrapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import net.fexcraft.app.fmt.utils.Settings;
import net.fexcraft.lib.common.math.RGB;
import net.fexcraft.lib.common.math.Vec3f;
import net.fexcraft.lib.tmt.ModelRendererTurbo;
import net.fexcraft.lib.local_tmt.ModelRendererTurbo;

public class ShapeQuadWrapper extends QuadWrapper {

Expand Down
2 changes: 1 addition & 1 deletion src/net/fexcraft/app/fmt/wrappers/ShapeboxWrapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import net.fexcraft.app.fmt.utils.Settings;
import net.fexcraft.lib.common.math.RGB;
import net.fexcraft.lib.common.math.Vec3f;
import net.fexcraft.lib.tmt.ModelRendererTurbo;
import net.fexcraft.lib.local_tmt.ModelRendererTurbo;

public class ShapeboxWrapper extends BoxWrapper {

Expand Down
2 changes: 1 addition & 1 deletion src/net/fexcraft/app/fmt/wrappers/TexrectWrapperB.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import com.google.gson.JsonObject;

import net.fexcraft.lib.common.math.Vec3f;
import net.fexcraft.lib.tmt.ModelRendererTurbo;
import net.fexcraft.lib.local_tmt.ModelRendererTurbo;

public class TexrectWrapperB extends ShapeboxWrapper {

Expand Down
2 changes: 1 addition & 1 deletion src/net/fexcraft/app/fmt/wrappers/TrapezoidWrapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import com.google.gson.JsonObject;

import net.fexcraft.lib.common.math.Vec3f;
import net.fexcraft.lib.tmt.ModelRendererTurbo;
import net.fexcraft.lib.local_tmt.ModelRendererTurbo;

public class TrapezoidWrapper extends BoxWrapper {

Expand Down
4 changes: 2 additions & 2 deletions src/net/fexcraft/app/fmt/wrappers/VoxelWrapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

import net.fexcraft.lib.common.Static;
import net.fexcraft.lib.common.math.RGB;
import net.fexcraft.lib.tmt.ModelRendererTurbo;
import net.fexcraft.lib.tmt.VoxelBuilder;
import net.fexcraft.lib.local_tmt.ModelRendererTurbo;
import net.fexcraft.lib.local_tmt.VoxelBuilder;

public class VoxelWrapper extends PolygonWrapper {

Expand Down
30 changes: 30 additions & 0 deletions src/net/fexcraft/lib/local_tmt/Coord2D.java
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;
}

}
Loading

0 comments on commit aa8eabe

Please sign in to comment.