package com.jackamikaz.testlibgdx;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.GL10;
import com.badlogic.gdx.graphics.Mesh;
import com.badlogic.gdx.graphics.Texture;
import com.bulletphysics.dynamics.RigidBody;
import com.bulletphysics.linearmath.DefaultMotionState;

public class BodyDraw
{
	public RigidBody body;
	private DefaultMotionState motionState;
	private Mesh mesh;
	private Texture texture;
	
	public BodyDraw(DefaultMotionState m, Mesh me, Texture t) {
		body = null;
		motionState = m;
		mesh = me;
		texture = t;
	}
	
	public void draw(float [] tempMatrix) {
		Gdx.gl10.glPushMatrix();
		motionState.graphicsWorldTrans.getOpenGLMatrix(tempMatrix);
		Gdx.gl10.glMultMatrixf(tempMatrix, 0);
		if (texture != null)
			texture.bind();
		mesh.render(GL10.GL_TRIANGLES);
		Gdx.gl10.glPopMatrix();
	}
}