Hi people,
I’m creating a cardgame, and now I’m trying to do a “beautiful” selection. My inspiration is HeroDex selection, and Magic Gathering selection method.
First of all, I’m trying to recreate the HeroDex selection, but I think I’m missing something. It’s not perfectly the same. See HeroDex images bellow:
Do you know some clue about what is missing? I’m trying to modify transparency and other properties, but it’s so different. I think I’m missing something.
See my code for that:
[java]
Mesh meshMarcador = new Mesh();
// Vertex positions in space
Vector3f [] vertices = new Vector3f[4];
vertices[0] = new Vector3f(0,0,0);
vertices[1] = new Vector3f(1.4f,0,0);
vertices[2] = new Vector3f(0,2.2f,0);
vertices[3] = new Vector3f(1.4f,2.2f,0);
// Texture coordinates
Vector2f [] texCoord = new Vector2f[4];
texCoord[0] = new Vector2f(0,0);
texCoord[1] = new Vector2f(1,0);
texCoord[2] = new Vector2f(0,1);
texCoord[3] = new Vector2f(1,1);
// Indexes. We define the order in which mesh should be constructed
short[] indexes = {2, 0, 1, 1, 3, 2};
// Setting buffers
meshMarcador.setBuffer(VertexBuffer.Type.Position, 3, BufferUtils.createFloatBuffer(vertices));
meshMarcador.setBuffer(VertexBuffer.Type.TexCoord, 2, BufferUtils.createFloatBuffer(texCoord));
meshMarcador.setBuffer(VertexBuffer.Type.Index, 1, BufferUtils.createShortBuffer(indexes));
meshMarcador.updateBound();
float[] colorArray = new float[4*4];
int colorIndex = 0;
for(int i = 0; i < 4; i++){
// Red value (is increased by .2 on each next vertex here)
colorArray[colorIndex++]= 0f;;
// Green value (is reduced by .2 on each next vertex)
colorArray[colorIndex++]= 0.5f;
// Blue value (remains the same in our case)
colorArray[colorIndex++]= 1f;
// Alpha value (no transparency set here)
colorArray[colorIndex++]= 0.3f;
}
meshMarcador.setBuffer(VertexBuffer.Type.Color, 4, colorArray);
Geometry marcador = new Geometry("Texture", meshMarcador);
Material materialMarcador = new Material(dInterface.getApp().getAssetManager(),"Common/MatDefs/Misc/Unshaded.j3md");
materialMarcador.setBoolean("VertexColor", true);
materialMarcador.getAdditionalRenderState().setBlendMode(RenderState.BlendMode.Alpha);
marcador.setMaterial(materialMarcador);
marcador.setQueueBucket(RenderQueue.Bucket.Transparent);
node.attachChild(marcador);
[/java]
Regarding Magic Gathering selection, do you know how can we simulate this kind of effect?
Thanks people
Tati