21 #ifndef vsr_cga2D_render_INC
22 #define vsr_cga2D_render_INC
25 #include "gfx/gfx_renderer.h"
27 #include "vsr_cga2D_types.h"
37 inline gfx::Mat4f mat(
const Vec& v, VT s) {
38 double x = v[0];
double y = v[1];
39 return gfx::Mat4f( s , 0 , 0 , 0,
46 MBO& MeshBuffer(
const Dll& s ) {
static MBO mbo(
Mesh::Line(
Vec(-50,0),
Vec(50,0) ), GL::DYNAMIC );
return mbo; }
47 MBO& MeshBuffer(
const Lin& s ) {
return MeshBuffer(
Dll() ); }
54 vector<MBO>& MeshBuffer(
const Pnt& s){
59 vector<MBO>& MeshBuffer(
const Sph& s ) {
return MeshBuffer(
Pnt() ); }
61 vector<MBO>& MeshBuffer(
const Par& s ) {
62 static vector<MBO> m = {
Mesh::Sphere(), Mesh::Points( Ro::split(s) ) };
72 void Render(
const Pnt& pnt, Renderer * re,
73 bool bUpdate=
false,
float r=1.0,
float g=1.0,
float b=1.0,
float a=1.0 ) {
75 auto& mbo = MeshBuffer( pnt );
79 double ta = vsr::Ro::size( pnt,
true );
81 if ( fabs(ta) > FPERROR ) {
83 bool real = ta > 0 ? 1 : 0;
85 re -> modelview( XF::mat( pnt, sqrt( fabs(ta) ) ) );
86 if (bUpdate) { circle.mesh.color(r,g,b,a); circle.update(); }
87 re -> pipe.line( circle );
93 point.mesh[0].Pos = Vec3f(pnt[0],pnt[1],pnt[2]);
94 if (bUpdate) point.mesh.color(r,g,b,a);
96 re -> pipe.line( point );
NVec< 5 > Vec
Vector
Definition: vsr_cga3D_types.h:62
Definition: vsr_cga2D_draw.h:13
Generic Geometric Number Types (templated on an algebra and a basis )
Definition: vsr_algebra.h:69
NLin< 5 > Lin
Line
Definition: vsr_cga3D_types.h:80
NPar< 5 > Par
Pair
Definition: vsr_cga3D_types.h:73
Cir Circle
Direct Circle 3-blade \(\kappa=p_a \wedge p_b \wedge p_c\)
Definition: vsr_cga3D_types.h:130
NDll< 5 > Dll
DualLine
Definition: vsr_cga3D_types.h:79
Pnt Point
Null Vector \(p=\{e_1,e_2,e_3,n_o,n_\infty\}\)
Definition: vsr_cga3D_types.h:128
the versor library namespace
Definition: vsr_algebra.h:29
Lin Line
Direct Line Trivector \(p_a \wedge p_b \wedge n_\infty\)
Definition: vsr_cga3D_types.h:140
NPnt< 5 > Pnt
Point
Definition: vsr_cga3D_types.h:72
NSph< 5 > Sph
Sphere
Definition: vsr_cga3D_types.h:75
Sph Sphere
Direct Sphere 4-blade \(\Sigma=p_a \wedge p_b \wedge p_c \wedge p_d\)
Definition: vsr_cga3D_types.h:131