5 #ifndef _mgOpenGLView_HH_
6 #define _mgOpenGLView_HH_
22 #include <glm/glm.hpp>
24 #include "mg/Pvector.h"
25 #include "mg/PickObjects.h"
26 #include "mg/Position.h"
27 #include "mg/Straight.h"
29 #include "mgGL/Color.h"
30 #include "mgGL/sysGLList.h"
31 #include "mgGL/glViewAttrib.h"
32 #include "mgGL/ConstructionPlane.h"
33 #include "mgGL/glslprogram.h"
122 double diameter()
const{
return m_viewAttrib.diameter();};
130 void execDefaultStaticAttrib();
139 void enable_grid_snap(
bool bEnabled);
145 void get_model_matrix(
150 void get_projection_matrix(
158 bool get_surface_parameter_glv(
181 void get_window(
int& width,
int& height)
const;
198 bool has_display_list()
const;
201 void home(){m_viewAttrib.setHomeMatrix();};
210 void importViewAttribFromContext(
217 void importDrawAttribFromContext(
223 void importGridAttrib(
const MGContext& ctx);
231 void initializeViewingEnvironmentByBox(
238 void initialize_viewing_environment(
247 bool is_enabled_grid_snap()
const;
257 void make_construction_plane(
281 void mglTranslate(
const glm::vec3& vec);
282 void mglRotate(
float angle,
const glm::vec3& axis);
283 void mglScale(
const glm::vec3& factor);
288 void pan_zoom(
int x0,
int y0,
int x1,
int y1);
292 void pan_zoom(
const MGBox& box);
311 int pick_start_end_glv(
321 int pick_perimeter_glv(
335 const MGEdge* pick_edge_glv(
346 float pick_aperture()
const;
349 int pick_to_select_buf(
351 const float delta[2],
353 std::set<unsigned>& selected
366 const glm::mat4* modelMat=0,
367 const glm::mat4* projlMat=0,
368 const glm::ivec4* vp=0
393 void rotate(
float angle,
float x,
float y,
float z);
406 void rotate(
const float angle[2]);
416 void set_center_current(
int x,
int y);
419 void set_line_density(
int line_density=1);
428 void setProjectionMat2GLSL(
bool initialize=
false);
431 void setModelViewMat2GLSL();
434 void setNdcMat2GLSL();
440 void setDpiFactor2GLSL();
452 void setBcolor(
const MGColor& color);
454 void set_fovy(
double fovy){m_viewAttrib.set_fovy(fovy);};
459 void setGcolor(
const MGColor& color);
464 void set_pick_aperture(
double pick_aperture);
465 void set_pick_aperture(
float pick_aperture);
468 void set_smooth(
float smooth);
472 void set_window(
int width,
int height);
475 void setProjModelViewMat2GLSL();
481 double span_length()
const{
return m_viewAttrib.diameter()*double(smooth())*.1;};
484 void translate(
double dx,
double dy);
487 void translate_without_scale(
double dx,
double dy);
504 void unproject_to_sl_glv(
int x,
int y,
MGStraight& sl)
const;
522 void get_near_position(
529 mgVBO* display_list();
534 ){m_display_list=dlist;};
541 void makeRCCurrent()
const;
544 void setDCRC(HDC dc, HGLRC rc);
547 void setupDrawEnv(
const MGColor& backColor,
bool selection=
false);
551 void screen_to_world(
566 int m_width, m_height;
587 float m_pick_aperture;
599 glm::vec3 m_center_current;
625 std::list<mgVBO*> m_command_drawersCommon;
629 std::list<mgVBO*> m_command_drawersSpecific;
632 void extractSelected(
633 const int viewport[4],
634 std::set<unsigned>& selected
639 void drawCommandDrawer(
640 std::list<mgVBO*>& drawers
MGCurve is an abstract class which represents a whole curve.
Definition: Curve.h:63
MGPlane is infinite plane in 3D space.
Definition: Plane.h:38
MGGelPosition Container Class.
Definition: GelPositions.h:23
mgSysGL * getSysGLByFunctionCode(int fc)
Definition: openglView.h:166
glm::vec3 m_up_vector_current
Definition: openglView.h:601
MGGLAttrib is an abstract class which defines the enum of undefined or disabled.
Definition: GLAttrib.h:35
const MGPosition & eye_position() const
Get the eye position.
Definition: openglView.h:142
MGOpenGLView * get_parent_OpenGLView()
Set the parent MGOpenGLView.
Definition: openglView.h:190
MGOpenGLView * m_parent_glView
0.
Definition: openglView.h:569
const MGPosition & center() const
return the center of the box of this view.
Definition: glViewAttrib.h:51
HGLRC m_hRC
Rendering context.
Definition: openglView.h:581
void setEyePositionUpVector(const MGPosition &eyeP, const MGVector &upVector)
Set m_eyeP and m_up_vector(the eye position and view-up-vector of the OpenGL).
bool DeleteDisplayList_by_function_object_code(int fc, const MGGel *gel)
Definition: openglView.h:117
glm::mat4 m_lookAtMat
and view_up_vector().
Definition: openglView.h:594
double view_volume_height() const
compute the view volume height.
Definition: openglView.h:513
bool has_parent_OpenGLView() const
Definition: openglView.h:192
void home()
Transform to the home position.
Definition: openglView.h:201
Is a container of MGAbstractGel, to specify what kind of gels are required.
Definition: AbstractGels.h:25
MGCL::VIEWMODE viewMode() const
Definition: openglView.h:562
MGConstructionPlane & cplane()
Definition: openglView.h:110
mgSysGL * push_back(int fc, const MGGel *oi)
static void setHilightColor(const MGColor &hcolor)
Definition: VBOElement.h:100
mgSysGLList m_sysgllist
System display list manager.
Definition: openglView.h:52
friend class MGOpenGLView
Definition: glViewAttrib.h:137
Is an abstract class which represents a whole geometry and a topology.
Definition: Object.h:42
mgSysGL * push_front_to_sysgl(int fc, const MGGel *oi=0)
Definition: openglView.h:382
float get_output_dpi()
Definition: openglView.h:438
const MGOpenGLView * get_parent_OpenGLView() const
Definition: openglView.h:191
Vector of a general n space dimension.
Definition: Vector.h:26
MGColor m_Bcolor
Background color.
Definition: openglView.h:584
static void setHcolor(const MGColor &color)
Set hilight color;.
Definition: openglView.h:462
MGContext defines the attributes of a document.
Definition: Context.h:33
int line_density() const
Return line density for a surface to draw in wire mode.
Definition: openglView.h:128
float m_dpi
Projection matrix to set into uniform.
Definition: openglView.h:606
HDC getHDC() const
Get redering context.
Definition: openglView.h:184
Defines a Box of any space dimendion.
Definition: Box.h:34
MGColor defines the OpenGL color (R,G,B,A).
Definition: Color.h:26
HGLRC getRC() const
Get redering context.
Definition: openglView.h:187
Defines parameters to draw MGObject, maily to approximate by lines and facets.
Definition: drawParam.h:53
MGFace is a trimmed surface.
Definition: Face.h:51
const MGglViewAttrib & viewAttrib() const
Definition: openglView.h:559
const MGVector & view_up_vector() const
Get the view up vector.
Definition: openglView.h:507
MGGel is an abstract class which represents a group element.
Definition: Gel.h:53
glm::vec3 m_XAxis_current
the current unprojected straight line of the input cursor is set.
Definition: openglView.h:598
MGEdge is an instance of MGCellNB, represents a boundary element of 2D manifold.
Definition: Edge.h:33
static const MGColor & getHilightColor()
Definition: VBOElement.h:101
void set_fovy(double fovy)
Definition: openglView.h:454
MGStraight is a curve of any space dimension, represent a straight line.
Definition: Straight.h:49
mgVBO * m_display_list
Definition: openglView.h:576
Is an abstract class which provides interfaces of MGGel that has MGAppearance.
Definition: AttribedGel.h:32
One Intersection of curve and surface.
Definition: CSisect.h:26
double diameter() const
Obtainthe the diameter of the sphere that surround the whole model.
Definition: glViewAttrib.h:65
Represent a positional data.
Definition: Position.h:28
MGSurface is an abstract class of 3D surface.
Definition: Surface.h:54
void push_back_to_sysgl(mgSysGL *sysgl)
Definition: openglView.h:387
MGglViewAttrib m_viewAttrib
Attributes that are saved to .mgl file.
Definition: openglView.h:592
MG_DLL_DECLR const MGAbstractGel mgAll_Object
void set_display_list(mgVBO *dlist)
Update display list name that shows all of the objects in this view.
Definition: openglView.h:532
glm::mat4 m_projMat
Definition: openglView.h:603
Defines OpenGL display class for MGCL objects.
Definition: openglView.h:43
VIEWMODE
Definition: MGCL.h:271
double span_length() const
Get the draw span length(approximate line segment length to draw curves).
Definition: openglView.h:481
const MGPosition & center() const
return the center of the box of this view.
Definition: openglView.h:107
Defines a list of mgSysGL.
Definition: sysGLList.h:33
MGFSurface is an abstract class to provide the comman interfaces to MGFace and MGSurface.
Definition: FSurface.h:33
HDC m_hDC
Device Context.
Definition: openglView.h:582
MGColor m_Gcolor
Object lines color.
Definition: openglView.h:585
void set_perspective(bool pers, double fovy=45.)
Set if this view is a perspective view(true), or orthnormal view(falsle).
double view_volume_far() const
compute the view volume far.
Definition: openglView.h:510
float m_smooth
Definition: openglView.h:586
double view_volume_near() const
compute the view volume near.
Definition: openglView.h:516
mgSysGL * push_back_to_sysgl(int fc, const MGGel *oi=0)
Definition: openglView.h:381
MGglViewAttrib is a class to serialize MGOpenGLView.
Definition: glViewAttrib.h:27
MGGroup is a class which constains MGGel elements.
Definition: Group.h:35
bool delete_lists_by_function_object_code(int fc, const MGGel *gel)
mgSysGL * push_front(int fc, const MGGel *oi)
a container class for MGPickObject.
Definition: PickObjects.h:29
void set_output_dpi(float dpi)
Definition: openglView.h:436
unsigned OpenGLStartDisplayName()
MGglViewAttrib & viewAttrib()
Definition: openglView.h:560
mgSysGL is a class to provide a facility to draw temporal pictures.
Definition: sysGL.h:26
mgSysGL * getSysGLByFunctionCode(int fc)
double get_scale()
Definition: openglView.h:518
bool DeleteDisplayList_by_function(int fc)
delete system display list by the function code.
Definition: openglView.h:113
static const MGColor & Hcolor()
Definition: openglView.h:98
OpenGL 4 用描画のためのクラス, in other words, display list.
Definition: VBO.h:76
MGConstructionPlane defines a construction plane ton input 3D data.
Definition: ConstructionPlane.h:33
void set_perspective(bool pers, double fovy=45.)
Set if this view is a perspective view(true), or orthnormal view(false).
Definition: openglView.h:612
static MGOpenGLView * getCurrentOpenGLView()
Get the current active MGOpenGLView.
Definition: openglView.h:195
bool is_perspective() const
Return if this is a perspective view or not.
Definition: openglView.h:250
const MGConstructionPlane & cplane() const
Definition: openglView.h:109
double diameter() const
Obtainthe the diameter of the sphere that surround the whole model.
Definition: openglView.h:122
bool delete_lists_by_function_code(int fc)
void copy(const MGOpenGLView &glview)
~MGglViewAttrib();
void set_center(const MGPosition &pos)
Definition: openglView.h:415
wire frame mode
Definition: MGCL.h:273