KiCad PCB EDA Suite
eda_3d_canvas_pivot.cpp File Reference

Implementation of a 3d cursor. More...

Go to the source code of this file.

Functions

static void pivot_render_triangles (float t)
 

Detailed Description

Implementation of a 3d cursor.

Definition in file eda_3d_canvas_pivot.cpp.

Function Documentation

static void pivot_render_triangles ( float  t)
static

Definition at line 35 of file eda_3d_canvas_pivot.cpp.

Referenced by EDA_3D_CANVAS::render_pivot().

36 {
37  wxASSERT( t >= 0.0f );
38 
39  SFVEC3F vertexPointer[12];
40 
41  const float u = 1.0f / 6.0f;
42 
43  vertexPointer[0] = SFVEC3F( (-3.0f + t) * u, -2.0f * u, 0.0f );
44  vertexPointer[1] = SFVEC3F( (-3.0f + t) * u, 2.0f * u, 0.0f );
45  vertexPointer[2] = SFVEC3F( (-1.0f + t) * u, 0.0f * u, 0.0f );
46 
47  vertexPointer[3] = SFVEC3F( -2.0f * u, (-3.0f + t) * u, 0.0f );
48  vertexPointer[4] = SFVEC3F( 2.0f * u, (-3.0f + t) * u, 0.0f );
49  vertexPointer[5] = SFVEC3F( 0.0f * u, (-1.0f + t) * u, 0.0f );
50 
51  vertexPointer[6] = SFVEC3F( (3.0f - t) * u, -2.0f * u, 0.0f );
52  vertexPointer[7] = SFVEC3F( (3.0f - t) * u, 2.0f * u, 0.0f );
53  vertexPointer[8] = SFVEC3F( (1.0f - t) * u, 0.0f * u, 0.0f );
54 
55  vertexPointer[9] = SFVEC3F( 2.0f * u, (3.0f - t) * u, 0.0f );
56  vertexPointer[10] = SFVEC3F( -2.0f * u, (3.0f - t) * u, 0.0f );
57  vertexPointer[11] = SFVEC3F( 0.0f * u, (1.0f - t) * u, 0.0f );
58 
59  glDisableClientState( GL_TEXTURE_COORD_ARRAY );
60  glDisableClientState( GL_COLOR_ARRAY );
61  glDisableClientState( GL_NORMAL_ARRAY );
62  glEnableClientState( GL_VERTEX_ARRAY );
63  glVertexPointer( 3, GL_FLOAT, 0, vertexPointer );
64 
65  glEnable( GL_BLEND );
66  glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
67 
68  glDrawArrays( GL_TRIANGLES, 0, 4 * 3 );
69 
70  glDisable( GL_BLEND );
71 
72  glDisableClientState( GL_VERTEX_ARRAY );
73 }
glm::vec3 SFVEC3F
Definition: xv3d_types.h:47