Revision ec0feaba
Added by Leszek Koltunski almost 6 years ago
src/main/java/org/distorted/library/mesh/MeshQuad.java | ||
---|---|---|
30 | 30 |
{ |
31 | 31 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
32 | 32 |
|
33 |
private void addVertex(int vertex, float x, float y, float[] attribs)
|
|
33 |
private void addVertex( float x, float y, float[] attribs, int index)
|
|
34 | 34 |
{ |
35 |
attribs[VERT_ATTRIBS*vertex + POS_ATTRIB ] = x-0.5f;
|
|
36 |
attribs[VERT_ATTRIBS*vertex + POS_ATTRIB+1] = 0.5f-y;
|
|
37 |
attribs[VERT_ATTRIBS*vertex + POS_ATTRIB+2] = 0.0f;
|
|
35 |
attribs[VERT_ATTRIBS*index + POS_ATTRIB ] = x-0.5f;
|
|
36 |
attribs[VERT_ATTRIBS*index + POS_ATTRIB+1] = 0.5f-y;
|
|
37 |
attribs[VERT_ATTRIBS*index + POS_ATTRIB+2] = 0.0f;
|
|
38 | 38 |
|
39 |
attribs[VERT_ATTRIBS*vertex + NOR_ATTRIB ] = 0.0f;
|
|
40 |
attribs[VERT_ATTRIBS*vertex + NOR_ATTRIB+1] = 0.0f;
|
|
41 |
attribs[VERT_ATTRIBS*vertex + NOR_ATTRIB+2] = 1.0f;
|
|
39 |
attribs[VERT_ATTRIBS*index + NOR_ATTRIB ] = 0.0f;
|
|
40 |
attribs[VERT_ATTRIBS*index + NOR_ATTRIB+1] = 0.0f;
|
|
41 |
attribs[VERT_ATTRIBS*index + NOR_ATTRIB+2] = 1.0f;
|
|
42 | 42 |
|
43 |
attribs[VERT_ATTRIBS*vertex + INF_ATTRIB ] = (x-0.5f);
|
|
44 |
attribs[VERT_ATTRIBS*vertex + INF_ATTRIB+1] = (0.5f-y);
|
|
45 |
attribs[VERT_ATTRIBS*vertex + INF_ATTRIB+2] = 0.01f ; // Inflated surface needs to be slightly in front
|
|
43 |
attribs[VERT_ATTRIBS*index + INF_ATTRIB ] = (x-0.5f);
|
|
44 |
attribs[VERT_ATTRIBS*index + INF_ATTRIB+1] = (0.5f-y);
|
|
45 |
attribs[VERT_ATTRIBS*index + INF_ATTRIB+2] = 0.01f ; // Inflated surface needs to be slightly in front
|
|
46 | 46 |
|
47 |
attribs[VERT_ATTRIBS*vertex + TEX_ATTRIB ] = x;
|
|
48 |
attribs[VERT_ATTRIBS*vertex + TEX_ATTRIB+1] = 1.0f-y;
|
|
47 |
attribs[VERT_ATTRIBS*index + TEX_ATTRIB ] = x;
|
|
48 |
attribs[VERT_ATTRIBS*index + TEX_ATTRIB+1] = 1.0f-y;
|
|
49 | 49 |
} |
50 | 50 |
|
51 | 51 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
60 | 60 |
|
61 | 61 |
float[] attribs= new float[VERT_ATTRIBS*4]; |
62 | 62 |
|
63 |
addVertex(0, 0.0f,0.0f, attribs);
|
|
64 |
addVertex(1, 0.0f,1.0f, attribs);
|
|
65 |
addVertex(2, 1.0f,0.0f, attribs);
|
|
66 |
addVertex(3, 1.0f,1.0f, attribs);
|
|
63 |
addVertex(0.0f,0.0f, attribs,0);
|
|
64 |
addVertex(0.0f,1.0f, attribs,1);
|
|
65 |
addVertex(1.0f,0.0f, attribs,2);
|
|
66 |
addVertex(1.0f,1.0f, attribs,3);
|
|
67 | 67 |
|
68 | 68 |
setAttribs(attribs); |
69 | 69 |
} |
Also available in: Unified diff
Minor.