57 |
57 |
private int mCols, mRows, mSlices;
|
58 |
58 |
private int[][] mCubes;
|
59 |
59 |
private byte[][] mInflateX, mInflateY;
|
|
60 |
private float mInfCorrX, mInfCorrY, mInfCorrZ;
|
60 |
61 |
private ArrayList<Edge> mEdges = new ArrayList<>();
|
61 |
62 |
|
62 |
63 |
private int currVert;
|
... | ... | |
184 |
185 |
mCols =0;
|
185 |
186 |
mSlices =slices;
|
186 |
187 |
numVertices =0;
|
187 |
|
|
|
188 |
|
188 |
189 |
if( cols>0 && desc.contains("1") )
|
189 |
190 |
{
|
190 |
191 |
mCols = cols;
|
191 |
192 |
mRows = desc.length()/cols;
|
192 |
193 |
|
|
194 |
int max = mRows>mCols ? mRows:mCols;
|
|
195 |
max = mSlices>max ? mSlices : max;
|
|
196 |
|
|
197 |
mInfCorrX = (float)max/mCols;
|
|
198 |
mInfCorrY = (float)max/mRows;
|
|
199 |
mInfCorrZ = (float)max/mSlices;
|
|
200 |
|
193 |
201 |
mCubes = new int[mRows][mCols];
|
194 |
202 |
mInflateX = new byte[mRows+1][mCols+1];
|
195 |
203 |
mInflateY = new byte[mRows+1][mCols+1];
|
... | ... | |
226 |
234 |
mInflateX = new byte[mRows+1][mCols+1];
|
227 |
235 |
mInflateY = new byte[mRows+1][mCols+1];
|
228 |
236 |
|
|
237 |
int max = mRows>mCols ? mRows:mCols;
|
|
238 |
max = mSlices>max ? mSlices : max;
|
|
239 |
|
|
240 |
mInfCorrX = (float)max/mCols;
|
|
241 |
mInfCorrY = (float)max/mRows;
|
|
242 |
mInfCorrZ = (float)max/mSlices;
|
|
243 |
|
229 |
244 |
for(int col=0; col<mCols; col++)
|
230 |
245 |
for(int row=0; row<mRows; row++)
|
231 |
246 |
mCubes[row][col] = 1;
|
... | ... | |
656 |
671 |
attribs[VERT_ATTRIBS*currVert + NOR_ATTRIB+1] = mNormalY[index];
|
657 |
672 |
attribs[VERT_ATTRIBS*currVert + NOR_ATTRIB+2] = mNormalZ[index];
|
658 |
673 |
|
659 |
|
attribs[VERT_ATTRIBS*currVert + INF_ATTRIB ] = mInflateX[row][col]/2.0f;
|
660 |
|
attribs[VERT_ATTRIBS*currVert + INF_ATTRIB+1] = mInflateY[row][col]/2.0f;
|
661 |
|
attribs[VERT_ATTRIBS*currVert + INF_ATTRIB+2] = vectZ;
|
|
674 |
attribs[VERT_ATTRIBS*currVert + INF_ATTRIB ] = mInfCorrX*mInflateX[row][col]/2.0f;
|
|
675 |
attribs[VERT_ATTRIBS*currVert + INF_ATTRIB+1] = mInfCorrY*mInflateY[row][col]/2.0f;
|
|
676 |
attribs[VERT_ATTRIBS*currVert + INF_ATTRIB+2] = mInfCorrZ*vectZ;
|
662 |
677 |
|
663 |
678 |
attribs[VERT_ATTRIBS*currVert + TEX_ATTRIB ] = x;
|
664 |
679 |
attribs[VERT_ATTRIBS*currVert + TEX_ATTRIB+1] = 1.0f-y;
|
... | ... | |
690 |
705 |
attribs[VERT_ATTRIBS*currVert + NOR_ATTRIB+1] = 1.0f;
|
691 |
706 |
attribs[VERT_ATTRIBS*currVert + NOR_ATTRIB+2] = (slice==0 ? R : (slice==mSlices ? -R:0) );
|
692 |
707 |
|
693 |
|
attribs[VERT_ATTRIBS*currVert + INF_ATTRIB ] = mInflateX[row][col]/2.0f;
|
694 |
|
attribs[VERT_ATTRIBS*currVert + INF_ATTRIB+1] = mInflateY[row][col]/2.0f;
|
695 |
|
attribs[VERT_ATTRIBS*currVert + INF_ATTRIB+2] = z;
|
|
708 |
attribs[VERT_ATTRIBS*currVert + INF_ATTRIB ] = mInfCorrX*mInflateX[row][col]/2.0f;
|
|
709 |
attribs[VERT_ATTRIBS*currVert + INF_ATTRIB+1] = mInfCorrY*mInflateY[row][col]/2.0f;
|
|
710 |
attribs[VERT_ATTRIBS*currVert + INF_ATTRIB+2] = mInfCorrZ*z;
|
696 |
711 |
|
697 |
712 |
attribs[VERT_ATTRIBS*currVert + TEX_ATTRIB ] = x;
|
698 |
713 |
attribs[VERT_ATTRIBS*currVert + TEX_ATTRIB+1] = 1.0f-(float)(row-slice)/mRows;
|
... | ... | |
711 |
726 |
attribs[VERT_ATTRIBS*currVert + NOR_ATTRIB+1] =-1.0f;
|
712 |
727 |
attribs[VERT_ATTRIBS*currVert + NOR_ATTRIB+2] = (slice==0 ? R : (slice==mSlices ? -R:0) );
|
713 |
728 |
|
714 |
|
attribs[VERT_ATTRIBS*currVert + INF_ATTRIB ] = mInflateX[row][col]/2.0f;
|
715 |
|
attribs[VERT_ATTRIBS*currVert + INF_ATTRIB+1] = mInflateY[row][col]/2.0f;
|
716 |
|
attribs[VERT_ATTRIBS*currVert + INF_ATTRIB+2] = z;
|
|
729 |
attribs[VERT_ATTRIBS*currVert + INF_ATTRIB ] = mInfCorrX*mInflateX[row][col]/2.0f;
|
|
730 |
attribs[VERT_ATTRIBS*currVert + INF_ATTRIB+1] = mInfCorrY*mInflateY[row][col]/2.0f;
|
|
731 |
attribs[VERT_ATTRIBS*currVert + INF_ATTRIB+2] = mInfCorrZ*z;
|
717 |
732 |
|
718 |
733 |
attribs[VERT_ATTRIBS*currVert + TEX_ATTRIB ] = x;
|
719 |
734 |
attribs[VERT_ATTRIBS*currVert + TEX_ATTRIB+1] = 1.0f - (float)(row+slice)/mRows;
|
... | ... | |
732 |
747 |
attribs[VERT_ATTRIBS*currVert + NOR_ATTRIB+1] = side==WEST ? 0.0f : (side==NORTH?-R:R);
|
733 |
748 |
attribs[VERT_ATTRIBS*currVert + NOR_ATTRIB+2] = (slice==0 ? R : (slice==mSlices ? -R:0) );
|
734 |
749 |
|
735 |
|
attribs[VERT_ATTRIBS*currVert + INF_ATTRIB ] = mInflateX[row][col]/2.0f;
|
736 |
|
attribs[VERT_ATTRIBS*currVert + INF_ATTRIB+1] = mInflateY[row][col]/2.0f;
|
737 |
|
attribs[VERT_ATTRIBS*currVert + INF_ATTRIB+2] = z;
|
|
750 |
attribs[VERT_ATTRIBS*currVert + INF_ATTRIB ] = mInfCorrX*mInflateX[row][col]/2.0f;
|
|
751 |
attribs[VERT_ATTRIBS*currVert + INF_ATTRIB+1] = mInfCorrY*mInflateY[row][col]/2.0f;
|
|
752 |
attribs[VERT_ATTRIBS*currVert + INF_ATTRIB+2] = mInfCorrZ*z;
|
738 |
753 |
|
739 |
754 |
attribs[VERT_ATTRIBS*currVert + TEX_ATTRIB ] = (float)(col-slice)/mCols;
|
740 |
755 |
attribs[VERT_ATTRIBS*currVert + TEX_ATTRIB+1] = 1.0f - y;
|
... | ... | |
753 |
768 |
attribs[VERT_ATTRIBS*currVert + NOR_ATTRIB+1] = side==EAST ? 0.0f : (side==SOUTH?-R:R);
|
754 |
769 |
attribs[VERT_ATTRIBS*currVert + NOR_ATTRIB+2] = (slice==0 ? R : (slice==mSlices ? -R:0) );
|
755 |
770 |
|
756 |
|
attribs[VERT_ATTRIBS*currVert + INF_ATTRIB ] = mInflateX[row][col]/2.0f;
|
757 |
|
attribs[VERT_ATTRIBS*currVert + INF_ATTRIB+1] = mInflateY[row][col]/2.0f;
|
758 |
|
attribs[VERT_ATTRIBS*currVert + INF_ATTRIB+2] = z;
|
|
771 |
attribs[VERT_ATTRIBS*currVert + INF_ATTRIB ] = mInfCorrX*mInflateX[row][col]/2.0f;
|
|
772 |
attribs[VERT_ATTRIBS*currVert + INF_ATTRIB+1] = mInfCorrY*mInflateY[row][col]/2.0f;
|
|
773 |
attribs[VERT_ATTRIBS*currVert + INF_ATTRIB+2] = mInfCorrZ*z;
|
759 |
774 |
|
760 |
775 |
attribs[VERT_ATTRIBS*currVert + TEX_ATTRIB ] = (float)(col+slice)/mCols;
|
761 |
776 |
attribs[VERT_ATTRIBS*currVert + TEX_ATTRIB+1] = 1.0f - y;
|
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)