MGCL V10
V10
MGCL V10
|
Defines OpenGL display class for MGCL objects. [詳解]
公開メンバ関数 | |
MGOpenGLView (bool perspective=true) | |
MGOpenGLView (const MGglViewAttrib &glatr) | |
Construct from MGglViewAttrib. [詳解] | |
virtual | ~MGOpenGLView () |
int | attach_drawer (mgVBO *drawer, bool common=true) |
void | detach_drawer (mgVBO *drawer, bool common=true) |
Detach the atttached mgVBO. [詳解] | |
void | copy (const MGOpenGLView &glview2) |
void | copy (const MGglViewAttrib &glatr) |
copy the attributes in glatr into this. [詳解] | |
const MGColor & | Bcolor () const |
const MGColor & | Gcolor () const |
const MGPosition & | center () const |
return the center of the box of this view. [詳解] | |
const MGConstructionPlane & | cplane () const |
MGConstructionPlane & | cplane () |
bool | DeleteDisplayList_by_function (int fc) |
delete system display list by the function code. [詳解] | |
bool | DeleteDisplayList_by_function_object_code (int fc, const MGGel *gel) |
double | diameter () const |
Obtainthe the diameter of the sphere that surround the whole model. [詳解] | |
const MGDrawParam & | draw_param () const |
MGDrawParam & | draw_param () |
int | line_density () const |
Return line density for a surface to draw in wire mode. [詳解] | |
void | execDefaultStaticAttrib () |
void | drawScene (const MGPickObjects *pobjs=0) |
void | enable_grid_snap (bool bEnabled) |
const MGPosition & | eye_position () const |
Get the eye position. [詳解] | |
void | get_model_matrix (glm::mat4 &modelMat) const |
get ModelView matrix of OpenGL. [詳解] | |
void | get_projection_matrix (const int vp[4], glm::mat4 &projMat) const |
get projection matrix, given the viewport data [詳解] | |
bool | get_surface_parameter_glv (const MGFSurface &surf, int sx, int sy, MGPosition &uv) const |
mgSysGL * | getSysGLByFunctionCode (int fc) |
void | get_viewport (glm::ivec4 &vp) const |
get viewport of OpenGL. [詳解] | |
void | get_viewport (int vp[4]) const |
void | get_window (int &width, int &height) const |
get window(m_width, m_height); [詳解] | |
HDC | getHDC () const |
Get redering context. [詳解] | |
HGLRC | getRC () const |
Get redering context. [詳解] | |
MGOpenGLView * | get_parent_OpenGLView () |
Set the parent MGOpenGLView. [詳解] | |
const MGOpenGLView * | get_parent_OpenGLView () const |
bool | has_parent_OpenGLView () const |
bool | has_display_list () const |
Test if this has a display list to draw. [詳解] | |
void | home () |
Transform to the home position. [詳解] | |
void | import_context (const MGContext &ctx) |
Import MGOpenGLView data from MGContext. [詳解] | |
void | importViewAttribFromContext (const MGContext &ctx) |
void | importDrawAttribFromContext (const MGContext &ctx) |
void | importGridAttrib (const MGContext &ctx) |
void | initializeViewingEnvironmentByBox (const MGBox &box) |
void | initialize_viewing_environment (const MGPlane &plane, double diameter, bool rotate=false) |
bool | is_enabled_grid_snap () const |
bool | is_perspective () const |
Return if this is a perspective view or not. [詳解] | |
MGPosition | locate_glv (int x, int y, MGPosition *uv=0) const |
void | make_construction_plane (const MGPosition &mid, const MGVector &uderi, const MGVector &vderi, double uspan, double vspan, int ulnum, int lnum) |
void | make_display_list (const MGContext &ctx, const MGGroup &grp) |
void | mglTranslate (const glm::vec3 &vec) |
void | mglRotate (float angle, const glm::vec3 &axis) |
void | mglScale (const glm::vec3 &factor) |
angle's unit is degree. [詳解] | |
void | pan_zoom (int x0, int y0, int x1, int y1) |
void | pan_zoom (const MGBox &box) |
MGPickObjects | pick_glv (const float center[2], float aperturex=-1., float aperturey=-1., const MGAbstractGels &objtype=mgAll_Object) |
int | pick_start_end_glv (const MGCurve &curve, int sx, int sy) |
int | pick_perimeter_glv (const MGSurface &surf, int sx, int sy, MGPosition *uv=0, float aperturex=-1., float aperturey=-1.) |
const MGEdge * | pick_edge_glv (const MGFace &f, int sx, int sy, MGPosition *uv=0, float aperturex=-1., float aperturey=-1.) |
float | pick_aperture () const |
Get the pick aperture. [詳解] | |
int | pick_to_select_buf (const float center[2], const float delta[2], mgVBO *display_list, std::set< unsigned > &selected) |
Function's return value is the number of hit objects. [詳解] | |
void | project (const MGPosition &world, MGPosition &screen, const glm::mat4 *modelMat=0, const glm::mat4 *projlMat=0, const glm::ivec4 *vp=0) const |
mgSysGL * | push_back_to_sysgl (int fc, const MGGel *oi=0) |
mgSysGL * | push_front_to_sysgl (int fc, const MGGel *oi=0) |
void | push_back_to_sysgl (mgSysGL *sysgl) |
void | rotate (float angle, float x, float y, float z) |
void | rotate (float angle, float vector[3], const MGPosition ¢er) |
void | rotate (const float angle[2]) |
void | scale (double factor, int *center=0) |
Scale the current view by the factor and the view center. [詳解] | |
void | set_center (const MGPosition &pos) |
void | set_center_current (int x, int y) |
void | set_line_density (int line_density=1) |
Set line density for a surface to draw in wire mode. [詳解] | |
void | setDrawParam (const MGContext &ctx) |
void | setProjectionMat2GLSL (bool initialize=false) |
void | setModelViewMat2GLSL () |
Set Model_View matrix of OpenGL(setUniform). [詳解] | |
void | setNdcMat2GLSL () |
Set ndc factors. [詳解] | |
void | set_output_dpi (float dpi) |
float | get_output_dpi () |
void | setDpiFactor2GLSL () |
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). [詳解] | |
void | set_parent_OpenGLView (MGOpenGLView *parent=0) |
Set the parent MGOpenGLView. [詳解] | |
void | setBcolor (const MGColor &color) |
Set background color;. [詳解] | |
void | set_fovy (double fovy) |
void | setGcolor (const MGColor &color) |
Set default object color;. [詳解] | |
void | set_pick_aperture (double pick_aperture) |
void | set_pick_aperture (float pick_aperture) |
void | set_smooth (float smooth) |
set the smooth factor of this view. [詳解] | |
void | set_window (int width, int height) |
void | setProjModelViewMat2GLSL () |
Set ProjModelView matrix to GLSL using setUniform();. [詳解] | |
float | smooth () const |
Get the smooth factor of this view. [詳解] | |
double | span_length () const |
Get the draw span length(approximate line segment length to draw curves). [詳解] | |
void | translate (double dx, double dy) |
Translate the current view by (dx, dy). [詳解] | |
void | translate_without_scale (double dx, double dy) |
Translate the current view by (dx, dy) without current scale. [詳解] | |
void | unproject (int x, int y, MGStraight &sl, MGCSisect &is) const |
void | unproject_to_sl_glv (int x, int y, MGStraight &sl) const |
const MGVector & | view_up_vector () const |
Get the view up vector. [詳解] | |
double | view_volume_far () const |
compute the view volume far. [詳解] | |
double | view_volume_height () const |
compute the view volume height. [詳解] | |
double | view_volume_near () const |
compute the view volume near. [詳解] | |
double | get_scale () |
void | get_near_position (const MGCurve *crv, const float center[2], double &t) |
mgVBO * | display_list () |
Return display list name that shows all of the objects in this view. [詳解] | |
void | set_display_list (mgVBO *dlist) |
Update display list name that shows all of the objects in this view. [詳解] | |
void | setViewMode (MGCL::VIEWMODE vmode=MGCL::WIRE) |
Set view mode. [詳解] | |
void | makeRCCurrent () const |
void | setDCRC (HDC dc, HGLRC rc) |
Set redering context. [詳解] | |
void | setupDrawEnv (const MGColor &backColor, bool selection=false) |
Set up drawing environment. [詳解] | |
void | screen_to_world (int wh[2], double sx, double sy, double &wx, double &wy) const |
const MGglViewAttrib & | viewAttrib () const |
MGglViewAttrib & | viewAttrib () |
MGCL::VIEWMODE | viewMode () const |
静的公開メンバ関数 | |
static const MGColor & | Hcolor () |
static MGOpenGLView * | getCurrentOpenGLView () |
Get the current active MGOpenGLView. [詳解] | |
static void | setHcolor (const MGColor &color) |
Set hilight color;. [詳解] | |
公開変数類 | |
mgSysGLList | m_sysgllist |
System display list manager. [詳解] | |
限定公開メンバ関数 | |
void | highlight (const MGPickObjects *pobjsP) |
void | set_perspective (bool pers, double fovy=45.) |
Set if this view is a perspective view(true), or orthnormal view(false). [詳解] | |
限定公開変数類 | |
int | m_width |
アトリビュート [詳解] | |
int | m_height |
MGOpenGLView * | m_parent_glView |
0. [詳解] | |
mgVBO * | m_display_list |
HGLRC | m_hRC |
Rendering context. [詳解] | |
HDC | m_hDC |
Device Context. [詳解] | |
MGColor | m_Bcolor |
Background color. [詳解] | |
MGColor | m_Gcolor |
Object lines color. [詳解] | |
float | m_smooth |
float | m_pick_aperture |
Pick aperture. Number of pixels to allow picking. [詳解] | |
MGglViewAttrib | m_viewAttrib |
Attributes that are saved to .mgl file. [詳解] | |
glm::mat4 | m_lookAtMat |
and view_up_vector(). [詳解] | |
glm::vec3 | m_XAxis_current |
the current unprojected straight line of the input cursor is set. [詳解] | |
glm::vec3 | m_center_current |
Current center after transformations(a point on m_unprojectSL_current). [詳解] | |
glm::vec3 | m_up_vector_current |
glm::mat4 | m_projMat |
float | m_dpi |
Projection matrix to set into uniform. [詳解] | |
Defines OpenGL display class for MGCL objects.
MGOpenGLView provides various functions to draw or render pictures of MGCL objects in MFC's CGLView windows.
MGOpenGLView::MGOpenGLView | ( | bool | perspective = true | ) |
perspective | indicates if the view is pespective or not. |
MGOpenGLView::MGOpenGLView | ( | const MGglViewAttrib & | glatr | ) |
Construct from MGglViewAttrib.
|
virtual |
int MGOpenGLView::attach_drawer | ( | mgVBO * | drawer, |
bool | common = true |
||
) |
Attach to VBO reference to Command Drawer list. Function's return value is the number of drawer's attached after attached.
drawer | The target graphic object. |
common | if true, drawer is attachd as common picture for all the sibling window. if flase, drawer is attached to this specific pictures. |
const MGColor& MGOpenGLView::Bcolor | ( | ) | const |
Get color values, Bcolor:background color, Gcolor:Object color, Hcolor:hilighted object color of this OpenGLView.
|
inline |
return the center of the box of this view.
void MGOpenGLView::copy | ( | const MGOpenGLView & | glview2 | ) |
Copy the informations of glview2 into this. Data that is not copied from glview2 are: m_sysgllist. m_hRC and m_hDC can be set using setDCRC(). m_sysgllist must be made by invoking openGL's display list generation functions.
void MGOpenGLView::copy | ( | const MGglViewAttrib & | glatr | ) |
copy the attributes in glatr into this.
|
inline |
|
inline |
|
inline |
delete system display list by the function code.
|
inline |
void MGOpenGLView::detach_drawer | ( | mgVBO * | drawer, |
bool | common = true |
||
) |
Detach the atttached mgVBO.
drawer | The target graphic object. |
common | if true, drawer is attachd as common picture for all the sibling window. if flase, drawer is attached to this specific pictures. |
|
inline |
Obtainthe the diameter of the sphere that surround the whole model.
mgVBO* MGOpenGLView::display_list | ( | ) |
Return display list name that shows all of the objects in this view.
const MGDrawParam& MGOpenGLView::draw_param | ( | ) | const |
MGDrawParam& MGOpenGLView::draw_param | ( | ) |
void MGOpenGLView::drawScene | ( | const MGPickObjects * | pobjs = 0 | ) |
Draw the scene defined in this view including the current objects as hilighted. drawScene will invoke makeRCCurrent();
void MGOpenGLView::enable_grid_snap | ( | bool | bEnabled | ) |
Enable when bEnabled=true, else disable grid snap. When bEnabled=true, cpnlane is enbaled.
void MGOpenGLView::execDefaultStaticAttrib | ( | ) |
|
inline |
Get the eye position.
const MGColor& MGOpenGLView::Gcolor | ( | ) | const |
void MGOpenGLView::get_model_matrix | ( | glm::mat4 & | modelMat | ) | const |
get ModelView matrix of OpenGL.
void MGOpenGLView::get_near_position | ( | const MGCurve * | crv, |
const float | center[2], | ||
double & | t | ||
) |
Compute the nearest point parameter value of crv to the point center. center's data is given by the screen coordinate of this current screen.
crv | Target curve. |
center | screen coordinates whose origin is (left, bottom). |
t | parameter value of the curve crv near to (sx,sy) will be returned. |
|
inline |
|
inline |
Set the parent MGOpenGLView.
|
inline |
void MGOpenGLView::get_projection_matrix | ( | const int | vp[4], |
glm::mat4 & | projMat | ||
) | const |
get projection matrix, given the viewport data
vp | viewport data ={left, bottom, widht, height} |
|
inline |
bool MGOpenGLView::get_surface_parameter_glv | ( | const MGFSurface & | surf, |
int | sx, | ||
int | sy, | ||
MGPosition & | uv | ||
) | const |
Get the surface parameter value uv(u,v) where screen coordinate (sx,sy) is projected on. If no projection points are found, the nearest point to a perimeter of surf will be returned.
surf | Target surface. |
sx | Screen coordinates x. (left, bottom) is (0,0). |
sy | y. |
uv | surface parameter (u,v) where (sx,sy) is projected on will be returned. |
void MGOpenGLView::get_viewport | ( | glm::ivec4 & | vp | ) | const |
get viewport of OpenGL.
vp | (vp[0],vp[1]) is (left,bottom) coordinates. (vp[2],vp[3]) is (width, height) of the viewport. |
void MGOpenGLView::get_viewport | ( | int | vp[4] | ) | const |
vp | (vp[0],vp[1]) is (left,bottom) coordinates. (vp[2],vp[3]) is (width, height) of the viewport. |
void MGOpenGLView::get_window | ( | int & | width, |
int & | height | ||
) | const |
get window(m_width, m_height);
|
inlinestatic |
Get the current active MGOpenGLView.
|
inline |
Get redering context.
|
inline |
Get redering context.
|
inline |
bool MGOpenGLView::has_display_list | ( | ) | const |
Test if this has a display list to draw.
|
inline |
|
inlinestatic |
|
protected |
|
inline |
Transform to the home position.
void MGOpenGLView::import_context | ( | const MGContext & | ctx | ) |
Import MGOpenGLView data from MGContext.
ctx | Target context. |
void MGOpenGLView::importDrawAttribFromContext | ( | const MGContext & | ctx | ) |
Import draw attrib data from MGContext. Draw attribs are colors(Bcolor, Gcolor, Hcolor), line approximation smoothness, pick aperture, and MGDrawParam.
ctx | Target context. |
void MGOpenGLView::importGridAttrib | ( | const MGContext & | ctx | ) |
Import construction plane's grid data from a MGContext, which are 1)(u,v) grid numbers, 2)(u,v) grid spans. Colors are not imported.
void MGOpenGLView::importViewAttribFromContext | ( | const MGContext & | ctx | ) |
Import MGContext's mgGLViewAttrib data, which are view mode, Construction Plane, and viewing transfromation data.
ctx | Target context. |
void MGOpenGLView::initialize_viewing_environment | ( | const MGPlane & | plane, |
double | diameter, | ||
bool | rotate = false |
||
) |
Initialize the viewing environment to view objects projected onto a plane. The pespectiveness is unchanged. center of the object is the origin of the plane.
plane | Target plane. |
diameter | diameter of the view. This is set to m_diameter. diameter of the sphere that sorround the model. |
rotate | if true, 90 degree rotation will be performed for the plane. (-v_deriv, u_deriv) will be (x,y), If false, (u_deriv, v_deriv) will be (x,y). |
void MGOpenGLView::initializeViewingEnvironmentByBox | ( | const MGBox & | box | ) |
bool MGOpenGLView::is_enabled_grid_snap | ( | ) | const |
|
inline |
Return if this is a perspective view or not.
|
inline |
Return line density for a surface to draw in wire mode.
MGPosition MGOpenGLView::locate_glv | ( | int | x, |
int | y, | ||
MGPosition * | uv = 0 |
||
) | const |
locate the screen coordinate (x,y) in the 3D world coordinate. (x, y)'s origin is (left, bottom) of the screen. In uv, the construction plane's parameter(u,v) coordinate will be returned.
void MGOpenGLView::make_construction_plane | ( | const MGPosition & | mid, |
const MGVector & | uderi, | ||
const MGVector & | vderi, | ||
double | uspan, | ||
double | vspan, | ||
int | ulnum, | ||
int | lnum | ||
) |
mid | center of the construction plane. |
uderi | u-axis vector of the construction plane. |
vderi | v-axis vector of the construction plane. |
uspan | span length between the lines along u-axis. |
vspan | span length between the lines along v-axis. |
ulnum | number of lines to draw along u-axis. |
lnum | number of lines to draw along v-axis. |
Make openGL display list of a standard mgl file in the input glview. A standard mgl file means that all the objects are read into a MGGroup object, and that the objects are the target to make display list. If this is not the case, make display list as follows:
void MGOpenGLView::makeRCCurrent | ( | ) | const |
Each viewport uses its own context, so we need to make sure the correct context is set whenever we make an OpenGL command.
void MGOpenGLView::mglRotate | ( | float | angle, |
const glm::vec3 & | axis | ||
) |
void MGOpenGLView::mglScale | ( | const glm::vec3 & | factor | ) |
angle's unit is degree.
void MGOpenGLView::mglTranslate | ( | const glm::vec3 & | vec | ) |
Simulate OpenGL's Translation and rotate to this ModelView. mglXXXX performs the transformation to m_modelViewMat.
void MGOpenGLView::pan_zoom | ( | int | x0, |
int | y0, | ||
int | x1, | ||
int | y1 | ||
) |
Translate and scale the current view. (x0, y0) to (x1,y1) is the rectangle of screen coordinate whose origin is (left,bottom).
void MGOpenGLView::pan_zoom | ( | const MGBox & | box | ) |
Translate and scale the current view. box is the world coordinate's box cube.
float MGOpenGLView::pick_aperture | ( | ) | const |
Get the pick aperture.
const MGEdge* MGOpenGLView::pick_edge_glv | ( | const MGFace & | f, |
int | sx, | ||
int | sy, | ||
MGPosition * | uv = 0 , |
||
float | aperturex = -1. , |
||
float | aperturey = -1. |
||
) |
Pick an edge of the face f. That is, obtain the edge number that passes input (sx,sy) when drawn in the current view matrix. Function's return value is the edge pointer picked. When no edges are picked, null will be returned.
f | Target face. |
sx | X of Screen coordinate. (left, bottom) is (0,0). |
sy | Y. |
uv | surface parameter (u,v) nearest to (sx,sy) will be returned. |
aperturex | specifies pick aperture of x and y. |
aperturey | When <=0. value is specified, default value(the value obtained by pick_aperture() will be used. |
MGPickObjects MGOpenGLView::pick_glv | ( | const float | center[2], |
float | aperturex = -1. , |
||
float | aperturey = -1. , |
||
const MGAbstractGels & | objtype = mgAll_Object |
||
) |
Pick objects in the display list generated by make_display_list. Function's return value is MGPickObject vector. All the objects which were inside the pick aperture will be output. This data can be accessed using current_object()cy or current_PickObject(). pick will invoke makeRCCurrent();
center | Screen coordinates. (left, bottom) is (0,0). |
aperturex | specifies pick aperture of x and y. |
aperturey | When <=0. value is specified, default value(the value obtained by pick_aperture() will be used. |
objtype | Target object kind. See MGGEL_KIND in "mg/types.h" or "mg/default.h" |
int MGOpenGLView::pick_perimeter_glv | ( | const MGSurface & | surf, |
int | sx, | ||
int | sy, | ||
MGPosition * | uv = 0 , |
||
float | aperturex = -1. , |
||
float | aperturey = -1. |
||
) |
Pick a perimeter of the surface surf. That is, obtain the perimeter number that passes input (sx,sy) when drawn in the current view matrix. Function's return value is perimeter number picked. When no perimeters are picked, -1 will be returned.
surf | Target surface. |
sx | X of Screen coordinate. (left, bottom) is (0,0). |
sy | Y. |
uv | surface parameter (u,v) nearest to (sx,sy) will be returned. |
aperturex | specifies pick aperture of x and y. |
aperturey | When <=0. value is specified, default value(the value obtained by pick_aperture() will be used. |
int MGOpenGLView::pick_start_end_glv | ( | const MGCurve & | curve, |
int | sx, | ||
int | sy | ||
) |
Determine if screen coordinate (sx,sy) is closer to the start point or to the end of the curve curve. Functin's return value is 0: if start point, 1: if end point.
curve | Target curve. |
sx | X of Screen coordinate. (left, bottom) is (0,0). |
sy | Y. |
int MGOpenGLView::pick_to_select_buf | ( | const float | center[2], |
const float | delta[2], | ||
mgVBO * | display_list, | ||
std::set< unsigned > & | selected | ||
) |
Function's return value is the number of hit objects.
center | Screen coordinates. (left, bottom) is (0,0). |
delta | (aperturex, aperturey). |
display_list | display list that includes pick objects. |
selected | Selected data will be returned. This data consist of the data set by setSelectName. |
void MGOpenGLView::project | ( | const MGPosition & | world, |
MGPosition & | screen, | ||
const glm::mat4 * | modelMat = 0 , |
||
const glm::mat4 * | projlMat = 0 , |
||
const glm::ivec4 * | vp = 0 |
||
) | const |
project world coordinates to OpenGL's screen coordinates. If modelMat, projMat, or vp is not input, project will ask OpenGL to get them. Generally, users of project are recommended to get modelMat, projlMat, or vp, and input them to project. Before use of project, SetContext() must be invoked.
world | Target world coordinate. |
screen | Screen coordinate will be output. |
modelMat | OpenGL's model matrix |
projlMat | OpenGL's projection matrix |
vp | OpenGL's viewport |
Push back (function_code, object id) to the end or the beginning of system display list. Function's return value is the mgSysGL pointer pushed. sysgl can be handled(can be erased after the generation) by (1)function code fc (2)object id oi(in other words, object name). If the system display list is to handle by the id(object name), oi must be meaningful. Usually oi is recommended to be the object pointer. If display list handling is not intended by the object id, set oi as null. int push_back_to_sysgl(int fc, MGGel* oi=0){return m_sysgllist.push_back(fc,oi);}; int push_front_to_sysgl(int fc, MGGel* oi=0){return m_sysgllist.push_front(fc,oi);};
|
inline |
Push back (function_code, object id) to the end or the beginning of system display list. sysgl must be a newed object, and the ownership will be transfered to this.
void MGOpenGLView::rotate | ( | float | angle, |
float | x, | ||
float | y, | ||
float | z | ||
) |
Rotate the current view by the angle along the vector(x,y,z), performs a counterclockwise rotation of angle about the vector from the m_center. The rotation matrix made is stored in m_PreCenterMat.
void MGOpenGLView::rotate | ( | float | angle, |
float | vector[3], | ||
const MGPosition & | center | ||
) |
Rotate the current view by the angle along vector around center. Performs a counterclockwise rotation. The rotation matrix made is stored in m_PreCenterMat.
void MGOpenGLView::rotate | ( | const float | angle[2] | ) |
Rotate the current view by the angle[0] around m_up_vector_current(Y-direction of the screen), and by the angle[1] around m_XAxis_current(view-up-vector*eye-vector=X-direction of the screen). Rotation is performed around m_center_current. (m_center_current,m_up_vector_current,m_XAxis_current) are et by set_center_current. The rotation matrix made is stored in m_PreCenterMat.
void MGOpenGLView::scale | ( | double | factor, |
int * | center = 0 |
||
) |
Scale the current view by the factor and the view center.
factor | saling factor. |
center | scaling center of the screen coordinate (sx, sy) on the view plane, where sx=center[0], sy=center[1] if center!=0. |
void MGOpenGLView::screen_to_world | ( | int | wh[2], |
double | sx, | ||
double | sy, | ||
double & | wx, | ||
double & | wy | ||
) | const |
Convert the screen coordinate (sx, sy) to world coordinate (wx, wy) on the view plane.
wh | width(wh[0]) and height(wh[1]) of the screen. |
sx | Input screen x. |
sy | y |
wx | World x will be output. |
wy | y will be output. |
|
inline |
void MGOpenGLView::set_center_current | ( | int | x, |
int | y | ||
) |
|
inline |
Update display list name that shows all of the objects in this view.
dlist | The target graphic object. |
|
inline |
void MGOpenGLView::set_line_density | ( | int | line_density = 1 | ) |
Set line density for a surface to draw in wire mode.
|
inline |
void MGOpenGLView::set_parent_OpenGLView | ( | MGOpenGLView * | parent = 0 | ) |
Set the parent MGOpenGLView.
|
inlineprotected |
Set if this view is a perspective view(true), or orthnormal view(false).
void MGOpenGLView::set_pick_aperture | ( | double | pick_aperture | ) |
void MGOpenGLView::set_pick_aperture | ( | float | pick_aperture | ) |
void MGOpenGLView::set_smooth | ( | float | smooth | ) |
set the smooth factor of this view.
void MGOpenGLView::set_window | ( | int | width, |
int | height | ||
) |
Set the window as(0,0)-(width,height). This invokes glViewport().
void MGOpenGLView::setBcolor | ( | const MGColor & | color | ) |
Set background color;.
void MGOpenGLView::setDCRC | ( | HDC | dc, |
HGLRC | rc | ||
) |
Set redering context.
void MGOpenGLView::setDpiFactor2GLSL | ( | ) |
void MGOpenGLView::setDrawParam | ( | const MGContext & | ctx | ) |
void MGOpenGLView::setEyePositionUpVector | ( | const MGPosition & | eyeP, |
const MGVector & | upVector | ||
) |
Set m_eyeP and m_up_vector(the eye position and view-up-vector of the OpenGL).
void MGOpenGLView::setGcolor | ( | const MGColor & | color | ) |
Set default object color;.
|
inlinestatic |
Set hilight color;.
void MGOpenGLView::setModelViewMat2GLSL | ( | ) |
Set Model_View matrix of OpenGL(setUniform).
void MGOpenGLView::setNdcMat2GLSL | ( | ) |
Set ndc factors.
void MGOpenGLView::setProjectionMat2GLSL | ( | bool | initialize = false | ) |
Set Projection matrix to GLSL. initialize==true means the projection matrix will be replaced by the projection matrix defined by the current viewport and the model data.
void MGOpenGLView::setProjModelViewMat2GLSL | ( | ) |
Set ProjModelView matrix to GLSL using setUniform();.
void MGOpenGLView::setupDrawEnv | ( | const MGColor & | backColor, |
bool | selection = false |
||
) |
Set up drawing environment.
void MGOpenGLView::setViewMode | ( | MGCL::VIEWMODE | vmode = MGCL::WIRE | ) |
Set view mode.
float MGOpenGLView::smooth | ( | ) | const |
Get the smooth factor of this view.
|
inline |
Get the draw span length(approximate line segment length to draw curves).
void MGOpenGLView::translate | ( | double | dx, |
double | dy | ||
) |
Translate the current view by (dx, dy).
void MGOpenGLView::translate_without_scale | ( | double | dx, |
double | dy | ||
) |
Translate the current view by (dx, dy) without current scale.
void MGOpenGLView::unproject | ( | int | x, |
int | y, | ||
MGStraight & | sl, | ||
MGCSisect & | is | ||
) | const |
Convert the windows screen coordinate (x,y) to MGCL's straight line. and get the intersection of the straight line and the construction plane. The origin of the screen coordinate is left, bottom. Not left, top. The direction of the sl is from the screen to the viewer.
x | X screen coordinate whose origin is (left, bottom). |
y | Y. |
sl | The straight line of (x,y) will be returnred. |
is | the intersectio of the sl and the construction plane will be returned. |
void MGOpenGLView::unproject_to_sl_glv | ( | int | x, |
int | y, | ||
MGStraight & | sl | ||
) | const |
Convert the windows screen coordinate (x,y) to MGCL's straight line. The origin of the screen coordinate is left, bottom. Not left, top. The direction of the sl is from the screen to the viewer.
|
inline |
Get the view up vector.
|
inline |
compute the view volume far.
|
inline |
compute the view volume height.
|
inline |
compute the view volume near.
|
inline |
|
inline |
|
inline |
|
protected |
Background color.
|
protected |
Current center after transformations(a point on m_unprojectSL_current).
|
protected |
Display list name of the document which is displayed on this glview. m_display_list=0 indicates no display list is generated for this glview.
|
protected |
Projection matrix to set into uniform.
|
protected |
Object lines color.
|
protected |
Device Context.
|
protected |
|
protected |
Rendering context.
|
protected |
and view_up_vector().
glm::lookAt matrix constructied from eye_position()
|
protected |
0.
If this OpenGLView has the parent, the pointer will be set. The parent means all of the display list are shared with the parent's, and on this drawScene's invocation, the parent's display list will be drawn.
|
protected |
Pick aperture. Number of pixels to allow picking.
|
protected |
|
protected |
Smoothness of the curves to draw. 1/smooth is the division number of a curve whose length is the window width. When smooth becomes small, smoothness increases.
mgSysGLList MGOpenGLView::m_sysgllist |
System display list manager.
|
protected |
|
protected |
Attributes that are saved to .mgl file.
|
protected |
アトリビュート
|
protected |
the current unprojected straight line of the input cursor is set.