diff --git a/FCL/src/main/java/com/tungsten/fcl/ui/account/OfflineAccountSkinDialog.java b/FCL/src/main/java/com/tungsten/fcl/ui/account/OfflineAccountSkinDialog.java index 74206cd3..edf24f35 100644 --- a/FCL/src/main/java/com/tungsten/fcl/ui/account/OfflineAccountSkinDialog.java +++ b/FCL/src/main/java/com/tungsten/fcl/ui/account/OfflineAccountSkinDialog.java @@ -38,8 +38,8 @@ import com.tungsten.fcllibrary.component.view.FCLImageButton; import com.tungsten.fcllibrary.component.view.FCLLinearLayout; import com.tungsten.fcllibrary.component.view.FCLRadioButton; import com.tungsten.fcllibrary.component.view.FCLTextView; -import com.tungsten.fcllibrary.skin.MinecraftSkinRenderer; -import com.tungsten.fcllibrary.skin.SkinGLSurfaceView; +import com.tungsten.fcllibrary.skin.SkinCanvas; +import com.tungsten.fcllibrary.skin.SkinRenderer; import com.tungsten.fcllibrary.util.ConvertUtils; import java.util.ArrayList; @@ -51,8 +51,8 @@ public class OfflineAccountSkinDialog extends FCLDialog implements View.OnClickL private final OfflineAccount account; private ConstraintLayout root; - private SkinGLSurfaceView skinGLSurfaceView; - private MinecraftSkinRenderer renderer; + private SkinCanvas skinCanvas; + private SkinRenderer renderer; private FCLTextView title; private FCLButton positive; @@ -90,16 +90,15 @@ public class OfflineAccountSkinDialog extends FCLDialog implements View.OnClickL setContentView(R.layout.dialog_offline_account_skin); setCancelable(false); - renderer = new MinecraftSkinRenderer(getContext(), true); - renderer.character.setRunning(true); - skinGLSurfaceView = findViewById(R.id.skin_view); - skinGLSurfaceView.setEGLConfigChooser(8, 8, 8, 8, 16, 0); - skinGLSurfaceView.getHolder().setFormat(PixelFormat.RGBA_8888); - skinGLSurfaceView.getHolder().setFormat(PixelFormat.TRANSLUCENT); - skinGLSurfaceView.setZOrderOnTop(true); - skinGLSurfaceView.setRenderer(renderer, 5f); - skinGLSurfaceView.setRenderMode(GLSurfaceView.RENDERMODE_CONTINUOUSLY); - skinGLSurfaceView.setPreserveEGLContextOnPause(true); + renderer = new SkinRenderer(); + skinCanvas = findViewById(R.id.skin_view); + skinCanvas.setEGLConfigChooser(8, 8, 8, 8, 16, 0); + skinCanvas.getHolder().setFormat(PixelFormat.RGBA_8888); + skinCanvas.getHolder().setFormat(PixelFormat.TRANSLUCENT); + skinCanvas.setZOrderOnTop(true); + skinCanvas.setRenderer(renderer, 5f); + skinCanvas.setRenderMode(GLSurfaceView.RENDERMODE_CONTINUOUSLY); + skinCanvas.setPreserveEGLContextOnPause(true); root = findViewById(R.id.root); title = findViewById(R.id.title); @@ -132,10 +131,10 @@ public class OfflineAccountSkinDialog extends FCLDialog implements View.OnClickL negative = findViewById(R.id.negative); negative.post(() -> { int size = root.getHeight() - title.getHeight() - positive.getHeight() - ConvertUtils.dip2px(getContext(), 40); - ViewGroup.LayoutParams layoutParams = skinGLSurfaceView.getLayoutParams(); + ViewGroup.LayoutParams layoutParams = skinCanvas.getLayoutParams(); layoutParams.width = size; layoutParams.height = size; - skinGLSurfaceView.setLayoutParams(layoutParams); + skinCanvas.setLayoutParams(layoutParams); positive.setOnClickListener(this); negative.setOnClickListener(this); diff --git a/FCL/src/main/java/com/tungsten/fcl/ui/main/MainUI.java b/FCL/src/main/java/com/tungsten/fcl/ui/main/MainUI.java index 1e0e4a2d..0adb4951 100644 --- a/FCL/src/main/java/com/tungsten/fcl/ui/main/MainUI.java +++ b/FCL/src/main/java/com/tungsten/fcl/ui/main/MainUI.java @@ -18,14 +18,14 @@ import com.tungsten.fclcore.task.Schedulers; import com.tungsten.fclcore.task.Task; import com.tungsten.fcllibrary.component.ui.FCLCommonUI; import com.tungsten.fcllibrary.component.view.FCLUILayout; -import com.tungsten.fcllibrary.skin.MinecraftSkinRenderer; -import com.tungsten.fcllibrary.skin.SkinGLSurfaceView; +import com.tungsten.fcllibrary.skin.SkinCanvas; +import com.tungsten.fcllibrary.skin.SkinRenderer; public class MainUI extends FCLCommonUI { private RelativeLayout skinContainer; - private SkinGLSurfaceView skinGLSurfaceView; - private MinecraftSkinRenderer renderer; + private SkinCanvas skinCanvas; + private SkinRenderer renderer; private ObjectProperty currentAccount; @@ -38,8 +38,7 @@ public class MainUI extends FCLCommonUI { super.onCreate(); skinContainer = findViewById(R.id.skin_container); - renderer = new MinecraftSkinRenderer(getContext(), true); - renderer.character.setRunning(true); + renderer = new SkinRenderer(); ViewGroup.LayoutParams layoutParamsSkin = skinContainer.getLayoutParams(); layoutParamsSkin.width = (int) (((View) skinContainer.getParent().getParent()).getMeasuredWidth() * 0.5f); layoutParamsSkin.height = (int) Math.min(((View) skinContainer.getParent().getParent()).getMeasuredWidth() * 0.5f, ((View) skinContainer.getParent().getParent()).getMeasuredHeight()); @@ -51,45 +50,45 @@ public class MainUI extends FCLCommonUI { @Override public void onStart() { super.onStart(); - if (skinGLSurfaceView == null) { - skinGLSurfaceView = new SkinGLSurfaceView(getContext()); - skinGLSurfaceView.setEGLConfigChooser(8, 8, 8, 8, 16, 0); - skinGLSurfaceView.getHolder().setFormat(PixelFormat.RGBA_8888); - skinGLSurfaceView.getHolder().setFormat(PixelFormat.TRANSLUCENT); - skinGLSurfaceView.setZOrderOnTop(true); - skinGLSurfaceView.setRenderer(renderer, 5f); - skinGLSurfaceView.setRenderMode(GLSurfaceView.RENDERMODE_CONTINUOUSLY); - skinGLSurfaceView.setPreserveEGLContextOnPause(true); + if (skinCanvas == null) { + skinCanvas = new SkinCanvas(getContext()); + skinCanvas.setEGLConfigChooser(8, 8, 8, 8, 16, 0); + skinCanvas.getHolder().setFormat(PixelFormat.RGBA_8888); + skinCanvas.getHolder().setFormat(PixelFormat.TRANSLUCENT); + skinCanvas.setZOrderOnTop(true); + skinCanvas.setRenderer(renderer, 5f); + skinCanvas.setRenderMode(GLSurfaceView.RENDERMODE_CONTINUOUSLY); + skinCanvas.setPreserveEGLContextOnPause(true); } else { - skinGLSurfaceView.onResume(); - renderer.refresh(renderer.getTexture()); + skinCanvas.onResume(); + renderer.updateTexture(renderer.getTexture()[0], renderer.getTexture()[1]); } - skinContainer.addView(skinGLSurfaceView); + skinContainer.addView(skinCanvas); } @Override public void onPause() { super.onPause(); - if (skinGLSurfaceView != null) { - skinGLSurfaceView.onPause(); + if (skinCanvas != null) { + skinCanvas.onPause(); } } @Override public void onResume() { super.onResume(); - if (isShowing() && skinGLSurfaceView != null) { - skinGLSurfaceView.onResume(); + if (isShowing() && skinCanvas != null) { + skinCanvas.onResume(); } } @Override public void onStop() { super.onStop(); - if (skinGLSurfaceView != null) { - skinGLSurfaceView.onPause(); + if (skinCanvas != null) { + skinCanvas.onPause(); } - skinContainer.removeView(skinGLSurfaceView); + skinContainer.removeView(skinCanvas); } @Override diff --git a/FCL/src/main/res/layout/dialog_offline_account_skin.xml b/FCL/src/main/res/layout/dialog_offline_account_skin.xml index 470d5221..b7c7b96c 100644 --- a/FCL/src/main/res/layout/dialog_offline_account_skin.xml +++ b/FCL/src/main/res/layout/dialog_offline_account_skin.xml @@ -27,7 +27,7 @@ app:layout_constraintBottom_toTopOf="@+id/positive" app:layout_constraintTop_toBottomOf="@+id/title"> - = 1.0f) { - final float[] mRotate = this.mRotate; - mRotate[1] += this.rotate_step[1] * n; - } - if (Math.abs(n2) >= 1.0f) { - final float[] mRotate2 = this.mRotate; - mRotate2[0] += this.rotate_step[0] * n2; - } - } - - public void setRunning(final boolean isRunning) { - this.isRunning = isRunning; - } - - public void drawBody(final GL10 gl10) { - gl10.glMatrixMode(5888); - gl10.glRotatef(this.mRotate[0], 1.0f, 0.0f, 0.0f); - gl10.glRotatef(this.mRotate[1], 0.0f, 1.0f, 0.0f); - gl10.glRotatef(this.mRotate[2], 0.0f, 0.0f, 1.0f); - if (this.mBodyVisible) { - this.mBody.draw(gl10, this.isRunning); - } - if (this.mHeadVisible) { - this.mHead.draw(gl10, this.isRunning); - } - if (this.mLLegVisible) { - this.mLLeg.draw(gl10, this.isRunning); - } - if (this.mRLegVisible) { - this.mRLeg.draw(gl10, this.isRunning); - } - if (this.mRArm != null) { - if (this.mLArmVisible) { - this.mLArm.draw(gl10, this.isRunning); - } - if (this.mRArmVisible) { - this.mRArm.draw(gl10, this.isRunning); - } - if (this.mHatVisible) { - this.mHat.draw(gl10, this.isRunning); - } - if (this.mLArmOverlayVisible) { - this.mLArmOverlay.draw(gl10, this.isRunning); - } - if (this.mRArmOverlayVisible) { - this.mRArmOverlay.draw(gl10, this.isRunning); - } - } - else { - if (this.mLArmVisible) { - this.mAlexLArm.draw(gl10, this.isRunning); - } - if (this.mRArmVisible) { - this.mAlexRArm.draw(gl10, this.isRunning); - } - if (this.mHatVisible) { - this.mHat.draw(gl10, this.isRunning); - } - if (this.mLArmOverlayVisible) { - this.mAlexLArmOverlay.draw(gl10, this.isRunning); - } - if (this.mRArmOverlayVisible) { - this.mAlexRArmOverlay.draw(gl10, this.isRunning); - } - } - if (this.mLLegOverlayVisible) { - this.mLLegOverlay.draw(gl10, this.isRunning); - } - if (this.mRLegOverlayVisible) { - this.mRLegOverlay.draw(gl10, this.isRunning); - } - if (this.mBodyOverlayVisible) { - this.mBodyOverlay.draw(gl10, this.isRunning); - } - } - - public void drawCape(final GL10 gl10) { - if (this.mCapeVisible) { - this.mCape.draw(gl10, this.isRunning); - } - } - - public Boolean getRunning() { - return this.isRunning; - } - - public float getXRotation() { - return this.mRotate[0]; - } - - public float getYRotation() { - return this.mRotate[1]; - } - - public float getZRotation() { - return this.mRotate[2]; - } - - public void hideBodyPart(final BodyPart bodyPart, final boolean b) { - if (bodyPart == BodyPart.BODY) { - this.mBodyVisible = b; - } - if (bodyPart == BodyPart.HAT) { - this.mHatVisible = b; - } - if (bodyPart == BodyPart.HEAD) { - this.mHeadVisible = b; - } - if (bodyPart == BodyPart.JACKET) { - this.mBodyOverlayVisible = b; - } - if (bodyPart == BodyPart.LEFT_ARM) { - this.mLArmVisible = b; - } - if (bodyPart == BodyPart.RIGHT_ARM) { - this.mRArmVisible = b; - } - if (bodyPart == BodyPart.LEFT_LEG) { - this.mLLegVisible = b; - } - if (bodyPart == BodyPart.RIGHT_LEG) { - this.mRLegVisible = b; - } - if (bodyPart == BodyPart.LEFT_SLEEVE) { - this.mLArmOverlayVisible = b; - } - if (bodyPart == BodyPart.RIGHT_SLEEVE) { - this.mRArmOverlayVisible = b; - } - if (bodyPart == BodyPart.LEFT_LEG_OVERLAY) { - this.mLLegOverlayVisible = b; - } - if (bodyPart == BodyPart.RIGHT_LEG_OVERLAY) { - this.mRLegOverlayVisible = b; - } - } - - public void hideCapePart(final CapePart capePart, final boolean b) { - if (capePart == CapePart.CAPE) { - this.mCapeVisible = b; - } - } - - public void setXRotation(final int n) { - this.mRotate[0] = n; - } - - public void setYRotation(final int n) { - this.mRotate[1] = n; - } - - public void setZRotation(final int n) { - this.mRotate[2] = n; - } - - public void showAllBodyParts() { - this.mHeadVisible = true; - this.mHatVisible = true; - this.mBodyVisible = true; - this.mBodyOverlayVisible = true; - this.mLArmVisible = true; - this.mRArmVisible = true; - this.mLArmOverlayVisible = true; - this.mRArmOverlayVisible = true; - this.mLLegVisible = true; - this.mRLegVisible = true; - this.mLLegOverlayVisible = true; - this.mRLegOverlayVisible = true; - this.mCapeVisible = true; - } -} diff --git a/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/MinecraftSkinRenderer.java b/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/MinecraftSkinRenderer.java deleted file mode 100644 index 479154d9..00000000 --- a/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/MinecraftSkinRenderer.java +++ /dev/null @@ -1,191 +0,0 @@ -package com.tungsten.fcllibrary.skin; - -import android.content.Context; -import android.graphics.Bitmap; -import android.graphics.BitmapFactory; -import android.opengl.GLSurfaceView; -import android.opengl.GLU; -import android.os.SystemClock; - -import com.tungsten.fclcore.fakefx.beans.property.ObjectProperty; -import com.tungsten.fclcore.fakefx.beans.property.ObjectPropertyBase; -import com.tungsten.fclcore.task.Schedulers; -import com.tungsten.fclcore.util.skin.InvalidSkinException; -import com.tungsten.fclcore.util.skin.NormalizedSkin; - -import javax.microedition.khronos.egl.EGLConfig; -import javax.microedition.khronos.opengles.GL10; - -public class MinecraftSkinRenderer implements GLSurfaceView.Renderer { - public static float[] light0Position; - public boolean changeSkinImage; - public GameCharacter character; - private int[] characterTexData = new int[2]; - private final Context context; - public String path; - public float[] plane_texcoords; - protected float[] plane_vertices; - private ObjectProperty textureProperty; - public Bitmap skin; - public Bitmap cape; - boolean superRun; - boolean updateBitmapSkin; - - static { - MinecraftSkinRenderer.light0Position = new float[]{0.0f, 0.0f, 5100.0f, 0.0f}; - } - - public MinecraftSkinRenderer(final Context context) { - this.changeSkinImage = false; - this.plane_texcoords = new float[] { 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f }; - this.plane_vertices = new float[] { -200.0f, -100.0f, -100.0f, -200.0f, 100.0f, -100.0f, 200.0f, 100.0f, -100.0f, 200.0f, -100.0f, -100.0f }; - this.updateBitmapSkin = false; - this.superRun = false; - this.context = context; - this.character = new GameCharacter(); - } - - public MinecraftSkinRenderer(final Context context, final int n) { - this.changeSkinImage = false; - this.plane_texcoords = new float[] { 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f }; - this.plane_vertices = new float[] { -200.0f, -100.0f, -100.0f, -200.0f, 100.0f, -100.0f, 200.0f, 100.0f, -100.0f, 200.0f, -100.0f, -100.0f }; - this.updateBitmapSkin = false; - this.superRun = false; - this.context = context; - this.character = new GameCharacter(n); - } - - public MinecraftSkinRenderer(final Context context, final int n, final boolean b) { - this.changeSkinImage = false; - this.plane_texcoords = new float[] { 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f }; - this.plane_vertices = new float[] { -200.0f, -100.0f, -100.0f, -200.0f, 100.0f, -100.0f, 200.0f, 100.0f, -100.0f, 200.0f, -100.0f, -100.0f }; - this.updateBitmapSkin = false; - this.superRun = false; - this.context = context; - this.character = new GameCharacter(b, n); - } - - public MinecraftSkinRenderer(final Context context, final boolean b) { - this.changeSkinImage = false; - this.plane_texcoords = new float[] {0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f}; - this.plane_vertices = new float[] {-200.0f, -100.0f, -100.0f, -200.0f, 100.0f, -100.0f, 200.0f, 100.0f, -100.0f, 200.0f, -100.0f, -100.0f}; - this.updateBitmapSkin = false; - this.superRun = false; - this.context = context; - this.character = new GameCharacter(b); - } - - public void onDrawFrame(final GL10 gl10) { - // Log.i("draw", "start"); - if (this.changeSkinImage) { - this.changeSkinImage = false; - } - if (this.updateBitmapSkin) { - characterTexData = TextureHelper.loadGLTextureFromBitmap(this.skin, this.cape, gl10); - this.updateBitmapSkin = false; - } - gl10.glClear(16640); - gl10.glEnable(3553); - gl10.glLoadIdentity(); - gl10.glColor4f(0.63671875f, 0.76953125f, 0.22265625f, 1.0f); - gl10.glTranslatef(0.0f, 0.0f, -60.0f); - gl10.glPushMatrix(); - gl10.glBindTexture(3553, characterTexData[0]); - this.character.drawBody(gl10); - if (cape != null && cape.getWidth() == 64 && cape.getHeight() == 32) { - gl10.glBindTexture(3553, characterTexData[1]); - this.character.drawCape(gl10); - } - gl10.glPopMatrix(); - gl10.glLoadIdentity(); - if (this.superRun) { - GLU.gluLookAt(gl10, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f); - gl10.glRotatef(0.09f * (int) (SystemClock.uptimeMillis() % 4000L), 0.0f, 0.0f, 1.0f); - this.character.drawBody(gl10); - } - } - - public void onSurfaceChanged(final GL10 gl10, final int n, final int n2) { - gl10.glViewport(0, 0, n, n2); - gl10.glMatrixMode(5889); - gl10.glLoadIdentity(); - final float n3 = n2 / 2.0f / (float) Math.tan(BufferUtils.d2r(22.5f)); - GLU.gluPerspective(gl10, 45.0f, n / n2, 0.5f, Math.max(1500.0f, n3)); - gl10.glMatrixMode(5888); - gl10.glLoadIdentity(); - GLU.gluLookAt(gl10, n / 2.0f, n2 / 2.0f, n3, n / 2.0f, n2 / 2.0f, 0.0f, 0.0f, 1.0f, 0.0f); - gl10.glEnable(2896); - gl10.glEnable(16384); - gl10.glLightfv(16384, 4608, new float[] {3.5f, 3.5f, 3.5f, 1.0f}, 0); - gl10.glLightfv(16384, 4611, MinecraftSkinRenderer.light0Position = new float[] {0.0f, 0.0f, n3, 0.0f}, 0); - } - - @Override - public void onSurfaceCreated(GL10 gl10, EGLConfig eglConfig) { - this.characterTexData = TextureHelper.loadTexture(BitmapFactory.decodeStream(MinecraftSkinRenderer.class.getResourceAsStream("/assets/img/alex.png"))); - gl10.glEnable(3042); - gl10.glCullFace(1028); - gl10.glShadeModel(7425); - gl10.glEnable(6408); - gl10.glEnable(2929); - gl10.glDepthFunc(515); - gl10.glHint(3152, 4354); - gl10.glClearDepthf(1.0f); - } - - public void setSuperRun(final boolean superRun) { - this.superRun = superRun; - } - - public void updateTexture(Bitmap skin, Bitmap cape) { - this.skin = skin; - this.cape = cape; - this.updateBitmapSkin = true; - } - - public void refresh(Bitmap[] texture) { - Schedulers.androidUIThread().execute(() -> { - try { - NormalizedSkin normalizedSkin = new NormalizedSkin(texture[0]); - character = new GameCharacter(normalizedSkin.isSlim()); - character.setRunning(true); - updateTexture(normalizedSkin.isOldFormat() ? normalizedSkin.getNormalizedTexture() : normalizedSkin.getOriginalTexture(), texture[1]); - } catch (InvalidSkinException e) { - e.printStackTrace(); - } - }); - } - - public final void setTexture(Bitmap skin, Bitmap cape) { - this.textureProperty().set(new Bitmap[] { skin, cape }); - } - - public final Bitmap[] getTexture() { - return textureProperty().get(); - } - - public final ObjectProperty textureProperty() { - if (textureProperty == null) { - textureProperty = new ObjectPropertyBase() { - - public void invalidated() { - Schedulers.androidUIThread().execute(() -> { - Bitmap[] texture = get(); - refresh(texture); - }); - } - - public Object getBean() { - return this; - } - - public String getName() { - return "image"; - } - }; - textureProperty.set(new Bitmap[] { BitmapFactory.decodeStream(MinecraftSkinRenderer.class.getResourceAsStream("/assets/img/alex.png")), null }); - } - - return textureProperty; - } -} diff --git a/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/SkinCanvas.java b/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/SkinCanvas.java new file mode 100644 index 00000000..cfc234af --- /dev/null +++ b/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/SkinCanvas.java @@ -0,0 +1,73 @@ +package com.tungsten.fcllibrary.skin; + +import android.annotation.SuppressLint; +import android.content.Context; +import android.opengl.GLSurfaceView; +import android.util.AttributeSet; +import android.view.MotionEvent; + +public class SkinCanvas extends GLSurfaceView { + + private float density; + private float previousX; + private float previousY; + private SkinRenderer renderer; + private int priPointerId; + private int secPointerId; + private double initDistance; + private float initScale; + + public SkinCanvas(Context context) { + super(context); + } + + public SkinCanvas(Context context, AttributeSet attrs) { + super(context, attrs); + } + + @SuppressLint("ClickableViewAccessibility") + @Override + public boolean onTouchEvent(MotionEvent event) { + if (event.getPointerCount() == 1) { + final float x = event.getX(); + final float y = event.getY(); + if (event.getAction() == MotionEvent.ACTION_MOVE && this.renderer != null) { + this.renderer.getSkinModel().setRotateStep((x - this.previousX) / (this.density), (y - this.previousY) / (this.density)); + } + this.previousX = x; + this.previousY = y; + } + if (event.getPointerCount() == 2) { + switch (event.getActionMasked()) { + case MotionEvent.ACTION_DOWN: + priPointerId = event.getPointerId(event.getActionIndex()); + break; + case MotionEvent.ACTION_POINTER_DOWN: + secPointerId = event.getPointerId(event.getActionIndex()); + float deltaX = event.getX(event.findPointerIndex(priPointerId)) - event.getX(event.findPointerIndex(secPointerId)); + float deltaY = event.getY(event.findPointerIndex(priPointerId)) - event.getY(event.findPointerIndex(secPointerId)); + initDistance = Math.sqrt(deltaX * deltaX + deltaY * deltaY); + initScale = renderer.getSkinModel().getScale(); + break; + case MotionEvent.ACTION_MOVE: + float dX = event.getX(event.findPointerIndex(priPointerId)) - event.getX(event.findPointerIndex(secPointerId)); + float dY = event.getY(event.findPointerIndex(priPointerId)) - event.getY(event.findPointerIndex(secPointerId)); + double dist = Math.sqrt(dX * dX + dY * dY); + double delta = dist - initDistance; + if (initScale + (delta / (1 * Math.sqrt(getWidth() * getWidth() + getHeight() * getHeight()))) <= 2 + && initScale + (delta / (1 * Math.sqrt(getWidth() * getWidth() + getHeight() * getHeight()))) >= 0.7) { + float scale = (float) (initScale + (delta / (1 * Math.sqrt(getWidth() * getWidth() + getHeight() * getHeight())))); + renderer.getSkinModel().setScale(scale); + } + break; + } + } + return true; + } + + public void setRenderer(SkinRenderer renderer, float density) { + this.renderer = renderer; + this.density = density; + super.setRenderer(renderer); + } +} diff --git a/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/SkinGLSurfaceView.java b/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/SkinGLSurfaceView.java deleted file mode 100644 index 4734f78d..00000000 --- a/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/SkinGLSurfaceView.java +++ /dev/null @@ -1,70 +0,0 @@ -package com.tungsten.fcllibrary.skin; - -import android.content.Context; -import android.opengl.GLSurfaceView; -import android.util.AttributeSet; -import android.view.MotionEvent; - -public class SkinGLSurfaceView extends GLSurfaceView { - private float density; - private float previousX; - private float previousY; - private MinecraftSkinRenderer renderer; - - public SkinGLSurfaceView(final Context context) { - super(context); - } - - public SkinGLSurfaceView(final Context context, final AttributeSet set) { - super(context, set); - } - - public boolean onTouchEvent(final MotionEvent motionEvent) { - if (motionEvent.getPointerCount() == 1) { - final float x = motionEvent.getX(); - final float y = motionEvent.getY(); - if (motionEvent.getAction() == 2 && this.renderer != null) { - this.renderer.character.setRotateStep((x - this.previousX) / (this.density), (y - this.previousY) / (this.density)); - } - this.previousX = x; - this.previousY = y; - } - if (motionEvent.getPointerCount() == 2) { - switch (motionEvent.getActionMasked()) { - case MotionEvent.ACTION_DOWN: - priId = motionEvent.getPointerId(motionEvent.getActionIndex()); - break; - case MotionEvent.ACTION_POINTER_DOWN: - secId = motionEvent.getPointerId(motionEvent.getActionIndex()); - float deltaX = motionEvent.getX(motionEvent.findPointerIndex(priId)) - motionEvent.getX(motionEvent.findPointerIndex(secId)); - float deltaY = motionEvent.getY(motionEvent.findPointerIndex(priId)) - motionEvent.getY(motionEvent.findPointerIndex(secId)); - initDist = Math.sqrt(deltaX * deltaX + deltaY * deltaY); - initScale = renderer.character.scale; - break; - case MotionEvent.ACTION_MOVE: - float dX = motionEvent.getX(motionEvent.findPointerIndex(priId)) - motionEvent.getX(motionEvent.findPointerIndex(secId)); - float dY = motionEvent.getY(motionEvent.findPointerIndex(priId)) - motionEvent.getY(motionEvent.findPointerIndex(secId)); - double dist = Math.sqrt(dX * dX + dY * dY); - double delta = dist - initDist; - if (initScale + (delta / (1 * Math.sqrt(getWidth() * getWidth() + getHeight() * getHeight()))) <= 2 && initScale + (delta / (1 * Math.sqrt(getWidth() * getWidth() + getHeight() * getHeight()))) >= 0.7) { - float scale = (float) (initScale + (delta / (1 * Math.sqrt(getWidth() * getWidth() + getHeight() * getHeight())))); - renderer.character.setScale(scale); - } - break; - } - } - - return true; - } - - private int priId; - private int secId; - private double initDist; - private float initScale; - - public void setRenderer(final MinecraftSkinRenderer minecraftSkinRenderer, final float mDensity) { - this.renderer = minecraftSkinRenderer; - this.density = mDensity; - super.setRenderer((Renderer)minecraftSkinRenderer); - } -} diff --git a/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/SkinModel.java b/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/SkinModel.java new file mode 100644 index 00000000..d8e41622 --- /dev/null +++ b/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/SkinModel.java @@ -0,0 +1,174 @@ +package com.tungsten.fcllibrary.skin; + +import com.tungsten.fcllibrary.skin.cube.arm.normal.LeftArm; +import com.tungsten.fcllibrary.skin.cube.arm.normal.LeftArmOverlay; +import com.tungsten.fcllibrary.skin.cube.arm.normal.RightArm; +import com.tungsten.fcllibrary.skin.cube.arm.normal.RightArmOverlay; +import com.tungsten.fcllibrary.skin.cube.arm.slim.LeftArmSlim; +import com.tungsten.fcllibrary.skin.cube.arm.slim.LeftArmSlimOverlay; +import com.tungsten.fcllibrary.skin.cube.arm.slim.RightArmSlim; +import com.tungsten.fcllibrary.skin.cube.arm.slim.RightArmSlimOverlay; +import com.tungsten.fcllibrary.skin.cube.body.Body; +import com.tungsten.fcllibrary.skin.cube.body.BodyOverlay; +import com.tungsten.fcllibrary.skin.cube.cape.Cape; +import com.tungsten.fcllibrary.skin.cube.head.Hat; +import com.tungsten.fcllibrary.skin.cube.head.Head; +import com.tungsten.fcllibrary.skin.cube.leg.LeftLeg; +import com.tungsten.fcllibrary.skin.cube.leg.LeftLegOverlay; +import com.tungsten.fcllibrary.skin.cube.leg.RightLeg; +import com.tungsten.fcllibrary.skin.cube.leg.RightLegOverlay; + +import javax.microedition.khronos.opengles.GL10; + +public class SkinModel { + + private Head head; + private Hat hat; + private Body body; + private BodyOverlay bodyOverlay; + private LeftArm leftArm; + private LeftArmOverlay leftArmOverlay; + private RightArm rightArm; + private RightArmOverlay rightArmOverlay; + private LeftArmSlim leftArmSlim; + private LeftArmSlimOverlay leftArmSlimOverlay; + private RightArmSlim rightArmSlim; + private RightArmSlimOverlay rightArmSlimOverlay; + private LeftLeg leftLeg; + private LeftLegOverlay leftLegOverlay; + private RightLeg rightLeg; + private RightLegOverlay rightLegOverlay; + private Cape cape; + private final float[] rotate; + private final float[] rotateStep; + private boolean isRunning; + private float scale; + + public SkinModel() { + this.rotate = new float[] { + 0.0f, + 0.0f, + 0.0f + }; + this.rotateStep = new float[] { + 2.0f, + 2.0f, + 2.0f + }; + this.isRunning = false; + this.scale = 1f; + initModel(); + } + + private void initModel() { + this.head = new Head(scale); + this.hat = new Hat(scale); + this.body = new Body(scale); + this.bodyOverlay = new BodyOverlay(scale); + this.leftArm = new LeftArm(scale); + this.rightArm = new RightArm(scale); + this.leftArmOverlay = new LeftArmOverlay(scale); + this.rightArmOverlay = new RightArmOverlay(scale); + this.leftArmSlim = new LeftArmSlim(scale); + this.rightArmSlim = new RightArmSlim(scale); + this.leftArmSlimOverlay = new LeftArmSlimOverlay(scale); + this.rightArmSlimOverlay = new RightArmSlimOverlay(scale); + this.leftLeg = new LeftLeg(scale); + this.rightLeg = new RightLeg(scale); + this.leftLegOverlay = new LeftLegOverlay(scale); + this.rightLegOverlay = new RightLegOverlay(scale); + this.cape = new Cape(scale); + } + + public void reset() { + initModel(); + } + + public void setScale(float scale) { + this.scale = scale; + initModel(); + } + + public float getScale() { + return scale; + } + + public void setRotate(float n1, float n2, float n3) { + this.rotate[0] = n1; + this.rotate[1] = n2; + this.rotate[2] = n3; + } + + public void setRotateStep(float n1, float n2) { + if (Math.abs(n1) >= 1.0f) { + final float[] rotate = this.rotate; + rotate[1] += this.rotateStep[1] * n1; + } + if (Math.abs(n2) >= 1.0f) { + final float[] rotate = this.rotate; + rotate[0] += this.rotateStep[0] * n2; + } + } + + public void setRunning(boolean isRunning) { + this.isRunning = isRunning; + } + + public void setXRotation(int n) { + this.rotate[0] = n; + } + + public void setYRotation(int n) { + this.rotate[1] = n; + } + + public void setZRotation(int n) { + this.rotate[2] = n; + } + + public boolean isRunning() { + return this.isRunning; + } + + public float getXRotation() { + return this.rotate[0]; + } + + public float getYRotation() { + return this.rotate[1]; + } + + public float getZRotation() { + return this.rotate[2]; + } + + public void drawBodyModel(final GL10 gl10, boolean slim) { + gl10.glMatrixMode(GL10.GL_MODELVIEW); + gl10.glRotatef(this.rotate[0], 1.0f, 0.0f, 0.0f); + gl10.glRotatef(this.rotate[1], 0.0f, 1.0f, 0.0f); + gl10.glRotatef(this.rotate[2], 0.0f, 0.0f, 1.0f); + this.head.draw(gl10); + this.hat.draw(gl10); + this.body.draw(gl10); + this.bodyOverlay.draw(gl10); + this.leftLeg.draw(gl10, this.isRunning); + this.rightLeg.draw(gl10, this.isRunning); + this.leftLegOverlay.draw(gl10, this.isRunning); + this.rightLegOverlay.draw(gl10, this.isRunning); + if (!slim) { + this.leftArm.draw(gl10, this.isRunning); + this.rightArm.draw(gl10, this.isRunning); + this.leftArmOverlay.draw(gl10, this.isRunning); + this.rightArmOverlay.draw(gl10, this.isRunning); + } else { + this.leftArmSlim.draw(gl10, this.isRunning); + this.rightArmSlim.draw(gl10, this.isRunning); + this.leftArmSlimOverlay.draw(gl10, this.isRunning); + this.rightArmSlimOverlay.draw(gl10, this.isRunning); + } + } + + public void drawCapeModel(GL10 gl10) { + this.cape.draw(gl10); + } +} diff --git a/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/SkinRenderer.java b/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/SkinRenderer.java new file mode 100644 index 00000000..6436581d --- /dev/null +++ b/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/SkinRenderer.java @@ -0,0 +1,162 @@ +package com.tungsten.fcllibrary.skin; + +import android.graphics.Bitmap; +import android.graphics.BitmapFactory; +import android.opengl.GLES20; +import android.opengl.GLSurfaceView; +import android.opengl.GLU; +import android.opengl.GLUtils; + +import androidx.annotation.Nullable; + +import com.tungsten.fclcore.fakefx.beans.property.ObjectProperty; +import com.tungsten.fclcore.fakefx.beans.property.ObjectPropertyBase; +import com.tungsten.fclcore.task.Schedulers; +import com.tungsten.fclcore.util.skin.InvalidSkinException; +import com.tungsten.fclcore.util.skin.NormalizedSkin; +import com.tungsten.fcllibrary.util.ConvertUtils; + +import org.jetbrains.annotations.NotNull; + +import javax.microedition.khronos.egl.EGLConfig; +import javax.microedition.khronos.opengles.GL10; + +public class SkinRenderer implements GLSurfaceView.Renderer { + + private final SkinModel skinModel; + private boolean updateBitmapSkin; + private boolean slim; + private Bitmap skin; + private Bitmap cape; + private int[] modelTextureData; + private ObjectProperty textureProperty; + + public SkinRenderer() { + this.skinModel = new SkinModel(); + this.skinModel.setRunning(true); + this.updateBitmapSkin = false; + this.slim = false; + this.skin = BitmapFactory.decodeStream(SkinRenderer.class.getResourceAsStream("/assets/img/alex.png")); + this.cape = null; + } + + @Override + public void onSurfaceCreated(GL10 gl10, EGLConfig eglConfig) { + this.modelTextureData = loadTexture(this.skin, this.cape); + gl10.glEnable(GL10.GL_BLEND); + gl10.glCullFace(GL10.GL_FRONT); + gl10.glShadeModel(GL10.GL_SMOOTH); + gl10.glEnable(GL10.GL_RGBA); + gl10.glEnable(GL10.GL_DEPTH_TEST); + gl10.glEnable(GL10.GL_ALPHA_TEST); + gl10.glAlphaFunc(GL10.GL_GREATER, 0.1f); + gl10.glDepthFunc(GL10.GL_LEQUAL); + gl10.glHint(GL10.GL_PERSPECTIVE_CORRECTION_HINT, GL10.GL_NICEST); + gl10.glClearDepthf(1.0f); + } + + @Override + public void onSurfaceChanged(GL10 gl10, int i, int i1) { + gl10.glViewport(0, 0, i, i1); + gl10.glMatrixMode(GL10.GL_PROJECTION); + gl10.glLoadIdentity(); + final float i2 = i1 / 2.0f / (float) Math.tan(ConvertUtils.d2r(22.5f)); + GLU.gluPerspective(gl10, 45.0f, (float) i / i1, 0.5f, Math.max(1500.0f, i2)); + gl10.glMatrixMode(GL10.GL_MODELVIEW); + gl10.glLoadIdentity(); + GLU.gluLookAt(gl10, i / 2.0f, i1 / 2.0f, i2, i / 2.0f, i1 / 2.0f, 0.0f, 0.0f, 1.0f, 0.0f); + gl10.glEnable(GL10.GL_COLOR_BUFFER_BIT); + } + + @Override + public void onDrawFrame(GL10 gl10) { + if (this.updateBitmapSkin) { + this.modelTextureData = loadTexture(this.skin, this.cape); + this.updateBitmapSkin = false; + } + gl10.glClear(16640); + gl10.glEnable(GL10.GL_TEXTURE_2D); + gl10.glLoadIdentity(); + gl10.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); + gl10.glTranslatef(0.0f, 0.0f, -60.0f); + gl10.glPushMatrix(); + gl10.glBindTexture(GL10.GL_TEXTURE_2D, modelTextureData[0]); + this.skinModel.drawBodyModel(gl10, slim); + if (cape != null && cape.getWidth() == 64 && cape.getHeight() == 32) { + gl10.glBindTexture(GL10.GL_TEXTURE_2D, modelTextureData[1]); + this.skinModel.drawCapeModel(gl10); + } + gl10.glPopMatrix(); + gl10.glLoadIdentity(); + } + + public void updateTexture(Bitmap skin, Bitmap cape) { + Schedulers.androidUIThread().execute(() -> { + try { + NormalizedSkin normalizedSkin = new NormalizedSkin(skin); + this.slim = normalizedSkin.isSlim(); + this.skin = normalizedSkin.isOldFormat() ? normalizedSkin.getNormalizedTexture() : normalizedSkin.getOriginalTexture(); + this.cape = cape; + this.updateBitmapSkin = true; + } catch (InvalidSkinException e) { + throw new RuntimeException(e.getCause()); + } + }); + } + + public SkinModel getSkinModel() { + return skinModel; + } + + public final void setTexture(Bitmap skin, Bitmap cape) { + this.textureProperty().set(new Bitmap[] { skin, cape }); + } + + public final Bitmap[] getTexture() { + return textureProperty().get(); + } + + public final ObjectProperty textureProperty() { + if (textureProperty == null) { + textureProperty = new ObjectPropertyBase() { + + public void invalidated() { + Schedulers.androidUIThread().execute(() -> { + Bitmap[] texture = get(); + updateTexture(texture[0], texture[1]); + }); + } + + public Object getBean() { + return this; + } + + public String getName() { + return "texture"; + } + }; + textureProperty.set(new Bitmap[] { BitmapFactory.decodeStream(SkinRenderer.class.getResourceAsStream("/assets/img/alex.png")), null }); + } + + return textureProperty; + } + + public static int[] loadTexture(@NotNull final Bitmap skin, @Nullable final Bitmap cape) { + final int[] textures = new int[2]; + GLES20.glGenTextures(2, textures, 0); + GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, textures[0]); + GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_NEAREST); + GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_NEAREST); + GLUtils.texImage2D(GLES20.GL_TEXTURE_2D, 0, skin, 0); + if (cape != null) { + GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, textures[1]); + GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_NEAREST); + GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_NEAREST); + GLUtils.texImage2D(GLES20.GL_TEXTURE_2D, 0, cape, 0); + } + if (textures[0] == 0 || (cape != null && textures[1] == 0)) { + throw new RuntimeException("Error loading texture."); + } + return textures; + } +} diff --git a/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/TextureHelper.java b/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/TextureHelper.java deleted file mode 100644 index 2c8e01d9..00000000 --- a/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/TextureHelper.java +++ /dev/null @@ -1,79 +0,0 @@ -package com.tungsten.fcllibrary.skin; - -import android.content.Context; -import android.graphics.Bitmap; -import android.graphics.BitmapFactory; -import android.opengl.GLES20; -import android.opengl.GLUtils; -import android.util.Log; - -import javax.microedition.khronos.opengles.GL10; - -public class TextureHelper { - public static boolean isLoadingError; - - static { - TextureHelper.isLoadingError = false; - } - - public static int[] loadGLTextureFromBitmap(final Bitmap skin, final Bitmap cape, final GL10 gl10) { - // Log.i("loadTex", "start"); - final int[] array = new int[2]; - gl10.glGenTextures(2, array, 0); - gl10.glBindTexture(3553, array[0]); - gl10.glTexParameterf(3553, 10241, 9728.0f); - gl10.glTexParameterf(3553, 10240, 9728.0f); - GLUtils.texImage2D(3553, 0, skin, 0); - gl10.glBindTexture(3553, array[1]); - gl10.glTexParameterf(3553, 10241, 9728.0f); - gl10.glTexParameterf(3553, 10240, 9728.0f); - if (cape != null) { - GLUtils.texImage2D(3553, 0, cape, 0); - } - if (array[0] == 0 || (cape != null && array[1] == 0)) { - throw new RuntimeException("Error loading texture."); - } else { - Log.i("loadTex", "success"); - } - return array; - } - - public static int[] loadTexture(final Context context, final int n) { - TextureHelper.isLoadingError = false; - final int[] array = new int[2]; - GLES20.glGenTextures(1, array, 0); - if (array[0] != 0) { - final BitmapFactory.Options bitmapFactory = new BitmapFactory.Options(); - bitmapFactory.inScaled = false; - final Bitmap decodeResource = BitmapFactory.decodeResource(context.getResources(), n, bitmapFactory); - GLES20.glBindTexture(3553, array[0]); - GLES20.glTexParameteri(3553, 10241, 9728); - GLES20.glTexParameterf(3553, 10240, 9728.0f); - GLUtils.texImage2D(3553, 0, decodeResource, 0); - decodeResource.recycle(); - } - if (array[0] == 0) { - throw new RuntimeException("Error loading texture."); - } - return array; - } - - public static int[] loadTexture(final Bitmap bitmap) { - TextureHelper.isLoadingError = false; - final int[] array = new int[2]; - GLES20.glGenTextures(1, array, 0); - if (array[0] != 0) { - new BitmapFactory.Options().inScaled = false; - GLES20.glBindTexture(3553, array[0]); - GLES20.glTexParameteri(3553, 10241, 9728); - GLES20.glTexParameterf(3553, 10240, 9728.0f); - GLUtils.texImage2D(3553, 0, bitmap, 0); - bitmap.recycle(); - } - if (array[0] == 0) { - throw new RuntimeException("Error loading texture."); - } - return array; - } - -} diff --git a/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/body/BodyPart.java b/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/body/BodyPart.java deleted file mode 100644 index add6e356..00000000 --- a/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/body/BodyPart.java +++ /dev/null @@ -1,886 +0,0 @@ -package com.tungsten.fcllibrary.skin.body; - -public enum BodyPart { - BODY(2, "Body", new BodyPartSection[] { BodySkin.FRONT.getBodyPartSection(), BodySkin.RIGHT.getBodyPartSection(), BodySkin.BACK.getBodyPartSection(), BodySkin.LEFT.getBodyPartSection(), BodySkin.TOP.getBodyPartSection(), BodySkin.BOTTOM.getBodyPartSection() }), - HAT(1, "Hat", new BodyPartSection[] { HatSkin.FRONT.getBodyPartSection(), HatSkin.RIGHT.getBodyPartSection(), HatSkin.BACK.getBodyPartSection(), HatSkin.LEFT.getBodyPartSection(), HatSkin.TOP.getBodyPartSection(), HatSkin.BOTTOM.getBodyPartSection() }), - HEAD(0, "Head", new BodyPartSection[] { HeadSkin.FRONT.getBodyPartSection(), HeadSkin.RIGHT.getBodyPartSection(), HeadSkin.BACK.getBodyPartSection(), HeadSkin.LEFT.getBodyPartSection(), HeadSkin.TOP.getBodyPartSection(), HeadSkin.BOTTOM.getBodyPartSection() }), - JACKET(3, "Body Overlay", new BodyPartSection[] { JacketSkin.FRONT.getBodyPartSection(), JacketSkin.RIGHT.getBodyPartSection(), JacketSkin.BACK.getBodyPartSection(), JacketSkin.LEFT.getBodyPartSection(), JacketSkin.TOP.getBodyPartSection(), JacketSkin.BOTTOM.getBodyPartSection() }), - LEFT_ARM(4, "Left Arm", new BodyPartSection[] { LeftArmSkin.FRONT.getBodyPartSection(), LeftArmSkin.RIGHT.getBodyPartSection(), LeftArmSkin.BACK.getBodyPartSection(), LeftArmSkin.LEFT.getBodyPartSection(), LeftArmSkin.TOP.getBodyPartSection(), LeftArmSkin.BOTTOM.getBodyPartSection() }), - LEFT_LEG(8, "Left Leg", new BodyPartSection[] { LeftLegSkin.FRONT.getBodyPartSection(), LeftLegSkin.RIGHT.getBodyPartSection(), LeftLegSkin.BACK.getBodyPartSection(), LeftLegSkin.LEFT.getBodyPartSection(), LeftLegSkin.TOP.getBodyPartSection(), LeftLegSkin.BOTTOM.getBodyPartSection() }), - LEFT_LEG_OVERLAY(10, "Left Leg Overlay", new BodyPartSection[] { LeftLegOverlaySkin.FRONT.getBodyPartSection(), LeftLegOverlaySkin.RIGHT.getBodyPartSection(), LeftLegOverlaySkin.BACK.getBodyPartSection(), LeftLegOverlaySkin.LEFT.getBodyPartSection(), LeftLegOverlaySkin.TOP.getBodyPartSection(), LeftLegOverlaySkin.BOTTOM.getBodyPartSection() }), - LEFT_SLEEVE(6, "Left Arm Overlay", new BodyPartSection[] { LeftSleeveSkin.FRONT.getBodyPartSection(), LeftSleeveSkin.RIGHT.getBodyPartSection(), LeftSleeveSkin.BACK.getBodyPartSection(), LeftSleeveSkin.LEFT.getBodyPartSection(), LeftSleeveSkin.TOP.getBodyPartSection(), LeftSleeveSkin.BOTTOM.getBodyPartSection() }), - RIGHT_ARM(5, "Right Arm", new BodyPartSection[] { RightArmSkin.FRONT.getBodyPartSection(), RightArmSkin.RIGHT.getBodyPartSection(), RightArmSkin.BACK.getBodyPartSection(), RightArmSkin.LEFT.getBodyPartSection(), RightArmSkin.TOP.getBodyPartSection(), RightArmSkin.BOTTOM.getBodyPartSection() }), - RIGHT_LEG(9, "Right Leg", new BodyPartSection[] { RightLegSkin.FRONT.getBodyPartSection(), RightLegSkin.RIGHT.getBodyPartSection(), RightLegSkin.BACK.getBodyPartSection(), RightLegSkin.LEFT.getBodyPartSection(), RightLegSkin.TOP.getBodyPartSection(), RightLegSkin.BOTTOM.getBodyPartSection() }), - RIGHT_LEG_OVERLAY(11, "Right Leg Overlay", new BodyPartSection[] { RightLegOverlaySkin.FRONT.getBodyPartSection(), RightLegOverlaySkin.RIGHT.getBodyPartSection(), RightLegOverlaySkin.BACK.getBodyPartSection(), RightLegOverlaySkin.LEFT.getBodyPartSection(), RightLegOverlaySkin.TOP.getBodyPartSection(), RightLegOverlaySkin.BOTTOM.getBodyPartSection() }), - RIGHT_SLEEVE(7, "Right Arm Overlay", new BodyPartSection[] { RightSleeveSkin.FRONT.getBodyPartSection(), RightSleeveSkin.RIGHT.getBodyPartSection(), RightSleeveSkin.BACK.getBodyPartSection(), RightSleeveSkin.LEFT.getBodyPartSection(), RightSleeveSkin.TOP.getBodyPartSection(), RightSleeveSkin.BOTTOM.getBodyPartSection() }); - - private BodyPartSection[] bodyParts; - private String displayName; - private int id; - - private BodyPart(final int id, final String displayName, final BodyPartSection[] bodyParts) { - this.id = id; - this.displayName = displayName; - this.bodyParts = bodyParts; - } - - BodyPartSection getBodyPartSection(final int n) { - return this.bodyParts[n]; - } - - String getDisplayName() { - return this.displayName; - } - - int getPartId() { - return this.id; - } - - public enum AlexLeftArmSkin { - BACK(2, "Back", 51, 20, 3, 12), - BOTTOM(5, "Bottom", 47, 16, 3, 4), - FRONT(0, "Front", 44, 20, 3, 12), - LEFT(3, "Left", 47, 20, 4, 12), - RIGHT(1, "Right", 40, 20, 4, 12), - TOP(4, "Top", 44, 16, 3, 4); - - private String displayName; - private int height; - private int id; - private int startX; - private int startY; - private int width; - - AlexLeftArmSkin(final int id, final String displayName, final int startX, final int startY, final int width, final int height) { - this.id = id; - this.width = width; - this.height = height; - this.displayName = displayName; - this.startX = startX; - this.startY = startY; - } - - BodyPartSection getBodyPartSection() { - return new BodyPartSection("Left Arm", this.displayName, this.startX, this.startY, this.width, this.height); - } - - String getDisplayName() { - return this.displayName; - } - - int getHeight() { - return this.height; - } - - int getPartId() { - return this.id; - } - - int getStartX() { - return this.startX; - } - - int getStartY() { - return this.startY; - } - - int getWidth() { - return this.width; - } - } - - public enum AlexLeftSleeveSkin { - BACK(2, "Back", 51, 36, 3, 12), - BOTTOM(5, "Bottom", 47, 32, 3, 4), - FRONT(0, "Front", 44, 36, 3, 12), - LEFT(3, "Left", 47, 36, 4, 12), - RIGHT(1, "Right", 40, 36, 4, 12), - TOP(4, "Top", 44, 32, 3, 4); - - private String displayName; - private int height; - private int id; - private int startX; - private int startY; - private int width; - - AlexLeftSleeveSkin(final int id, final String displayName, final int startX, final int startY, final int width, final int height) { - this.id = id; - this.width = width; - this.height = height; - this.displayName = displayName; - this.startX = startX; - this.startY = startY; - } - - BodyPartSection getBodyPartSection() { - return new BodyPartSection("Left Arm Overlay", this.displayName, this.startX, this.startY, this.width, this.height); - } - - String getDisplayName() { - return this.displayName; - } - - int getHeight() { - return this.height; - } - - int getPartId() { - return this.id; - } - - int getStartX() { - return this.startX; - } - - int getStartY() { - return this.startY; - } - - int getWidth() { - return this.width; - } - } - - public enum AlexRightArmSkin { - BACK(2, "Back", 43, 52, 3, 12), - BOTTOM(5, "Bottom", 39, 48, 3, 4), - FRONT(0, "Front", 36, 52, 3, 12), - LEFT(3, "Left", 39, 52, 4, 12), - RIGHT(1, "Right", 32, 52, 4, 12), - TOP(4, "Top", 36, 48, 3, 4); - - private String displayName; - private int height; - private int id; - private int startX; - private int startY; - private int width; - - AlexRightArmSkin(final int id, final String displayName, final int startX, final int startY, final int width, final int height) { - this.id = id; - this.width = width; - this.height = height; - this.displayName = displayName; - this.startX = startX; - this.startY = startY; - } - - BodyPartSection getBodyPartSection() { - return new BodyPartSection("Right Arm", this.displayName, this.startX, this.startY, this.width, this.height); - } - - String getDisplayName() { - return this.displayName; - } - - int getHeight() { - return this.height; - } - - int getPartId() { - return this.id; - } - - int getStartX() { - return this.startX; - } - - int getStartY() { - return this.startY; - } - - int getWidth() { - return this.width; - } - } - - public enum AlexRightSleeveSkin { - BACK(2, "Back", 59, 52, 3, 12), - BOTTOM(5, "Bottom", 55, 48, 3, 4), - FRONT(0, "Front", 52, 52, 3, 12), - LEFT(3, "Left", 55, 52, 4, 12), - RIGHT(1, "Right", 48, 52, 4, 12), - TOP(4, "Top", 52, 48, 3, 4); - - private String displayName; - private int height; - private int id; - private int startX; - private int startY; - private int width; - - AlexRightSleeveSkin(final int id, final String displayName, final int startX, final int startY, final int width, final int height) { - this.id = id; - this.width = width; - this.height = height; - this.displayName = displayName; - this.startX = startX; - this.startY = startY; - } - - BodyPartSection getBodyPartSection() { - return new BodyPartSection("Right Arm Overlay", this.displayName, this.startX, this.startY, this.width, this.height); - } - - String getDisplayName() { - return this.displayName; - } - - int getHeight() { - return this.height; - } - - int getPartId() { - return this.id; - } - - int getStartX() { - return this.startX; - } - - int getStartY() { - return this.startY; - } - - int getWidth() { - return this.width; - } - } - - public enum BodySkin { - BACK("BACK", 2, 2, "Back", 32, 20, 8, 12), - BOTTOM("BOTTOM", 5, 5, "Bottom", 28, 14, 8, 4), - FRONT("FRONT", 0, 0, "Front", 20, 20, 8, 12), - LEFT("LEFT", 3, 3, "Left", 28, 20, 4, 12), - RIGHT("RIGHT", 1, 1, "Right", 16, 20, 4, 12), - TOP("TOP", 4, 4, "Top", 20, 14, 8, 4); - - private String displayName; - private int height; - private int id; - private int startX; - private int startY; - private int width; - - BodySkin(final String s2, final int n2, final int id, final String displayName, final int startX, final int startY, final int width, final int height) { - this.id = id; - this.width = width; - this.height = height; - this.displayName = displayName; - this.startX = startX; - this.startY = startY; - } - - BodyPartSection getBodyPartSection() { - return new BodyPartSection("Body", this.displayName, this.startX, this.startY, this.width, this.height); - } - - String getDisplayName() { - return this.displayName; - } - - int getHeight() { - return this.height; - } - - int getPartId() { - return this.id; - } - - int getStartX() { - return this.startX; - } - - int getStartY() { - return this.startY; - } - - int getWidth() { - return this.width; - } - } - - public enum HatSkin { - BACK("BACK", 2, 2, "Back", 56, 8, 8, 8), - BOTTOM("BOTTOM", 5, 5, "Bottom", 48, 0, 8, 8), - FRONT("FRONT", 0, 0, "Front", 40, 8, 8, 8), - LEFT("LEFT", 3, 3, "Left", 48, 8, 8, 8), - RIGHT("RIGHT", 1, 1, "Right", 32, 8, 8, 8), - TOP("TOP", 4, 4, "Top", 40, 0, 8, 8); - - private String displayName; - private int height; - private int id; - private int startX; - private int startY; - private int width; - - HatSkin(final String s2, final int n2, final int id, final String displayName, final int startX, final int startY, final int width, final int height) { - this.id = id; - this.width = width; - this.height = height; - this.displayName = displayName; - this.startX = startX; - this.startY = startY; - } - - BodyPartSection getBodyPartSection() { - return new BodyPartSection("Hat", this.displayName, this.startX, this.startY, this.width, this.height); - } - - String getDisplayName() { - return this.displayName; - } - - int getHeight() { - return this.height; - } - - int getPartId() { - return this.id; - } - - int getStartX() { - return this.startX; - } - - int getStartY() { - return this.startY; - } - - int getWidth() { - return this.width; - } - } - - public enum HeadSkin { - BACK("BACK", 2, 2, "Back", 24, 8, 8, 8), - BOTTOM("BOTTOM", 5, 5, "Bottom", 16, 0, 8, 8), - FRONT("FRONT", 0, 0, "Front", 8, 8, 8, 8), - LEFT("LEFT", 3, 3, "Left", 16, 8, 8, 8), - RIGHT("RIGHT", 1, 1, "Right", 0, 8, 8, 8), - TOP("TOP", 4, 4, "Top", 8, 0, 8, 8); - - private String displayName; - private int height; - private int id; - private int startX; - private int startY; - private int width; - - HeadSkin(final String s2, final int n2, final int id, final String displayName, final int startX, final int startY, final int width, final int height) { - this.id = id; - this.width = width; - this.height = height; - this.displayName = displayName; - this.startX = startX; - this.startY = startY; - } - - BodyPartSection getBodyPartSection() { - return new BodyPartSection("Head", this.displayName, this.startX, this.startY, this.width, this.height); - } - - String getDisplayName() { - return this.displayName; - } - - int getHeight() { - return this.height; - } - - int getPartId() { - return this.id; - } - - int getStartX() { - return this.startX; - } - - int getStartY() { - return this.startY; - } - - int getWidth() { - return this.width; - } - } - - public enum JacketSkin { - BACK("BACK", 2, 2, "Back", 32, 36, 8, 12), - BOTTOM("BOTTOM", 5, 5, "Bottom", 28, 32, 8, 4), - FRONT("FRONT", 0, 0, "Front", 20, 36, 8, 12), - LEFT("LEFT", 3, 3, "Left", 28, 36, 4, 12), - RIGHT("RIGHT", 1, 1, "Right", 16, 36, 4, 12), - TOP("TOP", 4, 4, "Top", 20, 32, 8, 4); - - private String displayName; - private int height; - private int id; - private int startX; - private int startY; - private int width; - - JacketSkin(final String s2, final int n2, final int id, final String displayName, final int startX, final int startY, final int width, final int height) { - this.id = id; - this.width = width; - this.height = height; - this.displayName = displayName; - this.startX = startX; - this.startY = startY; - } - - BodyPartSection getBodyPartSection() { - return new BodyPartSection("Body Overlay", this.displayName, this.startX, this.startY, this.width, this.height); - } - - String getDisplayName() { - return this.displayName; - } - - int getHeight() { - return this.height; - } - - int getPartId() { - return this.id; - } - - int getStartX() { - return this.startX; - } - - int getStartY() { - return this.startY; - } - - int getWidth() { - return this.width; - } - } - - public enum LeftArmSkin { - BACK("BACK", 2, 2, "Back", 44, 52, 4, 12), - BOTTOM("BOTTOM", 5, 5, "Bottom", 40, 48, 4, 4), - FRONT("FRONT", 0, 0, "Front", 36, 52, 4, 12), - LEFT("LEFT", 3, 3, "Left", 40, 52, 4, 12), - RIGHT("RIGHT", 1, 1, "Right", 32, 52, 4, 12), - TOP("TOP", 4, 4, "Top", 36, 48, 4, 4); - - private String displayName; - private int height; - private int id; - private int startX; - private int startY; - private int width; - - LeftArmSkin(final String s2, final int n2, final int id, final String displayName, final int startX, final int startY, final int width, final int height) { - this.id = id; - this.width = width; - this.height = height; - this.displayName = displayName; - this.startX = startX; - this.startY = startY; - } - - BodyPartSection getBodyPartSection() { - return new BodyPartSection("Left Arm", this.displayName, this.startX, this.startY, this.width, this.height); - } - - String getDisplayName() { - return this.displayName; - } - - int getHeight() { - return this.height; - } - - int getPartId() { - return this.id; - } - - int getStartX() { - return this.startX; - } - - int getStartY() { - return this.startY; - } - - int getWidth() { - return this.width; - } - } - - public enum LeftLegOverlaySkin { - BACK("BACK", 2, 2, "Back", 12, 52, 4, 12), - BOTTOM("BOTTOM", 5, 5, "Bottom", 8, 48, 4, 4), - FRONT("FRONT", 0, 0, "Front", 4, 52, 4, 12), - LEFT("LEFT", 3, 3, "Left", 8, 52, 4, 12), - RIGHT("RIGHT", 1, 1, "Right", 0, 52, 4, 12), - TOP("TOP", 4, 4, "Top", 4, 48, 4, 4); - - private String displayName; - private int height; - private int id; - private int startX; - private int startY; - private int width; - - LeftLegOverlaySkin(final String s2, final int n2, final int id, final String displayName, final int startX, final int startY, final int width, final int height) { - this.id = id; - this.width = width; - this.height = height; - this.displayName = displayName; - this.startX = startX; - this.startY = startY; - } - - BodyPartSection getBodyPartSection() { - return new BodyPartSection("Left Leg Overlay", this.displayName, this.startX, this.startY, this.width, this.height); - } - - String getDisplayName() { - return this.displayName; - } - - int getHeight() { - return this.height; - } - - int getPartId() { - return this.id; - } - - int getStartX() { - return this.startX; - } - - int getStartY() { - return this.startY; - } - - int getWidth() { - return this.width; - } - } - - public enum LeftLegSkin { - BACK("BACK", 2, 2, "Back", 28, 52, 4, 12), - BOTTOM("BOTTOM", 5, 5, "Bottom", 24, 48, 4, 4), - FRONT("FRONT", 0, 0, "Front", 20, 52, 4, 12), - LEFT("LEFT", 3, 3, "Left", 24, 52, 4, 12), - RIGHT("RIGHT", 1, 1, "Right", 16, 52, 4, 12), - TOP("TOP", 4, 4, "Top", 20, 48, 4, 4); - - private String displayName; - private int height; - private int id; - private int startX; - private int startY; - private int width; - - LeftLegSkin(final String s2, final int n2, final int id, final String displayName, final int startX, final int startY, final int width, final int height) { - this.id = id; - this.width = width; - this.height = height; - this.displayName = displayName; - this.startX = startX; - this.startY = startY; - } - - BodyPartSection getBodyPartSection() { - return new BodyPartSection("Left Leg", this.displayName, this.startX, this.startY, this.width, this.height); - } - - String getDisplayName() { - return this.displayName; - } - - int getHeight() { - return this.height; - } - - int getPartId() { - return this.id; - } - - int getStartX() { - return this.startX; - } - - int getStartY() { - return this.startY; - } - - int getWidth() { - return this.width; - } - } - - public enum LeftSleeveSkin { - BACK("BACK", 2, 2, "Back", 60, 52, 4, 12), - BOTTOM("BOTTOM", 5, 5, "Bottom", 56, 48, 4, 4), - FRONT("FRONT", 0, 0, "Front", 52, 52, 4, 12), - LEFT("LEFT", 3, 3, "Left", 56, 52, 4, 12), - RIGHT("RIGHT", 1, 1, "Right", 48, 52, 4, 12), - TOP("TOP", 4, 4, "Top", 52, 48, 4, 4); - - private String displayName; - private int height; - private int id; - private int startX; - private int startY; - private int width; - - LeftSleeveSkin(final String s2, final int n2, final int id, final String displayName, final int startX, final int startY, final int width, final int height) { - this.id = id; - this.width = width; - this.height = height; - this.displayName = displayName; - this.startX = startX; - this.startY = startY; - } - - BodyPartSection getBodyPartSection() { - return new BodyPartSection("Left Arm Overlay", this.displayName, this.startX, this.startY, this.width, this.height); - } - - String getDisplayName() { - return this.displayName; - } - - int getHeight() { - return this.height; - } - - int getPartId() { - return this.id; - } - - int getStartX() { - return this.startX; - } - - int getStartY() { - return this.startY; - } - - int getWidth() { - return this.width; - } - } - - public enum RightArmSkin { - BACK("BACK", 2, 2, "Back", 52, 20, 4, 12), - BOTTOM("BOTTOM", 5, 5, "Bottom", 48, 16, 4, 4), - FRONT("FRONT", 0, 0, "Front", 44, 20, 4, 12), - LEFT("LEFT", 3, 3, "Left", 48, 20, 4, 12), - RIGHT("RIGHT", 1, 1, "Right", 40, 20, 4, 12), - TOP("TOP", 4, 4, "Top", 44, 16, 4, 4); - - private String displayName; - private int height; - private int id; - private int startX; - private int startY; - private int width; - - RightArmSkin(final String s2, final int n2, final int id, final String displayName, final int startX, final int startY, final int width, final int height) { - this.id = id; - this.width = width; - this.height = height; - this.displayName = displayName; - this.startX = startX; - this.startY = startY; - } - - BodyPartSection getBodyPartSection() { - return new BodyPartSection("Right Arm", this.displayName, this.startX, this.startY, this.width, this.height); - } - - String getDisplayName() { - return this.displayName; - } - - int getHeight() { - return this.height; - } - - int getPartId() { - return this.id; - } - - int getStartX() { - return this.startX; - } - - int getStartY() { - return this.startY; - } - - int getWidth() { - return this.width; - } - } - - public enum RightLegOverlaySkin { - BACK("BACK", 2, 2, "Back", 12, 36, 4, 12), - BOTTOM("BOTTOM", 5, 5, "Bottom", 8, 32, 4, 4), - FRONT("FRONT", 0, 0, "Front", 4, 36, 4, 12), - LEFT("LEFT", 3, 3, "Left", 8, 36, 4, 12), - RIGHT("RIGHT", 1, 1, "Right", 0, 36, 4, 12), - TOP("TOP", 4, 4, "Top", 4, 32, 4, 4); - - private String displayName; - private int height; - private int id; - private int startX; - private int startY; - private int width; - - RightLegOverlaySkin(final String s2, final int n2, final int id, final String displayName, final int startX, final int startY, final int width, final int height) { - this.id = id; - this.width = width; - this.height = height; - this.displayName = displayName; - this.startX = startX; - this.startY = startY; - } - - BodyPartSection getBodyPartSection() { - return new BodyPartSection("Right Leg Overlay", this.displayName, this.startX, this.startY, this.width, this.height); - } - - String getDisplayName() { - return this.displayName; - } - - int getHeight() { - return this.height; - } - - int getPartId() { - return this.id; - } - - int getStartX() { - return this.startX; - } - - int getStartY() { - return this.startY; - } - - int getWidth() { - return this.width; - } - } - - public enum RightLegSkin { - BACK("BACK", 2, 2, "Back", 12, 20, 4, 12), - BOTTOM("BOTTOM", 5, 5, "Bottom", 8, 16, 4, 4), - FRONT("FRONT", 0, 0, "Front", 4, 20, 4, 12), - LEFT("LEFT", 3, 3, "Left", 8, 20, 4, 12), - RIGHT("RIGHT", 1, 1, "Right", 0, 20, 4, 12), - TOP("TOP", 4, 4, "Top", 4, 16, 4, 4); - - private String displayName; - private int height; - private int id; - private int startX; - private int startY; - private int width; - - RightLegSkin(final String s2, final int n2, final int id, final String displayName, final int startX, final int startY, final int width, final int height) { - this.id = id; - this.width = width; - this.height = height; - this.displayName = displayName; - this.startX = startX; - this.startY = startY; - } - - BodyPartSection getBodyPartSection() { - return new BodyPartSection("Right Leg", this.displayName, this.startX, this.startY, this.width, this.height); - } - - String getDisplayName() { - return this.displayName; - } - - int getHeight() { - return this.height; - } - - int getPartId() { - return this.id; - } - - int getStartX() { - return this.startX; - } - - int getStartY() { - return this.startY; - } - - int getWidth() { - return this.width; - } - } - - public enum RightSleeveSkin { - BACK("BACK", 2, 2, "Back", 52, 36, 4, 12), - BOTTOM("BOTTOM", 5, 5, "Bottom", 48, 32, 4, 4), - FRONT("FRONT", 0, 0, "Front", 44, 36, 4, 12), - LEFT("LEFT", 3, 3, "Left", 48, 36, 4, 12), - RIGHT("RIGHT", 1, 1, "Right", 40, 36, 4, 12), - TOP("TOP", 4, 4, "Top", 44, 32, 4, 4); - - private String displayName; - private int height; - private int id; - private int startX; - private int startY; - private int width; - - RightSleeveSkin(final String s2, final int n2, final int id, final String displayName, final int startX, final int startY, final int width, final int height) { - this.id = id; - this.width = width; - this.height = height; - this.displayName = displayName; - this.startX = startX; - this.startY = startY; - } - - BodyPartSection getBodyPartSection() { - return new BodyPartSection("Right Arm Overlay", this.displayName, this.startX, this.startY, this.width, this.height); - } - - String getDisplayName() { - return this.displayName; - } - - int getHeight() { - return this.height; - } - - int getPartId() { - return this.id; - } - - int getStartX() { - return this.startX; - } - - int getStartY() { - return this.startY; - } - - int getWidth() { - return this.width; - } - } -} diff --git a/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/body/BodyPartSection.java b/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/body/BodyPartSection.java deleted file mode 100644 index b500a79b..00000000 --- a/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/body/BodyPartSection.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.tungsten.fcllibrary.skin.body; - -public class BodyPartSection { - String bodyPartName; - int height; - String sideName; - int startX; - int startY; - int width; - - public BodyPartSection(final String bodyPartName, final String sideName, final int startX, final int startY, final int width, final int height) { - this.bodyPartName = bodyPartName; - this.sideName = sideName; - this.startX = startX; - this.startY = startY; - this.width = width; - this.height = height; - } - - public String getBodyPartName() { - return this.bodyPartName; - } - - public int getHeight() { - return this.height; - } - - public String getSideName() { - return this.sideName; - } - - public int getStartX() { - return this.startX; - } - - public int getStartY() { - return this.startY; - } - - public int getWidth() { - return this.width; - } -} diff --git a/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/body/LimbCube.java b/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/body/LimbCube.java deleted file mode 100644 index 24d82310..00000000 --- a/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/body/LimbCube.java +++ /dev/null @@ -1,162 +0,0 @@ -package com.tungsten.fcllibrary.skin.body; - -import java.nio.Buffer; -import java.nio.ByteBuffer; -import java.nio.ByteOrder; -import java.nio.FloatBuffer; -import java.util.ArrayList; - -import javax.microedition.khronos.opengles.GL10; - -public class LimbCube { - protected int[] face_indecies; - protected float[] face_vertices; - protected float fixedDir; - protected boolean isFixOneAxis; - protected float mMainAngle; - protected FloatBuffer mNormalVertexBuffer; - protected float[] mOffset; - protected float[] mScale; - protected float mSubAngle; - protected ArrayList mTextureBuffers; - protected FloatBuffer mVertexBuffer; - protected float[] main_angle_axis; - protected float main_max_angle; - protected float main_min_angle; - protected float main_step_value; - protected float[] normal_vertices; - protected float[] sub_angle_axis; - protected float sub_max_angle; - protected float sub_min_angle; - protected float sub_step_value; - private float[] vertices; - - public LimbCube(final float n, final float n2, final float n3, final float n4, final float n5, final float n6) { - this.mScale = new float[] { 0.0f, 0.0f, 0.0f }; - this.mOffset = new float[] { 0.0f, 0.0f, 0.0f }; - this.mMainAngle = 0.0f; - this.main_step_value = -3.0f; - this.main_max_angle = 3.0f; - this.main_min_angle = -3.0f; - this.main_angle_axis = new float[] { 0.0f, 0.0f, 0.0f }; - this.mSubAngle = 0.0f; - this.sub_step_value = -0.15f; - this.sub_max_angle = 3.0f; - this.sub_min_angle = -3.0f; - this.sub_angle_axis = new float[] { 0.0f, 0.0f, 0.0f }; - this.isFixOneAxis = true; - this.fixedDir = 1.0f; - this.vertices = new float[] { -1.0f, -1.0f, 1.0f, 1.0f, -1.0f, 1.0f, 1.0f, 1.0f, 1.0f, -1.0f, 1.0f, 1.0f, -1.0f, -1.0f, -1.0f, 1.0f, -1.0f, -1.0f, 1.0f, 1.0f, -1.0f, -1.0f, 1.0f, -1.0f, -1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, -1.0f, -1.0f, 0.0f, -1.0f }; - this.face_indecies = new int[] { 0, 8, 9, 1, 8, 3, 2, 9, 3, 7, 6, 2, 1, 5, 4, 0, 1, 9, 10, 5, 9, 2, 6, 10, 4, 11, 8, 0, 11, 7, 3, 8, 5, 10, 11, 4, 10, 6, 7, 11 }; - this.face_vertices = new float[this.face_indecies.length * 3]; - this.normal_vertices = new float[] { 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, -1.0f }; - this.mTextureBuffers = new ArrayList(); - this.mScale[0] = n; - this.mScale[1] = n2; - this.mScale[2] = n3; - this.mOffset[0] = n4; - this.mOffset[1] = n5; - this.mOffset[2] = n6; - final ByteBuffer allocateDirect = ByteBuffer.allocateDirect(this.face_vertices.length * 4); - allocateDirect.order(ByteOrder.nativeOrder()); - (this.mVertexBuffer = allocateDirect.asFloatBuffer()).put(this.face_vertices); - this.mVertexBuffer.position(0); - final ByteBuffer allocateDirect2 = ByteBuffer.allocateDirect(this.normal_vertices.length * 4); - allocateDirect2.order(ByteOrder.nativeOrder()); - (this.mNormalVertexBuffer = allocateDirect2.asFloatBuffer()).put(this.normal_vertices); - this.mNormalVertexBuffer.position(0); - } - - public LimbCube(final float n, final float n2, final float n3, final float n4, final float n5, final float n6, final float main_step_value, final float n7, final float n8, final float n9, final float main_max_angle, final float main_min_angle, final float sub_step_value, final float sub_max_angle, final float sub_min_angle, final boolean isFixOneAxis, final float fixedDir) { - this(n, n2, n3, n4, n5, n6); - this.main_step_value = main_step_value; - this.main_angle_axis[0] = n7; - this.main_angle_axis[1] = n8; - this.main_angle_axis[2] = n9; - this.main_max_angle = main_max_angle; - this.main_min_angle = main_min_angle; - this.sub_step_value = sub_step_value; - this.sub_max_angle = sub_max_angle; - this.sub_min_angle = sub_min_angle; - this.isFixOneAxis = isFixOneAxis; - this.fixedDir = fixedDir; - } - - public FloatBuffer AddTextures(final float[] array) { - final ByteBuffer allocateDirect = ByteBuffer.allocateDirect(array.length * 4); - allocateDirect.order(ByteOrder.nativeOrder()); - final FloatBuffer floatBuffer = allocateDirect.asFloatBuffer(); - floatBuffer.put(array); - floatBuffer.position(0); - this.mTextureBuffers.add(floatBuffer); - return floatBuffer; - } - - public void ClearAllTextures() { - this.mTextureBuffers.clear(); - } - - public void draw(final GL10 gl10, final boolean b) { - gl10.glEnable(3042); - gl10.glBlendFunc(1, 771); - gl10.glEnableClientState(32884); - gl10.glEnableClientState(32885); - gl10.glEnableClientState(32888); - gl10.glNormalPointer(5126, 0, (Buffer)this.mNormalVertexBuffer); - for (int i = 0; i < this.face_indecies.length; ++i) { - final int n = this.face_indecies[i]; - final float n2 = this.vertices[n * 3 + 1] * this.mScale[1] / 2.0f; - final float n3 = this.vertices[n * 3 + 2] * this.mScale[2] / 2.0f; - float n4; - float n5; - n4 = n2; - n5 = n3; - this.mVertexBuffer.put(i * 3, this.vertices[n * 3] * this.mScale[0] / 2.0f); - this.mVertexBuffer.put(i * 3 + 1, n4); - this.mVertexBuffer.put(i * 3 + 2, n5); - } - gl10.glVertexPointer(3, 5126, 0, (Buffer)this.mVertexBuffer); - gl10.glPushMatrix(); - gl10.glTranslatef(this.mOffset[0], this.mOffset[1], this.mOffset[2]); - if (b) { - gl10.glTranslatef(0.0f, this.mScale[1] / 4.0f * 3.0f, 0.0f); - gl10.glRotatef(this.mMainAngle, this.main_angle_axis[0], this.main_angle_axis[1], this.main_angle_axis[2]); - gl10.glTranslatef(0.0f, -this.mScale[1] / 4.0f * 3.0f, 0.0f); - this.mMainAngle += this.main_step_value; - if (this.mMainAngle >= this.main_max_angle) { - this.main_step_value *= -1.0f; - this.mMainAngle = this.main_max_angle; - } - else if (this.mMainAngle <= this.main_min_angle) { - this.main_step_value *= -1.0f; - this.mMainAngle = this.main_min_angle; - } - this.mSubAngle += this.sub_step_value; - if (this.mSubAngle >= this.sub_max_angle) { - this.sub_step_value *= -1.0f; - this.mSubAngle = this.sub_max_angle; - } - else if (this.mSubAngle <= this.sub_min_angle) { - this.sub_step_value *= -1.0f; - this.mSubAngle = this.sub_min_angle; - } - } - for (int j = 0; j < this.mTextureBuffers.size(); ++j) { - gl10.glTexCoordPointer(2, 5126, 0, (Buffer)this.mTextureBuffers.get(j)); - for (int k = 0; k < 10; ++k) { - gl10.glDrawArrays(6, k * 4, 4); - } - } - gl10.glPopMatrix(); - gl10.glDisable(3042); - gl10.glDisableClientState(32888); - gl10.glDisableClientState(32884); - } - - public void setZeroRun() { - this.mMainAngle = 1.5f; - this.main_step_value = 0.7f; - this.mSubAngle = 0.5f; - this.sub_step_value = -0.5f; - } -} diff --git a/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/body/MainCube.java b/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/body/MainCube.java deleted file mode 100644 index 6d8b9fcc..00000000 --- a/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/body/MainCube.java +++ /dev/null @@ -1,110 +0,0 @@ -package com.tungsten.fcllibrary.skin.body; - -import java.nio.Buffer; -import java.nio.ByteBuffer; -import java.nio.ByteOrder; -import java.nio.FloatBuffer; -import java.util.ArrayList; - -import javax.microedition.khronos.opengles.GL10; - -public class MainCube { - protected float[] angle_axis; - protected float[] face_vertices; - protected float mAngle; - protected FloatBuffer mNormalVertexBuffer; - protected float[] mOffset; - protected float[] mScale; - protected ArrayList mTextureBuffers; - protected FloatBuffer mVertexBuffer; - protected float max_angle; - protected float min_angle; - protected float[] normal_vertices; - protected float step_value; - - public MainCube(final float n, final float n2, final float n3, final float n4, final float n5, final float n6) { - this.mScale = new float[] { 0.0f, 0.0f, 0.0f }; - this.mOffset = new float[] { 0.0f, 0.0f, 0.0f }; - this.mAngle = 0.0f; - this.step_value = -0.15f; - this.max_angle = 3.0f; - this.min_angle = -3.0f; - this.angle_axis = new float[] { 0.0f, 0.0f, 0.0f }; - this.face_vertices = new float[] { -1.0f, -1.0f, 1.0f, -1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, -1.0f, 1.0f, -1.0f, 1.0f, 1.0f, -1.0f, 1.0f, -1.0f, 1.0f, 1.0f, -1.0f, 1.0f, 1.0f, 1.0f, 1.0f, -1.0f, 1.0f, 1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, 1.0f, 1.0f, -1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, -1.0f, 1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, 1.0f, -1.0f, -1.0f, 1.0f, 1.0f, -1.0f, -1.0f, 1.0f, 1.0f, -1.0f, -1.0f, 1.0f, 1.0f, -1.0f, -1.0f, 1.0f, -1.0f, -1.0f, -1.0f, -1.0f }; - this.normal_vertices = new float[] { 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, -1.0f }; - this.mTextureBuffers = new ArrayList(); - this.mScale[0] = n; - this.mScale[1] = n2; - this.mScale[2] = n3; - this.mOffset[0] = n4; - this.mOffset[1] = n5; - this.mOffset[2] = n6; - for (int i = 0; i < 24; ++i) { - this.face_vertices[i * 3] = this.face_vertices[i * 3] * this.mScale[0] / 2.0f; - this.face_vertices[i * 3 + 1] = this.face_vertices[i * 3 + 1] * this.mScale[1] / 2.0f; - this.face_vertices[i * 3 + 2] = this.face_vertices[i * 3 + 2] * this.mScale[2] / 2.0f; - } - final ByteBuffer allocateDirect = ByteBuffer.allocateDirect(this.face_vertices.length * 4); - allocateDirect.order(ByteOrder.nativeOrder()); - (this.mVertexBuffer = allocateDirect.asFloatBuffer()).put(this.face_vertices); - this.mVertexBuffer.position(0); - final ByteBuffer allocateDirect2 = ByteBuffer.allocateDirect(this.normal_vertices.length * 4); - allocateDirect2.order(ByteOrder.nativeOrder()); - (this.mNormalVertexBuffer = allocateDirect2.asFloatBuffer()).put(this.normal_vertices); - this.mNormalVertexBuffer.position(0); - } - - public MainCube(final float n, final float n2, final float n3, final float n4, final float n5, final float n6, final float step_value, final float n7, final float n8, final float n9, final float max_angle, final float min_angle) { - this(n, n2, n3, n4, n5, n6); - this.step_value = step_value; - this.max_angle = max_angle; - this.min_angle = min_angle; - this.angle_axis[0] = n7; - this.angle_axis[1] = n8; - this.angle_axis[2] = n9; - } - - public FloatBuffer AddTextures(final float[] array) { - final ByteBuffer allocateDirect = ByteBuffer.allocateDirect(array.length * 4); - allocateDirect.order(ByteOrder.nativeOrder()); - final FloatBuffer floatBuffer = allocateDirect.asFloatBuffer(); - floatBuffer.put(array); - floatBuffer.position(0); - this.mTextureBuffers.add(floatBuffer); - return floatBuffer; - } - - public void ClearAllTextures() { - this.mTextureBuffers.clear(); - } - - public void draw(final GL10 gl10, final boolean b) { - gl10.glEnable(3042); - gl10.glBlendFunc(1, 771); - gl10.glEnableClientState(32884); - gl10.glEnableClientState(32885); - gl10.glEnableClientState(32888); - gl10.glVertexPointer(3, 5126, 0, (Buffer)this.mVertexBuffer); - gl10.glNormalPointer(5126, 0, (Buffer)this.mNormalVertexBuffer); - gl10.glPushMatrix(); - gl10.glTranslatef(this.mOffset[0], this.mOffset[1], this.mOffset[2]); - for (int i = 0; i < this.mTextureBuffers.size(); ++i) { - gl10.glTexCoordPointer(2, 5126, 0, (Buffer) this.mTextureBuffers.get(i)); - for (int j = 0; j < 6; ++j) { - gl10.glDrawArrays(6, j * 4, 4); - } - } - gl10.glPopMatrix(); - gl10.glDisable(3042); - gl10.glDisableClientState(32888); - gl10.glDisableClientState(32885); - gl10.glDisableClientState(32884); - } - - public void setZeroRun() { - this.mAngle = 0.0f; - this.step_value = -0.15f; - this.max_angle = 3.0f; - this.min_angle = -3.0f; - } -} diff --git a/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/cape/CapeCube.java b/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/cape/CapeCube.java deleted file mode 100644 index 1da97d39..00000000 --- a/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/cape/CapeCube.java +++ /dev/null @@ -1,112 +0,0 @@ -package com.tungsten.fcllibrary.skin.cape; - -import java.nio.Buffer; -import java.nio.ByteBuffer; -import java.nio.ByteOrder; -import java.nio.FloatBuffer; -import java.util.ArrayList; - -import javax.microedition.khronos.opengles.GL10; - -public class CapeCube { - protected float[] angle_axis; - protected float[] face_vertices; - protected float mAngle; - protected FloatBuffer mNormalVertexBuffer; - protected float[] mOffset; - protected float[] mScale; - protected ArrayList mTextureBuffers; - protected FloatBuffer mVertexBuffer; - protected float max_angle; - protected float min_angle; - protected float[] normal_vertices; - protected float step_value; - - public CapeCube(final float n, final float n2, final float n3, final float n4, final float n5, final float n6) { - this.mScale = new float[] { 0.0f, 0.0f, 0.0f }; - this.mOffset = new float[] { 0.0f, 0.0f, 0.0f }; - this.mAngle = 0.0f; - this.step_value = -0.15f; - this.max_angle = 3.0f; - this.min_angle = -3.0f; - this.angle_axis = new float[] { 0.0f, 0.0f, 0.0f }; - this.face_vertices = new float[] { -1.0f, -1.0f, 1.0f, -1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, -1.0f, 1.0f, -1.0f, 1.0f, 1.0f, -1.0f, 1.0f, -1.0f, 1.0f, 1.0f, -1.0f, 1.0f, 1.0f, 1.0f, 1.0f, -1.0f, 1.0f, 1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, 1.0f, 1.0f, -1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, -1.0f, 1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, 1.0f, -1.0f, -1.0f, 1.0f, 1.0f, -1.0f, -1.0f, 1.0f, 1.0f, -1.0f, -1.0f, 1.0f, 1.0f, -1.0f, -1.0f, 1.0f, -1.0f, -1.0f, -1.0f, -1.0f }; - this.normal_vertices = new float[] { 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, -1.0f }; - this.mTextureBuffers = new ArrayList(); - this.mScale[0] = n; - this.mScale[1] = n2; - this.mScale[2] = n3; - this.mOffset[0] = n4; - this.mOffset[1] = n5; - this.mOffset[2] = n6; - for (int i = 0; i < 24; ++i) { - this.face_vertices[i * 3] = this.face_vertices[i * 3] * this.mScale[0] / 2.0f; - this.face_vertices[i * 3 + 1] = this.face_vertices[i * 3 + 1] * this.mScale[1] / 2.0f; - this.face_vertices[i * 3 + 2] = this.face_vertices[i * 3 + 2] * this.mScale[2] / 2.0f; - } - final ByteBuffer allocateDirect = ByteBuffer.allocateDirect(this.face_vertices.length * 4); - allocateDirect.order(ByteOrder.nativeOrder()); - (this.mVertexBuffer = allocateDirect.asFloatBuffer()).put(this.face_vertices); - this.mVertexBuffer.position(0); - final ByteBuffer allocateDirect2 = ByteBuffer.allocateDirect(this.normal_vertices.length * 4); - allocateDirect2.order(ByteOrder.nativeOrder()); - (this.mNormalVertexBuffer = allocateDirect2.asFloatBuffer()).put(this.normal_vertices); - this.mNormalVertexBuffer.position(0); - } - - public CapeCube(final float n, final float n2, final float n3, final float n4, final float n5, final float n6, final float step_value, final float n7, final float n8, final float n9, final float max_angle, final float min_angle) { - this(n, n2, n3, n4, n5, n6); - this.step_value = step_value; - this.max_angle = max_angle; - this.min_angle = min_angle; - this.angle_axis[0] = n7; - this.angle_axis[1] = n8; - this.angle_axis[2] = n9; - } - - public FloatBuffer AddTextures(final float[] array) { - final ByteBuffer allocateDirect = ByteBuffer.allocateDirect(array.length * 4); - allocateDirect.order(ByteOrder.nativeOrder()); - final FloatBuffer floatBuffer = allocateDirect.asFloatBuffer(); - floatBuffer.put(array); - floatBuffer.position(0); - this.mTextureBuffers.add(floatBuffer); - return floatBuffer; - } - - public void ClearAllTextures() { - this.mTextureBuffers.clear(); - } - - public void draw(final GL10 gl10, final boolean b) { - gl10.glEnable(3042); - gl10.glBlendFunc(1, 771); - gl10.glEnableClientState(32884); - gl10.glEnableClientState(32885); - gl10.glEnableClientState(32888); - gl10.glVertexPointer(3, 5126, 0, (Buffer)this.mVertexBuffer); - gl10.glNormalPointer(5126, 0, (Buffer)this.mNormalVertexBuffer); - gl10.glPushMatrix(); - gl10.glTranslatef(this.mOffset[0], this.mOffset[1], this.mOffset[2]); - gl10.glTranslatef(0.0f, this.mScale[1] / 4.0f * 3.0f, 0.0f); - gl10.glRotatef(12f, 1f, 0f, 0f); - gl10.glTranslatef(0.0f, -this.mScale[1] / 4.0f * 3.0f, 0.0f); - for (int i = 0; i < this.mTextureBuffers.size(); ++i) { - gl10.glTexCoordPointer(2, 5126, 0, (Buffer)this.mTextureBuffers.get(i)); - for (int j = 0; j < 6; ++j) { - gl10.glDrawArrays(6, j * 4, 4); - } - } - gl10.glPopMatrix(); - gl10.glDisable(3042); - gl10.glDisableClientState(32888); - gl10.glDisableClientState(32884); - } - - public void setZeroRun() { - this.mAngle = 0.0f; - this.step_value = -0.15f; - this.max_angle = 3.0f; - this.min_angle = -3.0f; - } -} diff --git a/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/cape/CapePart.java b/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/cape/CapePart.java deleted file mode 100644 index 82291c84..00000000 --- a/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/cape/CapePart.java +++ /dev/null @@ -1,83 +0,0 @@ -package com.tungsten.fcllibrary.skin.cape; - -public enum CapePart { - - CAPE(0, "Cape", new CapePartSection[] { CapeSkin.FRONT.getCapePartSection(), CapeSkin.RIGHT.getCapePartSection(), CapeSkin.BACK.getCapePartSection(), CapeSkin.LEFT.getCapePartSection(), CapeSkin.TOP.getCapePartSection(), CapeSkin.BOTTOM.getCapePartSection() }); - - private CapePartSection[] capeParts; - private String displayName; - private int id; - - private CapePart(final int id, final String displayName, final CapePartSection[] capeParts) { - this.id = id; - this.displayName = displayName; - this.capeParts = capeParts; - } - - CapePartSection getCapePartSection(final int n) { - return this.capeParts[n]; - } - - String getDisplayName() { - return this.displayName; - } - - int getPartId() { - return this.id; - } - - public enum CapeSkin - { - BACK("BACK", 2, 2, "Back", 1, 1, 10, 16), - BOTTOM("BOTTOM", 5, 5, "Bottom", 11, 0, 10, 1), - FRONT("FRONT", 0, 0, "Front", 12, 1, 10, 16), - LEFT("LEFT", 3, 3, "Left", 0, 1, 1, 16), - RIGHT("RIGHT", 1, 1, "Right", 11, 1, 1, 16), - TOP("TOP", 4, 4, "Top", 1, 0, 10, 1); - - private String displayName; - private int height; - private int id; - private int startX; - private int startY; - private int width; - - private CapeSkin(final String s2, final int n2, final int id, final String displayName, final int startX, final int startY, final int width, final int height) { - this.id = id; - this.width = width; - this.height = height; - this.displayName = displayName; - this.startX = startX; - this.startY = startY; - } - - CapePartSection getCapePartSection() { - return new CapePartSection("Cape", this.displayName, this.startX, this.startY, this.width, this.height); - } - - String getDisplayName() { - return this.displayName; - } - - int getHeight() { - return this.height; - } - - int getPartId() { - return this.id; - } - - int getStartX() { - return this.startX; - } - - int getStartY() { - return this.startY; - } - - int getWidth() { - return this.width; - } - } - -} diff --git a/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/cape/CapePartSection.java b/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/cape/CapePartSection.java deleted file mode 100644 index 8d290795..00000000 --- a/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/cape/CapePartSection.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.tungsten.fcllibrary.skin.cape; - -public class CapePartSection { - - String capePartName; - int height; - String sideName; - int startX; - int startY; - int width; - - public CapePartSection(final String capePartName, final String sideName, final int startX, final int startY, final int width, final int height) { - this.capePartName = capePartName; - this.sideName = sideName; - this.startX = startX; - this.startY = startY; - this.width = width; - this.height = height; - } - - public String getCapePartName() { - return this.capePartName; - } - - public int getHeight() { - return this.height; - } - - public String getSideName() { - return this.sideName; - } - - public int getStartX() { - return this.startX; - } - - public int getStartY() { - return this.startY; - } - - public int getWidth() { - return this.width; - } - -} diff --git a/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/cube/CapeCube.java b/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/cube/CapeCube.java new file mode 100644 index 00000000..4bbc3f93 --- /dev/null +++ b/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/cube/CapeCube.java @@ -0,0 +1,148 @@ +package com.tungsten.fcllibrary.skin.cube; + +import java.nio.ByteBuffer; +import java.nio.ByteOrder; +import java.nio.FloatBuffer; +import java.util.ArrayList; + +import javax.microedition.khronos.opengles.GL10; + +public class CapeCube { + + protected float[] scale; + protected float[] offset; + protected float[] faceVertices; + protected float[] normalVertices; + protected FloatBuffer vertexBuffer; + protected FloatBuffer normalVertexBuffer; + protected ArrayList textureBuffers; + + public CapeCube(float n1, float n2, float n3, float n4, float n5, float n6) { + this.scale = new float[3]; + this.scale[0] = n1; + this.scale[1] = n2; + this.scale[2] = n3; + this.offset = new float[3]; + this.offset[0] = n4; + this.offset[1] = n5; + this.offset[2] = n6; + this.faceVertices = new float[] { + -1.0f, -1.0f, 1.0f, + -1.0f, 1.0f, 1.0f, + 1.0f, 1.0f, 1.0f, + 1.0f, -1.0f, 1.0f, + + -1.0f, 1.0f, 1.0f, + -1.0f, 1.0f, -1.0f, + 1.0f, 1.0f, -1.0f, + 1.0f, 1.0f, 1.0f, + + 1.0f, -1.0f, 1.0f, + 1.0f, -1.0f, -1.0f, + -1.0f, -1.0f, -1.0f, + -1.0f, -1.0f, 1.0f, + + 1.0f, -1.0f, 1.0f, + 1.0f, 1.0f, 1.0f, + 1.0f, 1.0f, -1.0f, + 1.0f, -1.0f, -1.0f, + + -1.0f, -1.0f, -1.0f, + -1.0f, 1.0f, -1.0f, + -1.0f, 1.0f, 1.0f, + -1.0f, -1.0f, 1.0f, + + 1.0f, -1.0f, -1.0f, + 1.0f, 1.0f, -1.0f, + -1.0f, 1.0f, -1.0f, + -1.0f, -1.0f, -1.0f + }; + this.normalVertices = new float[] { + 0.0f, 0.0f, 1.0f, + 0.0f, 0.0f, 1.0f, + 0.0f, 0.0f, 1.0f, + 0.0f, 0.0f, 1.0f, + + 0.0f, 1.0f, 0.0f, + 0.0f, 1.0f, 0.0f, + 0.0f, 1.0f, 0.0f, + 0.0f, 1.0f, 0.0f, + + 0.0f, -1.0f, 0.0f, + 0.0f, -1.0f, 0.0f, + 0.0f, -1.0f, 0.0f, + 0.0f, -1.0f, 0.0f, + + 1.0f, 0.0f, 0.0f, + 1.0f, 0.0f, 0.0f, + 1.0f, 0.0f, 0.0f, + 1.0f, 0.0f, 0.0f, + + -1.0f, 0.0f, 0.0f, + -1.0f, 0.0f, 0.0f, + -1.0f, 0.0f, 0.0f, + -1.0f, 0.0f, 0.0f, + + 0.0f, 0.0f, -1.0f, + 0.0f, 0.0f, -1.0f, + 0.0f, 0.0f, -1.0f, + 0.0f, 0.0f, -1.0f + }; + for (int i = 0; i < 24; ++i) { + this.faceVertices[i * 3 ] = this.faceVertices[i * 3 ] * this.scale[0] / 2.0f; + this.faceVertices[i * 3 + 1] = this.faceVertices[i * 3 + 1] * this.scale[1] / 2.0f; + this.faceVertices[i * 3 + 2] = this.faceVertices[i * 3 + 2] * this.scale[2] / 2.0f; + } + final ByteBuffer allocateDirectFace = ByteBuffer.allocateDirect(this.faceVertices.length * 4); + allocateDirectFace.order(ByteOrder.nativeOrder()); + this.vertexBuffer = allocateDirectFace.asFloatBuffer(); + this.vertexBuffer.put(this.faceVertices); + this.vertexBuffer.position(0); + final ByteBuffer allocateDirectNormal = ByteBuffer.allocateDirect(this.normalVertices.length * 4); + allocateDirectNormal.order(ByteOrder.nativeOrder()); + this.normalVertexBuffer = allocateDirectNormal.asFloatBuffer(); + this.normalVertexBuffer.put(this.normalVertices); + this.normalVertexBuffer.position(0); + this.textureBuffers = new ArrayList<>(); + } + + public FloatBuffer addTextures(final float[] texture) { + final ByteBuffer allocateDirect = ByteBuffer.allocateDirect(texture.length * 4); + allocateDirect.order(ByteOrder.nativeOrder()); + final FloatBuffer floatBuffer = allocateDirect.asFloatBuffer(); + floatBuffer.put(texture); + floatBuffer.position(0); + this.textureBuffers.add(floatBuffer); + return floatBuffer; + } + + public void clearAllTextures() { + this.textureBuffers.clear(); + } + + public void draw(final GL10 gl10) { + gl10.glEnable(GL10.GL_BLEND); + gl10.glBlendFunc(GL10.GL_ONE, GL10.GL_ONE_MINUS_SRC_ALPHA); + gl10.glEnableClientState(GL10.GL_VERTEX_ARRAY); + gl10.glEnableClientState(GL10.GL_NORMAL_ARRAY); + gl10.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY); + gl10.glVertexPointer(3, GL10.GL_FLOAT, 0, this.vertexBuffer); + gl10.glNormalPointer(GL10.GL_FLOAT, 0, this.normalVertexBuffer); + gl10.glPushMatrix(); + gl10.glTranslatef(this.offset[0], this.offset[1], this.offset[2]); + gl10.glTranslatef(0.0f, this.scale[1] / 4.0f * 3.0f, 0.0f); + gl10.glRotatef(12f, 1f, 0f, 0f); + gl10.glTranslatef(0.0f, -this.scale[1] / 4.0f * 3.0f, 0.0f); + for (int i = 0; i < this.textureBuffers.size(); ++i) { + gl10.glTexCoordPointer(2, GL10.GL_FLOAT, 0, this.textureBuffers.get(i)); + for (int j = 0; j < 6; ++j) { + gl10.glDrawArrays(6, j * 4, 4); + } + } + gl10.glPopMatrix(); + gl10.glDisable(GL10.GL_BLEND); + gl10.glDisableClientState(GL10.GL_TEXTURE_COORD_ARRAY); + gl10.glDisableClientState(GL10.GL_NORMAL_ARRAY); + gl10.glDisableClientState(GL10.GL_VERTEX_ARRAY); + } +} diff --git a/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/cube/LimbCube.java b/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/cube/LimbCube.java new file mode 100644 index 00000000..cf8328fa --- /dev/null +++ b/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/cube/LimbCube.java @@ -0,0 +1,212 @@ +package com.tungsten.fcllibrary.skin.cube; + +import java.nio.ByteBuffer; +import java.nio.ByteOrder; +import java.nio.FloatBuffer; +import java.util.ArrayList; + +import javax.microedition.khronos.opengles.GL10; + +public class LimbCube { + + protected float[] scale; + protected float[] offset; + protected int[] faceIndecies; + protected float[] faceVertices; + protected float[] normalVertices; + protected float[] vertices; + protected float[] mainAngleAxis; + protected float mainAngle; + protected float mainMaxAngle; + protected float mainMinAngle; + protected float mainStepValue; + protected float[] subAngleAxis; + protected float subAngle; + protected float subMaxAngle; + protected float subMinAngle; + protected float subStepValue; + protected FloatBuffer vertexBuffer; + protected FloatBuffer normalVertexBuffer; + protected ArrayList textureBuffers; + + public LimbCube(float n1, float n2, float n3, float n4, float n5, float n6, float n7, float n8, float n9, float mainStepValue, float mainMaxAngle, float mainMinAngle, float subStepValue, float subMaxAngle, float subMinAngle) { + this.scale = new float[3]; + this.scale[0] = n1; + this.scale[1] = n2; + this.scale[2] = n3; + this.offset = new float[3]; + this.offset[0] = n4; + this.offset[1] = n5; + this.offset[2] = n6; + this.mainAngleAxis = new float[3]; + this.mainAngleAxis[0] = n7; + this.mainAngleAxis[1] = n8; + this.mainAngleAxis[2] = n9; + this.mainAngle = 0.0f; + this.mainStepValue = mainStepValue; + this.mainMaxAngle = mainMaxAngle; + this.mainMinAngle = mainMinAngle; + this.subAngleAxis = new float[3]; + this.subAngle = 0.0f; + this.subStepValue = subStepValue; + this.subMaxAngle = subMaxAngle; + this.subMinAngle = subMinAngle; + this.vertices = new float[] { + -1.0f, -1.0f, 1.0f, + 1.0f, -1.0f, 1.0f, + 1.0f, 1.0f, 1.0f, + -1.0f, 1.0f, 1.0f, + + -1.0f, -1.0f, -1.0f, + 1.0f, -1.0f, -1.0f, + 1.0f, 1.0f, -1.0f, + -1.0f, 1.0f, -1.0f, + + -1.0f, 0.0f, 1.0f, + 1.0f, 0.0f, 1.0f, + 1.0f, 0.0f, -1.0f, + -1.0f, 0.0f, -1.0f + }; + this.faceIndecies = new int[] { + 0, 8, 9, 1, + 8, 3, 2, 9, + 3, 7, 6, 2, + 1, 5, 4, 0, + 1, 9, 10, 5, + 9, 2, 6, 10, + 4, 11, 8, 0, + 11, 7, 3, 8, + 5, 10, 11, 4, + 10, 6, 7, 11 + }; + this.faceVertices = new float[this.faceIndecies.length * 3]; + this.normalVertices = new float[] { + 0.0f, 0.0f, 1.0f, + 0.0f, 0.0f, 1.0f, + 0.0f, 0.0f, 1.0f, + 0.0f, 0.0f, 1.0f, + + 0.0f, 0.0f, 1.0f, + 0.0f, 0.0f, 1.0f, + 0.0f, 0.0f, 1.0f, + 0.0f, 0.0f, 1.0f, + + 0.0f, 1.0f, 0.0f, + 0.0f, 1.0f, 0.0f, + 0.0f, 1.0f, 0.0f, + 0.0f, 1.0f, 0.0f, + + 0.0f, -1.0f, 0.0f, + 0.0f, -1.0f, 0.0f, + 0.0f, -1.0f, 0.0f, + 0.0f, -1.0f, 0.0f, + + 1.0f, 0.0f, 0.0f, + 1.0f, 0.0f, 0.0f, + 1.0f, 0.0f, 0.0f, + 1.0f, 0.0f, 0.0f, + + 1.0f, 0.0f, 0.0f, + 1.0f, 0.0f, 0.0f, + 1.0f, 0.0f, 0.0f, + 1.0f, 0.0f, 0.0f, + + -1.0f, 0.0f, 0.0f, + -1.0f, 0.0f, 0.0f, + -1.0f, 0.0f, 0.0f, + -1.0f, 0.0f, 0.0f, + + -1.0f, 0.0f, 0.0f, + -1.0f, 0.0f, 0.0f, + -1.0f, 0.0f, 0.0f, + -1.0f, 0.0f, 0.0f, + + 0.0f, 0.0f, -1.0f, + 0.0f, 0.0f, -1.0f, + 0.0f, 0.0f, -1.0f, + 0.0f, 0.0f, -1.0f, + + 0.0f, 0.0f, -1.0f, + 0.0f, 0.0f, -1.0f, + 0.0f, 0.0f, -1.0f, + 0.0f, 0.0f, -1.0f + }; + final ByteBuffer allocateDirectFace = ByteBuffer.allocateDirect(this.faceVertices.length * 4); + allocateDirectFace.order(ByteOrder.nativeOrder()); + this.vertexBuffer = allocateDirectFace.asFloatBuffer(); + this.vertexBuffer.put(this.faceVertices); + this.vertexBuffer.position(0); + final ByteBuffer allocateDirectNormal = ByteBuffer.allocateDirect(this.normalVertices.length * 4); + allocateDirectNormal.order(ByteOrder.nativeOrder()); + this.normalVertexBuffer = allocateDirectNormal.asFloatBuffer(); + this.normalVertexBuffer.put(this.normalVertices); + this.normalVertexBuffer.position(0); + this.textureBuffers = new ArrayList<>(); + } + + public FloatBuffer addTextures(final float[] texture) { + final ByteBuffer allocateDirect = ByteBuffer.allocateDirect(texture.length * 4); + allocateDirect.order(ByteOrder.nativeOrder()); + final FloatBuffer floatBuffer = allocateDirect.asFloatBuffer(); + floatBuffer.put(texture); + floatBuffer.position(0); + this.textureBuffers.add(floatBuffer); + return floatBuffer; + } + + public void clearAllTextures() { + this.textureBuffers.clear(); + } + + public void draw(final GL10 gl10, final boolean isRunning) { + gl10.glEnable(GL10.GL_BLEND); + gl10.glBlendFunc(GL10.GL_ONE, GL10.GL_ONE_MINUS_SRC_ALPHA); + gl10.glEnableClientState(GL10.GL_VERTEX_ARRAY); + gl10.glEnableClientState(GL10.GL_NORMAL_ARRAY); + gl10.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY); + gl10.glNormalPointer(GL10.GL_FLOAT, 0, this.normalVertexBuffer); + for (int i = 0; i < this.faceIndecies.length; ++i) { + final int n = this.faceIndecies[i]; + final float n2 = this.vertices[n * 3 + 1] * this.scale[1] / 2.0f; + final float n3 = this.vertices[n * 3 + 2] * this.scale[2] / 2.0f; + this.vertexBuffer.put(i * 3, this.vertices[n * 3] * this.scale[0] / 2.0f); + this.vertexBuffer.put(i * 3 + 1, n2); + this.vertexBuffer.put(i * 3 + 2, n3); + } + gl10.glVertexPointer(3, GL10.GL_FLOAT, 0, this.vertexBuffer); + gl10.glPushMatrix(); + gl10.glTranslatef(this.offset[0], this.offset[1], this.offset[2]); + if (isRunning) { + gl10.glTranslatef(0.0f, this.scale[1] / 4.0f * 3.0f, 0.0f); + gl10.glRotatef(this.mainAngle, this.mainAngleAxis[0], this.mainAngleAxis[1], this.mainAngleAxis[2]); + gl10.glTranslatef(0.0f, -this.scale[1] / 4.0f * 3.0f, 0.0f); + this.mainAngle += this.mainStepValue; + if (this.mainAngle >= this.mainMaxAngle) { + this.mainStepValue *= -1.0f; + this.mainAngle = this.mainMaxAngle; + } else if (this.mainAngle <= this.mainMinAngle) { + this.mainStepValue *= -1.0f; + this.mainAngle = this.mainMinAngle; + } + this.subAngle += this.subStepValue; + if (this.subAngle >= this.subMaxAngle) { + this.subStepValue *= -1.0f; + this.subAngle = this.subMaxAngle; + } else if (this.subAngle <= this.subMinAngle) { + this.subStepValue *= -1.0f; + this.subAngle = this.subMinAngle; + } + } + for (int i = 0; i < this.textureBuffers.size(); ++i) { + gl10.glTexCoordPointer(2, GL10.GL_FLOAT, 0, this.textureBuffers.get(i)); + for (int j = 0; j < 10; ++j) { + gl10.glDrawArrays(6, j * 4, 4); + } + } + gl10.glPopMatrix(); + gl10.glDisable(GL10.GL_BLEND); + gl10.glDisableClientState(GL10.GL_TEXTURE_COORD_ARRAY); + gl10.glDisableClientState(GL10.GL_NORMAL_ARRAY); + gl10.glDisableClientState(GL10.GL_VERTEX_ARRAY); + } +} diff --git a/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/cube/MainCube.java b/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/cube/MainCube.java new file mode 100644 index 00000000..dd5b43bc --- /dev/null +++ b/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/cube/MainCube.java @@ -0,0 +1,140 @@ +package com.tungsten.fcllibrary.skin.cube; + +import java.nio.ByteBuffer; +import java.nio.ByteOrder; +import java.nio.FloatBuffer; +import java.util.ArrayList; + +import javax.microedition.khronos.opengles.GL10; + +public class MainCube { + + protected float[] offset; + protected float[] faceVertices; + protected float[] normalVertices; + protected FloatBuffer vertexBuffer; + protected FloatBuffer normalVertexBuffer; + protected ArrayList textureBuffers; + + public MainCube(float n1, float n2, float n3, float n4, float n5, float n6) { + this.offset = new float[3]; + this.offset[0] = n4; + this.offset[1] = n5; + this.offset[2] = n6; + this.faceVertices = new float[] { + -1.0f, -1.0f, 1.0f, + -1.0f, 1.0f, 1.0f, + 1.0f, 1.0f, 1.0f, + 1.0f, -1.0f, 1.0f, + + -1.0f, 1.0f, 1.0f, + -1.0f, 1.0f, -1.0f, + 1.0f, 1.0f, -1.0f, + 1.0f, 1.0f, 1.0f, + + 1.0f, -1.0f, 1.0f, + 1.0f, -1.0f, -1.0f, + -1.0f, -1.0f, -1.0f, + -1.0f, -1.0f, 1.0f, + + 1.0f, -1.0f, 1.0f, + 1.0f, 1.0f, 1.0f, + 1.0f, 1.0f, -1.0f, + 1.0f, -1.0f, -1.0f, + + -1.0f, -1.0f, -1.0f, + -1.0f, 1.0f, -1.0f, + -1.0f, 1.0f, 1.0f, + -1.0f, -1.0f, 1.0f, + + 1.0f, -1.0f, -1.0f, + 1.0f, 1.0f, -1.0f, + -1.0f, 1.0f, -1.0f, + -1.0f, -1.0f, -1.0f + }; + this.normalVertices = new float[] { + 0.0f, 0.0f, 1.0f, + 0.0f, 0.0f, 1.0f, + 0.0f, 0.0f, 1.0f, + 0.0f, 0.0f, 1.0f, + + 0.0f, 1.0f, 0.0f, + 0.0f, 1.0f, 0.0f, + 0.0f, 1.0f, 0.0f, + 0.0f, 1.0f, 0.0f, + + 0.0f, -1.0f, 0.0f, + 0.0f, -1.0f, 0.0f, + 0.0f, -1.0f, 0.0f, + 0.0f, -1.0f, 0.0f, + + 1.0f, 0.0f, 0.0f, + 1.0f, 0.0f, 0.0f, + 1.0f, 0.0f, 0.0f, + 1.0f, 0.0f, 0.0f, + + -1.0f, 0.0f, 0.0f, + -1.0f, 0.0f, 0.0f, + -1.0f, 0.0f, 0.0f, + -1.0f, 0.0f, 0.0f, + + 0.0f, 0.0f, -1.0f, + 0.0f, 0.0f, -1.0f, + 0.0f, 0.0f, -1.0f, + 0.0f, 0.0f, -1.0f + }; + for (int i = 0; i < 24; ++i) { + this.faceVertices[i * 3 ] = this.faceVertices[i * 3 ] * n1 / 2.0f; + this.faceVertices[i * 3 + 1] = this.faceVertices[i * 3 + 1] * n2 / 2.0f; + this.faceVertices[i * 3 + 2] = this.faceVertices[i * 3 + 2] * n3 / 2.0f; + } + final ByteBuffer allocateDirectFace = ByteBuffer.allocateDirect(this.faceVertices.length * 4); + allocateDirectFace.order(ByteOrder.nativeOrder()); + this.vertexBuffer = allocateDirectFace.asFloatBuffer(); + this.vertexBuffer.put(this.faceVertices); + this.vertexBuffer.position(0); + final ByteBuffer allocateDirectNormal = ByteBuffer.allocateDirect(this.normalVertices.length * 4); + allocateDirectNormal.order(ByteOrder.nativeOrder()); + this.normalVertexBuffer = allocateDirectNormal.asFloatBuffer(); + this.normalVertexBuffer.put(this.normalVertices); + this.normalVertexBuffer.position(0); + this.textureBuffers = new ArrayList<>(); + } + + public FloatBuffer addTextures(float[] texture) { + final ByteBuffer allocateDirect = ByteBuffer.allocateDirect(texture.length * 4); + allocateDirect.order(ByteOrder.nativeOrder()); + final FloatBuffer floatBuffer = allocateDirect.asFloatBuffer(); + floatBuffer.put(texture); + floatBuffer.position(0); + this.textureBuffers.add(floatBuffer); + return floatBuffer; + } + + public void clearAllTextures() { + this.textureBuffers.clear(); + } + + public void draw(GL10 gl10) { + gl10.glEnable(GL10.GL_BLEND); + gl10.glBlendFunc(GL10.GL_ONE, GL10.GL_ONE_MINUS_SRC_ALPHA); + gl10.glEnableClientState(GL10.GL_VERTEX_ARRAY); + gl10.glEnableClientState(GL10.GL_NORMAL_ARRAY); + gl10.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY); + gl10.glVertexPointer(3, GL10.GL_FLOAT, 0, this.vertexBuffer); + gl10.glNormalPointer(GL10.GL_FLOAT, 0, this.normalVertexBuffer); + gl10.glPushMatrix(); + gl10.glTranslatef(this.offset[0], this.offset[1], this.offset[2]); + for (int i = 0; i < this.textureBuffers.size(); ++i) { + gl10.glTexCoordPointer(2, GL10.GL_FLOAT, 0, this.textureBuffers.get(i)); + for (int j = 0; j < 6; ++j) { + gl10.glDrawArrays(6, j * 4, 4); + } + } + gl10.glPopMatrix(); + gl10.glDisable(GL10.GL_BLEND); + gl10.glDisableClientState(GL10.GL_TEXTURE_COORD_ARRAY); + gl10.glDisableClientState(GL10.GL_NORMAL_ARRAY); + gl10.glDisableClientState(GL10.GL_VERTEX_ARRAY); + } +} diff --git a/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/body/cube/steve/LArm.java b/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/cube/arm/normal/LeftArm.java similarity index 66% rename from FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/body/cube/steve/LArm.java rename to FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/cube/arm/normal/LeftArm.java index 6e2d571f..9ace3c7e 100644 --- a/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/body/cube/steve/LArm.java +++ b/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/cube/arm/normal/LeftArm.java @@ -1,14 +1,17 @@ -package com.tungsten.fcllibrary.skin.body.cube.steve; +package com.tungsten.fcllibrary.skin.cube.arm.normal; -import com.tungsten.fcllibrary.skin.body.LimbCube; +import com.tungsten.fcllibrary.skin.cube.LimbCube; -public class LArm extends LimbCube { +public class LeftArm extends LimbCube { - protected float[] larm_texcoords; + protected float[] leftArmTexCoordinates; - public LArm(float scale) { - super(4.0f * scale, 12.0f * scale, 4.0f * scale, 6.0f * scale, 2.0f * scale, 0.0f * scale, -0.5f, 1.0f, 0.0f, 0.0f, 10.0f, -10.0f, 0.333f, 20.0f, -20.0f, true, -1.0f); - this.larm_texcoords = new float[] { + public LeftArm(float scale) { + super(4.0f * scale, 12.0f * scale, 4.0f * scale, 6.0f * scale, 2.0f * scale, 0.0f * scale, + 1.0f, 0.0f, 0.0f, + -0.5f, 10.0f, -10.0f, + 0.333f, 20.0f, -20.0f); + this.leftArmTexCoordinates = new float[] { 0.5625f, 1.0f, 0.5625f, 0.90625f, 0.625f, 0.90625f, 0.625f, 1.0f, 0.5625f, 0.90625f, 0.5625f, 0.8125f, 0.625f, 0.8125f, 0.625f, 0.90625f, 0.5625f, 0.8125f, 0.5625f, 0.75f, 0.625f, 0.75f, 0.625f, 0.8125f, @@ -20,6 +23,6 @@ public class LArm extends LimbCube { 0.6875f, 1.0f, 0.6875f, 0.90625f, 0.75f, 0.90625f, 0.75f, 1.0f, 0.6875f, 0.90625f, 0.6875f, 0.8125f, 0.75f, 0.8125f, 0.75f, 0.90625f }; - this.AddTextures(this.larm_texcoords); + addTextures(this.leftArmTexCoordinates); } } diff --git a/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/body/cube/steve/LArmOverlay.java b/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/cube/arm/normal/LeftArmOverlay.java similarity index 63% rename from FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/body/cube/steve/LArmOverlay.java rename to FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/cube/arm/normal/LeftArmOverlay.java index 1529a22a..93f3ba94 100644 --- a/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/body/cube/steve/LArmOverlay.java +++ b/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/cube/arm/normal/LeftArmOverlay.java @@ -1,14 +1,17 @@ -package com.tungsten.fcllibrary.skin.body.cube.steve; +package com.tungsten.fcllibrary.skin.cube.arm.normal; -import com.tungsten.fcllibrary.skin.body.LimbCube; +import com.tungsten.fcllibrary.skin.cube.LimbCube; -public class LArmOverlay extends LimbCube { +public class LeftArmOverlay extends LimbCube { - protected float[] larm1_texcoords; + protected float[] leftArmOverlayTexCoordinates; - public LArmOverlay(float scale) { - super(4.2352943f * scale, 12.705883f * scale, 4.2352943f * scale, 6.0f * scale, 2.0f * scale, 0.0f * scale, -0.5f, 1.0f, 0.0f, 0.0f, 10.0f, -10.0f, 0.333f, 20.0f, -20.0f, true, -1.0f); - this.larm1_texcoords = new float[] { + public LeftArmOverlay(float scale) { + super(4.2352943f * scale, 12.705883f * scale, 4.2352943f * scale, 6.0f * scale, 2.0f * scale, 0.0f * scale, + 1.0f, 0.0f, 0.0f, + -0.5f, 10.0f, -10.0f, + 0.333f, 20.0f, -20.0f); + this.leftArmOverlayTexCoordinates = new float[] { 0.8125f, 1.0f, 0.8125f, 0.90625f, 0.875f, 0.90625f, 0.875f, 1.0f, 0.8125f, 0.90625f, 0.8125f, 0.8125f, 0.875f, 0.8125f, 0.875f, 0.90625f, 0.8125f, 0.8125f, 0.8125f, 0.75f, 0.875f, 0.75f, 0.875f, 0.8125f, @@ -20,6 +23,6 @@ public class LArmOverlay extends LimbCube { 0.9375f, 1.0f, 0.9375f, 0.90625f, 1.0f, 0.90625f, 1.0f, 1.0f, 0.9375f, 0.90625f, 0.9375f, 0.8125f, 1.0f, 0.8125f, 1.0f, 0.90625f }; - this.AddTextures(this.larm1_texcoords); + addTextures(this.leftArmOverlayTexCoordinates); } } diff --git a/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/body/cube/steve/RArm.java b/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/cube/arm/normal/RightArm.java similarity index 65% rename from FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/body/cube/steve/RArm.java rename to FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/cube/arm/normal/RightArm.java index f3d12363..f2aca1cf 100644 --- a/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/body/cube/steve/RArm.java +++ b/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/cube/arm/normal/RightArm.java @@ -1,14 +1,17 @@ -package com.tungsten.fcllibrary.skin.body.cube.steve; +package com.tungsten.fcllibrary.skin.cube.arm.normal; -import com.tungsten.fcllibrary.skin.body.LimbCube; +import com.tungsten.fcllibrary.skin.cube.LimbCube; -public class RArm extends LimbCube { +public class RightArm extends LimbCube { - protected float[] rarm_texcoords; + protected float[] rightArmTexCoordinates; - public RArm(float scale) { - super(4.0f * scale, 12.0f * scale, 4.0f * scale, -6.0f * scale, 2.0f * scale, 0.0f * scale, 0.5f, 1.0f, 0.0f, 0.0f, 10.0f, -10.0f, -0.333f, 20.0f, -20.0f, true, -1.0f); - this.rarm_texcoords = new float[] { + public RightArm(float scale) { + super(4.0f * scale, 12.0f * scale, 4.0f * scale, -6.0f * scale, 2.0f * scale, 0.0f * scale, + 1.0f, 0.0f, 0.0f, + 0.5f, 10.0f, -10.0f, + -0.333f, 20.0f, -20.0f); + this.rightArmTexCoordinates = new float[] { 0.6875f, 0.5f, 0.6875f, 0.40625f, 0.75f, 0.40625f, 0.75f, 0.5f, 0.6875f, 0.40625f, 0.6875f, 0.3125f, 0.75f, 0.3125f, 0.75f, 0.40625f, 0.6875f, 0.3125f, 0.6875f, 0.25f, 0.75f, 0.25f, 0.75f, 0.3125f, @@ -20,6 +23,6 @@ public class RArm extends LimbCube { 0.8125f, 0.5f, 0.8125f, 0.40625f, 0.875f, 0.40625f, 0.875f, 0.5f, 0.8125f, 0.40625f, 0.8125f, 0.3125f, 0.875f, 0.3125f, 0.875f, 0.40625f }; - this.AddTextures(this.rarm_texcoords); + addTextures(this.rightArmTexCoordinates); } } diff --git a/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/body/cube/steve/RArmOverlay.java b/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/cube/arm/normal/RightArmOverlay.java similarity index 63% rename from FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/body/cube/steve/RArmOverlay.java rename to FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/cube/arm/normal/RightArmOverlay.java index 8ad002c2..04db295d 100644 --- a/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/body/cube/steve/RArmOverlay.java +++ b/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/cube/arm/normal/RightArmOverlay.java @@ -1,14 +1,17 @@ -package com.tungsten.fcllibrary.skin.body.cube.steve; +package com.tungsten.fcllibrary.skin.cube.arm.normal; -import com.tungsten.fcllibrary.skin.body.LimbCube; +import com.tungsten.fcllibrary.skin.cube.LimbCube; -public class RArmOverlay extends LimbCube { +public class RightArmOverlay extends LimbCube { - protected float[] rarm1_texcoords; + protected float[] rightArmOverlayTexCoordinates; - public RArmOverlay(float scale) { - super(4.2352943f * scale, 12.705883f * scale, 4.2352943f * scale, -6.0f * scale, 2.0f * scale, 0.0f * scale, 0.5f, 1.0f, 0.0f, 0.0f, 10.0f, -10.0f, -0.333f, 20.0f, -20.0f, true, -1.0f); - this.rarm1_texcoords = new float[] { + public RightArmOverlay(float scale) { + super(4.2352943f * scale, 12.705883f * scale, 4.2352943f * scale, -6.0f * scale, 2.0f * scale, 0.0f * scale, + 1.0f, 0.0f, 0.0f, + 0.5f, 10.0f, -10.0f, + -0.333f, 20.0f, -20.0f); + this.rightArmOverlayTexCoordinates = new float[] { 0.6875f, 0.75f, 0.6875f, 0.65625f, 0.75f, 0.65625f, 0.75f, 0.75f, 0.6875f, 0.65625f, 0.6875f, 0.5625f, 0.75f, 0.5625f, 0.75f, 0.65625f, 0.6875f, 0.5625f, 0.6875f, 0.5f, 0.75f, 0.5f, 0.75f, 0.5625f, @@ -20,6 +23,6 @@ public class RArmOverlay extends LimbCube { 0.8125f, 0.75f, 0.8125f, 0.65625f, 0.875f, 0.65625f, 0.875f, 0.75f, 0.8125f, 0.65625f, 0.8125f, 0.5625f, 0.875f, 0.5625f, 0.875f, 0.65625f }; - this.AddTextures(this.rarm1_texcoords); + addTextures(this.rightArmOverlayTexCoordinates); } } diff --git a/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/body/cube/alex/AlexLArm.java b/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/cube/arm/slim/LeftArmSlim.java similarity index 66% rename from FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/body/cube/alex/AlexLArm.java rename to FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/cube/arm/slim/LeftArmSlim.java index db3d626c..6097b0dc 100644 --- a/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/body/cube/alex/AlexLArm.java +++ b/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/cube/arm/slim/LeftArmSlim.java @@ -1,14 +1,17 @@ -package com.tungsten.fcllibrary.skin.body.cube.alex; +package com.tungsten.fcllibrary.skin.cube.arm.slim; -import com.tungsten.fcllibrary.skin.body.LimbCube; +import com.tungsten.fcllibrary.skin.cube.LimbCube; -public class AlexLArm extends LimbCube { +public class LeftArmSlim extends LimbCube { - protected float[] larm_texcoords; + protected float[] leftArmSlimTexCoordinates; - public AlexLArm(float scale) { - super(3.0f * scale, 12.0f * scale, 4.0f * scale, 5.5f * scale, 2.0f * scale, 0.0f * scale, -0.5f, 1.0f, 0.0f, 0.0f, 10.0f, -10.0f, 0.333f, 20.0f, -20.0f, true, -1.0f); - this.larm_texcoords = new float[] { + public LeftArmSlim(float scale) { + super(3.0f * scale, 12.0f * scale, 4.0f * scale, 5.5f * scale, 2.0f * scale, 0.0f * scale, + 1.0f, 0.0f, 0.0f, + -0.5f, 10.0f, -10.0f, + 0.333f, 20.0f, -20.0f); + this.leftArmSlimTexCoordinates = new float[] { 0.5625f, 1.0f, 0.5625f, 0.90625f, 0.609375f, 0.90625f, 0.609375f, 1.0f, 0.5625f, 0.90625f, 0.5625f, 0.8125f, 0.609375f, 0.8125f, 0.609375f, 0.90625f, 0.5625f, 0.8125f, 0.5625f, 0.75f, 0.609375f, 0.75f, 0.609375f, 0.8125f, @@ -20,6 +23,6 @@ public class AlexLArm extends LimbCube { 0.671875f, 1.0f, 0.671875f, 0.90625f, 0.71875f, 0.90625f, 0.71875f, 1.0f, 0.671875f, 0.90625f, 0.671875f, 0.8125f, 0.71875f, 0.8125f, 0.71875f, 0.90625f }; - this.AddTextures(this.larm_texcoords); + addTextures(this.leftArmSlimTexCoordinates); } } diff --git a/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/body/cube/alex/AlexLArmOverlay.java b/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/cube/arm/slim/LeftArmSlimOverlay.java similarity index 63% rename from FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/body/cube/alex/AlexLArmOverlay.java rename to FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/cube/arm/slim/LeftArmSlimOverlay.java index b763bb0d..91ea9bfe 100644 --- a/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/body/cube/alex/AlexLArmOverlay.java +++ b/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/cube/arm/slim/LeftArmSlimOverlay.java @@ -1,14 +1,17 @@ -package com.tungsten.fcllibrary.skin.body.cube.alex; +package com.tungsten.fcllibrary.skin.cube.arm.slim; -import com.tungsten.fcllibrary.skin.body.LimbCube; +import com.tungsten.fcllibrary.skin.cube.LimbCube; -public class AlexLArmOverlay extends LimbCube { +public class LeftArmSlimOverlay extends LimbCube { - protected float[] larm1_texcoords; + protected float[] leftArmSlimOverlayTexCoordinates; - public AlexLArmOverlay(float scale) { - super(3.1764708f * scale, 12.705883f * scale, 4.2352943f * scale, 5.5f * scale, 2.0f * scale, 0.0f * scale, -0.5f, 1.0f, 0.0f, 0.0f, 10.0f, -10.0f, 0.333f, 20.0f, -20.0f, true, -1.0f); - this.larm1_texcoords = new float[] { + public LeftArmSlimOverlay(float scale) { + super(3.1764708f * scale, 12.705883f * scale, 4.2352943f * scale, 5.5f * scale, 2.0f * scale, 0.0f * scale, + 1.0f, 0.0f, 0.0f, + -0.5f, 10.0f, -10.0f, + 0.333f, 20.0f, -20.0f); + this.leftArmSlimOverlayTexCoordinates = new float[] { 0.8125f, 1.0f, 0.8125f, 0.90625f, 0.875f, 0.90625f, 0.875f, 1.0f, 0.8125f, 0.90625f, 0.8125f, 0.8125f, 0.875f, 0.8125f, 0.875f, 0.90625f, 0.8125f, 0.8125f, 0.8125f, 0.75f, 0.875f, 0.75f, 0.875f, 0.8125f, @@ -20,6 +23,6 @@ public class AlexLArmOverlay extends LimbCube { 0.9375f, 1.0f, 0.9375f, 0.90625f, 1.0f, 0.90625f, 1.0f, 1.0f, 0.9375f, 0.90625f, 0.9375f, 0.8125f, 1.0f, 0.8125f, 1.0f, 0.90625f }; - this.AddTextures(this.larm1_texcoords); + addTextures(this.leftArmSlimOverlayTexCoordinates); } } diff --git a/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/body/cube/alex/AlexRArm.java b/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/cube/arm/slim/RightArmSlim.java similarity index 66% rename from FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/body/cube/alex/AlexRArm.java rename to FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/cube/arm/slim/RightArmSlim.java index 0efafd5b..5a18fb3d 100644 --- a/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/body/cube/alex/AlexRArm.java +++ b/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/cube/arm/slim/RightArmSlim.java @@ -1,14 +1,17 @@ -package com.tungsten.fcllibrary.skin.body.cube.alex; +package com.tungsten.fcllibrary.skin.cube.arm.slim; -import com.tungsten.fcllibrary.skin.body.LimbCube; +import com.tungsten.fcllibrary.skin.cube.LimbCube; -public class AlexRArm extends LimbCube { +public class RightArmSlim extends LimbCube { - protected float[] rarm_texcoords; + protected float[] rightArmSlimTexCoordinates; - public AlexRArm(float scale) { - super(3.0f * scale, 12.0f * scale, 4.0f * scale, -5.5f * scale, 2.0f * scale, 0.0f * scale, 0.5f, 1.0f, 0.0f, 0.0f, 10.0f, -10.0f, -0.333f, 20.0f, -20.0f, true, -1.0f); - this.rarm_texcoords = new float[] { + public RightArmSlim(float scale) { + super(3.0f * scale, 12.0f * scale, 4.0f * scale, -5.5f * scale, 2.0f * scale, 0.0f * scale, + 1.0f, 0.0f, 0.0f, + 0.5f, 10.0f, -10.0f, + -0.333f, 20.0f, -20.0f); + this.rightArmSlimTexCoordinates = new float[] { 0.6875f, 0.5f, 0.6875f, 0.40625f, 0.734375f, 0.40625f, 0.734375f, 0.5f, 0.6875f, 0.40625f, 0.6875f, 0.3125f, 0.734375f, 0.3125f, 0.734375f, 0.40625f, 0.6875f, 0.3125f, 0.6875f, 0.25f, 0.734375f, 0.25f, 0.734375f, 0.3125f, @@ -20,6 +23,6 @@ public class AlexRArm extends LimbCube { 0.796875f, 0.5f, 0.796875f, 0.40625f, 0.84375f, 0.40625f, 0.84375f, 0.5f, 0.796875f, 0.40625f, 0.796875f, 0.3125f, 0.84375f, 0.3125f, 0.84375f, 0.40625f }; - this.AddTextures(this.rarm_texcoords); + addTextures(this.rightArmSlimTexCoordinates); } } diff --git a/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/body/cube/alex/AlexRArmOverlay.java b/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/cube/arm/slim/RightArmSlimOverlay.java similarity index 64% rename from FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/body/cube/alex/AlexRArmOverlay.java rename to FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/cube/arm/slim/RightArmSlimOverlay.java index 87c3752f..98893442 100644 --- a/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/body/cube/alex/AlexRArmOverlay.java +++ b/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/cube/arm/slim/RightArmSlimOverlay.java @@ -1,14 +1,17 @@ -package com.tungsten.fcllibrary.skin.body.cube.alex; +package com.tungsten.fcllibrary.skin.cube.arm.slim; -import com.tungsten.fcllibrary.skin.body.LimbCube; +import com.tungsten.fcllibrary.skin.cube.LimbCube; -public class AlexRArmOverlay extends LimbCube { +public class RightArmSlimOverlay extends LimbCube { - protected float[] rarm1_texcoords; + protected float[] rightArmSlimOverlayTexCoordinates; - public AlexRArmOverlay(float scale) { - super(3.1764708f * scale, 12.705883f * scale, 4.2352943f * scale, -5.5f * scale, 2.0f * scale, 0.0f * scale, 0.5f, 1.0f, 0.0f, 0.0f, 10.0f, -10.0f, -0.333f, 20.0f, -20.0f, true, -1.0f); - this.rarm1_texcoords = new float[] { + public RightArmSlimOverlay(float scale) { + super(3.1764708f * scale, 12.705883f * scale, 4.2352943f * scale, -5.5f * scale, 2.0f * scale, 0.0f * scale, + 1.0f, 0.0f, 0.0f, + 0.5f, 10.0f, -10.0f, + -0.333f, 20.0f, -20.0f); + this.rightArmSlimOverlayTexCoordinates = new float[] { 0.6875f, 0.75f, 0.6875f, 0.65625f, 0.734375f, 0.65625f, 0.734375f, 0.75f, 0.6875f, 0.65625f, 0.6875f, 0.5625f, 0.734375f, 0.5625f, 0.734375f, 0.65625f, 0.6875f, 0.5625f, 0.6875f, 0.5f, 0.734375f, 0.5f, 0.734375f, 0.5625f, @@ -20,6 +23,6 @@ public class AlexRArmOverlay extends LimbCube { 0.796875f, 1.0f, 0.796875f, 0.90625f, 0.84375f, 0.90625f, 0.84375f, 1.0f, 0.796875f, 0.90625f, 0.796875f, 0.8125f, 0.84375f, 0.8125f, 0.84375f, 0.90625f }; - this.AddTextures(this.rarm1_texcoords); + addTextures(this.rightArmSlimOverlayTexCoordinates); } } diff --git a/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/body/cube/Body.java b/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/cube/body/Body.java similarity index 67% rename from FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/body/cube/Body.java rename to FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/cube/body/Body.java index d90d241a..078e0a59 100644 --- a/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/body/cube/Body.java +++ b/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/cube/body/Body.java @@ -1,14 +1,14 @@ -package com.tungsten.fcllibrary.skin.body.cube; +package com.tungsten.fcllibrary.skin.cube.body; -import com.tungsten.fcllibrary.skin.body.MainCube; +import com.tungsten.fcllibrary.skin.cube.MainCube; public class Body extends MainCube { - protected float[] body_texcoords; + protected float[] bodyTexCoordinates; public Body(float scale) { - super(8.0f * scale, 12.0f * scale, 4.0f * scale, 0.0f * scale, 2.0f * scale, 0.0f * scale, -0.15f, 0.0f, 1.0f, 0.0f, 3.0f, -3.0f); - this.body_texcoords = new float[] { + super(8.0f * scale, 12.0f * scale, 4.0f * scale, 0.0f * scale, 2.0f * scale, 0.0f * scale); + this.bodyTexCoordinates = new float[] { 0.3125f, 0.5f, 0.3125f, 0.3125f, 0.4375f, 0.3125f, 0.4375f, 0.5f, 0.3125f, 0.3125f, 0.3125f, 0.25f, 0.4375f, 0.25f, 0.4375f, 0.3125f, 0.4375f, 0.3125f, 0.4375f, 0.25f, 0.5625f, 0.25f, 0.5625f, 0.3125f, @@ -16,6 +16,6 @@ public class Body extends MainCube { 0.25f, 0.5f, 0.25f, 0.3125f, 0.3125f, 0.3125f, 0.3125f, 0.5f, 0.5f, 0.5f, 0.5f, 0.3125f, 0.625f, 0.3125f, 0.625f, 0.5f }; - this.AddTextures(this.body_texcoords); + addTextures(this.bodyTexCoordinates); } } diff --git a/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/body/cube/BodyOverlay.java b/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/cube/body/BodyOverlay.java similarity index 66% rename from FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/body/cube/BodyOverlay.java rename to FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/cube/body/BodyOverlay.java index 6bfa2f46..d1a169ab 100644 --- a/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/body/cube/BodyOverlay.java +++ b/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/cube/body/BodyOverlay.java @@ -1,14 +1,14 @@ -package com.tungsten.fcllibrary.skin.body.cube; +package com.tungsten.fcllibrary.skin.cube.body; -import com.tungsten.fcllibrary.skin.body.MainCube; +import com.tungsten.fcllibrary.skin.cube.MainCube; public class BodyOverlay extends MainCube { - protected float[] jacket_texcoords; + protected float[] jacketTexCoordinates; public BodyOverlay(float scale) { - super(8.470589f * scale, 12.705883f * scale, 4.2352943f * scale, 0.0f * scale, 2.0f * scale, 0.0f * scale, -0.15f, 0.0f, 1.0f, 0.0f, 3.0f, -3.0f); - this.jacket_texcoords = new float[] { + super(8.470589f * scale, 12.705883f * scale, 4.2352943f * scale, 0.0f * scale, 2.0f * scale, 0.0f * scale); + this.jacketTexCoordinates = new float[] { 0.3125f, 0.75f, 0.3125f, 0.5625f, 0.4375f, 0.5625f, 0.4375f, 0.75f, 0.3125f, 0.5625f, 0.3125f, 0.5f, 0.4375f, 0.5f, 0.4375f, 0.5625f, 0.4375f, 0.5625f, 0.4375f, 0.5f, 0.5625f, 0.5f, 0.5625f, 0.5625f, @@ -16,6 +16,6 @@ public class BodyOverlay extends MainCube { 0.25f, 0.75f, 0.25f, 0.5625f, 0.3125f, 0.5625f, 0.3125f, 0.75f, 0.5f, 0.75f, 0.5f, 0.5625f, 0.625f, 0.5625f, 0.625f, 0.75f }; - this.AddTextures(this.jacket_texcoords); + addTextures(this.jacketTexCoordinates); } } diff --git a/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/cape/cube/Cape.java b/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/cube/cape/Cape.java similarity index 69% rename from FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/cape/cube/Cape.java rename to FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/cube/cape/Cape.java index 9b9feeef..b14cb6d1 100644 --- a/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/cape/cube/Cape.java +++ b/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/cube/cape/Cape.java @@ -1,14 +1,14 @@ -package com.tungsten.fcllibrary.skin.cape.cube; +package com.tungsten.fcllibrary.skin.cube.cape; -import com.tungsten.fcllibrary.skin.cape.CapeCube; +import com.tungsten.fcllibrary.skin.cube.CapeCube; public class Cape extends CapeCube { - protected float[] cape_texcoords; + protected float[] capeTexCoordinates; public Cape(float scale) { - super(10.0f * scale, 16.0f * scale, scale, 0.0f * scale, 0.0f * scale, -1.75f * scale, -0.15f * scale, 0.0f, 1.0f, 0.0f, 3.0f, -3.0f); - this.cape_texcoords = new float[] { + super(10.0f * scale, 16.0f * scale, scale, 0.0f * scale, 0.0f * scale, -1.75f * scale); + this.capeTexCoordinates = new float[] { 0.1875f, 0.53125f, 0.1875f, 0.03125f, 0.34375f, 0.03125f, 0.34375f, 0.53125f, 0.015625f, 0.03125f, 0.015625f, 0f, 0.171875f, 0f, 0.171875f, 0.03125f, 0.171875f, 0.03125f, 0.171875f, 0f, 0.328125f, 0f, 0.328125f, 0.03125f, @@ -16,7 +16,7 @@ public class Cape extends CapeCube { 0.171875f, 0.53125f, 0.171875f, 0.03125f, 0.1875f, 0.03125f, 0.1875f, 0.53125f, 0.015625f, 0.53125f, 0.015625f, 0.03125f, 0.171875f, 0.03125f, 0.171875f, 0.53125f }; - this.AddTextures(this.cape_texcoords); + addTextures(this.capeTexCoordinates); } } diff --git a/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/body/cube/Hat.java b/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/cube/head/Hat.java similarity index 66% rename from FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/body/cube/Hat.java rename to FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/cube/head/Hat.java index d89edd7c..e89590ec 100644 --- a/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/body/cube/Hat.java +++ b/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/cube/head/Hat.java @@ -1,14 +1,14 @@ -package com.tungsten.fcllibrary.skin.body.cube; +package com.tungsten.fcllibrary.skin.cube.head; -import com.tungsten.fcllibrary.skin.body.MainCube; +import com.tungsten.fcllibrary.skin.cube.MainCube; public class Hat extends MainCube { - protected float[] hat_texcoords; + protected float[] hatTexCoordinates; public Hat(float scale) { - super(9.0f * scale, 9.0f * scale, 9.0f * scale, 0.0f * scale, 12.0f * scale, 0.0f * scale, 0.25f, 0.0f, 1.0f, 0.0f, 5.0f, -5.0f); - this.hat_texcoords = new float[] { + super(9.0f * scale, 9.0f * scale, 9.0f * scale, 0.0f * scale, 12.0f * scale, 0.0f * scale); + this.hatTexCoordinates = new float[] { 0.625f, 0.25f, 0.625f, 0.125f, 0.75f, 0.125f, 0.75f, 0.25f, 0.625f, 0.125f, 0.625f, 0.0f, 0.75f, 0.0f, 0.75f, 0.125f, 0.75f, 0.125f, 0.75f, 0.0f, 0.875f, 0.0f, 0.875f, 0.125f, @@ -16,6 +16,6 @@ public class Hat extends MainCube { 0.5f, 0.25f, 0.5f, 0.125f, 0.625f, 0.125f, 0.625f, 0.25f, 0.875f, 0.25f, 0.875f, 0.125f, 1.0f, 0.125f, 1.0f, 0.25f }; - this.AddTextures(this.hat_texcoords); + addTextures(this.hatTexCoordinates); } } diff --git a/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/body/cube/Head.java b/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/cube/head/Head.java similarity index 66% rename from FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/body/cube/Head.java rename to FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/cube/head/Head.java index 184fdfe0..0dc4cdfa 100644 --- a/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/body/cube/Head.java +++ b/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/cube/head/Head.java @@ -1,19 +1,21 @@ -package com.tungsten.fcllibrary.skin.body.cube; +package com.tungsten.fcllibrary.skin.cube.head; -import com.tungsten.fcllibrary.skin.body.MainCube; +import com.tungsten.fcllibrary.skin.cube.MainCube; public class Head extends MainCube { - protected float[] head_texcoords; + protected float[] headTexCoordinates; public Head(float scale) { - super(8.0f * scale, 8.0f * scale, 8.0f * scale, 0.0f * scale, 12.0f * scale, 0.0f * scale, 0.25f, 0.0f, 1.0f, 0.0f, 5.0f, -5.0f); - this.AddTextures(this.head_texcoords = new float[] { + super(8.0f * scale, 8.0f * scale, 8.0f * scale, 0.0f * scale, 12.0f * scale, 0.0f * scale); + this.headTexCoordinates = new float[] { 0.125f, 0.25f, 0.125f, 0.125f, 0.25f, 0.125f, 0.25f, 0.25f, 0.125f, 0.125f, 0.125f, 0.0f, 0.25f, 0.0f, 0.25f, 0.125f, 0.25f, 0.125f, 0.25f, 0.0f, 0.375f, 0.0f, 0.375f, 0.125f, 0.25f, 0.25f, 0.25f, 0.125f, 0.375f, 0.125f, 0.375f, 0.25f, 0.0f, 0.25f, 0.0f, 0.125f, 0.125f, 0.125f, 0.125f, 0.25f, - 0.375f, 0.25f, 0.375f, 0.125f, 0.5f, 0.125f, 0.5f, 0.25f }); + 0.375f, 0.25f, 0.375f, 0.125f, 0.5f, 0.125f, 0.5f, 0.25f + }; + addTextures(this.headTexCoordinates); } } diff --git a/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/body/cube/LLeg.java b/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/cube/leg/LeftLeg.java similarity index 66% rename from FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/body/cube/LLeg.java rename to FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/cube/leg/LeftLeg.java index 128f02d5..e33a288d 100644 --- a/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/body/cube/LLeg.java +++ b/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/cube/leg/LeftLeg.java @@ -1,14 +1,17 @@ -package com.tungsten.fcllibrary.skin.body.cube; +package com.tungsten.fcllibrary.skin.cube.leg; -import com.tungsten.fcllibrary.skin.body.LimbCube; +import com.tungsten.fcllibrary.skin.cube.LimbCube; -public class LLeg extends LimbCube { +public class LeftLeg extends LimbCube { - protected float[] lleg_texcoords; + protected float[] leftLegTexCoordinates; - public LLeg(float scale) { - super(4.0f * scale, 12.0f * scale, 4.0f * scale, 2.0f * scale, -10.0f * scale, 0.0f * scale, 1.5f, 1.0f, 0.0f, 0.0f, 30.0f, -30.0f, -0.5f, 30.0f, -30.0f, true, 1.0f); - this.lleg_texcoords = new float[] { + public LeftLeg(float scale) { + super(4.0f * scale, 12.0f * scale, 4.0f * scale, 2.0f * scale, -10.0f * scale, 0.0f * scale, + 1.0f, 0.0f, 0.0f, + 1.5f, 30.0f, -30.0f, + -0.5f, 30.0f, -30.0f); + this.leftLegTexCoordinates = new float[] { 0.3125f, 1.0f, 0.3125f, 0.90625f, 0.375f, 0.90625f, 0.375f, 1.0f, 0.3125f, 0.90625f, 0.3125f, 0.8125f, 0.375f, 0.8125f, 0.375f, 0.90625f, 0.3125f, 0.8125f, 0.3125f, 0.75f, 0.375f, 0.75f, 0.375f, 0.8125f, @@ -20,6 +23,6 @@ public class LLeg extends LimbCube { 0.4375f, 1.0f, 0.4375f, 0.90625f, 0.5f, 0.90625f, 0.5f, 1.0f, 0.4375f, 0.90625f, 0.4375f, 0.8125f, 0.5f, 0.8125f, 0.5f, 0.90625f }; - this.AddTextures(this.lleg_texcoords); + addTextures(this.leftLegTexCoordinates); } } diff --git a/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/body/cube/LLegOverlay.java b/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/cube/leg/LeftLegOverlay.java similarity index 64% rename from FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/body/cube/LLegOverlay.java rename to FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/cube/leg/LeftLegOverlay.java index 7d153bd9..90324257 100644 --- a/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/body/cube/LLegOverlay.java +++ b/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/cube/leg/LeftLegOverlay.java @@ -1,14 +1,17 @@ -package com.tungsten.fcllibrary.skin.body.cube; +package com.tungsten.fcllibrary.skin.cube.leg; -import com.tungsten.fcllibrary.skin.body.LimbCube; +import com.tungsten.fcllibrary.skin.cube.LimbCube; -public class LLegOverlay extends LimbCube { +public class LeftLegOverlay extends LimbCube { - protected float[] lleg1_texcoords; + protected float[] leftLegOverlayTexCoordinates; - public LLegOverlay(float scale) { - super(4.2352943f * scale, 12.705883f * scale, 4.2352943f * scale, 2.0f * scale, -10.0f * scale, 0.0f * scale, 1.5f, 1.0f, 0.0f, 0.0f, 30.0f, -30.0f, -0.5f, 30.0f, -30.0f, true, 1.0f); - this.lleg1_texcoords = new float[] { + public LeftLegOverlay(float scale) { + super(4.2352943f * scale, 12.705883f * scale, 4.2352943f * scale, 2.0f * scale, -10.0f * scale, 0.0f * scale, + 1.0f, 0.0f, 0.0f, + 1.5f, 30.0f, -30.0f, + -0.5f, 30.0f, -30.0f); + this.leftLegOverlayTexCoordinates = new float[] { 0.0625f, 1.0f, 0.0625f, 0.90625f, 0.125f, 0.90625f, 0.125f, 1.0f, 0.0625f, 0.90625f, 0.0625f, 0.8125f, 0.125f, 0.8125f, 0.125f, 0.90625f, 0.0625f, 0.8125f, 0.0625f, 0.75f, 0.125f, 0.75f, 0.125f, 0.8125f, @@ -20,6 +23,6 @@ public class LLegOverlay extends LimbCube { 0.1875f, 1.0f, 0.1875f, 0.90625f, 0.25f, 0.90625f, 0.25f, 1.0f, 0.1875f, 0.90625f, 0.1875f, 0.8125f, 0.25f, 0.8125f, 0.25f, 0.90625f }; - this.AddTextures(this.lleg1_texcoords); + addTextures(this.leftLegOverlayTexCoordinates); } } diff --git a/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/body/cube/RLeg.java b/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/cube/leg/RightLeg.java similarity index 66% rename from FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/body/cube/RLeg.java rename to FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/cube/leg/RightLeg.java index e768af1a..a78c6903 100644 --- a/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/body/cube/RLeg.java +++ b/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/cube/leg/RightLeg.java @@ -1,14 +1,17 @@ -package com.tungsten.fcllibrary.skin.body.cube; +package com.tungsten.fcllibrary.skin.cube.leg; -import com.tungsten.fcllibrary.skin.body.LimbCube; +import com.tungsten.fcllibrary.skin.cube.LimbCube; -public class RLeg extends LimbCube { +public class RightLeg extends LimbCube { - protected float[] rleg_texcoords; + protected float[] rightLegTexCoordinates; - public RLeg(float scale) { - super(4.0f * scale, 12.0f * scale, 4.0f * scale, -2.0f * scale, -10.0f * scale, 0.0f * scale, -1.5f, 1.0f, 0.0f, 0.0f, 30.0f, -30.0f, 0.5f, 30.0f, -30.0f, true, 1.0f); - this.rleg_texcoords = new float[] { + public RightLeg(float scale) { + super(4.0f * scale, 12.0f * scale, 4.0f * scale, -2.0f * scale, -10.0f * scale, 0.0f * scale, + 1.0f, 0.0f, 0.0f, + -1.5f, 30.0f, -30.0f, + 0.5f, 30.0f, -30.0f); + this.rightLegTexCoordinates = new float[] { 0.0625f, 0.5f, 0.0625f, 0.40625f, 0.125f, 0.40625f, 0.125f, 0.5f, 0.0625f, 0.40625f, 0.0625f, 0.3125f, 0.125f, 0.3125f, 0.125f, 0.40625f, 0.0625f, 0.3125f, 0.0625f, 0.25f, 0.125f, 0.25f, 0.125f, 0.3125f, @@ -20,6 +23,6 @@ public class RLeg extends LimbCube { 0.1875f, 0.5f, 0.1875f, 0.40625f, 0.25f, 0.40625f, 0.25f, 0.5f, 0.1875f, 0.40625f, 0.1875f, 0.3125f, 0.25f, 0.3125f, 0.25f, 0.40625f }; - this.AddTextures(this.rleg_texcoords); + addTextures(this.rightLegTexCoordinates); } } diff --git a/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/body/cube/RLegOverlay.java b/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/cube/leg/RightLegOverlay.java similarity index 63% rename from FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/body/cube/RLegOverlay.java rename to FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/cube/leg/RightLegOverlay.java index 87059dac..29d73a13 100644 --- a/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/body/cube/RLegOverlay.java +++ b/FCLLibrary/src/main/java/com/tungsten/fcllibrary/skin/cube/leg/RightLegOverlay.java @@ -1,14 +1,16 @@ -package com.tungsten.fcllibrary.skin.body.cube; +package com.tungsten.fcllibrary.skin.cube.leg; -import com.tungsten.fcllibrary.skin.body.LimbCube; +import com.tungsten.fcllibrary.skin.cube.LimbCube; -public class RLegOverlay extends LimbCube -{ - protected float[] rleg1_texcoords; +public class RightLegOverlay extends LimbCube { + protected float[] rightLegOverlayTexCoordinates; - public RLegOverlay(float scale) { - super(4.2352943f * scale, 12.705883f * scale, 4.2352943f * scale, -2.0f * scale, -10.0f * scale, 0.0f * scale, -1.5f, 1.0f, 0.0f, 0.0f, 30.0f, -30.0f, 0.5f, 30.0f, -30.0f, true, 1.0f); - this.rleg1_texcoords = new float[] { + public RightLegOverlay(float scale) { + super(4.2352943f * scale, 12.705883f * scale, 4.2352943f * scale, -2.0f * scale, -10.0f * scale, 0.0f * scale, + 1.0f, 0.0f, 0.0f, + -1.5f, 30.0f, -30.0f, + 0.5f, 30.0f, -30.0f); + this.rightLegOverlayTexCoordinates = new float[] { 0.0625f, 0.75f, 0.0625f, 0.65625f, 0.125f, 0.65625f, 0.125f, 0.75f, 0.0625f, 0.65625f, 0.0625f, 0.5625f, 0.125f, 0.5625f, 0.125f, 0.65625f, 0.0625f, 0.5625f, 0.0625f, 0.5f, 0.125f, 0.5f, 0.125f, 0.5625f, @@ -20,6 +22,6 @@ public class RLegOverlay extends LimbCube 0.1875f, 0.75f, 0.1875f, 0.65625f, 0.25f, 0.65625f, 0.25f, 0.75f, 0.1875f, 0.65625f, 0.1875f, 0.5625f, 0.25f, 0.5625f, 0.25f, 0.65625f }; - this.AddTextures(this.rleg1_texcoords); + addTextures(this.rightLegOverlayTexCoordinates); } } diff --git a/FCLLibrary/src/main/java/com/tungsten/fcllibrary/util/ConvertUtils.java b/FCLLibrary/src/main/java/com/tungsten/fcllibrary/util/ConvertUtils.java index 2346eb7a..799cc9e8 100644 --- a/FCLLibrary/src/main/java/com/tungsten/fcllibrary/util/ConvertUtils.java +++ b/FCLLibrary/src/main/java/com/tungsten/fcllibrary/util/ConvertUtils.java @@ -23,6 +23,10 @@ public class ConvertUtils { return (int) (pxValue / scare + 0.5f); } + public static float d2r(final float n) { + return 3.1415927f * n / 180.0f; + } + public static double radian2Angle(double radian) { double tmp = Math.round(radian / Math.PI * 180); return tmp >= 0 ? tmp : 360 + tmp;