Commit 0d74380a authored by Human Gamer's avatar Human Gamer

Stuff and Things

parent c758fd0b
Pipeline #1743508 skipped
......@@ -23,6 +23,8 @@ public class TexCoordField extends JComponent
this.offsetField = new Point2Field("Offset: ", offset);
this.scaleField = new Point2Field("Scale: ", scale);
this.rotField = new FloatField(rotation);
this.rotField.setMin(-7200);
this.rotField.setMax(7200);
this.add(this.offsetField);
this.add(this.scaleField);
......
......@@ -358,16 +358,38 @@ public final class Util
float sinv;
float cosv;
float angle = 0;
//for (int i = 0; i < 2; i++)
//{
//ns = vecs[i][sv];
//nt = vecs[i][tv];
ns = vecs[0][sv];
nt = vecs[0][tv];
ns = vecs[0][sv];
nt = vecs[0][tv];
//ns = vecs[0][sv];
//nt = vecs[0][tv];
float angle = 0;
// x = cos(a) * y - sin(a) * z
// x = vecs[i][sv] = ns
// y = vecs[i][sv] = ns
// z = vecs[i][tv] = nt
//a = 2*tan^(-1)((-z+sqrt(-x^2+y^2+z^2))/(x+y))
//a = 2*tan^(-1)((-z+sqrt(-x^2+y^2+z^2))/(x+y))
//a = 2*tan^(-1)((-nt+sqrt(-ns^2+ns^2+nt^2))/(ns+ns))
//double a = -Math.pow(ns, 2);
//double b = Math.pow(ns, 2);
//double c = Math.pow(nt, 2);
//double sq = Math.sqrt(a+b+c);
//double p1 = sq - nt;
//double p2 = ns + ns;
//float angle = (float) (2.0f * Math.atan(p1 / p2));
//angle = (float) (2 * Math.atan((Math.sqrt(Math.pow(-ns, 2) + Math.pow(ns, 2) + Math.pow(nt, 2)) - nt) / (ns+ns)));
//System.out.println(angle);
// cosv * vecs[i][sv] - sinv * vecs[i][tv] = vecs[i][sv]
// cosv * vecs[i][sv] = vecs[i][sv] + sinv * vecs[i][tv]
......@@ -381,7 +403,6 @@ public final class Util
// cos(a) = x + sin(a) * y / x
// cos(a) = 5 + sin(a) * 3 / 5
//ns = cosv * vecs[i][sv] - sinv * vecs[i][tv];
//nt = sinv * vecs[i][sv] + cosv * vecs[i][tv];
//}
......@@ -400,7 +421,7 @@ public final class Util
float yScale = 1 / (planeY.getX() + planeY.getY() + planeY.getZ());//1 / (planeY.getX() / height);
Point2F offset = new Point2F(planeX.getD(), planeY.getD());
float rotate = angle;
float rotate = (float) Math.toDegrees(angle);
Point2F scale = new Point2F(xScale, yScale);
return new TexData(normal, offset, rotate, scale);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment