// Copyright (C) 2010, Guy Barrand. All rights reserved. // See the file tools.license for terms. #ifndef tools_glprims #define tools_glprims //same as OpenGL GL_[POINTS,etc...], but for the case we don't have OpenGL. #include //size_t namespace tools { namespace gl { typedef unsigned char mode_t; inline mode_t points() {return 0x0000;} inline mode_t lines() {return 0x0001;} //segments inline mode_t line_loop() {return 0x0002;} inline mode_t line_strip() {return 0x0003;} //polyline inline mode_t triangles() {return 0x0004;} inline mode_t triangle_strip() {return 0x0005;} inline mode_t triangle_fan() {return 0x0006;} //inline mode_t quads() {return 0x0007;} //inline mode_t quad_strip() {return 0x0008;} //inline mode_t polygon() {return 0x0009;} inline bool is_mode(mode_t a_mode) { return a_mode<=0x006?true:false; } inline bool is_line(mode_t a_mode) { if(a_mode==points()) return true; //0 sz line ! if(a_mode==lines()) return true; if(a_mode==line_loop()) return true; if(a_mode==line_strip()) return true; return false; } inline void cvt_2to3(size_t a_npt,const float* a_xys,float*& a_xyzs) { const float* vpos = a_xys; float x,y; for(size_t i=0;i