If any of the creators do not wish me to do so then pm me or just post it here.
So far all i have done is a cube custom node which im still working on for my tactics game called MightBlade (Name might change).
Although it seems as if nobody is intrested here is the custom cube code
Code: Select all
public class CCubeTile extends ISceneNode
{
public enum E_CUBE_EDGE
{
ECE_TOP_NW, ECE_TOP_NE, ECE_TOP_SW, ECE_TOP_SE, ECE_BOTTOM_NW, ECE_BOTTOM_NE, ECE_BOTTOM_SW, ECE_BOTTOM_SE
}
public static final SColor S_COLOR = GameColour.WHITE;
private aabbox3df Box = new aabbox3df(0, 0, 0, 0, 0, 0);
private S3DVertex Vertices[] = new S3DVertex[12];
private SMaterial Material = new SMaterial();
private ISceneManager SceneManager;
private int cubeSize;
public CCubeTile(ISceneNode parent, ISceneManager mgr, IVideoDriver driver, int id, int size, GameTile tile)
{
super(parent, mgr, id);
SceneManager = mgr;
cubeSize = size;
Material.setFlag(E_MATERIAL_FLAG.EMF_WIREFRAME, false);
Material.setFlag(E_MATERIAL_FLAG.EMF_LIGHTING, false);
if (tile != null)
{
ITexture tex = driver.getTexture(tile.getTexture());
Material.setTexture(0, tex);
matrix4 rotate = new matrix4();
rotate.makeIdentity();
rotate.setTextureRotationCenter((tile.getTexRot()) / 360);//tRotationDegrees(new vector3df(tile.getTexRot(), tile.getTexRot(),tile.getTexRot()));
Material.setTextureMatrix(0, rotate);
}
//getMaterial(0).setTexture(0, SceneManager.getVideoDriver().getTexture("./media/unused/wall.jpg"));
Vertices[0] = new S3DVertex(0, 0, 0, -1, -1, -1, S_COLOR, 0, 1);
Vertices[1] = new S3DVertex(1, 0, 0, 1, -1, -1, S_COLOR, 1, 1);
Vertices[2] = new S3DVertex(1, 1, 0, 1, 1, -1, S_COLOR, 1, 0);
Vertices[3] = new S3DVertex(0, 1, 0, -1, 1, -1, S_COLOR, 0, 0);
Vertices[4] = new S3DVertex(1, 0, 1, 1, -1, 1, S_COLOR, 0, 1);
Vertices[5] = new S3DVertex(1, 1, 1, 1, 1, 1, S_COLOR, 0, 0);
Vertices[6] = new S3DVertex(0, 1, 1, -1, 1, 1, S_COLOR, 1, 0);
Vertices[7] = new S3DVertex(0, 0, 1, -1, -1, 1, S_COLOR, 1, 1);
Vertices[8] = new S3DVertex(0, 1, 1, -1, 1, 1, S_COLOR, 0, 1);
Vertices[9] = new S3DVertex(0, 1, 0, -1, 1, -1, S_COLOR, 1, 1);
Vertices[10] = new S3DVertex(1, 0, 1, 1, -1, 1, S_COLOR, 1, 0);
Vertices[11] = new S3DVertex(1, 0, 0, 1, -1, -1, S_COLOR, 0, 0);
Box.reset(Vertices[0].getPos());
for (int i = 0; i < Vertices.length; ++i)
{
Vertices[i].setPos(Vertices[i].getPos().subtractOperator(new vector3df(0.5f, 0.5f, 0.5f)));
Vertices[i].setPos(Vertices[i].getPos().timesOperator(cubeSize * 2));
if (i != 0) Box.addInternalPoint(Vertices[i].getPos());
}
}
public void OnRegisterSceneNode()
{
if (isVisible())
{
SceneManager.registerNodeForRendering(this, E_SCENE_NODE_RENDER_PASS.ESNRP_TRANSPARENT);
}
OnRegisterSceneNodeJava();
}
public void render()
{
int indices[] = { 0, 2, 1,/**/0, 3, 2,/**/1, 5, 4,/**/1, 2, 5,/**/4, 6, 7,/**/4, 5, 6,
/**/7, 3, 0,/**/7, 6, 3,/**/9, 5, 2,/**/9, 8, 5,/**/0, 11, 10,/**/0, 10, 7 };
IVideoDriver driver = SceneManager.getVideoDriver();
driver.setMaterial(Material);
driver.setTransform(E_TRANSFORMATION_STATE.ETS_WORLD, getAbsoluteTransformation());
driver.drawIndexedTriangleList(Vertices, Vertices.length, indices, indices.length / 3);
}
/*
0 011 111
1 /6--------/5 y
2 / | / | ^ z
3 / | / | | /
4 010 3---------2 | |/
5 | 7- - -| -4 101 *---->x
6 | / | /
7 |/ | /
8 0---------1/
9 000 100
*/
public void morph(E_CUBE_EDGE edge, vector3df newpos)
{
switch (edge)
{
case ECE_TOP_NW:
morph(6, newpos);
morph(8, newpos);
break;
case ECE_TOP_NE:
morph(5, newpos);
break;
case ECE_TOP_SW:
morph(3, newpos);
morph(9, newpos);
break;
case ECE_TOP_SE:
morph(2, newpos);
break;
case ECE_BOTTOM_NW:
morph(7, newpos);
break;
case ECE_BOTTOM_NE:
morph(4, newpos);
morph(10, newpos);
break;
case ECE_BOTTOM_SW:
morph(0, newpos);
break;
case ECE_BOTTOM_SE:
morph(1, newpos);
morph(11, newpos);
break;
default:
return;
}
}
public void setDebugColour(SColor col)
{
for (int i = 0; i < Vertices.length; ++i)
{
Vertices[i].setColor(col);
}
}
public void morph(E_CUBE_EDGE edge, int height)
{
morph(edge, new vector3df(0, height, 0));
}
private void morph(int side, vector3df newpos)
{
S3DVertex old = Vertices[side];
old.setPos(old.getPos().addOperator(newpos));
Vertices[side] = old;
}
public aabbox3df getBoundingBoxConst()
{
return Box;
}
public long getMaterialCount()
{
return 1;
}
public SMaterial getMaterial(long i)
{
return Material;
}
}