\r
static public final float[] sin = new float[SIN_COUNT];\r
static public final float[] cos = new float[SIN_COUNT];\r
+ \r
static {\r
for (int i = 0; i < SIN_COUNT; i++) {\r
float a = (i + 0.5f) / SIN_COUNT * radFull;\r
}\r
\r
static public final float sin (float rad) {\r
- return sin[(int)(rad * radToIndex) & SIN_MASK];\r
+ return (float)Math.sin(rad);\r
+// return sin[(int)(rad * radToIndex) & SIN_MASK];\r
}\r
\r
static public final float cos (float rad) {\r
- return cos[(int)(rad * radToIndex) & SIN_MASK];\r
+ return (float)Math.cos(rad);\r
+// return cos[(int)(rad * radToIndex) & SIN_MASK];\r
}\r
\r
static public final float sinDeg (float deg) {\r
- return sin[(int)(deg * degToIndex) & SIN_MASK];\r
+ return (float)Math.sin(degreesToRadians * deg);\r
+// return sin[(int)(deg * degToIndex) & SIN_MASK];\r
}\r
\r
static public final float cosDeg (float deg) {\r
- return cos[(int)(deg * degToIndex) & SIN_MASK];\r
+ return (float)Math.cos(degreesToRadians * deg);\r
+// return cos[(int)(deg * degToIndex) & SIN_MASK];\r
}\r
\r
// ---\r
public class JoglDebugStarter {\r
\r
public static void main (String[] argv) {\r
- new JoglApplication(new com.badlogic.gdx.tests.Gdx2DTest(), "Debug Test", 480, 320, false);\r
+ new JoglApplication(new com.badlogic.gdx.tests.RotationTest(), "Debug Test", 480, 320, false);\r
}\r
}\r
import com.badlogic.gdx.graphics.GL10;\r
import com.badlogic.gdx.graphics.Texture;\r
import com.badlogic.gdx.graphics.g2d.SpriteBatch;\r
+import com.badlogic.gdx.graphics.g2d.TextureRegion;\r
import com.badlogic.gdx.tests.utils.GdxTest;\r
\r
public class RotationTest extends GdxTest {\r
}\r
\r
Texture texture;\r
+ TextureRegion region;\r
SpriteBatch batch;\r
\r
\r
+ \r
@Override public void create() {\r
texture = new Texture(Gdx.files.internal("data/black_marked_0.png"));\r
+ region = new TextureRegion(texture);\r
batch = new SpriteBatch();\r
+ batch.getTransformMatrix().setToTranslation(30.5f, 30.5f, 0);\r
}\r
\r
@Override public void render() {\r
Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);\r
batch.begin();\r
- batch.draw(texture, 100.5f, 100.5f);\r
+ batch.draw(texture, 0, 0);\r
+ batch.draw(region, 128, 0, 64, 64, 128, 128, 1, 1, 90);\r
+ batch.draw(region, 128, 128, 64, 64, 128, 128, 1, 1, 180);\r
+ batch.draw(region, 0, 128, 64, 64, 128, 128, 1, 1, 270);\r
batch.end();\r
}\r
}\r