summaryrefslogtreecommitdiff
path: root/src/examples
diff options
context:
space:
mode:
authorBogdan Devichev <b.devichev@samsung.com>2015-04-06 10:58:28 +0900
committerChunEon Park <chuneon.park@samsung.com>2015-04-06 10:58:28 +0900
commit7f128ec8d2944cbf6994c933d0e392f452a9ac62 (patch)
tree0c143de7fa126646a0d24c195320b3f42f14d0e1 /src/examples
parente2f11bf4cb82ed2264a90da4bde31688e3d7b12f (diff)
evas-3D: primitives: cone is standardized now (normalized and z is an axis of symmetry)
Summary: {F13944} Test Plan: D2248 gives app for testing. Reviewers: cedric, Hermet, raster, Sergeant_Whitespace Reviewed By: Sergeant_Whitespace Subscribers: Sergeant_Whitespace, cedric Differential Revision: https://phab.enlightenment.org/D2251
Diffstat (limited to 'src/examples')
-rw-r--r--src/examples/evas/evas-3d-primitives.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/examples/evas/evas-3d-primitives.c b/src/examples/evas/evas-3d-primitives.c
index 1e36baa..ef6a321 100644
--- a/src/examples/evas/evas-3d-primitives.c
+++ b/src/examples/evas/evas-3d-primitives.c
@@ -455,13 +455,15 @@ void
455evas_3d_add_cone_frame(Eo *mesh, int frame, int p, vec2 tex_scale) 455evas_3d_add_cone_frame(Eo *mesh, int frame, int p, vec2 tex_scale)
456{ 456{
457 int vcount, icount, vccount, i; 457 int vcount, icount, vccount, i;
458 double dfi, fi, sinfi, cosfi; 458 double dfi, fi, sinfi, cosfi, nplane, nz;
459 459
460 icount = p * 6; 460 icount = p * 6;
461 vccount = p + 1; 461 vccount = p + 1;
462 vcount = 2 * vccount; 462 vcount = 2 * vccount;
463 463
464 dfi = 2.0 * M_PI / p; 464 dfi = 2.0 * M_PI / p;
465 nz = sqrt(1.0 / 3.0);
466 nplane = sqrt(2.0 / 3.0);
465 467
466 ALLOCATE_VERTEX_DATA 468 ALLOCATE_VERTEX_DATA
467 469
@@ -470,20 +472,20 @@ evas_3d_add_cone_frame(Eo *mesh, int frame, int p, vec2 tex_scale)
470 fi = i * dfi; 472 fi = i * dfi;
471 sinfi = sin(fi); 473 sinfi = sin(fi);
472 cosfi = cos(fi); 474 cosfi = cos(fi);
473 vertices[i].x = sinfi; 475 vertices[i].x = sinfi / 2.0;
474 vertices[i].y = 0; 476 vertices[i].y = cosfi / 2.0;
475 vertices[i].z = cosfi; 477 vertices[i].z = -0.5;
476 vertices[i + vccount].x = 0; 478 vertices[i + vccount].x = 0;
477 vertices[i + vccount].y = 1; 479 vertices[i + vccount].y = 0;
478 vertices[i + vccount].z = 0; 480 vertices[i + vccount].z = 0.5;
479 481
480 normals[i + vccount].x = normals[i].x = sinfi * 0.71; 482 normals[i + vccount].x = normals[i].x = sinfi * nplane;
481 normals[i + vccount].y = normals[i].y = 0.71; 483 normals[i + vccount].y = normals[i].y = cosfi * nplane;
482 normals[i + vccount].z = normals[i].z = cosfi * 0.71; 484 normals[i + vccount].z = normals[i].z = nz;
483 485
484 tangents[i + vccount].x = tangents[i].x = cosfi; 486 tangents[i + vccount].x = tangents[i].x = cosfi;
485 tangents[i + vccount].y = tangents[i].y = 0; 487 tangents[i + vccount].y = tangents[i].y = -sinfi;
486 tangents[i + vccount].z = tangents[i].z = -sinfi; 488 tangents[i + vccount].z = tangents[i].z = 0;
487 489
488 tex_coord[i].x = i / (float)(vccount - 1) * tex_scale.x; 490 tex_coord[i].x = i / (float)(vccount - 1) * tex_scale.x;
489 tex_coord[i].y = 0; 491 tex_coord[i].y = 0;