Revision 554ce72b
Added by Leszek Koltunski over 5 years ago
src/main/java/org/distorted/library/mesh/MeshFlat.java | ||
---|---|---|
31 | 31 |
private int mCols, mRows; |
32 | 32 |
private int remainingVert; |
33 | 33 |
private int numVertices; |
34 |
private float mInfCorrX, mInfCorrY; |
|
34 | 35 |
|
35 | 36 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
36 | 37 |
// Create a flat, full grid. |
... | ... | |
40 | 41 |
mRows=rows; |
41 | 42 |
mCols=cols; |
42 | 43 |
|
44 |
int max = mRows>mCols ? mRows:mCols; |
|
45 |
mInfCorrX = (float)max/mCols; |
|
46 |
mInfCorrY = (float)max/mRows; |
|
47 |
|
|
43 | 48 |
if( cols==1 && rows==1 ) |
44 | 49 |
{ |
45 | 50 |
numVertices = 4; |
... | ... | |
69 | 74 |
attribs[VERT_ATTRIBS*vertex + NOR_ATTRIB+1] = 0.0f; |
70 | 75 |
attribs[VERT_ATTRIBS*vertex + NOR_ATTRIB+2] = 1.0f; |
71 | 76 |
|
72 |
attribs[VERT_ATTRIBS*vertex + INF_ATTRIB ] = x-0.5f; |
|
73 |
attribs[VERT_ATTRIBS*vertex + INF_ATTRIB+1] = 0.5f-y; |
|
77 |
attribs[VERT_ATTRIBS*vertex + INF_ATTRIB ] = (x-0.5f)*mInfCorrX; |
|
78 |
attribs[VERT_ATTRIBS*vertex + INF_ATTRIB+1] = (0.5f-y)*mInfCorrY; |
|
79 |
|
|
80 |
// TODO: this better be non-zero, so that when the GLOW gets rendered it is slightly above |
|
81 |
// the original MeshFlat surface, but simply setting this to non-zero here does not work, |
|
82 |
// because MeshFlat's u_objD.z is 0 and this gets multipled by it in the main vertex shader. |
|
74 | 83 |
attribs[VERT_ATTRIBS*vertex + INF_ATTRIB+2] = 0.0f; |
75 | 84 |
|
76 | 85 |
attribs[VERT_ATTRIBS*vertex + TEX_ATTRIB ] = x; |
Also available in: Unified diff
Bugfix: make the Inflate distances equal in all 3 dimensions regardless of dimensions of the Mesh. (still MeshFlat's Z dim needs to be corrected)