versor  3.0
C++11 library for Geometric algebra
vsr_cga3D_draw.h
1 /*
2  * =====================================================================================
3  *
4  * Filename: vsr_cga3D_draw.h
5  *
6  * Description: fixed (immediate mode) graphics pipeline draw routines for 3d cga
7  *
8  * Version: 1.0
9  * Created: 01/19/2015 18:02:48
10  * Revision: none
11  * Compiler: gcc
12  *
13  * Author: Pablo Colapinto (), gmail -> wolftype
14  * Organization: wolftype
15  *
16  * =====================================================================================
17  */
18 
19 
20 
21 #ifndef VSR_DRAW_H_INCLUDED
22 #define VSR_DRAW_H_INCLUDED
23 
24 #include "gfx/gfx_glyphs.h"
25 #include "gfx/gfx_render.h"
26 #include "draw/vsr_draw.h"
27 
28 #include "space/vsr_cga3D_op.h"
29 #include "form/vsr_cga3D_frame.h"
30 #include "form/vsr_field.h"
31 
32 namespace gfx{
33 
34  using namespace vsr;
35  //triangle and normal
36  template<class T>
37  void TriNormal( const T& a, const T& b, const T& c, bool cc = false ){
38  gfx::GL::normal( cga::Round::dir( a^ ( !cc ? ( b^c ) : (c^b) ) ).template copy<cga::Biv>().duale().unit() );
39  gfx::GL::Tri( a, b, c );
40  }
41 
42 
43 
44 // //Alternative Draw routine
45 // template<class A>
46 // void DrawB( const A& s, float r = 1, float g = 1, float b = 1, float a = 1){
47 // glPushMatrix();
48 // glNormal3f(0,0,1);
49 // glColor4f(r,g,b,a);
50 // ImmediateB(s);
51 // glPopMatrix();
52 // }
53 //
54 
55 //
57 // template<class A, class B>
58 // void DrawAtB( const A& s, const B& p, float r = 1, float g = 1, float b = 1, float a = 1){
59 // glPushMatrix();
60 // glTranslatef( p[0], p[1], p[2] );
61 // glNormal3f(0,0,1);
62 // glColor4f(r,g,b,a);
63 // ImmediateB(s);
64 // glPopMatrix();
65 // }
66 
67 
68 
69 // template< class A, class B>
70 // void DrawAll( const A& a, const B& b){
71 // Draw( a ^ b, 1, 0 ,0 );
72 // Draw( a <= b, 1, .2, 0 );
73 // Draw( a.dual() <= b, 0, 1, 0 );
74 // Draw( a.dual() ^ b, 0, 1, .2 );
75 // Draw( a <= b.dual() , 0, 0, 1);
76 // Draw( a ^ b.dual() , .2, 0, 1);
77 // Draw( a.dual() ^ b.dual(), .2, .5, .7 );
78 // Draw( a.dual() <= b.dual(), .4, .3, .6 );
79 // Draw( A( Op::project(a,b) ),1,0,1,.2 );
80 // Draw( A( Op::reject(a,b) ),1,1,0,.2 );
81 //
82 // }
83 //
84 // template<class A, class B>
85 // void DrawEvery( const A& a, const B& b){
86 // DrawAll(a,b);
87 // DrawAll(a^cga::Inf(1),b);
88 // DrawAll(a, b^cga::Inf(1) );
89 // // DrawAll(a, b);
90 // }
91 
92 
93  template<> void Renderable<cga::Vec>::DrawImmediate (const cga::Vec& s);
94  // template<> void Renderable<cga::Vec>::DrawImmediateB (const cga::Vec& s);
95  template<> void Renderable<cga::Biv>::DrawImmediate (const cga::Biv& s);
96  template<> void Renderable<cga::Drv>::DrawImmediate (const cga::Drv& s);
97  template<> void Renderable<cga::Dlp>::DrawImmediate (const cga::Dlp& s);
98  template<> void Renderable<cga::Pln>::DrawImmediate (const cga::Pln& s);
99  template<> void Renderable<cga::Cir>::DrawImmediate (const cga::Cir& s );
100  template<> void Renderable<cga::Pnt>::DrawImmediate (const cga::Pnt& s);
101  template<> void Renderable<cga::Sph>::DrawImmediate (const cga::Sph& s);
102  template<> void Renderable<cga::Flp>::DrawImmediate (const cga::Flp& s);
103  template<> void Renderable<cga::Par>::DrawImmediate (const cga::Par& s);
104  template<> void Renderable<cga::Dll>::DrawImmediate (const cga::Dll& s);
105  template<> void Renderable<cga::Lin>::DrawImmediate (const cga::Lin& s);
106  template<> void Renderable<cga::Tnv>::DrawImmediate (const cga::Tnv& t);
107  template<> void Renderable<cga::Frame>::DrawImmediate (const cga::Frame& f);
108 // template<> void Renderable<cga::Frame>::DrawImmediateB (const cga::Frame& s);
109 
110 
111  template<> void Renderable<Field<cga::Vec>>::DrawImmediate( const Field<cga::Vec>& f);
112  //template<> void ImmediateB( const Field<cga::Vec>& f);
113  template<> void Renderable<Field<cga::Sca>>::DrawImmediate( const Field<cga::Sca>& f);
114  template<> void Renderable<Field<cga::Tnv>>::DrawImmediate( const Field<cga::Tnv>& f);
115  template<> void Renderable<Field<cga::Frame>>::DrawImmediate( const Field<cga::Frame>& f);
116 // #ifdef GFX_IMMEDIATE_MODE
117 
118 
119 //#endif
120 
121 
122 } //gfx::
123 
124 #endif
Common Operations Specific to CGA3D.
Definition: vsr_cga2D_draw.h:13
Generic Geometric Number Types (templated on an algebra and a basis )
Definition: vsr_algebra.h:69
A Basic 3D Field (slowly porting this over from the now defunct vsr_lattice class) Use to Evaluate Ne...
Definition: vsr_field.h:67
static auto dir(const A &s) -> decltype(direction(s))
Direction of Round Element (shorthand)
Definition: vsr_cga3D_round.h:301
the versor library namespace
Definition: vsr_algebra.h:29
Orthonormal Frame composed from a Position and Orientation.
Definition: vsr_cga3D_frame.h:47
3D CGA Orthonormal Frame
NTri< 5 > Tri
Trivector
Definition: vsr_cga3D_types.h:65