Revision 9e5b990e
Added by Leszek Koltunski about 4 years ago
src/main/java/org/distorted/objects/FactoryCubit.java | ||
---|---|---|
506 | 506 |
final float angle = (float)Math.PI/(2*IVY_N); |
507 | 507 |
final float CORR = 1.0f - 2*IVY_D; |
508 | 508 |
final float DIST = 0.4f; |
509 |
final float DIST2 = -0.5f*CORR; |
|
509 |
final float DIST2 = -0.5f*CORR + IVY_D;
|
|
510 | 510 |
final float CORR2 = 0.5f; |
511 | 511 |
float[] vertices = new float[2*(IVY_N+1)+6]; |
512 | 512 |
|
... | ... | |
527 | 527 |
vertices[2*i+7] = (CORR*(sin-0.5f)-DIST)*CORR2; |
528 | 528 |
} |
529 | 529 |
|
530 |
float[] bands0 = computeBands(+0.02f,18,0.2f,0.5f,5);
|
|
530 |
float[] bands0 = computeBands(+0.02f,12,0.2f,0.5f,5);
|
|
531 | 531 |
float[] bands1 = computeBands(-0.10f,20,0.2f,0.0f,2); |
532 | 532 |
|
533 | 533 |
meshes[0] = new MeshPolygon(vertices,bands0,0,0); |
... | ... | |
553 | 553 |
MeshBase[] meshes = new MeshBase[2]; |
554 | 554 |
|
555 | 555 |
final float angle = (float)Math.PI/(2*IVY_N); |
556 |
final float CORR = 0.25f - 0.5f*IVY_D;
|
|
556 |
final float CORR = 1.0f - 2*IVY_D;
|
|
557 | 557 |
float[] vertices = new float[4*IVY_N]; |
558 | 558 |
|
559 | 559 |
for(int i=0; i<IVY_N; i++) |
... | ... | |
567 | 567 |
vertices[2*i+1+2*IVY_N] = CORR*(sin-0.5f); |
568 | 568 |
} |
569 | 569 |
|
570 |
float[] bands0 = computeBands(+0.0125f,35,0.125f,0.5f,5);
|
|
571 |
float[] bands1 = computeBands(-0.0250f,45,0.125f,0.0f,2);
|
|
570 |
float[] bands0 = computeBands(+0.05f,35,0.5f,0.5f,5);
|
|
571 |
float[] bands1 = computeBands(-0.10f,45,0.5f,0.0f,2);
|
|
572 | 572 |
|
573 | 573 |
meshes[0] = new MeshPolygon(vertices,bands0,0,0); |
574 | 574 |
meshes[0].setEffectAssociation(0,1,0); |
... | ... | |
1007 | 1007 |
return effect; |
1008 | 1008 |
} |
1009 | 1009 |
|
1010 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
1011 |
|
|
1012 |
VertexEffect[] createVertexEffectsIvyFace() |
|
1013 |
{ |
|
1014 |
VertexEffect[] effect = new VertexEffect[1]; |
|
1015 |
effect[0] = new VertexEffectScale(4.0f); |
|
1016 |
return effect; |
|
1017 |
} |
|
1018 |
|
|
1019 | 1010 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
1020 | 1011 |
// OBJECTS |
1021 | 1012 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
1291 | 1282 |
MeshBase createIvyFaceMesh() |
1292 | 1283 |
{ |
1293 | 1284 |
MeshBase mesh = createFacesIvyFace(); |
1294 |
VertexEffect[] effects = createVertexEffectsIvyFace(); |
|
1295 |
for( VertexEffect effect : effects ) mesh.apply(effect); |
|
1296 | 1285 |
|
1297 | 1286 |
mesh.mergeEffComponents(); |
1298 | 1287 |
mesh.addEmptyTexComponent(); |
src/main/java/org/distorted/objects/FactorySticker.java | ||
---|---|---|
160 | 160 |
} |
161 | 161 |
|
162 | 162 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
163 |
// TODO |
|
164 | 163 |
|
165 |
void drawIvyCornerSticker(Canvas canvas, Paint paint, int left, int top, int color, float stroke) |
|
164 |
void drawIvyCornerSticker(Canvas canvas, Paint paint, int left, int top, int color, float stroke, float radius)
|
|
166 | 165 |
{ |
166 |
paint.setAntiAlias(true); |
|
167 | 167 |
paint.setColor(color); |
168 | 168 |
paint.setStyle(Paint.Style.FILL); |
169 | 169 |
canvas.drawRect(left,top,left+TEXTURE_HEIGHT,top+TEXTURE_HEIGHT,paint); |
170 | 170 |
|
171 |
float CORR = 0.5f; |
|
172 |
float DIST = 0.4f; |
|
173 |
|
|
171 | 174 |
paint.setColor(COLOR_BLACK); |
172 | 175 |
paint.setStyle(Paint.Style.STROKE); |
173 |
paint.setStrokeWidth(stroke); |
|
176 |
paint.setStrokeWidth(CORR*stroke*TEXTURE_HEIGHT); |
|
177 |
|
|
178 |
float tmp1 = ((IVY_D-0.5f)-DIST)*CORR; |
|
179 |
float cx1 = TEXTURE_HEIGHT*(tmp1 + 0.5f); |
|
180 |
float cy1 = TEXTURE_HEIGHT*(0.5f - tmp1); |
|
181 |
|
|
182 |
float halfL1 = CORR*TEXTURE_HEIGHT*(1.0f-2*IVY_D); |
|
183 |
|
|
184 |
canvas.drawArc( left+cx1-halfL1, top+cy1-halfL1, left+cx1+halfL1, top+cy1+halfL1, 270, 90, false, paint); |
|
185 |
|
|
186 |
float tmp2 = (+0.5f-DIST)*CORR; |
|
187 |
float tmp3 = (-0.5f-DIST)*CORR; |
|
188 |
|
|
189 |
float x0 = TEXTURE_HEIGHT*(+tmp2 + 0.5f); |
|
190 |
float y0 = TEXTURE_HEIGHT*(-tmp3 + 0.5f); |
|
191 |
float x1 = TEXTURE_HEIGHT*(+tmp2 + 0.5f); |
|
192 |
float y1 = TEXTURE_HEIGHT*(-tmp2 + 0.5f); |
|
193 |
float x2 = TEXTURE_HEIGHT*(+tmp3 + 0.5f); |
|
194 |
float y2 = TEXTURE_HEIGHT*(-tmp2 + 0.5f); |
|
195 |
|
|
196 |
canvas.drawLine(left+x0,top+y0,left+x1,top+y1,paint); |
|
197 |
canvas.drawLine(left+x1,top+y1,left+x2,top+y2,paint); |
|
198 |
|
|
199 |
float tmp4 = ((0.5f-stroke/2-radius/2)-DIST)*CORR; |
|
200 |
float cx2 = TEXTURE_HEIGHT*(tmp4 + 0.5f); |
|
201 |
float cy2 = TEXTURE_HEIGHT*(0.5f - tmp4); |
|
202 |
|
|
203 |
float halfL2 = CORR*TEXTURE_HEIGHT*radius; |
|
204 |
|
|
205 |
paint.setStrokeWidth(CORR*radius*TEXTURE_HEIGHT); |
|
206 |
canvas.drawArc( left+cx2-halfL2, top+cy2-halfL2, left+cx2+halfL2, top+cy2+halfL2, 270, 90, false, paint); |
|
174 | 207 |
} |
175 | 208 |
|
176 | 209 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
177 |
// TODO |
|
178 | 210 |
|
179 |
void drawIvyCenterSticker(Canvas canvas, Paint paint, int left, int top, int color, float stroke) |
|
211 |
void drawIvyCenterSticker(Canvas canvas, Paint paint, int left, int top, int color, float stroke, float radius)
|
|
180 | 212 |
{ |
213 |
paint.setAntiAlias(true); |
|
181 | 214 |
paint.setColor(color); |
182 | 215 |
paint.setStyle(Paint.Style.FILL); |
183 | 216 |
canvas.drawRect(left,top,left+TEXTURE_HEIGHT,top+TEXTURE_HEIGHT,paint); |
... | ... | |
186 | 219 |
paint.setStyle(Paint.Style.STROKE); |
187 | 220 |
paint.setStrokeWidth(stroke*TEXTURE_HEIGHT); |
188 | 221 |
|
189 |
float cx = 0.075f*TEXTURE_HEIGHT; |
|
190 |
float cy = 0.075f*TEXTURE_HEIGHT; |
|
191 |
|
|
192 |
float c2 = TEXTURE_HEIGHT*(1.0f-0.0f*IVY_D); |
|
193 |
float halfL = TEXTURE_HEIGHT*(0.7f - 0.5f*IVY_D); |
|
194 |
|
|
195 |
android.util.Log.e("sitck", "left="+left+" top="+top); |
|
196 |
|
|
197 |
canvas.drawArc( left+cx-halfL, top+cy-halfL, left+cx+halfL, top+cy+halfL, 280, 80, false, paint); |
|
198 |
// canvas.drawArc( left+c2-halfL, top+c2-halfL, left+c2+halfL, top+c2+halfL, 90, 90, false, paint); |
|
222 |
float cx1 = TEXTURE_HEIGHT*IVY_D; |
|
223 |
float cy1 = TEXTURE_HEIGHT*(1-IVY_D); |
|
224 |
float cx2 = TEXTURE_HEIGHT*(1.0f-IVY_D); |
|
225 |
float cy2 = TEXTURE_HEIGHT*IVY_D; |
|
199 | 226 |
|
227 |
float halfL = TEXTURE_HEIGHT*(1.0f - 2*IVY_D); |
|
200 | 228 |
|
229 |
canvas.drawArc( left+cx1-halfL, top+cy1-halfL, left+cx1+halfL, top+cy1+halfL, 270, 90, false, paint); |
|
230 |
canvas.drawArc( left+cx2-halfL, top+cy2-halfL, left+cx2+halfL, top+cy2+halfL, 90, 90, false, paint); |
|
201 | 231 |
} |
202 | 232 |
} |
src/main/java/org/distorted/objects/TwistyIvy.java | ||
---|---|---|
234 | 234 |
{ |
235 | 235 |
int COLORS = FACE_COLORS.length; |
236 | 236 |
FactorySticker factory = FactorySticker.getInstance(); |
237 |
float R = 0.01f; |
|
237 |
float S = 0.08f; |
|
238 |
float R = 0.06f; |
|
238 | 239 |
|
239 | 240 |
if( face<COLORS ) |
240 | 241 |
{ |
241 |
factory.drawIvyCornerSticker(canvas, paint, left, top, FACE_COLORS[face%COLORS], R); |
|
242 |
factory.drawIvyCornerSticker(canvas, paint, left, top, FACE_COLORS[face%COLORS], S, R);
|
|
242 | 243 |
} |
243 | 244 |
else |
244 | 245 |
{ |
245 |
factory.drawIvyCenterSticker(canvas, paint, left, top, FACE_COLORS[face%COLORS], R); |
|
246 |
factory.drawIvyCenterSticker(canvas, paint, left, top, FACE_COLORS[face%COLORS], S, R);
|
|
246 | 247 |
} |
247 | 248 |
} |
248 | 249 |
|
Also available in: Unified diff
Progress with the Ivy.