forked from enlightenment/efl
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
This commit is contained in:
parent
e2f11bf4cb
commit
7f128ec8d2
|
@ -455,13 +455,15 @@ void
|
||||||
evas_3d_add_cone_frame(Eo *mesh, int frame, int p, vec2 tex_scale)
|
evas_3d_add_cone_frame(Eo *mesh, int frame, int p, vec2 tex_scale)
|
||||||
{
|
{
|
||||||
int vcount, icount, vccount, i;
|
int vcount, icount, vccount, i;
|
||||||
double dfi, fi, sinfi, cosfi;
|
double dfi, fi, sinfi, cosfi, nplane, nz;
|
||||||
|
|
||||||
icount = p * 6;
|
icount = p * 6;
|
||||||
vccount = p + 1;
|
vccount = p + 1;
|
||||||
vcount = 2 * vccount;
|
vcount = 2 * vccount;
|
||||||
|
|
||||||
dfi = 2.0 * M_PI / p;
|
dfi = 2.0 * M_PI / p;
|
||||||
|
nz = sqrt(1.0 / 3.0);
|
||||||
|
nplane = sqrt(2.0 / 3.0);
|
||||||
|
|
||||||
ALLOCATE_VERTEX_DATA
|
ALLOCATE_VERTEX_DATA
|
||||||
|
|
||||||
|
@ -470,20 +472,20 @@ evas_3d_add_cone_frame(Eo *mesh, int frame, int p, vec2 tex_scale)
|
||||||
fi = i * dfi;
|
fi = i * dfi;
|
||||||
sinfi = sin(fi);
|
sinfi = sin(fi);
|
||||||
cosfi = cos(fi);
|
cosfi = cos(fi);
|
||||||
vertices[i].x = sinfi;
|
vertices[i].x = sinfi / 2.0;
|
||||||
vertices[i].y = 0;
|
vertices[i].y = cosfi / 2.0;
|
||||||
vertices[i].z = cosfi;
|
vertices[i].z = -0.5;
|
||||||
vertices[i + vccount].x = 0;
|
vertices[i + vccount].x = 0;
|
||||||
vertices[i + vccount].y = 1;
|
vertices[i + vccount].y = 0;
|
||||||
vertices[i + vccount].z = 0;
|
vertices[i + vccount].z = 0.5;
|
||||||
|
|
||||||
normals[i + vccount].x = normals[i].x = sinfi * 0.71;
|
normals[i + vccount].x = normals[i].x = sinfi * nplane;
|
||||||
normals[i + vccount].y = normals[i].y = 0.71;
|
normals[i + vccount].y = normals[i].y = cosfi * nplane;
|
||||||
normals[i + vccount].z = normals[i].z = cosfi * 0.71;
|
normals[i + vccount].z = normals[i].z = nz;
|
||||||
|
|
||||||
tangents[i + vccount].x = tangents[i].x = cosfi;
|
tangents[i + vccount].x = tangents[i].x = cosfi;
|
||||||
tangents[i + vccount].y = tangents[i].y = 0;
|
tangents[i + vccount].y = tangents[i].y = -sinfi;
|
||||||
tangents[i + vccount].z = tangents[i].z = -sinfi;
|
tangents[i + vccount].z = tangents[i].z = 0;
|
||||||
|
|
||||||
tex_coord[i].x = i / (float)(vccount - 1) * tex_scale.x;
|
tex_coord[i].x = i / (float)(vccount - 1) * tex_scale.x;
|
||||||
tex_coord[i].y = 0;
|
tex_coord[i].y = 0;
|
||||||
|
|
Loading…
Reference in New Issue