Revision a16bf106
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 |
private float mInfCorr; |
|
35 | 35 |
|
36 | 36 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
37 | 37 |
// Create a flat, full grid. |
... | ... | |
41 | 41 |
mRows=rows; |
42 | 42 |
mCols=cols; |
43 | 43 |
|
44 |
int max = mRows>mCols ? mRows:mCols; |
|
45 |
mInfCorrX = (float)max/mCols; |
|
46 |
mInfCorrY = (float)max/mRows; |
|
44 |
mInfCorr = mRows>mCols ? mRows:mCols; |
|
47 | 45 |
|
48 | 46 |
if( cols==1 && rows==1 ) |
49 | 47 |
{ |
... | ... | |
74 | 72 |
attribs[VERT_ATTRIBS*vertex + NOR_ATTRIB+1] = 0.0f; |
75 | 73 |
attribs[VERT_ATTRIBS*vertex + NOR_ATTRIB+2] = 1.0f; |
76 | 74 |
|
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. |
|
83 |
attribs[VERT_ATTRIBS*vertex + INF_ATTRIB+2] = 0.0f; |
|
75 |
attribs[VERT_ATTRIBS*vertex + INF_ATTRIB ] = (x-0.5f)*mInfCorr; |
|
76 |
attribs[VERT_ATTRIBS*vertex + INF_ATTRIB+1] = (0.5f-y)*mInfCorr; |
|
77 |
attribs[VERT_ATTRIBS*vertex + INF_ATTRIB+2] = 0.01f *mInfCorr; // Inflated surface needs to be slightly in front |
|
84 | 78 |
|
85 | 79 |
attribs[VERT_ATTRIBS*vertex + TEX_ATTRIB ] = x; |
86 | 80 |
attribs[VERT_ATTRIBS*vertex + TEX_ATTRIB+1] = 1.0f-y; |
Also available in: Unified diff
Make the Effects3D app a bit more user-friendly.