fix(FCLLibrary): better skin model

This commit is contained in:
Tungstend 2024-01-06 01:00:17 +08:00
parent 913e3cb444
commit 2bd9b4bd27
39 changed files with 1117 additions and 2452 deletions

View File

@ -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);

View File

@ -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<Account> 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

View File

@ -27,7 +27,7 @@
app:layout_constraintBottom_toTopOf="@+id/positive"
app:layout_constraintTop_toBottomOf="@+id/title">
<com.tungsten.fcllibrary.skin.SkinGLSurfaceView
<com.tungsten.fcllibrary.skin.SkinCanvas
android:id="@+id/skin_view"
android:layout_width="0dp"
android:layout_height="0dp"

View File

@ -1,30 +0,0 @@
package com.tungsten.fcllibrary.skin;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.FloatBuffer;
import java.nio.ShortBuffer;
public class BufferUtils {
public static float d2r(final float n) {
return 3.1415927f * n / 180.0f;
}
static FloatBuffer toFloatBuffer(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);
return floatBuffer;
}
static ShortBuffer toShortBuffer(final short[] array) {
final ByteBuffer allocateDirect = ByteBuffer.allocateDirect(array.length * 2);
allocateDirect.order(ByteOrder.nativeOrder());
final ShortBuffer shortBuffer = allocateDirect.asShortBuffer();
shortBuffer.put(array);
shortBuffer.position(0);
return shortBuffer;
}
}

View File

@ -1,472 +0,0 @@
package com.tungsten.fcllibrary.skin;
import com.tungsten.fcllibrary.skin.body.BodyPart;
import com.tungsten.fcllibrary.skin.body.cube.Body;
import com.tungsten.fcllibrary.skin.body.cube.BodyOverlay;
import com.tungsten.fcllibrary.skin.body.cube.Hat;
import com.tungsten.fcllibrary.skin.body.cube.Head;
import com.tungsten.fcllibrary.skin.body.cube.LLeg;
import com.tungsten.fcllibrary.skin.body.cube.LLegOverlay;
import com.tungsten.fcllibrary.skin.body.cube.RLeg;
import com.tungsten.fcllibrary.skin.body.cube.RLegOverlay;
import com.tungsten.fcllibrary.skin.body.cube.alex.AlexLArm;
import com.tungsten.fcllibrary.skin.body.cube.alex.AlexLArmOverlay;
import com.tungsten.fcllibrary.skin.body.cube.alex.AlexRArm;
import com.tungsten.fcllibrary.skin.body.cube.alex.AlexRArmOverlay;
import com.tungsten.fcllibrary.skin.body.cube.steve.LArm;
import com.tungsten.fcllibrary.skin.body.cube.steve.LArmOverlay;
import com.tungsten.fcllibrary.skin.body.cube.steve.RArm;
import com.tungsten.fcllibrary.skin.body.cube.steve.RArmOverlay;
import com.tungsten.fcllibrary.skin.cape.CapePart;
import com.tungsten.fcllibrary.skin.cape.cube.Cape;
import javax.microedition.khronos.opengles.GL10;
public class GameCharacter {
public static int selected_resource;
private boolean isAlexSkin;
private boolean isRunning;
private AlexLArm mAlexLArm;
private AlexLArmOverlay mAlexLArmOverlay;
private AlexRArm mAlexRArm;
private AlexRArmOverlay mAlexRArmOverlay;
private Body mBody;
private BodyOverlay mBodyOverlay;
private boolean mBodyOverlayVisible;
private boolean mBodyVisible;
private boolean mCheckAlexOrSteve;
private Hat mHat;
private boolean mHatVisible;
private Head mHead;
private boolean mHeadVisible;
private LArm mLArm;
private LArmOverlay mLArmOverlay;
private boolean mLArmOverlayVisible;
private boolean mLArmVisible;
private LLeg mLLeg;
private LLegOverlay mLLegOverlay;
private boolean mLLegOverlayVisible;
private boolean mLLegVisible;
private RArm mRArm;
private RArmOverlay mRArmOverlay;
private boolean mRArmOverlayVisible;
private boolean mRArmVisible;
private RLeg mRLeg;
private RLegOverlay mRLegOverlay;
private boolean mRLegOverlayVisible;
private boolean mRLegVisible;
private Cape mCape;
private boolean mCapeVisible;
private float[] mRotate;
private float[] rotate_step;
public float scale = 1f;
public GameCharacter() {
this.isAlexSkin = false;
this.isRunning = false;
this.mBodyOverlayVisible = true;
this.mBodyVisible = true;
this.mHatVisible = true;
this.mHeadVisible = true;
this.mLArmOverlayVisible = true;
this.mLArmVisible = true;
this.mLLegOverlayVisible = true;
this.mLLegVisible = true;
this.mRArmOverlayVisible = true;
this.mRArmVisible = true;
this.mRLegOverlayVisible = true;
this.mRLegVisible = true;
this.mCapeVisible = true;
this.mRotate = new float[] { 0.0f, 0.0f, 0.0f };
this.rotate_step = new float[] { 2.0f, 2.0f, 2.0f };
this.mHead = new Head(scale);
this.mHat = new Hat(scale);
this.mBody = new Body(scale);
this.mBodyOverlay = new BodyOverlay(scale);
this.mLArm = new LArm(scale);
this.mRArm = new RArm(scale);
this.mLArmOverlay = new LArmOverlay(scale);
this.mRArmOverlay = new RArmOverlay(scale);
this.mLLeg = new LLeg(scale);
this.mRLeg = new RLeg(scale);
this.mLLegOverlay = new LLegOverlay(scale);
this.mRLegOverlay = new RLegOverlay(scale);
this.mCape = new Cape(scale);
}
public GameCharacter(final int selected_resource) {
this.isAlexSkin = false;
this.isRunning = false;
this.mBodyOverlayVisible = true;
this.mBodyVisible = true;
this.mHatVisible = true;
this.mHeadVisible = true;
this.mLArmOverlayVisible = true;
this.mLArmVisible = true;
this.mLLegOverlayVisible = true;
this.mLLegVisible = true;
this.mRArmOverlayVisible = true;
this.mRArmVisible = true;
this.mRLegOverlayVisible = true;
this.mRLegVisible = true;
this.mCapeVisible = true;
this.mRotate = new float[] { 0.0f, 0.0f, 0.0f };
this.rotate_step = new float[] { 2.0f, 2.0f, 2.0f };
GameCharacter.selected_resource = selected_resource;
this.mHead = new Head(scale);
this.mHat = new Hat(scale);
this.mBody = new Body(scale);
this.mBodyOverlay = new BodyOverlay(scale);
this.mLArm = new LArm(scale);
this.mRArm = new RArm(scale);
this.mLArmOverlay = new LArmOverlay(scale);
this.mRArmOverlay = new RArmOverlay(scale);
this.mLLeg = new LLeg(scale);
this.mRLeg = new RLeg(scale);
this.mLLegOverlay = new LLegOverlay(scale);
this.mRLegOverlay = new RLegOverlay(scale);
this.mCape = new Cape(scale);
}
public GameCharacter(final boolean mCheckAlexOrSteve) {
this.isAlexSkin = false;
this.isRunning = false;
this.mBodyOverlayVisible = true;
this.mBodyVisible = true;
this.mHatVisible = true;
this.mHeadVisible = true;
this.mLArmOverlayVisible = true;
this.mLArmVisible = true;
this.mLLegOverlayVisible = true;
this.mLLegVisible = true;
this.mRArmOverlayVisible = true;
this.mRArmVisible = true;
this.mRLegOverlayVisible = true;
this.mRLegVisible = true;
this.mCapeVisible = true;
this.mRotate = new float[] { 0.0f, 0.0f, 0.0f };
this.rotate_step = new float[] { 2.0f, 2.0f, 2.0f };
if (!(this.mCheckAlexOrSteve = mCheckAlexOrSteve)) {
this.mHead = new Head(scale);
this.mHat = new Hat(scale);
this.mBody = new Body(scale);
this.mBodyOverlay = new BodyOverlay(scale);
this.mLArm = new LArm(scale);
this.mRArm = new RArm(scale);
this.mLArmOverlay = new LArmOverlay(scale);
this.mRArmOverlay = new RArmOverlay(scale);
this.mLLeg = new LLeg(scale);
this.mRLeg = new RLeg(scale);
this.mLLegOverlay = new LLegOverlay(scale);
this.mRLegOverlay = new RLegOverlay(scale);
this.mCape = new Cape(scale);
return;
}
this.mHead = new Head(scale);
this.mHat = new Hat(scale);
this.mBody = new Body(scale);
this.mBodyOverlay = new BodyOverlay(scale);
this.mAlexLArm = new AlexLArm(scale);
this.mAlexRArm = new AlexRArm(scale);
this.mAlexLArmOverlay = new AlexLArmOverlay(scale);
this.mAlexRArmOverlay = new AlexRArmOverlay(scale);
this.mLLeg = new LLeg(scale);
this.mRLeg = new RLeg(scale);
this.mLLegOverlay = new LLegOverlay(scale);
this.mRLegOverlay = new RLegOverlay(scale);
this.mCape = new Cape(scale);
}
public GameCharacter(final boolean mCheckAlexOrSteve, final int selected_resource) {
this.isAlexSkin = false;
this.isRunning = false;
this.mBodyOverlayVisible = true;
this.mBodyVisible = true;
this.mHatVisible = true;
this.mHeadVisible = true;
this.mLArmOverlayVisible = true;
this.mLArmVisible = true;
this.mLLegOverlayVisible = true;
this.mLLegVisible = true;
this.mRArmOverlayVisible = true;
this.mRArmVisible = true;
this.mRLegOverlayVisible = true;
this.mRLegVisible = true;
this.mCapeVisible = true;
this.mRotate = new float[] { 0.0f, 0.0f, 0.0f };
this.rotate_step = new float[] { 2.0f, 2.0f, 2.0f };
this.mCheckAlexOrSteve = mCheckAlexOrSteve;
GameCharacter.selected_resource = selected_resource;
if (!mCheckAlexOrSteve) {
this.mHead = new Head(scale);
this.mHat = new Hat(scale);
this.mBody = new Body(scale);
this.mBodyOverlay = new BodyOverlay(scale);
this.mLArm = new LArm(scale);
this.mRArm = new RArm(scale);
this.mLArmOverlay = new LArmOverlay(scale);
this.mRArmOverlay = new RArmOverlay(scale);
this.mLLeg = new LLeg(scale);
this.mRLeg = new RLeg(scale);
this.mLLegOverlay = new LLegOverlay(scale);
this.mRLegOverlay = new RLegOverlay(scale);
this.mCape = new Cape(scale);
return;
}
this.mHead = new Head(scale);
this.mHat = new Hat(scale);
this.mBody = new Body(scale);
this.mBodyOverlay = new BodyOverlay(scale);
this.mAlexLArm = new AlexLArm(scale);
this.mAlexRArm = new AlexRArm(scale);
this.mAlexLArmOverlay = new AlexLArmOverlay(scale);
this.mAlexRArmOverlay = new AlexRArmOverlay(scale);
this.mLLeg = new LLeg(scale);
this.mRLeg = new RLeg(scale);
this.mLLegOverlay = new LLegOverlay(scale);
this.mRLegOverlay = new RLegOverlay(scale);
this.mCape = new Cape(scale);
}
public void ResetRunForBody() {
if (!this.mCheckAlexOrSteve) {
this.mHead = new Head(scale);
this.mHat = new Hat(scale);
this.mBody = new Body(scale);
this.mBodyOverlay = new BodyOverlay(scale);
this.mLArm = new LArm(scale);
this.mRArm = new RArm(scale);
this.mLArmOverlay = new LArmOverlay(scale);
this.mRArmOverlay = new RArmOverlay(scale);
this.mLLeg = new LLeg(scale);
this.mRLeg = new RLeg(scale);
this.mLLegOverlay = new LLegOverlay(scale);
this.mRLegOverlay = new RLegOverlay(scale);
return;
}
this.mHead = new Head(scale);
this.mHat = new Hat(scale);
this.mBody = new Body(scale);
this.mBodyOverlay = new BodyOverlay(scale);
this.mAlexLArm = new AlexLArm(scale);
this.mAlexRArm = new AlexRArm(scale);
this.mAlexLArmOverlay = new AlexLArmOverlay(scale);
this.mAlexRArmOverlay = new AlexRArmOverlay(scale);
this.mLLeg = new LLeg(scale);
this.mRLeg = new RLeg(scale);
this.mLLegOverlay = new LLegOverlay(scale);
this.mRLegOverlay = new RLegOverlay(scale);
}
public void setScale(float scale) {
this.scale = scale;
if (!mCheckAlexOrSteve) {
this.mHead = new Head(scale);
this.mHat = new Hat(scale);
this.mBody = new Body(scale);
this.mBodyOverlay = new BodyOverlay(scale);
this.mLArm = new LArm(scale);
this.mRArm = new RArm(scale);
this.mLArmOverlay = new LArmOverlay(scale);
this.mRArmOverlay = new RArmOverlay(scale);
this.mLLeg = new LLeg(scale);
this.mRLeg = new RLeg(scale);
this.mLLegOverlay = new LLegOverlay(scale);
this.mRLegOverlay = new RLegOverlay(scale);
this.mCape = new Cape(scale);
return;
}
this.mHead = new Head(scale);
this.mHat = new Hat(scale);
this.mBody = new Body(scale);
this.mBodyOverlay = new BodyOverlay(scale);
this.mAlexLArm = new AlexLArm(scale);
this.mAlexRArm = new AlexRArm(scale);
this.mAlexLArmOverlay = new AlexLArmOverlay(scale);
this.mAlexRArmOverlay = new AlexRArmOverlay(scale);
this.mLLeg = new LLeg(scale);
this.mRLeg = new RLeg(scale);
this.mLLegOverlay = new LLegOverlay(scale);
this.mRLegOverlay = new RLegOverlay(scale);
this.mCape = new Cape(scale);
}
public void setRotate(final float n, final float n2, final float n3) {
this.mRotate[0] = n;
this.mRotate[1] = n2;
this.mRotate[2] = n3;
}
public void setRotateStep(final float n, final float n2) {
if (Math.abs(n) >= 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;
}
}

View File

@ -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<Bitmap[]> 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<Bitmap[]> textureProperty() {
if (textureProperty == null) {
textureProperty = new ObjectPropertyBase<Bitmap[]>() {
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;
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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<Bitmap[]> 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<Bitmap[]> textureProperty() {
if (textureProperty == null) {
textureProperty = new ObjectPropertyBase<Bitmap[]>() {
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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}
}

View File

@ -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;
}
}

View File

@ -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<FloatBuffer> 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<FloatBuffer>();
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;
}
}

View File

@ -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<FloatBuffer> 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<FloatBuffer>();
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;
}
}

View File

@ -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<FloatBuffer> 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<FloatBuffer>();
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;
}
}

View File

@ -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;
}
}
}

View File

@ -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;
}
}

View File

@ -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<FloatBuffer> 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);
}
}

View File

@ -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<FloatBuffer> 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);
}
}

View File

@ -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<FloatBuffer> 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);
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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;