hermet pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=7f128ec8d2944cbf6994c933d0e392f452a9ac62

commit 7f128ec8d2944cbf6994c933d0e392f452a9ac62
Author: Bogdan Devichev <[email protected]>
Date:   Mon Apr 6 10:58:28 2015 +0900

    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
---
 src/examples/evas/evas-3d-primitives.c | 24 +++++++++++++-----------
 1 file 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
 evas_3d_add_cone_frame(Eo *mesh, int frame, int p, vec2 tex_scale)
 {
    int vcount, icount, vccount, i;
-   double dfi, fi, sinfi, cosfi;
+   double dfi, fi, sinfi, cosfi, nplane, nz;
 
    icount = p * 6;
    vccount = p + 1;
    vcount = 2 * vccount;
 
    dfi = 2.0 * M_PI / p;
+   nz = sqrt(1.0 / 3.0);
+   nplane = sqrt(2.0 / 3.0);
 
    ALLOCATE_VERTEX_DATA
 
@@ -470,20 +472,20 @@ evas_3d_add_cone_frame(Eo *mesh, int frame, int p, vec2 
tex_scale)
         fi = i * dfi;
         sinfi = sin(fi);
         cosfi = cos(fi);
-        vertices[i].x = sinfi;
-        vertices[i].y = 0;
-        vertices[i].z = cosfi;
+        vertices[i].x = sinfi / 2.0;
+        vertices[i].y = cosfi / 2.0;
+        vertices[i].z = -0.5;
         vertices[i + vccount].x = 0;
-        vertices[i + vccount].y = 1;
-        vertices[i + vccount].z = 0;
+        vertices[i + vccount].y = 0;
+        vertices[i + vccount].z = 0.5;
 
-        normals[i + vccount].x = normals[i].x = sinfi * 0.71;
-        normals[i + vccount].y = normals[i].y = 0.71;
-        normals[i + vccount].z = normals[i].z = cosfi * 0.71;
+        normals[i + vccount].x = normals[i].x = sinfi * nplane;
+        normals[i + vccount].y = normals[i].y = cosfi * nplane;
+        normals[i + vccount].z = normals[i].z = nz;
 
         tangents[i + vccount].x = tangents[i].x = cosfi;
-        tangents[i + vccount].y = tangents[i].y = 0;
-        tangents[i + vccount].z = tangents[i].z = -sinfi;
+        tangents[i + vccount].y = tangents[i].y = -sinfi;
+        tangents[i + vccount].z = tangents[i].z = 0;
 
         tex_coord[i].x = i / (float)(vccount - 1) * tex_scale.x;
         tex_coord[i].y = 0;

-- 


Reply via email to