g4tools  5.4.0
Classes | Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
tools::sg::gl2ps_action Class Reference
Inheritance diagram for tools::sg::gl2ps_action:
Inheritance graph
[legend]
Collaboration diagram for tools::sg::gl2ps_action:
Collaboration graph
[legend]

Classes

class  primvis
 

Public Member Functions

virtual void draw_vertex_array (gl::mode_t a_mode, size_t a_floatn, const float *a_xyzs)
 
virtual void draw_vertex_array_xy (gl::mode_t a_mode, size_t a_floatn, const float *a_xys)
 
virtual void draw_vertex_color_array (gl::mode_t a_mode, size_t a_floatn, const float *a_xyzs, const float *a_rgbas)
 
virtual void draw_vertex_normal_array (gl::mode_t a_mode, size_t a_floatn, const float *a_xyzs, const float *a_nms)
 
virtual void draw_vertex_color_normal_array (gl::mode_t a_mode, size_t a_floatn, const float *a_xyzs, const float *a_rgbas, const float *a_nms)
 
virtual void clear_color (float a_r, float a_g, float a_b, float)
 
virtual void color4f (float a_r, float a_g, float a_b, float a_a)
 
virtual void line_width (float a_v)
 
virtual void point_size (float a_v)
 
virtual void set_polygon_offset (bool a_v)
 
virtual void normal (float a_x, float a_y, float a_z)
 
virtual void set_winding (winding_type a_v)
 
virtual void set_shade_model (shade_type a_v)
 
virtual void set_depth_test (bool a_on)
 
virtual void set_cull_face (bool a_on)
 
virtual void set_point_smooth (bool a_on)
 
virtual void set_line_smooth (bool a_on)
 
virtual void load_proj_matrix (const mat4f &a_mtx)
 
virtual void load_model_matrix (const mat4f &a_mtx)
 
virtual unsigned int max_lights ()
 
virtual void enable_light (unsigned int, float a_dx, float a_dy, float a_dz, float a_r, float a_g, float a_b, float a_a)
 
virtual void set_lighting (bool a_on)
 
virtual void set_blend (bool)
 
virtual void restore_state (unsigned int)
 
virtual void draw_vertex_array_texture (gl::mode_t, size_t a_xyzn, const float *a_xyzs, gstoid a_id, const float *a_tcs)
 texture ///////////////////////////////////////////////////// More...
 
virtual void draw_vertex_normal_array_texture (gl::mode_t a_mode, size_t a_xyzn, const float *a_xyzs, const float *, gstoid a_id, const float *a_tcs)
 
virtual void begin_gsto (gstoid)
 VBO /////////////////////////////////////////////////////////. More...
 
virtual void draw_gsto_v (gl::mode_t, size_t, bufpos)
 
virtual void draw_gsto_vc (gl::mode_t, size_t, bufpos, bufpos)
 
virtual void draw_gsto_vn (gl::mode_t, size_t, bufpos, bufpos)
 
virtual void draw_gsto_vcn (gl::mode_t, size_t, bufpos, bufpos, bufpos)
 
virtual void end_gsto ()
 
virtual sg::render_managerrender_manager ()
 
 gl2ps_action (gl2ps_manager &a_mgr, std::ostream &a_out, unsigned int a_ww, unsigned int a_wh)
 
virtual ~gl2ps_action ()
 
bool open (const std::string &a_name, int a_format=TOOLS_GL2PS_EPS)
 
bool close ()
 
void set_background (float a_r, float a_g, float a_b)
 
- Public Member Functions inherited from tools::sg::render_action
 render_action (std::ostream &a_out, unsigned int a_ww, unsigned int a_wh)
 
virtual ~render_action ()
 
 render_action (const render_action &a_from)
 
render_actionoperator= (const render_action &a_from)
 
void load_matrices_to_identity ()
 
void load_matrices_from_state ()
 
void clear_color (const colorf &a_color)
 
void color4f (const colorf &a_color)
 
void enable_light (unsigned int a_light, const vec3f &a_dir, const colorf &a_col)
 
void draw_vertex_array (gl::mode_t a_mode, const std::vector< float > &a_xyzs)
 
void draw_vertex_array_xy (gl::mode_t a_mode, const std::vector< float > &a_xys)
 
void draw_vertex_color_array (gl::mode_t a_mode, const std::vector< float > &a_xyzs, const std::vector< float > &a_rgbas)
 
void draw_vertex_normal_array (gl::mode_t a_mode, const std::vector< float > &a_xyzs, const std::vector< float > &a_nms)
 
void draw_vertex_color_normal_array (gl::mode_t a_mode, const std::vector< float > &a_xyzs, const std::vector< float > &a_rgbas, const std::vector< float > &a_nms)
 
void normal (const vec3f &a_vec)
 
bool add_triangles_normal (size_t a_floatn, const float *a_xyzs, const float *a_nms)
 
bool add_triangle_fan_normal (size_t a_floatn, const float *a_xyzs, const float *a_nms)
 
bool add_triangle_fan_normal_rgba (size_t a_floatn, const float *a_xyzs, float *a_nms, const float *a_rgbas)
 
bool add_triangle_strip_normal (size_t a_floatn, const float *a_xyzs, const float *a_nms)
 
bool add_triangle_strip_normal_rgba (size_t a_floatn, const float *a_xyzs, const float *a_nms, const float *a_rgbas)
 
bool add_lines (size_t a_floatn, const float *a_xyzs)
 
bool add_line_loop (size_t a_floatn, const float *a_xyzs)
 
bool add_line_strip (size_t a_floatn, const float *a_xyzs)
 
bool add_points (size_t a_floatn, const float *a_xyzs)
 
bool add_triangle_fan_texture_normal (size_t a_floatn, const float *a_xyzs, const float *a_nms, gstoid a_tex, const float *a_texs)
 
bool add_triangle_strip_texture_normal (size_t a_floatn, const float *a_xyzs, const float *a_nms, gstoid a_tex, const float *a_texs)
 
bool add_line_loop (const std::vector< float > &a_xyzs)
 
bool add_line_strip (const std::vector< float > &a_xyzs)
 
bool add_triangle_strip_as_triangles (size_t a_floatn, const float *a_xyzs, const float *a_nms)
 
void dump_vertex_array_xy (std::ostream &a_out, gl::mode_t, size_t a_floatn, const float *a_xys)
 
- Public Member Functions inherited from tools::sg::matrix_action
 matrix_action (std::ostream &a_out, unsigned int a_ww, unsigned int a_wh)
 
virtual ~matrix_action ()
 
 matrix_action (const matrix_action &a_from)
 
matrix_actionoperator= (const matrix_action &a_from)
 
void push_matrices ()
 
void pop_matrices ()
 
mat4fprojection_matrix ()
 
mat4fmodel_matrix ()
 
bool end () const
 
int cur () const
 
bool project_point (float &a_x, float &a_y, float &a_z, float &a_w)
 
void model_point (float &a_x, float &a_y, float &a_z, float &a_w)
 
void projected_origin (float &a_x, float &a_y, float &a_z)
 
- Public Member Functions inherited from tools::sg::win_action
 win_action (std::ostream &a_out, unsigned int a_ww, unsigned int a_wh)
 
virtual ~win_action ()
 
unsigned int ww () const
 
unsigned int wh () const
 
- Public Member Functions inherited from tools::sg::action
virtual void * cast (const std::string &a_class) const
 
virtual const std::string & s_cls () const =0
 
 action (std::ostream &a_out)
 
virtual ~action ()
 
std::ostream & out () const
 
- Public Member Functions inherited from tools::sg::states
 states (unsigned int a_ww, unsigned int a_wh)
 
virtual ~states ()
 
const sg::statestate () const
 
sg::statestate ()
 
void pop_state ()
 
void push_state ()
 
void save_state (const sg::state &a_state)
 
const sg::statesaved_state () const
 
sg::statesaved_state ()
 

Protected Member Functions

 gl2ps_action (const gl2ps_action &a_from)
 
gl2ps_actionoperator= (const gl2ps_action &a_from)
 
void set_normal_matrix ()
 
bool project_point (float &a_x, float &a_y, float &a_z, float &a_w)
 
- Protected Member Functions inherited from tools::sg::matrix_action
void reset ()
 
- Protected Member Functions inherited from tools::sg::win_action
 win_action (const win_action &a_from)
 
win_actionoperator= (const win_action &a_from)
 
- Protected Member Functions inherited from tools::sg::action
 action (const action &a_from)
 
actionoperator= (const action &)
 
- Protected Member Functions inherited from tools::sg::states
 states (const states &a_from)
 
statesoperator= (const states &a_from)
 

Static Protected Member Functions

static void set_vtx (tools_GL2PSvertex *a_vs, unsigned int a_index, float a_x, float a_y, float a_z, float a_r, float a_g, float a_b, float a_a)
 

Protected Attributes

gl2ps_managerm_mgr
 
FILE * m_FILE
 
float m_back [3]
 
mat4f m_vp_mtx
 
primvis m_pv
 
colorf m_light_color
 
vec3f m_light_direction
 
vec3f m_normal
 
mat4f m_proj
 
mat4f m_model
 
mat4f m_normal_matrix
 
colorf m_color
 
bool m_ccw
 
bool m_POLYGON_OFFSET_FILL
 
bool m_CULL_FACE
 
bool m_POINT_SMOOTH
 
bool m_LINE_SMOOTH
 
float m_point_size
 
float m_line_width
 
bool m_light_on
 
bool m_DEPTH_TEST
 
- Protected Attributes inherited from tools::sg::matrix_action
std::vector< mat4fm_projs
 
std::vector< mat4fm_models
 
int m_cur
 
mat4f m_identity
 
- Protected Attributes inherited from tools::sg::win_action
unsigned int m_ww
 
unsigned int m_wh
 
- Protected Attributes inherited from tools::sg::action
std::ostream & m_out
 
- Protected Attributes inherited from tools::sg::states
std::vector< sg::statem_states
 
sg::state m_state
 
sg::state m_saved_state
 

Additional Inherited Members

- Public Types inherited from tools::sg::render_action
typedef unsigned int gstoid
 

Detailed Description

Definition at line 19 of file gl2ps_action.

Constructor & Destructor Documentation

◆ gl2ps_action() [1/2]

tools::sg::gl2ps_action::gl2ps_action ( gl2ps_manager a_mgr,
std::ostream &  a_out,
unsigned int  a_ww,
unsigned int  a_wh 
)
inline

Definition at line 163 of file gl2ps_action.

164  :parent(a_out,a_ww,a_wh)
165  ,m_mgr(a_mgr)
166  ,m_FILE(0)
167  ,m_pv(get_me())
168  ,m_light_color(colorf_white())
169  ,m_light_direction(vec3f(0,0,-1))
170 
171  ,m_ccw(true)
172  ,m_POLYGON_OFFSET_FILL(false)
173  ,m_CULL_FACE(true)
174  ,m_POINT_SMOOTH(false)
175  ,m_LINE_SMOOTH(false)
176  ,m_point_size(1)
177  ,m_line_width(1)
178  ,m_light_on(false)
179  ,m_DEPTH_TEST(true)
180  {
181  m_back[0] = 1;
182  m_back[1] = 1;
183  m_back[2] = 1;
184 
185  m_vp_mtx.set_identity();
186  m_vp_mtx.mul_translate(float(m_ww)/2,float(m_wh)/2,0);
187  m_vp_mtx.mul_scale(float(m_ww)/2,float(m_wh)/2,1);
188 
189  //m_zb.change_size(a_ww,a_wh);
190 // m_zb.clear_color_buffer(0);
191 // m_zb.clear_depth_buffer();
192  m_proj.set_identity();
193  m_model.set_identity();
194  m_normal_matrix.set_identity();
195  }

◆ ~gl2ps_action()

virtual tools::sg::gl2ps_action::~gl2ps_action ( )
inlinevirtual

Definition at line 196 of file gl2ps_action.

196 {}

◆ gl2ps_action() [2/2]

tools::sg::gl2ps_action::gl2ps_action ( const gl2ps_action a_from)
inlineprotected

Definition at line 198 of file gl2ps_action.

199  :parent(a_from)
200  ,m_mgr(a_from.m_mgr)
201  ,m_FILE(0)
202 
203  ,m_vp_mtx(a_from.m_vp_mtx)
204  ,m_pv(a_from.m_pv)
205  ,m_light_color(a_from.m_light_color)
206  ,m_light_direction(a_from.m_light_direction)
207  ,m_normal(a_from.m_normal)
208 
209  ,m_proj(a_from.m_proj)
210  ,m_model(a_from.m_model)
211  ,m_normal_matrix(a_from.m_normal_matrix)
212  ,m_color(a_from.m_color)
213  ,m_ccw(a_from.m_ccw)
214  ,m_POLYGON_OFFSET_FILL(a_from.m_POLYGON_OFFSET_FILL)
215  ,m_CULL_FACE(a_from.m_CULL_FACE)
216  ,m_POINT_SMOOTH(a_from.m_POINT_SMOOTH)
217  ,m_LINE_SMOOTH(a_from.m_LINE_SMOOTH)
218  ,m_point_size(a_from.m_point_size)
219  ,m_line_width(a_from.m_line_width)
220  ,m_light_on(a_from.m_light_on)
221  ,m_DEPTH_TEST(a_from.m_DEPTH_TEST)
222  {
223  m_back[0] = a_from.m_back[0];
224  m_back[1] = a_from.m_back[1];
225  m_back[2] = a_from.m_back[2];
226  }

Member Function Documentation

◆ begin_gsto()

virtual void tools::sg::gl2ps_action::begin_gsto ( gstoid  )
inlinevirtual

VBO /////////////////////////////////////////////////////////.

Implements tools::sg::render_action.

Definition at line 152 of file gl2ps_action.

152 {}

◆ clear_color()

virtual void tools::sg::gl2ps_action::clear_color ( float  a_r,
float  a_g,
float  a_b,
float   
)
inlinevirtual

Implements tools::sg::render_action.

Definition at line 64 of file gl2ps_action.

64  {
65  //a_a ?
66  set_background(a_r,a_g,a_b);
67  }

◆ close()

bool tools::sg::gl2ps_action::close ( )
inline

Definition at line 296 of file gl2ps_action.

296  {
297  if(!m_FILE) return false;
299  ::fclose(m_FILE);
300  m_FILE = 0;
301  return true;
302  }

◆ color4f()

virtual void tools::sg::gl2ps_action::color4f ( float  a_r,
float  a_g,
float  a_b,
float  a_a 
)
inlinevirtual

Implements tools::sg::render_action.

Definition at line 68 of file gl2ps_action.

68  {
69  m_color.set_value(a_r,a_g,a_b,a_a);
70  }

◆ draw_gsto_v()

virtual void tools::sg::gl2ps_action::draw_gsto_v ( gl::mode_t  ,
size_t  ,
bufpos   
)
inlinevirtual

Implements tools::sg::render_action.

Definition at line 153 of file gl2ps_action.

153 {}

◆ draw_gsto_vc()

virtual void tools::sg::gl2ps_action::draw_gsto_vc ( gl::mode_t  ,
size_t  ,
bufpos  ,
bufpos   
)
inlinevirtual

Implements tools::sg::render_action.

Definition at line 154 of file gl2ps_action.

154 {}

◆ draw_gsto_vcn()

virtual void tools::sg::gl2ps_action::draw_gsto_vcn ( gl::mode_t  ,
size_t  ,
bufpos  ,
bufpos  ,
bufpos   
)
inlinevirtual

Implements tools::sg::render_action.

Definition at line 156 of file gl2ps_action.

156 {}

◆ draw_gsto_vn()

virtual void tools::sg::gl2ps_action::draw_gsto_vn ( gl::mode_t  ,
size_t  ,
bufpos  ,
bufpos   
)
inlinevirtual

Implements tools::sg::render_action.

Definition at line 155 of file gl2ps_action.

155 {}

◆ draw_vertex_array()

virtual void tools::sg::gl2ps_action::draw_vertex_array ( gl::mode_t  a_mode,
size_t  a_floatn,
const float *  a_xyzs 
)
inlinevirtual

Implements tools::sg::render_action.

Definition at line 28 of file gl2ps_action.

30  {
31  m_pv.add_primitive(a_mode,a_floatn,a_xyzs);
32  }

◆ draw_vertex_array_texture()

virtual void tools::sg::gl2ps_action::draw_vertex_array_texture ( gl::mode_t  ,
size_t  a_xyzn,
const float *  a_xyzs,
gstoid  a_id,
const float *  a_tcs 
)
inlinevirtual

texture /////////////////////////////////////////////////////

Implements tools::sg::render_action.

Definition at line 133 of file gl2ps_action.

134  {
135  img_byte img;
136  if(!m_mgr.find(a_id,img)) return;
137  m_pv.add_texture(m_out,a_xyzn,a_xyzs,img,a_tcs);
138  }

◆ draw_vertex_array_xy()

virtual void tools::sg::gl2ps_action::draw_vertex_array_xy ( gl::mode_t  a_mode,
size_t  a_floatn,
const float *  a_xys 
)
inlinevirtual

Implements tools::sg::render_action.

Definition at line 34 of file gl2ps_action.

36  {
37  m_pv.add_primitive_xy(a_mode,a_floatn,a_xys);
38  }

◆ draw_vertex_color_array()

virtual void tools::sg::gl2ps_action::draw_vertex_color_array ( gl::mode_t  a_mode,
size_t  a_floatn,
const float *  a_xyzs,
const float *  a_rgbas 
)
inlinevirtual

Implements tools::sg::render_action.

Definition at line 40 of file gl2ps_action.

43  {
44  m_pv.add_primitive_rgba(a_mode,a_floatn,a_xyzs,a_rgbas);
45  }

◆ draw_vertex_color_normal_array()

virtual void tools::sg::gl2ps_action::draw_vertex_color_normal_array ( gl::mode_t  a_mode,
size_t  a_floatn,
const float *  a_xyzs,
const float *  a_rgbas,
const float *  a_nms 
)
inlinevirtual

Implements tools::sg::render_action.

Definition at line 54 of file gl2ps_action.

58  {
59  // We expect a_nms of size : 3*(a_floatn/3)
60  // (then one normal per 3D point).
61  m_pv.add_primitive_normal_rgba(a_mode,a_floatn,a_xyzs,a_nms,a_rgbas);
62  }

◆ draw_vertex_normal_array()

virtual void tools::sg::gl2ps_action::draw_vertex_normal_array ( gl::mode_t  a_mode,
size_t  a_floatn,
const float *  a_xyzs,
const float *  a_nms 
)
inlinevirtual

Implements tools::sg::render_action.

Definition at line 47 of file gl2ps_action.

50  {
51  m_pv.add_primitive_normal(a_mode,a_floatn,a_xyzs,a_nms);
52  }

◆ draw_vertex_normal_array_texture()

virtual void tools::sg::gl2ps_action::draw_vertex_normal_array_texture ( gl::mode_t  a_mode,
size_t  a_xyzn,
const float *  a_xyzs,
const float *  ,
gstoid  a_id,
const float *  a_tcs 
)
inlinevirtual

Implements tools::sg::render_action.

Definition at line 140 of file gl2ps_action.

145  {
146  draw_vertex_array_texture(a_mode,a_xyzn,a_xyzs,a_id,a_tcs);
147  }

◆ enable_light()

virtual void tools::sg::gl2ps_action::enable_light ( unsigned int  ,
float  a_dx,
float  a_dy,
float  a_dz,
float  a_r,
float  a_g,
float  a_b,
float  a_a 
)
inlinevirtual

Implements tools::sg::render_action.

Definition at line 101 of file gl2ps_action.

103  {
104  m_light_color.set_value(a_r,a_g,a_b,a_a);
105  m_light_direction.set_value(a_dx,a_dy,a_dz);
106  m_light_on = true;
107  }

◆ end_gsto()

virtual void tools::sg::gl2ps_action::end_gsto ( )
inlinevirtual

Implements tools::sg::render_action.

Definition at line 157 of file gl2ps_action.

157 {}

◆ line_width()

virtual void tools::sg::gl2ps_action::line_width ( float  a_v)
inlinevirtual

Implements tools::sg::render_action.

Definition at line 71 of file gl2ps_action.

71 {m_line_width = a_v;}

◆ load_model_matrix()

virtual void tools::sg::gl2ps_action::load_model_matrix ( const mat4f a_mtx)
inlinevirtual

Implements tools::sg::render_action.

Definition at line 94 of file gl2ps_action.

94  {
95  m_model = a_mtx;
97  }

◆ load_proj_matrix()

virtual void tools::sg::gl2ps_action::load_proj_matrix ( const mat4f a_mtx)
inlinevirtual

Implements tools::sg::render_action.

Definition at line 93 of file gl2ps_action.

93 {m_proj = a_mtx;}

◆ max_lights()

virtual unsigned int tools::sg::gl2ps_action::max_lights ( )
inlinevirtual

Implements tools::sg::render_action.

Definition at line 99 of file gl2ps_action.

99 {return 1000;}

◆ normal()

virtual void tools::sg::gl2ps_action::normal ( float  a_x,
float  a_y,
float  a_z 
)
inlinevirtual

Implements tools::sg::render_action.

Definition at line 74 of file gl2ps_action.

74  {
75  m_normal.set_value(a_x,a_y,a_z);
76  }

◆ open()

bool tools::sg::gl2ps_action::open ( const std::string &  a_name,
int  a_format = TOOLS_GL2PS_EPS 
)
inline

Definition at line 257 of file gl2ps_action.

257  {
258  if(m_FILE) return false;
259  m_FILE = ::fopen(a_name.c_str(),"w");
260  if(!m_FILE) {
261  m_out << "tools::sg::gl2ps_action::open :"
262  << " can't open file " << a_name << "."
263  << std::endl;
264  return false;
265  }
266 
267  int options = TOOLS_GL2PS_OCCLUSION_CULL
271  //int sort = TOOLS_GL2PS_NO_SORT;
272  //int sort = TOOLS_GL2PS_SIMPLE_SORT;
273  int sort = TOOLS_GL2PS_BSP_SORT;
274 
275  tools_GLint vp[4];
276  vp[0] = 0;
277  vp[1] = 0;
278  vp[2] = m_ww;
279  vp[3] = m_wh;
280 
281  int bufsize = 0;
282  ::tools_gl2psBeginPage("","tools_sg_write_gl2ps",
283  vp,a_format,sort,options,
284  TOOLS_GL_RGBA,0, NULL,0,0,0,bufsize,
285  m_FILE,a_name.c_str());
286 
287  ::tools_gl2psSetBackgroundColor(m_back[0],m_back[1],m_back[2]);
288 
289  m_vp_mtx.set_identity();
290  m_vp_mtx.mul_translate(float(m_ww)/2,float(m_wh)/2,0);
291  m_vp_mtx.mul_scale(float(m_ww)/2,float(m_wh)/2,1);
292 
293  return true;
294  }

◆ operator=()

gl2ps_action& tools::sg::gl2ps_action::operator= ( const gl2ps_action a_from)
inlineprotected

Definition at line 227 of file gl2ps_action.

227  {
228  parent::operator=(a_from);
229  if(&a_from==this) return *this;
230  close();
231  m_back[0] = a_from.m_back[0];
232  m_back[1] = a_from.m_back[1];
233  m_back[2] = a_from.m_back[2];
234 
235  m_vp_mtx = a_from.m_vp_mtx;
236  m_pv = a_from.m_pv;
237  m_light_color = a_from.m_light_color;
238  m_light_direction = a_from.m_light_direction;
239  m_normal = a_from.m_normal;
240 
241  m_proj = a_from.m_proj;
242  m_model = a_from.m_model;
243  m_normal_matrix = a_from.m_normal_matrix;
244  m_color = a_from.m_color;
245  m_ccw = a_from.m_ccw;
246  m_POLYGON_OFFSET_FILL = a_from.m_POLYGON_OFFSET_FILL;
247  m_CULL_FACE = a_from.m_CULL_FACE;
248  m_POINT_SMOOTH = a_from.m_POINT_SMOOTH;
249  m_LINE_SMOOTH = a_from.m_LINE_SMOOTH;
250  m_point_size = a_from.m_point_size;
251  m_line_width = a_from.m_line_width;
252  m_light_on = a_from.m_light_on;
253  m_DEPTH_TEST = a_from.m_DEPTH_TEST;
254  return *this;
255  }

◆ point_size()

virtual void tools::sg::gl2ps_action::point_size ( float  a_v)
inlinevirtual

Implements tools::sg::render_action.

Definition at line 72 of file gl2ps_action.

72 {m_point_size = a_v;}

◆ project_point()

bool tools::sg::gl2ps_action::project_point ( float &  a_x,
float &  a_y,
float &  a_z,
float &  a_w 
)
inlineprotected

Definition at line 318 of file gl2ps_action.

318  {
319  a_w = 1;
320  m_model.mul_4f(a_x,a_y,a_z,a_w);
321  m_proj.mul_4f(a_x,a_y,a_z,a_w);
322  if(a_w==0) return false;
323  a_x /= a_w;
324  a_y /= a_w;
325  a_z /= a_w;
326  return true;
327  }

◆ render_manager()

virtual sg::render_manager& tools::sg::gl2ps_action::render_manager ( )
inlinevirtual

Implements tools::sg::render_action.

Definition at line 161 of file gl2ps_action.

161 {return m_mgr;}

◆ restore_state()

virtual void tools::sg::gl2ps_action::restore_state ( unsigned int  )
inlinevirtual

Implements tools::sg::render_action.

Definition at line 112 of file gl2ps_action.

112  {
113  const sg::state& _state = state();
114  m_proj = _state.m_proj;
115  m_model = _state.m_model;
117 
118  m_color = _state.m_color;
119  m_ccw = (_state.m_winding==winding_ccw?true:false);
120  m_POLYGON_OFFSET_FILL = _state.m_GL_POLYGON_OFFSET_FILL;
121  m_CULL_FACE = _state.m_GL_CULL_FACE;
122  m_POINT_SMOOTH = _state.m_GL_POINT_SMOOTH;
123  m_LINE_SMOOTH = _state.m_GL_LINE_SMOOTH;
124  m_point_size = _state.m_point_size;
125  m_line_width = _state.m_line_width;
126  m_light_on = _state.m_GL_LIGHTING;
127  m_DEPTH_TEST = _state.m_GL_DEPTH_TEST;
128  }

◆ set_background()

void tools::sg::gl2ps_action::set_background ( float  a_r,
float  a_g,
float  a_b 
)
inline

Definition at line 303 of file gl2ps_action.

303  {
304  m_back[0] = a_r;
305  m_back[1] = a_g;
306  m_back[2] = a_b;
307  }

◆ set_blend()

virtual void tools::sg::gl2ps_action::set_blend ( bool  )
inlinevirtual

Implements tools::sg::render_action.

Definition at line 110 of file gl2ps_action.

110 {}

◆ set_cull_face()

virtual void tools::sg::gl2ps_action::set_cull_face ( bool  a_on)
inlinevirtual

Implements tools::sg::render_action.

Definition at line 89 of file gl2ps_action.

89 {m_CULL_FACE = a_on;}

◆ set_depth_test()

virtual void tools::sg::gl2ps_action::set_depth_test ( bool  a_on)
inlinevirtual

Implements tools::sg::render_action.

Definition at line 87 of file gl2ps_action.

87 {m_DEPTH_TEST = a_on;}

◆ set_lighting()

virtual void tools::sg::gl2ps_action::set_lighting ( bool  a_on)
inlinevirtual

Implements tools::sg::render_action.

Definition at line 109 of file gl2ps_action.

109 {m_light_on = a_on;}

◆ set_line_smooth()

virtual void tools::sg::gl2ps_action::set_line_smooth ( bool  a_on)
inlinevirtual

Implements tools::sg::render_action.

Definition at line 91 of file gl2ps_action.

91 {m_LINE_SMOOTH = a_on;}

◆ set_normal_matrix()

void tools::sg::gl2ps_action::set_normal_matrix ( )
inlineprotected

Definition at line 309 of file gl2ps_action.

309  {
310  mat4f tmp(m_model);
311  tmp.no_translate();
312  if(!tmp.invert(m_normal_matrix)) {
313  m_out << "mem_action::set_normal_matrix : can't invert model matrix." << std::endl;
314  }
315  m_normal_matrix.transpose();
316  }

◆ set_point_smooth()

virtual void tools::sg::gl2ps_action::set_point_smooth ( bool  a_on)
inlinevirtual

Implements tools::sg::render_action.

Definition at line 90 of file gl2ps_action.

90 {m_POINT_SMOOTH = a_on;}

◆ set_polygon_offset()

virtual void tools::sg::gl2ps_action::set_polygon_offset ( bool  a_v)
inlinevirtual

Implements tools::sg::render_action.

Definition at line 73 of file gl2ps_action.

73 {m_POLYGON_OFFSET_FILL = a_v;}

◆ set_shade_model()

virtual void tools::sg::gl2ps_action::set_shade_model ( shade_type  a_v)
inlinevirtual

Implements tools::sg::render_action.

Definition at line 82 of file gl2ps_action.

82  {
83  if(a_v==shade_smooth) {}
84  else {}
85  }

◆ set_vtx()

static void tools::sg::gl2ps_action::set_vtx ( tools_GL2PSvertex a_vs,
unsigned int  a_index,
float  a_x,
float  a_y,
float  a_z,
float  a_r,
float  a_g,
float  a_b,
float  a_a 
)
inlinestaticprotected

Definition at line 334 of file gl2ps_action.

336  {
337  a_vs[a_index].xyz[0] = a_x;
338  a_vs[a_index].xyz[1] = a_y;
339  a_vs[a_index].xyz[2] = a_z;
340  a_vs[a_index].rgba[0] = a_r;
341  a_vs[a_index].rgba[1] = a_g;
342  a_vs[a_index].rgba[2] = a_b;
343  a_vs[a_index].rgba[3] = a_a;
344  }

◆ set_winding()

virtual void tools::sg::gl2ps_action::set_winding ( winding_type  a_v)
inlinevirtual

Implements tools::sg::render_action.

Definition at line 78 of file gl2ps_action.

78  {
79  m_ccw = (a_v==winding_ccw?true:false);
80  }

Member Data Documentation

◆ m_back

float tools::sg::gl2ps_action::m_back[3]
protected

Definition at line 620 of file gl2ps_action.

◆ m_ccw

bool tools::sg::gl2ps_action::m_ccw
protected

Definition at line 633 of file gl2ps_action.

◆ m_color

colorf tools::sg::gl2ps_action::m_color
protected

Definition at line 632 of file gl2ps_action.

◆ m_CULL_FACE

bool tools::sg::gl2ps_action::m_CULL_FACE
protected

Definition at line 635 of file gl2ps_action.

◆ m_DEPTH_TEST

bool tools::sg::gl2ps_action::m_DEPTH_TEST
protected

Definition at line 641 of file gl2ps_action.

◆ m_FILE

FILE* tools::sg::gl2ps_action::m_FILE
protected

Definition at line 619 of file gl2ps_action.

◆ m_light_color

colorf tools::sg::gl2ps_action::m_light_color
protected

Definition at line 624 of file gl2ps_action.

◆ m_light_direction

vec3f tools::sg::gl2ps_action::m_light_direction
protected

Definition at line 625 of file gl2ps_action.

◆ m_light_on

bool tools::sg::gl2ps_action::m_light_on
protected

Definition at line 640 of file gl2ps_action.

◆ m_LINE_SMOOTH

bool tools::sg::gl2ps_action::m_LINE_SMOOTH
protected

Definition at line 637 of file gl2ps_action.

◆ m_line_width

float tools::sg::gl2ps_action::m_line_width
protected

Definition at line 639 of file gl2ps_action.

◆ m_mgr

gl2ps_manager& tools::sg::gl2ps_action::m_mgr
protected

Definition at line 618 of file gl2ps_action.

◆ m_model

mat4f tools::sg::gl2ps_action::m_model
protected

Definition at line 630 of file gl2ps_action.

◆ m_normal

vec3f tools::sg::gl2ps_action::m_normal
protected

Definition at line 626 of file gl2ps_action.

◆ m_normal_matrix

mat4f tools::sg::gl2ps_action::m_normal_matrix
protected

Definition at line 631 of file gl2ps_action.

◆ m_point_size

float tools::sg::gl2ps_action::m_point_size
protected

Definition at line 638 of file gl2ps_action.

◆ m_POINT_SMOOTH

bool tools::sg::gl2ps_action::m_POINT_SMOOTH
protected

Definition at line 636 of file gl2ps_action.

◆ m_POLYGON_OFFSET_FILL

bool tools::sg::gl2ps_action::m_POLYGON_OFFSET_FILL
protected

Definition at line 634 of file gl2ps_action.

◆ m_proj

mat4f tools::sg::gl2ps_action::m_proj
protected

Definition at line 629 of file gl2ps_action.

◆ m_pv

primvis tools::sg::gl2ps_action::m_pv
protected

Definition at line 622 of file gl2ps_action.

◆ m_vp_mtx

mat4f tools::sg::gl2ps_action::m_vp_mtx
protected

Definition at line 621 of file gl2ps_action.


The documentation for this class was generated from the following file:
tools::sg::gl2ps_manager::find
bool find(unsigned int a_id, img_byte &a_img)
Definition: gl2ps_manager:79
tools::sg::gl2ps_action::close
bool close()
Definition: gl2ps_action:296
tools::img_byte
img< unsigned char > img_byte
Definition: img:894
tools::sg::primitive_visitor::add_primitive_normal_rgba
bool add_primitive_normal_rgba(gl::mode_t a_mode, size_t a_floatn, const float *a_xyzs, const float *a_nms, const float *a_rgbas, bool a_stop=false)
Definition: primitive_visitor:1604
tools::sg::gl2ps_action::m_model
mat4f m_model
Definition: gl2ps_action:630
tools::sg::gl2ps_action::m_back
float m_back[3]
Definition: gl2ps_action:620
tools::sg::gl2ps_action::m_vp_mtx
mat4f m_vp_mtx
Definition: gl2ps_action:621
tools::sg::winding_ccw
@ winding_ccw
Definition: enums:105
tools::sg::gl2ps_action::set_normal_matrix
void set_normal_matrix()
Definition: gl2ps_action:309
tools_gl2psBeginPage
TOOLS_GL2PSDLL_API tools_GLint tools_gl2psBeginPage(const char *title, const char *producer, tools_GLint viewport[4], tools_GLint format, tools_GLint sort, tools_GLint options, tools_GLint colormode, tools_GLint colorsize, tools_GL2PSrgba *colormap, tools_GLint nr, tools_GLint ng, tools_GLint nb, tools_GLint buffersize, FILE *stream, const char *filename)
Definition: gl2ps:5927
tools::vec3::set_value
void set_value(const T &a0, const T &a1, const T &a2)
Definition: vec3:92
TOOLS_GL2PS_SILENT
#define TOOLS_GL2PS_SILENT
Definition: gl2ps_def.h:62
tools::sg::primitive_visitor::add_primitive
bool add_primitive(gl::mode_t a_mode, size_t a_floatn, const float *a_xyzs, bool a_stop=false)
Definition: primitive_visitor:1518
tools::sg::gl2ps_action::m_line_width
float m_line_width
Definition: gl2ps_action:639
tools::sg::primitive_visitor::add_primitive_normal
bool add_primitive_normal(gl::mode_t a_mode, size_t a_floatn, const float *a_xyzs, const float *a_nms, bool a_stop=false)
Definition: primitive_visitor:1576
tools::sg::gl2ps_action::m_pv
primvis m_pv
Definition: gl2ps_action:622
tools::sg::gl2ps_action::m_point_size
float m_point_size
Definition: gl2ps_action:638
tools::sg::win_action::m_wh
unsigned int m_wh
Definition: win_action:38
tools::mat4::mul_translate
void mul_translate(const T &a_x, const T &a_y, const T &a_z)
Definition: mat4:272
tools::sg::gl2ps_action::m_POINT_SMOOTH
bool m_POINT_SMOOTH
Definition: gl2ps_action:636
tools::sg::win_action::m_ww
unsigned int m_ww
Definition: win_action:37
tools::sg::primitive_visitor::add_primitive_rgba
bool add_primitive_rgba(gl::mode_t a_mode, size_t a_floatn, const float *a_xyzs, const float *a_rgbas, bool a_stop=false)
Definition: primitive_visitor:1546
tools::sg::primitive_visitor::add_texture
void add_texture(std::ostream &a_out, size_t a_xyzn, const float *a_xyzs, const img_byte &a_img, const float *a_tcs)
Definition: primitive_visitor:2047
tools::mat4f::mul_4f
void mul_4f(float &a_x, float &a_y, float &a_z, float &a_w) const
Definition: mat4f:61
tools_GL2PSvertex::rgba
tools_GL2PSrgba rgba
Definition: gl2ps_def.h:114
tools::sg::action::m_out
std::ostream & m_out
Definition: action:55
tools::sg::gl2ps_action::draw_vertex_array_texture
virtual void draw_vertex_array_texture(gl::mode_t, size_t a_xyzn, const float *a_xyzs, gstoid a_id, const float *a_tcs)
texture /////////////////////////////////////////////////////
Definition: gl2ps_action:133
TOOLS_GL2PS_BSP_SORT
#define TOOLS_GL2PS_BSP_SORT
Definition: gl2ps_def.h:45
tools_gl2psEndPage
TOOLS_GL2PSDLL_API tools_GLint tools_gl2psEndPage(void)
Definition: gl2ps:6119
tools::sg::gl2ps_action::m_DEPTH_TEST
bool m_DEPTH_TEST
Definition: gl2ps_action:641
TOOLS_GL2PS_DRAW_BACKGROUND
#define TOOLS_GL2PS_DRAW_BACKGROUND
Definition: gl2ps_def.h:60
tools::sg::gl2ps_action::m_CULL_FACE
bool m_CULL_FACE
Definition: gl2ps_action:635
tools::sg::gl2ps_action::m_color
colorf m_color
Definition: gl2ps_action:632
tools::sg::gl2ps_action::set_background
void set_background(float a_r, float a_g, float a_b)
Definition: gl2ps_action:303
tools::sg::gl2ps_action::m_light_color
colorf m_light_color
Definition: gl2ps_action:624
tools::sg::gl2ps_action::m_light_on
bool m_light_on
Definition: gl2ps_action:640
tools::mat4::mul_scale
void mul_scale(const T &a_sx, const T &a_sy, const T &a_sz)
Definition: mat4:234
tools::sg::gl2ps_action::m_light_direction
vec3f m_light_direction
Definition: gl2ps_action:625
tools::vec4::set_value
void set_value(const T &a0, const T &a1, const T &a2, const T &a3)
Definition: vec4:100
tools::sg::gl2ps_action::m_proj
mat4f m_proj
Definition: gl2ps_action:629
tools::sg::gl2ps_action::m_LINE_SMOOTH
bool m_LINE_SMOOTH
Definition: gl2ps_action:637
tools::sg::gl2ps_action::m_normal_matrix
mat4f m_normal_matrix
Definition: gl2ps_action:631
tools::sg::gl2ps_action::m_normal
vec3f m_normal
Definition: gl2ps_action:626
tools_GL2PSvertex::xyz
tools_GL2PSxyz xyz
Definition: gl2ps_def.h:113
tools::sg::states::state
const sg::state & state() const
Definition: states:76
tools::sg::shade_smooth
@ shade_smooth
Definition: enums:199
TOOLS_GL2PS_OCCLUSION_CULL
#define TOOLS_GL2PS_OCCLUSION_CULL
Definition: gl2ps_def.h:64
TOOLS_GL_RGBA
#define TOOLS_GL_RGBA
Definition: gl2ps_def.h:143
tools::sg::gl2ps_action::m_FILE
FILE * m_FILE
Definition: gl2ps_action:619
tools::sg::gl2ps_action::m_mgr
gl2ps_manager & m_mgr
Definition: gl2ps_action:618
tools::sg::gl2ps_action::m_ccw
bool m_ccw
Definition: gl2ps_action:633
tools::sg::gl2ps_action::m_POLYGON_OFFSET_FILL
bool m_POLYGON_OFFSET_FILL
Definition: gl2ps_action:634
tools::sg::primitive_visitor::add_primitive_xy
bool add_primitive_xy(gl::mode_t a_mode, size_t a_floatn, const float *a_xys, bool a_stop=false, bool a_triangle_revert=false)
Definition: primitive_visitor:1937
TOOLS_GL2PS_BEST_ROOT
#define TOOLS_GL2PS_BEST_ROOT
Definition: gl2ps_def.h:63
tools_GLint
int tools_GLint
Definition: gl2ps_def.h:7