⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 opengl_renderer.cpp

📁 ncbi源码
💻 CPP
📖 第 1 页 / 共 5 页
字号:
    initialViewFromASN->SetMatrix().SetM10(viewMatrix[10]);    initialViewFromASN->SetMatrix().SetM11(viewMatrix[11]);    initialViewFromASN->SetMatrix().SetM12(viewMatrix[12]);    initialViewFromASN->SetMatrix().SetM13(viewMatrix[13]);    initialViewFromASN->SetMatrix().SetM14(viewMatrix[14]);    initialViewFromASN->SetMatrix().SetM15(viewMatrix[15]);    initialViewFromASN->SetRotation_center().SetX(structureSet->rotationCenter.x);    initialViewFromASN->SetRotation_center().SetY(structureSet->rotationCenter.y);    initialViewFromASN->SetRotation_center().SetZ(structureSet->rotationCenter.z);    if (annotations) {        // store copy in given annotations        string err;        CRef < CCn3d_view_settings > copy(CopyASNObject(*initialViewFromASN, &err));        if (copy.Empty()) {            ERRORMSG("OpenGLRenderer::SaveToASNViewSettings() - failed to copy settings:\n" << err);            return false;        }        annotations->SetView(*copy);    }    return true;}bool OpenGLRenderer::LoadFromASNViewSettings(const ncbi::objects::CCn3d_user_annotations& annotations){    initialViewFromASN.Reset();    if (!annotations.IsSetView()) return true;    // save a copy of the view settings    string err;    initialViewFromASN.Reset(CopyASNObject(annotations.GetView(), &err));    if (err.size() > 0 || initialViewFromASN.Empty()) {        ERRORMSG("OpenGLRenderer::LoadFromASNViewSettings() - failed to copy settings:\n" << err);        return false;    }    return true;}void OpenGLRenderer::RestoreSavedView(void){    if (initialViewFromASN.Empty() || !structureSet) {        ResetCamera();        return;    }    // restore current camera settings    cameraDistance = initialViewFromASN->GetCamera_distance();    cameraAngleRad = initialViewFromASN->GetCamera_angle_rad();    cameraLookAtX = initialViewFromASN->GetCamera_look_at_X();    cameraLookAtY = initialViewFromASN->GetCamera_look_at_Y();    cameraClipNear = initialViewFromASN->GetCamera_clip_near();    cameraClipFar = initialViewFromASN->GetCamera_clip_far();    viewMatrix[0] = initialViewFromASN->GetMatrix().GetM0();    viewMatrix[1] = initialViewFromASN->GetMatrix().GetM1();    viewMatrix[2] = initialViewFromASN->GetMatrix().GetM2();    viewMatrix[3] = initialViewFromASN->GetMatrix().GetM3();    viewMatrix[4] = initialViewFromASN->GetMatrix().GetM4();    viewMatrix[5] = initialViewFromASN->GetMatrix().GetM5();    viewMatrix[6] = initialViewFromASN->GetMatrix().GetM6();    viewMatrix[7] = initialViewFromASN->GetMatrix().GetM7();    viewMatrix[8] = initialViewFromASN->GetMatrix().GetM8();    viewMatrix[9] = initialViewFromASN->GetMatrix().GetM9();    viewMatrix[10] = initialViewFromASN->GetMatrix().GetM10();    viewMatrix[11] = initialViewFromASN->GetMatrix().GetM11();    viewMatrix[12] = initialViewFromASN->GetMatrix().GetM12();    viewMatrix[13] = initialViewFromASN->GetMatrix().GetM13();    viewMatrix[14] = initialViewFromASN->GetMatrix().GetM14();    viewMatrix[15] = initialViewFromASN->GetMatrix().GetM15();    structureSet->rotationCenter.Set(        initialViewFromASN->GetRotation_center().GetX(),        initialViewFromASN->GetRotation_center().GetY(),        initialViewFromASN->GetRotation_center().GetZ());    NewView();}void OpenGLRenderer::GetViewport(int *viewport){    glCanvas->SetCurrent();    GLint viewportGL[4];    // just in case GLint != int    glGetIntegerv(GL_VIEWPORT, viewportGL);    for (int i=0; i<4; ++i) viewport[i] = (int) viewportGL[i];}const wxFont& OpenGLRenderer::GetGLFont(void) const{    return glCanvas->GetGLFont();}bool OpenGLRenderer::SetGLFont(int firstChar, int nChars, int fontBase){    bool okay = true;#if defined(__WXMSW__)    HDC hdc = wglGetCurrentDC();    HGDIOBJ currentFont = SelectObject(hdc, reinterpret_cast<HGDIOBJ>(GetGLFont().GetHFONT()));    if (!wglUseFontBitmaps(hdc, firstChar, nChars, fontBase)) {        ERRORMSG("OpenGLRenderer::SetGLFont() - wglUseFontBitmaps() failed");        okay = false;    }    SelectObject(hdc, currentFont);#elif defined(__WXGTK__)    glXUseXFont(gdk_font_id(GetGLFont().GetInternalFont()), firstChar, nChars, fontBase);#elif defined(__WXMAC__)    wxFontRefData *fontRefData = (wxFontRefData *) GetGLFont().GetRefData();    if (RealFont(fontRefData->m_macFontNum, fontRefData->m_macFontSize)) {        if (aglUseFont(aglGetCurrentContext(),                (GLint) fontRefData->m_macFontNum,                fontRefData->m_macFontStyle, fontRefData->m_macFontSize,                firstChar, nChars, fontBase) != GL_TRUE) {            ERRORMSG("OpenGLRenderer::SetGLFont() - aglUseFont() failed");            okay = false;        }    } else {        ERRORMSG("OpenGLRenderer::SetGLFont() - RealFont() returned false");        okay = false;    }#endif    return okay;}END_SCOPE(Cn3D)/** ---------------------------------------------------------------------------* $Log: opengl_renderer.cpp,v $* Revision 1000.3  2004/06/01 18:28:52  gouriano* PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.79** Revision 1.79  2004/05/21 21:41:39  gorelenk* Added PCH ncbi_pch.hpp** Revision 1.78  2004/04/19 19:36:07  thiessen* fix frame switch bug when no structures present** Revision 1.77  2004/03/15 17:59:20  thiessen* prefer prefix vs. postfix ++/-- operators** Revision 1.76  2004/03/15 17:51:29  thiessen* prefer prefix vs. postfix ++/-- operators** Revision 1.75  2004/02/19 17:05:00  thiessen* remove cn3d/ from include paths; add pragma to disable annoying msvc warning** Revision 1.74  2003/12/04 15:58:36  thiessen* fix const problem** Revision 1.73  2003/12/04 15:49:40  thiessen* fix stereo and PNG export problems on Mac** Revision 1.72  2003/11/15 16:08:36  thiessen* add stereo** Revision 1.71  2003/10/06 22:05:52  thiessen* fix max camera angle to < PI** Revision 1.70  2003/05/22 19:08:17  thiessen* add limits to camera angle** Revision 1.69  2003/03/13 14:26:18  thiessen* add file_messaging module; split cn3d_main_wxwin into cn3d_app, cn3d_glcanvas, structure_window, cn3d_tools** Revision 1.68  2003/02/03 19:20:04  thiessen* format changes: move CVS Log to bottom of file, remove std:: from .cpp files, and use new diagnostic macros** Revision 1.67  2003/01/09 13:46:54  thiessen* highlight atom labels** Revision 1.66  2002/12/19 15:58:26  thiessen* fix quadric problem on Mac** Revision 1.65  2002/10/11 17:21:39  thiessen* initial Mac OSX build** Revision 1.64  2002/10/08 12:35:42  thiessen* use delete[] for arrays** Revision 1.63  2002/09/14 18:14:31  thiessen* fix trigonometry error** Revision 1.62  2002/09/14 17:03:07  thiessen* center initial view on aligned residues** Revision 1.61  2002/08/15 22:13:15  thiessen* update for wx2.3.2+ only; add structure pick dialog; fix MultitextDialog bug** Revision 1.60  2002/03/04 15:52:14  thiessen* hide sequence windows instead of destroying ; add perspective/orthographic projection choice** Revision 1.59  2002/02/01 13:55:54  thiessen* fix view restore bug when new file loaded** Revision 1.58  2002/01/11 15:48:58  thiessen* update for Mac CW7** Revision 1.57  2001/12/15 03:15:59  thiessen* adjustments for slightly changed object loader Set...() API** Revision 1.56  2001/12/12 14:04:14  thiessen* add missing object headers after object loader change** Revision 1.55  2001/11/30 14:02:05  thiessen* progress on sequence imports to single structures** Revision 1.54  2001/10/23 20:10:23  thiessen* fix scaling of fonts in high-res PNG output** Revision 1.53  2001/10/23 13:53:38  thiessen* add PNG export** Revision 1.52  2001/10/17 17:46:22  thiessen* save camera setup and rotation center in files** Revision 1.51  2001/09/06 18:15:44  thiessen* fix OpenGL window initialization/OnSize to work on Mac** Revision 1.50  2001/08/24 18:53:42  thiessen* add filename to sequence viewer window titles** Revision 1.49  2001/08/24 13:29:28  thiessen* header and GTK font tweaks** Revision 1.48  2001/08/24 00:41:35  thiessen* tweak conservation colors and opengl font handling** Revision 1.47  2001/08/21 01:10:45  thiessen* add labeling** Revision 1.46  2001/08/15 20:52:15  juran* On the Mac, include OpenGL headers that can actually be located.** Revision 1.45  2001/08/13 22:30:59  thiessen* add structure window mouse drag/zoom; add highlight option to render settings** Revision 1.44  2001/08/09 19:07:13  thiessen* add temperature and hydrophobicity coloring** Revision 1.43  2001/08/08 02:26:18  thiessen* fixes for gnu ; make DrawHelix more logical** Revision 1.42  2001/08/06 20:22:00  thiessen* add preferences dialog ; make sure OnCloseWindow get wxCloseEvent** Revision 1.41  2001/07/10 21:50:45  thiessen* fix ambient/specular coloring** Revision 1.40  2001/07/10 21:27:52  thiessen* add some specular reflection** Revision 1.39  2001/06/29 18:13:57  thiessen* initial (incomplete) user annotation system** Revision 1.38  2001/05/31 18:47:08  thiessen* add preliminary style dialog; remove LIST_TYPE; add thread single and delete all; misc tweaks** Revision 1.37  2001/05/25 15:18:24  thiessen* fixes for visual id settings in wxGTK** Revision 1.36  2001/05/25 01:38:16  thiessen* minor fixes for compiling on SGI** Revision 1.35  2001/05/22 19:09:31  thiessen* many minor fixes to compile/run on Solaris/GTK** Revision 1.34  2001/05/17 18:34:25  thiessen* spelling fixes; change dialogs to inherit from wxDialog** Revision 1.33  2001/05/15 23:48:37  thiessen* minor adjustments to compile under Solaris/wxGTK** Revision 1.32  2001/01/30 20:51:19  thiessen* minor fixes** Revision 1.31  2000/12/19 16:39:09  thiessen* tweaks to show/hide** Revision 1.30  2000/12/15 15:51:47  thiessen* show/hide system installed** Revision 1.29  2000/11/30 15:49:39  thiessen* add show/hide rows; unpack sec. struc. and domain features** Revision 1.28  2000/11/02 16:56:02  thiessen* working editor undo; dynamic slave transforms** Revision 1.27  2000/09/11 01:46:15  thiessen* working messenger for sequence<->structure window communication** Revision 1.26  2000/09/08 20:16:55  thiessen* working dynamic alignment views** Revision 1.25  2000/08/27 18:52:21  thiessen* extract sequence information** Revision 1.24  2000/08/25 14:22:00  thiessen* minor tweaks** Revision 1.23  2000/08/24 23:40:19  thiessen* add 'atomic ion' labels** Revision 1.22  2000/08/24 18:43:52  thiessen* tweaks for transparent sphere display** Revision 1.21  2000/08/21 17:22:38  thiessen* add primitive highlighting for testing** Revision 1.20  2000/08/19 02:59:04  thiessen* fix transparent sphere bug** Revision 1.19  2000/08/18 23:07:08  thiessen* minor efficiency tweaks** Revision 1.18  2000/08/18 18:57:39  thiessen* added transparent spheres** Revision 1.17  2000/08/17 14:24:06  thiessen* added working StyleManager** Revision 1.16  2000/08/16 14:18:46  thiessen* map 3-d objects to molecules** Revision 1.15  2000/08/13 02:43:01  thiessen* added helix and strand objects** Revision 1.14  2000/08/11 12:58:31  thiessen* added worm; get 3d-object coords from asn1** Revision 1.13  2000/08/07 14:13:15  thiessen* added animation frames** Revision 1.12  2000/08/07 00:21:17  thiessen* add display list mechanism** Revision 1.11  2000/08/04 22:49:03  thiessen* add backbone atom classification and selection feedback mechanism** Revision 1.10  2000/08/03 15:12:23  thiessen* add skeleton of style and show/hide managers** Revision 1.9  2000/07/27 13:30:51  thiessen* remove 'using namespace ...' from all headers** Revision 1.8  2000/07/18 16:50:11  thiessen* more friendly rotation center setting** Revision 1.7  2000/07/18 02:41:33  thiessen* fix bug in virtual bonds and altConfs** Revision 1.6  2000/07/18 00:06:00  thiessen* allow arbitrary rotation center** Revision 1.5  2000/07/17 22:37:18  thiessen* fix vector_math typo; correctly set initial view** Revision 1.4  2000/07/17 04:20:49  thiessen* now does correct structure alignment transformation** Revision 1.3  2000/07/16 23:19:11  thiessen* redo of drawing system** Revision 1.2  2000/07/12 23:27:49  thiessen* now draws basic CPK model** Revision 1.1  2000/07/12 14:11:30  thiessen* added initial OpenGL rendering engine**/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -