Revision e6904678
Added by Leszek Koltunski over 6 years ago
src/main/java/org/distorted/library/main/MeshCubes.java | ||
---|---|---|
126 | 126 |
} |
127 | 127 |
*/ |
128 | 128 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
129 |
/* |
|
129 |
|
|
130 | 130 |
private static String debug(float[] val, int stop) |
131 | 131 |
{ |
132 | 132 |
String ret=""; |
133 |
float v; |
|
134 |
boolean neg; |
|
135 |
int mod; |
|
133 | 136 |
|
134 | 137 |
for(int i=0; i<val.length; i++) |
135 | 138 |
{ |
136 | 139 |
if( i%stop==0 ) ret+="\n"; |
137 |
ret+=(" "+val[i]); |
|
140 |
|
|
141 |
mod = i%stop; |
|
142 |
|
|
143 |
if( mod==0 || mod==3 || mod==6 ) ret+=" ("; |
|
144 |
|
|
145 |
v = val[i]; |
|
146 |
if( v==-0.0f ) v=0.0f; |
|
147 |
|
|
148 |
|
|
149 |
neg = v<0; |
|
150 |
v = (v<0 ? -v:v); |
|
151 |
|
|
152 |
ret+=((neg? " -":" +")+v); |
|
153 |
|
|
154 |
if( mod==2 || mod==5 || mod==7 ) ret+=")"; |
|
138 | 155 |
} |
139 | 156 |
|
140 | 157 |
return ret; |
141 | 158 |
} |
142 |
*/ |
|
159 |
|
|
143 | 160 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
144 | 161 |
/* |
145 | 162 |
private static String debug(Edge e) |
... | ... | |
676 | 693 |
int vertSoFar=0; |
677 | 694 |
float[] attribs= new float[(POS_DATA_SIZE+NOR_DATA_SIZE+TEX_DATA_SIZE)*numVertices]; |
678 | 695 |
|
679 |
//android.util.Log.d("MeshCubes","building front grid..."); |
|
680 |
|
|
681 | 696 |
vertSoFar = buildFrontBackGrid(true, vertSoFar,attribs); |
682 | 697 |
|
683 | 698 |
if( mSlices>0 ) |
... | ... | |
685 | 700 |
vertSoFar = repeatLast(vertSoFar,attribs); |
686 | 701 |
if( vertSoFar%2==1 ) |
687 | 702 |
{ |
688 |
//android.util.Log.d("MeshCubes","repeating winding1 vertex"); |
|
689 |
|
|
690 | 703 |
vertSoFar = repeatLast(vertSoFar,attribs); |
691 | 704 |
} |
692 |
|
|
693 |
//android.util.Log.d("MeshCubes","building side grid..."); |
|
694 |
|
|
695 | 705 |
vertSoFar = buildSideGrid (vertSoFar,attribs); |
696 |
|
|
697 |
//android.util.Log.d("MeshCubes","building back grid..."); |
|
698 |
|
|
699 | 706 |
buildFrontBackGrid (false,vertSoFar,attribs); |
700 | 707 |
} |
701 | 708 |
|
702 |
//android.util.Log.e("MeshCubes", "dataLen="+numVertices); |
|
703 |
//android.util.Log.d("MeshCubes", "attribs: "+debug(attribs,8) ); |
|
704 |
|
|
705 | 709 |
mEdges.clear(); |
706 | 710 |
mEdges = null; |
707 | 711 |
mCubes = null; |
... | ... | |
709 | 713 |
if( remainingVert!=0 ) |
710 | 714 |
android.util.Log.e("MeshCubes", "remainingVert " +remainingVert ); |
711 | 715 |
|
716 |
/* |
|
717 |
float[] attribs_good = |
|
718 |
{ -0.5f, +0.5f, -0.5f, +0.0f, +1.0f, +0.0f, +0.0f, +0.0f, |
|
719 |
-0.5f, +0.5f, -0.5f, +0.0f, +1.0f, +0.0f, +0.0f, +0.0f, |
|
720 |
-0.5f, +0.5f, +0.5f, +0.0f, +1.0f, +0.0f, +0.0f, +1.0f, |
|
721 |
+0.5f, +0.5f, -0.5f, +0.0f, +1.0f, +0.0f, +1.0f, +0.0f, |
|
722 |
+0.5f, +0.5f, +0.5f, +0.0f, +1.0f, +0.0f, +1.0f, +1.0f }; |
|
723 |
|
|
724 |
float[] attribs_hmm = |
|
725 |
{ -0.5f, -0.1f, -0.5f, +0.0f, -1.0f, +0.0f, +0.0f, +1.0f, |
|
726 |
-0.5f, -0.1f, -0.5f, +0.0f, -1.0f, +0.0f, +0.0f, +1.0f, |
|
727 |
-0.5f, -0.1f, +0.5f, +0.0f, -1.0f, +0.0f, +0.0f, +0.5f, |
|
728 |
+0.5f, -0.1f, -0.5f, +0.0f, -1.0f, +0.0f, +1.0f, +1.0f, |
|
729 |
+0.5f, -0.1f, +0.5f, +0.0f, -1.0f, +0.0f, +1.0f, +0.5f }; |
|
730 |
|
|
731 |
float[] attribs_bad = |
|
732 |
{ -0.5f, +0.0f, -0.5f, +0.0f, +1.0f, +0.0f, +0.0f, +1.0f, |
|
733 |
-0.5f, +0.0f, -0.5f, +0.0f, +1.0f, +0.0f, +0.0f, +1.0f, |
|
734 |
-0.5f, +0.0f, +0.5f, +0.0f, +1.0f, +0.0f, +0.0f, +0.5f, |
|
735 |
+0.5f, +0.0f, -0.5f, +0.0f, +1.0f, +0.0f, +1.0f, +1.0f, |
|
736 |
+0.5f, +0.0f, +0.5f, +0.0f, +1.0f, +0.0f, +1.0f, +0.5f }; |
|
737 |
|
|
738 |
numVertices=5; |
|
739 |
*/ |
|
712 | 740 |
mVertAttribs = ByteBuffer.allocateDirect(numVertices*VERTSIZE).order(ByteOrder.nativeOrder()).asFloatBuffer(); |
713 | 741 |
mVertAttribs.put(attribs).position(0); |
714 | 742 |
} |
Also available in: Unified diff
Progress with Effects3D app - merge Matrix effects