From 2166f0fad8d7bd32bed2ce4b8766e115d7be63a8 Mon Sep 17 00:00:00 2001 From: "SAN, KGV" <> Date: Fri, 3 Feb 2012 12:59:15 +0000 Subject: [PATCH] 0022819: Redesign of OpenGl driver --- src/Graphic3d/FILES | 21 - src/Graphic3d/Graphic3d_GraphicDriver.cdl | 75 +- src/Graphic3d/Graphic3d_GraphicDriver_1.cxx | 55 - src/Graphic3d/Graphic3d_GraphicDriver_2.cxx | 62 - src/Graphic3d/Graphic3d_GraphicDriver_3.cxx | 66 - src/Graphic3d/Graphic3d_GraphicDriver_4.cxx | 54 - src/Graphic3d/Graphic3d_GraphicDriver_5.cxx | 51 - src/Graphic3d/Graphic3d_GraphicDriver_6.cxx | 39 - src/Graphic3d/Graphic3d_GraphicDriver_7.cxx | 125 - src/Graphic3d/Graphic3d_GraphicDriver_703.cxx | 36 - src/Graphic3d/Graphic3d_GraphicDriver_705.cxx | 61 - src/Graphic3d/Graphic3d_GraphicDriver_707.cxx | 39 - src/Graphic3d/Graphic3d_GraphicDriver_709.cxx | 60 - src/Graphic3d/Graphic3d_GraphicDriver_710.cxx | 78 - src/Graphic3d/Graphic3d_GraphicDriver_711.cxx | 62 - src/Graphic3d/Graphic3d_GraphicDriver_712.cxx | 36 - src/Graphic3d/Graphic3d_GraphicDriver_713.cxx | 53 - src/Graphic3d/Graphic3d_GraphicDriver_8.cxx | 79 - src/Graphic3d/Graphic3d_GraphicDriver_9.cxx | 126 - .../Graphic3d_GraphicDriver_Export.cxx | 25 - .../Graphic3d_GraphicDriver_Layer.cxx | 89 - .../Graphic3d_GraphicDriver_Print.cxx | 27 - src/Graphic3d/Graphic3d_Group.cdl | 72 +- src/Graphic3d/Graphic3d_Group_12.cxx | 100 - src/Graphic3d/Graphic3d_Group_9.cxx | 211 -- src/OpenGl/FILES | 331 +- src/OpenGl/Handle_OpenGl_Context.hxx | 15 + src/OpenGl/Handle_OpenGl_Display.hxx | 19 + .../Handle_OpenGl_GraduatedTrihedron.hxx | 19 + src/OpenGl/Handle_OpenGl_GraphicDriver.hxx | 18 + src/OpenGl/Handle_OpenGl_Trihedron.hxx | 19 + src/OpenGl/Handle_OpenGl_View.hxx | 19 + src/OpenGl/Handle_OpenGl_Window.hxx | 19 + src/OpenGl/Handle_OpenGl_Workspace.hxx | 19 + src/OpenGl/OpenGl.cdl | 43 - src/OpenGl/OpenGl_ArbVBO.hxx | 45 + src/OpenGl/OpenGl_AspectFace.cxx | 217 ++ src/OpenGl/OpenGl_AspectFace.hxx | 73 + src/OpenGl/OpenGl_AspectLine.cxx | 45 + src/OpenGl/OpenGl_AspectLine.hxx | 40 + src/OpenGl/OpenGl_AspectMarker.cxx | 37 + src/OpenGl/OpenGl_AspectMarker.hxx | 39 + src/OpenGl/OpenGl_AspectText.cxx | 76 + src/OpenGl/OpenGl_AspectText.hxx | 55 + src/OpenGl/OpenGl_CMPLRS.edl | 34 +- src/OpenGl/OpenGl_CView.hxx | 21 + src/OpenGl/OpenGl_Callback.hxx | 17 + src/OpenGl/OpenGl_Context.cxx | 105 + src/OpenGl/OpenGl_Context.hxx | 61 + src/OpenGl/OpenGl_Display.cxx | 299 ++ src/OpenGl/OpenGl_Display.hxx | 158 + src/OpenGl/OpenGl_Display_1.cxx | 378 +++ src/OpenGl/OpenGl_Display_2.cxx | 1949 +++++++++++ src/OpenGl/OpenGl_Element.hxx | 23 + src/OpenGl/OpenGl_ExtFBO.hxx | 68 + src/OpenGl/OpenGl_Extension.cxx | 231 -- src/OpenGl/OpenGl_Extension.hxx | 140 - src/OpenGl/OpenGl_FrameBuffer.cxx | 124 +- src/OpenGl/OpenGl_FrameBuffer.hxx | 84 +- ...dron.cxx => OpenGl_GraduatedTrihedron.cxx} | 608 ++-- src/OpenGl/OpenGl_GraduatedTrihedron.hxx | 64 + src/OpenGl/OpenGl_GraphicDriver.cdl | 1337 -------- src/OpenGl/OpenGl_GraphicDriver.cxx | 100 +- src/OpenGl/OpenGl_GraphicDriver.hxx | 317 ++ src/OpenGl/OpenGl_GraphicDriver_1.cxx | 121 +- src/OpenGl/OpenGl_GraphicDriver_2.cxx | 137 +- src/OpenGl/OpenGl_GraphicDriver_3.cxx | 215 +- src/OpenGl/OpenGl_GraphicDriver_4.cxx | 199 +- src/OpenGl/OpenGl_GraphicDriver_5.cxx | 158 +- src/OpenGl/OpenGl_GraphicDriver_6.cxx | 72 +- src/OpenGl/OpenGl_GraphicDriver_7.cxx | 700 ++-- src/OpenGl/OpenGl_GraphicDriver_703.cxx | 556 +-- src/OpenGl/OpenGl_GraphicDriver_705.cxx | 637 +--- src/OpenGl/OpenGl_GraphicDriver_707.cxx | 162 +- src/OpenGl/OpenGl_GraphicDriver_709.cxx | 633 +--- src/OpenGl/OpenGl_GraphicDriver_710.cxx | 98 +- src/OpenGl/OpenGl_GraphicDriver_711.cxx | 636 +--- src/OpenGl/OpenGl_GraphicDriver_712.cxx | 98 - src/OpenGl/OpenGl_GraphicDriver_713.cxx | 134 +- src/OpenGl/OpenGl_GraphicDriver_8.cxx | 254 +- src/OpenGl/OpenGl_GraphicDriver_9.cxx | 309 +- src/OpenGl/OpenGl_GraphicDriver_Export.cxx | 2 +- src/OpenGl/OpenGl_GraphicDriver_Layer.cxx | 430 ++- src/OpenGl/OpenGl_GraphicDriver_print.cxx | 42 +- src/OpenGl/OpenGl_Group.cxx | 282 ++ src/OpenGl/OpenGl_Group.hxx | 59 + src/OpenGl/OpenGl_Light.hxx | 30 + src/OpenGl/OpenGl_LightBox.cxx | 605 ---- src/OpenGl/OpenGl_LightBox.hxx | 112 - src/OpenGl/OpenGl_Marker.cxx | 93 + src/OpenGl/OpenGl_Marker.hxx | 30 + src/OpenGl/OpenGl_MarkerSet.cxx | 129 + src/OpenGl/OpenGl_MarkerSet.hxx | 33 + src/OpenGl/OpenGl_Matrix.cxx | 31 + src/OpenGl/OpenGl_Matrix.hxx | 20 + src/OpenGl/OpenGl_Memory.cxx | 6 - src/OpenGl/OpenGl_Memory.hxx | 14 - src/OpenGl/OpenGl_Mesh.cxx | 925 +++++ src/OpenGl/OpenGl_Mesh.hxx | 78 + src/OpenGl/OpenGl_NamedStatus.hxx | 29 + src/OpenGl/OpenGl_Polygon.cxx | 704 ++++ src/OpenGl/OpenGl_Polygon.hxx | 62 + src/OpenGl/OpenGl_Polyline.cxx | 111 + src/OpenGl/OpenGl_Polyline.hxx | 38 + src/OpenGl/OpenGl_PrimitiveArray.cxx | 2920 ++++++++-------- src/OpenGl/OpenGl_PrimitiveArray.hxx | 86 + src/OpenGl/OpenGl_PrinterContext.cxx | 2 +- src/OpenGl/OpenGl_PrinterContext.hxx | 14 +- src/OpenGl/OpenGl_PriorityList.cxx | 57 + src/OpenGl/OpenGl_PriorityList.hxx | 44 + src/OpenGl/OpenGl_QuadrangleStrip.cxx | 773 +++++ src/OpenGl/OpenGl_QuadrangleStrip.hxx | 66 + src/OpenGl/OpenGl_Resource.hxx | 7 +- src/OpenGl/OpenGl_ResourceCleaner.cxx | 36 +- src/OpenGl/OpenGl_ResourceCleaner.hxx | 5 +- src/OpenGl/OpenGl_ResourceTexture.cxx | 26 +- src/OpenGl/OpenGl_ResourceTexture.hxx | 2 +- src/OpenGl/OpenGl_ResourceVBO.cxx | 33 +- src/OpenGl/OpenGl_ResourceVBO.hxx | 2 +- src/OpenGl/OpenGl_Structure.cxx | 448 +++ src/OpenGl/OpenGl_Structure.hxx | 82 + src/OpenGl/OpenGl_Text.cxx | 213 ++ src/OpenGl/OpenGl_Text.hxx | 41 + src/OpenGl/OpenGl_TextParam.hxx | 21 + src/OpenGl/OpenGl_TextRender.cxx | 507 --- src/OpenGl/OpenGl_TextRender.hxx | 77 - src/OpenGl/OpenGl_TextureBox.cxx | 259 +- src/OpenGl/OpenGl_TriangleStrip.cxx | 725 ++++ src/OpenGl/OpenGl_TriangleStrip.hxx | 64 + src/OpenGl/OpenGl_Trihedron.cxx | 797 +++++ src/OpenGl/OpenGl_Trihedron.hxx | 55 + src/OpenGl/OpenGl_View.cxx | 645 ++++ src/OpenGl/OpenGl_View.hxx | 214 ++ src/OpenGl/OpenGl_View_1.cxx | 244 ++ src/OpenGl/OpenGl_View_2.cxx | 1538 +++++++++ src/OpenGl/OpenGl_Window.cxx | 684 ++++ src/OpenGl/OpenGl_Window.hxx | 106 + src/OpenGl/OpenGl_Workspace.cxx | 147 + src/OpenGl/OpenGl_Workspace.hxx | 224 ++ src/OpenGl/OpenGl_Workspace_1.cxx | 55 + ..._togl_print.cxx => OpenGl_Workspace_2.cxx} | 352 +- src/OpenGl/OpenGl_Workspace_3.cxx | 490 +++ src/OpenGl/OpenGl_Workspace_4.cxx | 69 + src/OpenGl/OpenGl_Workspace_5.cxx | 628 ++++ src/OpenGl/OpenGl_addnames.cxx | 151 - src/OpenGl/OpenGl_animation.hxx | 62 - src/OpenGl/OpenGl_antialias.cxx | 134 - src/OpenGl/OpenGl_applid.cxx | 83 - src/OpenGl/OpenGl_attri.cxx | 1993 ----------- src/OpenGl/OpenGl_bintcol.cxx | 128 - src/OpenGl/OpenGl_bintrefl.cxx | 126 - src/OpenGl/OpenGl_bsurfprop.cxx | 125 - src/OpenGl/OpenGl_callback.hxx | 16 - src/OpenGl/OpenGl_charexpan.cxx | 114 - src/OpenGl/OpenGl_charspace.cxx | 113 - src/OpenGl/OpenGl_cmn_varargs.hxx | 70 - src/OpenGl/OpenGl_context.hxx | 42 - src/OpenGl/OpenGl_curve.cxx | 257 -- src/OpenGl/OpenGl_degeneration.hxx | 13 - src/OpenGl/OpenGl_degmodel.cxx | 141 - src/OpenGl/OpenGl_depthcue.cxx | 262 -- src/OpenGl/OpenGl_dind.cxx | 96 - src/OpenGl/OpenGl_dotexturemap.cxx | 130 - src/OpenGl/OpenGl_edgecol.cxx | 126 - src/OpenGl/OpenGl_edgeflag.cxx | 97 - src/OpenGl/OpenGl_edgetyp.cxx | 113 - src/OpenGl/OpenGl_edgewid.cxx | 117 - src/OpenGl/OpenGl_execstruct.cxx | 632 ---- src/OpenGl/OpenGl_facecull.cxx | 111 - src/OpenGl/OpenGl_facedmode.cxx | 99 - src/OpenGl/OpenGl_filters.cxx | 508 --- src/OpenGl/OpenGl_funcs.cxx | 1386 -------- src/OpenGl/OpenGl_graduatedtrihedron.hxx | 29 - src/OpenGl/OpenGl_highlight.cxx | 245 -- src/OpenGl/OpenGl_hlind.cxx | 95 - src/OpenGl/OpenGl_indexpolygons.cxx | 1616 --------- src/OpenGl/OpenGl_initelem.cxx | 2204 ------------ src/OpenGl/OpenGl_inquire.cxx | 48 - src/OpenGl/OpenGl_inquire.hxx | 16 - src/OpenGl/OpenGl_intcol.cxx | 131 - src/OpenGl/OpenGl_intrefl.cxx | 125 - src/OpenGl/OpenGl_intshademtd.cxx | 108 - src/OpenGl/OpenGl_intstyle.cxx | 150 - src/OpenGl/OpenGl_intstyleind.cxx | 153 - src/OpenGl/OpenGl_label.cxx | 82 - src/OpenGl/OpenGl_lightstate.cxx | 177 - src/OpenGl/OpenGl_localtran3.cxx | 139 - src/OpenGl/OpenGl_mrkr.cxx | 235 -- src/OpenGl/OpenGl_mrkrcol.cxx | 134 - src/OpenGl/OpenGl_mrkrset.cxx | 268 -- src/OpenGl/OpenGl_mrkrsize.cxx | 116 - src/OpenGl/OpenGl_mrkrtype.cxx | 127 - src/OpenGl/OpenGl_pick.cxx | 227 -- src/OpenGl/OpenGl_pickid.cxx | 86 - src/OpenGl/OpenGl_polygon.cxx | 1351 -------- src/OpenGl/OpenGl_polygonholes.cxx | 1702 ---------- src/OpenGl/OpenGl_polygonoffset.cxx | 94 - src/OpenGl/OpenGl_polyl.cxx | 364 -- src/OpenGl/OpenGl_polylcol.cxx | 129 - src/OpenGl/OpenGl_polyltyp.cxx | 121 - src/OpenGl/OpenGl_polylwid.cxx | 118 - src/OpenGl/OpenGl_qstrip.cxx | 1426 -------- src/OpenGl/OpenGl_remnames.cxx | 150 - src/OpenGl/OpenGl_subrs.cxx | 2995 ----------------- src/OpenGl/OpenGl_subrvis.cxx | 863 ----- src/OpenGl/OpenGl_surfprop.cxx | 135 - src/OpenGl/OpenGl_telem.hxx | 46 - src/OpenGl/OpenGl_telem_attri.hxx | 11 - src/OpenGl/OpenGl_telem_depthcue.hxx | 51 - src/OpenGl/OpenGl_telem_filters.hxx | 24 - src/OpenGl/OpenGl_telem_highlight.hxx | 22 - src/OpenGl/OpenGl_telem_inquire.hxx | 161 - src/OpenGl/OpenGl_telem_pick.hxx | 33 - src/OpenGl/OpenGl_telem_util.cxx | 970 +----- src/OpenGl/OpenGl_telem_util.hxx | 84 +- src/OpenGl/OpenGl_telem_view.cxx | 330 ++ src/OpenGl/OpenGl_telem_view.hxx | 65 +- src/OpenGl/OpenGl_text.cxx | 463 --- src/OpenGl/OpenGl_textalignment.cxx | 70 - src/OpenGl/OpenGl_textangle.cxx | 56 - src/OpenGl/OpenGl_textcol.cxx | 174 - src/OpenGl/OpenGl_textcolsubtitle.cxx | 171 - src/OpenGl/OpenGl_textdisplaytype.cxx | 100 - src/OpenGl/OpenGl_textfont.cxx | 88 - src/OpenGl/OpenGl_textfontaspect.cxx | 55 - src/OpenGl/OpenGl_textheight.cxx | 170 - src/OpenGl/OpenGl_textstyle.cxx | 98 - src/OpenGl/OpenGl_texture.cxx | 118 - src/OpenGl/OpenGl_textzoomable.cxx | 55 - src/OpenGl/OpenGl_tgl.hxx | 67 - src/OpenGl/OpenGl_tgl_elems.hxx | 72 - src/OpenGl/OpenGl_tgl_funcs.hxx | 1272 +------ src/OpenGl/OpenGl_tgl_pick.hxx | 20 - src/OpenGl/OpenGl_tgl_subrs.hxx | 66 - src/OpenGl/OpenGl_tgl_subrvis.hxx | 51 - src/OpenGl/OpenGl_tgl_tox.hxx | 42 - src/OpenGl/OpenGl_tgl_util.cxx | 128 - src/OpenGl/OpenGl_tgl_util.hxx | 10 - src/OpenGl/OpenGl_tgl_utilgr.cxx | 94 - src/OpenGl/OpenGl_tgl_utilgr.hxx | 28 - src/OpenGl/OpenGl_tgl_vis.hxx | 43 - src/OpenGl/OpenGl_tmesh.cxx | 1357 -------- src/OpenGl/OpenGl_togl_activateview.cxx | 16 - src/OpenGl/OpenGl_togl_antialiasing.cxx | 16 - src/OpenGl/OpenGl_togl_backfacing.cxx | 23 - src/OpenGl/OpenGl_togl_background.cxx | 20 - src/OpenGl/OpenGl_togl_begin.cxx | 132 - src/OpenGl/OpenGl_togl_begin_animation.cxx | 187 - .../OpenGl_togl_begin_immediat_mode.cxx | 1087 ------ src/OpenGl/OpenGl_togl_begin_layer_mode.cxx | 1142 ------- src/OpenGl/OpenGl_togl_bezier.cxx | 12 - src/OpenGl/OpenGl_togl_bezier_weight.cxx | 13 - src/OpenGl/OpenGl_togl_blink.cxx | 14 - src/OpenGl/OpenGl_togl_boundarybox.cxx | 131 - src/OpenGl/OpenGl_togl_cleargroup.cxx | 41 - src/OpenGl/OpenGl_togl_clearstructure.cxx | 23 - src/OpenGl/OpenGl_togl_cliplimit.cxx | 87 - src/OpenGl/OpenGl_togl_closegroup.cxx | 28 - src/OpenGl/OpenGl_togl_connect.cxx | 24 - src/OpenGl/OpenGl_togl_contextstructure.cxx | 507 --- src/OpenGl/OpenGl_togl_curve.cxx | 20 - src/OpenGl/OpenGl_togl_deactivateview.cxx | 39 - .../OpenGl_togl_degeneratestructure.cxx | 22 - src/OpenGl/OpenGl_togl_depthcueing.cxx | 38 - src/OpenGl/OpenGl_togl_depthtest.cxx | 70 - src/OpenGl/OpenGl_togl_disconnect.cxx | 24 - src/OpenGl/OpenGl_togl_displaystructure.cxx | 69 - .../OpenGl_togl_element_exploration.cxx | 78 - src/OpenGl/OpenGl_togl_end.cxx | 31 - src/OpenGl/OpenGl_togl_erasestructure.cxx | 23 - src/OpenGl/OpenGl_togl_facecontextgroup.cxx | 732 ---- .../OpenGl_togl_gradient_background.cxx | 76 - src/OpenGl/OpenGl_togl_graduatedtrihedron.cxx | 30 - src/OpenGl/OpenGl_togl_group.cxx | 45 - src/OpenGl/OpenGl_togl_highlightcolor.cxx | 44 - src/OpenGl/OpenGl_togl_init_pick.cxx | 8 - src/OpenGl/OpenGl_togl_inquirefacilities.cxx | 47 - src/OpenGl/OpenGl_togl_inquirelight.cxx | 32 - src/OpenGl/OpenGl_togl_inquireplane.cxx | 2 - src/OpenGl/OpenGl_togl_inquireview.cxx | 9 - src/OpenGl/OpenGl_togl_light.cxx | 17 - src/OpenGl/OpenGl_togl_light_exploration.cxx | 35 - src/OpenGl/OpenGl_togl_linecontextgroup.cxx | 170 - src/OpenGl/OpenGl_togl_marker.cxx | 20 - src/OpenGl/OpenGl_togl_marker_set.cxx | 20 - src/OpenGl/OpenGl_togl_markercontextgroup.cxx | 283 -- src/OpenGl/OpenGl_togl_namesetstructure.cxx | 32 - src/OpenGl/OpenGl_togl_opengroup.cxx | 57 - src/OpenGl/OpenGl_togl_parray.cxx | 92 - src/OpenGl/OpenGl_togl_pick.cxx | 50 - src/OpenGl/OpenGl_togl_pickid.cxx | 63 - src/OpenGl/OpenGl_togl_plane.cxx | 40 - src/OpenGl/OpenGl_togl_polygon.cxx | 52 - src/OpenGl/OpenGl_togl_polygon_holes.cxx | 32 - src/OpenGl/OpenGl_togl_polygon_indices.cxx | 22 - src/OpenGl/OpenGl_togl_polygon_set.cxx | 20 - src/OpenGl/OpenGl_togl_polyline.cxx | 27 - src/OpenGl/OpenGl_togl_project_raster.cxx | 74 - src/OpenGl/OpenGl_togl_quadrangle.cxx | 20 - src/OpenGl/OpenGl_togl_ratio_window.cxx | 54 - src/OpenGl/OpenGl_togl_redraw.cxx | 190 -- src/OpenGl/OpenGl_togl_removegroup.cxx | 47 - src/OpenGl/OpenGl_togl_removestructure.cxx | 14 - src/OpenGl/OpenGl_togl_removeview.cxx | 17 - src/OpenGl/OpenGl_togl_set_environment.cxx | 45 - src/OpenGl/OpenGl_togl_setlight.cxx | 71 - src/OpenGl/OpenGl_togl_setplane.cxx | 60 - src/OpenGl/OpenGl_togl_setvisualisation.cxx | 131 - src/OpenGl/OpenGl_togl_structure.cxx | 69 - .../OpenGl_togl_structure_exploration.cxx | 49 - src/OpenGl/OpenGl_togl_text.cxx | 83 - src/OpenGl/OpenGl_togl_textcontextgroup.cxx | 248 -- src/OpenGl/OpenGl_togl_texture.cxx | 121 - src/OpenGl/OpenGl_togl_transformstructure.cxx | 25 - src/OpenGl/OpenGl_togl_transparency.cxx | 17 - src/OpenGl/OpenGl_togl_triangle.cxx | 20 - src/OpenGl/OpenGl_togl_triedron.cxx | 123 - src/OpenGl/OpenGl_togl_unproject_raster.cxx | 87 - src/OpenGl/OpenGl_togl_update.cxx | 85 - src/OpenGl/OpenGl_togl_userdraw.cxx | 18 - src/OpenGl/OpenGl_togl_view.cxx | 138 - src/OpenGl/OpenGl_togl_view_exploration.cxx | 14 - src/OpenGl/OpenGl_togl_viewmapping.cxx | 126 - src/OpenGl/OpenGl_togl_vieworientation.cxx | 103 - src/OpenGl/OpenGl_tox.cxx | 166 - src/OpenGl/OpenGl_traces.hxx | 170 - src/OpenGl/OpenGl_transform_persistence.cxx | 319 -- src/OpenGl/OpenGl_transform_persistence.hxx | 6 - src/OpenGl/OpenGl_triedron.cxx | 1498 --------- src/OpenGl/OpenGl_triedron.hxx | 115 - src/OpenGl/OpenGl_trsf_stack.hxx | 10 - src/OpenGl/OpenGl_tsm.cxx | 640 ---- src/OpenGl/OpenGl_tsm.hxx | 109 - src/OpenGl/OpenGl_tsm_ws.hxx | 67 - src/OpenGl/OpenGl_txgl.cxx | 1103 ------ src/OpenGl/OpenGl_txgl.hxx | 56 - src/OpenGl/OpenGl_undefined.cxx | 333 -- src/OpenGl/OpenGl_userdraw.cxx | 33 - src/OpenGl/OpenGl_view.cxx | 1530 --------- src/OpenGl/OpenGl_vind.cxx | 135 - src/OpenGl/OpenGl_ws.cxx | 468 --- src/QADBMReflex/QADBMReflex.cdl | 24 - src/QADBMReflex/QADBMReflex.cxx | 313 -- src/QADBMReflex/QADBMReflex_OCC749Prs.cdl | 93 - src/QADBMReflex/QADBMReflex_OCC749Prs.cxx | 232 -- .../QADBMReflex_OCC749PrsUseVertex.cdl | 35 - .../QADBMReflex_OCC749PrsUseVertex.cxx | 166 - .../QADBMReflex_OCC749PrsUseVertexABV.cdl | 35 - .../QADBMReflex_OCC749PrsUseVertexABV.cxx | 167 - .../QADBMReflex_OCC749PrsUseVertexC.cdl | 35 - .../QADBMReflex_OCC749PrsUseVertexC.cxx | 184 - .../QADBMReflex_OCC749PrsUseVertexCABV.cdl | 35 - .../QADBMReflex_OCC749PrsUseVertexCABV.cxx | 186 - src/QADraw/QADraw_Additional.cxx | 2 - src/QAOCC/FILES | 2 - src/QAOCC/QAOCC.cdl | 1 - src/QAOCC/QAOCC.cxx | 47 - src/QAOCC/QAOCC_OCC749Prs.cdl | 41 - src/QAOCC/QAOCC_OCC749Prs.cxx | 83 - src/TKQADraw/PACKAGES | 1 - src/VoxelClient/VoxelClient_VisDrawer.cxx | 114 +- src/VoxelClient/VoxelClient_VisDrawer.h | 6 +- 362 files changed, 19524 insertions(+), 57638 deletions(-) delete mode 100755 src/Graphic3d/Graphic3d_GraphicDriver_1.cxx delete mode 100755 src/Graphic3d/Graphic3d_GraphicDriver_2.cxx delete mode 100755 src/Graphic3d/Graphic3d_GraphicDriver_3.cxx delete mode 100755 src/Graphic3d/Graphic3d_GraphicDriver_4.cxx delete mode 100755 src/Graphic3d/Graphic3d_GraphicDriver_5.cxx delete mode 100755 src/Graphic3d/Graphic3d_GraphicDriver_6.cxx delete mode 100755 src/Graphic3d/Graphic3d_GraphicDriver_7.cxx delete mode 100755 src/Graphic3d/Graphic3d_GraphicDriver_703.cxx delete mode 100755 src/Graphic3d/Graphic3d_GraphicDriver_705.cxx delete mode 100755 src/Graphic3d/Graphic3d_GraphicDriver_707.cxx delete mode 100755 src/Graphic3d/Graphic3d_GraphicDriver_709.cxx delete mode 100755 src/Graphic3d/Graphic3d_GraphicDriver_710.cxx delete mode 100755 src/Graphic3d/Graphic3d_GraphicDriver_711.cxx delete mode 100755 src/Graphic3d/Graphic3d_GraphicDriver_712.cxx delete mode 100755 src/Graphic3d/Graphic3d_GraphicDriver_713.cxx delete mode 100755 src/Graphic3d/Graphic3d_GraphicDriver_8.cxx delete mode 100755 src/Graphic3d/Graphic3d_GraphicDriver_9.cxx delete mode 100755 src/Graphic3d/Graphic3d_GraphicDriver_Export.cxx delete mode 100755 src/Graphic3d/Graphic3d_GraphicDriver_Layer.cxx delete mode 100755 src/Graphic3d/Graphic3d_GraphicDriver_Print.cxx delete mode 100755 src/Graphic3d/Graphic3d_Group_12.cxx create mode 100644 src/OpenGl/Handle_OpenGl_Context.hxx create mode 100644 src/OpenGl/Handle_OpenGl_Display.hxx create mode 100644 src/OpenGl/Handle_OpenGl_GraduatedTrihedron.hxx create mode 100644 src/OpenGl/Handle_OpenGl_GraphicDriver.hxx create mode 100644 src/OpenGl/Handle_OpenGl_Trihedron.hxx create mode 100644 src/OpenGl/Handle_OpenGl_View.hxx create mode 100644 src/OpenGl/Handle_OpenGl_Window.hxx create mode 100644 src/OpenGl/Handle_OpenGl_Workspace.hxx delete mode 100755 src/OpenGl/OpenGl.cdl create mode 100644 src/OpenGl/OpenGl_ArbVBO.hxx create mode 100644 src/OpenGl/OpenGl_AspectFace.cxx create mode 100644 src/OpenGl/OpenGl_AspectFace.hxx create mode 100644 src/OpenGl/OpenGl_AspectLine.cxx create mode 100644 src/OpenGl/OpenGl_AspectLine.hxx create mode 100644 src/OpenGl/OpenGl_AspectMarker.cxx create mode 100644 src/OpenGl/OpenGl_AspectMarker.hxx create mode 100644 src/OpenGl/OpenGl_AspectText.cxx create mode 100644 src/OpenGl/OpenGl_AspectText.hxx create mode 100644 src/OpenGl/OpenGl_CView.hxx create mode 100644 src/OpenGl/OpenGl_Callback.hxx create mode 100644 src/OpenGl/OpenGl_Context.cxx create mode 100644 src/OpenGl/OpenGl_Context.hxx create mode 100644 src/OpenGl/OpenGl_Display.cxx create mode 100644 src/OpenGl/OpenGl_Display.hxx create mode 100644 src/OpenGl/OpenGl_Display_1.cxx create mode 100644 src/OpenGl/OpenGl_Display_2.cxx create mode 100644 src/OpenGl/OpenGl_Element.hxx create mode 100644 src/OpenGl/OpenGl_ExtFBO.hxx delete mode 100755 src/OpenGl/OpenGl_Extension.cxx delete mode 100755 src/OpenGl/OpenGl_Extension.hxx rename src/OpenGl/{OpenGl_graduatedtrihedron.cxx => OpenGl_GraduatedTrihedron.cxx} (62%) create mode 100644 src/OpenGl/OpenGl_GraduatedTrihedron.hxx delete mode 100755 src/OpenGl/OpenGl_GraphicDriver.cdl create mode 100644 src/OpenGl/OpenGl_GraphicDriver.hxx delete mode 100755 src/OpenGl/OpenGl_GraphicDriver_712.cxx create mode 100644 src/OpenGl/OpenGl_Group.cxx create mode 100644 src/OpenGl/OpenGl_Group.hxx create mode 100644 src/OpenGl/OpenGl_Light.hxx delete mode 100755 src/OpenGl/OpenGl_LightBox.cxx delete mode 100755 src/OpenGl/OpenGl_LightBox.hxx create mode 100644 src/OpenGl/OpenGl_Marker.cxx create mode 100644 src/OpenGl/OpenGl_Marker.hxx create mode 100644 src/OpenGl/OpenGl_MarkerSet.cxx create mode 100644 src/OpenGl/OpenGl_MarkerSet.hxx create mode 100644 src/OpenGl/OpenGl_Matrix.cxx create mode 100644 src/OpenGl/OpenGl_Matrix.hxx delete mode 100755 src/OpenGl/OpenGl_Memory.cxx create mode 100644 src/OpenGl/OpenGl_Mesh.cxx create mode 100644 src/OpenGl/OpenGl_Mesh.hxx create mode 100644 src/OpenGl/OpenGl_NamedStatus.hxx create mode 100644 src/OpenGl/OpenGl_Polygon.cxx create mode 100644 src/OpenGl/OpenGl_Polygon.hxx create mode 100644 src/OpenGl/OpenGl_Polyline.cxx create mode 100644 src/OpenGl/OpenGl_Polyline.hxx create mode 100644 src/OpenGl/OpenGl_PrimitiveArray.hxx create mode 100644 src/OpenGl/OpenGl_PriorityList.cxx create mode 100644 src/OpenGl/OpenGl_PriorityList.hxx create mode 100644 src/OpenGl/OpenGl_QuadrangleStrip.cxx create mode 100644 src/OpenGl/OpenGl_QuadrangleStrip.hxx create mode 100644 src/OpenGl/OpenGl_Structure.cxx create mode 100644 src/OpenGl/OpenGl_Structure.hxx create mode 100644 src/OpenGl/OpenGl_Text.cxx create mode 100644 src/OpenGl/OpenGl_Text.hxx create mode 100644 src/OpenGl/OpenGl_TextParam.hxx delete mode 100755 src/OpenGl/OpenGl_TextRender.cxx delete mode 100755 src/OpenGl/OpenGl_TextRender.hxx create mode 100644 src/OpenGl/OpenGl_TriangleStrip.cxx create mode 100644 src/OpenGl/OpenGl_TriangleStrip.hxx create mode 100644 src/OpenGl/OpenGl_Trihedron.cxx create mode 100644 src/OpenGl/OpenGl_Trihedron.hxx create mode 100644 src/OpenGl/OpenGl_View.cxx create mode 100644 src/OpenGl/OpenGl_View.hxx create mode 100644 src/OpenGl/OpenGl_View_1.cxx create mode 100644 src/OpenGl/OpenGl_View_2.cxx create mode 100644 src/OpenGl/OpenGl_Window.cxx create mode 100644 src/OpenGl/OpenGl_Window.hxx create mode 100644 src/OpenGl/OpenGl_Workspace.cxx create mode 100644 src/OpenGl/OpenGl_Workspace.hxx create mode 100644 src/OpenGl/OpenGl_Workspace_1.cxx rename src/OpenGl/{OpenGl_togl_print.cxx => OpenGl_Workspace_2.cxx} (74%) mode change 100755 => 100644 create mode 100644 src/OpenGl/OpenGl_Workspace_3.cxx create mode 100644 src/OpenGl/OpenGl_Workspace_4.cxx create mode 100644 src/OpenGl/OpenGl_Workspace_5.cxx delete mode 100755 src/OpenGl/OpenGl_addnames.cxx delete mode 100755 src/OpenGl/OpenGl_animation.hxx delete mode 100755 src/OpenGl/OpenGl_antialias.cxx delete mode 100755 src/OpenGl/OpenGl_applid.cxx delete mode 100755 src/OpenGl/OpenGl_attri.cxx delete mode 100755 src/OpenGl/OpenGl_bintcol.cxx delete mode 100755 src/OpenGl/OpenGl_bintrefl.cxx delete mode 100755 src/OpenGl/OpenGl_bsurfprop.cxx delete mode 100755 src/OpenGl/OpenGl_callback.hxx delete mode 100755 src/OpenGl/OpenGl_charexpan.cxx delete mode 100755 src/OpenGl/OpenGl_charspace.cxx delete mode 100755 src/OpenGl/OpenGl_cmn_varargs.hxx delete mode 100755 src/OpenGl/OpenGl_context.hxx delete mode 100755 src/OpenGl/OpenGl_curve.cxx delete mode 100755 src/OpenGl/OpenGl_degeneration.hxx delete mode 100755 src/OpenGl/OpenGl_degmodel.cxx delete mode 100755 src/OpenGl/OpenGl_depthcue.cxx delete mode 100755 src/OpenGl/OpenGl_dind.cxx delete mode 100755 src/OpenGl/OpenGl_dotexturemap.cxx delete mode 100755 src/OpenGl/OpenGl_edgecol.cxx delete mode 100755 src/OpenGl/OpenGl_edgeflag.cxx delete mode 100755 src/OpenGl/OpenGl_edgetyp.cxx delete mode 100755 src/OpenGl/OpenGl_edgewid.cxx delete mode 100755 src/OpenGl/OpenGl_execstruct.cxx delete mode 100755 src/OpenGl/OpenGl_facecull.cxx delete mode 100755 src/OpenGl/OpenGl_facedmode.cxx delete mode 100755 src/OpenGl/OpenGl_filters.cxx delete mode 100755 src/OpenGl/OpenGl_funcs.cxx delete mode 100644 src/OpenGl/OpenGl_graduatedtrihedron.hxx delete mode 100755 src/OpenGl/OpenGl_highlight.cxx delete mode 100755 src/OpenGl/OpenGl_hlind.cxx delete mode 100755 src/OpenGl/OpenGl_indexpolygons.cxx delete mode 100755 src/OpenGl/OpenGl_initelem.cxx delete mode 100755 src/OpenGl/OpenGl_inquire.cxx delete mode 100755 src/OpenGl/OpenGl_inquire.hxx delete mode 100755 src/OpenGl/OpenGl_intcol.cxx delete mode 100755 src/OpenGl/OpenGl_intrefl.cxx delete mode 100755 src/OpenGl/OpenGl_intshademtd.cxx delete mode 100755 src/OpenGl/OpenGl_intstyle.cxx delete mode 100755 src/OpenGl/OpenGl_intstyleind.cxx delete mode 100755 src/OpenGl/OpenGl_label.cxx delete mode 100755 src/OpenGl/OpenGl_lightstate.cxx delete mode 100755 src/OpenGl/OpenGl_localtran3.cxx delete mode 100755 src/OpenGl/OpenGl_mrkr.cxx delete mode 100755 src/OpenGl/OpenGl_mrkrcol.cxx delete mode 100755 src/OpenGl/OpenGl_mrkrset.cxx delete mode 100755 src/OpenGl/OpenGl_mrkrsize.cxx delete mode 100755 src/OpenGl/OpenGl_mrkrtype.cxx delete mode 100755 src/OpenGl/OpenGl_pick.cxx delete mode 100755 src/OpenGl/OpenGl_pickid.cxx delete mode 100755 src/OpenGl/OpenGl_polygon.cxx delete mode 100755 src/OpenGl/OpenGl_polygonholes.cxx delete mode 100755 src/OpenGl/OpenGl_polygonoffset.cxx delete mode 100755 src/OpenGl/OpenGl_polyl.cxx delete mode 100755 src/OpenGl/OpenGl_polylcol.cxx delete mode 100755 src/OpenGl/OpenGl_polyltyp.cxx delete mode 100755 src/OpenGl/OpenGl_polylwid.cxx delete mode 100755 src/OpenGl/OpenGl_qstrip.cxx delete mode 100755 src/OpenGl/OpenGl_remnames.cxx delete mode 100755 src/OpenGl/OpenGl_subrs.cxx delete mode 100755 src/OpenGl/OpenGl_subrvis.cxx delete mode 100755 src/OpenGl/OpenGl_surfprop.cxx delete mode 100755 src/OpenGl/OpenGl_telem.hxx delete mode 100755 src/OpenGl/OpenGl_telem_attri.hxx delete mode 100755 src/OpenGl/OpenGl_telem_depthcue.hxx delete mode 100755 src/OpenGl/OpenGl_telem_filters.hxx delete mode 100755 src/OpenGl/OpenGl_telem_highlight.hxx delete mode 100755 src/OpenGl/OpenGl_telem_inquire.hxx delete mode 100755 src/OpenGl/OpenGl_telem_pick.hxx create mode 100644 src/OpenGl/OpenGl_telem_view.cxx delete mode 100755 src/OpenGl/OpenGl_text.cxx delete mode 100755 src/OpenGl/OpenGl_textalignment.cxx delete mode 100755 src/OpenGl/OpenGl_textangle.cxx delete mode 100755 src/OpenGl/OpenGl_textcol.cxx delete mode 100755 src/OpenGl/OpenGl_textcolsubtitle.cxx delete mode 100755 src/OpenGl/OpenGl_textdisplaytype.cxx delete mode 100755 src/OpenGl/OpenGl_textfont.cxx delete mode 100755 src/OpenGl/OpenGl_textfontaspect.cxx delete mode 100755 src/OpenGl/OpenGl_textheight.cxx delete mode 100755 src/OpenGl/OpenGl_textstyle.cxx delete mode 100755 src/OpenGl/OpenGl_texture.cxx delete mode 100755 src/OpenGl/OpenGl_textzoomable.cxx delete mode 100755 src/OpenGl/OpenGl_tgl.hxx delete mode 100755 src/OpenGl/OpenGl_tgl_elems.hxx delete mode 100755 src/OpenGl/OpenGl_tgl_pick.hxx delete mode 100755 src/OpenGl/OpenGl_tgl_subrs.hxx delete mode 100755 src/OpenGl/OpenGl_tgl_subrvis.hxx delete mode 100755 src/OpenGl/OpenGl_tgl_tox.hxx delete mode 100755 src/OpenGl/OpenGl_tgl_util.cxx delete mode 100755 src/OpenGl/OpenGl_tgl_util.hxx delete mode 100755 src/OpenGl/OpenGl_tgl_utilgr.cxx delete mode 100755 src/OpenGl/OpenGl_tgl_utilgr.hxx delete mode 100755 src/OpenGl/OpenGl_tgl_vis.hxx delete mode 100755 src/OpenGl/OpenGl_tmesh.cxx delete mode 100755 src/OpenGl/OpenGl_togl_activateview.cxx delete mode 100755 src/OpenGl/OpenGl_togl_antialiasing.cxx delete mode 100755 src/OpenGl/OpenGl_togl_backfacing.cxx delete mode 100755 src/OpenGl/OpenGl_togl_background.cxx delete mode 100755 src/OpenGl/OpenGl_togl_begin.cxx delete mode 100755 src/OpenGl/OpenGl_togl_begin_animation.cxx delete mode 100755 src/OpenGl/OpenGl_togl_begin_immediat_mode.cxx delete mode 100755 src/OpenGl/OpenGl_togl_begin_layer_mode.cxx delete mode 100755 src/OpenGl/OpenGl_togl_bezier.cxx delete mode 100755 src/OpenGl/OpenGl_togl_bezier_weight.cxx delete mode 100755 src/OpenGl/OpenGl_togl_blink.cxx delete mode 100755 src/OpenGl/OpenGl_togl_boundarybox.cxx delete mode 100755 src/OpenGl/OpenGl_togl_cleargroup.cxx delete mode 100755 src/OpenGl/OpenGl_togl_clearstructure.cxx delete mode 100755 src/OpenGl/OpenGl_togl_cliplimit.cxx delete mode 100755 src/OpenGl/OpenGl_togl_closegroup.cxx delete mode 100755 src/OpenGl/OpenGl_togl_connect.cxx delete mode 100755 src/OpenGl/OpenGl_togl_contextstructure.cxx delete mode 100755 src/OpenGl/OpenGl_togl_curve.cxx delete mode 100755 src/OpenGl/OpenGl_togl_deactivateview.cxx delete mode 100755 src/OpenGl/OpenGl_togl_degeneratestructure.cxx delete mode 100755 src/OpenGl/OpenGl_togl_depthcueing.cxx delete mode 100755 src/OpenGl/OpenGl_togl_depthtest.cxx delete mode 100755 src/OpenGl/OpenGl_togl_disconnect.cxx delete mode 100755 src/OpenGl/OpenGl_togl_displaystructure.cxx delete mode 100755 src/OpenGl/OpenGl_togl_element_exploration.cxx delete mode 100755 src/OpenGl/OpenGl_togl_end.cxx delete mode 100755 src/OpenGl/OpenGl_togl_erasestructure.cxx delete mode 100755 src/OpenGl/OpenGl_togl_facecontextgroup.cxx delete mode 100755 src/OpenGl/OpenGl_togl_gradient_background.cxx delete mode 100644 src/OpenGl/OpenGl_togl_graduatedtrihedron.cxx delete mode 100755 src/OpenGl/OpenGl_togl_group.cxx delete mode 100755 src/OpenGl/OpenGl_togl_highlightcolor.cxx delete mode 100755 src/OpenGl/OpenGl_togl_init_pick.cxx delete mode 100755 src/OpenGl/OpenGl_togl_inquirefacilities.cxx delete mode 100755 src/OpenGl/OpenGl_togl_inquirelight.cxx delete mode 100755 src/OpenGl/OpenGl_togl_inquireview.cxx delete mode 100755 src/OpenGl/OpenGl_togl_light.cxx delete mode 100755 src/OpenGl/OpenGl_togl_light_exploration.cxx delete mode 100755 src/OpenGl/OpenGl_togl_linecontextgroup.cxx delete mode 100755 src/OpenGl/OpenGl_togl_marker.cxx delete mode 100755 src/OpenGl/OpenGl_togl_marker_set.cxx delete mode 100755 src/OpenGl/OpenGl_togl_markercontextgroup.cxx delete mode 100755 src/OpenGl/OpenGl_togl_namesetstructure.cxx delete mode 100755 src/OpenGl/OpenGl_togl_opengroup.cxx delete mode 100755 src/OpenGl/OpenGl_togl_parray.cxx delete mode 100755 src/OpenGl/OpenGl_togl_pick.cxx delete mode 100755 src/OpenGl/OpenGl_togl_pickid.cxx delete mode 100755 src/OpenGl/OpenGl_togl_plane.cxx delete mode 100755 src/OpenGl/OpenGl_togl_polygon.cxx delete mode 100755 src/OpenGl/OpenGl_togl_polygon_holes.cxx delete mode 100755 src/OpenGl/OpenGl_togl_polygon_indices.cxx delete mode 100755 src/OpenGl/OpenGl_togl_polygon_set.cxx delete mode 100755 src/OpenGl/OpenGl_togl_polyline.cxx delete mode 100755 src/OpenGl/OpenGl_togl_project_raster.cxx delete mode 100755 src/OpenGl/OpenGl_togl_quadrangle.cxx delete mode 100755 src/OpenGl/OpenGl_togl_ratio_window.cxx delete mode 100755 src/OpenGl/OpenGl_togl_redraw.cxx delete mode 100755 src/OpenGl/OpenGl_togl_removegroup.cxx delete mode 100755 src/OpenGl/OpenGl_togl_removestructure.cxx delete mode 100755 src/OpenGl/OpenGl_togl_removeview.cxx delete mode 100755 src/OpenGl/OpenGl_togl_set_environment.cxx delete mode 100755 src/OpenGl/OpenGl_togl_setlight.cxx delete mode 100755 src/OpenGl/OpenGl_togl_setplane.cxx delete mode 100755 src/OpenGl/OpenGl_togl_setvisualisation.cxx delete mode 100755 src/OpenGl/OpenGl_togl_structure.cxx delete mode 100755 src/OpenGl/OpenGl_togl_structure_exploration.cxx delete mode 100755 src/OpenGl/OpenGl_togl_text.cxx delete mode 100755 src/OpenGl/OpenGl_togl_textcontextgroup.cxx delete mode 100755 src/OpenGl/OpenGl_togl_transformstructure.cxx delete mode 100755 src/OpenGl/OpenGl_togl_transparency.cxx delete mode 100755 src/OpenGl/OpenGl_togl_triangle.cxx delete mode 100755 src/OpenGl/OpenGl_togl_triedron.cxx delete mode 100755 src/OpenGl/OpenGl_togl_unproject_raster.cxx delete mode 100755 src/OpenGl/OpenGl_togl_update.cxx delete mode 100755 src/OpenGl/OpenGl_togl_userdraw.cxx delete mode 100755 src/OpenGl/OpenGl_togl_view.cxx delete mode 100755 src/OpenGl/OpenGl_togl_view_exploration.cxx delete mode 100755 src/OpenGl/OpenGl_togl_viewmapping.cxx delete mode 100755 src/OpenGl/OpenGl_togl_vieworientation.cxx delete mode 100755 src/OpenGl/OpenGl_tox.cxx delete mode 100755 src/OpenGl/OpenGl_traces.hxx delete mode 100755 src/OpenGl/OpenGl_transform_persistence.cxx delete mode 100755 src/OpenGl/OpenGl_triedron.cxx delete mode 100755 src/OpenGl/OpenGl_triedron.hxx delete mode 100755 src/OpenGl/OpenGl_trsf_stack.hxx delete mode 100755 src/OpenGl/OpenGl_tsm.cxx delete mode 100755 src/OpenGl/OpenGl_tsm_ws.hxx delete mode 100755 src/OpenGl/OpenGl_txgl.cxx delete mode 100755 src/OpenGl/OpenGl_txgl.hxx delete mode 100755 src/OpenGl/OpenGl_undefined.cxx delete mode 100755 src/OpenGl/OpenGl_userdraw.cxx delete mode 100755 src/OpenGl/OpenGl_view.cxx delete mode 100755 src/OpenGl/OpenGl_vind.cxx delete mode 100755 src/OpenGl/OpenGl_ws.cxx delete mode 100755 src/QADBMReflex/QADBMReflex.cdl delete mode 100755 src/QADBMReflex/QADBMReflex.cxx delete mode 100755 src/QADBMReflex/QADBMReflex_OCC749Prs.cdl delete mode 100755 src/QADBMReflex/QADBMReflex_OCC749Prs.cxx delete mode 100755 src/QADBMReflex/QADBMReflex_OCC749PrsUseVertex.cdl delete mode 100755 src/QADBMReflex/QADBMReflex_OCC749PrsUseVertex.cxx delete mode 100755 src/QADBMReflex/QADBMReflex_OCC749PrsUseVertexABV.cdl delete mode 100755 src/QADBMReflex/QADBMReflex_OCC749PrsUseVertexABV.cxx delete mode 100755 src/QADBMReflex/QADBMReflex_OCC749PrsUseVertexC.cdl delete mode 100755 src/QADBMReflex/QADBMReflex_OCC749PrsUseVertexC.cxx delete mode 100755 src/QADBMReflex/QADBMReflex_OCC749PrsUseVertexCABV.cdl delete mode 100755 src/QADBMReflex/QADBMReflex_OCC749PrsUseVertexCABV.cxx delete mode 100755 src/QAOCC/QAOCC_OCC749Prs.cdl delete mode 100755 src/QAOCC/QAOCC_OCC749Prs.cxx diff --git a/src/Graphic3d/FILES b/src/Graphic3d/FILES index 6e7f7bbcc4..184377d68c 100755 --- a/src/Graphic3d/FILES +++ b/src/Graphic3d/FILES @@ -28,24 +28,6 @@ Graphic3d_CView.cxx Graphic3d_CView.hxx Graphic3d_CGraduatedTrihedron.cxx Graphic3d_CGraduatedTrihedron.hxx -Graphic3d_GraphicDriver_1.cxx -Graphic3d_GraphicDriver_2.cxx -Graphic3d_GraphicDriver_3.cxx -Graphic3d_GraphicDriver_4.cxx -Graphic3d_GraphicDriver_5.cxx -Graphic3d_GraphicDriver_6.cxx -Graphic3d_GraphicDriver_7.cxx -Graphic3d_GraphicDriver_703.cxx -Graphic3d_GraphicDriver_705.cxx -Graphic3d_GraphicDriver_707.cxx -Graphic3d_GraphicDriver_709.cxx -Graphic3d_GraphicDriver_710.cxx -Graphic3d_GraphicDriver_711.cxx -Graphic3d_GraphicDriver_712.cxx -Graphic3d_GraphicDriver_8.cxx -Graphic3d_GraphicDriver_9.cxx -Graphic3d_GraphicDriver_Layer.cxx -Graphic3d_GraphicDriver_Print.cxx Graphic3d_Structure.pxx Graphic3d_Group.pxx Graphic3d_Group_1.cxx @@ -58,7 +40,6 @@ Graphic3d_Group_8.cxx Graphic3d_Group_9.cxx Graphic3d_Group_10.cxx Graphic3d_Group_11.cxx -Graphic3d_Group_12.cxx Graphic3d_Structure.pxx Graphic3d_DataStructure.pxx Graphic3d_StructureManager.pxx @@ -67,11 +48,9 @@ Graphic3d_CMPLRS.edl Graphic3d_WOKSteps.edl Graphic3d_PrimitiveArray.hxx Graphic3d_Group_13.cxx -Graphic3d_GraphicDriver_713.cxx Graphic3d_TransModeFlags.hxx Graphic3d_CTransPersStruct.hxx Graphic3d_CTransPersStruct.cxx -Graphic3d_GraphicDriver_Export.cxx Graphic3d_NListOfHAsciiString.hxx Graphic3d_AspectText3d.cxx Graphic3d_WNTGraphicDevice.cxx diff --git a/src/Graphic3d/Graphic3d_GraphicDriver.cdl b/src/Graphic3d/Graphic3d_GraphicDriver.cdl index b4cc4c0976..63d3eedf96 100755 --- a/src/Graphic3d/Graphic3d_GraphicDriver.cdl +++ b/src/Graphic3d/Graphic3d_GraphicDriver.cdl @@ -33,11 +33,10 @@ deferred class GraphicDriver from Graphic3d inherits GraphicDriver from Aspect ---Version: - ---Purpose: This class allows the definition of a graphic - -- driver and encapsulates the Pex driver, the - -- OpenGl driver, the Optimizer driver and the Phigs driver. + ---Purpose: This class allows the definition of a graphic driver + -- (currently only OpenGl driver is used). - ---Keywords: Pex, OpenGl, Optimizer, Phigs + ---Keywords: OpenGl ---Warning: ---References: @@ -400,7 +399,7 @@ is AColor2: Color from Quantity; FillStyle : GradientFillMethod from Aspect ) - is virtual; + is deferred; ---Purpose: call_togl_gradient_background @@ -418,7 +417,7 @@ is SetBgGradientStyle( me : mutable; ACView : CView from Graphic3d; FillStyle : GradientFillMethod from Aspect ) - is virtual; + is deferred; ClipLimit ( me : mutable; ACView : CView from Graphic3d; @@ -714,46 +713,6 @@ is is deferred; ---Purpose: call_togl_quadrangle - QuadrangleSet ( me : mutable; - ACGroup : CGroup from Graphic3d; - ListVertex : Array1OfVertex from Graphic3d; - ListEdge : Array1OfEdge from Aspect; - EvalMinMax : Boolean from Standard = Standard_True ) - is deferred; - ---Purpose: call_togl_polygon_indices - - QuadrangleSet ( me : mutable; - ACGroup : CGroup from Graphic3d; - ListVertex : Array1OfVertexN from Graphic3d; - ListEdge : Array1OfEdge from Aspect; - EvalMinMax : Boolean from Standard = Standard_True ) - is deferred; - ---Purpose: call_togl_polygon_indices - - QuadrangleSet ( me : mutable; - ACGroup : CGroup from Graphic3d; - ListVertex : Array1OfVertexNT from Graphic3d; - ListEdge : Array1OfEdge from Aspect; - EvalMinMax : Boolean from Standard = Standard_True ) - is deferred; - ---Purpose: call_togl_polygon_indices - - QuadrangleSet ( me : mutable; - ACGroup : CGroup from Graphic3d; - ListVertex : Array1OfVertexC from Graphic3d; - ListEdge : Array1OfEdge from Aspect; - EvalMinMax : Boolean from Standard = Standard_True ) - is deferred; - ---Purpose: call_togl_polygon_indices - - QuadrangleSet ( me : mutable; - ACGroup : CGroup from Graphic3d; - ListVertex : Array1OfVertexNC from Graphic3d; - ListEdge : Array1OfEdge from Aspect; - EvalMinMax : Boolean from Standard = Standard_True ) - is deferred; - ---Purpose: call_togl_polygon_indices - ---------------------------------------- -- Category: Methods to create Text -- for Purpose : see Graphic3d_Group.cdl @@ -884,7 +843,7 @@ is EnableVBO( me : mutable; status : Boolean from Standard ) - is virtual; + is deferred; ---Purpose: enables/disables usage of OpenGL vertex buffer arrays while drawing primitiev arrays ---------------------------------------- @@ -949,26 +908,6 @@ is ---Purpose: call_togl_graduatedtrihedron_minmaxvalues is deferred; - ---------------------------------------- - -- Category: Internal methods - -- for Purpose : see Graphic3d_Group.cdl - ---------------------------------------- - - Bezier ( me : mutable; - ACGroup : CGroup from Graphic3d; - ListVertex : Array1OfVertex from Graphic3d; - EvalMinMax : Boolean from Standard = Standard_True ) - is deferred; - ---Purpose: call_togl_bezier - - Bezier ( me : mutable; - ACGroup : CGroup from Graphic3d; - ListVertex : Array1OfVertex from Graphic3d; - ListWeight : Array1OfReal from TColStd; - EvalMinMax : Boolean from Standard = Standard_True ) - is deferred; - ---Purpose: call_togl_bezier_weight - --------------------------- -- Category: Animation mode --------------------------- @@ -1202,7 +1141,7 @@ is R : ShortReal from Standard; G : ShortReal from Standard; B : ShortReal from Standard ) - is virtual; + is deferred; ---Purpose: call_togl_set_text_attributes Text ( me : mutable; diff --git a/src/Graphic3d/Graphic3d_GraphicDriver_1.cxx b/src/Graphic3d/Graphic3d_GraphicDriver_1.cxx deleted file mode 100755 index 34ef747004..0000000000 --- a/src/Graphic3d/Graphic3d_GraphicDriver_1.cxx +++ /dev/null @@ -1,55 +0,0 @@ -// File Graphic3d_GraphicDriver_1.cxx -// Created Mardi 28 janvier 1997 -// Author CAL -// Modified 02.15.100 : JR : Clutter -// GG 27/12/02 IMP120302 Add new method Begin(Aspect_Display) - -//-Copyright MatraDatavision 1997 - -//-Version - -//-Design Declaration des variables specifiques aux Drivers - -//-Warning Un driver encapsule les Pex et OpenGl drivers - -//-References - -//-Language C++ 2.0 - -//-Declarations - -// for the class -#include - -#include - -//-Aliases - -//-Global data definitions - -//-Methods, in order - - -Standard_Boolean Graphic3d_GraphicDriver::Begin (const Standard_CString ) { - return Standard_True; -} - -//RIC120302 -Standard_Boolean Graphic3d_GraphicDriver::Begin (const Aspect_Display) -{ - return Standard_True; -} -//RIC120302 - -void Graphic3d_GraphicDriver::End () { -} - -void Graphic3d_GraphicDriver::BeginAnimation (const Graphic3d_CView& - ) -{ -} - -void Graphic3d_GraphicDriver::EndAnimation (const Graphic3d_CView& - ) -{ -} diff --git a/src/Graphic3d/Graphic3d_GraphicDriver_2.cxx b/src/Graphic3d/Graphic3d_GraphicDriver_2.cxx deleted file mode 100755 index 90178b7119..0000000000 --- a/src/Graphic3d/Graphic3d_GraphicDriver_2.cxx +++ /dev/null @@ -1,62 +0,0 @@ -// File Graphic3d_GraphicDriver_2.cxx -// Created Mardi 28 janvier 1997 -// Author CAL -// 15/09/97 ; PCT : ajout InquireTextureAvailable() pour les textures -// 11/97 ; CAL : retrait de la dependance avec math -// 02.15.100 : JR : Clutter - -//-Copyright MatraDatavision 1997 - -//-Version - -//-Design Declaration des variables specifiques aux Drivers - -//-Warning Un driver encapsule les Pex et OpenGl drivers - -//-References - -//-Language C++ 2.0 - -//-Declarations - -// for the class -#include - -#include - -#include - -//-Aliases - -//-Global data definitions - -//-Methods, in order - -Standard_Integer Graphic3d_GraphicDriver::InquireLightLimit () { - return Standard_False; -} - -void Graphic3d_GraphicDriver::InquireMat (const Graphic3d_CView& - , TColStd_Array2OfReal& - , TColStd_Array2OfReal& - ) -{ -} - -Standard_Integer Graphic3d_GraphicDriver::InquirePlaneLimit () -{ - return Standard_False; -} - -Standard_Integer Graphic3d_GraphicDriver::InquireViewLimit () -{ - return Standard_False; -} - - - -Standard_Boolean Graphic3d_GraphicDriver::InquireTextureAvailable () -{ - return Standard_False; -} - diff --git a/src/Graphic3d/Graphic3d_GraphicDriver_3.cxx b/src/Graphic3d/Graphic3d_GraphicDriver_3.cxx deleted file mode 100755 index 12c7eeb903..0000000000 --- a/src/Graphic3d/Graphic3d_GraphicDriver_3.cxx +++ /dev/null @@ -1,66 +0,0 @@ -// File Graphic3d_GraphicDriver_3.cxx -// Created Mardi 28 janvier 1997 -// Author CAL -// 02.15.100 : JR : Clutter - -//-Copyright MatraDatavision 1997 - -//-Version - -//-Design Declaration des variables specifiques aux Drivers - -//-Warning Un driver encapsule les Pex et OpenGl drivers - -//-References - -//-Language C++ 2.0 - -//-Declarations - -// for the class -#include - -#include - -//-Aliases - -//-Global data definitions - -//-Methods, in order - -void Graphic3d_GraphicDriver::ClearGroup (const Graphic3d_CGroup& ) { -} - -void Graphic3d_GraphicDriver::CloseGroup (const Graphic3d_CGroup& ) { -} - - -void Graphic3d_GraphicDriver::FaceContextGroup (const Graphic3d_CGroup& , const Standard_Integer NoInsert) { -} - - -void Graphic3d_GraphicDriver::Group (Graphic3d_CGroup& ) { -} - - -void Graphic3d_GraphicDriver::LineContextGroup (const Graphic3d_CGroup& , const Standard_Integer ) { -} - -void Graphic3d_GraphicDriver::MarkerContextGroup (const Graphic3d_CGroup& , const Standard_Integer ) { -} - -void Graphic3d_GraphicDriver::MarkerContextGroup (const Graphic3d_CGroup& , const Standard_Integer, const Standard_Integer, const Standard_Integer, const Handle(TColStd_HArray1OfByte)& ) { -} - - - -void Graphic3d_GraphicDriver::OpenGroup (const Graphic3d_CGroup& ) { -} - - -void Graphic3d_GraphicDriver::RemoveGroup (const Graphic3d_CGroup& ) { -} - -void Graphic3d_GraphicDriver::TextContextGroup (const Graphic3d_CGroup& , const Standard_Integer ) { - -} diff --git a/src/Graphic3d/Graphic3d_GraphicDriver_4.cxx b/src/Graphic3d/Graphic3d_GraphicDriver_4.cxx deleted file mode 100755 index af88279a09..0000000000 --- a/src/Graphic3d/Graphic3d_GraphicDriver_4.cxx +++ /dev/null @@ -1,54 +0,0 @@ -// File Graphic3d_GraphicDriver_4.cxx -// Created Mardi 28 janvier 1997 -// Author CAL -// 02.15.100 : JR : Clutter - -//-Copyright MatraDatavision 1997 - -//-Version - -//-Design Declaration des variables specifiques aux Drivers - -//-Warning Un driver encapsule les Pex et OpenGl drivers - -//-References - -//-Language C++ 2.0 - -//-Declarations - -// for the class -#include - -#include - -//-Aliases - -//-Global data definitions - -//-Methods, in order - - -void Graphic3d_GraphicDriver::ClearStructure (const Graphic3d_CStructure& ) { -} - -void Graphic3d_GraphicDriver::Connect (const Graphic3d_CStructure& , const Graphic3d_CStructure& ) { -} - -void Graphic3d_GraphicDriver::ContextStructure (const Graphic3d_CStructure& ) { -} - -void Graphic3d_GraphicDriver::Disconnect (const Graphic3d_CStructure& , const Graphic3d_CStructure& ) { -} - -void Graphic3d_GraphicDriver::DisplayStructure (const Graphic3d_CView& , const Graphic3d_CStructure& , const Standard_Integer ) { -} - -void Graphic3d_GraphicDriver::EraseStructure (const Graphic3d_CView& , const Graphic3d_CStructure& ) { -} - -void Graphic3d_GraphicDriver::RemoveStructure (const Graphic3d_CStructure& ) { -} - -void Graphic3d_GraphicDriver::Structure (Graphic3d_CStructure& ) { -} diff --git a/src/Graphic3d/Graphic3d_GraphicDriver_5.cxx b/src/Graphic3d/Graphic3d_GraphicDriver_5.cxx deleted file mode 100755 index e697a58bdf..0000000000 --- a/src/Graphic3d/Graphic3d_GraphicDriver_5.cxx +++ /dev/null @@ -1,51 +0,0 @@ -// File Graphic3d_GraphicDriver_5.cxx -// Created Mardi 28 janvier 1997 -// Author CAL -// 02.15.100 : JR : Clutter - -//-Copyright MatraDatavision 1997 - -//-Version - -//-Design Declaration des variables specifiques aux Drivers - -//-Warning Un driver encapsule les Pex et OpenGl drivers - -//-References - -//-Language C++ 2.0 - -//-Declarations - -// for the class -#include - -#include - -//-Aliases - -//-Global data definitions - -//-Methods, in order - - -void Graphic3d_GraphicDriver::DumpGroup (const Graphic3d_CGroup& ) { -} - - -void Graphic3d_GraphicDriver::DumpStructure (const Graphic3d_CStructure& ) { -} - - -void Graphic3d_GraphicDriver::DumpView (const Graphic3d_CView& ) { -} - - -Standard_Boolean Graphic3d_GraphicDriver::ElementExploration (const Graphic3d_CStructure & , const Standard_Integer , Graphic3d_VertexNC& , Graphic3d_Vector& ) { - return Standard_False; -} - - -Graphic3d_TypeOfPrimitive Graphic3d_GraphicDriver::ElementType (const Graphic3d_CStructure & , const Standard_Integer ) { - return Graphic3d_TOP_UNDEFINED; -} diff --git a/src/Graphic3d/Graphic3d_GraphicDriver_6.cxx b/src/Graphic3d/Graphic3d_GraphicDriver_6.cxx deleted file mode 100755 index af0fba10a1..0000000000 --- a/src/Graphic3d/Graphic3d_GraphicDriver_6.cxx +++ /dev/null @@ -1,39 +0,0 @@ -// File Graphic3d_GraphicDriver_6.cxx -// Created Mardi 28 janvier 1997 -// Author CAL -// 02.15.100 : JR : Clutter - -//-Copyright MatraDatavision 1997 - -//-Version - -//-Design Declaration des variables specifiques aux Drivers - -//-Warning Un driver encapsule les Pex et OpenGl drivers - -//-References - -//-Language C++ 2.0 - -//-Declarations - -// for the class -#include - -#include - -//-Aliases - -//-Global data definitions - -//-Methods, in order - -void Graphic3d_GraphicDriver::InitPick () { -} - - -void Graphic3d_GraphicDriver::Pick (Graphic3d_CPick& ) { -} - -void Graphic3d_GraphicDriver::PickId (const Graphic3d_CGroup& ) { -} diff --git a/src/Graphic3d/Graphic3d_GraphicDriver_7.cxx b/src/Graphic3d/Graphic3d_GraphicDriver_7.cxx deleted file mode 100755 index 9d8d1f1471..0000000000 --- a/src/Graphic3d/Graphic3d_GraphicDriver_7.cxx +++ /dev/null @@ -1,125 +0,0 @@ -// File Graphic3d_GraphicDriver_7.cxx -// Created Mardi 28 janvier 1997 -// Author CAL -// Modified GG 10/11/99 PRO19603 Change the Redraw method (add redraw area capabillity) -// EUG 07/10/99 G003 Add DegenerateStructure() and -// SetBackFacingModel() methods. -// 02.15.100 : JR : Clutter - -//-Copyright MatraDatavision 1997 - -//-Version - -//-Design Declaration des variables specifiques aux Drivers - -//-Warning Un driver encapsule les Pex et OpenGl drivers - -//-References - -//-Language C++ 2.0 - -//-Declarations - -// for the class -#include - -#include - -//-Aliases - -//-Global data definitions - -//-Methods, in order - -void Graphic3d_GraphicDriver::ActivateView (const Graphic3d_CView& ) { -} - -void Graphic3d_GraphicDriver::AntiAliasing (const Graphic3d_CView& , const Standard_Boolean ) { -} - -void Graphic3d_GraphicDriver::Background (const Graphic3d_CView& ) { -} - -void Graphic3d_GraphicDriver::GradientBackground( const Graphic3d_CView& ACView, - const Quantity_Color& AColor1, const Quantity_Color& AColor2, - const Aspect_GradientFillMethod AType ){ -} - -void Graphic3d_GraphicDriver::Blink (const Graphic3d_CStructure& , const Standard_Boolean ) { -} - -void Graphic3d_GraphicDriver::BoundaryBox (const Graphic3d_CStructure& , const Standard_Boolean ) { -} - -void Graphic3d_GraphicDriver::HighlightColor (const Graphic3d_CStructure& , const Standard_ShortReal , const Standard_ShortReal , const Standard_ShortReal , const Standard_Boolean ) { -} - -void Graphic3d_GraphicDriver::NameSetStructure (const Graphic3d_CStructure& ) { -} - -void Graphic3d_GraphicDriver::ClipLimit (const Graphic3d_CView& , const Standard_Boolean ) { -} - -void Graphic3d_GraphicDriver::DeactivateView (const Graphic3d_CView& ) { -} - -void Graphic3d_GraphicDriver::DepthCueing (const Graphic3d_CView& , const Standard_Boolean ) { -} - -Standard_Boolean Graphic3d_GraphicDriver::ProjectRaster (const Graphic3d_CView& , const Standard_ShortReal , const Standard_ShortReal , const Standard_ShortReal , Standard_Integer& , Standard_Integer& ) { - return Standard_False; -} - -Standard_Boolean Graphic3d_GraphicDriver::UnProjectRaster (const Graphic3d_CView& , const Standard_Integer , const Standard_Integer , const Standard_Integer , const Standard_Integer , const Standard_Integer , const Standard_Integer , Standard_ShortReal& , Standard_ShortReal& , Standard_ShortReal& ) { - return Standard_False; -} - -Standard_Boolean Graphic3d_GraphicDriver::UnProjectRasterWithRay (const Graphic3d_CView& , const Standard_Integer , const Standard_Integer , const Standard_Integer , const Standard_Integer , const Standard_Integer , const Standard_Integer , Standard_ShortReal& , Standard_ShortReal& , Standard_ShortReal& , Standard_ShortReal& , Standard_ShortReal& , Standard_ShortReal& ) { - return Standard_False; -} - -void Graphic3d_GraphicDriver::RatioWindow (const Graphic3d_CView& ) { -} - -void Graphic3d_GraphicDriver::Redraw (const Graphic3d_CView& , const Aspect_CLayer2d& , const Aspect_CLayer2d& , const Standard_Integer , const Standard_Integer , const Standard_Integer , const Standard_Integer ) { -} - -void Graphic3d_GraphicDriver::RemoveView (const Graphic3d_CView& ) { -} - -void Graphic3d_GraphicDriver::SetLight (const Graphic3d_CView& ) { -} - -void Graphic3d_GraphicDriver::SetPlane (const Graphic3d_CView& ) { -} - -void Graphic3d_GraphicDriver::SetVisualisation (const Graphic3d_CView& ) { -} - -void Graphic3d_GraphicDriver::TransformStructure (const Graphic3d_CStructure& ) { -} - -void Graphic3d_GraphicDriver :: DegenerateStructure ( const Graphic3d_CStructure& ) { -} - - -void Graphic3d_GraphicDriver::Transparency (const Graphic3d_CView& , const Standard_Boolean ) { -} - - -void Graphic3d_GraphicDriver::Update (const Graphic3d_CView& , const Aspect_CLayer2d& , const Aspect_CLayer2d& ) { -} - - -Standard_Boolean Graphic3d_GraphicDriver::View (Graphic3d_CView& ) { - return Standard_True; -} - -void Graphic3d_GraphicDriver::ViewMapping (const Graphic3d_CView& , const Standard_Boolean ) { -} - -void Graphic3d_GraphicDriver::ViewOrientation (const Graphic3d_CView& , const Standard_Boolean ) { -} - -void Graphic3d_GraphicDriver :: SetBackFacingModel ( const Graphic3d_CView& ) { -} // end Graphic3d_GraphicDriver :: SetBackFacingModel diff --git a/src/Graphic3d/Graphic3d_GraphicDriver_703.cxx b/src/Graphic3d/Graphic3d_GraphicDriver_703.cxx deleted file mode 100755 index 79cc104c8f..0000000000 --- a/src/Graphic3d/Graphic3d_GraphicDriver_703.cxx +++ /dev/null @@ -1,36 +0,0 @@ -// File Graphic3d_GraphicDriver_703.cxx -// Created Mardi 28 janvier 1997 -// Author CAL -// 02.15.100 : JR : Clutter - -//-Copyright MatraDatavision 1997 - -//-Version - -//-Design Declaration des variables specifiques aux Drivers - -//-Warning Un driver encapsule les Pex et OpenGl drivers - -//-References - -//-Language C++ 2.0 - -//-Declarations - -// for the class -#include -#include - -#include - -//-Aliases - -//-Global data definitions - -//-Methods, in order - -void Graphic3d_GraphicDriver::Marker (const Graphic3d_CGroup& , const Graphic3d_Vertex& , const Standard_Boolean ) { -} - -void Graphic3d_GraphicDriver::MarkerSet (const Graphic3d_CGroup& , const Graphic3d_Array1OfVertex& , const Standard_Boolean ) { -} diff --git a/src/Graphic3d/Graphic3d_GraphicDriver_705.cxx b/src/Graphic3d/Graphic3d_GraphicDriver_705.cxx deleted file mode 100755 index 4d1eb40e09..0000000000 --- a/src/Graphic3d/Graphic3d_GraphicDriver_705.cxx +++ /dev/null @@ -1,61 +0,0 @@ -// File Graphic3d_GraphicDriver_705.cxx -// Created Mardi 28 janvier 1997 -// Author CAL -// Modified -// 27/07/97 ; PCT : ajout coordonnee texture -// 02.15.100 : JR : Clutter - -//-Copyright MatraDatavision 1997 - -//-Version - -//-Design Declaration des variables specifiques aux Drivers - -//-Warning Un driver encapsule les Pex et OpenGl drivers - -//-References - -//-Language C++ 2.0 - -//-Declarations - -// for the class -#include - -#include - -//-Aliases - -//-Global data definitions - -//-Methods, in order - -void Graphic3d_GraphicDriver::Polygon (const Graphic3d_CGroup& , const Graphic3d_Array1OfVertex& , const Graphic3d_TypeOfPolygon , const Standard_Boolean ) { -} - -void Graphic3d_GraphicDriver::Polygon (const Graphic3d_CGroup& , const Graphic3d_Array1OfVertex& , const Graphic3d_Vector& , const Graphic3d_TypeOfPolygon , const Standard_Boolean ) { -} - -void Graphic3d_GraphicDriver::Polygon (const Graphic3d_CGroup& , const Graphic3d_Array1OfVertexN& , const Graphic3d_TypeOfPolygon , const Standard_Boolean ) { -} - -void Graphic3d_GraphicDriver::Polygon (const Graphic3d_CGroup& , const Graphic3d_Array1OfVertexN& , const Graphic3d_Vector& , const Graphic3d_TypeOfPolygon , const Standard_Boolean ) { -} - - -void Graphic3d_GraphicDriver::Polygon(const Graphic3d_CGroup& ,const Graphic3d_Array1OfVertexNT& ,const Graphic3d_TypeOfPolygon ,const Standard_Boolean ) -{ -} - - -void Graphic3d_GraphicDriver::PolygonHoles (const Graphic3d_CGroup& , const TColStd_Array1OfInteger& , const Graphic3d_Array1OfVertex& , const Standard_Boolean ) { -} - -void Graphic3d_GraphicDriver::PolygonHoles (const Graphic3d_CGroup& , const TColStd_Array1OfInteger& , const Graphic3d_Array1OfVertex& , const Graphic3d_Vector& , const Standard_Boolean ) { -} - -void Graphic3d_GraphicDriver::PolygonHoles (const Graphic3d_CGroup& , const TColStd_Array1OfInteger& , const Graphic3d_Array1OfVertexN& , const Standard_Boolean ) { -} - -void Graphic3d_GraphicDriver::PolygonHoles (const Graphic3d_CGroup& , const TColStd_Array1OfInteger& , const Graphic3d_Array1OfVertexN& , const Graphic3d_Vector& , const Standard_Boolean ) { -} diff --git a/src/Graphic3d/Graphic3d_GraphicDriver_707.cxx b/src/Graphic3d/Graphic3d_GraphicDriver_707.cxx deleted file mode 100755 index a760b7333a..0000000000 --- a/src/Graphic3d/Graphic3d_GraphicDriver_707.cxx +++ /dev/null @@ -1,39 +0,0 @@ -// File Graphic3d_GraphicDriver_707.cxx -// Created Mardi 28 janvier 1997 -// Author CAL -// 11/97 ; CAL : ajout polyline par 2 points -// 02.15.100 : JR : Clutter - -//-Copyright MatraDatavision 1997 - -//-Version - -//-Design Declaration des variables specifiques aux Drivers - -//-Warning Un driver encapsule les Pex et OpenGl drivers - -//-References - -//-Language C++ 2.0 - -//-Declarations - -// for the class -#include - -#include - -//-Aliases - -//-Global data definitions - -//-Methods, in order - -void Graphic3d_GraphicDriver::Polyline (const Graphic3d_CGroup& , const Graphic3d_Array1OfVertex& , const Standard_Boolean ) { -} - -void Graphic3d_GraphicDriver::Polyline (const Graphic3d_CGroup& , const Graphic3d_Array1OfVertexC& , const Standard_Boolean ) { -} - -void Graphic3d_GraphicDriver::Polyline (const Graphic3d_CGroup& , const Standard_Real , const Standard_Real , const Standard_Real , const Standard_Real , const Standard_Real , const Standard_Real , const Standard_Boolean ) { -} diff --git a/src/Graphic3d/Graphic3d_GraphicDriver_709.cxx b/src/Graphic3d/Graphic3d_GraphicDriver_709.cxx deleted file mode 100755 index 352508c8c3..0000000000 --- a/src/Graphic3d/Graphic3d_GraphicDriver_709.cxx +++ /dev/null @@ -1,60 +0,0 @@ -// File Graphic3d_GraphicDriver_709.cxx -// Created Mardi 28 janvier 1997 -// Author CAL -// Modified -// 27/08/97 ; PCT : ajout coordonnee texture -// 02.15.100 : JR : Clutter - -//-Copyright MatraDatavision 1997 - -//-Version - -//-Design Declaration des variables specifiques aux Drivers - -//-Warning Un driver encapsule les Pex et OpenGl drivers - -//-References - -//-Language C++ 2.0 - -//-Declarations - -// for the class -#include - -#include - -//-Aliases - -//-Global data definitions - -//-Methods, in order - -void Graphic3d_GraphicDriver::QuadrangleMesh (const Graphic3d_CGroup& , const Graphic3d_Array2OfVertex& , const Standard_Boolean ) { -} - -void Graphic3d_GraphicDriver::QuadrangleMesh (const Graphic3d_CGroup& , const Graphic3d_Array2OfVertexN& , const Standard_Boolean ) { -} - - -void Graphic3d_GraphicDriver::QuadrangleMesh(const Graphic3d_CGroup& ,const Graphic3d_Array2OfVertexNT& ,const Standard_Boolean ) -{ -} - - -void Graphic3d_GraphicDriver::QuadrangleSet (const Graphic3d_CGroup& , const Graphic3d_Array1OfVertex& , const Aspect_Array1OfEdge& , const Standard_Boolean ) { -} - -void Graphic3d_GraphicDriver::QuadrangleSet (const Graphic3d_CGroup& , const Graphic3d_Array1OfVertexN& , const Aspect_Array1OfEdge& , const Standard_Boolean ) { -} - -void Graphic3d_GraphicDriver::QuadrangleSet (const Graphic3d_CGroup& , const Graphic3d_Array1OfVertexC& , const Aspect_Array1OfEdge& , const Standard_Boolean ) { -} - -void Graphic3d_GraphicDriver::QuadrangleSet (const Graphic3d_CGroup& , const Graphic3d_Array1OfVertexNC& , const Aspect_Array1OfEdge& , const Standard_Boolean ) { -} - - -void Graphic3d_GraphicDriver::QuadrangleSet(const Graphic3d_CGroup& ,const Graphic3d_Array1OfVertexNT& ,const Aspect_Array1OfEdge& ,const Standard_Boolean ) -{ -} diff --git a/src/Graphic3d/Graphic3d_GraphicDriver_710.cxx b/src/Graphic3d/Graphic3d_GraphicDriver_710.cxx deleted file mode 100755 index 61b7807423..0000000000 --- a/src/Graphic3d/Graphic3d_GraphicDriver_710.cxx +++ /dev/null @@ -1,78 +0,0 @@ -// File Graphic3d_GraphicDriver_710.cxx -// Created Mardi 28 janvier 1997 -// Author CAL -// 02.15.100 : JR : Clutter - -//-Copyright MatraDatavision 1997 - -//-Version - -//-Design Declaration des variables specifiques aux Drivers - -//-Warning Un driver encapsule les Pex et OpenGl drivers - -//-References - -//-Language C++ 2.0 - -//-Declarations - -// for the class -#include -#include - -#include - -//-Aliases - -//-Global data definitions - -//-Methods, in order - -void Graphic3d_GraphicDriver::Text ( - const Graphic3d_CGroup& , - const Standard_CString , - const Graphic3d_Vertex& , - const Standard_Real , - const Quantity_PlaneAngle , - const Graphic3d_TextPath , - const Graphic3d_HorizontalTextAlignment , - const Graphic3d_VerticalTextAlignment , - const Standard_Boolean - ) -{ -} - -void Graphic3d_GraphicDriver::Text ( - const Graphic3d_CGroup& , - const Standard_CString , - const Graphic3d_Vertex& , - const Standard_Real , - const Standard_Boolean - ) -{ -} - -void Graphic3d_GraphicDriver::Text ( - const Graphic3d_CGroup& , - const TCollection_ExtendedString& , - const Graphic3d_Vertex& , - const Standard_Real , - const Quantity_PlaneAngle , - const Graphic3d_TextPath , - const Graphic3d_HorizontalTextAlignment , - const Graphic3d_VerticalTextAlignment , - const Standard_Boolean - ) -{ -} - -void Graphic3d_GraphicDriver::Text ( - const Graphic3d_CGroup& , - const TCollection_ExtendedString& , - const Graphic3d_Vertex& , - const Standard_Real , - const Standard_Boolean - ) -{ -} diff --git a/src/Graphic3d/Graphic3d_GraphicDriver_711.cxx b/src/Graphic3d/Graphic3d_GraphicDriver_711.cxx deleted file mode 100755 index a035d168bb..0000000000 --- a/src/Graphic3d/Graphic3d_GraphicDriver_711.cxx +++ /dev/null @@ -1,62 +0,0 @@ -// File Graphic3d_GraphicDriver_711.cxx -// Created Mardi 28 janvier 1997 -// Author CAL -// -// Modified -// 27/08/97 ; PCT : ajout coordonne texture -// 02.15.100 : JR : Clutter - -//-Copyright MatraDatavision 1997 - -//-Version - -//-Design Declaration des variables specifiques aux Drivers - -//-Warning Un driver encapsule les Pex et OpenGl drivers - -//-References - -//-Language C++ 2.0 - -//-Declarations - -// for the class -#include - -#include - -//-Aliases - -//-Global data definitions - -//-Methods, in order - -void Graphic3d_GraphicDriver::TriangleMesh (const Graphic3d_CGroup& , const Graphic3d_Array1OfVertex& , const Standard_Boolean ) { -} - -void Graphic3d_GraphicDriver::TriangleMesh (const Graphic3d_CGroup& , const Graphic3d_Array1OfVertexN& , const Standard_Boolean ) { -} - - -void Graphic3d_GraphicDriver::TriangleMesh(const Graphic3d_CGroup& ,const Graphic3d_Array1OfVertexNT& ,const Standard_Boolean ) -{ -} - - -void Graphic3d_GraphicDriver::TriangleSet (const Graphic3d_CGroup& , const Graphic3d_Array1OfVertex& , const Aspect_Array1OfEdge& , const Standard_Boolean ) { -} - -void Graphic3d_GraphicDriver::TriangleSet (const Graphic3d_CGroup& , const Graphic3d_Array1OfVertexN& , const Aspect_Array1OfEdge& , const Standard_Boolean ) { -} - -void Graphic3d_GraphicDriver::TriangleSet (const Graphic3d_CGroup& , const Graphic3d_Array1OfVertexC& , const Aspect_Array1OfEdge& , const Standard_Boolean ) { -} - -void Graphic3d_GraphicDriver::TriangleSet (const Graphic3d_CGroup& , const Graphic3d_Array1OfVertexNC& , const Aspect_Array1OfEdge& , const Standard_Boolean ) { -} - - - -void Graphic3d_GraphicDriver::TriangleSet(const Graphic3d_CGroup& ,const Graphic3d_Array1OfVertexNT& ,const Aspect_Array1OfEdge& ,const Standard_Boolean ) -{ -} diff --git a/src/Graphic3d/Graphic3d_GraphicDriver_712.cxx b/src/Graphic3d/Graphic3d_GraphicDriver_712.cxx deleted file mode 100755 index 31933e4746..0000000000 --- a/src/Graphic3d/Graphic3d_GraphicDriver_712.cxx +++ /dev/null @@ -1,36 +0,0 @@ -// File Graphic3d_GraphicDriver_712.cxx -// Created Mardi 28 janvier 1997 -// Author CAL -// 02.15.100 : JR : Clutter - -//-Copyright MatraDatavision 1997 - -//-Version - -//-Design Declaration des variables specifiques aux Drivers - -//-Warning Un driver encapsule les Pex et OpenGl drivers - -//-References - -//-Language C++ 2.0 - -//-Declarations - -// for the class -#include - -#include - -//-Aliases - -//-Global data definitions - -//-Methods, in order - - -void Graphic3d_GraphicDriver::Bezier (const Graphic3d_CGroup& , const Graphic3d_Array1OfVertex& , const Standard_Boolean ) { -} - -void Graphic3d_GraphicDriver::Bezier (const Graphic3d_CGroup& , const Graphic3d_Array1OfVertex& , const TColStd_Array1OfReal& , const Standard_Boolean ) { -} diff --git a/src/Graphic3d/Graphic3d_GraphicDriver_713.cxx b/src/Graphic3d/Graphic3d_GraphicDriver_713.cxx deleted file mode 100755 index c75166a103..0000000000 --- a/src/Graphic3d/Graphic3d_GraphicDriver_713.cxx +++ /dev/null @@ -1,53 +0,0 @@ -// File OpenGl_GraphicDriver_713.cxx -// Created 22-10-01 -// Author SAV - - -// 09/07/02 SAV - merged with file Graphic3d_GraphicDriver_713.cxx created 16/06/2000 by ATS for G005 study. -//Following routines are entry points for creation of PARRAY primitives for (used for presentation). - -#include -#include - -#define BUC61044 /* 25/10/01 SAV ; added functionality to control gl depth testing -from higher API */ -#define BUC61045 /* 25/10/01 SAV ; added functionality to control gl lighting -from higher API */ - - -void Graphic3d_GraphicDriver::SetDepthTestEnabled( const Graphic3d_CView&, const Standard_Boolean ) const { -} - -Standard_Boolean Graphic3d_GraphicDriver::IsDepthTestEnabled( const Graphic3d_CView& ) const { - return Standard_True; -} - -void Graphic3d_GraphicDriver::ReadDepths( const Graphic3d_CView&, - const Standard_Integer, - const Standard_Integer, - const Standard_Integer, - const Standard_Integer, - const Standard_Address ) const -{ -} - -void Graphic3d_GraphicDriver::SetGLLightEnabled( const Graphic3d_CView&, const Standard_Boolean ) const { -} - -Standard_Boolean Graphic3d_GraphicDriver::IsGLLightEnabled( const Graphic3d_CView& ) const { - return Standard_True; -} - - -void Graphic3d_GraphicDriver :: PrimitiveArray ( const Graphic3d_CGroup&,const Graphic3d_PrimitiveArray&,const Standard_Boolean) { -} - - -void Graphic3d_GraphicDriver :: UserDraw ( const Graphic3d_CGroup&, - const Graphic3d_CUserDraw& ) -{ -} - -void Graphic3d_GraphicDriver::EnableVBO( const Standard_Boolean ) -{ -} \ No newline at end of file diff --git a/src/Graphic3d/Graphic3d_GraphicDriver_8.cxx b/src/Graphic3d/Graphic3d_GraphicDriver_8.cxx deleted file mode 100755 index fe82a5e56b..0000000000 --- a/src/Graphic3d/Graphic3d_GraphicDriver_8.cxx +++ /dev/null @@ -1,79 +0,0 @@ -// File Graphic3d_GraphicDriver_8.cxx -// Created Mardi 28 janvier 1997 -// Author CAL -// 02.15.100 : JR : Clutter - -//-Copyright MatraDatavision 1997 - -//-Version - -//-Design Declaration des variables specifiques aux Drivers - -//-Warning Un driver encapsule les Pex et OpenGl drivers - -//-References - -//-Language C++ 2.0 - -//-Declarations - -// for the class -#include - -#include - -//-Aliases - -//-Global data definitions - -//-Methods, in order - - -Standard_Boolean Graphic3d_GraphicDriver::BeginAddMode (const Graphic3d_CView& ) { - return Standard_True; -} - -void Graphic3d_GraphicDriver::EndAddMode (void) { -} - -Standard_Boolean Graphic3d_GraphicDriver::BeginImmediatMode (const Graphic3d_CView& , const Aspect_CLayer2d& , const Aspect_CLayer2d& , const Standard_Boolean , const Standard_Boolean ) { - return Standard_True; -} - -void Graphic3d_GraphicDriver::BeginPolyline () { -} - -void Graphic3d_GraphicDriver::ClearImmediatMode (const Graphic3d_CView&, const Standard_Boolean ) { -} - -void Graphic3d_GraphicDriver::Draw (const Standard_ShortReal , const Standard_ShortReal , const Standard_ShortReal ) { -} - -void Graphic3d_GraphicDriver::DrawStructure (const Graphic3d_CStructure& ) { -} - -void Graphic3d_GraphicDriver::EndImmediatMode (const Standard_Integer ) { -} - -void Graphic3d_GraphicDriver::EndPolyline () { -} - -void Graphic3d_GraphicDriver::Move (const Standard_ShortReal , const Standard_ShortReal , const Standard_ShortReal ) { -} - -void Graphic3d_GraphicDriver::SetLineColor (const Standard_ShortReal , const Standard_ShortReal , const Standard_ShortReal ) { -} - -void Graphic3d_GraphicDriver::SetLineType (const Standard_Integer ) { -} - -void Graphic3d_GraphicDriver::SetLineWidth (const Standard_ShortReal ) { -} - - -void Graphic3d_GraphicDriver::SetMinMax (const Standard_ShortReal , const Standard_ShortReal , const Standard_ShortReal , const Standard_ShortReal , const Standard_ShortReal , const Standard_ShortReal ) { -} - -void Graphic3d_GraphicDriver::Transform (const TColStd_Array2OfReal& , const Graphic3d_TypeOfComposition ) { - -} diff --git a/src/Graphic3d/Graphic3d_GraphicDriver_9.cxx b/src/Graphic3d/Graphic3d_GraphicDriver_9.cxx deleted file mode 100755 index 8d3ab63798..0000000000 --- a/src/Graphic3d/Graphic3d_GraphicDriver_9.cxx +++ /dev/null @@ -1,126 +0,0 @@ -// File Graphic3d_GraphicDriver_8.cxx -// Created Mardi 28 janvier 1997 -// Author CAL -// modified: 1/07/97 ; PCT : ajout texture mapping -// 16-09-98 ; BGN : Points d'entree du Triedre (S3819, Phase 1) -// 22-09-98 ; BGN : S3989 (anciennement S3819) -// TypeOfTriedron* from Aspect (pas Graphic3d) -// 02.15.100 : JR : Clutter - -//-Copyright MatraDatavision 1997 - -//-Version - -//-Design Declaration des variables specifiques aux Drivers - -//-Warning Un driver encapsule les Pex et OpenGl drivers - -//-References - -//-Language C++ 2.0 - -//-Declarations - - -//SAV 23/12/02 : Added methods to set background image. - -// for the class -#include - -#include - -#include - -//-Aliases - -//-Global data definitions - -//-Methods, in order - -Standard_Integer Graphic3d_GraphicDriver::CreateTexture(const Graphic3d_TypeOfTexture ,const Handle_AlienImage_AlienImage &,const Standard_CString,const Handle(TColStd_HArray1OfReal)& TexUpperBounds ) const -{ - return -1; - -} - -void Graphic3d_GraphicDriver::DestroyTexture(const Standard_Integer ) const -{ -} - - -void Graphic3d_GraphicDriver::ModifyTexture(const Standard_Integer ,const Graphic3d_CInitTexture& ) const -{ -} - -void Graphic3d_GraphicDriver::Environment(const Graphic3d_CView& ) -{ -} - - -// -// Triedron methods : the Triedron is a non-zoomable object. -// - - -void Graphic3d_GraphicDriver::ZBufferTriedronSetup ( - const Quantity_NameOfColor, - const Quantity_NameOfColor, - const Quantity_NameOfColor, - const Standard_Real, - const Standard_Real, - const Standard_Integer) -{ -} - -void Graphic3d_GraphicDriver::TriedronDisplay ( - const Graphic3d_CView& , - const Aspect_TypeOfTriedronPosition , - const Quantity_NameOfColor , - const Standard_Real, - const Standard_Boolean ) -{ -} - -void Graphic3d_GraphicDriver::TriedronErase (const Graphic3d_CView& ) -{ -} - - -void Graphic3d_GraphicDriver::TriedronEcho (const Graphic3d_CView& ,const Aspect_TypeOfTriedronEcho ) -{ -} - - -void Graphic3d_GraphicDriver::BackgroundImage( const Standard_CString /*FileName*/, - const Graphic3d_CView& /*ACView*/, - const Aspect_FillMethod /*FillStyle*/) -{ -} - -void Graphic3d_GraphicDriver::SetBgImageStyle( const Graphic3d_CView& /*ACView*/, - const Aspect_FillMethod /*FillStyle*/) -{ -} - -void Graphic3d_GraphicDriver::SetBgGradientStyle( const Graphic3d_CView& /*ACView*/, - const Aspect_GradientFillMethod /*FillStyle*/) -{ -} - -void Graphic3d_GraphicDriver::GraduatedTrihedronDisplay(const Graphic3d_CView&, - const Graphic3d_CGraduatedTrihedron&) -{ -} - -void Graphic3d_GraphicDriver::GraduatedTrihedronErase(const Graphic3d_CView&) -{ -} - -void Graphic3d_GraphicDriver::GraduatedTrihedronMinMaxValues(const Standard_ShortReal, - const Standard_ShortReal, - const Standard_ShortReal, - const Standard_ShortReal, - const Standard_ShortReal, - const Standard_ShortReal) -{ -} diff --git a/src/Graphic3d/Graphic3d_GraphicDriver_Export.cxx b/src/Graphic3d/Graphic3d_GraphicDriver_Export.cxx deleted file mode 100755 index b2eabf2c9f..0000000000 --- a/src/Graphic3d/Graphic3d_GraphicDriver_Export.cxx +++ /dev/null @@ -1,25 +0,0 @@ -/************************************************************************/ -/* Includes */ -/************************************************************************/ - -#include - -/************************************************************************/ -/* Print Methods */ -/************************************************************************/ - - -Standard_Boolean Graphic3d_GraphicDriver::Export (const Standard_CString theFileName, - const Graphic3d_ExportFormat theFormat, - const Graphic3d_SortType theSortType, - const Standard_Integer theW, - const Standard_Integer theH, - const Graphic3d_CView& theView, - const Aspect_CLayer2d& theLayerUnder, - const Aspect_CLayer2d& theLayerOver, - const Standard_Real thePrecision, - const Standard_Address theProgressBarFunc, - const Standard_Address theProgressObject) -{ - return Standard_False; -} diff --git a/src/Graphic3d/Graphic3d_GraphicDriver_Layer.cxx b/src/Graphic3d/Graphic3d_GraphicDriver_Layer.cxx deleted file mode 100755 index f9cd0623d9..0000000000 --- a/src/Graphic3d/Graphic3d_GraphicDriver_Layer.cxx +++ /dev/null @@ -1,89 +0,0 @@ -// File Graphic3d_GraphicDriver_Layer.cxx -// Created Mardi 3 novembre 1998 -// Author CAL -// 02.15.100 : JR : Clutter - -//-Copyright MatraDatavision 1998 - -//-Version - -//-Design Declaration des variables specifiques aux Drivers - -//-Warning Un driver encapsule les Pex et OpenGl drivers - -//-References - -//-Language C++ 2.0 - -//-Declarations - -// for the class -#include - -#include - -//-Aliases - -//-Global data definitions - -//-Methods, in order - -void Graphic3d_GraphicDriver::Layer (Aspect_CLayer2d& ) { -} - -void Graphic3d_GraphicDriver::RemoveLayer (const Aspect_CLayer2d& ) { -} - -void Graphic3d_GraphicDriver::BeginLayer (const Aspect_CLayer2d& ) { -} - -void Graphic3d_GraphicDriver::BeginPolygon2d () { -} - -void Graphic3d_GraphicDriver::BeginPolyline2d () { -} - -void Graphic3d_GraphicDriver::ClearLayer (const Aspect_CLayer2d& ) { -} - -void Graphic3d_GraphicDriver::Draw (const Standard_ShortReal , const Standard_ShortReal ) { -} - -void Graphic3d_GraphicDriver::Edge (const Standard_ShortReal , const Standard_ShortReal ) { -} - -void Graphic3d_GraphicDriver::EndLayer () { -} - -void Graphic3d_GraphicDriver::EndPolygon2d () { -} - -void Graphic3d_GraphicDriver::EndPolyline2d () { -} - -void Graphic3d_GraphicDriver::Move (const Standard_ShortReal , const Standard_ShortReal ) { -} - -void Graphic3d_GraphicDriver::Rectangle (const Standard_ShortReal , const Standard_ShortReal , const Standard_ShortReal , const Standard_ShortReal ) { -} - -void Graphic3d_GraphicDriver::SetColor (const Standard_ShortReal , const Standard_ShortReal , const Standard_ShortReal ) { -} - -void Graphic3d_GraphicDriver::SetTransparency (const Standard_ShortReal ) { -} - -void Graphic3d_GraphicDriver::UnsetTransparency () { -} - -void Graphic3d_GraphicDriver::SetLineAttributes (const Standard_Integer , const Standard_ShortReal ) { -} - -void Graphic3d_GraphicDriver::SetTextAttributes (const Standard_CString Font, const Standard_Integer AType, const Standard_ShortReal R, const Standard_ShortReal G, const Standard_ShortReal B) { -} - -void Graphic3d_GraphicDriver::Text (const Standard_CString , const Standard_ShortReal , const Standard_ShortReal , const Standard_ShortReal ) { -} - -void Graphic3d_GraphicDriver::TextSize (const Standard_CString , const Standard_ShortReal , Standard_ShortReal& , Standard_ShortReal& , Standard_ShortReal& ) const { -} diff --git a/src/Graphic3d/Graphic3d_GraphicDriver_Print.cxx b/src/Graphic3d/Graphic3d_GraphicDriver_Print.cxx deleted file mode 100755 index ddc2075494..0000000000 --- a/src/Graphic3d/Graphic3d_GraphicDriver_Print.cxx +++ /dev/null @@ -1,27 +0,0 @@ -// File Graphic3d_GraphicDriver_Print.c -// Created March 2000 -// Author THA -// e-mail t-hartl@muenchen.matra-dtv.fr - -/************************************************************************/ -/* Includes */ -/************************************************************************/ - -#include -#include - -/************************************************************************/ -/* Print Methods */ -/************************************************************************/ - -Standard_Boolean Graphic3d_GraphicDriver::Print (const Graphic3d_CView& , - const Aspect_CLayer2d& , - const Aspect_CLayer2d& , - const Aspect_Handle , - const Standard_Boolean , - const Standard_CString , - const Aspect_PrintAlgo , - const Standard_Real ) const -{ - return Standard_False; -} diff --git a/src/Graphic3d/Graphic3d_Group.cdl b/src/Graphic3d/Graphic3d_Group.cdl index 60dbafa968..c3e577a9b3 100755 --- a/src/Graphic3d/Graphic3d_Group.cdl +++ b/src/Graphic3d/Graphic3d_Group.cdl @@ -606,77 +606,7 @@ -- Warning: Raises GroupDefinitionError if contains -- less than four points. raises GroupDefinitionError from Graphic3d is static; - - QuadrangleSet ( me : mutable; - ListVertex : Array1OfVertex from Graphic3d; - ListEdge : Array1OfEdge from Aspect; - EvalMinMax : Boolean from Standard = Standard_True ) - ---Level: Public - ---Purpose: Creates a group of quadrangles defined by a table of - -- vertices and a table of edges, visible or not. - -- Category: Methods to create Quadrangle - -- Warning: Raises GroupDefinitionError if contains - -- less than four points or if contains - -- less than four edges. - raises GroupDefinitionError from Graphic3d is static; - - QuadrangleSet ( me : mutable; - ListVertex : Array1OfVertexN from Graphic3d; - ListEdge : Array1OfEdge from Aspect; - EvalMinMax : Boolean from Standard = Standard_True ) - ---Level: Public - ---Purpose: Creates a group of quadrangles defined by a table of - -- vertices and a table of edges, visible or not. - -- For each vertex the normal is given. - -- Category: Methods to create Quadrangle - -- Warning: Raises GroupDefinitionError if contains - -- less than four points or if contains - -- less than four edges. - raises GroupDefinitionError from Graphic3d is static; - - QuadrangleSet ( me : mutable; - ListVertex : Array1OfVertexNT from Graphic3d; - ListEdge : Array1OfEdge from Aspect; - EvalMinMax : Boolean from Standard = Standard_True ) - ---Level: Public - ---Purpose: Creates a group of quadrangles defined by a table of - -- vertices and a table of edges, visible or not. - -- For each vertex the normal is given. - -- For each vertex a texture coordinate is given. - -- Category: Methods to create Quadrangle - -- Warning: Raises GroupDefinitionError if contains - -- less than four points or if contains - -- less than four edges. - raises GroupDefinitionError from Graphic3d is static; - - QuadrangleSet ( me : mutable; - ListVertex : Array1OfVertexC from Graphic3d; - ListEdge : Array1OfEdge from Aspect; - EvalMinMax : Boolean from Standard = Standard_True ) - ---Level: Public - ---Purpose: Creates a group of quadrangles defined by a table of - -- vertices and a table of edges, visible or not. - -- For each vertex the color is given. - -- Category: Methods to create Quadrangle - -- Warning: Raises GroupDefinitionError if contains - -- less than four points or if contains - -- less than four edges. - raises GroupDefinitionError from Graphic3d is static; - - QuadrangleSet ( me : mutable; - ListVertex : Array1OfVertexNC from Graphic3d; - ListEdge : Array1OfEdge from Aspect; - EvalMinMax : Boolean from Standard = Standard_True ) - ---Level: Public - ---Purpose: Creates a group of quadrangles defined by a table of - -- vertices and a table of edges, visible or not. - -- For each vertex the normal and the color are given. - -- Category: Methods to create Quadrangle - -- Warning: Raises GroupDefinitionError if contains - -- less than four points or if contains - -- less than four edges. - raises GroupDefinitionError from Graphic3d is static; - + ----------------------------------- -- Category: Methods to create Text ----------------------------------- diff --git a/src/Graphic3d/Graphic3d_Group_12.cxx b/src/Graphic3d/Graphic3d_Group_12.cxx deleted file mode 100755 index 976dc78770..0000000000 --- a/src/Graphic3d/Graphic3d_Group_12.cxx +++ /dev/null @@ -1,100 +0,0 @@ - -// File Graphic3d_Group_12.cxx (Curve) -// Created Aout 1994 -// Author NW,JPB,CAL - -//-Copyright MatraDatavision 1994 - -//-Version - -//-Design Declaration des variables specifiques aux groupes -// de primitives - -//-Warning Un groupe est defini dans une structure -// Il s'agit de la plus petite entite editable - -//-References - -//-Language C++ 2.0 - -//-Declarations - -// for the class -#include -#include - -//-Methods, in order - -void Graphic3d_Group::Bezier (const Graphic3d_Array1OfVertex& ListVertex, const Standard_Boolean EvalMinMax) { - - if (IsDeleted ()) return; - - MyIsEmpty = Standard_False; - -Standard_Integer i, j; - - i = ListVertex.Length (); - - if (i <= 2) - Graphic3d_GroupDefinitionError::Raise ("Bad number of vertices"); - - // Min-Max Update - if (EvalMinMax) { -Standard_Real X, Y, Z; -Standard_Integer Lower = ListVertex.Lower (); -Standard_Integer Upper = ListVertex.Upper (); - // Parcours des sommets - for (j=0, i=Lower; i<=Upper; i++, j++) { - ListVertex (i).Coord (X, Y, Z); - if (X < MyBounds.XMin) MyBounds.XMin = Standard_ShortReal (X); - if (Y < MyBounds.YMin) MyBounds.YMin = Standard_ShortReal (Y); - if (Z < MyBounds.ZMin) MyBounds.ZMin = Standard_ShortReal (Z); - if (X > MyBounds.XMax) MyBounds.XMax = Standard_ShortReal (X); - if (Y > MyBounds.YMax) MyBounds.YMax = Standard_ShortReal (Y); - if (Z > MyBounds.ZMax) MyBounds.ZMax = Standard_ShortReal (Z); - } - } - - MyGraphicDriver->Bezier (MyCGroup, ListVertex, EvalMinMax); - - Update (); - -} - -void Graphic3d_Group::Bezier (const Graphic3d_Array1OfVertex& ListVertex, const TColStd_Array1OfReal& ListWeight, const Standard_Boolean EvalMinMax) { - - if (IsDeleted ()) return; - - MyIsEmpty = Standard_False; - -Standard_Integer i, j; - - i = ListVertex.Length (); - j = ListWeight.Length (); - - if ((i <= 2) || (i != j)) - Graphic3d_GroupDefinitionError::Raise ("Bad number of vertices"); - - // Min-Max Update - if (EvalMinMax) { -Standard_Real X, Y, Z; -Standard_Integer Lower = ListVertex.Lower (); -Standard_Integer Upper = ListVertex.Upper (); - // Parcours des sommets - for (j=0, i=Lower; i<=Upper; i++, j++) { - ListVertex (i).Coord (X, Y, Z); - if (X < MyBounds.XMin) MyBounds.XMin = Standard_ShortReal (X); - if (Y < MyBounds.YMin) MyBounds.YMin = Standard_ShortReal (Y); - if (Z < MyBounds.ZMin) MyBounds.ZMin = Standard_ShortReal (Z); - if (X > MyBounds.XMax) MyBounds.XMax = Standard_ShortReal (X); - if (Y > MyBounds.YMax) MyBounds.YMax = Standard_ShortReal (Y); - if (Z > MyBounds.ZMax) MyBounds.ZMax = Standard_ShortReal (Z); - } - } - - MyGraphicDriver->Bezier - (MyCGroup, ListVertex, ListWeight, EvalMinMax); - - Update (); - -} diff --git a/src/Graphic3d/Graphic3d_Group_9.cxx b/src/Graphic3d/Graphic3d_Group_9.cxx index d1ea2a5af4..40c5ce7c87 100755 --- a/src/Graphic3d/Graphic3d_Group_9.cxx +++ b/src/Graphic3d/Graphic3d_Group_9.cxx @@ -21,16 +21,9 @@ //-Declarations -// for the class #include #include -#include -#include -#include - -//-Methods, in order - void Graphic3d_Group::QuadrangleMesh (const Graphic3d_Array2OfVertex& ListVertex, const Standard_Boolean EvalMinMax) { if (IsDeleted ()) return; @@ -141,207 +134,3 @@ Standard_Integer UpperCol = ListVertex.UpperCol (); Update (); } - - -void Graphic3d_Group::QuadrangleSet (const Graphic3d_Array1OfVertex& ListVertex, const Aspect_Array1OfEdge& ListEdge, const Standard_Boolean EvalMinMax) { - - if (IsDeleted ()) return; - - if (! MyContainsFacet) MyStructure->GroupsWithFacet (+1); - MyContainsFacet = Standard_True; - MyIsEmpty = Standard_False; - -Standard_Integer i, j; - - i = ListVertex.Length (); - j = ListEdge.Length (); - - if ((i <= 3) || (j <= 3)) - Graphic3d_GroupDefinitionError::Raise ("Bad number of vertices"); - - // Min-Max Update - if (EvalMinMax) { -Standard_Real X, Y, Z; -Standard_Integer Lower = ListVertex.Lower (); -Standard_Integer Upper = ListVertex.Upper (); - // Parcours des sommets - for (j=0, i=Lower; i<=Upper; i++, j++) { - ListVertex (i).Coord (X, Y, Z); - if (X < MyBounds.XMin) MyBounds.XMin = Standard_ShortReal (X); - if (Y < MyBounds.YMin) MyBounds.YMin = Standard_ShortReal (Y); - if (Z < MyBounds.ZMin) MyBounds.ZMin = Standard_ShortReal (Z); - if (X > MyBounds.XMax) MyBounds.XMax = Standard_ShortReal (X); - if (Y > MyBounds.YMax) MyBounds.YMax = Standard_ShortReal (Y); - if (Z > MyBounds.ZMax) MyBounds.ZMax = Standard_ShortReal (Z); - } - } - - MyGraphicDriver->QuadrangleSet - (MyCGroup, ListVertex, ListEdge, EvalMinMax); - - Update (); - -} - -void Graphic3d_Group::QuadrangleSet (const Graphic3d_Array1OfVertexN& ListVertex, const Aspect_Array1OfEdge& ListEdge, const Standard_Boolean EvalMinMax) { - - if (IsDeleted ()) return; - - if (! MyContainsFacet) MyStructure->GroupsWithFacet (+1); - MyContainsFacet = Standard_True; - MyIsEmpty = Standard_False; - -Standard_Integer i, j; - - i = ListVertex.Length (); - j = ListEdge.Length (); - - if ((i <= 3) || (j <= 3)) - Graphic3d_GroupDefinitionError::Raise ("Bad number of vertices"); - - // Min-Max Update - if (EvalMinMax) { -Standard_Real X, Y, Z; -Standard_Integer Lower = ListVertex.Lower (); -Standard_Integer Upper = ListVertex.Upper (); - // Parcours des sommets - for (j=0, i=Lower; i<=Upper; i++, j++) { - ListVertex (i).Coord (X, Y, Z); - if (X < MyBounds.XMin) MyBounds.XMin = Standard_ShortReal (X); - if (Y < MyBounds.YMin) MyBounds.YMin = Standard_ShortReal (Y); - if (Z < MyBounds.ZMin) MyBounds.ZMin = Standard_ShortReal (Z); - if (X > MyBounds.XMax) MyBounds.XMax = Standard_ShortReal (X); - if (Y > MyBounds.YMax) MyBounds.YMax = Standard_ShortReal (Y); - if (Z > MyBounds.ZMax) MyBounds.ZMax = Standard_ShortReal (Z); - } - } - - MyGraphicDriver->QuadrangleSet - (MyCGroup, ListVertex, ListEdge, EvalMinMax); - - Update (); - -} - -void Graphic3d_Group::QuadrangleSet (const Graphic3d_Array1OfVertexC& ListVertex, const Aspect_Array1OfEdge& ListEdge, const Standard_Boolean EvalMinMax) { - - if (IsDeleted ()) return; - - if (! MyContainsFacet) MyStructure->GroupsWithFacet (+1); - MyContainsFacet = Standard_True; - MyIsEmpty = Standard_False; - -Standard_Integer i, j; - - i = ListVertex.Length (); - j = ListEdge.Length (); - - if ((i <= 3) || (j <= 3)) - Graphic3d_GroupDefinitionError::Raise ("Bad number of vertices"); - - // Min-Max Update - if (EvalMinMax) { -Standard_Real X, Y, Z; -Standard_Integer Lower = ListVertex.Lower (); -Standard_Integer Upper = ListVertex.Upper (); - // Parcours des sommets - for (j=0, i=Lower; i<=Upper; i++, j++) { - ListVertex (i).Coord (X, Y, Z); - if (X < MyBounds.XMin) MyBounds.XMin = Standard_ShortReal (X); - if (Y < MyBounds.YMin) MyBounds.YMin = Standard_ShortReal (Y); - if (Z < MyBounds.ZMin) MyBounds.ZMin = Standard_ShortReal (Z); - if (X > MyBounds.XMax) MyBounds.XMax = Standard_ShortReal (X); - if (Y > MyBounds.YMax) MyBounds.YMax = Standard_ShortReal (Y); - if (Z > MyBounds.ZMax) MyBounds.ZMax = Standard_ShortReal (Z); - } - } - - MyGraphicDriver->QuadrangleSet - (MyCGroup, ListVertex, ListEdge, EvalMinMax); - - Update (); - -} - -void Graphic3d_Group::QuadrangleSet (const Graphic3d_Array1OfVertexNC& ListVertex, const Aspect_Array1OfEdge& ListEdge, const Standard_Boolean EvalMinMax) { - - if (IsDeleted ()) return; - - if (! MyContainsFacet) MyStructure->GroupsWithFacet (+1); - MyContainsFacet = Standard_True; - MyIsEmpty = Standard_False; - -Standard_Integer i, j; - - i = ListVertex.Length (); - j = ListEdge.Length (); - - if ((i <= 3) || (j <= 3)) - Graphic3d_GroupDefinitionError::Raise ("Bad number of vertices"); - - // Min-Max Update - if (EvalMinMax) { -Standard_Real X, Y, Z; -Standard_Integer Lower = ListVertex.Lower (); -Standard_Integer Upper = ListVertex.Upper (); - // Parcours des sommets - for (j=0, i=Lower; i<=Upper; i++, j++) { - ListVertex (i).Coord (X, Y, Z); - if (X < MyBounds.XMin) MyBounds.XMin = Standard_ShortReal (X); - if (Y < MyBounds.YMin) MyBounds.YMin = Standard_ShortReal (Y); - if (Z < MyBounds.ZMin) MyBounds.ZMin = Standard_ShortReal (Z); - if (X > MyBounds.XMax) MyBounds.XMax = Standard_ShortReal (X); - if (Y > MyBounds.YMax) MyBounds.YMax = Standard_ShortReal (Y); - if (Z > MyBounds.ZMax) MyBounds.ZMax = Standard_ShortReal (Z); - } - } - - MyGraphicDriver->QuadrangleSet - (MyCGroup, ListVertex, ListEdge, EvalMinMax); - - Update (); - -} - - - -void Graphic3d_Group::QuadrangleSet(const Graphic3d_Array1OfVertexNT& ListVertex,const Aspect_Array1OfEdge& ListEdge,const Standard_Boolean EvalMinMax) -{ - - if (IsDeleted ()) return; - - if (! MyContainsFacet) MyStructure->GroupsWithFacet (+1); - MyContainsFacet = Standard_True; - MyIsEmpty = Standard_False; - -Standard_Integer i, j; - - i = ListVertex.Length (); - j = ListEdge.Length (); - - if ((i <= 3) || (j <= 3)) - Graphic3d_GroupDefinitionError::Raise ("Bad number of vertices"); - - // Min-Max Update - if (EvalMinMax) { -Standard_Real X, Y, Z; -Standard_Integer Lower = ListVertex.Lower (); -Standard_Integer Upper = ListVertex.Upper (); - // Parcours des sommets - for (j=0, i=Lower; i<=Upper; i++, j++) { - ListVertex (i).Coord (X, Y, Z); - if (X < MyBounds.XMin) MyBounds.XMin = Standard_ShortReal (X); - if (Y < MyBounds.YMin) MyBounds.YMin = Standard_ShortReal (Y); - if (Z < MyBounds.ZMin) MyBounds.ZMin = Standard_ShortReal (Z); - if (X > MyBounds.XMax) MyBounds.XMax = Standard_ShortReal (X); - if (Y > MyBounds.YMax) MyBounds.YMax = Standard_ShortReal (Y); - if (Z > MyBounds.ZMax) MyBounds.ZMax = Standard_ShortReal (Z); - } - } - - MyGraphicDriver->QuadrangleSet - (MyCGroup, ListVertex, ListEdge, EvalMinMax); - - Update (); - -} diff --git a/src/OpenGl/FILES b/src/OpenGl/FILES index fbbb96b21c..342136466f 100755 --- a/src/OpenGl/FILES +++ b/src/OpenGl/FILES @@ -1,10 +1,8 @@ EXTERNLIB -OpenGl_triedron.cxx OpenGl_CMPLRS.edl -OpenGl_FontMgr.hxx -OpenGl_FontMgr.cxx -OpenGl_AVIWriter.hxx -OpenGl_AVIWriter.cxx +Handle_OpenGl_GraphicDriver.hxx +OpenGl_GraphicDriver.hxx +OpenGl_GraphicDriver.cxx OpenGl_GraphicDriver_1.cxx OpenGl_GraphicDriver_2.cxx OpenGl_GraphicDriver_3.cxx @@ -12,240 +10,117 @@ OpenGl_GraphicDriver_4.cxx OpenGl_GraphicDriver_5.cxx OpenGl_GraphicDriver_6.cxx OpenGl_GraphicDriver_7.cxx +OpenGl_GraphicDriver_8.cxx +OpenGl_GraphicDriver_9.cxx OpenGl_GraphicDriver_703.cxx OpenGl_GraphicDriver_705.cxx OpenGl_GraphicDriver_707.cxx OpenGl_GraphicDriver_709.cxx OpenGl_GraphicDriver_710.cxx OpenGl_GraphicDriver_711.cxx -OpenGl_GraphicDriver_712.cxx -OpenGl_GraphicDriver_8.cxx -OpenGl_GraphicDriver_9.cxx -OpenGl_GraphicDriver_print.cxx +OpenGl_GraphicDriver_713.cxx OpenGl_GraphicDriver_Layer.cxx -OpenGl.cdl -OpenGl_addnames.cxx -OpenGl_animation.hxx -OpenGl_antialias.cxx -OpenGl_applid.cxx -OpenGl_attri.cxx -OpenGl_bintcol.cxx -OpenGl_bintrefl.cxx -OpenGl_bsurfprop.cxx -OpenGl_charexpan.cxx -OpenGl_charspace.cxx -OpenGl_cmn_varargs.hxx -OpenGl_context.hxx -OpenGl_curve.cxx -OpenGl_degeneration.hxx -OpenGl_degmodel.cxx -OpenGl_depthcue.cxx -OpenGl_dind.cxx -OpenGl_edgecol.cxx -OpenGl_edgeflag.cxx -OpenGl_edgetyp.cxx -OpenGl_edgewid.cxx -OpenGl_execstruct.cxx -OpenGl_Extension.hxx -OpenGl_Extension.cxx -OpenGl_facecull.cxx -OpenGl_facedmode.cxx -OpenGl_filters.cxx -OpenGl_funcs.cxx -OpenGl_highlight.cxx -OpenGl_hlind.cxx -OpenGl_ImageBox.hxx -OpenGl_ImageBox.cxx -OpenGl_indexpolygons.cxx -OpenGl_initelem.cxx -OpenGl_inquire.cxx -OpenGl_inquire.hxx -OpenGl_intcol.cxx -OpenGl_intrefl.cxx -OpenGl_intshademtd.cxx -OpenGl_intstyle.cxx -OpenGl_intstyleind.cxx -OpenGl_label.cxx -OpenGl_lightstate.cxx -OpenGl_localtran3.cxx -OpenGl_LightBox.cxx -OpenGl_LightBox.hxx -OpenGl_mrkr.cxx -OpenGl_mrkrcol.cxx -OpenGl_mrkrset.cxx -OpenGl_mrkrsize.cxx -OpenGl_mrkrtype.cxx -OpenGl_pick.cxx -OpenGl_pickid.cxx -OpenGl_polygon.cxx -OpenGl_polygonholes.cxx -OpenGl_polygonoffset.cxx -OpenGl_polyl.cxx -OpenGl_polylcol.cxx -OpenGl_polyltyp.cxx -OpenGl_polylwid.cxx -OpenGl_qstrip.cxx -OpenGl_remnames.cxx -OpenGl_subrs.cxx -OpenGl_subrvis.cxx -OpenGl_surfprop.cxx -OpenGl_telem.hxx -OpenGl_telem_attri.hxx -OpenGl_telem_depthcue.hxx -OpenGl_telem_filters.hxx -OpenGl_telem_highlight.hxx -OpenGl_telem_inquire.hxx -OpenGl_telem_pick.hxx -OpenGl_telem_util.cxx -OpenGl_telem_util.hxx +OpenGl_GraphicDriver_print.cxx +OpenGl_GraphicDriver_Export.cxx +OpenGl_AspectLine.hxx +OpenGl_AspectLine.cxx +OpenGl_AspectFace.hxx +OpenGl_AspectFace.cxx +OpenGl_AspectMarker.hxx +OpenGl_AspectMarker.cxx +OpenGl_AspectText.hxx +OpenGl_AspectText.cxx +OpenGl_Group.hxx +OpenGl_Group.cxx +OpenGl_Structure.hxx +OpenGl_Structure.cxx +OpenGl_Element.hxx +OpenGl_Text.hxx +OpenGl_Text.cxx +OpenGl_Polyline.hxx +OpenGl_Polyline.cxx +OpenGl_Marker.hxx +OpenGl_Marker.cxx +OpenGl_MarkerSet.hxx +OpenGl_MarkerSet.cxx +OpenGl_Polygon.hxx +OpenGl_Polygon.cxx +OpenGl_QuadrangleStrip.hxx +OpenGl_QuadrangleStrip.cxx +OpenGl_TriangleStrip.hxx +OpenGl_TriangleStrip.cxx +OpenGl_Mesh.hxx +OpenGl_Mesh.cxx +OpenGl_PrimitiveArray.hxx +OpenGl_PrimitiveArray.cxx +Handle_OpenGl_Workspace.hxx +OpenGl_Workspace.hxx +OpenGl_Workspace.cxx +OpenGl_Workspace_1.cxx +OpenGl_Workspace_2.cxx +OpenGl_Workspace_3.cxx +OpenGl_Workspace_4.cxx +OpenGl_Workspace_5.cxx +Handle_OpenGl_View.hxx +OpenGl_View.hxx +OpenGl_View.cxx +OpenGl_View_1.cxx +OpenGl_View_2.cxx +OpenGl_Light.hxx +Handle_OpenGl_Trihedron.hxx +OpenGl_Trihedron.hxx +OpenGl_Trihedron.cxx +Handle_OpenGl_GraduatedTrihedron.hxx +OpenGl_GraduatedTrihedron.hxx +OpenGl_GraduatedTrihedron.cxx +OpenGl_Matrix.hxx +OpenGl_Matrix.cxx +OpenGl_CView.hxx +OpenGl_NamedStatus.hxx +OpenGl_TextParam.hxx +OpenGl_Callback.hxx +OpenGl_PrinterContext.hxx +OpenGl_PrinterContext.cxx +Handle_OpenGl_Display.hxx +OpenGl_Display.hxx +OpenGl_Display.cxx +OpenGl_Display_1.cxx +OpenGl_Display_2.cxx +Handle_OpenGl_Window.hxx +OpenGl_Window.hxx +OpenGl_Window.cxx +OpenGl_PriorityList.hxx +OpenGl_PriorityList.cxx +OpenGl_AVIWriter.hxx +OpenGl_AVIWriter.cxx +OpenGl_tsm.hxx +OpenGl_telem_view.cxx OpenGl_telem_view.hxx -OpenGl_text.cxx -OpenGl_textcol.cxx -OpenGl_textcolsubtitle.cxx -OpenGl_textdisplaytype.cxx -OpenGl_textfont.cxx -OpenGl_textheight.cxx -OpenGl_textstyle.cxx -OpenGl_TextureBox.hxx -OpenGl_TextureBox.cxx -OpenGl_tgl.hxx OpenGl_tgl_all.hxx -OpenGl_tgl_elems.hxx -OpenGl_tgl_funcs.hxx -OpenGl_tgl_pick.hxx -OpenGl_tgl_subrs.hxx -OpenGl_tgl_subrvis.hxx -OpenGl_tgl_tox.hxx -OpenGl_tgl_util.cxx -OpenGl_tgl_util.hxx -OpenGl_tgl_utilgr.cxx -OpenGl_tgl_utilgr.hxx -OpenGl_tgl_vis.hxx -OpenGl_tmesh.cxx -OpenGl_tox.cxx -OpenGl_trsf_stack.hxx -OpenGl_tsm.cxx -OpenGl_tsm.hxx -OpenGl_tsm_ws.hxx -OpenGl_txgl.cxx -OpenGl_txgl.hxx -OpenGl_undefined.cxx -OpenGl_view.cxx -OpenGl_vind.cxx -OpenGl_ws.cxx -OpenGl_togl_activateview.cxx -OpenGl_togl_antialiasing.cxx -OpenGl_togl_backfacing.cxx -OpenGl_togl_background.cxx -OpenGl_togl_begin.cxx -OpenGl_togl_begin_animation.cxx -OpenGl_togl_begin_immediat_mode.cxx -OpenGl_togl_begin_layer_mode.cxx -OpenGl_togl_bezier.cxx -OpenGl_togl_bezier_weight.cxx -OpenGl_togl_blink.cxx -OpenGl_togl_boundarybox.cxx -OpenGl_togl_cleargroup.cxx -OpenGl_togl_clearstructure.cxx -OpenGl_togl_cliplimit.cxx -OpenGl_togl_closegroup.cxx -OpenGl_togl_connect.cxx -OpenGl_togl_contextstructure.cxx -OpenGl_togl_curve.cxx -OpenGl_togl_deactivateview.cxx -OpenGl_togl_degeneratestructure.cxx -OpenGl_togl_depthcueing.cxx -OpenGl_togl_disconnect.cxx -OpenGl_togl_displaystructure.cxx -OpenGl_togl_element_exploration.cxx -OpenGl_togl_end.cxx -OpenGl_togl_erasestructure.cxx -OpenGl_togl_facecontextgroup.cxx -OpenGl_togl_group.cxx -OpenGl_togl_highlightcolor.cxx -OpenGl_togl_init_pick.cxx -OpenGl_togl_inquirefacilities.cxx -OpenGl_togl_inquirelight.cxx -OpenGl_togl_inquireplane.cxx -OpenGl_togl_inquireview.cxx -OpenGl_togl_light.cxx -OpenGl_togl_light_exploration.cxx -OpenGl_togl_linecontextgroup.cxx -OpenGl_togl_marker.cxx -OpenGl_togl_marker_set.cxx -OpenGl_togl_markercontextgroup.cxx -OpenGl_togl_namesetstructure.cxx -OpenGl_togl_opengroup.cxx -OpenGl_togl_pick.cxx -OpenGl_togl_pickid.cxx -OpenGl_togl_plane.cxx -OpenGl_togl_polygon.cxx -OpenGl_togl_polygon_holes.cxx -OpenGl_togl_polygon_indices.cxx -OpenGl_togl_polygon_set.cxx -OpenGl_togl_polyline.cxx -OpenGl_togl_print.cxx -OpenGl_togl_project_raster.cxx -OpenGl_togl_quadrangle.cxx -OpenGl_togl_ratio_window.cxx -OpenGl_togl_redraw.cxx -OpenGl_togl_removegroup.cxx -OpenGl_togl_removestructure.cxx -OpenGl_togl_removeview.cxx -OpenGl_togl_set_environment.cxx -OpenGl_togl_setlight.cxx -OpenGl_togl_setplane.cxx -OpenGl_togl_setvisualisation.cxx -OpenGl_togl_structure.cxx -OpenGl_togl_structure_exploration.cxx -OpenGl_togl_text.cxx -OpenGl_togl_textcontextgroup.cxx -OpenGl_togl_texture.cxx -OpenGl_togl_transformstructure.cxx -OpenGl_togl_transparency.cxx -OpenGl_togl_triangle.cxx -OpenGl_togl_triedron.cxx -OpenGl_togl_unproject_raster.cxx -OpenGl_togl_update.cxx -OpenGl_togl_view.cxx -OpenGl_togl_view_exploration.cxx -OpenGl_togl_viewmapping.cxx -OpenGl_togl_vieworientation.cxx -OpenGl_dotexturemap.cxx -OpenGl_texture.cxx -OpenGl_triedron.cxx -OpenGl_triedron.hxx -OpenGl_traces.hxx -OpenGl_togl_parray.cxx -OpenGl_PrimitiveArray.cxx -OpenGl_togl_depthtest.cxx -OpenGl_GraphicDriver_713.cxx -OpenGl_transform_persistence.cxx -OpenGl_transform_persistence.hxx -OpenGl_GraphicDriver_Export.cxx -OpenGl_textalignment.cxx -OpenGl_togl_userdraw.cxx -OpenGl_userdraw.cxx -OpenGl_callback.hxx -OpenGl_Memory.hxx -OpenGl_Memory.cxx -OpenGl_TextRender.hxx -OpenGl_TextRender.cxx -OpenGl_textzoomable.cxx -OpenGl_textangle.cxx -OpenGl_textfontaspect.cxx -OpenGl_togl_gradient_background.cxx -OpenGl_graduatedtrihedron.cxx -OpenGl_graduatedtrihedron.hxx -OpenGl_togl_graduatedtrihedron.cxx OpenGl_FrameBuffer.hxx OpenGl_FrameBuffer.cxx +OpenGl_TextureBox.cxx +OpenGl_TextureBox.hxx +OpenGl_ImageBox.cxx +OpenGl_ImageBox.hxx +OpenGl_Memory.hxx OpenGl_Resource.hxx -OpenGl_ResourceCleaner.cxx -OpenGl_ResourceCleaner.hxx -OpenGl_ResourceVBO.cxx OpenGl_ResourceVBO.hxx -OpenGl_ResourceTexture.cxx +OpenGl_ResourceVBO.cxx OpenGl_ResourceTexture.hxx -OpenGl_PrinterContext.cxx -OpenGl_PrinterContext.hxx +OpenGl_ResourceTexture.cxx +OpenGl_ResourceCleaner.hxx +OpenGl_ResourceCleaner.cxx +OpenGl_telem_util.hxx +OpenGl_telem_util.cxx +OpenGl_transform_persistence.hxx +OpenGl_FontMgr.hxx +OpenGl_FontMgr.cxx +OpenGl_tgl_funcs.hxx +OpenGl_togl_texture.cxx +OpenGl_togl_inquireplane.cxx +Handle_OpenGl_Context.hxx +OpenGl_Context.hxx +OpenGl_Context.cxx +OpenGl_ArbVBO.hxx +OpenGl_ExtFBO.hxx \ No newline at end of file diff --git a/src/OpenGl/Handle_OpenGl_Context.hxx b/src/OpenGl/Handle_OpenGl_Context.hxx new file mode 100644 index 0000000000..50e1b1c2f9 --- /dev/null +++ b/src/OpenGl/Handle_OpenGl_Context.hxx @@ -0,0 +1,15 @@ +// File: Handle_OpenGl_Context.hxx +// Created: 26 January 2012 +// Author: Kirill GAVRILOV +// Copyright: OPEN CASCADE 2012 + +#ifndef _Handle_OpenGl_Context_Header +#define _Handle_OpenGl_Context_Header + +#include +#include + +class OpenGl_Context; +DEFINE_STANDARD_HANDLE(OpenGl_Context, Standard_Transient) + +#endif // _Handle_OpenGl_Context_Header diff --git a/src/OpenGl/Handle_OpenGl_Display.hxx b/src/OpenGl/Handle_OpenGl_Display.hxx new file mode 100644 index 0000000000..58d8fe1331 --- /dev/null +++ b/src/OpenGl/Handle_OpenGl_Display.hxx @@ -0,0 +1,19 @@ +// File: Handle_OpenGl_Display.hxx +// Created: 20 September 2011 +// Author: Sergey ZERCHANINOV +// Copyright: OPEN CASCADE 2011 + +#ifndef _Handle_OpenGl_Display_Header +#define _Handle_OpenGl_Display_Header + +#include +#include + +class OpenGl_Display; + +// Handle definition +// +DEFINE_STANDARD_HANDLE(OpenGl_Display,MMgt_TShared) + + +#endif //_Handle_OpenGl_Display_Header diff --git a/src/OpenGl/Handle_OpenGl_GraduatedTrihedron.hxx b/src/OpenGl/Handle_OpenGl_GraduatedTrihedron.hxx new file mode 100644 index 0000000000..ab8f83481c --- /dev/null +++ b/src/OpenGl/Handle_OpenGl_GraduatedTrihedron.hxx @@ -0,0 +1,19 @@ +// File: Handle_OpenGl_GraduatedTrihedron.hxx +// Created: 20 September 2011 +// Author: Sergey ZERCHANINOV +// Copyright: OPEN CASCADE 2011 + +#ifndef _Handle_OpenGl_GraduatedTrihedron_Header +#define _Handle_OpenGl_GraduatedTrihedron_Header + +#include +#include + +class OpenGl_GraduatedTrihedron; + +// Handle definition +// +DEFINE_STANDARD_HANDLE(OpenGl_GraduatedTrihedron,MMgt_TShared) + + +#endif //_Handle_OpenGl_GraduatedTrihedron_Header diff --git a/src/OpenGl/Handle_OpenGl_GraphicDriver.hxx b/src/OpenGl/Handle_OpenGl_GraphicDriver.hxx new file mode 100644 index 0000000000..17818b388b --- /dev/null +++ b/src/OpenGl/Handle_OpenGl_GraphicDriver.hxx @@ -0,0 +1,18 @@ +// File: Handle_OpenGl_GraphicDriver.hxx +// Created: 20 October 2011 +// Author: Sergey ZERCHANINOV +// Copyright: OPEN CASCADE 2011 + +#ifndef _Handle_OpenGl_GraphicDriver_Header +#define _Handle_OpenGl_GraphicDriver_Header + +#include +#include + +class OpenGl_GraphicDriver; + +// Handle definition +// +DEFINE_STANDARD_HANDLE(OpenGl_GraphicDriver,Graphic3d_GraphicDriver) + +#endif //_Handle_OpenGl_GraphicDriver_Header diff --git a/src/OpenGl/Handle_OpenGl_Trihedron.hxx b/src/OpenGl/Handle_OpenGl_Trihedron.hxx new file mode 100644 index 0000000000..43426b893f --- /dev/null +++ b/src/OpenGl/Handle_OpenGl_Trihedron.hxx @@ -0,0 +1,19 @@ +// File: Handle_OpenGl_Trihedron.hxx +// Created: 20 September 2011 +// Author: Sergey ZERCHANINOV +// Copyright: OPEN CASCADE 2011 + +#ifndef _Handle_OpenGl_Trihedron_Header +#define _Handle_OpenGl_Trihedron_Header + +#include +#include + +class OpenGl_Trihedron; + +// Handle definition +// +DEFINE_STANDARD_HANDLE(OpenGl_Trihedron,MMgt_TShared) + + +#endif //_Handle_OpenGl_Trihedron_Header diff --git a/src/OpenGl/Handle_OpenGl_View.hxx b/src/OpenGl/Handle_OpenGl_View.hxx new file mode 100644 index 0000000000..8357a0e56f --- /dev/null +++ b/src/OpenGl/Handle_OpenGl_View.hxx @@ -0,0 +1,19 @@ +// File: Handle_OpenGl_View.hxx +// Created: 20 September 2011 +// Author: Sergey ZERCHANINOV +// Copyright: OPEN CASCADE 2011 + +#ifndef _Handle_OpenGl_View_Header +#define _Handle_OpenGl_View_Header + +#include +#include + +class OpenGl_View; + +// Handle definition +// +DEFINE_STANDARD_HANDLE(OpenGl_View,MMgt_TShared) + + +#endif //_Handle_OpenGl_View_Header diff --git a/src/OpenGl/Handle_OpenGl_Window.hxx b/src/OpenGl/Handle_OpenGl_Window.hxx new file mode 100644 index 0000000000..5d366a82c6 --- /dev/null +++ b/src/OpenGl/Handle_OpenGl_Window.hxx @@ -0,0 +1,19 @@ +// File: Handle_OpenGl_Window.hxx +// Created: 20 September 2011 +// Author: Sergey ZERCHANINOV +// Copyright: OPEN CASCADE 2011 + +#ifndef _Handle_OpenGl_Window_Header +#define _Handle_OpenGl_Window_Header + +#include +#include + +class OpenGl_Window; + +// Handle definition +// +DEFINE_STANDARD_HANDLE(OpenGl_Window,MMgt_TShared) + + +#endif //_Handle_OpenGl_Window_Header diff --git a/src/OpenGl/Handle_OpenGl_Workspace.hxx b/src/OpenGl/Handle_OpenGl_Workspace.hxx new file mode 100644 index 0000000000..93cda801cf --- /dev/null +++ b/src/OpenGl/Handle_OpenGl_Workspace.hxx @@ -0,0 +1,19 @@ +// File: Handle_OpenGl_Workspace.hxx +// Created: 20 September 2011 +// Author: Sergey ZERCHANINOV +// Copyright: OPEN CASCADE 2011 + +#ifndef _Handle_OpenGl_Workspace_Header +#define _Handle_OpenGl_Workspace_Header + +#include +#include + +class OpenGl_Workspace; + +// Handle definition +// +DEFINE_STANDARD_HANDLE(OpenGl_Workspace,OpenGl_Window) + + +#endif //_Handle_OpenGl_Workspace_Header diff --git a/src/OpenGl/OpenGl.cdl b/src/OpenGl/OpenGl.cdl deleted file mode 100755 index d30fea4a85..0000000000 --- a/src/OpenGl/OpenGl.cdl +++ /dev/null @@ -1,43 +0,0 @@ --- --- Package: OpenGl --- Author: CAL --- Created: Mercredi 4 Janvier 1995 --- Updated: 20/08/97 ; PCT : ajout texture mapping --- 27/01/98 ; FMN : Delete GEOMLITE --- --- Copyright: MatraDatavision 1995 --- --- Purpose: Specifications definitives --- - -package OpenGl - - ---Version: - - ---Purpose: This package contains the common OpenGl graphic interface. - - ---Keywords: OpenGl, CInterface - - ---Warning: No class in this package. It is used only to archive - -- all the objects files in a library. - ---References: - -uses - - OSD, - TColStd, - TCollection, - Aspect, - Quantity, - Graphic3d, - Image, - AlienImage - -is - - exception Error inherits NumericError from Standard; - - class GraphicDriver; - ---Purpose: Defines a graphic driver for the opengl interface - -end OpenGl; diff --git a/src/OpenGl/OpenGl_ArbVBO.hxx b/src/OpenGl/OpenGl_ArbVBO.hxx new file mode 100644 index 0000000000..4920684540 --- /dev/null +++ b/src/OpenGl/OpenGl_ArbVBO.hxx @@ -0,0 +1,45 @@ +// File: OpenGl_ArbVBO.hxx +// Created: 26 January 2012 +// Author: Kirill GAVRILOV +// Copyright: OPEN CASCADE 2012 + +#ifndef _OpenGl_ArbVBO_H__ +#define _OpenGl_ArbVBO_H__ + +#if (defined(_WIN32) || defined(__WIN32__)) + #include +#endif +#include + +typedef ptrdiff_t GLsizeiptr; + +//! VBO is part of OpenGL since 1.5 +struct OpenGl_ArbVBO +{ + #ifndef GL_ARRAY_BUFFER_ARB + #define GL_ARRAY_BUFFER_ARB 0x8892 + #endif + #ifndef GL_STATIC_DRAW_ARB + #define GL_STATIC_DRAW_ARB 0x88E4 + #endif + #ifndef GL_ELEMENTS_ARRAY_BUFFER_ARB + #define GL_ELEMENTS_ARRAY_BUFFER_ARB 0x8893 + #endif + +public: + + typedef void (APIENTRY *glBindBuffer_t) (GLenum target, GLuint buffer); + typedef void (APIENTRY *glDeleteBuffers_t) (GLsizei n, const GLuint* buffers); + typedef void (APIENTRY *glGenBuffers_t) (GLsizei n, GLuint* buffers); + typedef void (APIENTRY *glBufferData_t) (GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage); + +public: + + glGenBuffers_t glGenBuffersARB; + glBindBuffer_t glBindBufferARB; + glBufferData_t glBufferDataARB; + glDeleteBuffers_t glDeleteBuffersARB; + +}; + +#endif // _OpenGl_ArbVBO_H__ diff --git a/src/OpenGl/OpenGl_AspectFace.cxx b/src/OpenGl/OpenGl_AspectFace.cxx new file mode 100644 index 0000000000..89a0668233 --- /dev/null +++ b/src/OpenGl/OpenGl_AspectFace.cxx @@ -0,0 +1,217 @@ +// File: OpenGl_AspectFace.cxx +// Created: 13 July 2011 +// Author: Sergey ZERCHANINOV +// Copyright: OPEN CASCADE 2011 + +#include + +#include +#include + +/*----------------------------------------------------------------------*/ + +static const TEL_CONTEXT_FACE myDefaultAspectFace = +{ + Aspect_IS_SOLID, + TOn, TEL_HS_SOLID, TOn, TelCullNone, + { 0.2F, 0.8F, 0.1F, 0.0F, /* amb, diff, spec, emsv */ + 1.0F, 10.0F, 0.0F, /* trans, shine, env_reflexion */ + 0, /* isphysic */ + (OPENGL_AMBIENT_MASK | OPENGL_DIFFUSE_MASK | OPENGL_SPECULAR_MASK), /* color_mask */ + {{ 1.0F, 1.0F, 1.0F, 1.0F }}, /* ambient color */ + {{ 1.0F, 1.0F, 1.0F, 1.0F }}, /* diffuse color */ + {{ 1.0F, 1.0F, 1.0F, 1.0F }}, /* specular color */ + {{ 1.0F, 1.0F, 1.0F, 1.0F }}, /* emissive color */ + {{ 1.0F, 1.0F, 1.0F, 1.0F }} /* material color */ + }, + { 0.2F, 0.8F, 0.1F, 0.0F, /* amb, diff, spec, emsv */ + 1.0F, 10.0F, 0.0F, /* trans, shine, env_reflexion */ + 0, /* isphysic */ + (OPENGL_AMBIENT_MASK | OPENGL_DIFFUSE_MASK | OPENGL_SPECULAR_MASK), /* color_mask */ + {{ 1.0F, 1.0F, 1.0F, 1.0F }}, /* ambient color */ + {{ 1.0F, 1.0F, 1.0F, 1.0F }}, /* diffuse color */ + {{ 1.0F, 1.0F, 1.0F, 1.0F }}, /* specular color */ + {{ 1.0F, 1.0F, 1.0F, 1.0F }}, /* emissive color */ + {{ 1.0F, 1.0F, 1.0F, 1.0F }} /* material color */ + }, + 0, -1, { Aspect_POM_Fill, 1.0F, 0.0F } +}; + +/*----------------------------------------------------------------------*/ + +static void ConvertMaterial (const CALL_DEF_MATERIAL &material, OPENGL_SURF_PROP &surface) +{ + /* Cas par cas pour l evaluation */ + surface.amb = material.IsAmbient? material.Ambient : 0.F; + surface.diff = material.IsDiffuse? material.Diffuse : 0.F; + surface.spec = material.IsSpecular? material.Specular : 0.F; + surface.emsv = material.IsEmission? material.Emission : 0.F; + + /* type de materiel */ + surface.isphysic = material.IsPhysic? 1 : 0; + + /* Couleur du materiel */ + surface.color_mask = 0; + if ( material.IsAmbient ) + surface.color_mask |= OPENGL_AMBIENT_MASK; + if ( material.IsDiffuse ) + surface.color_mask |= OPENGL_DIFFUSE_MASK; + if ( material.IsSpecular ) + surface.color_mask |= OPENGL_SPECULAR_MASK; + if ( material.IsEmission ) + surface.color_mask |= OPENGL_EMISSIVE_MASK; + + /* Couleur eclairage ambient */ + surface.ambcol.rgb[0] = material.ColorAmb.r; + surface.ambcol.rgb[1] = material.ColorAmb.g; + surface.ambcol.rgb[2] = material.ColorAmb.b; + surface.ambcol.rgb[3] = 1.F; + + /* Couleur eclairage diffus */ + surface.difcol.rgb[0] = material.ColorDif.r; + surface.difcol.rgb[1] = material.ColorDif.g; + surface.difcol.rgb[2] = material.ColorDif.b; + surface.difcol.rgb[3] = 1.F; + + /* Couleur eclairage speculaire */ + surface.speccol.rgb[0] = material.ColorSpec.r; + surface.speccol.rgb[1] = material.ColorSpec.g; + surface.speccol.rgb[2] = material.ColorSpec.b; + surface.speccol.rgb[3] = 1.F; + + /* Couleur d emission */ + surface.emscol.rgb[0] = material.ColorEms.r; + surface.emscol.rgb[1] = material.ColorEms.g; + surface.emscol.rgb[2] = material.ColorEms.b; + surface.emscol.rgb[3] = 1.F; + + surface.shine = ( float )128 * material.Shininess; + surface.env_reflexion = material.EnvReflexion; + + /* Dans la couche C++ : + * prop->trans = 0. => opaque + * prop->trans = 1. => transparent + * in OpenGl it is opposite. + */ + surface.trans = 1.0F - material.Transparency; +} + +/*----------------------------------------------------------------------*/ + +OpenGl_AspectFace::OpenGl_AspectFace () + : myContext(myDefaultAspectFace) +{} + +/*----------------------------------------------------------------------*/ + +void OpenGl_AspectFace::SetContext (const CALL_DEF_CONTEXTFILLAREA &AContext) +{ + //TelInteriorStyle + myContext.InteriorStyle = (Aspect_InteriorStyle) AContext.Style; + + //TelEdgeFlag + myContext.Edge = AContext.Edge ? TOn : TOff; + + //TelInteriorStyleIndex + switch( AContext.Hatch ) + { + case 0 : /* Aspect_HS_HORIZONTAL */ + myContext.Hatch = TEL_HS_HORIZONTAL; + break; + case 1 : /* Aspect_HS_HORIZONTAL_WIDE */ + myContext.Hatch = TEL_HS_HORIZONTAL_SPARSE; + break; + case 2 : /* Aspect_HS_VERTICAL */ + myContext.Hatch = TEL_HS_VERTICAL; + break; + case 3 : /* Aspect_HS_VERTICAL_WIDE */ + myContext.Hatch = TEL_HS_VERTICAL_SPARSE; + break; + case 4 : /* Aspect_HS_DIAGONAL_45 */ + myContext.Hatch = TEL_HS_DIAG_45; + break; + case 5 : /* Aspect_HS_DIAGONAL_45_WIDE */ + myContext.Hatch = TEL_HS_DIAG_45_SPARSE; + break; + case 6 : /* Aspect_HS_DIAGONAL_135 */ + myContext.Hatch = TEL_HS_DIAG_135; + break; + case 7 : /* Aspect_HS_DIAGONAL_135_WIDE */ + myContext.Hatch = TEL_HS_DIAG_135_SPARSE; + break; + case 8 : /* Aspect_HS_GRID */ + myContext.Hatch = TEL_HS_GRID; + break; + case 9 : /* Aspect_HS_GRID_WIDE */ + myContext.Hatch = TEL_HS_GRID_SPARSE; + break; + case 10 : /* Aspect_HS_GRID_DIAGONAL */ + myContext.Hatch = TEL_HS_CROSS; + break; + case 11 : /* Aspect_HS_GRID_DIAGONAL_WIDE */ + myContext.Hatch = TEL_HS_CROSS_SPARSE; + break; + default : + myContext.Hatch = 0; + break; + } + + //TelFaceDistinguishingMode + myContext.DistinguishingMode = AContext.Distinguish ? TOn : TOff; + + //TelFaceCullingMode + myContext.CullingMode = AContext.BackFace ? TelCullBack : TelCullNone; + + //TelSurfaceAreaProperties + ConvertMaterial(AContext.Front,myContext.IntFront); + + //TelBackSurfaceAreaProperties + ConvertMaterial(AContext.Back,myContext.IntBack); + + //TelInteriorColour + myContext.IntFront.matcol.rgb[0] = (float) AContext.IntColor.r; + myContext.IntFront.matcol.rgb[1] = (float) AContext.IntColor.g; + myContext.IntFront.matcol.rgb[2] = (float) AContext.IntColor.b; + myContext.IntFront.matcol.rgb[3] = 1.f; + + //TelBackInteriorColour + myContext.IntBack.matcol.rgb[0] = (float) AContext.BackIntColor.r; + myContext.IntBack.matcol.rgb[1] = (float) AContext.BackIntColor.g; + myContext.IntBack.matcol.rgb[2] = (float) AContext.BackIntColor.b; + myContext.IntBack.matcol.rgb[3] = 1.f; + + //TelDoTextureMap + myContext.doTextureMap = AContext.Texture.doTextureMap; + + //TelTextureId + myContext.TexId = AContext.Texture.TexId; + + //TelPolygonOffset + myContext.PolygonOffset.mode = (Aspect_PolygonOffsetMode) AContext.PolygonOffsetMode; + myContext.PolygonOffset.factor = AContext.PolygonOffsetFactor; + myContext.PolygonOffset.units = AContext.PolygonOffsetUnits; + + CALL_DEF_CONTEXTLINE anEdgeContext; + + //TelEdgeColour + anEdgeContext.Color.r = (float) AContext.EdgeColor.r; + anEdgeContext.Color.g = (float) AContext.EdgeColor.g; + anEdgeContext.Color.b = (float) AContext.EdgeColor.b; + + //TelEdgeType + anEdgeContext.LineType = (Aspect_TypeOfLine) AContext.LineType; + + //TelEdgeWidth + anEdgeContext.Width = (float) AContext.Width; + + myAspectEdge.SetContext(anEdgeContext); +} + +/*----------------------------------------------------------------------*/ + +void OpenGl_AspectFace::Render (const Handle(OpenGl_Workspace) &AWorkspace) const +{ + AWorkspace->SetAspectFace(this); +} + +/*----------------------------------------------------------------------*/ diff --git a/src/OpenGl/OpenGl_AspectFace.hxx b/src/OpenGl/OpenGl_AspectFace.hxx new file mode 100644 index 0000000000..3dae10ac97 --- /dev/null +++ b/src/OpenGl/OpenGl_AspectFace.hxx @@ -0,0 +1,73 @@ +// File: OpenGl_AspectFace.hxx +// Created: 13 July 2011 +// Author: Sergey ZERCHANINOV +// Copyright: OPEN CASCADE 2011 + +#ifndef _OpenGl_AspectFace_Header +#define _OpenGl_AspectFace_Header + +#include +#include + +#include + +#define OPENGL_AMBIENT_MASK (1<<0) +#define OPENGL_DIFFUSE_MASK (1<<1) +#define OPENGL_SPECULAR_MASK (1<<2) +#define OPENGL_EMISSIVE_MASK (1<<3) + +struct OPENGL_SURF_PROP +{ + float amb, diff, spec, emsv; + float trans, shine; + float env_reflexion; + int isphysic; + unsigned int color_mask; + TEL_COLOUR speccol, difcol, ambcol, emscol, matcol; + IMPLEMENT_MEMORY_OPERATORS +}; + +struct TEL_CONTEXT_FACE +{ + Aspect_InteriorStyle InteriorStyle; + int Edge; + int Hatch; + int DistinguishingMode; + int CullingMode; + OPENGL_SURF_PROP IntFront; + OPENGL_SURF_PROP IntBack; + int doTextureMap; + int TexId; + TEL_POFFSET_PARAM PolygonOffset; + IMPLEMENT_MEMORY_OPERATORS +}; + +#include + +class OpenGl_AspectFace : public OpenGl_Element +{ + public: + + OpenGl_AspectFace (); + virtual ~OpenGl_AspectFace () {} + + void SetContext (const CALL_DEF_CONTEXTFILLAREA &AContext); + + void SetContext (const TEL_CONTEXT_FACE &AContext) { myContext = AContext; } + void SetAspectEdge (const OpenGl_AspectLine * AnAspectEdge) { myAspectEdge = *AnAspectEdge; } + + const TEL_CONTEXT_FACE & Context() const { return myContext; } + const OpenGl_AspectLine * AspectEdge() const { return &myAspectEdge; } + + virtual void Render (const Handle(OpenGl_Workspace) &AWorkspace) const; + + protected: + + TEL_CONTEXT_FACE myContext; + OpenGl_AspectLine myAspectEdge; + + public: + IMPLEMENT_MEMORY_OPERATORS +}; + +#endif //_OpenGl_AspectFace_Header diff --git a/src/OpenGl/OpenGl_AspectLine.cxx b/src/OpenGl/OpenGl_AspectLine.cxx new file mode 100644 index 0000000000..1e559e4dd1 --- /dev/null +++ b/src/OpenGl/OpenGl_AspectLine.cxx @@ -0,0 +1,45 @@ +// File: OpenGl_AspectLine.cxx +// Created: 13 July 2011 +// Author: Sergey ZERCHANINOV +// Copyright: OPEN CASCADE 2011 + +#include + +static const TEL_COLOUR myDefaultColor = {{ 1.0F, 1.0F, 1.0F, 1.0F }}; + +/*----------------------------------------------------------------------*/ + +OpenGl_AspectLine::OpenGl_AspectLine () + : myColor(myDefaultColor), + myType(Aspect_TOL_SOLID), + myWidth(1.0F) +{} + +/*----------------------------------------------------------------------*/ + +OpenGl_AspectLine::OpenGl_AspectLine (const OpenGl_AspectLine &AnOther) + : myColor(AnOther.myColor), + myType(AnOther.myType), + myWidth(AnOther.myWidth) +{} + +/*----------------------------------------------------------------------*/ + +void OpenGl_AspectLine::SetContext (const CALL_DEF_CONTEXTLINE &AContext) +{ + myColor.rgb[0] = (float) AContext.Color.r; + myColor.rgb[1] = (float) AContext.Color.g; + myColor.rgb[2] = (float) AContext.Color.b; + myColor.rgb[3] = 1.0f; + myType = (Aspect_TypeOfLine) AContext.LineType; + myWidth = (float) AContext.Width; +} + +/*----------------------------------------------------------------------*/ + +void OpenGl_AspectLine::Render (const Handle(OpenGl_Workspace) &AWorkspace) const +{ + AWorkspace->SetAspectLine(this); +} + +/*----------------------------------------------------------------------*/ diff --git a/src/OpenGl/OpenGl_AspectLine.hxx b/src/OpenGl/OpenGl_AspectLine.hxx new file mode 100644 index 0000000000..2e820ec8dc --- /dev/null +++ b/src/OpenGl/OpenGl_AspectLine.hxx @@ -0,0 +1,40 @@ +// File: OpenGl_AspectLine.hxx +// Created: 13 July 2011 +// Author: Sergey ZERCHANINOV +// Copyright: OPEN CASCADE 2011 + +#ifndef _OpenGl_AspectLine_Header +#define _OpenGl_AspectLine_Header + +#include +#include + +#include + +class OpenGl_AspectLine : public OpenGl_Element +{ + public: + + OpenGl_AspectLine (); + OpenGl_AspectLine (const OpenGl_AspectLine &AnOther); + virtual ~OpenGl_AspectLine () {} + + void SetContext (const CALL_DEF_CONTEXTLINE &AContext); + + const TEL_COLOUR & Color() const { return myColor; } + Aspect_TypeOfLine Type() const { return myType; } + float Width() const { return myWidth; } + + virtual void Render (const Handle(OpenGl_Workspace) &AWorkspace) const; + + protected: + + TEL_COLOUR myColor; + Aspect_TypeOfLine myType; + float myWidth; + + public: + IMPLEMENT_MEMORY_OPERATORS +}; + +#endif //_OpenGl_AspectLine_Header diff --git a/src/OpenGl/OpenGl_AspectMarker.cxx b/src/OpenGl/OpenGl_AspectMarker.cxx new file mode 100644 index 0000000000..f74a7f66d9 --- /dev/null +++ b/src/OpenGl/OpenGl_AspectMarker.cxx @@ -0,0 +1,37 @@ +// File: OpenGl_AspectMarker.cxx +// Created: 14 July 2011 +// Author: Sergey ZERCHANINOV +// Copyright: OPEN CASCADE 2011 + +#include + +static const TEL_COLOUR myDefaultColor = {{ 1.0F, 1.0F, 1.0F, 1.0F }}; + +/*----------------------------------------------------------------------*/ + +OpenGl_AspectMarker::OpenGl_AspectMarker () + : myColor(myDefaultColor), + myType(Aspect_TOM_PLUS), + myScale(1.0F) +{} + +/*----------------------------------------------------------------------*/ + +void OpenGl_AspectMarker::SetContext (const CALL_DEF_CONTEXTMARKER &AContext) +{ + myColor.rgb[0] = (float) AContext.Color.r; + myColor.rgb[1] = (float) AContext.Color.g; + myColor.rgb[2] = (float) AContext.Color.b; + myColor.rgb[3] = 1.0f; + myType = (Aspect_TypeOfMarker) AContext.MarkerType; + myScale = (float) AContext.Scale; +} + +/*----------------------------------------------------------------------*/ + +void OpenGl_AspectMarker::Render (const Handle(OpenGl_Workspace) &AWorkspace) const +{ + AWorkspace->SetAspectMarker(this); +} + +/*----------------------------------------------------------------------*/ diff --git a/src/OpenGl/OpenGl_AspectMarker.hxx b/src/OpenGl/OpenGl_AspectMarker.hxx new file mode 100644 index 0000000000..56136673ab --- /dev/null +++ b/src/OpenGl/OpenGl_AspectMarker.hxx @@ -0,0 +1,39 @@ +// File: OpenGl_AspectMarker.hxx +// Created: 13 July 2011 +// Author: Sergey ZERCHANINOV +// Copyright: OPEN CASCADE 2011 + +#ifndef OpenGl_AspectMarker_Header +#define OpenGl_AspectMarker_Header + +#include +#include + +#include + +class OpenGl_AspectMarker : public OpenGl_Element +{ + public: + + OpenGl_AspectMarker (); + virtual ~OpenGl_AspectMarker () {} + + void SetContext (const CALL_DEF_CONTEXTMARKER &AContext); + + const TEL_COLOUR & Color() const { return myColor; } + Aspect_TypeOfMarker Type() const { return myType; } + float Scale() const { return myScale; } + + virtual void Render (const Handle(OpenGl_Workspace) &AWorkspace) const; + + protected: + + TEL_COLOUR myColor; + Aspect_TypeOfMarker myType; + float myScale; + + public: + IMPLEMENT_MEMORY_OPERATORS +}; + +#endif //OpenGl_AspectMarker_Header diff --git a/src/OpenGl/OpenGl_AspectText.cxx b/src/OpenGl/OpenGl_AspectText.cxx new file mode 100644 index 0000000000..8c6f6c0368 --- /dev/null +++ b/src/OpenGl/OpenGl_AspectText.cxx @@ -0,0 +1,76 @@ +// File: OpenGl_AspectText.cxx +// Created: 13 July 2011 +// Author: Sergey ZERCHANINOV +// Copyright: OPEN CASCADE 2011 + +#include + +static const TEL_COLOUR myDefaultColor = {{ 1.0F, 1.0F, 1.0F, 1.0F }}; + +/*----------------------------------------------------------------------*/ + +OpenGl_AspectText::OpenGl_AspectText () + : myZoomable(0), + myAngle(0.0F), + myFontAspect(OSD_FA_Regular), + myFont(NULL), + //mySpace(0.3F), + //myExpan(1.0F), + myColor(myDefaultColor), + myStyleType(Aspect_TOST_NORMAL), + myDisplayType(Aspect_TODT_NORMAL), + mySubtitleColor(myDefaultColor) +{ + SetFontName( (const char *) "Courier" ); +} + +/*----------------------------------------------------------------------*/ + +OpenGl_AspectText::~OpenGl_AspectText () +{ + if (myFont) + delete[] myFont; +} + +/*----------------------------------------------------------------------*/ + +void OpenGl_AspectText::SetContext (const CALL_DEF_CONTEXTTEXT &AContext) +{ + myZoomable = (int) AContext.TextZoomable; + myAngle = (float) AContext.TextAngle; + myFontAspect = (OSD_FontAspect) AContext.TextFontAspect; + //mySpace = (float) AContext.Space; + //myExpan = (float) AContext.Expan; + myColor.rgb[0] = (float) AContext.Color.r; + myColor.rgb[1] = (float) AContext.Color.g; + myColor.rgb[2] = (float) AContext.Color.b; + myColor.rgb[3] = 1.0f; + myStyleType = (Aspect_TypeOfStyleText) AContext.Style; + myDisplayType = (Aspect_TypeOfDisplayText) AContext.DisplayType; + mySubtitleColor.rgb[0] = (float) AContext.ColorSubTitle.r; + mySubtitleColor.rgb[1] = (float) AContext.ColorSubTitle.g; + mySubtitleColor.rgb[2] = (float) AContext.ColorSubTitle.b; + mySubtitleColor.rgb[3] = 1.0f; + + SetFontName( (const char *) AContext.Font ); +} + +/*----------------------------------------------------------------------*/ + +void OpenGl_AspectText::Render (const Handle(OpenGl_Workspace) &AWorkspace) const +{ + AWorkspace->SetAspectText(this); +} + +/*----------------------------------------------------------------------*/ + +void OpenGl_AspectText::SetFontName (const char *AFont) +{ + if (myFont) + delete[] myFont; + char *fontname = new char[ strlen( AFont ) + 1 ]; + strcpy( fontname, AFont ); + myFont = fontname; +} + +/*----------------------------------------------------------------------*/ diff --git a/src/OpenGl/OpenGl_AspectText.hxx b/src/OpenGl/OpenGl_AspectText.hxx new file mode 100644 index 0000000000..516d27866d --- /dev/null +++ b/src/OpenGl/OpenGl_AspectText.hxx @@ -0,0 +1,55 @@ +// File: OpenGl_AspectText.hxx +// Created: 13 July 2011 +// Author: Sergey ZERCHANINOV +// Copyright: OPEN CASCADE 2011 + +#ifndef OpenGl_AspectText_Header +#define OpenGl_AspectText_Header + +#include +#include +#include +#include + +#include + +class OpenGl_AspectText : public OpenGl_Element +{ + public: + + OpenGl_AspectText (); + virtual ~OpenGl_AspectText (); + + void SetContext (const CALL_DEF_CONTEXTTEXT &AContext); + + int IsZoomable() const { return myZoomable; } + float Angle() const { return myAngle; } + OSD_FontAspect FontAspect() const { return myFontAspect; } + const char * Font() const { return myFont; } + const TEL_COLOUR & Color() const { return myColor; } + Aspect_TypeOfStyleText StyleType() const { return myStyleType; } + Aspect_TypeOfDisplayText DisplayType() const { return myDisplayType; } + const TEL_COLOUR & SubtitleColor() const { return mySubtitleColor; } + + virtual void Render (const Handle(OpenGl_Workspace) &AWorkspace) const; + + protected: + + void SetFontName (const char *AFont); + + int myZoomable; + float myAngle; + OSD_FontAspect myFontAspect; + const char *myFont; + //float mySpace; + //float myExpan; + TEL_COLOUR myColor; + Aspect_TypeOfStyleText myStyleType; + Aspect_TypeOfDisplayText myDisplayType; + TEL_COLOUR mySubtitleColor; + + public: + IMPLEMENT_MEMORY_OPERATORS +}; + +#endif //OpenGl_AspectText_Header diff --git a/src/OpenGl/OpenGl_CMPLRS.edl b/src/OpenGl/OpenGl_CMPLRS.edl index 22026b9353..a33aba0de6 100755 --- a/src/OpenGl/OpenGl_CMPLRS.edl +++ b/src/OpenGl/OpenGl_CMPLRS.edl @@ -1,10 +1,8 @@ -- --- File: OpenGl_CMPLRS.edl --- Author: Stephane Callegari --- History: 13-12-96 : CAL : Creation --- 01-11-97 : BGN : Portage HP/OpenGL --- (avec option +a1 pour C++, et -Aa pour C) --- Copyright: Matra Datavision 1996 +-- File: OpenGl_CMPLRS.edl +-- Author: Stephane Callegari +-- History: 13-12-96 : CAL : Creation +-- Copyright: Matra Datavision 1996 -- @ifnotdefined ( %OpenGl_CMPLRS_EDL) then @@ -16,28 +14,4 @@ @string %CMPLRS_CXX_Options += %CSF_X11_INCLUDE " " %CSF_OPENGL_INCLUDE " " %CSF_FTGL_INCLUDES " " %CSF_FREETYPE_INCLUDES " " %CSF_GL2PS_INCLUDES " "; @string %CMPLRS_C_Options += %CSF_X11_INCLUDE " " %CSF_OPENGL_INCLUDE " " %CSF_FTGL_INCLUDES " " %CSF_FREETYPE_INCLUDES " " %CSF_GL2PS_INCLUDES " "; - @if ( %Station == "hp" ) then - - @string %CMPLRS_C_Options += " -D_HPUX_SOURCE"; - - @if ( %DebugMode == "False" ) then - @set %CMPLRS_C_ModeOpt = "+O1 -DNo_Exception "; - @set %CMPLRS_F77_ModeOpt = "+O1"; - @endif; - - @endif; - - @if ( %Station == "ao1" ) then - - @string %CMPLRS_C_Options += " -DJWR_DEC_TRIFAN_BUG"; - @string %CMPLRS_C_Options += " -std1"; - - @endif; - - -- FMN @string %CMPLRS_C_Options += " -DLMC_COLOR"; - @string %CMPLRS_C_Options += " -DSILGL -DSILGL_VRS=50"; - - - @endif; - diff --git a/src/OpenGl/OpenGl_CView.hxx b/src/OpenGl/OpenGl_CView.hxx new file mode 100644 index 0000000000..04c29a088f --- /dev/null +++ b/src/OpenGl/OpenGl_CView.hxx @@ -0,0 +1,21 @@ +// File: OpenGl_CView.hxx +// Created: 20 September 2011 +// Author: Sergey ZERCHANINOV +// Copyright: OPEN CASCADE 2011 + +#ifndef OpenGl_CView_Header +#define OpenGl_CView_Header + +#include + +#include +#include + +struct OpenGl_CView +{ + Handle_OpenGl_Workspace WS; + Handle_OpenGl_View View; + IMPLEMENT_MEMORY_OPERATORS +}; + +#endif //OpenGl_CView_Header diff --git a/src/OpenGl/OpenGl_Callback.hxx b/src/OpenGl/OpenGl_Callback.hxx new file mode 100644 index 0000000000..357ef57da0 --- /dev/null +++ b/src/OpenGl/OpenGl_Callback.hxx @@ -0,0 +1,17 @@ +// File: OpenGl_Callback.hxx +// Created: 25 October 2011 +// Author: Sergey ZERCHANINOV +// Copyright: OPEN CASCADE 2011 + +#ifndef _OpenGl_Callback_HeaderFile +#define _OpenGl_Callback_HeaderFile + +#include + +#include + +typedef OpenGl_Element * (*OpenGl_UserDrawCallback)(const CALL_DEF_USERDRAW *); + +Standard_EXPORT OpenGl_UserDrawCallback & UserDrawCallback (); + +#endif //_OpenGl_Callback_HeaderFile diff --git a/src/OpenGl/OpenGl_Context.cxx b/src/OpenGl/OpenGl_Context.cxx new file mode 100644 index 0000000000..36b653e2b7 --- /dev/null +++ b/src/OpenGl/OpenGl_Context.cxx @@ -0,0 +1,105 @@ +// File: OpenGl_Context.cxx +// Created: 26 January 2012 +// Author: Kirill GAVRILOV +// Copyright: OPEN CASCADE 2012 + +#include + +IMPLEMENT_STANDARD_HANDLE (OpenGl_Context, Standard_Transient) +IMPLEMENT_STANDARD_RTTIEXT(OpenGl_Context, Standard_Transient) + +#if (!defined(_WIN32) && !defined(__WIN32__)) + #include +#endif + +// ======================================================================= +// function : OpenGl_Context +// purpose : +// ======================================================================= +OpenGl_Context::OpenGl_Context() +: arbVBO (NULL), + extFBO (NULL) +{ + // +} + +// ======================================================================= +// function : ~OpenGl_Context +// purpose : +// ======================================================================= +OpenGl_Context::~OpenGl_Context() +{ + // +} + +// ======================================================================= +// function : CheckExtension +// purpose : +// ======================================================================= +Standard_Boolean OpenGl_Context::CheckExtension (const char* theExtName, + const char* theExtString) +{ + if (theExtName == NULL + || theExtString == NULL) { + std::cerr << "CheckExtension called with NULL string! No GL context?\n"; + return Standard_False; + } + + // Search for theExtName in the extensions string. + // Use of strstr() is not sufficient because extension names can be prefixes of other extension names. + char* aPtrIter = (char* )theExtString; + int anExtNameLen = strlen(theExtName); + const char* aPtrEnd = aPtrIter + strlen(theExtString); + + while (aPtrIter < aPtrEnd) + { + int n = strcspn (aPtrIter, " "); + if ((n == anExtNameLen) && (strncmp (theExtName, aPtrIter, n) == 0)) + return Standard_True; + + aPtrIter += (n + 1); + } + return Standard_False; +} + +// ======================================================================= +// function : Init +// purpose : +// ======================================================================= +void OpenGl_Context::Init() +{ + const char* anExtString = (const char* )glGetString (GL_EXTENSIONS); + if (CheckExtension ("GL_ARB_vertex_buffer_object", anExtString)) + { + arbVBO = new OpenGl_ArbVBO(); + memset(arbVBO, 0, sizeof(OpenGl_ArbVBO)); // nullify whole structure for safety + if (!FindProc ("glGenBuffersARB", arbVBO->glGenBuffersARB) + || !FindProc ("glBindBufferARB", arbVBO->glBindBufferARB) + || !FindProc ("glBufferDataARB", arbVBO->glBufferDataARB) + || !FindProc ("glDeleteBuffersARB", arbVBO->glDeleteBuffersARB)) + { + delete arbVBO; + arbVBO = NULL; + } + } + + if (CheckExtension ("GL_EXT_framebuffer_object", anExtString)) + { + extFBO = new OpenGl_ExtFBO(); + memset(extFBO, 0, sizeof(OpenGl_ExtFBO)); // nullify whole structure for safety + if (!FindProc ("glGenFramebuffersEXT", extFBO->glGenFramebuffersEXT) + || !FindProc ("glDeleteFramebuffersEXT", extFBO->glDeleteFramebuffersEXT) + || !FindProc ("glBindFramebufferEXT", extFBO->glBindFramebufferEXT) + || !FindProc ("glFramebufferTexture2DEXT", extFBO->glFramebufferTexture2DEXT) + || !FindProc ("glCheckFramebufferStatusEXT", extFBO->glCheckFramebufferStatusEXT) + || !FindProc ("glGenRenderbuffersEXT", extFBO->glGenRenderbuffersEXT) + || !FindProc ("glDeleteRenderbuffersEXT", extFBO->glDeleteRenderbuffersEXT) + || !FindProc ("glBindRenderbufferEXT", extFBO->glBindRenderbufferEXT) + || !FindProc ("glRenderbufferStorageEXT", extFBO->glRenderbufferStorageEXT) + || !FindProc ("glFramebufferRenderbufferEXT", extFBO->glFramebufferRenderbufferEXT)) + { + delete extFBO; + extFBO = NULL; + } + } +} diff --git a/src/OpenGl/OpenGl_Context.hxx b/src/OpenGl/OpenGl_Context.hxx new file mode 100644 index 0000000000..a83af275b1 --- /dev/null +++ b/src/OpenGl/OpenGl_Context.hxx @@ -0,0 +1,61 @@ +// File: OpenGl_Context.hxx +// Created: 26 January 2012 +// Author: Kirill GAVRILOV +// Copyright: OPEN CASCADE 2012 + +#ifndef _OpenGl_Context_H__ +#define _OpenGl_Context_H__ + +#include +#include +#include +#include + +#if (!defined(_WIN32) && !defined(__WIN32__)) + extern "C" { + extern void (*glXGetProcAddress (const GLubyte* theProcName))(); + } +#endif + +//! This class provide access to the GL context and available extensions. +class OpenGl_Context : public Standard_Transient +{ +public: + + OpenGl_Context(); + virtual ~OpenGl_Context(); + + //! Initialize available extensions. + //! GL context should be active! + void Init(); + + //! Parse theExtString string for presence of theExtName extension. + static Standard_Boolean CheckExtension (const char* theExtName, + const char* theExtString); + + //! Auxiliary template to retrieve GL function pointer. + //! The context should be bound before call. + template + bool FindProc (const char* theFuncName, + FuncType_t& theFuncPtr) + { + #if (defined(_WIN32) || defined(__WIN32__)) + theFuncPtr = (FuncType_t )wglGetProcAddress (theFuncName); + #else + theFuncPtr = (FuncType_t )glXGetProcAddress ((const GLubyte* )theFuncName); + #endif + return (theFuncPtr != NULL); + } + +public: + + OpenGl_ArbVBO* arbVBO; + OpenGl_ExtFBO* extFBO; + +public: + + DEFINE_STANDARD_RTTI(OpenGl_Window) // Type definition + +}; + +#endif // _OpenGl_Context_H__ diff --git a/src/OpenGl/OpenGl_Display.cxx b/src/OpenGl/OpenGl_Display.cxx new file mode 100644 index 0000000000..ffbba57af2 --- /dev/null +++ b/src/OpenGl/OpenGl_Display.cxx @@ -0,0 +1,299 @@ +// File: OpenGl_Display.cxx +// Created: 20 September 2011 +// Author: Sergey ZERCHANINOV +// Copyright: OPEN CASCADE 2011 + +#include + +#include +#include +#include + +#include +#include + +#include + +IMPLEMENT_STANDARD_HANDLE(OpenGl_Display,MMgt_TShared) +IMPLEMENT_STANDARD_RTTIEXT(OpenGl_Display,MMgt_TShared) + +Handle(OpenGl_Display) openglDisplay; + +namespace +{ + #if (defined(_WIN32) || defined(__WIN32__)) + static char* TheDummyDisplay = "DISPLAY"; + #endif + + static const OpenGl_Facilities myDefaultFacilities = { 1, 1, 1, 1, OpenGLMaxLights, 10000 }; +}; + +/*----------------------------------------------------------------------*/ + +OpenGl_Display::OpenGl_Display (const Standard_CString theDisplay) +: myDisplay(NULL), + myFacilities(myDefaultFacilities), + myDBuffer(Standard_True), + myDither(Standard_True), + myBackDither(Standard_False), + myWalkthrough(Standard_False), + mySymPerspective(Standard_False), + myOffsetFactor(1.F), + myOffsetUnits(0.F), + myAntiAliasingMode(3), + myLinestyleBase(0), + myPatternBase(0), + myMarkerBase(0), + myFont(-1), + myFontSize(-1) +{ +#if (defined(_WIN32) || defined(__WIN32__)) + myDisplay = TheDummyDisplay; +#else + if (theDisplay != NULL && *theDisplay != '\0') + { + OSD_Environment aDispEnv ("DISPLAY", theDisplay); + aDispEnv.Build(); + } + + // Specifies the hardware display name, which determines the + // display and communications domain to be used. + // On a POSIX system, if the display_name is NULL, it defaults + // to the value of the DISPLAY environment variable. + myDisplay = XOpenDisplay (NULL); +#endif + + Init(); +} + +/*----------------------------------------------------------------------*/ + +OpenGl_Display::OpenGl_Display (const Aspect_Display theDisplay) +: myDisplay(NULL), + myFacilities(myDefaultFacilities), + myDBuffer(Standard_True), + myDither(Standard_True), + myBackDither(Standard_False), + myWalkthrough(Standard_False), + mySymPerspective(Standard_False), + myOffsetFactor(1.F), + myOffsetUnits(0.F), + myAntiAliasingMode(3), + myLinestyleBase(0), + myPatternBase(0), + myMarkerBase(0), + myFont(-1), + myFontSize(-1) +{ +#if (defined(_WIN32) || defined(__WIN32__)) + myDisplay = TheDummyDisplay; +#else + myDisplay = theDisplay; +#endif + + Init(); +} + +/*----------------------------------------------------------------------*/ + +OpenGl_Display::~OpenGl_Display () +{ + // Delete line styles + if (myLinestyleBase) + { + glDeleteLists((GLuint)myLinestyleBase,5); + myLinestyleBase = 0; + } + // Delete surface patterns + if (myPatternBase) + { + glDeleteLists((GLuint)myPatternBase,TEL_HS_USER_DEF_START); + myPatternBase = 0; + } + // Delete markers + if (myMarkerBase) + { + glDeleteLists((GLuint)myMarkerBase,60); + myMarkerBase = 0; + } + // Delete user markers + OpenGl_MapOfUserMarker::Iterator itm(myMapOfUM); + for (; itm.More(); itm.Next()) + { + const OPENGL_MARKER_DATA &aData = itm.Value(); + if (aData.Array) + { + delete[] aData.Array; + } + else if (aData.ListId != 0) + { + glDeleteLists ( aData.ListId, 1 ); + } + } + myDisplay = NULL; +} + +/*----------------------------------------------------------------------*/ + +Handle(OpenGl_Window) OpenGl_Display::GetWindow (const Aspect_Drawable AParent) const +{ + Handle(OpenGl_Window) aWindow; + if ( myMapOfWindows.IsBound( AParent ) ) + { + aWindow = myMapOfWindows.Find( AParent ); + } + return aWindow; +} + +/*----------------------------------------------------------------------*/ + +void OpenGl_Display::SetWindow (const Aspect_Drawable AParent, const Handle(OpenGl_Window) &AWindow) +{ + if ( !myMapOfWindows.IsBound( AParent ) ) + { + myMapOfWindows.Bind( AParent, AWindow ); + } +} + +/*----------------------------------------------------------------------*/ + +//GenerateMarkerBitmap +void OpenGl_Display::AddUserMarker (const Standard_Integer AIndex, + const Standard_Integer AMarkWidth, + const Standard_Integer AMarkHeight, + const Handle(TColStd_HArray1OfByte)& ATexture) +{ + if (!myMapOfUM.IsBound(AIndex)) + { + const OPENGL_MARKER_DATA anEmptyData = { 0, 0, 0, NULL }; + myMapOfUM.Bind(AIndex,anEmptyData); + } + + OPENGL_MARKER_DATA &aData = myMapOfUM.ChangeFind(AIndex); + + if (aData.Array) + { + delete[] aData.Array; + aData.Array = NULL; + } + + unsigned char *anArray = new unsigned char[ATexture->Length()]; + + const int aByteWidth = AMarkWidth / 8; + int i, anIndex = ATexture->Upper() - ATexture->Lower() - aByteWidth + 1; + for ( ; anIndex >= 0; anIndex -= aByteWidth ) + for ( i = 0; i < aByteWidth; i++ ) + anArray[ATexture->Upper() - ATexture->Lower() - aByteWidth + 1 - anIndex + i ] = ATexture->Value( anIndex + i + 1 ); + + aData.Width = AMarkWidth; + aData.Height = AMarkHeight; + aData.Array = anArray; +} + +/*----------------------------------------------------------------------*/ + +void OpenGl_Display::UpdateUserMarkers () +{ + OpenGl_MapOfUserMarker::Iterator itm(myMapOfUM); + for (; itm.More(); itm.Next()) + { + OPENGL_MARKER_DATA &aData = itm.ChangeValue(); + if (aData.Array) + { + if (aData.ListId == 0) + aData.ListId = glGenLists(1); + + glNewList( (GLuint)aData.ListId, GL_COMPILE ); + + GLint w = ( GLsizei ) aData.Width; + GLint h = ( GLsizei ) aData.Height; + glBitmap( w, h, + 0.5F * ( float )aData.Width, 0.5F * ( float )aData.Height, + ( float )30.0, ( float )30.0, + ( GLubyte* )aData.Array ); + + glEndList(); + + delete[] aData.Array; + aData.Array = NULL; + } + } +} + +/*----------------------------------------------------------------------*/ + +Standard_Integer OpenGl_Display::GetUserMarkerListIndex (const Standard_Integer AIndex) const +{ + if (myMapOfUM.IsBound(AIndex)) + { + const OPENGL_MARKER_DATA &aData = myMapOfUM.Find(AIndex); + if (!aData.Array) + return aData.ListId; + } + return -1; +} + +/*----------------------------------------------------------------------*/ + +void OpenGl_Display::Init() +{ + if (myDisplay != NULL) + { + #if (!defined(_WIN32) && !defined(__WIN32__)) + XSynchronize ((Display* )myDisplay, (getenv("CALL_SYNCHRO_X") != NULL) ? 1 : 0); + + if (getenv("CSF_GraphicSync") != NULL) + XSynchronize ((Display* )myDisplay, 1); + + // does the server know about OpenGL & GLX? + int aDummy; + if (!XQueryExtension ((Display* )myDisplay, "GLX", &aDummy, &aDummy, &aDummy)) + { + #ifdef DEBUG + std::cerr << "This system doesn't appear to support OpenGL\n"; + #endif + } + #endif + } + else + { + TCollection_AsciiString msg("OpenGl_Display::Init"); + #if (!defined(_WIN32) && !defined(__WIN32__)) + msg += " : Cannot connect to X server "; + msg += XDisplayName ((char*) NULL); + #endif + Aspect_GraphicDeviceDefinitionError::Raise(msg.ToCString()); + } + + if (getenv("CALL_OPENGL_NO_DBF") != NULL) + myDBuffer = Standard_False; + + if (getenv("CALL_OPENGL_NO_DITHER") != NULL) + myDither = Standard_False; + + if (getenv("CALL_OPENGL_NO_BACKDITHER") != NULL) + myBackDither = Standard_False; + + if (getenv("CSF_WALKTHROUGH") != NULL) + myWalkthrough = Standard_True; + + /* OCC18942: Test if symmetric perspective projection should be turned on */ + if (getenv("CSF_SYM_PERSPECTIVE") != NULL) + mySymPerspective = Standard_True; + + const char* pvalue = getenv("CALL_OPENGL_POLYGON_OFFSET"); + if (pvalue) + { + float v1, v2; + const int n = sscanf(pvalue, "%f %f", &v1, &v2); + if (n > 0) myOffsetFactor = v1; + if (n > 1) myOffsetUnits = v2; + } + + pvalue = getenv("CALL_OPENGL_ANTIALIASING_MODE"); + if (pvalue) + { + int v; + if ( sscanf(pvalue,"%d",&v) > 0 ) myAntiAliasingMode = v; + } +} diff --git a/src/OpenGl/OpenGl_Display.hxx b/src/OpenGl/OpenGl_Display.hxx new file mode 100644 index 0000000000..de102b03de --- /dev/null +++ b/src/OpenGl/OpenGl_Display.hxx @@ -0,0 +1,158 @@ +// File: OpenGl_Display.hxx +// Created: 20 September 2011 +// Author: Sergey ZERCHANINOV +// Copyright: OPEN CASCADE 2011 + +#ifndef _OpenGl_Display_Header +#define _OpenGl_Display_Header + +#include +#include + +#include +#include +#include + +#include +#include +#include +#include + +#include + +#include + +#include + +struct OpenGl_Facilities +{ + int AntiAliasing; + int DepthCueing; + int DoubleBuffer; + int ZBuffer; + int MaxLights; + int MaxViews; +}; + +struct OPENGL_MARKER_DATA +{ + unsigned int ListId; + unsigned int Width; + unsigned int Height; + unsigned char* Array; + IMPLEMENT_MEMORY_OPERATORS +}; + +typedef NCollection_DataMap OpenGl_MapOfUserMarker; + +class OpenGl_AspectText; +struct OpenGl_TextParam; + +class OpenGl_Display : public MMgt_TShared +{ + public: + OpenGl_Display (const Standard_CString ADisplay); + OpenGl_Display (const Aspect_Display ADisplay); + virtual ~OpenGl_Display (); + + Aspect_Display GetDisplay () const { return myDisplay; } + + Handle(OpenGl_Window) GetWindow (const Aspect_Drawable AParent) const; + void SetWindow (const Aspect_Drawable AParent, const Handle(OpenGl_Window) &AWindow); + + const OpenGl_Facilities & Facilities () const { return myFacilities; } + + Standard_Boolean DBuffer () const { return myDBuffer; } + Standard_Boolean Dither () const { return myDither; } + Standard_Boolean BackDither () const { return myBackDither; } + Standard_Boolean Walkthrough () const { return myWalkthrough; } + Standard_Boolean SymPerspective() const { return mySymPerspective; } + Standard_Boolean PolygonOffset (Standard_ShortReal &AFactor, Standard_ShortReal &AUnits) const + { + AFactor = myOffsetFactor; + AUnits = myOffsetUnits; + return Standard_True; + } + Standard_Integer AntiAliasingMode () const { return myAntiAliasingMode; } + + // System attributes + + void InitAttributes (); + + const char * GetStringForMarker (const Aspect_TypeOfMarker AType, const Tfloat AVal) const; + + void SetBaseForMarker () const; + + void SetTypeOfLine (const Aspect_TypeOfLine AType) const; + + void SetTypeOfHatch (const int AType) const; + + // User markers + + void AddUserMarker (const Standard_Integer AIndex, + const Standard_Integer AMarkWidth, + const Standard_Integer AMarkHeight, + const Handle(TColStd_HArray1OfByte)& ATexture); + + void UpdateUserMarkers (); + + Standard_Integer GetUserMarkerListIndex (const Standard_Integer AIndex) const; + + // Fonts + + int FindFont (const char* AFontName, const OSD_FontAspect AFontAspect, const int ABestSize = -1, const float AXScale = 1.F, const float AYScale = 1.F); + + void StringSize (const wchar_t *text, int &width, int &ascent, int &descent); + + void RenderText (const wchar_t *text, const int is2d, const float x, const float y, const float z, const OpenGl_AspectText *aspect, const OpenGl_TextParam *param); + + friend class OpenGl_Window; + + // Type definition + // + DEFINE_STANDARD_RTTI(OpenGl_Display) + + protected: + + void Init (); + + void ExportText (const wchar_t *text, const int is2d, const float x, const float y, const float z, const OpenGl_AspectText *aspect, const OpenGl_TextParam *param, const float height); + +#ifdef HAVE_GL2PS + static void getGL2PSFontName(const char *src_font, char *ps_font); +#endif + + Aspect_Display myDisplay; + OpenGl_Facilities myFacilities; + + Standard_Boolean myDBuffer; + Standard_Boolean myDither; + Standard_Boolean myBackDither; + Standard_Boolean myWalkthrough; + Standard_Boolean mySymPerspective; + Standard_ShortReal myOffsetFactor; + Standard_ShortReal myOffsetUnits; + Standard_Integer myAntiAliasingMode; + +#if (defined(_WIN32) || defined(__WIN32__)) + NCollection_DataMap myMapOfWindows; +#else + NCollection_DataMap myMapOfWindows; +#endif + + unsigned int myLinestyleBase; + unsigned int myPatternBase; + unsigned int myMarkerBase; + + OpenGl_MapOfUserMarker myMapOfUM; + + Standard_Integer myFont; + Standard_Integer myFontSize; + + public: + IMPLEMENT_MEMORY_OPERATORS +}; + +extern Handle(OpenGl_Display) openglDisplay; + +#endif //OpenGl_Workspace_Header diff --git a/src/OpenGl/OpenGl_Display_1.cxx b/src/OpenGl/OpenGl_Display_1.cxx new file mode 100644 index 0000000000..eed1d32337 --- /dev/null +++ b/src/OpenGl/OpenGl_Display_1.cxx @@ -0,0 +1,378 @@ +// File: OpenGl_Display_1.cxx +// Created: 25 October 2011 +// Author: Sergey ZERCHANINOV +// Copyright: OPEN CASCADE 2011 + +#include + +#include +#include + +#include + +#include + +#ifdef HAVE_GL2PS +#include +#endif + +/*-----------------------------------------------------------------------------*/ +/* +* Prototypes variables statiques +*/ + +struct FontMapNode +{ + const char * EnumName; + const char * FontName; + OSD_FontAspect FontAspect; +}; + +static const FontMapNode myFontMap[] = +{ + +#ifdef WNT + + { "Courier" , "Courier New" , OSD_FA_Regular }, + { "Times-Roman" , "Times New Roman", OSD_FA_Regular }, + { "Times-Bold" , "Times New Roman", OSD_FA_Bold }, + { "Times-Italic" , "Times New Roman", OSD_FA_Italic }, + { "Times-BoldItalic" , "Times New Roman", OSD_FA_BoldItalic }, + { "ZapfChancery-MediumItalic", "Script" , OSD_FA_Regular }, + { "Symbol" , "Symbol" , OSD_FA_Regular }, + { "ZapfDingbats" , "WingDings" , OSD_FA_Regular }, + { "Rock" , "Arial" , OSD_FA_Regular }, + { "Iris" , "Lucida Console" , OSD_FA_Regular } + +#else //X11 + + { "Courier" , "Courier" , OSD_FA_Regular }, + { "Times-Roman" , "Times" , OSD_FA_Regular }, + { "Times-Bold" , "Times" , OSD_FA_Bold }, + { "Times-Italic" , "Times" , OSD_FA_Italic }, + { "Times-BoldItalic" , "Times" , OSD_FA_BoldItalic }, + { "Arial" , "Helvetica" , OSD_FA_Regular }, + { "ZapfChancery-MediumItalic", "-adobe-itc zapf chancery-medium-i-normal--*-*-*-*-*-*-iso8859-1" , OSD_FA_Regular }, + { "Symbol" , "-adobe-symbol-medium-r-normal--*-*-*-*-*-*-adobe-fontspecific" , OSD_FA_Regular }, + { "ZapfDingbats" , "-adobe-itc zapf dingbats-medium-r-normal--*-*-*-*-*-*-adobe-fontspecific" , OSD_FA_Regular }, + { "Rock" , "-sgi-rock-medium-r-normal--*-*-*-*-p-*-iso8859-1" , OSD_FA_Regular }, + { "Iris" , "--iris-medium-r-normal--*-*-*-*-m-*-iso8859-1" , OSD_FA_Regular } +#endif + +}; + +#define NUM_FONT_ENTRIES (sizeof(myFontMap)/sizeof(FontMapNode)) + +/*-----------------------------------------------------------------------------*/ + +/* +* Constants +*/ + +#ifdef HAVE_GL2PS +void OpenGl_Display::getGL2PSFontName (const char *src_font, char *ps_font) +{ + /* + Convert font name used for rendering to some "good" font names + that produce good vector text + */ + static char const *family[] = {"Helvetica", "Courier", "Times"}; + static char const *italic[] = {"Oblique", "Oblique", "Italic"}; + static char const *base[] = {"", "", "-Roman"}; + + int font = 0; + int isBold = 0; + int isItalic = 0; + + if( strstr( src_font, "Symbol" ) ){ + sprintf( ps_font, "%s", "Symbol" ); + return; + } + + if( strstr( src_font, "ZapfDingbats" ) ){ + sprintf( ps_font, "%s", "WingDings" ); + return; + } + + if ( strstr( src_font, "Courier" ) ){ + font = 1; + } + else if ( strstr( src_font, "Times" ) ){ + font = 2; + } + + if ( strstr( src_font, "Bold" ) ){ + isBold = 1; + } + + if ( strstr( src_font, "Italic" ) || strstr( src_font, "Oblique" ) ){ + isItalic = 1; + } + + if ( isBold ){ + sprintf( ps_font, "%s-%s", family[font], "Bold"); + if ( isItalic ){ + sprintf(ps_font, "%s%s", ps_font, italic[font]); + } + } + else if ( isItalic ) + { + sprintf( ps_font, "%s-%s", family[font], italic[font] ); + } + else + { + sprintf( ps_font, "%s%s", family[font], base[font] ); + } +} +#endif + +/*-----------------------------------------------------------------------------*/ + +/* +* Fonctions publiques +*/ + +/*-----------------------------------------------------------------------------*/ + +int OpenGl_Display::FindFont (const char* AFontName, const OSD_FontAspect AFontAspect, + const int ABestSize, const float AXScale, const float AYScale) +{ + if (!AFontName) + return -1; + + if (ABestSize != -1) + myFontSize = ABestSize; + + OpenGl_FontMgr* mgr = OpenGl_FontMgr::instance(); + + Handle(TCollection_HAsciiString) family_name = new TCollection_HAsciiString(AFontName); + myFont = mgr->request_font( family_name, AFontAspect, myFontSize ); + + if( myFont == -1 ) + { + //try to use font names mapping + FontMapNode newTempFont = myFontMap[0]; + for ( int i = 0; i < NUM_FONT_ENTRIES; ++i ) + { + if ( TCollection_AsciiString(myFontMap[i].EnumName).IsEqual( family_name->ToCString() ) ) + { + newTempFont = myFontMap[i]; + break; + } + } + family_name = new TCollection_HAsciiString(newTempFont.FontName); + myFont = mgr->request_font( family_name, newTempFont.FontAspect, myFontSize ); + } + + // Requested family name not found -> serach for any font family with given aspect and height + if ( myFont == -1 ) + { + family_name = new TCollection_HAsciiString( "" ); + myFont = mgr->request_font( family_name, AFontAspect, myFontSize ); + } + + // The last resort: trying to use ANY font available in the system + if ( myFont == -1 ) + { + myFont = mgr->request_font( family_name, OSD_FA_Undefined, -1 ); + } + + if ( myFont != -1 ) + mgr->setCurrentScale( AXScale, AYScale ); + + return myFont; +} + +/*-----------------------------------------------------------------------------*/ + +void OpenGl_Display::StringSize (const wchar_t *str, int &width, int &ascent, int &descent) +{ + ascent = 0; + descent = 0; + width = 0; + if (myFont != -1) { + OpenGl_FontMgr* mgr = OpenGl_FontMgr::instance(); + const FTFont* font = mgr->fontById( myFont ); + if ( font ) { + width = int( mgr->computeWidth( myFont, str ) ); + ascent = int( font->Ascender() ); + descent = int( font->Descender() ); + } + } +} + +/*-----------------------------------------------------------------------------*/ + +void OpenGl_Display::RenderText (const wchar_t* str, const int is2d, const float x, const float y, const float z, + const OpenGl_AspectText *aspect, const OpenGl_TextParam *param) +{ + OpenGl_FontMgr* mgr = OpenGl_FontMgr::instance(); + const FTFont* fnt = mgr->fontById( myFont ); + if ( !fnt ) + return; + + // FTFont changes texture state when it renders and computes size for the text + glPushAttrib(GL_TEXTURE_BIT); + + int widthFont, ascentFont, descentFont; + StringSize( str, widthFont, ascentFont, descentFont ); + + GLdouble xdis = 0.; + switch (param->HAlign) + { + case Graphic3d_HTA_CENTER: + xdis = -0.5 * (GLdouble)widthFont; + break; + case Graphic3d_HTA_RIGHT: + xdis = -(GLdouble)widthFont; + break; + //case Graphic3d_HTA_LEFT: + //default: break; + } + GLdouble ydis = 0.; + switch (param->VAlign) + { + case Graphic3d_VTA_CENTER: + ydis = -0.5 * (GLdouble)ascentFont - descentFont; + break; + case Graphic3d_VTA_TOP: + ydis = -(GLdouble)ascentFont - descentFont; + break; + //case Graphic3d_VTA_BOTTOM: + //default: break; + } + + float export_h = 1.; + + glMatrixMode(GL_MODELVIEW); + glPushMatrix(); + if (is2d) + { + glLoadIdentity(); + glTranslatef(x, y, 0.f); + glRotatef( 180, 1, 0, 0 ); + } + else + { + const GLdouble identityMatrix[4][4] = + { + {1.,0.,0.,0.}, + {0.,1.,0.,0.}, + {0.,0.,1.,0.}, + {0.,0.,0.,1.} + }; + + GLdouble projMatrix[4][4], modelMatrix[4][4]; + GLint viewport[4]; + + GLdouble wx, wy, wz; + GLdouble x1, y1, z1; + GLdouble x2, y2, z2; + + glGetDoublev( GL_MODELVIEW_MATRIX, (GLdouble*)modelMatrix ); + glGetDoublev( GL_PROJECTION_MATRIX, (GLdouble*)projMatrix ); + glGetIntegerv( GL_VIEWPORT, (GLint*)viewport ); + + gluProject( x, y, z, + (GLdouble*)modelMatrix, + (GLdouble*)projMatrix, + (GLint*)viewport, + &wx, &wy, &wz ); + glLoadIdentity(); + gluUnProject( wx, wy, wz, + (GLdouble*)identityMatrix, (GLdouble*)projMatrix, (GLint*)viewport, + &x1, &y1 , &z1 ); + + GLdouble h = (GLdouble)fnt->FaceSize(); + + gluUnProject( wx, wy + h - 1., wz, + (GLdouble*)identityMatrix, (GLdouble*)projMatrix, (GLint*)viewport, + &x2, &y2, &z2 ); + + h = (y2-y1)/h; + + glTranslated( x1, y1 , z1 ); + glRotated(aspect->Angle(), 0, 0, 1); + glTranslated(xdis, ydis, 0); + + if( !aspect->IsZoomable() ) + { + glScaled( h, h, h ); + } + else + { + export_h = (float )h; + } + } + + GLint renderMode; + glGetIntegerv(GL_RENDER_MODE, &renderMode); + if ( renderMode == GL_FEEDBACK ) + { +#ifdef HAVE_GL2PS + export_h = (GLdouble)fnt->FaceSize() / export_h; + glPopMatrix(); + ExportText( str, is2d, x, y, z, aspect, param, export_h ); +#endif + } + else + { + mgr->render_text( myFont, str, is2d ); + glPopMatrix(); + } + glPopAttrib(); +} + +/*-----------------------------------------------------------------------------*/ + +static const int alignmentforgl2ps[3][3] = { {5,2,8}, {4,1,7}, {6,3,9} }; + +void OpenGl_Display::ExportText (const wchar_t* text, const int is2d, const float x, const float y, const float z, + const OpenGl_AspectText *aspect, const OpenGl_TextParam *param, const float height) +{ +#ifdef HAVE_GL2PS + + int vh = 1; + switch (param->HAlign) + { + case Graphic3d_HTA_CENTER: vh = 2; break; + case Graphic3d_HTA_RIGHT: vh = 3; break; + //case Graphic3d_HTA_LEFT: + //default: break; + } + + int vv = 1; + switch (param->VAlign) + { + case Graphic3d_VTA_CENTER: vv = 2; break; + case Graphic3d_VTA_TOP: vv = 3; break; + //case Graphic3d_VTA_BOTTOM: + //default: break; + } + + const int alignment = alignmentforgl2ps[vh-1][vv-1]; + + const char* fontname = aspect->Font(); + float angle = aspect->Angle(); + + GLubyte zero = 0; + char ps_font[64]; + + getGL2PSFontName(fontname, ps_font); + + if( is2d ) + glRasterPos2f( x, y ); + else + glRasterPos3f( x, y, z ); + + glBitmap( 1, 1, 0, 0, 0, 0, &zero ); + + //szv: workaround for gl2ps! + const int len = 4 * (wcslen(text) + 1); //szv: should be more than enough + char *astr = new char[len]; + wcstombs(astr,text,len); + gl2psTextOpt(astr, ps_font, height, alignment, angle); + delete[] astr; + +#endif +} diff --git a/src/OpenGl/OpenGl_Display_2.cxx b/src/OpenGl/OpenGl_Display_2.cxx new file mode 100644 index 0000000000..2ceb5d687e --- /dev/null +++ b/src/OpenGl/OpenGl_Display_2.cxx @@ -0,0 +1,1949 @@ +// File: OpenGl_Display_2.cxx +// Created: 25 October 2011 +// Author: Sergey ZERCHANINOV +// Copyright: OPEN CASCADE 2011 + +#include + +#ifdef HAVE_GL2PS +#include +#endif + +#include +#include + +/*----------------------------------------------------------------------*/ +/* +* Constantes +*/ + +#define DOT_LS 0xCCCC +#define DASH_DOT_LS 0xFF18 +#define DASH_LS 0xFFC0 +#define DASH_DDOT_LS 0xFF24 + +static const unsigned int myInteriors[TEL_HS_USER_DEF_START][32] = +{ + //TEL_HS_SOLID + { + 0xFFFFFFFF, + 0xFFFFFFFF, + 0xFFFFFFFF, + 0xFFFFFFFF, + 0xFFFFFFFF, + 0xFFFFFFFF, + 0xFFFFFFFF, + 0xFFFFFFFF, + 0xFFFFFFFF, + 0xFFFFFFFF, + 0xFFFFFFFF, + 0xFFFFFFFF, + 0xFFFFFFFF, + 0xFFFFFFFF, + 0xFFFFFFFF, + 0xFFFFFFFF, + 0xFFFFFFFF, + 0xFFFFFFFF, + 0xFFFFFFFF, + 0xFFFFFFFF, + 0xFFFFFFFF, + 0xFFFFFFFF, + 0xFFFFFFFF, + 0xFFFFFFFF, + 0xFFFFFFFF, + 0xFFFFFFFF, + 0xFFFFFFFF, + 0xFFFFFFFF, + 0xFFFFFFFF, + 0xFFFFFFFF, + 0xFFFFFFFF, + 0xFFFFFFFF + }, + //TEL_HS_CROSS + { + 0xFFFFFFFF, + 0xBBBBBBBB, + 0xEEEEEEEE, + 0xBBBBBBBB, + 0xEEEEEEEE, + 0xBBBBBBBB, + 0xEEEEEEEE, + 0xBBBBBBBB, + 0xEEEEEEEE, + 0xBBBBBBBB, + 0xEEEEEEEE, + 0xBBBBBBBB, + 0xEEEEEEEE, + 0xBBBBBBBB, + 0xEEEEEEEE, + 0xBBBBBBBB, + 0xEEEEEEEE, + 0xBBBBBBBB, + 0xEEEEEEEE, + 0xBBBBBBBB, + 0xEEEEEEEE, + 0xBBBBBBBB, + 0xEEEEEEEE, + 0xBBBBBBBB, + 0xEEEEEEEE, + 0xBBBBBBBB, + 0xEEEEEEEE, + 0xBBBBBBBB, + 0xEEEEEEEE, + 0xBBBBBBBB, + 0xEEEEEEEE, + 0xBBBBBBBB + }, + //TEL_HS_CROSS_SPARSE + { + 0x81818181, + 0x24242424, + 0x18181818, + 0x42424242, + 0x81818181, + 0x24242424, + 0x18181818, + 0x42424242, + 0x81818181, + 0x24242424, + 0x18181818, + 0x42424242, + 0x81818181, + 0x24242424, + 0x18181818, + 0x42424242, + 0x81818181, + 0x24242424, + 0x18181818, + 0x42424242, + 0x81818181, + 0x24242424, + 0x18181818, + 0x42424242, + 0x81818181, + 0x24242424, + 0x18181818, + 0x42424242, + 0x81818181, + 0x24242424, + 0x18181818, + 0x42424242 + }, + //TEL_HS_GRID + { + 0xFFFFFFFF, + 0x88888888, + 0xFFFFFFFF, + 0x88888888, + 0xFFFFFFFF, + 0x88888888, + 0xFFFFFFFF, + 0x88888888, + 0xFFFFFFFF, + 0x88888888, + 0xFFFFFFFF, + 0x88888888, + 0xFFFFFFFF, + 0x88888888, + 0xFFFFFFFF, + 0x88888888, + 0xFFFFFFFF, + 0x88888888, + 0xFFFFFFFF, + 0x88888888, + 0xFFFFFFFF, + 0x88888888, + 0xFFFFFFFF, + 0x88888888, + 0xFFFFFFFF, + 0x88888888, + 0xFFFFFFFF, + 0x88888888, + 0xFFFFFFFF, + 0x88888888, + 0xFFFFFFFF, + 0x88888888 + }, + //TEL_HS_GRID_SPARSE + { + 0xFFFFFFFF, + 0x80808080, + 0x80808080, + 0x80808080, + 0xFFFFFFFF, + 0x80808080, + 0x80808080, + 0x80808080, + 0xFFFFFFFF, + 0x80808080, + 0x80808080, + 0x80808080, + 0xFFFFFFFF, + 0x80808080, + 0x80808080, + 0x80808080, + 0xFFFFFFFF, + 0x80808080, + 0x80808080, + 0x80808080, + 0xFFFFFFFF, + 0x80808080, + 0x80808080, + 0x80808080, + 0xFFFFFFFF, + 0x80808080, + 0x80808080, + 0x80808080, + 0xFFFFFFFF, + 0x80808080, + 0x80808080, + 0x80808080 + }, + //TEL_HS_DIAG_45 + { + 0x88888888, + 0x22222222, + 0x88888888, + 0x22222222, + 0x88888888, + 0x22222222, + 0x88888888, + 0x22222222, + 0x88888888, + 0x22222222, + 0x88888888, + 0x22222222, + 0x88888888, + 0x22222222, + 0x88888888, + 0x22222222, + 0x88888888, + 0x22222222, + 0x88888888, + 0x22222222, + 0x88888888, + 0x22222222, + 0x88888888, + 0x22222222, + 0x88888888, + 0x22222222, + 0x88888888, + 0x22222222, + 0x88888888, + 0x22222222, + 0x88888888, + 0x22222222 + }, + //TEL_HS_DIAG_135 + { + 0x11111111, + 0x44444444, + 0x11111111, + 0x44444444, + 0x11111111, + 0x44444444, + 0x11111111, + 0x44444444, + 0x11111111, + 0x44444444, + 0x11111111, + 0x44444444, + 0x11111111, + 0x44444444, + 0x11111111, + 0x44444444, + 0x11111111, + 0x44444444, + 0x11111111, + 0x44444444, + 0x11111111, + 0x44444444, + 0x11111111, + 0x44444444, + 0x11111111, + 0x44444444, + 0x11111111, + 0x44444444, + 0x11111111, + 0x44444444, + 0x11111111, + 0x44444444 + }, + //TEL_HS_HORIZONTAL + { + 0xFFFFFFFF, + 0x00000000, + 0xFFFFFFFF, + 0x00000000, + 0xFFFFFFFF, + 0x00000000, + 0xFFFFFFFF, + 0x00000000, + 0xFFFFFFFF, + 0x00000000, + 0xFFFFFFFF, + 0x00000000, + 0xFFFFFFFF, + 0x00000000, + 0xFFFFFFFF, + 0x00000000, + 0xFFFFFFFF, + 0x00000000, + 0xFFFFFFFF, + 0x00000000, + 0xFFFFFFFF, + 0x00000000, + 0xFFFFFFFF, + 0x00000000, + 0xFFFFFFFF, + 0x00000000, + 0xFFFFFFFF, + 0x00000000, + 0xFFFFFFFF, + 0x00000000, + 0xFFFFFFFF, + 0x00000000 + }, + //TEL_HS_VERTICAL + { + 0x11111111, + 0x11111111, + 0x11111111, + 0x11111111, + 0x11111111, + 0x11111111, + 0x11111111, + 0x11111111, + 0x11111111, + 0x11111111, + 0x11111111, + 0x11111111, + 0x11111111, + 0x11111111, + 0x11111111, + 0x11111111, + 0x11111111, + 0x11111111, + 0x11111111, + 0x11111111, + 0x11111111, + 0x11111111, + 0x11111111, + 0x11111111, + 0x11111111, + 0x11111111, + 0x11111111, + 0x11111111, + 0x11111111, + 0x11111111, + 0x11111111, + 0x11111111 + }, + //TEL_HS_DIAG_45_SPARSE + { + 0x80808080, + 0x20202020, + 0x08080808, + 0x02020202, + 0x80808080, + 0x20202020, + 0x08080808, + 0x02020202, + 0x80808080, + 0x20202020, + 0x08080808, + 0x02020202, + 0x80808080, + 0x20202020, + 0x08080808, + 0x02020202, + 0x80808080, + 0x20202020, + 0x08080808, + 0x02020202, + 0x80808080, + 0x20202020, + 0x08080808, + 0x02020202, + 0x80808080, + 0x20202020, + 0x08080808, + 0x02020202, + 0x80808080, + 0x20202020, + 0x08080808, + 0x02020202 + }, + //TEL_HS_DIAG_135_SPARSE + { + 0x01010101, + 0x04040404, + 0x10101010, + 0x40404040, + 0x01010101, + 0x04040404, + 0x10101010, + 0x40404040, + 0x01010101, + 0x04040404, + 0x10101010, + 0x40404040, + 0x01010101, + 0x04040404, + 0x10101010, + 0x40404040, + 0x01010101, + 0x04040404, + 0x10101010, + 0x40404040, + 0x01010101, + 0x04040404, + 0x10101010, + 0x40404040, + 0x01010101, + 0x04040404, + 0x10101010, + 0x40404040, + 0x01010101, + 0x04040404, + 0x10101010, + 0x40404040 + }, + //TEL_HS_HORIZONTAL_SPARSE + { + 0xFFFFFFFF, + 0x00000000, + 0x00000000, + 0x00000000, + 0xFFFFFFFF, + 0x00000000, + 0x00000000, + 0x00000000, + 0xFFFFFFFF, + 0x00000000, + 0x00000000, + 0x00000000, + 0xFFFFFFFF, + 0x00000000, + 0x00000000, + 0x00000000, + 0xFFFFFFFF, + 0x00000000, + 0x00000000, + 0x00000000, + 0xFFFFFFFF, + 0x00000000, + 0x00000000, + 0x00000000, + 0xFFFFFFFF, + 0x00000000, + 0x00000000, + 0x00000000, + 0xFFFFFFFF, + 0x00000000, + 0x00000000, + 0x00000000 + }, + //TEL_HS_VERTICAL_SPARSE + { + 0x10101010, + 0x10101010, + 0x10101010, + 0x10101010, + 0x10101010, + 0x10101010, + 0x10101010, + 0x10101010, + 0x10101010, + 0x10101010, + 0x10101010, + 0x10101010, + 0x10101010, + 0x10101010, + 0x10101010, + 0x10101010, + 0x10101010, + 0x10101010, + 0x10101010, + 0x10101010, + 0x10101010, + 0x10101010, + 0x10101010, + 0x10101010, + 0x10101010, + 0x10101010, + 0x10101010, + 0x10101010, + 0x10101010, + 0x10101010, + 0x10101010, + 0x10101010 + } +}; + +/* Following Section relates to POLYMARKER */ + +#define TEL_NO_OF_SIZES 13 +#define TEL_NB_OF_LISTS 5 + +struct PM_FONT_INFO +{ + const char *str; + Tfloat width, height; + Tint offset; +}; +typedef PM_FONT_INFO* pm_font_info; + +#define PM_PLUS_10_NUM 9*2 +#define PM_PLUS_15_NUM 11*2 +#define PM_PLUS_20_NUM 13*2 +#define PM_PLUS_25_NUM 15*2 +#define PM_PLUS_30_NUM 17*3 +#define PM_PLUS_35_NUM 19*3 +#define PM_PLUS_40_NUM 21*3 +#define PM_PLUS_45_NUM 23*3 +#define PM_PLUS_50_NUM 25*4 +#define PM_PLUS_55_NUM 27*4 +#define PM_PLUS_60_NUM 29*4 +#define PM_PLUS_65_NUM 31*4 +#define PM_PLUS_70_NUM 32*4 + +#define PM_STAR_10_NUM 9 +#define PM_STAR_15_NUM 11*2 +#define PM_STAR_20_NUM 13*2 +#define PM_STAR_25_NUM 15*2 +#define PM_STAR_30_NUM 17*2 +#define PM_STAR_35_NUM 19*2 +#define PM_STAR_40_NUM 21*3 +#define PM_STAR_45_NUM 23*3 +#define PM_STAR_50_NUM 25*3 +#define PM_STAR_55_NUM 27*3 +#define PM_STAR_60_NUM 29*4 +#define PM_STAR_65_NUM 32*4 +#define PM_STAR_70_NUM 32*4 + +#define PM_CIRC_10_NUM 7 +#define PM_CIRC_15_NUM 9*2 +#define PM_CIRC_20_NUM 9*2 +#define PM_CIRC_25_NUM 11*2 +#define PM_CIRC_30_NUM 13*2 +#define PM_CIRC_35_NUM 15*2 +#define PM_CIRC_40_NUM 17*3 +#define PM_CIRC_45_NUM 19*3 +#define PM_CIRC_50_NUM 21*3 +#define PM_CIRC_55_NUM 23*3 +#define PM_CIRC_60_NUM 25*4 +#define PM_CIRC_65_NUM 27*4 +#define PM_CIRC_70_NUM 29*4 + +#define PM_CROSS_10_NUM 7 +#define PM_CROSS_15_NUM 9*2 +#define PM_CROSS_20_NUM 11*2 +#define PM_CROSS_25_NUM 13*2 +#define PM_CROSS_30_NUM 15*2 +#define PM_CROSS_35_NUM 17*3 +#define PM_CROSS_40_NUM 19*3 +#define PM_CROSS_45_NUM 21*3 +#define PM_CROSS_50_NUM 23*3 +#define PM_CROSS_55_NUM 25*4 +#define PM_CROSS_60_NUM 27*4 +#define PM_CROSS_65_NUM 32*4 +#define PM_CROSS_70_NUM 32*4 + +#define PM_PLUS_10_OFT 0 +#define PM_PLUS_15_OFT PM_PLUS_10_OFT + PM_PLUS_10_NUM +#define PM_PLUS_20_OFT PM_PLUS_15_OFT + PM_PLUS_15_NUM +#define PM_PLUS_25_OFT PM_PLUS_20_OFT + PM_PLUS_20_NUM +#define PM_PLUS_30_OFT PM_PLUS_25_OFT + PM_PLUS_25_NUM +#define PM_PLUS_35_OFT PM_PLUS_30_OFT + PM_PLUS_30_NUM +#define PM_PLUS_40_OFT PM_PLUS_35_OFT + PM_PLUS_35_NUM +#define PM_PLUS_45_OFT PM_PLUS_40_OFT + PM_PLUS_40_NUM +#define PM_PLUS_50_OFT PM_PLUS_45_OFT + PM_PLUS_45_NUM +#define PM_PLUS_55_OFT PM_PLUS_50_OFT + PM_PLUS_50_NUM +#define PM_PLUS_60_OFT PM_PLUS_55_OFT + PM_PLUS_55_NUM +#define PM_PLUS_65_OFT PM_PLUS_60_OFT + PM_PLUS_60_NUM +#define PM_PLUS_70_OFT PM_PLUS_65_OFT + PM_PLUS_65_NUM + +#define PM_STAR_10_OFT PM_PLUS_70_OFT + PM_PLUS_70_NUM +#define PM_STAR_15_OFT PM_STAR_10_OFT + PM_STAR_10_NUM +#define PM_STAR_20_OFT PM_STAR_15_OFT + PM_STAR_15_NUM +#define PM_STAR_25_OFT PM_STAR_20_OFT + PM_STAR_20_NUM +#define PM_STAR_30_OFT PM_STAR_25_OFT + PM_STAR_25_NUM +#define PM_STAR_35_OFT PM_STAR_30_OFT + PM_STAR_30_NUM +#define PM_STAR_40_OFT PM_STAR_35_OFT + PM_STAR_35_NUM +#define PM_STAR_45_OFT PM_STAR_40_OFT + PM_STAR_40_NUM +#define PM_STAR_50_OFT PM_STAR_45_OFT + PM_STAR_45_NUM +#define PM_STAR_55_OFT PM_STAR_50_OFT + PM_STAR_50_NUM +#define PM_STAR_60_OFT PM_STAR_55_OFT + PM_STAR_55_NUM +#define PM_STAR_65_OFT PM_STAR_60_OFT + PM_STAR_60_NUM +#define PM_STAR_70_OFT PM_STAR_65_OFT + PM_STAR_65_NUM + +#define PM_CIRC_10_OFT PM_STAR_70_OFT + PM_STAR_70_NUM +#define PM_CIRC_15_OFT PM_CIRC_10_OFT + PM_CIRC_10_NUM +#define PM_CIRC_20_OFT PM_CIRC_15_OFT + PM_CIRC_15_NUM +#define PM_CIRC_25_OFT PM_CIRC_20_OFT + PM_CIRC_20_NUM +#define PM_CIRC_30_OFT PM_CIRC_25_OFT + PM_CIRC_25_NUM +#define PM_CIRC_35_OFT PM_CIRC_30_OFT + PM_CIRC_30_NUM +#define PM_CIRC_40_OFT PM_CIRC_35_OFT + PM_CIRC_35_NUM +#define PM_CIRC_45_OFT PM_CIRC_40_OFT + PM_CIRC_40_NUM +#define PM_CIRC_50_OFT PM_CIRC_45_OFT + PM_CIRC_45_NUM +#define PM_CIRC_55_OFT PM_CIRC_50_OFT + PM_CIRC_50_NUM +#define PM_CIRC_60_OFT PM_CIRC_55_OFT + PM_CIRC_55_NUM +#define PM_CIRC_65_OFT PM_CIRC_60_OFT + PM_CIRC_60_NUM +#define PM_CIRC_70_OFT PM_CIRC_65_OFT + PM_CIRC_65_NUM + +#define PM_CROSS_10_OFT PM_CIRC_70_OFT + PM_CIRC_70_NUM +#define PM_CROSS_15_OFT PM_CROSS_10_OFT + PM_CROSS_10_NUM +#define PM_CROSS_20_OFT PM_CROSS_15_OFT + PM_CROSS_15_NUM +#define PM_CROSS_25_OFT PM_CROSS_20_OFT + PM_CROSS_20_NUM +#define PM_CROSS_30_OFT PM_CROSS_25_OFT + PM_CROSS_25_NUM +#define PM_CROSS_35_OFT PM_CROSS_30_OFT + PM_CROSS_30_NUM +#define PM_CROSS_40_OFT PM_CROSS_35_OFT + PM_CROSS_35_NUM +#define PM_CROSS_45_OFT PM_CROSS_40_OFT + PM_CROSS_40_NUM +#define PM_CROSS_50_OFT PM_CROSS_45_OFT + PM_CROSS_45_NUM +#define PM_CROSS_55_OFT PM_CROSS_50_OFT + PM_CROSS_50_NUM +#define PM_CROSS_60_OFT PM_CROSS_55_OFT + PM_CROSS_55_NUM +#define PM_CROSS_65_OFT PM_CROSS_60_OFT + PM_CROSS_60_NUM +#define PM_CROSS_70_OFT PM_CROSS_65_OFT + PM_CROSS_65_NUM + +static const PM_FONT_INFO arrPMFontInfo[][TEL_NO_OF_SIZES] = +{ + /* TOM_POINT - not used */ + {{"\0"}, + {"\0"}, + {"\0"}, + {"\0"}, + {"\0"}, + {"\0"}, + {"\0"}, + {"\0"}, + {"\0"}, + {"\0"}, + {"\0"}, + {"\0"}, + {"\0"}}, + + /* TOM_PLUS */ + {{"\001", 9.f, 9.f, PM_PLUS_10_OFT}, + {"\002", 11.f, 11.f, PM_PLUS_15_OFT}, + {"\003", 13.f, 13.f, PM_PLUS_20_OFT}, + {"\004", 15.f, 15.f, PM_PLUS_25_OFT}, + {"\005", 17.f, 17.f, PM_PLUS_30_OFT}, + {"\006", 19.f, 19.f, PM_PLUS_35_OFT}, + {"\007", 21.f, 21.f, PM_PLUS_40_OFT}, + {"\010", 23.f, 23.f, PM_PLUS_45_OFT}, + {"\011", 25.f, 25.f, PM_PLUS_50_OFT}, + {"\012", 27.f, 27.f, PM_PLUS_55_OFT}, + {"\013", 29.f, 29.f, PM_PLUS_60_OFT}, + {"\014", 31.f, 31.f, PM_PLUS_65_OFT}, + {"\015", 32.f, 32.f, PM_PLUS_70_OFT}}, + + /* TOM_STAR */ + {{"\016", 7.f, 9.f, PM_STAR_10_OFT}, + {"\017", 9.f, 11.f, PM_STAR_15_OFT}, + {"\020", 11.f, 13.f, PM_STAR_20_OFT}, + {"\021", 13.f, 15.f, PM_STAR_25_OFT}, + {"\022", 13.f, 17.f, PM_STAR_30_OFT}, + {"\023", 15.f, 19.f, PM_STAR_35_OFT}, + {"\024", 17.f, 21.f, PM_STAR_40_OFT}, + {"\025", 19.f, 23.f, PM_STAR_45_OFT}, + {"\026", 21.f, 25.f, PM_STAR_50_OFT}, + {"\027", 23.f, 27.f, PM_STAR_55_OFT}, + {"\030", 25.f, 29.f, PM_STAR_60_OFT}, + {"\031", 32.f, 32.f, PM_STAR_65_OFT}, + {"\032", 32.f, 32.f, PM_STAR_70_OFT}}, + + /* TOM_O */ + {{"\033", 7.f, 7.f, PM_CIRC_10_OFT}, + {"\034", 9.f, 9.f, PM_CIRC_15_OFT}, + {"\035", 9.f, 9.f, PM_CIRC_20_OFT}, + {"\036", 11.f, 11.f, PM_CIRC_25_OFT}, + {"\037", 13.f, 13.f, PM_CIRC_30_OFT}, + {"\040", 15.f, 15.f, PM_CIRC_35_OFT}, + {"\041", 17.f, 17.f, PM_CIRC_40_OFT}, + {"\042", 19.f, 19.f, PM_CIRC_45_OFT}, + {"\043", 21.f, 21.f, PM_CIRC_50_OFT}, + {"\044", 23.f, 23.f, PM_CIRC_55_OFT}, + {"\045", 25.f, 25.f, PM_CIRC_60_OFT}, + {"\046", 27.f, 27.f, PM_CIRC_65_OFT}, + {"\047", 29.f, 29.f, PM_CIRC_70_OFT}}, + + /* TOM_X */ + {{"\050", 7.f, 7.f, PM_CROSS_10_OFT}, + {"\051", 9.f, 9.f, PM_CROSS_15_OFT}, + {"\052", 11.f, 11.f, PM_CROSS_20_OFT}, + {"\053", 13.f, 13.f, PM_CROSS_25_OFT}, + {"\054", 15.f, 15.f, PM_CROSS_30_OFT}, + {"\055", 17.f, 17.f, PM_CROSS_35_OFT}, + {"\056", 19.f, 19.f, PM_CROSS_40_OFT}, + {"\057", 21.f, 21.f, PM_CROSS_45_OFT}, + {"\060", 23.f, 23.f, PM_CROSS_50_OFT}, + {"\061", 25.f, 25.f, PM_CROSS_55_OFT}, + {"\062", 27.f, 27.f, PM_CROSS_60_OFT}, + {"\063", 32.f, 32.f, PM_CROSS_65_OFT}, + {"\064", 32.f, 32.f, PM_CROSS_70_OFT}}, + + /* TOM_O_POINT - not used */ + {{"\0"}, + {"\0"}, + {"\0"}, + {"\0"}, + {"\0"}, + {"\0"}, + {"\0"}, + {"\0"}, + {"\0"}, + {"\0"}, + {"\0"}, + {"\0"}, + {"\0"}}, + + /* TOM_O_PLUS */ + {{"\001\033"}, + {"\002\034"}, + {"\003\035"}, + {"\004\036"}, + {"\005\037"}, + {"\006\040"}, + {"\007\041"}, + {"\010\042"}, + {"\011\043"}, + {"\012\044"}, + {"\013\045"}, + {"\014\046"}, + {"\015\047"}}, + + /* TOM_O_STAR */ + {{"\016\033"}, + {"\017\034"}, + {"\020\035"}, + {"\021\036"}, + {"\022\037"}, + {"\023\040"}, + {"\024\041"}, + {"\025\042"}, + {"\026\043"}, + {"\027\044"}, + {"\030\045"}, + {"\031\046"}, + {"\032\047"}}, + + /* TOM_O_X */ + {{"\050\033"}, + {"\051\034"}, + {"\052\035"}, + {"\053\036"}, + {"\054\037"}, + {"\055\040"}, + {"\056\041"}, + {"\057\042"}, + {"\060\043"}, + {"\061\044"}, + {"\062\045"}, + {"\063\046"}, + {"\064\047"}} +}; + +static const unsigned char myMarkerRaster[] = +{ + /* TYPE = PLUS */ + + 0x08,0x00, + 0x08,0x00, + 0x08,0x00, + 0x08,0x00, + 0xff,0x80, + 0x08,0x00, + 0x08,0x00, + 0x08,0x00, + 0x08,0x00, /* PLUS 9x9 = 1.0 */ + + 0x04,0x00, + 0x04,0x00, + 0x04,0x00, + 0x04,0x00, + 0x04,0x00, + 0xff,0xe0, + 0x04,0x00, + 0x04,0x00, + 0x04,0x00, + 0x04,0x00, + 0x04,0x00, /* PLUS 11x11 = 1.5 */ + + 0x02,0x00, + 0x02,0x00, + 0x02,0x00, + 0x02,0x00, + 0x02,0x00, + 0x02,0x00, + 0xff,0xf8, + 0x02,0x00, + 0x02,0x00, + 0x02,0x00, + 0x02,0x00, + 0x02,0x00, + 0x02,0x00,/* PLUS 13x13 = 2.0 */ + + 0x01,0x00, + 0x01,0x00, + 0x01,0x00, + 0x01,0x00, + 0x01,0x00, + 0x01,0x00, + 0x01,0x00, + 0xff,0xfe, + 0x01,0x00, + 0x01,0x00, + 0x01,0x00, + 0x01,0x00, + 0x01,0x00, + 0x01,0x00, + 0x01,0x00,/* PLUS 15x15 = 2.5 */ + + 0x00,0x80, 0x00, + 0x00,0x80, 0x00, + 0x00,0x80, 0x00, + 0x00,0x80, 0x00, + 0x00,0x80, 0x00, + 0x00,0x80, 0x00, + 0x00,0x80, 0x00, + 0x00,0x80, 0x00, + 0xff,0xff, 0x80, + 0x00,0x80, 0x00, + 0x00,0x80, 0x00, + 0x00,0x80, 0x00, + 0x00,0x80, 0x00, + 0x00,0x80, 0x00, + 0x00,0x80, 0x00, + 0x00,0x80, 0x00, + 0x00,0x80, 0x00,/* PLUS 17x17 = 3.0 */ + + 0x00,0x40, 0x00, + 0x00,0x40, 0x00, + 0x00,0x40, 0x00, + 0x00,0x40, 0x00, + 0x00,0x40, 0x00, + 0x00,0x40, 0x00, + 0x00,0x40, 0x00, + 0x00,0x40, 0x00, + 0x00,0x40, 0x00, + 0xff,0xff, 0xe0, + 0x00,0x40, 0x00, + 0x00,0x40, 0x00, + 0x00,0x40, 0x00, + 0x00,0x40, 0x00, + 0x00,0x40, 0x00, + 0x00,0x40, 0x00, + 0x00,0x40, 0x00, + 0x00,0x40, 0x00, + 0x00,0x40, 0x00,/* PLUS 19x19 = 3.5 */ + + 0x00,0x20, 0x00, + 0x00,0x20, 0x00, + 0x00,0x20, 0x00, + 0x00,0x20, 0x00, + 0x00,0x20, 0x00, + 0x00,0x20, 0x00, + 0x00,0x20, 0x00, + 0x00,0x20, 0x00, + 0x00,0x20, 0x00, + 0x00,0x20, 0x00, + 0xff,0xff, 0xf8, + 0x00,0x20, 0x00, + 0x00,0x20, 0x00, + 0x00,0x20, 0x00, + 0x00,0x20, 0x00, + 0x00,0x20, 0x00, + 0x00,0x20, 0x00, + 0x00,0x20, 0x00, + 0x00,0x20, 0x00, + 0x00,0x20, 0x00, + 0x00,0x20, 0x00,/* PLUS 21x21 = 4.0 */ + + 0x00,0x10, 0x00, + 0x00,0x10, 0x00, + 0x00,0x10, 0x00, + 0x00,0x10, 0x00, + 0x00,0x10, 0x00, + 0x00,0x10, 0x00, + 0x00,0x10, 0x00, + 0x00,0x10, 0x00, + 0x00,0x10, 0x00, + 0x00,0x10, 0x00, + 0x00,0x10, 0x00, + 0xff,0xff, 0xfe, + 0x00,0x10, 0x00, + 0x00,0x10, 0x00, + 0x00,0x10, 0x00, + 0x00,0x10, 0x00, + 0x00,0x10, 0x00, + 0x00,0x10, 0x00, + 0x00,0x10, 0x00, + 0x00,0x10, 0x00, + 0x00,0x10, 0x00, + 0x00,0x10, 0x00, + 0x00,0x10, 0x00,/* PLUS 23x23 = 4.5 */ + + 0x00,0x08, 0x00,0x00, + 0x00,0x08, 0x00,0x00, + 0x00,0x08, 0x00,0x00, + 0x00,0x08, 0x00,0x00, + 0x00,0x08, 0x00,0x00, + 0x00,0x08, 0x00,0x00, + 0x00,0x08, 0x00,0x00, + 0x00,0x08, 0x00,0x00, + 0x00,0x08, 0x00,0x00, + 0x00,0x08, 0x00,0x00, + 0x00,0x08, 0x00,0x00, + 0x00,0x08, 0x00,0x00, + 0xff,0xff, 0xff,0x80, + 0x00,0x08, 0x00,0x00, + 0x00,0x08, 0x00,0x00, + 0x00,0x08, 0x00,0x00, + 0x00,0x08, 0x00,0x00, + 0x00,0x08, 0x00,0x00, + 0x00,0x08, 0x00,0x00, + 0x00,0x08, 0x00,0x00, + 0x00,0x08, 0x00,0x00, + 0x00,0x08, 0x00,0x00, + 0x00,0x08, 0x00,0x00, + 0x00,0x08, 0x00,0x00, + 0x00,0x08, 0x00,0x00,/* PLUS 25x25 = 5.0 */ + + 0x00,0x04, 0x00,0x00, + 0x00,0x04, 0x00,0x00, + 0x00,0x04, 0x00,0x00, + 0x00,0x04, 0x00,0x00, + 0x00,0x04, 0x00,0x00, + 0x00,0x04, 0x00,0x00, + 0x00,0x04, 0x00,0x00, + 0x00,0x04, 0x00,0x00, + 0x00,0x04, 0x00,0x00, + 0x00,0x04, 0x00,0x00, + 0x00,0x04, 0x00,0x00, + 0x00,0x04, 0x00,0x00, + 0x00,0x04, 0x00,0x00, + 0xff,0xff, 0xff,0xe0, + 0x00,0x04, 0x00,0x00, + 0x00,0x04, 0x00,0x00, + 0x00,0x04, 0x00,0x00, + 0x00,0x04, 0x00,0x00, + 0x00,0x04, 0x00,0x00, + 0x00,0x04, 0x00,0x00, + 0x00,0x04, 0x00,0x00, + 0x00,0x04, 0x00,0x00, + 0x00,0x04, 0x00,0x00, + 0x00,0x04, 0x00,0x00, + 0x00,0x04, 0x00,0x00, + 0x00,0x04, 0x00,0x00, + 0x00,0x04, 0x00,0x00,/* PLUS 27x27 = 5.5 */ + + 0x00,0x02, 0x00,0x00, + 0x00,0x02, 0x00,0x00, + 0x00,0x02, 0x00,0x00, + 0x00,0x02, 0x00,0x00, + 0x00,0x02, 0x00,0x00, + 0x00,0x02, 0x00,0x00, + 0x00,0x02, 0x00,0x00, + 0x00,0x02, 0x00,0x00, + 0x00,0x02, 0x00,0x00, + 0x00,0x02, 0x00,0x00, + 0x00,0x02, 0x00,0x00, + 0x00,0x02, 0x00,0x00, + 0x00,0x02, 0x00,0x00, + 0x00,0x02, 0x00,0x00, + 0xff,0xff, 0xff,0xf8, + 0x00,0x02, 0x00,0x00, + 0x00,0x02, 0x00,0x00, + 0x00,0x02, 0x00,0x00, + 0x00,0x02, 0x00,0x00, + 0x00,0x02, 0x00,0x00, + 0x00,0x02, 0x00,0x00, + 0x00,0x02, 0x00,0x00, + 0x00,0x02, 0x00,0x00, + 0x00,0x02, 0x00,0x00, + 0x00,0x02, 0x00,0x00, + 0x00,0x02, 0x00,0x00, + 0x00,0x02, 0x00,0x00, + 0x00,0x02, 0x00,0x00, + 0x00,0x02, 0x00,0x00,/* PLUS 29x29 = 6.0 */ + + 0x00,0x01, 0x00,0x00, + 0x00,0x01, 0x00,0x00, + 0x00,0x01, 0x00,0x00, + 0x00,0x01, 0x00,0x00, + 0x00,0x01, 0x00,0x00, + 0x00,0x01, 0x00,0x00, + 0x00,0x01, 0x00,0x00, + 0x00,0x01, 0x00,0x00, + 0x00,0x01, 0x00,0x00, + 0x00,0x01, 0x00,0x00, + 0x00,0x01, 0x00,0x00, + 0x00,0x01, 0x00,0x00, + 0x00,0x01, 0x00,0x00, + 0x00,0x01, 0x00,0x00, + 0x00,0x01, 0x00,0x00, + 0xff,0xff, 0xff,0xfd, + 0x00,0x01, 0x00,0x00, + 0x00,0x01, 0x00,0x00, + 0x00,0x01, 0x00,0x00, + 0x00,0x01, 0x00,0x00, + 0x00,0x01, 0x00,0x00, + 0x00,0x01, 0x00,0x00, + 0x00,0x01, 0x00,0x00, + 0x00,0x01, 0x00,0x00, + 0x00,0x01, 0x00,0x00, + 0x00,0x01, 0x00,0x00, + 0x00,0x01, 0x00,0x00, + 0x00,0x01, 0x00,0x00, + 0x00,0x01, 0x00,0x00, + 0x00,0x01, 0x00,0x00, + 0x00,0x01, 0x00,0x00,/* PLUS 31x31 = 6.5 */ + + 0x00,0x00, 0x80,0x00, + 0x00,0x00, 0x80,0x00, + 0x00,0x00, 0x80,0x00, + 0x00,0x00, 0x80,0x00, + 0x00,0x00, 0x80,0x00, + 0x00,0x00, 0x80,0x00, + 0x00,0x00, 0x80,0x00, + 0x00,0x00, 0x80,0x00, + 0x00,0x00, 0x80,0x00, + 0x00,0x00, 0x80,0x00, + 0x00,0x00, 0x80,0x00, + 0x00,0x00, 0x80,0x00, + 0x00,0x00, 0x80,0x00, + 0x00,0x00, 0x80,0x00, + 0x00,0x00, 0x80,0x00, + 0x00,0x00, 0x80,0x00, + 0xff,0xff, 0xff,0xff, + 0x00,0x00, 0x80,0x00, + 0x00,0x00, 0x80,0x00, + 0x00,0x00, 0x80,0x00, + 0x00,0x00, 0x80,0x00, + 0x00,0x00, 0x80,0x00, + 0x00,0x00, 0x80,0x00, + 0x00,0x00, 0x80,0x00, + 0x00,0x00, 0x80,0x00, + 0x00,0x00, 0x80,0x00, + 0x00,0x00, 0x80,0x00, + 0x00,0x00, 0x80,0x00, + 0x00,0x00, 0x80,0x00, + 0x00,0x00, 0x80,0x00, + 0x00,0x00, 0x80,0x00, + 0x00,0x00, 0x80,0x00,/* PLUS 32x32 = 7.0 */ + + /* TYPE = STAR */ + + 0x10, + 0x10, + 0xd6, + 0x38, + 0x10, + 0x38, + 0xd6, + 0x10, + 0x10,/* STAR 7x9 = 1.0 */ + + 0x08,0x00, + 0x08,0x00, + 0x08,0x00, + 0xc9,0x80, + 0x3e,0x00, + 0x08,0x00, + 0x3e,0x00, + 0xc9,0x80, + 0x08,0x00, + 0x08,0x00, + 0x08,0x00,/* STAR 9x11 = 1.5 */ + + 0x04,0x00, + 0x04,0x00, + 0x04,0x00, + 0x84,0x20, + 0x64,0xc0, + 0x1f,0x00, + 0x04,0x00, + 0x1f,0x00, + 0x64,0xc0, + 0x84,0x20, + 0x04,0x00, + 0x04,0x00, + 0x04,0x00,/* STAR 11x13 = 2.0 */ + + 0x02,0x00, + 0x02,0x00, + 0x02,0x00, + 0x02,0x00, + 0x82,0x18, + 0x62,0x60, + 0x1b,0x80, + 0x06,0x00, + 0x1b,0x80, + 0x62,0x60, + 0x82,0x18, + 0x02,0x00, + 0x02,0x00, + 0x02,0x00, + 0x02,0x00,/* STAR 13x15 = 2.5 */ + + 0x02,0x00, + 0x02,0x00, + 0x02,0x00, + 0x02,0x00, + 0x82,0x08, + 0x62,0x30, + 0x12,0x40, + 0x0f,0x80, + 0x02,0x00, + 0x0f,0x80, + 0x12,0x40, + 0x62,0x30, + 0x82,0x08, + 0x02,0x00, + 0x02,0x00, + 0x02,0x00, + 0x02,0x00,/* STAR 13x17 = 3.0 */ + + 0x01,0x00, + 0x01,0x00, + 0x01,0x00, + 0x01,0x00, + 0x01,0x00, + 0xc1,0x06, + 0x21,0x18, + 0x19,0x20, + 0x07,0xc0, + 0x01,0x00, + 0x07,0xc0, + 0x19,0x20, + 0x21,0x18, + 0xc1,0x06, + 0x01,0x00, + 0x01,0x00, + 0x01,0x00, + 0x01,0x00, + 0x01,0x00,/* STAR 15x19 = 3.5 */ + + 0x00,0x80, 0x00, + 0x00,0x80, 0x00, + 0x00,0x80, 0x00, + 0x00,0x80, 0x00, + 0x00,0x80, 0x00, + 0x80,0x80, 0x80, + 0x60,0x83, 0x00, + 0x10,0x8c, 0x00, + 0x0c,0x90, 0x00, + 0x03,0xe0, 0x00, + 0x00,0x80, 0x00, + 0x03,0xe0, 0x00, + 0x0c,0x90, 0x00, + 0x10,0x8c, 0x00, + 0x60,0x83, 0x00, + 0x80,0x80, 0x80, + 0x00,0x80, 0x00, + 0x00,0x80, 0x00, + 0x00,0x80, 0x00, + 0x00,0x80, 0x00, + 0x00,0x80, 0x00,/* STAR 17x21 = 4.0 */ + + 0x00,0x40, 0x00, + 0x00,0x40, 0x00, + 0x00,0x40, 0x00, + 0x00,0x40, 0x00, + 0x00,0x40, 0x00, + 0x00,0x40, 0x00, + 0xc0,0x40, 0x60, + 0x30,0x41, 0x80, + 0x08,0x42, 0x00, + 0x06,0x4c, 0x00, + 0x01,0xf0, 0x00, + 0x00,0x40, 0x00, + 0x01,0xf0, 0x00, + 0x06,0x4c, 0x00, + 0x08,0x42, 0x00, + 0x30,0x41, 0x80, + 0xc0,0x40, 0x60, + 0x00,0x40, 0x00, + 0x00,0x40, 0x00, + 0x00,0x40, 0x00, + 0x00,0x40, 0x00, + 0x00,0x40, 0x00, + 0x00,0x40, 0x00,/* STAR 19x23 = 4.5 */ + + 0x00,0x20, 0x00, + 0x00,0x20, 0x00, + 0x00,0x20, 0x00, + 0x00,0x20, 0x00, + 0x00,0x20, 0x00, + 0x00,0x20, 0x00, + 0x80,0x20, 0x08, + 0x60,0x20, 0x30, + 0x18,0x20, 0xc0, + 0x04,0x21, 0x00, + 0x03,0x26, 0x00, + 0x00,0xf8, 0x00, + 0x00,0x20, 0x00, + 0x00,0xf8, 0x00, + 0x03,0x26, 0x00, + 0x04,0x21, 0x00, + 0x18,0x20, 0xc0, + 0x60,0x20, 0x30, + 0x80,0x20, 0x08, + 0x00,0x20, 0x00, + 0x00,0x20, 0x00, + 0x00,0x20, 0x00, + 0x00,0x20, 0x00, + 0x00,0x20, 0x00, + 0x00,0x20, 0x00,/* STAR 21x25 = 5.0 */ + + 0x00,0x10, 0x00, + 0x00,0x10, 0x00, + 0x00,0x10, 0x00, + 0x00,0x10, 0x00, + 0x00,0x10, 0x00, + 0x00,0x10, 0x00, + 0x00,0x10, 0x00, + 0xc0,0x10, 0x06, + 0x30,0x10, 0x18, + 0x08,0x10, 0x60, + 0x06,0x10, 0x80, + 0x01,0x93, 0x00, + 0x00,0x7c, 0x00, + 0x00,0x10, 0x00, + 0x00,0x7c, 0x00, + 0x01,0x93, 0x00, + 0x06,0x10, 0x80, + 0x08,0x10, 0x60, + 0x30,0x10, 0x18, + 0xc0,0x10, 0x06, + 0x00,0x10, 0x00, + 0x00,0x10, 0x00, + 0x00,0x10, 0x00, + 0x00,0x10, 0x00, + 0x00,0x10, 0x00, + 0x00,0x10, 0x00, + 0x00,0x10, 0x00,/* STAR 23x27 = 5.5 */ + + 0x00,0x08, 0x00,0x00, + 0x00,0x08, 0x00,0x00, + 0x00,0x08, 0x00,0x00, + 0x00,0x08, 0x00,0x00, + 0x00,0x08, 0x00,0x00, + 0x00,0x08, 0x00,0x00, + 0x00,0x08, 0x00,0x00, + 0x80,0x08, 0x00,0x80, + 0x60,0x08, 0x03,0x00, + 0x18,0x08, 0x0c,0x00, + 0x04,0x08, 0x30,0x00, + 0x03,0x08, 0x40,0x00, + 0x00,0xc9, 0x80,0x00, + 0x00,0x3e, 0x00,0x00, + 0x00,0x08, 0x00,0x00, + 0x00,0x3e, 0x00,0x00, + 0x00,0xc9, 0x80,0x00, + 0x03,0x08, 0x40,0x00, + 0x04,0x08, 0x30,0x00, + 0x18,0x08, 0x0c,0x00, + 0x60,0x08, 0x03,0x00, + 0x80,0x08, 0x00,0x80, + 0x00,0x08, 0x00,0x00, + 0x00,0x08, 0x00,0x00, + 0x00,0x08, 0x00,0x00, + 0x00,0x08, 0x00,0x00, + 0x00,0x08, 0x00,0x00, + 0x00,0x08, 0x00,0x00, + 0x00,0x08, 0x00,0x00,/* STAR 25x29 = 6.0 */ + + 0x00,0x00, 0x80,0x00, + 0x00,0x00, 0x80,0x00, + 0x00,0x00, 0x80,0x00, + 0x00,0x00, 0x80,0x00, + 0x00,0x00, 0x80,0x00, + 0x00,0x00, 0x80,0x00, + 0x00,0x00, 0x80,0x00, + 0x00,0x00, 0x80,0x00, + 0x00,0x00, 0x80,0x00, + 0x30,0x00, 0x80,0x06, + 0x0c,0x00, 0x80,0x18, + 0x03,0x00, 0x80,0x60, + 0x00,0xc0, 0x81,0x80, + 0x00,0x30, 0x86,0x00, + 0x00,0x0c, 0x98,0x00, + 0x00,0x03, 0xe0,0x00, + 0x00,0x03, 0xe0,0x00, + 0x00,0x0c, 0x98,0x00, + 0x00,0x30, 0x86,0x00, + 0x00,0xc0, 0x81,0x80, + 0x03,0x00, 0x80,0x60, + 0x0c,0x00, 0x80,0x18, + 0x30,0x00, 0x80,0x06, + 0x00,0x00, 0x80,0x00, + 0x00,0x00, 0x80,0x00, + 0x00,0x00, 0x80,0x00, + 0x00,0x00, 0x80,0x00, + 0x00,0x00, 0x80,0x00, + 0x00,0x00, 0x80,0x00, + 0x00,0x00, 0x80,0x00, + 0x00,0x00, 0x00,0x00, + 0x00,0x00, 0x00,0x00,/* STAR 32x32 = 6.5 */ + + 0x00, 0x00, 0x80, 0x00, + 0x00, 0x00, 0x80, 0x00, + 0x00, 0x00, 0x80, 0x00, + 0x00, 0x00, 0x80, 0x00, + 0x00, 0x00, 0x80, 0x00, + 0x00, 0x00, 0x80, 0x00, + 0x00, 0x00, 0x80, 0x00, + 0x00, 0x00, 0x80, 0x00, + 0x10, 0x00, 0x80, 0x04, + 0x0c, 0x00, 0x80, 0x18, + 0x02, 0x00, 0x80, 0x20, + 0x01, 0x80, 0x80, 0xc0, + 0x00, 0x40, 0x81, 0x00, + 0x00, 0x30, 0x86, 0x00, + 0x00, 0x08, 0x88, 0x00, + 0x00, 0x06, 0xb0, 0x00, + 0x00, 0x01, 0xc0, 0x00, + 0x00, 0x06, 0xb0, 0x00, + 0x00, 0x08, 0x88, 0x00, + 0x00, 0x30, 0x86, 0x00, + 0x00, 0x40, 0x81, 0x00, + 0x01, 0x80, 0x80, 0xc0, + 0x02, 0x00, 0x80, 0x20, + 0x0c, 0x00, 0x80, 0x18, + 0x10, 0x00, 0x80, 0x04, + 0x00, 0x00, 0x80, 0x00, + 0x00, 0x00, 0x80, 0x00, + 0x00, 0x00, 0x80, 0x00, + 0x00, 0x00, 0x80, 0x00, + 0x00, 0x00, 0x80, 0x00, + 0x00, 0x00, 0x80, 0x00, + 0x00, 0x00, 0x80, 0x00,/* STAR 32x32 = 7.0 */ + + /* TYPE = CIRC */ + + 0x38, + 0x44, + 0x82, + 0x82, + 0x82, + 0x44, + 0x38,/* CIRC 7x7 = 1.0 */ + + 0x3c,0x00, + 0x42,0x00, + 0x81,0x00, + 0x81,0x00, + 0x81,0x00, + 0x81,0x00, + 0x42,0x00, + 0x3c,0x00, + 0x00,0x00,/*CIRC 9x9 = 1.5 */ + + 0x3e, 0x00, + 0x41, 0x00, + 0x81, 0x80, + 0x80,0x80, + 0x80,0x80, + 0x80,0x80, + 0x81, 0x80, + 0x41, 0x00, + 0x3e,0x00,/* CIRC 9x9 = 2.0 */ + + 0x1f,0x00, + 0x20,0x80, + 0x40,0x40, + 0x80,0x20, + 0x80,0x20, + 0x80,0x20, + 0x80,0x20, + 0x80,0x20, + 0x40,0x40, + 0x20,0x80, + 0x1f,0x00,/* CIRC 11x11 = 2.5 */ + + 0x0f,0x80, + 0x10,0x40, + 0x20,0x20, + 0x40,0x10, + 0x80,0x08, + 0x80,0x08, + 0x80,0x08, + 0x80,0x08, + 0x80,0x08, + 0x40,0x10, + 0x20,0x20, + 0x10,0x40, + 0x0f,0x80,/* CIRC 13x13 = 3.0 */ + + 0x07,0xc0, + 0x18,0x30, + 0x20,0x08, + 0x40,0x04, + 0x40,0x04, + 0x80,0x02, + 0x80,0x02, + 0x80,0x02, + 0x80,0x02, + 0x80,0x02, + 0x40,0x04, + 0x40,0x04, + 0x20,0x08, + 0x18,0x30, + 0x07,0xc0,/* CIRC 15x15 = 3.5 */ + + 0x03,0xe0, 0x00, + 0x0c,0x18, 0x00, + 0x10,0x04, 0x00, + 0x20,0x02, 0x00, + 0x40,0x01, 0x00, + 0x40,0x01, 0x00, + 0x80,0x00, 0x80, + 0x80,0x00, 0x80, + 0x80,0x00, 0x80, + 0x80,0x00, 0x80, + 0x80,0x00, 0x80, + 0x40,0x01, 0x00, + 0x40,0x01, 0x00, + 0x20,0x02, 0x00, + 0x10,0x04, 0x00, + 0x0c,0x18, 0x00, + 0x03,0xe0, 0x00,/* CIRC 17x17 = 4.0 */ + + 0x03,0xf8, 0x00, + 0x0e,0x0e, 0x00, + 0x18,0x03, 0x00, + 0x20,0x00, 0x80, + 0x60,0x00, 0xc0, + 0x40,0x00, 0x40, + 0xc0,0x00, 0x60, + 0x80,0x00, 0x20, + 0x80,0x00, 0x20, + 0x80,0x00, 0x20, + 0x80,0x00, 0x20, + 0x80,0x00, 0x20, + 0xc0,0x00, 0x60, + 0x40,0x00, 0x40, + 0x60,0x00, 0xc0, + 0x20,0x00, 0x80, + 0x18,0x03, 0x00, + 0x0e,0x0e, 0x00, + 0x03,0xf8, 0x00,/* CIRC 19x19 = 4.5 */ + + 0x01,0xfc, 0x00, + 0x06,0x03, 0x00, + 0x08,0x00, 0x80, + 0x10,0x00, 0x40, + 0x20,0x00, 0x20, + 0x40,0x00, 0x10, + 0x40,0x00, 0x10, + 0x80,0x00, 0x08, + 0x80,0x00, 0x08, + 0x80,0x00, 0x08, + 0x80,0x00, 0x08, + 0x80,0x00, 0x08, + 0x80,0x00, 0x08, + 0x80,0x00, 0x08, + 0x40,0x00, 0x10, + 0x40,0x00, 0x10, + 0x20,0x00, 0x20, + 0x10,0x00, 0x40, + 0x08,0x00, 0x80, + 0x06,0x03, 0x00, + 0x01,0xfc, 0x00,/* CIRC 21x21 = 5.0 */ + + 0x00,0xfe, 0x00, + 0x03,0x01, 0x80, + 0x0c,0x00, 0x60, + 0x18,0x00, 0x30, + 0x30,0x00, 0x18, + 0x20,0x00, 0x08, + 0x40,0x00, 0x04, + 0x40,0x00, 0x04, + 0x80,0x00, 0x02, + 0x80,0x00, 0x02, + 0x80,0x00, 0x02, + 0x80,0x00, 0x02, + 0x80,0x00, 0x02, + 0x80,0x00, 0x02, + 0x80,0x00, 0x02, + 0x40,0x00, 0x04, + 0x40,0x00, 0x04, + 0x20,0x00, 0x08, + 0x30,0x00, 0x18, + 0x18,0x00, 0x30, + 0x0c,0x00, 0x60, + 0x03,0x01, 0x80, + 0x00,0xfe, 0x00,/* CIRC 23x23 = 5.5 */ + + 0x00,0x7f, 0x00,0x00, + 0x01,0x80, 0xc0,0x00, + 0x06,0x00, 0x30,0x00, + 0x08,0x00, 0x08,0x00, + 0x10,0x00, 0x04,0x00, + 0x20,0x00, 0x02,0x00, + 0x20,0x00, 0x02,0x00, + 0x40,0x00, 0x01,0x00, + 0x40,0x00, 0x01,0x00, + 0x80,0x00, 0x00,0x80, + 0x80,0x00, 0x00,0x80, + 0x80,0x00, 0x00,0x80, + 0x80,0x00, 0x00,0x80, + 0x80,0x00, 0x00,0x80, + 0x80,0x00, 0x00,0x80, + 0x80,0x00, 0x00,0x80, + 0x40,0x00, 0x01,0x00, + 0x40,0x00, 0x01,0x00, + 0x20,0x00, 0x02,0x00, + 0x20,0x00, 0x02,0x00, + 0x10,0x00, 0x04,0x00, + 0x08,0x00, 0x08,0x00, + 0x06,0x00, 0x30,0x00, + 0x01,0x80, 0xc0,0x00, + 0x00,0x7f, 0x00,0x00,/* CIRC 25x25 = 6.0 */ + + 0x00,0x3f, 0x80,0x00, + 0x01,0xc0, 0x70,0x00, + 0x03,0x00, 0x18,0x00, + 0x0c,0x00, 0x06,0x00, + 0x18,0x00, 0x03,0x00, + 0x10,0x00, 0x01,0x00, + 0x20,0x00, 0x00,0x80, + 0x60,0x00, 0x00,0xc0, + 0x40,0x00, 0x00,0x40, + 0x40,0x00, 0x00,0x40, + 0x80,0x00, 0x00,0x20, + 0x80,0x00, 0x00,0x20, + 0x80,0x00, 0x00,0x20, + 0x80,0x00, 0x00,0x20, + 0x80,0x00, 0x00,0x20, + 0x80,0x00, 0x00,0x20, + 0x80,0x00, 0x00,0x20, + 0x40,0x00, 0x00,0x40, + 0x40,0x00, 0x00,0x40, + 0x60,0x00, 0x00,0xc0, + 0x20,0x00, 0x00,0x80, + 0x10,0x00, 0x01,0x00, + 0x18,0x00, 0x03,0x00, + 0x0c,0x00, 0x06,0x00, + 0x03,0x00, 0x18,0x00, + 0x01,0xc0, 0x70,0x00, + 0x00,0x3f, 0x80,0x00,/* CIRC 27x27 = 6.5 */ + + 0x00,0x1f, 0xc0,0x00, + 0x00,0xe0, 0x38,0x00, + 0x01,0x00, 0x04,0x00, + 0x06,0x00, 0x03,0x00, + 0x08,0x00, 0x00,0x80, + 0x10,0x00, 0x00,0x40, + 0x10,0x00, 0x00,0x40, + 0x20,0x00, 0x00,0x20, + 0x40,0x00, 0x00,0x10, + 0x40,0x00, 0x00,0x10, + 0x40,0x00, 0x00,0x10, + 0x80,0x00, 0x00,0x08, + 0x80,0x00, 0x00,0x08, + 0x80,0x00, 0x00,0x08, + 0x80,0x00, 0x00,0x08, + 0x80,0x00, 0x00,0x08, + 0x80,0x00, 0x00,0x08, + 0x80,0x00, 0x00,0x08, + 0x40,0x00, 0x00,0x10, + 0x40,0x00, 0x00,0x10, + 0x40,0x00, 0x00,0x10, + 0x20,0x00, 0x00,0x20, + 0x10,0x00, 0x00,0x40, + 0x10,0x00, 0x00,0x40, + 0x08,0x00, 0x00,0x80, + 0x06,0x00, 0x03,0x00, + 0x01,0x00, 0x04,0x00, + 0x00,0xe0, 0x38,0x00, + 0x00,0x1f, 0xc0,0x00, /* CIRC 29x29 = 7.0 */ + + /* TYPE = CROSS */ + + 0x82, + 0x44, + 0x28, + 0x10, + 0x28, + 0x44, + 0x82,/* CROSS 7x7 = 1.0 */ + + 0x80,0x80, + 0x41,0x00, + 0x22,0x00, + 0x14,0x00, + 0x08,0x00, + 0x14,0x00, + 0x22,0x00, + 0x41,0x00, + 0x80,0x80,/* CROSS 9x9 = 1.5 */ + + 0x80,0x20, + 0x40,0x40, + 0x20,0x80, + 0x11,0x00, + 0x0a,0x00, + 0x04,0x00, + 0x0a,0x00, + 0x11,0x00, + 0x20,0x80, + 0x40,0x40, + 0x80,0x20,/* CROSS 11x11 = 2.0 */ + + 0x80,0x08, + 0x40,0x10, + 0x20,0x20, + 0x10,0x40, + 0x08,0x80, + 0x05,0x00, + 0x02,0x00, + 0x05,0x00, + 0x08,0x80, + 0x10,0x40, + 0x20,0x20, + 0x40,0x10, + 0x80,0x08,/* CROSS 13x13 = 2.5 */ + + 0x80,0x02, + 0x40,0x04, + 0x20,0x08, + 0x10,0x10, + 0x08,0x20, + 0x04,0x40, + 0x02,0x80, + 0x01,0x00, + 0x02,0x80, + 0x04,0x40, + 0x08,0x20, + 0x10,0x10, + 0x20,0x08, + 0x40,0x04, + 0x80,0x02,/* CROSS 15x15 = 3.0 */ + + 0x80,0x00, 0x80, + 0x40,0x01, 0x00, + 0x20,0x02, 0x00, + 0x10,0x04, 0x00, + 0x08,0x08, 0x00, + 0x04,0x10, 0x00, + 0x02,0x20, 0x00, + 0x01,0x40, 0x00, + 0x00,0x80, 0x00, + 0x01,0x40, 0x00, + 0x02,0x20, 0x00, + 0x04,0x10, 0x00, + 0x08,0x08, 0x00, + 0x10,0x04, 0x00, + 0x20,0x02, 0x00, + 0x40,0x01, 0x00, + 0x80,0x00, 0x80,/* CROSS 17x17 = 3.5 */ + + 0x80,0x00, 0x20, + 0x40,0x00, 0x40, + 0x20,0x00, 0x80, + 0x10,0x01, 0x00, + 0x08,0x02, 0x00, + 0x04,0x04, 0x00, + 0x02,0x08, 0x00, + 0x01,0x10, 0x00, + 0x00,0xa0, 0x00, + 0x00,0x40, 0x00, + 0x00,0xa0, 0x00, + 0x01,0x10, 0x00, + 0x02,0x08, 0x00, + 0x04,0x04, 0x00, + 0x08,0x02, 0x00, + 0x10,0x01, 0x00, + 0x20,0x00, 0x80, + 0x40,0x00, 0x40, + 0x80,0x00, 0x20,/* CROSS 19x19 = 4.0 */ + + 0x80,0x00, 0x08, + 0x40,0x00, 0x10, + 0x20,0x00, 0x20, + 0x10,0x00, 0x40, + 0x08,0x00, 0x80, + 0x04,0x01, 0x00, + 0x02,0x02, 0x00, + 0x01,0x04, 0x00, + 0x00,0x88, 0x00, + 0x00,0x50, 0x00, + 0x00,0x20, 0x00, + 0x00,0x50, 0x00, + 0x00,0x88, 0x00, + 0x01,0x04, 0x00, + 0x02,0x02, 0x00, + 0x04,0x01, 0x00, + 0x08,0x00, 0x80, + 0x10,0x00, 0x40, + 0x20,0x00, 0x20, + 0x40,0x00, 0x10, + 0x80,0x00, 0x08,/* CROSS 21x21 = 4.5 */ + + 0x80,0x00, 0x02, + 0x40,0x00, 0x04, + 0x20,0x00, 0x08, + 0x10,0x00, 0x10, + 0x08,0x00, 0x20, + 0x04,0x00, 0x40, + 0x02,0x00, 0x80, + 0x01,0x01, 0x00, + 0x00,0x82, 0x00, + 0x00,0x44, 0x00, + 0x00,0x28, 0x00, + 0x00,0x10, 0x00, + 0x00,0x28, 0x00, + 0x00,0x44, 0x00, + 0x00,0x82, 0x00, + 0x01,0x01, 0x00, + 0x02,0x00, 0x80, + 0x04,0x00, 0x40, + 0x08,0x00, 0x20, + 0x10,0x00, 0x10, + 0x20,0x00, 0x08, + 0x40,0x00, 0x04, + 0x80,0x00, 0x02,/* CROSS 23x23 = 5.0 */ + + 0x80,0x00, 0x00,0x80, + 0x40,0x00, 0x01,0x00, + 0x20,0x00, 0x02,0x00, + 0x10,0x00, 0x04,0x00, + 0x08,0x00, 0x08,0x00, + 0x04,0x00, 0x10,0x00, + 0x02,0x00, 0x20,0x00, + 0x01,0x00, 0x40,0x00, + 0x00,0x80, 0x80,0x00, + 0x00,0x41, 0x00,0x00, + 0x00,0x22, 0x00,0x00, + 0x00,0x14, 0x00,0x00, + 0x00,0x08, 0x00,0x00, + 0x00,0x14, 0x00,0x00, + 0x00,0x22, 0x00,0x00, + 0x00,0x41, 0x00,0x00, + 0x00,0x80, 0x80,0x00, + 0x01,0x00, 0x40,0x00, + 0x02,0x00, 0x20,0x00, + 0x04,0x00, 0x10,0x00, + 0x08,0x00, 0x08,0x00, + 0x10,0x00, 0x04,0x00, + 0x20,0x00, 0x02,0x00, + 0x40,0x00, 0x01,0x00, + 0x80,0x00, 0x00,0x80,/* CROSS 25x25 = 5.5 */ + + 0x80,0x00, 0x00,0x20, + 0x40,0x00, 0x00,0x40, + 0x20,0x00, 0x00,0x80, + 0x10,0x00, 0x01,0x00, + 0x08,0x00, 0x02,0x00, + 0x04,0x00, 0x04,0x00, + 0x02,0x00, 0x08,0x00, + 0x01,0x00, 0x10,0x00, + 0x00,0x80, 0x20,0x00, + 0x00,0x40, 0x40,0x00, + 0x00,0x20, 0x80,0x00, + 0x00,0x11, 0x00,0x00, + 0x00,0x0a, 0x00,0x00, + 0x00,0x04, 0x00,0x00, + 0x00,0x0a, 0x00,0x00, + 0x00,0x11, 0x00,0x00, + 0x00,0x20, 0x80,0x00, + 0x00,0x40, 0x40,0x00, + 0x00,0x80, 0x20,0x00, + 0x01,0x00, 0x10,0x00, + 0x02,0x00, 0x08,0x00, + 0x04,0x00, 0x04,0x00, + 0x08,0x00, 0x02,0x00, + 0x10,0x00, 0x01,0x00, + 0x20,0x00, 0x00,0x80, + 0x40,0x00, 0x00,0x40, + 0x80,0x00, 0x00,0x20,/* CROSS 27x27 = 6.0 */ + + 0x00,0x00, 0x00,0x00, + 0x00,0x00, 0x00,0x00, + 0x20,0x00, 0x00,0x04, + 0x10,0x00, 0x00,0x08, + 0x08,0x00, 0x00,0x10, + 0x04,0x00, 0x00,0x20, + 0x02,0x00, 0x00,0x40, + 0x01,0x00, 0x00,0x80, + 0x00,0x80, 0x01,0x00, + 0x00,0x40, 0x02,0x00, + 0x00,0x20, 0x04,0x00, + 0x00,0x10, 0x08,0x00, + 0x00,0x08, 0x10,0x00, + 0x00,0x04, 0x20,0x00, + 0x00,0x02, 0x40,0x00, + 0x00,0x01, 0x80,0x00, + 0x00,0x01, 0x80,0x00, + 0x00,0x02, 0x40,0x00, + 0x00,0x04, 0x20,0x00, + 0x00,0x08, 0x10,0x00, + 0x00,0x10, 0x08,0x00, + 0x00,0x20, 0x04,0x00, + 0x00,0x40, 0x02,0x00, + 0x00,0x80, 0x01,0x00, + 0x01,0x00, 0x00,0x80, + 0x02,0x00, 0x00,0x40, + 0x04,0x00, 0x00,0x20, + 0x08,0x00, 0x00,0x10, + 0x10,0x00, 0x00,0x08, + 0x20,0x00, 0x00,0x04, + 0x00,0x00, 0x00,0x00, + 0x00,0x00, 0x00,0x00,/* CROSS 32x32 = 6.5 */ + + 0x00,0x00, 0x00,0x00, + 0x40,0x00, 0x00,0x02, + 0x20,0x00, 0x00,0x04, + 0x10,0x00, 0x00,0x08, + 0x08,0x00, 0x00,0x10, + 0x04,0x00, 0x00,0x20, + 0x02,0x00, 0x00,0x40, + 0x01,0x00, 0x00,0x80, + 0x00,0x80, 0x01,0x00, + 0x00,0x40, 0x02,0x00, + 0x00,0x20, 0x04,0x00, + 0x00,0x10, 0x08,0x00, + 0x00,0x08, 0x10,0x00, + 0x00,0x04, 0x20,0x00, + 0x00,0x02, 0x40,0x00, + 0x00,0x01, 0x80,0x00, + 0x00,0x01, 0x80,0x00, + 0x00,0x02, 0x40,0x00, + 0x00,0x04, 0x20,0x00, + 0x00,0x08, 0x10,0x00, + 0x00,0x10, 0x08,0x00, + 0x00,0x20, 0x04,0x00, + 0x00,0x40, 0x02,0x00, + 0x00,0x80, 0x01,0x00, + 0x01,0x00, 0x00,0x80, + 0x02,0x00, 0x00,0x40, + 0x04,0x00, 0x00,0x20, + 0x08,0x00, 0x00,0x10, + 0x10,0x00, 0x00,0x08, + 0x20,0x00, 0x00,0x04, + 0x40,0x00, 0x00,0x02, + 0x00,0x00, 0x00,0x00/* CROSS 32x32 = 7.0 */ +}; + +/*----------------------------------------------------------------------*/ + +//TsmInitAttributes +void OpenGl_Display::InitAttributes () +{ + // Return if already initialized + if (myLinestyleBase) return; + + myLinestyleBase = glGenLists(5); + + /* Line */ + + glNewList( (GLuint)myLinestyleBase+(GLuint)Aspect_TOL_DASH, GL_COMPILE ); + glLineStipple(1, DASH_LS ); + glEndList(); + + glNewList( (GLuint)myLinestyleBase+(GLuint)Aspect_TOL_DOT, GL_COMPILE ); + glLineStipple(1, DOT_LS ); + glEndList(); + + glNewList( (GLuint)myLinestyleBase+(GLuint)Aspect_TOL_DOTDASH, GL_COMPILE ); + glLineStipple(1, DASH_DOT_LS ); + glEndList(); + + glNewList( (GLuint)myLinestyleBase+(GLuint)Aspect_TOL_USERDEFINED, GL_COMPILE ); + glLineStipple(1, DASH_DDOT_LS ); + glEndList(); + + /* FSXXX + * GL_POLYGON_STIPPLE + * need 32x32 stipple patterns + */ + const int nbi = sizeof(myInteriors)/(32*sizeof(unsigned int)); + myPatternBase = glGenLists(TEL_HS_USER_DEF_START); + int i; + for( i = 1; i < TEL_HS_USER_DEF_START; i++ ) + { + glNewList( (GLuint)myPatternBase + i, GL_COMPILE ); + glPolygonStipple((const GLubyte *) (myInteriors[i Aspect_TOM_O_X )? Aspect_TOM_X : AType); + + const float index = ( float )(TEL_NO_OF_SIZES-1) * (AVal - ( float )TEL_PM_START_SIZE ) / ( float )(TEL_PM_END_SIZE - TEL_PM_START_SIZE); + int id = (int)(index + 0.5F); + if (id < 0) id = 0; + else if (id >= TEL_NO_OF_SIZES) id = TEL_NO_OF_SIZES-1; + + return arrPMFontInfo[atype][id].str; +} + +/*----------------------------------------------------------------------*/ + +void OpenGl_Display::SetBaseForMarker () const +{ + glListBase( (const GLuint) myMarkerBase ); +} + +/*----------------------------------------------------------------------*/ + +void OpenGl_Display::SetTypeOfLine (const Aspect_TypeOfLine AType) const +{ + if (AType != Aspect_TOL_SOLID) + { + glCallList((GLuint)myLinestyleBase+(GLuint)AType); + glEnable( GL_LINE_STIPPLE ); +#ifdef HAVE_GL2PS + gl2psEnable( GL2PS_LINE_STIPPLE ); +#endif + } + else + { + glDisable( GL_LINE_STIPPLE ); +#ifdef HAVE_GL2PS + gl2psDisable( GL2PS_LINE_STIPPLE ); +#endif + } +} + +/*----------------------------------------------------------------------*/ + +void OpenGl_Display::SetTypeOfHatch (const int AType) const +{ + if (AType) + { + glCallList((GLuint)myPatternBase+(GLuint)AType); + glEnable( GL_POLYGON_STIPPLE ); + } + else + glDisable( GL_POLYGON_STIPPLE ); +} + +/*----------------------------------------------------------------------*/ diff --git a/src/OpenGl/OpenGl_Element.hxx b/src/OpenGl/OpenGl_Element.hxx new file mode 100644 index 0000000000..e10510e085 --- /dev/null +++ b/src/OpenGl/OpenGl_Element.hxx @@ -0,0 +1,23 @@ +// File: OpenGl_Element.hxx +// Created: 5 August 2011 +// Author: Sergey ZERCHANINOV +// Copyright: OPEN CASCADE 2011 + +#ifndef OpenGl_Element_Header +#define OpenGl_Element_Header + +#include + +class OpenGl_Element +{ + public: + OpenGl_Element () {} + virtual ~OpenGl_Element () {} + + virtual void Render (const Handle(OpenGl_Workspace) &AWorkspace) const = 0; + + public: + IMPLEMENT_MEMORY_OPERATORS +}; + +#endif //OpenGl_Element_Header diff --git a/src/OpenGl/OpenGl_ExtFBO.hxx b/src/OpenGl/OpenGl_ExtFBO.hxx new file mode 100644 index 0000000000..eb6ae7bb67 --- /dev/null +++ b/src/OpenGl/OpenGl_ExtFBO.hxx @@ -0,0 +1,68 @@ +// File: OpenGl_ExtVBO.hxx +// Created: 26 January 2012 +// Author: Kirill GAVRILOV +// Copyright: OPEN CASCADE 2012 + +#ifndef _OpenGl_ExtFBO_H__ +#define _OpenGl_ExtFBO_H__ + +#if (defined(_WIN32) || defined(__WIN32__)) + #include +#endif +#include + +//! FBO is part of OpenGL since 2.0 +struct OpenGl_ExtFBO +{ + #ifndef GL_FRAMEBUFFER_EXT + #define GL_FRAMEBUFFER_EXT 0x8D40 + #endif + #ifndef GL_COLOR_ATTACHMENT0_EXT + #define GL_COLOR_ATTACHMENT0_EXT 0x8CE0 + #endif + #ifndef GL_FRAMEBUFFER_COMPLETE_EXT + #define GL_FRAMEBUFFER_COMPLETE_EXT 0x8CD5 + #endif + #ifndef GL_RENDERBUFFER_EXT + #define GL_RENDERBUFFER_EXT 0x8D41 + #endif + #ifndef GL_DEPTH_ATTACHMENT_EXT + #define GL_DEPTH_ATTACHMENT_EXT 0x8D00 + #endif + +public: + + typedef void (APIENTRY *glGenFramebuffersEXT_t) (GLsizei n, GLuint* ids); + typedef void (APIENTRY *glDeleteFramebuffersEXT_t) (GLsizei n, GLuint* ids); + typedef void (APIENTRY *glBindFramebufferEXT_t) (GLenum target, GLuint id); + typedef void (APIENTRY *glFramebufferTexture2DEXT_t) (GLenum target, GLenum attachmentPoint, + GLenum textureTarget, GLuint textureId, + GLint level); + typedef GLenum (APIENTRY *glCheckFramebufferStatusEXT_t) (GLenum target); + typedef void (APIENTRY *glGenRenderbuffersEXT_t) (GLsizei n, GLuint* ids); + typedef void (APIENTRY *glDeleteRenderbuffersEXT_t) (GLsizei n, GLuint* ids); + typedef void (APIENTRY *glBindRenderbufferEXT_t) (GLenum target, GLuint id); + typedef void (APIENTRY *glRenderbufferStorageEXT_t) (GLenum target, GLenum internalFormat, + GLsizei width, GLsizei height); + + typedef void (APIENTRY *glFramebufferRenderbufferEXT_t) (GLenum target, + GLenum attachmentPoint, + GLenum renderbufferTarget, + GLuint renderbufferId); + +public: + + glGenFramebuffersEXT_t glGenFramebuffersEXT; + glDeleteFramebuffersEXT_t glDeleteFramebuffersEXT; + glBindFramebufferEXT_t glBindFramebufferEXT; + glFramebufferTexture2DEXT_t glFramebufferTexture2DEXT; + glCheckFramebufferStatusEXT_t glCheckFramebufferStatusEXT; + glGenRenderbuffersEXT_t glGenRenderbuffersEXT; + glDeleteRenderbuffersEXT_t glDeleteRenderbuffersEXT; + glBindRenderbufferEXT_t glBindRenderbufferEXT; + glRenderbufferStorageEXT_t glRenderbufferStorageEXT; + glFramebufferRenderbufferEXT_t glFramebufferRenderbufferEXT; + +}; + +#endif // _OpenGl_ExtFBO_H__ diff --git a/src/OpenGl/OpenGl_Extension.cxx b/src/OpenGl/OpenGl_Extension.cxx deleted file mode 100755 index a1b7b28a1d..0000000000 --- a/src/OpenGl/OpenGl_Extension.cxx +++ /dev/null @@ -1,231 +0,0 @@ -/* -* Fonction -* ~~~~~~~~ -* Gestion des extensions sous OpenGL -* -* -* Attention: -* ~~~~~~~~~~~ -* Ce package a ete teste sur SGI, OSF, SUN, HP et WNT. -* -* Remarques: -* ~~~~~~~~~~~ -* Le InitExtensionGLX permet d'initialiser le display. Ceci est necessaire -* pour travailler sur les extensions de GLX. On ne peut appeler QueryExtensionGLX -* si on n'a pas fait cette manip. -* Par contre QueryExtension gere les extensions a GL, on n'a pas besoin du -* Display. -* -* Pour l'instant on ne gere pas les extensions a GLU et a WGL. -* -* Historique des modifications -* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -* 14-10-97: FMN ; creation -* 23-10-97: FMN ; ajout gestion glx -* 04-11-97: FMN ; Gestion des differentes versions GLX -* 19-11-97: FMN ; Ajout GetCurrentDisplay -* 04-12-97: FMN ; Ajout supportsOneDotOne -* 22-07-98: FMN ; InitExtensionGLX n'est execute qu'une fois -* 28-07-98: FMN ; Renomme theDisplay en mytheDisplay -*/ -/*----------------------------------------------------------------------*/ - -/*----------------------------------------------------------------------*/ -/* -* Includes -*/ - -#include -#include -#include - -#include - -#define XDEBUG - -/*----------------------------------------------------------------------*/ -/* -* Types definis -*/ - - -/*----------------------------------------------------------------------*/ -/* -* Variables statiques -*/ - -static Display *mytheDisplay = NULL; -static int screen_num; -static int GLXmajor, GLXminor; -static int GLmajor, GLminor; - -static GLboolean flag_InitExtensionGLX = GL_FALSE; - -static GLboolean OneDotOne = GL_FALSE; -static GLboolean initOneDotOne = GL_FALSE; - -/*----------------------------------------------------------------------*/ -/* -* Fonctions publiques -*/ - -/*----------------------------------------------------------------------*/ -extern GLboolean CheckExtension(char *extName, const char *extString) -{ - /* - ** Search for extName in the extensions string. Use of strstr() - ** is not sufficient because extension names can be prefixes of - ** other extension names. Could use strtok() but the constant - ** string returned by glGetString can be in read-only memory. - */ - char *p = (char *)extString; - char *end; - int extNameLen; - - extNameLen = strlen(extName); - end = p + strlen(p); - - while (p < end) { - int n = strcspn(p, " "); - if ((extNameLen == n) && (strncmp(extName, p, n) == 0)) { - return GL_TRUE; - } - p += (n + 1); - } - return GL_FALSE; -} - -extern GLboolean InitExtensionGLX(Display *display) -{ -#ifndef WNT - - int dontcare; /* for returned arguments we don't care about */ - - if (display == NULL) return GL_FALSE; - - if (!flag_InitExtensionGLX) - { - /* does the server know about OpenGL & GLX? */ - if(!XQueryExtension(display, "GLX", &dontcare, &dontcare, &dontcare)) { -#ifdef DEBUG - fprintf(stderr,"This system doesn't appear to support OpenGL\n"); -#endif /* DEBUG */ - return GL_FALSE; - } - - /* find the glx version */ - if(glXQueryVersion(display, &GLXmajor, &GLXminor)) { -#ifdef DEBUG - printf("GLX Version: %d.%d\n", GLXmajor, GLXminor); -#endif /* DEBUG */ - } else { -#ifdef DEBUG - fprintf(stderr, "Error: glXQueryVersion() failed.\n"); -#endif /* DEBUG */ - return GL_FALSE; - } - - /* get screen number */ - screen_num = DefaultScreen(display); - - flag_InitExtensionGLX = GL_TRUE; - mytheDisplay = display; - - } /* (!flag_InitExtensionGLX) */ - - return GL_TRUE; - -#else - - return GL_FALSE; - -#endif /* WNT */ -} - -/*----------------------------------------------------------------------*/ -extern GLboolean QueryExtensionGLX(char *extName) -{ - GLboolean result = GL_FALSE; - -#ifdef GLX_VERSION_1_1 - if (flag_InitExtensionGLX) - { - if ( GLXminor > 1 || GLXmajor > 1 ) /* GLX_VERSION_1_2 */ - { - /* Certaines extensions sont par defaut dans la version 1.2 */ - if (strcmp(extName,"GLX_EXT_import_context")) return GL_TRUE; - result = CheckExtension(extName, glXQueryExtensionsString(mytheDisplay, screen_num)); - } - else if( GLXminor > 0 || GLXmajor > 1 ) /* GLX_VERSION_1_1 */ - { - result = CheckExtension(extName, glXQueryExtensionsString(mytheDisplay, screen_num)); - } - } -#endif -#ifdef DEBUG - printf("QueryExtensionGLX: %s %d", extName, result); -#endif - return result; -} - -/*----------------------------------------------------------------------*/ -extern Display *GetCurrentDisplay(void) -{ -#ifdef DEBUG - printf("GetCurrentDisplay %x \n", mytheDisplay); -#endif - return mytheDisplay; -} - -/*----------------------------------------------------------------------*/ -extern GLboolean QueryExtension(char *extName) -{ - GLboolean result = GL_FALSE; - - if (supportsOneDotOne()) /* GL_VERSION_1_1 ou more */ - { - /* Certaines extensions sont par defaut dans la version 1.1 */ - /* Certain extensions are the defaut in version 1.1 */ - if ((strcmp(extName,"GL_EXT_vertex_array")) || - (strcmp(extName,"GL_EXT_polygon_offset")) || - (strcmp(extName,"GL_EXT_blend_logic_op")) || - (strcmp(extName,"GL_EXT_texture")) || - (strcmp(extName,"GL_EXT_copy_texture")) || - (strcmp(extName,"GL_EXT_subtexture")) || - (strcmp(extName,"GL_EXT_texture_object"))) - result = GL_TRUE; - else - result = CheckExtension(extName, (char *)glGetString(GL_EXTENSIONS)); - } - else /* GL_VERSION_1_0 */ - { - result = CheckExtension(extName, (char *)glGetString(GL_EXTENSIONS)); - } - -#ifdef DEBUG - printf("QueryExtension: %s %d \n", extName, result); -#endif - return result; -} -/*----------------------------------------------------------------------*/ - -extern GLboolean supportsOneDotOne(void) -{ - const GLubyte *version; - - if (!initOneDotOne) - { - version = glGetString(GL_VERSION); - if(sscanf((const char *)version, "%d.%d", &GLmajor, &GLminor) == 2) - { - OneDotOne = (GLmajor>=1 && GLminor >=1); - } - initOneDotOne = GL_TRUE; - } -#ifdef DEBUG - printf("GL Version: %d.%d\n", GLmajor, GLminor); -#endif /* DEBUG */ - return OneDotOne; -} - -/*----------------------------------------------------------------------*/ diff --git a/src/OpenGl/OpenGl_Extension.hxx b/src/OpenGl/OpenGl_Extension.hxx deleted file mode 100755 index c12912ac81..0000000000 --- a/src/OpenGl/OpenGl_Extension.hxx +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Fonction - * ~~~~~~~~ - * Gestion des extensions sous OpenGL - * - * - * Attention: - * ~~~~~~~~~~~ - * Ce package a ete teste sur SGI, OSF, SUN, HP et WNT. - * - * Remarques: - * ~~~~~~~~~~~ - * Le InitExtensionGLX permet d'initialiser le display. Ceci est necessaire - * pour travailler sur les extensions de GLX. On ne peut appeler QueryExtensionGLX - * si on n'a pas fait cette manip. - * Par contre QueryExtension gere les extensions a GL, on n'a pas besoin du - * Display. - * - * Pour l'instant on ne gere pas les extensions a GLU et a WGL. - * - * Historique des modifications - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - * 14-10-97: FMN ; Creation - * 23-10-97: FMN ; Ajout gestion glx - * 19-11-97: FMN ; Ajout GetCurrentDisplay - * 04-12-97: FMN ; Ajout supportsOneDotOne - * 19-06-98: FMN ; Portage Optimizer (C++) - */ -/*----------------------------------------------------------------------*/ - -#ifndef _OPENGL_EXTENSION_H__ -#define _OPENGL_EXTENSION_H__ - -/*----------------------------------------------------------------------*/ -/* - * Includes - */ - -#if defined(WNT) && !defined(HAVE_NO_DLL) -# ifdef __OpenGl_DLL -# define EXPORT __declspec(dllexport) -# else -# define EXPORT -# endif /* DLL */ -# ifdef STRICT -# undef STRICT -# endif -# define STRICT -# include -#else -# define EXPORT -#endif /* WNT */ - -#include -#include - -#ifdef WNT -# include -# ifndef Display -# define Display char -# endif /* Display */ -#else -# include -#endif /* WNT */ - - -#ifdef GL_VERSION_1_1 -#define GL_EXT_vertex_array 1 -#define GL_EXT_polygon_offset 1 -#define GL_EXT_blend_logic_op 1 -#define GL_EXT_texture 1 -#define GL_EXT_copy_texture 1 -#define GL_EXT_subtexture 1 -#define GL_EXT_texture_object 1 -#endif /* GL_VERSION_1_1 */ - - -#ifndef GLU_VERSION_1_2 -#define GLUtesselator GLUtriangulatorObj -#define GLU_TESS_BEGIN 100100 -#define GLU_TESS_VERTEX 100101 -#define GLU_TESS_END 100102 -#define GLU_TESS_ERROR 100103 -#define GLU_TESS_COMBINE 100105 -#endif - -#define INVALID_EXT_FUNCTION_PTR 0xffffffff -/* - * Contournement temporaire glPolygoneOffsetEXT - * La syntaxe change entre OpenGL 1.0 et OpenGL 1.1 - */ - -#if defined (__sun) || defined (__osf__) || defined (__hp) -#define glPolygonOffsetEXT(a, b) glPolygonOffset(a, b) -#endif -#if defined (__sun) -#define GL_POLYGON_OFFSET_EXT GL_POLYGON_OFFSET_FILL -#endif - -#ifdef WNT -#define glPolygonOffsetEXT(a, b) glPolygonOffset(a, b) -#define GL_POLYGON_OFFSET_EXT GL_POLYGON_OFFSET_FILL -#endif /* WNT */ - -#if defined (__sun) || defined (__osf__) || defined (__hp) || defined (__sgi) -#else -typedef void (APIENTRY * PFNGLBLENDEQUATIONEXTPROC) (GLenum mode); -#endif - -/*----------------------------------------------------------------------*/ -/* - * Prototypes - */ - -/* - * Points d'entree Public du module - */ - - -extern GLboolean InitExtensionGLX(Display *display); -extern GLboolean QueryExtensionGLX(char *extName); - -extern GLboolean QueryExtension(char *extName); - -extern Display *GetCurrentDisplay(void); - -extern GLboolean supportsOneDotOne(void); - -extern GLboolean CheckExtension(char *extName, const char *extString); - - -/* Methods defined in OpenGl_GraphicDriver.cxx */ - -EXPORT GLboolean OpenGl_QueryExtensionGLX (const char *extName); - -EXPORT GLboolean OpenGl_QueryExtension (const char *extName); - -/*----------------------------------------------------------------------*/ - -#endif /* _OPENGL_EXTENSION_H__ */ diff --git a/src/OpenGl/OpenGl_FrameBuffer.cxx b/src/OpenGl/OpenGl_FrameBuffer.cxx index fba0cb7689..11437c855a 100644 --- a/src/OpenGl/OpenGl_FrameBuffer.cxx +++ b/src/OpenGl/OpenGl_FrameBuffer.cxx @@ -1,15 +1,13 @@ +// File: OpenGl_FrameBuffer.cxx +// Author: Kirill GAVRILOV +// Copyright: OPEN CASCADE 2011 + #include #ifdef DEB #include #endif -#ifndef WNT - #define glGetProcAddress( x ) glXGetProcAddress( (const GLubyte*) x ) -#else - #define glGetProcAddress( x ) wglGetProcAddress( x ) -#endif - static inline bool isOddNumber (const GLsizei theNumber) { return theNumber & 0x01; @@ -39,43 +37,6 @@ static inline GLsizei getPowerOfTwo (const GLsizei theNumber, return theThreshold; } -Standard_Boolean OpenGl_FrameBuffer::AreFBOFunctionsValid() -{ - return glGenFramebuffersEXT != NULL - && glDeleteFramebuffersEXT != NULL - && glBindFramebufferEXT != NULL - && glFramebufferTexture2DEXT != NULL - && glCheckFramebufferStatusEXT != NULL - && glGenRenderbuffersEXT != NULL - && glBindRenderbufferEXT != NULL - && glDeleteRenderbuffersEXT != NULL - && glRenderbufferStorageEXT != NULL - && glFramebufferRenderbufferEXT != NULL; -} - -Standard_Boolean OpenGl_FrameBuffer::InitFBOFunctions() -{ - if (AreFBOFunctionsValid()) - { - return Standard_True; - } - if (CheckExtension ((char *)"GL_EXT_framebuffer_object", (const char *)glGetString (GL_EXTENSIONS))) - { - glGenFramebuffersEXT = (glGenFramebuffersEXT_t) glGetProcAddress ("glGenFramebuffersEXT"); - glDeleteFramebuffersEXT = (glDeleteFramebuffersEXT_t) glGetProcAddress ("glDeleteFramebuffersEXT"); - glBindFramebufferEXT = (glBindFramebufferEXT_t) glGetProcAddress ("glBindFramebufferEXT"); - glFramebufferTexture2DEXT = (glFramebufferTexture2DEXT_t) glGetProcAddress ("glFramebufferTexture2DEXT"); - glCheckFramebufferStatusEXT = (glCheckFramebufferStatusEXT_t) glGetProcAddress ("glCheckFramebufferStatusEXT"); - glGenRenderbuffersEXT = (glGenRenderbuffersEXT_t) glGetProcAddress ("glGenRenderbuffersEXT"); - glDeleteRenderbuffersEXT = (glDeleteRenderbuffersEXT_t) glGetProcAddress ("glDeleteRenderbuffersEXT"); - glBindRenderbufferEXT = (glBindRenderbufferEXT_t) glGetProcAddress ("glBindRenderbufferEXT"); - glRenderbufferStorageEXT = (glRenderbufferStorageEXT_t) glGetProcAddress ("glRenderbufferStorageEXT"); - glFramebufferRenderbufferEXT = (glFramebufferRenderbufferEXT_t)glGetProcAddress ("glFramebufferRenderbufferEXT"); - return AreFBOFunctionsValid(); - } - return Standard_False; -} - OpenGl_FrameBuffer::OpenGl_FrameBuffer (GLint theTextureFormat) : mySizeX (0), mySizeY (0), @@ -84,26 +45,17 @@ OpenGl_FrameBuffer::OpenGl_FrameBuffer (GLint theTextureFormat) myTextFormat (theTextureFormat), myGlTextureId (NO_TEXTURE), myGlFBufferId (NO_FRAMEBUFFER), - myGlDepthRBId (NO_RENDERBUFFER), - glGenFramebuffersEXT (NULL), - glDeleteFramebuffersEXT (NULL), - glBindFramebufferEXT (NULL), - glFramebufferTexture2DEXT (NULL), - glCheckFramebufferStatusEXT (NULL), - glGenRenderbuffersEXT (NULL), - glDeleteRenderbuffersEXT (NULL), - glBindRenderbufferEXT (NULL), - glRenderbufferStorageEXT (NULL), - glFramebufferRenderbufferEXT (NULL) + myGlDepthRBId (NO_RENDERBUFFER) { // } -Standard_Boolean OpenGl_FrameBuffer::Init (GLsizei theViewportSizeX, +Standard_Boolean OpenGl_FrameBuffer::Init (const Handle(OpenGl_Context)& theGlContext, + GLsizei theViewportSizeX, GLsizei theViewportSizeY, GLboolean toForcePowerOfTwo) { - if (!InitFBOFunctions()) + if (theGlContext->extFBO == NULL) { #ifdef DEB std::cerr << "OpenGl_FrameBuffer, FBO extension not supported!\n"; @@ -112,7 +64,7 @@ Standard_Boolean OpenGl_FrameBuffer::Init (GLsizei theViewportSizeX, } // clean up previous state - Release(); + Release (theGlContext); // upscale width/height if numbers are odd if (toForcePowerOfTwo) @@ -133,41 +85,41 @@ Standard_Boolean OpenGl_FrameBuffer::Init (GLsizei theViewportSizeX, myVPSizeY = theViewportSizeY; // Create the texture (will be used as color buffer) - if (!InitTrashTexture()) + if (!InitTrashTexture (theGlContext)) { if (!isPowerOfTwo (mySizeX) || !isPowerOfTwo (mySizeY)) { - return Init (theViewportSizeX, theViewportSizeY, GL_TRUE); + return Init (theGlContext, theViewportSizeX, theViewportSizeY, GL_TRUE); } - Release(); + Release (theGlContext); return Standard_False; } // Create RenderBuffer (will be used as depth buffer) - glGenRenderbuffersEXT (1, &myGlDepthRBId); - glBindRenderbufferEXT (GL_RENDERBUFFER_EXT, myGlDepthRBId); - glRenderbufferStorageEXT (GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT, mySizeX, mySizeY); + theGlContext->extFBO->glGenRenderbuffersEXT (1, &myGlDepthRBId); + theGlContext->extFBO->glBindRenderbufferEXT (GL_RENDERBUFFER_EXT, myGlDepthRBId); + theGlContext->extFBO->glRenderbufferStorageEXT (GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT, mySizeX, mySizeY); // Build FBO and setup it as texture - glGenFramebuffersEXT (1, &myGlFBufferId); - glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, myGlFBufferId); + theGlContext->extFBO->glGenFramebuffersEXT (1, &myGlFBufferId); + theGlContext->extFBO->glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, myGlFBufferId); glEnable (GL_TEXTURE_2D); glBindTexture (GL_TEXTURE_2D, myGlTextureId); - glFramebufferTexture2DEXT (GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, myGlTextureId, 0); - glFramebufferRenderbufferEXT (GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, myGlFBufferId); - if (glCheckFramebufferStatusEXT (GL_FRAMEBUFFER_EXT) != GL_FRAMEBUFFER_COMPLETE_EXT) + theGlContext->extFBO->glFramebufferTexture2DEXT (GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, myGlTextureId, 0); + theGlContext->extFBO->glFramebufferRenderbufferEXT (GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, myGlFBufferId); + if (theGlContext->extFBO->glCheckFramebufferStatusEXT (GL_FRAMEBUFFER_EXT) != GL_FRAMEBUFFER_COMPLETE_EXT) { if (!isPowerOfTwo (mySizeX) || !isPowerOfTwo (mySizeY)) { - return Init (theViewportSizeX, theViewportSizeY, GL_TRUE); + return Init (theGlContext, theViewportSizeX, theViewportSizeY, GL_TRUE); } - Release(); + Release (theGlContext); return Standard_False; } - UnbindBuffer(); + UnbindBuffer (theGlContext); UnbindTexture(); - glBindRenderbufferEXT (GL_RENDERBUFFER_EXT, NO_RENDERBUFFER); + theGlContext->extFBO->glBindRenderbufferEXT (GL_RENDERBUFFER_EXT, NO_RENDERBUFFER); #ifdef DEB std::cerr << "OpenGl_FrameBuffer, created FBO " << mySizeX << "x" << mySizeY @@ -176,12 +128,19 @@ Standard_Boolean OpenGl_FrameBuffer::Init (GLsizei theViewportSizeX, return Standard_True; } -void OpenGl_FrameBuffer::Release() +void OpenGl_FrameBuffer::Release (const Handle(OpenGl_Context)& theGlContext) { if (IsValidDepthBuffer()) { - glDeleteRenderbuffersEXT (1, &myGlDepthRBId); - myGlDepthRBId = NO_RENDERBUFFER; + if (!theGlContext.IsNull() && theGlContext->extFBO != NULL) + { + theGlContext->extFBO->glDeleteRenderbuffersEXT (1, &myGlDepthRBId); + myGlDepthRBId = NO_RENDERBUFFER; + } + else + { + std::cerr << "OpenGl_FrameBuffer::Release() called with invalid OpenGl_Context!\n"; + } } if (IsValidTexture()) { @@ -191,8 +150,15 @@ void OpenGl_FrameBuffer::Release() mySizeX = mySizeY = myVPSizeX = myVPSizeY = 0; if (IsValidFrameBuffer()) { - glDeleteFramebuffersEXT (1, &myGlFBufferId); - myGlFBufferId = NO_FRAMEBUFFER; + if (!theGlContext.IsNull() && theGlContext->extFBO != NULL) + { + theGlContext->extFBO->glDeleteFramebuffersEXT (1, &myGlFBufferId); + myGlFBufferId = NO_FRAMEBUFFER; + } + else + { + std::cerr << "OpenGl_FrameBuffer::Release() called with invalid OpenGl_Context!\n"; + } } } @@ -210,7 +176,7 @@ Standard_Boolean OpenGl_FrameBuffer::IsProxySuccess() const return aTestParamX != 0 && aTestParamY != 0; } -Standard_Boolean OpenGl_FrameBuffer::InitTrashTexture() +Standard_Boolean OpenGl_FrameBuffer::InitTrashTexture (const Handle(OpenGl_Context)& theGlContext) { // Check texture size is fit dimension maximum GLint aMaxTexDim = 2048; @@ -234,7 +200,7 @@ Standard_Boolean OpenGl_FrameBuffer::InitTrashTexture() if (!IsProxySuccess()) { - Release(); + Release (theGlContext); return Standard_False; } diff --git a/src/OpenGl/OpenGl_FrameBuffer.hxx b/src/OpenGl/OpenGl_FrameBuffer.hxx index 153d690d72..156b7a5dbc 100644 --- a/src/OpenGl/OpenGl_FrameBuffer.hxx +++ b/src/OpenGl/OpenGl_FrameBuffer.hxx @@ -1,37 +1,15 @@ +// File: OpenGl_FrameBuffer.hxx +// Author: Kirill GAVRILOV +// Copyright: OPEN CASCADE 2011 + #ifndef OPENGL_FRAME_BUFFER_H #define OPENGL_FRAME_BUFFER_H -#include +#include #include #include -#ifndef GL_FRAMEBUFFER_EXT - #define GL_FRAMEBUFFER_EXT 0x8D40 -#endif - -#ifndef GL_COLOR_ATTACHMENT0_EXT - #define GL_COLOR_ATTACHMENT0_EXT 0x8CE0 -#endif - -#ifndef GL_FRAMEBUFFER_COMPLETE_EXT - #define GL_FRAMEBUFFER_COMPLETE_EXT 0x8CD5 -#endif - -#ifndef GL_RENDERBUFFER_EXT - #define GL_RENDERBUFFER_EXT 0x8D41 -#endif - -#ifndef GL_DEPTH_ATTACHMENT_EXT - #define GL_DEPTH_ATTACHMENT_EXT 0x8D00 -#endif - -#ifdef WNT - #define GL_API_ENTRY APIENTRY -#else - #define GL_API_ENTRY -#endif - class OpenGl_FrameBuffer { @@ -42,33 +20,13 @@ public: static const GLuint NO_FRAMEBUFFER = 0; static const GLuint NO_RENDERBUFFER = 0; -public: - - typedef void (GL_API_ENTRY *glGenFramebuffersEXT_t) (GLsizei n, GLuint* ids); - typedef void (GL_API_ENTRY *glDeleteFramebuffersEXT_t) (GLsizei n, GLuint* ids); - typedef void (GL_API_ENTRY *glBindFramebufferEXT_t) (GLenum target, GLuint id); - typedef void (GL_API_ENTRY *glFramebufferTexture2DEXT_t) (GLenum target, GLenum attachmentPoint, - GLenum textureTarget, GLuint textureId, - GLint level); - typedef GLenum (GL_API_ENTRY *glCheckFramebufferStatusEXT_t) (GLenum target); - typedef void (GL_API_ENTRY *glGenRenderbuffersEXT_t) (GLsizei n, GLuint* ids); - typedef void (GL_API_ENTRY *glDeleteRenderbuffersEXT_t) (GLsizei n, GLuint* ids); - typedef void (GL_API_ENTRY *glBindRenderbufferEXT_t) (GLenum target, GLuint id); - typedef void (GL_API_ENTRY *glRenderbufferStorageEXT_t) (GLenum target, GLenum internalFormat, - GLsizei width, GLsizei height); - - typedef void (GL_API_ENTRY *glFramebufferRenderbufferEXT_t) (GLenum target, - GLenum attachmentPoint, - GLenum renderbufferTarget, - GLuint renderbufferId); - public: OpenGl_FrameBuffer (GLint theTextureFormat = GL_RGBA8); virtual ~OpenGl_FrameBuffer() { - Release(); + Release (Handle(OpenGl_Context)()); } //! Texture width. @@ -109,12 +67,13 @@ public: //! current implementation will try to generate compatible FBO; //! 2) FBO rendering will be done in software mode (ForceWare 'hack'); //! 3) FBO rendering will be incorrect (some obsolete Catalyst drivers). - Standard_Boolean Init (GLsizei theViewportSizeX, + Standard_Boolean Init (const Handle(OpenGl_Context)& theGlContext, + GLsizei theViewportSizeX, GLsizei theViewportSizeY, GLboolean toForcePowerOfTwo = GL_FALSE); //! Release GL objects - void Release(); + void Release (const Handle(OpenGl_Context)& theGlContext); //! Setup viewport to render into FBO void SetupViewport() @@ -131,15 +90,15 @@ public: } //! Bind frame buffer (to render into the texture). - void BindBuffer() + void BindBuffer (const Handle(OpenGl_Context)& theGlContext) { - glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, myGlFBufferId); + theGlContext->extFBO->glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, myGlFBufferId); } //! Unbind frame buffer. - void UnbindBuffer() + void UnbindBuffer (const Handle(OpenGl_Context)& theGlContext) { - glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, NO_FRAMEBUFFER); + theGlContext->extFBO->glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, NO_FRAMEBUFFER); } //! Bind the texture. @@ -162,7 +121,7 @@ private: Standard_Boolean IsProxySuccess() const; //! Generate texture with undefined data - Standard_Boolean InitTrashTexture(); + Standard_Boolean InitTrashTexture (const Handle(OpenGl_Context)& theGlContext); Standard_Boolean IsValidTexture() const { @@ -179,9 +138,6 @@ private: return myGlTextureId != NO_RENDERBUFFER; } - Standard_Boolean AreFBOFunctionsValid(); - Standard_Boolean InitFBOFunctions(); - private: GLsizei mySizeX; // texture width @@ -193,18 +149,6 @@ private: GLuint myGlFBufferId; // FBO object ID GLuint myGlDepthRBId; // RenderBuffer object for depth ID - // functions - glGenFramebuffersEXT_t glGenFramebuffersEXT; - glDeleteFramebuffersEXT_t glDeleteFramebuffersEXT; - glBindFramebufferEXT_t glBindFramebufferEXT; - glFramebufferTexture2DEXT_t glFramebufferTexture2DEXT; - glCheckFramebufferStatusEXT_t glCheckFramebufferStatusEXT; - glGenRenderbuffersEXT_t glGenRenderbuffersEXT; - glDeleteRenderbuffersEXT_t glDeleteRenderbuffersEXT; - glBindRenderbufferEXT_t glBindRenderbufferEXT; - glRenderbufferStorageEXT_t glRenderbufferStorageEXT; - glFramebufferRenderbufferEXT_t glFramebufferRenderbufferEXT; - }; #endif //OPENGL_FRAME_BUFFER_H diff --git a/src/OpenGl/OpenGl_graduatedtrihedron.cxx b/src/OpenGl/OpenGl_GraduatedTrihedron.cxx similarity index 62% rename from src/OpenGl/OpenGl_graduatedtrihedron.cxx rename to src/OpenGl/OpenGl_GraduatedTrihedron.cxx index 64f65337d9..2f8c8bc58b 100644 --- a/src/OpenGl/OpenGl_graduatedtrihedron.cxx +++ b/src/OpenGl/OpenGl_GraduatedTrihedron.cxx @@ -1,10 +1,9 @@ -// File: OpenGl_graduatedtrihedron.cxx -// Created: 6 March 2011 +// File: OpenGl_GraduatedTrihedron.cxx +// Created: 20 September 2011 // Author: Sergey ZERCHANINOV -// Copyright: OPEN CASCADE SA 2011 +// Copyright: OPEN CASCADE 2011 #include -#include #include #include @@ -18,10 +17,6 @@ #include #include -#include -#include -#include - #ifdef HAVE_CONFIG_H #include #endif @@ -29,236 +24,48 @@ #include #endif -struct TEL_GRADUATEDTRIHEDRON_DATA -{ - int WsId; - wchar_t *xname, *yname, *zname; - unsigned char xdrawname, ydrawname, zdrawname; - unsigned char xdrawvalues, ydrawvalues, zdrawvalues; - unsigned char drawgrid; - unsigned char drawaxes; - unsigned int nbx, nby, nbz; - int xoffset, yoffset, zoffset; - int xaxisoffset, yaxisoffset, zaxisoffset; - unsigned char xdrawtickmarks, ydrawtickmarks, zdrawtickmarks; - unsigned int xtickmarklength, ytickmarklength, ztickmarklength; - float gridcolor[3]; - float xnamecolor[3]; - float ynamecolor[3]; - float znamecolor[3]; - float xcolor[3]; - float ycolor[3]; - float zcolor[3]; - char* fontOfNames; - OSD_FontAspect styleOfNames; - int sizeOfNames; - char* fontOfValues; - OSD_FontAspect styleOfValues; - int sizeOfValues; - minMaxValuesCallback cbCubicAxes; - void* ptrVisual3dView; - IMPLEMENT_MEMORY_OPERATORS -}; -typedef TEL_GRADUATEDTRIHEDRON_DATA* tel_graduatedtrihedron_data; - -/* Graduated trihedron data */ -static int nbWsIds = 0; /* Number of the views (size of the arrays below */ -static tel_graduatedtrihedron_data* graduatedTrihedronData = 0; /* The array contains graduated trihedron data of all views */ - -/* Bounding box */ -float xmin = 0.0f, ymin = 0.0f, zmin = 0.0f, xmax = 100.0f, ymax = 100.0f, zmax = 100.0f; +#include +#include +#include +#include -static void copyData(const Graphic3d_CGraduatedTrihedron *fromData, TEL_GRADUATEDTRIHEDRON_DATA* toData) -{ - int len; +IMPLEMENT_STANDARD_HANDLE(OpenGl_GraduatedTrihedron,MMgt_TShared) +IMPLEMENT_STANDARD_RTTIEXT(OpenGl_GraduatedTrihedron,MMgt_TShared) - /* Names of axes */ - /* X-name */ - len = fromData->xname.Length(); - if (len) - { - Standard_ExtString iname = fromData->xname.ToExtString(); - toData->xname = new wchar_t[len+1]; - len = 0; while (toData->xname[len] = (wchar_t)(iname[len])) len++; - } - else - toData->xname = NULL; - /* Y-name */ - len = fromData->yname.Length(); - if (len) - { - Standard_ExtString iname = fromData->yname.ToExtString(); - toData->yname = new wchar_t[len+1]; - len = 0; while (toData->yname[len] = (wchar_t)(iname[len])) len++; - } - else - toData->yname = NULL; - /* Z-name */ - len = fromData->zname.Length(); - if (len) - { - Standard_ExtString iname = fromData->zname.ToExtString(); - toData->zname = new wchar_t[len+1]; - len = 0; while (toData->zname[len] = (wchar_t)(iname[len])) len++; - } - else - toData->zname = NULL; - /* Draw names */ - toData->xdrawname = fromData->xdrawname; - toData->ydrawname = fromData->ydrawname; - toData->zdrawname = fromData->zdrawname; - /* Draw values */ - toData->xdrawvalues = fromData->xdrawvalues; - toData->ydrawvalues = fromData->ydrawvalues; - toData->zdrawvalues = fromData->zdrawvalues; - /* Draw grid */ - toData->drawgrid = fromData->drawgrid; - /* Draw axes */ - toData->drawaxes = fromData->drawaxes; - /* Number of splits along axes */ - toData->nbx = fromData->nbx; - toData->nby = fromData->nby; - toData->nbz = fromData->nbz; - /* Offset for drawing values */ - toData->xoffset = fromData->xoffset; - toData->yoffset = fromData->yoffset; - toData->zoffset = fromData->zoffset; - /* Offset for drawing names of axes */ - toData->xaxisoffset = fromData->xaxisoffset; - toData->yaxisoffset = fromData->yaxisoffset; - toData->zaxisoffset = fromData->zaxisoffset; - /* Draw tickmarks */ - toData->xdrawtickmarks = fromData->xdrawtickmarks; - toData->ydrawtickmarks = fromData->ydrawtickmarks; - toData->zdrawtickmarks = fromData->zdrawtickmarks; - /* Length of tickmarks */ - toData->xtickmarklength = fromData->xtickmarklength; - toData->ytickmarklength = fromData->ytickmarklength; - toData->ztickmarklength = fromData->ztickmarklength; - /* Grid color */ - toData->gridcolor[0] = (float) fromData->gridcolor.Red(); - toData->gridcolor[1] = (float) fromData->gridcolor.Green(); - toData->gridcolor[2] = (float) fromData->gridcolor.Blue(); - /* X name color */ - toData->xnamecolor[0] = (float) fromData->xnamecolor.Red(); - toData->xnamecolor[1] = (float) fromData->xnamecolor.Green(); - toData->xnamecolor[2] = (float) fromData->xnamecolor.Blue(); - /* Y name color */ - toData->ynamecolor[0] = (float) fromData->ynamecolor.Red(); - toData->ynamecolor[1] = (float) fromData->ynamecolor.Green(); - toData->ynamecolor[2] = (float) fromData->ynamecolor.Blue(); - /* Z name color */ - toData->znamecolor[0] = (float) fromData->znamecolor.Red(); - toData->znamecolor[1] = (float) fromData->znamecolor.Green(); - toData->znamecolor[2] = (float) fromData->znamecolor.Blue(); - /* X color of axis and values */ - toData->xcolor[0] = (float) fromData->xcolor.Red(); - toData->xcolor[1] = (float) fromData->xcolor.Green(); - toData->xcolor[2] = (float) fromData->xcolor.Blue(); - /* Y color of axis and values */ - toData->ycolor[0] = (float) fromData->ycolor.Red(); - toData->ycolor[1] = (float) fromData->ycolor.Green(); - toData->ycolor[2] = (float) fromData->ycolor.Blue(); - /* Z color of axis and values */ - toData->zcolor[0] = (float) fromData->zcolor.Red(); - toData->zcolor[1] = (float) fromData->zcolor.Green(); - toData->zcolor[2] = (float) fromData->zcolor.Blue(); - /* Font name of names of axes: Courier, Arial, ... */ - len = fromData->fontOfNames.Length(); - toData->fontOfNames = new char[len+1]; - if (len) - strcpy(toData->fontOfNames, fromData->fontOfNames.ToCString()); - else - toData->fontOfNames[0] = L'\0'; - /* Style of names of axes: OSD_FA_Regular, OSD_FA_Bold, ... */ - toData->styleOfNames = fromData->styleOfNames; - /* Size of names of axes: 8, 10, 12, 14, ... */ - toData->sizeOfNames = fromData->sizeOfNames; - /* Font name of values: Courier, Arial, ... */ - len = fromData->fontOfValues.Length(); - toData->fontOfValues = new char[len+1]; - if (len) - strcpy(toData->fontOfValues, fromData->fontOfValues.ToCString()); - else - toData->fontOfValues[0] = L'\0'; - /* Style of values: OSD_FA_Regular, OSD_FA_Bold, ... */ - toData->styleOfValues = fromData->styleOfValues; - /* Size of values: 8, 10, 12, 14, ... */ - toData->sizeOfValues = fromData->sizeOfValues; - /* Callback - updater of boundary box */ - toData->cbCubicAxes = fromData->cbCubicAxes; - toData->ptrVisual3dView = fromData->ptrVisual3dView; -} - -static void freeData() -{ - if (nbWsIds) - { - int i = 0; - tel_graduatedtrihedron_data gtdata; - for (i = 0; i < nbWsIds; i++) - { - gtdata = graduatedTrihedronData[i]; - - // Names of axes - if (gtdata->xname) - delete[] gtdata->xname; - if (gtdata->yname) - delete[] gtdata->yname; - if (gtdata->zname) - delete[] gtdata->zname; - - // Fonts - if (gtdata->fontOfNames) - delete[] gtdata->fontOfNames; - if (gtdata->fontOfValues) - delete[] gtdata->fontOfValues; - - delete gtdata; - } - delete graduatedTrihedronData; - graduatedTrihedronData = 0; - nbWsIds = 0; - } -} +const OpenGl_AspectLine myDefaultAspectLine; -static int getGraduatedTrihedronDataIndex(int WsId) -{ - int i = 0; - for (; i < nbWsIds; i++) - { - if (graduatedTrihedronData[i]->WsId == WsId) - return i; - } - return -1; -} +/* Bounding box */ +float xmin = 0.0f, ymin = 0.0f, zmin = 0.0f, xmax = 100.0f, ymax = 100.0f, zmax = 100.0f; /* Normal of the view (not normalized!) */ static float getNormal(float* normal) { - GLint viewport[4]; - GLdouble model_matrix[16], proj_matrix[16]; - double x1, y1, z1, x2, y2, z2, x3, y3, z3; - double dx1, dy1, dz1, dx2, dy2, dz2, width; - - glGetDoublev(GL_MODELVIEW_MATRIX, model_matrix); - glGetDoublev(GL_PROJECTION_MATRIX, proj_matrix); - glGetIntegerv(GL_VIEWPORT, viewport); - - gluUnProject(viewport[0], viewport[1], 0., model_matrix, proj_matrix, viewport, &x1, &y1, &z1); - gluUnProject(viewport[0] + viewport[2], viewport[1], 0., model_matrix, proj_matrix, viewport, &x2, &y2, &z2); - gluUnProject(viewport[0], viewport[1] + viewport[3], 0., model_matrix, proj_matrix, viewport, &x3, &y3, &z3); - - /* Normal out of user is p1p3^p1p2 */ - dx1 = x3 - x1; dy1 = y3 - y1; dz1 = z3 - z1; - dx2 = x2 - x1; dy2 = y2 - y1; dz2 = z2 - z1; - normal[0] = (float) (dy1 * dz2 - dz1 * dy2); - normal[1] = (float) (dz1 * dx2 - dx1 * dz2); - normal[2] = (float) (dx1 * dy2 - dy1 * dx2); - - /* Distance corresponding to 1 pixel */ - width = sqrt(dx2 * dx2 + dy2 * dy2 + dz2 * dz2); - return (float) width / (float) viewport[2]; + GLint viewport[4]; + GLdouble model_matrix[16], proj_matrix[16]; + + glGetDoublev(GL_MODELVIEW_MATRIX, model_matrix); + glGetDoublev(GL_PROJECTION_MATRIX, proj_matrix); + glGetIntegerv(GL_VIEWPORT, viewport); + + double x1, y1, z1, x2, y2, z2, x3, y3, z3; + gluUnProject(viewport[0], viewport[1], 0., model_matrix, proj_matrix, viewport, &x1, &y1, &z1); + gluUnProject(viewport[0] + viewport[2], viewport[1], 0., model_matrix, proj_matrix, viewport, &x2, &y2, &z2); + gluUnProject(viewport[0], viewport[1] + viewport[3], 0., model_matrix, proj_matrix, viewport, &x3, &y3, &z3); + + /* Normal out of user is p1p3^p1p2 */ + const double dx1 = x3 - x1; + const double dy1 = y3 - y1; + const double dz1 = z3 - z1; + const double dx2 = x2 - x1; + const double dy2 = y2 - y1; + const double dz2 = z2 - z1; + normal[0] = (float) (dy1 * dz2 - dz1 * dy2); + normal[1] = (float) (dz1 * dx2 - dx1 * dz2); + normal[2] = (float) (dx1 * dy2 - dy1 * dx2); + + /* Distance corresponding to 1 pixel */ + const float width = (float) sqrt(dx2 * dx2 + dy2 * dy2 + dz2 * dz2); + return width / (float) viewport[2]; } static float getDistance2Corner(float* normal, float* center, float x, float y, float z) @@ -314,11 +121,10 @@ static char getFarestCorner(float d000, float d100, float d010, float d001, return 8; /* d111 */ } -static void drawText(const wchar_t* text, char* font, OSD_FontAspect style, int size, float x, float y, float z) +static void drawText(const Handle(OpenGl_Workspace) &AWorkspace, const wchar_t* text, const char* font, OSD_FontAspect style, int size, float x, float y, float z) { - OpenGl_TextRender* textRenderer = OpenGl_TextRender::instance(); - const GLuint fontBase = textRenderer->FindFont((Tchar*) font, style, (float) size); - textRenderer->RenderText(text, fontBase, 0, x, y, z); + AWorkspace->FindFont(font, style, size); + AWorkspace->RenderText(text, 0, x, y, z); /* 4 OCC 6.3.1 and older: GLuint fontBase; @@ -392,90 +198,138 @@ static void drawArrow(float x1, float y1, float z1, glEnd(); } -TStatus call_graduatedtrihedron_display(int WsId, const Graphic3d_CGraduatedTrihedron &data) +OpenGl_GraduatedTrihedron::OpenGl_GraduatedTrihedron (const Graphic3d_CGraduatedTrihedron &AData) +: myXName(NULL), myYName(NULL), myZName(NULL), + myDrawXName(AData.xdrawname), myDrawYName(AData.ydrawname), myDrawZName(AData.zdrawname), + myDrawXValues(AData.xdrawvalues), myDrawYValues(AData.ydrawvalues), myDrawZValues(AData.zdrawvalues), + myDrawGrid(AData.drawgrid), myDrawAxes(AData.drawaxes), + myNbX(AData.nbx), myNbY(AData.nby), myNbZ(AData.nbz), + myXOffset(AData.xoffset), myYOffset(AData.yoffset), myZOffset(AData.zoffset), + myXAxisOffset(AData.xaxisoffset), myYAxisOffset(AData.yaxisoffset), myZAxisOffset(AData.zaxisoffset), + myDrawXTickmarks(AData.xdrawtickmarks), myDrawYTickmarks(AData.ydrawtickmarks), myDrawZTickmarks(AData.zdrawtickmarks), + myXTickmarkLength(AData.xtickmarklength), myYTickmarkLength(AData.ytickmarklength), myZTickmarkLength(AData.ztickmarklength), + myFontOfNames(NULL), + myStyleOfNames(AData.styleOfNames), + mySizeOfNames(AData.sizeOfNames), + myFontOfValues(NULL), + myStyleOfValues(AData.styleOfValues), + mySizeOfValues(AData.sizeOfValues), + myCbCubicAxes(AData.cbCubicAxes), + myPtrVisual3dView(AData.ptrVisual3dView) { - /* Initialize data for a new view */ - int index = getGraduatedTrihedronDataIndex(WsId); - if (index == -1) + /* Names of axes */ + /* X-name */ + int len = AData.xname.Length(); + if (len) { - /* Extend array for +1 */ - tel_graduatedtrihedron_data* newGraduatedTrihedronData = new tel_graduatedtrihedron_data[nbWsIds+1]; - - /* Copy existing contents */ - int i; - for (i = 0; i < nbWsIds; i++) - newGraduatedTrihedronData[i] = graduatedTrihedronData[i]; - - /* Add new item */ - index = nbWsIds++; - newGraduatedTrihedronData[index] = new TEL_GRADUATEDTRIHEDRON_DATA; - newGraduatedTrihedronData[index]->WsId = WsId; - - /* Switch to new array */ - delete graduatedTrihedronData; - graduatedTrihedronData = newGraduatedTrihedronData; + Standard_ExtString iname = AData.xname.ToExtString(); + wchar_t *xname = new wchar_t[len+1]; + len = 0; while (xname[len] = (wchar_t)(iname[len])) len++; + myXName = xname; } - copyData(&data, graduatedTrihedronData[index]); - return call_graduatedtrihedron_redraw(WsId); -} - -TStatus call_graduatedtrihedron_erase(int WsId) -{ - int index = getGraduatedTrihedronDataIndex(WsId); - if (index == -1) - return TSuccess; /* Nothing to remove */ - - /* If trihedron is displayed only in one view, just free the array and set nbWsIds equal to 0. */ - if (nbWsIds == 1) + /* Y-name */ + len = AData.yname.Length(); + if (len) { - freeData(); - return TSuccess; + Standard_ExtString iname = AData.yname.ToExtString(); + wchar_t *yname = new wchar_t[len+1]; + len = 0; while (yname[len] = (wchar_t)(iname[len])) len++; + myYName = yname; } - - /* Reduce array for -1 */ - tel_graduatedtrihedron_data* newGraduatedTrihedronData = new tel_graduatedtrihedron_data[nbWsIds-1]; - - /* Copy existing contents */ - int i, j; - for (i = 0, j = 0; i < nbWsIds; i++) + /* Z-name */ + len = AData.zname.Length(); + if (len) { - if (graduatedTrihedronData[i]->WsId != WsId) - newGraduatedTrihedronData[j++] = graduatedTrihedronData[i]; + Standard_ExtString iname = AData.zname.ToExtString(); + wchar_t *zname = new wchar_t[len+1]; + len = 0; while (zname[len] = (wchar_t)(iname[len])) len++; + myZName = zname; } - nbWsIds--; - - /* Switch to new array */ - delete graduatedTrihedronData; - graduatedTrihedronData = newGraduatedTrihedronData; - - return TSuccess; + /* Grid color */ + myGridColor[0] = (float) AData.gridcolor.Red(); + myGridColor[1] = (float) AData.gridcolor.Green(); + myGridColor[2] = (float) AData.gridcolor.Blue(); + /* X name color */ + myXNameColor[0] = (float) AData.xnamecolor.Red(); + myXNameColor[1] = (float) AData.xnamecolor.Green(); + myXNameColor[2] = (float) AData.xnamecolor.Blue(); + /* Y name color */ + myYNameColor[0] = (float) AData.ynamecolor.Red(); + myYNameColor[1] = (float) AData.ynamecolor.Green(); + myYNameColor[2] = (float) AData.ynamecolor.Blue(); + /* Z name color */ + myZNameColor[0] = (float) AData.znamecolor.Red(); + myZNameColor[1] = (float) AData.znamecolor.Green(); + myZNameColor[2] = (float) AData.znamecolor.Blue(); + /* X color of axis and values */ + myXColor[0] = (float) AData.xcolor.Red(); + myXColor[1] = (float) AData.xcolor.Green(); + myXColor[2] = (float) AData.xcolor.Blue(); + /* Y color of axis and values */ + myYColor[0] = (float) AData.ycolor.Red(); + myYColor[1] = (float) AData.ycolor.Green(); + myYColor[2] = (float) AData.ycolor.Blue(); + /* Z color of axis and values */ + myZColor[0] = (float) AData.zcolor.Red(); + myZColor[1] = (float) AData.zcolor.Green(); + myZColor[2] = (float) AData.zcolor.Blue(); + /* Font name of names of axes: Courier, Arial, ... */ + len = AData.fontOfNames.Length(); + char *fontOfNames = new char[len+1]; + if (len) + strcpy(fontOfNames, AData.fontOfNames.ToCString()); + else + fontOfNames[0] = '\0'; + myFontOfNames = fontOfNames; + /* Font name of values: Courier, Arial, ... */ + len = AData.fontOfValues.Length(); + char *fontOfValues = new char[len+1]; + if (len) + strcpy(fontOfValues, AData.fontOfValues.ToCString()); + else + fontOfValues[0] = '\0'; + myFontOfValues = fontOfValues; } -TStatus call_graduatedtrihedron_redraw(int WsId) +OpenGl_GraduatedTrihedron::~OpenGl_GraduatedTrihedron () { - /* Get index of the trihedron data */ - int index = getGraduatedTrihedronDataIndex(WsId); - if (index == -1) - return TFailure; + // Names of axes + if (myXName) + delete[] myXName; + if (myYName) + delete[] myYName; + if (myZName) + delete[] myZName; + + // Fonts + if (myFontOfNames) + delete[] myFontOfNames; + if (myFontOfValues) + delete[] myFontOfValues; +} - tel_graduatedtrihedron_data data = graduatedTrihedronData[index]; +//call_graduatedtrihedron_redraw +void OpenGl_GraduatedTrihedron::Render (const Handle(OpenGl_Workspace) &AWorkspace) const +{ + const OpenGl_AspectLine *oldAspectLine = AWorkspace->SetAspectLine(&myDefaultAspectLine); + AWorkspace->AspectLine(Standard_True); /* Update boundary box */ - if (data->cbCubicAxes) - data->cbCubicAxes(data->ptrVisual3dView); + if (myCbCubicAxes) + myCbCubicAxes(myPtrVisual3dView); /* Disable lighting for lines */ GLboolean light = glIsEnabled(GL_LIGHTING); if (light) glDisable(GL_LIGHTING); - + /* Find the farest point of bounding box */ /* Get normal of the view out of user. */ /* Also, the method return distance corresponding to 1 pixel */ float normal[3]; float dpix = getNormal(normal); - + /* Normalize normal */ float d = sqrtf(normal[0] * normal[0] + normal[1] * normal[1] + normal[2] * normal[2]); normal[0] /= d; @@ -790,9 +644,9 @@ TStatus call_graduatedtrihedron_redraw(int WsId) float step, dx, dy, dz; /* Grid */ - if (data->drawgrid) + if (myDrawGrid) { - glColor3fv(data->gridcolor); + glColor3fv(myGridColor); glBegin(GL_LINES); /* Boundary grid-lines */ if (LX1draw == 1) @@ -844,11 +698,11 @@ TStatus call_graduatedtrihedron_redraw(int WsId) /* Intermediate grid-lines */ /* X-Grid lines */ - if (data->nbx > 0) + if (myNbX > 0) { - i = data->drawaxes ? 1 : 0; - step = fabsf(LX1[3] - LX1[0]) / (float) data->nbx; - while (i < data->nbx) + i = myDrawAxes ? 1 : 0; + step = fabsf(LX1[3] - LX1[0]) / (float) myNbX; + while (i < myNbX) { glBegin(GL_LINE_STRIP); glVertex3f(LX1[0] + i * step, LX1[1], LX1[2]); @@ -859,11 +713,11 @@ TStatus call_graduatedtrihedron_redraw(int WsId) } } /* Y-Grid lines */ - if (data->nby > 0) + if (myNbY > 0) { - i = data->drawaxes ? 1 : 0; - step = fabsf(LY1[4] - LY1[1]) / (float) data->nby; - while (i < data->nby) + i = myDrawAxes ? 1 : 0; + step = fabsf(LY1[4] - LY1[1]) / (float) myNbY; + while (i < myNbY) { glBegin(GL_LINE_STRIP); glVertex3f(LY1[0], LY1[1] + i * step, LY1[2]); @@ -874,11 +728,11 @@ TStatus call_graduatedtrihedron_redraw(int WsId) } } /* Z-Grid lines */ - if (data->nbz > 0) + if (myNbZ > 0) { - i = data->drawaxes ? 1 : 0; - step = fabsf(LZ1[5] - LZ1[2]) / (float) data->nbz; - while (i < data->nbz) + i = myDrawAxes ? 1 : 0; + step = fabsf(LZ1[5] - LZ1[2]) / (float) myNbZ; + while (i < myNbZ) { glBegin(GL_LINE_STRIP); glVertex3f(LZ1[0], LZ1[1], LZ1[2] + i * step); @@ -891,18 +745,18 @@ TStatus call_graduatedtrihedron_redraw(int WsId) } /* Axes (arrows) */ - if (data->drawaxes) + if (myDrawAxes) { /* X-axis */ - glColor3fv(data->xcolor); + glColor3fv(myXColor); drawArrow(xmin, ymin, zmin, xmax, ymin, zmin, normal[0], normal[1], normal[2]); /* Y-axis */ - glColor3fv(data->ycolor); + glColor3fv(myYColor); drawArrow(xmin, ymin, zmin, xmin, ymax, zmin, normal[0], normal[1], normal[2]); /* Z-axis */ - glColor3fv(data->zcolor); + glColor3fv(myZColor); drawArrow(xmin, ymin, zmin, xmin, ymin, zmax, normal[0], normal[1], normal[2]); } @@ -910,7 +764,7 @@ TStatus call_graduatedtrihedron_redraw(int WsId) char textValue[128]; wchar_t wtextValue[128]; - if (data->xdrawname || data->xdrawvalues) + if (myDrawXName || myDrawXValues) { /* Middle point of the first X-axis */ m1[0] = 0.5f * (LX1[0] + LX1[3]); @@ -937,51 +791,51 @@ TStatus call_graduatedtrihedron_redraw(int WsId) m2[2] = dpix * dz; /* Name of X-axis */ - if (data->xdrawname) + if (myDrawXName) { - glColor3fv(data->xnamecolor); - offset = data->xaxisoffset + data->xtickmarklength; - drawText(data->xname, data->fontOfNames, data->styleOfNames, data->sizeOfNames, + glColor3fv(myXNameColor); + offset = myXAxisOffset + myXTickmarkLength; + drawText(AWorkspace, myXName, myFontOfNames, myStyleOfNames, mySizeOfNames, m1[0], m1[1] + offset * m2[1], m1[2] + offset * m2[2]); } /* X-values */ - if (data->xdrawvalues && data->nbx > 0) + if (myDrawXValues && myNbX > 0) { - glColor3fv(data->xcolor); + glColor3fv(myXColor); i = 0; - step = fabsf(LX1[3] - LX1[0]) / (float) data->nbx; - offset = data->xoffset + data->xtickmarklength; - while (i <= data->nbx) + step = fabsf(LX1[3] - LX1[0]) / (float) myNbX; + offset = myXOffset + myXTickmarkLength; + while (i <= myNbX) { sprintf(textValue, "%g", LX1[0] + i * step); j = 0; while (wtextValue[j] = textValue[j]) j++; - drawText(wtextValue, data->fontOfValues, data->styleOfValues, data->sizeOfValues, + drawText(AWorkspace, wtextValue, myFontOfValues, myStyleOfValues, mySizeOfValues, LX1[0] + i * step, m1[1] + offset * m2[1], m1[2] + offset * m2[2]); i++; } } /* X-tickmark */ - if (data->xdrawtickmarks && data->nbx > 0) + if (myDrawXTickmarks && myNbX > 0) { - glColor3fv(data->gridcolor); + glColor3fv(myGridColor); i = 0; - step = fabsf(LX1[3] - LX1[0]) / (float) data->nbx; - while (i <= data->nbx) + step = fabsf(LX1[3] - LX1[0]) / (float) myNbX; + while (i <= myNbX) { glBegin(GL_LINES); - glVertex3f(LX1[0] + i * step, m1[1], m1[2]); - glVertex3f(LX1[0] + i * step, m1[1] + data->xtickmarklength * m2[1], m1[2] + data->xtickmarklength * m2[2]); + glVertex3f(LX1[0] + i * step, m1[1], m1[2]); + glVertex3f(LX1[0] + i * step, m1[1] + myXTickmarkLength * m2[1], m1[2] + myXTickmarkLength * m2[2]); glEnd(); i++; } } } - if (data->ydrawname || data->ydrawvalues) + if (myDrawYName || myDrawYValues) { /* Middle point of the first Y-axis */ m1[0] = 0.5f * (LY1[0] + LY1[3]); @@ -1009,51 +863,51 @@ TStatus call_graduatedtrihedron_redraw(int WsId) m2[2] = dpix * dz; /* Name of Y-axis */ - if (data->ydrawname) + if (myDrawYName) { - glColor3fv(data->ynamecolor); - offset = data->yaxisoffset + data->ytickmarklength; - drawText(data->yname, data->fontOfNames, data->styleOfNames, data->sizeOfNames, + glColor3fv(myYNameColor); + offset = myYAxisOffset + myYTickmarkLength; + drawText(AWorkspace, myYName, myFontOfNames, myStyleOfNames, mySizeOfNames, m1[0] + offset * m2[0], m1[1], m1[2] + offset * m2[2]); } /* Y-values */ - if (data->ydrawvalues && data->nby > 0) + if (myDrawYValues && myNbY > 0) { - glColor3fv(data->ycolor); + glColor3fv(myYColor); i = 0; - step = fabsf(LY1[4] - LY1[1]) / (float) data->nby; - offset = data->yoffset + data->ytickmarklength; - while (i <= data->nby) + step = fabsf(LY1[4] - LY1[1]) / (float) myNbY; + offset = myYOffset + myYTickmarkLength; + while (i <= myNbY) { sprintf(textValue, "%g", LY1[1] + i * step); j = 0; while (wtextValue[j] = textValue[j]) j++; - drawText(wtextValue, data->fontOfValues, data->styleOfValues, data->sizeOfValues, + drawText(AWorkspace, wtextValue, myFontOfValues, myStyleOfValues, mySizeOfValues, m1[0] + offset * m2[0], LY1[1] + i * step, m1[2] + offset * m2[2]); i++; } } /* Y-tickmark */ - if (data->ydrawtickmarks && data->nby > 0) + if (myDrawYTickmarks && myNbY > 0) { - glColor3fv(data->gridcolor); + glColor3fv(myGridColor); i = 0; - step = fabsf(LY1[4] - LY1[1]) / (float) data->nby; - while (i <= data->nby) + step = fabsf(LY1[4] - LY1[1]) / (float) myNbY; + while (i <= myNbY) { glBegin(GL_LINES); - glVertex3f(m1[0], LY1[1] + i * step, m1[2]); - glVertex3f(m1[0] + data->ytickmarklength * m2[0], LY1[1] + i * step, m1[2] + data->ytickmarklength * m2[2]); + glVertex3f(m1[0], LY1[1] + i * step, m1[2]); + glVertex3f(m1[0] + myYTickmarkLength * m2[0], LY1[1] + i * step, m1[2] + myYTickmarkLength * m2[2]); glEnd(); i++; } } } - if (data->zdrawname || data->zdrawvalues) + if (myDrawZName || myDrawZValues) { /* Middle point of the first Z-axis */ m1[0] = 0.5f * (LZ1[0] + LZ1[3]); @@ -1081,44 +935,44 @@ TStatus call_graduatedtrihedron_redraw(int WsId) m2[1] = dpix * dy; /* Name of Z-axis */ - if (data->zdrawname) + if (myDrawZName) { - glColor3fv(data->znamecolor); - offset = data->zaxisoffset + data->ztickmarklength; - drawText(data->zname, data->fontOfNames, data->styleOfNames, data->sizeOfNames, + glColor3fv(myZNameColor); + offset = myZAxisOffset + myZTickmarkLength; + drawText(AWorkspace, myZName, myFontOfNames, myStyleOfNames, mySizeOfNames, m1[0] + offset * m2[0], m1[1] + offset * m2[1], m1[2]); } /* Z-values */ - if (data->zdrawvalues && data->nbz > 0) + if (myDrawZValues && myNbZ > 0) { - glColor3fv(data->zcolor); + glColor3fv(myZColor); i = 0; - step = fabsf(LZ1[5] - LZ1[2]) / (float) data->nbz; - offset = data->zoffset + data->ztickmarklength; - while (i <= data->nbz) + step = fabsf(LZ1[5] - LZ1[2]) / (float) myNbZ; + offset = myZOffset + myZTickmarkLength; + while (i <= myNbZ) { sprintf(textValue, "%g", LZ1[2] + i * step); j = 0; while (wtextValue[j] = textValue[j]) j++; - drawText(wtextValue, data->fontOfValues, data->styleOfValues, data->sizeOfValues, + drawText(AWorkspace, wtextValue, myFontOfValues, myStyleOfValues, mySizeOfValues, m1[0] + offset * m2[0], m1[1] + offset * m2[1], LZ1[2] + i * step); i++; } } /* Z-tickmark */ - if (data->zdrawtickmarks && data->nbz > 0) + if (myDrawZTickmarks && myNbZ > 0) { - glColor3fv(data->gridcolor); + glColor3fv(myGridColor); i = 0; - step = fabsf(LZ1[5] - LZ1[2]) / (float) data->nbz; - while (i <= data->nbz) + step = fabsf(LZ1[5] - LZ1[2]) / (float) myNbZ; + while (i <= myNbZ) { glBegin(GL_LINES); - glVertex3f(m1[0], m1[1], LZ1[2] + i * step); - glVertex3f(m1[0] + data->ztickmarklength * m2[0], m1[1] + data->ztickmarklength * m2[1], LZ1[2] + i * step); + glVertex3f(m1[0], m1[1], LZ1[2] + i * step); + glVertex3f(m1[0] + myZTickmarkLength * m2[0], m1[1] + myZTickmarkLength * m2[1], LZ1[2] + i * step); glEnd(); i++; } @@ -1128,22 +982,18 @@ TStatus call_graduatedtrihedron_redraw(int WsId) /* Activate the lighting if it was turned off by this method call */ if (light) glEnable(GL_LIGHTING); - - return TSuccess; + + AWorkspace->SetAspectLine(oldAspectLine); } -TStatus call_graduatedtrihedron_minmaxvalues(const float xMin, - const float yMin, - const float zMin, - const float xMax, - const float yMax, - const float zMax) +//call_graduatedtrihedron_minmaxvalues +void OpenGl_GraduatedTrihedron::SetMinMax (const Standard_ShortReal xMin, const Standard_ShortReal yMin, const Standard_ShortReal zMin, + const Standard_ShortReal xMax, const Standard_ShortReal yMax, const Standard_ShortReal zMax) { - xmin = xMin; - ymin = yMin; - zmin = zMin; - xmax = xMax; - ymax = yMax; - zmax = zMax; - return TSuccess; + xmin = xMin; + ymin = yMin; + zmin = zMin; + xmax = xMax; + ymax = yMax; + zmax = zMax; } diff --git a/src/OpenGl/OpenGl_GraduatedTrihedron.hxx b/src/OpenGl/OpenGl_GraduatedTrihedron.hxx new file mode 100644 index 0000000000..00dfbce1a9 --- /dev/null +++ b/src/OpenGl/OpenGl_GraduatedTrihedron.hxx @@ -0,0 +1,64 @@ +// File: OpenGl_GraduatedTrihedron.hxx +// Created: 20 September 2011 +// Author: Sergey ZERCHANINOV +// Copyright: OPEN CASCADE 2011 + +#ifndef _OpenGl_GraduatedTrihedron_Header +#define _OpenGl_GraduatedTrihedron_Header + +#include + +#include + +class OpenGl_View; + +class OpenGl_GraduatedTrihedron : public MMgt_TShared +{ + public: + OpenGl_GraduatedTrihedron (const Graphic3d_CGraduatedTrihedron &AData); + virtual ~OpenGl_GraduatedTrihedron (); + + static void SetMinMax (const Standard_ShortReal xMin, const Standard_ShortReal yMin, const Standard_ShortReal zMin, + const Standard_ShortReal xMax, const Standard_ShortReal yMax, const Standard_ShortReal zMax); + + void Render (const Handle(OpenGl_Workspace) &AWorkspace) const; + + // Type definition + // + DEFINE_STANDARD_RTTI(OpenGl_GraduatedTrihedron) + + protected: + + const wchar_t *myXName; + const wchar_t *myYName; + const wchar_t *myZName; + unsigned char myDrawXName, myDrawYName, myDrawZName; + unsigned char myDrawXValues, myDrawYValues, myDrawZValues; + unsigned char myDrawGrid; + unsigned char myDrawAxes; + unsigned int myNbX, myNbY, myNbZ; + int myXOffset, myYOffset, myZOffset; + int myXAxisOffset, myYAxisOffset, myZAxisOffset; + unsigned char myDrawXTickmarks, myDrawYTickmarks, myDrawZTickmarks; + unsigned int myXTickmarkLength, myYTickmarkLength, myZTickmarkLength; + float myGridColor[3]; + float myXNameColor[3]; + float myYNameColor[3]; + float myZNameColor[3]; + float myXColor[3]; + float myYColor[3]; + float myZColor[3]; + const char *myFontOfNames; + OSD_FontAspect myStyleOfNames; + int mySizeOfNames; + const char* myFontOfValues; + OSD_FontAspect myStyleOfValues; + int mySizeOfValues; + minMaxValuesCallback myCbCubicAxes; + void* myPtrVisual3dView; + + public: + IMPLEMENT_MEMORY_OPERATORS +}; + +#endif //_OpenGl_GraduatedTrihedron_Header diff --git a/src/OpenGl/OpenGl_GraphicDriver.cdl b/src/OpenGl/OpenGl_GraphicDriver.cdl deleted file mode 100755 index d36bb1fb5f..0000000000 --- a/src/OpenGl/OpenGl_GraphicDriver.cdl +++ /dev/null @@ -1,1337 +0,0 @@ --- --- File: OpenGl_GraphicDriver.cdl --- Created: Mardi 28 janvier 1997 --- Author: CAL --- Modified: --- 07-10-99 : EUG : Degeneration support (G003) --- Add DegenerateStructure() and --- SetBackFacingModel() methods. --- 16-06-2000 : ATS,SPK : G005 : PARRAY method --- 17/08/00 ; THA ; Thomas HARTL --- -> Add Print methods (works only under Windows). --- 27/03/02 ; GG ; RIC120302 Add new method Begin(Aspect_Display) --- 23/12/02 ; SAV Added methods to set background image --- 20/01/09 ; ABD : Integration support of system fonts (using FTGL and FreeType) --- --- ----Copyright: MatraDatavision 1997 --- - -class GraphicDriver from OpenGl inherits GraphicDriver from Graphic3d - - ---Version: - - ---Purpose: This class allows the definition of an opengl graphic - -- driver - - ---Keywords: OpenGl - - ---Warning: - ---References: - -uses - - Array1OfInteger from TColStd, - Array1OfReal from TColStd, - Array2OfReal from TColStd, - - ExtendedString from TCollection, - - NameOfColor from Quantity, - Color from Quantity, - PlaneAngle from Quantity, - - AlienImage from AlienImage, - - Array1OfEdge from Aspect, - CLayer2d from Aspect, - TypeOfTriedronEcho from Aspect, - TypeOfTriedronPosition from Aspect, - Handle from Aspect, - Display from Aspect, - PrintAlgo from Aspect, - - AspectLine3d from Graphic3d, - AspectMarker3d from Graphic3d, - AspectText3d from Graphic3d, - AspectFillArea3d from Graphic3d, - HorizontalTextAlignment from Graphic3d, - CBitFields20 from Graphic3d, - CGroup from Graphic3d, - CPick from Graphic3d, - CStructure from Graphic3d, - CView from Graphic3d, - CRawBufferData from Image, - Structure from Graphic3d, - TextPath from Graphic3d, - TypeOfComposition from Graphic3d, - TypeOfPolygon from Graphic3d, - TypeOfPrimitive from Graphic3d, - Vector from Graphic3d, - Array1OfVertex from Graphic3d, - Array2OfVertex from Graphic3d, - Vertex from Graphic3d, - Array1OfVertexC from Graphic3d, - Array2OfVertexC from Graphic3d, - VertexC from Graphic3d, - Array1OfVertexN from Graphic3d, - Array2OfVertexN from Graphic3d, - VertexN from Graphic3d, - Array1OfVertexNC from Graphic3d, - Array2OfVertexNC from Graphic3d, - VertexNC from Graphic3d, - VerticalTextAlignment from Graphic3d, - CInitTexture from Graphic3d, - TypeOfTexture from Graphic3d, - VertexNT from Graphic3d, - Array1OfVertexNT from Graphic3d, - Array2OfVertexNT from Graphic3d, - PrimitiveArray from Graphic3d, - PtrFrameBuffer from Graphic3d, - FillMethod from Aspect, - GradientFillMethod from Aspect, - HArray1OfByte from TColStd, - ExportFormat from Graphic3d, - SortType from Graphic3d, - HArray1OfReal from TColStd, - CUserDraw from Graphic3d, - NListOfHAsciiString from Graphic3d, - FontAspect from OSD, - CGraduatedTrihedron from Graphic3d -is - - Create ( AShrName : CString from Standard ) - returns mutable GraphicDriver from OpenGl; - - ------------------------- - -- Category: Init methods - ------------------------- - DefaultTextHeight( me ) - returns ShortReal from Standard - is redefined static; - - Begin ( me : mutable; - ADisplay : CString from Standard ) - returns Boolean from Standard - is redefined static; - ---Purpose: call_togl_begin - - Begin ( me : mutable; - ADisplay : Display from Aspect ) - returns Boolean from Standard - is redefined static; - ---Purpose: call_togl_begin_display - - End ( me : mutable ) - is redefined static; - ---Purpose: call_togl_end - - ---------------------------- - -- Category: Inquire methods - ---------------------------- - - InquireLightLimit ( me : mutable ) - returns Integer from Standard - is redefined static; - ---Purpose: call_togl_inquirelight - - InquireMat ( me : mutable; - ACView : CView from Graphic3d; - AMatO : out Array2OfReal from TColStd; - AMatM : out Array2OfReal from TColStd ) - is redefined static; - ---Purpose: call_togl_inquiremat - - InquirePlaneLimit ( me : mutable ) - returns Integer from Standard - is redefined static; - ---Purpose: call_togl_inquireplane - - InquireViewLimit ( me : mutable ) - returns Integer from Standard - is redefined static; - ---Purpose: call_togl_inquireview - - InquireTextureAvailable ( me : mutable ) - returns Boolean from Standard - is redefined static; - ---Purpose: Returns Standard_True if texture is - -- supported by the graphic driver - - ------------------------------ - -- Category: Highlight methods - ------------------------------ - - Blink ( me : mutable; - ACStructure : CStructure from Graphic3d; - Create : Boolean from Standard ) - is redefined static; - ---Purpose: call_togl_blink - - BoundaryBox ( me : mutable; - ACStructure : CStructure from Graphic3d; - Create : Boolean from Standard ) - is redefined static; - ---Purpose: call_togl_boundarybox - - HighlightColor ( me : mutable; - ACStructure : CStructure from Graphic3d; - R : ShortReal from Standard; - G : ShortReal from Standard; - B : ShortReal from Standard; - Create : Boolean from Standard ) - is redefined static; - ---Purpose: call_togl_highlightcolor - - NameSetStructure ( me : mutable; - ACStructure : CStructure from Graphic3d ) - is redefined static; - ---Purpose: call_togl_namesetstructure - - ------------------------------------- - -- Category: Group management methods - ------------------------------------- - - ClearGroup ( me : mutable; - ACGroup : CGroup from Graphic3d ) - is redefined static; - ---Purpose: call_togl_cleargroup - - CloseGroup ( me : mutable; - ACGroup : CGroup from Graphic3d ) - is redefined static; - ---Purpose: call_togl_closegroup - - FaceContextGroup ( me : mutable; - ACGroup : CGroup from Graphic3d; - NoInsert : Integer from Standard ) - is redefined static; - ---Purpose: call_togl_facecontextgroup - - Group ( me : mutable; - ACGroup : in out CGroup from Graphic3d ) - is redefined static; - ---Purpose: call_togl_group - - LineContextGroup ( me : mutable; - ACGroup : CGroup from Graphic3d; - NoInsert : Integer from Standard ) - is redefined static; - ---Purpose: call_togl_linecontextgroup - - MarkerContextGroup ( me : mutable; - ACGroup : CGroup from Graphic3d; - NoInsert : Integer from Standard ) - is redefined static; - ---Purpose: call_togl_markercontextgroup - - MarkerContextGroup ( me : mutable; - ACGroup : CGroup from Graphic3d; - NoInsert : Integer from Standard; - AMarkWidth : Integer from Standard; - AMarkHeight : Integer from Standard; - ATexture : HArray1OfByte from TColStd ) - is redefined static; - ---Purpose: call_togl_markercontextgroup - - - OpenGroup ( me : mutable; - ACGroup : CGroup from Graphic3d ) - is redefined static; - ---Purpose: call_togl_opengroup - - RemoveGroup ( me : mutable; - ACGroup : CGroup from Graphic3d ) - is redefined static; - ---Purpose: call_togl_removegroup - - TextContextGroup ( me : mutable; - ACGroup : CGroup from Graphic3d; - NoInsert : Integer from Standard ) - is redefined static; - ---Purpose: call_togl_textcontextgroup - - ----------------------------------------- - -- Category: Structure management methods - ----------------------------------------- - - ClearStructure ( me : mutable; - ACStructure : CStructure from Graphic3d ) - is redefined static; - ---Purpose: call_togl_clearstructure - - Connect ( me : mutable; - AFather : CStructure from Graphic3d; - ASon : CStructure from Graphic3d ) - is redefined static; - ---Purpose: call_togl_connect - - ContextStructure ( me : mutable; - ACStructure : CStructure from Graphic3d ) - is redefined static; - ---Purpose: call_togl_contextstructure - - Disconnect ( me : mutable; - AFather : CStructure from Graphic3d; - ASon : CStructure from Graphic3d ) - is redefined static; - ---Purpose: call_togl_disconnect - - DisplayStructure ( me : mutable; - ACView : CView from Graphic3d; - ACStructure : CStructure from Graphic3d; - APriority : Integer from Standard ) - is redefined static; - ---Purpose: call_togl_displaystructure - - EraseStructure ( me : mutable; - ACView : CView from Graphic3d; - ACStructure : CStructure from Graphic3d ) - is redefined static; - ---Purpose: call_togl_erasestructure - - RemoveStructure ( me : mutable; - ACStructure : CStructure from Graphic3d ) - is redefined static; - ---Purpose: call_togl_removestructure - - Structure ( me : mutable; - ACStructure : in out CStructure from Graphic3d ) - is redefined static; - ---Purpose: call_togl_structure - - -------------------------------- - -- Category: Exploration methods - -------------------------------- - - DumpGroup ( me : mutable; - ACGroup : CGroup from Graphic3d ) - is redefined static; - ---Purpose: call_togl_structure_exploration - - DumpStructure ( me : mutable; - ACStructure : CStructure from Graphic3d ) - is redefined static; - ---Purpose: call_togl_structure_exploration - - DumpView ( me : mutable; - ACView : CView from Graphic3d ) - is redefined static; - ---Purpose: call_togl_view_exploration - - ElementExploration ( me : mutable; - ACStructure : CStructure from Graphic3d; - ElementNumber : Integer from Standard; - AVertex : out VertexNC from Graphic3d; - AVector : out Vector from Graphic3d ) - returns Boolean from Standard - is redefined static; - ---Purpose: call_togl_element_exploration - - ElementType ( me : mutable; - ACStructure : CStructure from Graphic3d; - ElementNumber : Integer from Standard ) - returns TypeOfPrimitive from Graphic3d - is redefined static; - ---Purpose: call_togl_element_type - - ------------------------------------ - -- Category: Pick management methods - ------------------------------------ - - InitPick ( me : mutable ) - is redefined static; - ---Purpose: call_togl_init_pick - - Pick ( me : mutable; - ACPick : out CPick from Graphic3d ) - is redefined static; - ---Purpose: call_togl_pick - - PickId ( me : mutable; - ACGroup : CGroup from Graphic3d ) - is redefined static; - ---Purpose: call_togl_pickid - - ------------------------------------ - -- Category: Structured mode methods - ------------------------------------ - - ActivateView ( me : mutable; - ACView : CView from Graphic3d ) - is redefined static; - ---Purpose: call_togl_activateview - - AntiAliasing ( me : mutable; - ACView : CView from Graphic3d; - AFlag : Boolean from Standard ) - is redefined static; - ---Purpose: call_togl_antialiasing - - Background ( me : mutable; - ACView : CView from Graphic3d ) - is redefined static; - ---Purpose: call_togl_background - - GradientBackground ( me : mutable; - ACView : CView from Graphic3d; - AColor1: Color from Quantity; - AColor2: Color from Quantity; - FillStyle : GradientFillMethod from Aspect - ) - is redefined static; - ---Purpose: call_togl_gradient_background - - BackgroundImage( me : mutable; - FileName : CString from Standard; - ACView : CView from Graphic3d; - FillStyle : FillMethod from Aspect ) - is redefined static; - - SetBgImageStyle( me : mutable; ACView : CView from Graphic3d; - FillStyle : FillMethod from Aspect ) - is redefined static; - - SetBgGradientStyle( me : mutable; - ACView : CView from Graphic3d; - FillStyle : GradientFillMethod from Aspect ) - is redefined static; - - ClipLimit ( me : mutable; - ACView : CView from Graphic3d; - AWait : Boolean from Standard ) - is redefined static; - ---Purpose: call_togl_cliplimit - - DeactivateView ( me : mutable; - ACView : CView from Graphic3d ) - is redefined static; - ---Purpose: call_togl_deactivateview - - DepthCueing ( me : mutable; - ACView : CView from Graphic3d; - AFlag : Boolean from Standard ) - is redefined static; - ---Purpose: call_togl_cliplimit - - ProjectRaster ( me : mutable; - ACView : CView from Graphic3d; - AX : ShortReal from Standard; - AY : ShortReal from Standard; - AZ : ShortReal from Standard; - AU : out Integer from Standard; - AV : out Integer from Standard ) - returns Boolean from Standard - is redefined static; - ---Purpose: call_togl_unproject_raster - - UnProjectRaster ( me : mutable; - ACView : CView from Graphic3d; - Axm : Integer from Standard; - Aym : Integer from Standard; - AXM : Integer from Standard; - AYM : Integer from Standard; - AU : Integer from Standard; - AV : Integer from Standard; - AX : out ShortReal from Standard; - AY : out ShortReal from Standard; - AZ : out ShortReal from Standard ) - returns Boolean from Standard - is redefined static; - ---Purpose: call_togl_unproject_raster - - UnProjectRasterWithRay ( me : mutable; - ACView : CView from Graphic3d; - Axm : Integer from Standard; - Aym : Integer from Standard; - AXM : Integer from Standard; - AYM : Integer from Standard; - AU : Integer from Standard; - AV : Integer from Standard; - AX : out ShortReal from Standard; - AY : out ShortReal from Standard; - AZ : out ShortReal from Standard; - DX : out ShortReal from Standard; - DY : out ShortReal from Standard; - DZ : out ShortReal from Standard ) - returns Boolean from Standard - is redefined static; - ---Purpose: call_togl_unproject_raster_with_ray - - RatioWindow ( me : mutable; - ACView : CView from Graphic3d ) - is redefined static; - ---Purpose: call_togl_ratio_window - - Redraw ( me : mutable; - ACView : CView from Graphic3d; - ACUnderLayer : CLayer2d from Aspect; - ACOverLayer : CLayer2d from Aspect; - x : Integer = 0; - y : Integer = 0; - width : Integer = 0; - height : Integer = 0 ) - is redefined static; - ---Purpose: call_togl_redraw - - RemoveView ( me : mutable; - ACView : CView from Graphic3d ) - is redefined static; - ---Purpose: call_togl_removeview - - SetLight ( me : mutable; - ACView : CView from Graphic3d ) - is redefined static; - ---Purpose: call_togl_setlight - - SetPlane ( me : mutable; - ACView : CView from Graphic3d ) - is redefined static; - ---Purpose: call_togl_setplane - - SetVisualisation ( me : mutable; - ACView : CView from Graphic3d ) - is redefined static; - ---Purpose: call_togl_setvisualisation - - TransformStructure ( me : mutable; - ACStructure : CStructure from Graphic3d ) - is redefined static; - ---Purpose: call_togl_transformstructure - - DegenerateStructure ( me : mutable; - ACStructure : CStructure from Graphic3d ) - is redefined static; - ---Purpose: call_togl_degeneratestructure - - Transparency ( me : mutable; - ACView : CView from Graphic3d; - AFlag : Boolean from Standard ) - is redefined static; - ---Purpose: call_togl_transparency - - Update ( me : mutable; - ACView : CView from Graphic3d; - ACUnderLayer : CLayer2d from Aspect; - ACOverLayer : CLayer2d from Aspect ) - is redefined static; - ---Purpose: call_togl_update - - View ( me : mutable; - ACView : in out CView from Graphic3d ) - returns Boolean from Standard - is redefined static; - ---Purpose: call_togl_view - - ViewMapping ( me : mutable; - ACView : CView from Graphic3d; - AWait : Boolean from Standard ) - is redefined static; - ---Purpose: call_togl_viewmapping - - ViewOrientation ( me : mutable; - ACView : CView from Graphic3d; - AWait : Boolean from Standard ) - is redefined static; - ---Purpose: call_togl_vieworientation - - Environment ( me : mutable; - ACView : CView from Graphic3d ) - is redefined static; - ---Purpose: - - ---------------------------------------- - -- Category: Methods to create Marker - -- for Purpose : see Graphic3d_Group.cdl - ---------------------------------------- - - Marker ( me : mutable; - ACGroup : CGroup from Graphic3d; - APoint : Vertex from Graphic3d; - EvalMinMax : Boolean from Standard = Standard_True ) - is redefined static; - - MarkerSet ( me : mutable; - ACGroup : CGroup from Graphic3d; - ListVertex : Array1OfVertex from Graphic3d; - EvalMinMax : Boolean from Standard = Standard_True ) - is redefined static; - - ---------------------------------------- - -- Category: Methods to create Polygon - -- for Purpose : see Graphic3d_Group.cdl - ---------------------------------------- - - Polygon ( me : mutable; - ACGroup : CGroup from Graphic3d; - ListVertex : Array1OfVertex from Graphic3d; - AType : TypeOfPolygon from Graphic3d = Graphic3d_TOP_CONVEX; - EvalMinMax : Boolean from Standard = Standard_True ) - is redefined static; - ---Purpose: call_togl_polygon - - Polygon ( me : mutable; - ACGroup : CGroup from Graphic3d; - ListVertex : Array1OfVertex from Graphic3d; - Normal : Vector from Graphic3d; - AType : TypeOfPolygon from Graphic3d = Graphic3d_TOP_CONVEX; - EvalMinMax : Boolean from Standard = Standard_True ) - is redefined static; - ---Purpose: call_togl_polygon - - Polygon ( me : mutable; - ACGroup : CGroup from Graphic3d; - ListVertex : Array1OfVertexN from Graphic3d; - AType : TypeOfPolygon from Graphic3d = Graphic3d_TOP_CONVEX; - EvalMinMax : Boolean from Standard = Standard_True ) - is redefined static; - ---Purpose: call_togl_polygon - - Polygon ( me : mutable; - ACGroup : CGroup from Graphic3d; - ListVertex : Array1OfVertexN from Graphic3d; - Normal : Vector from Graphic3d; - AType : TypeOfPolygon from Graphic3d = Graphic3d_TOP_CONVEX; - EvalMinMax : Boolean from Standard = Standard_True ) - is redefined static; - ---Purpose: call_togl_polygon - - Polygon ( me : mutable; - ACGroup : CGroup from Graphic3d; - ListVertex : Array1OfVertexNT from Graphic3d; - AType : TypeOfPolygon from Graphic3d = Graphic3d_TOP_CONVEX; - EvalMinMax : Boolean from Standard = Standard_True ) - is redefined static; - ---Purpose: call_togl_polygon - - PolygonHoles ( me : mutable; - ACGroup : CGroup from Graphic3d; - Bounds : Array1OfInteger from TColStd; - ListVertex : Array1OfVertex from Graphic3d; - EvalMinMax : Boolean from Standard = Standard_True ) - is redefined static; - ---Purpose: call_togl_polygon_holes - - PolygonHoles ( me : mutable; - ACGroup : CGroup from Graphic3d; - Bounds : Array1OfInteger from TColStd; - ListVertex : Array1OfVertex from Graphic3d; - Normal : Vector from Graphic3d; - EvalMinMax : Boolean from Standard = Standard_True ) - is redefined static; - ---Purpose: call_togl_polygon_holes - - PolygonHoles ( me : mutable; - ACGroup : CGroup from Graphic3d; - Bounds : Array1OfInteger from TColStd; - ListVertex : Array1OfVertexN from Graphic3d; - EvalMinMax : Boolean from Standard = Standard_True ) - is redefined static; - ---Purpose: call_togl_polygon_holes - - PolygonHoles ( me : mutable; - ACGroup : CGroup from Graphic3d; - Bounds : Array1OfInteger from TColStd; - ListVertex : Array1OfVertexN from Graphic3d; - Normal : Vector from Graphic3d; - EvalMinMax : Boolean from Standard = Standard_True ) - is redefined static; - ---Purpose: call_togl_polygon_holes - - ---------------------------------------- - -- Category: Methods to create Polyline - -- for Purpose : see Graphic3d_Group.cdl - ---------------------------------------- - - Polyline ( me : mutable; - ACGroup : CGroup from Graphic3d; - X1, Y1, Z1, X2, Y2, Z2 : Real from Standard; - EvalMinMax : Boolean from Standard = Standard_True ) - is redefined static; - ---Purpose: call_togl_polyline - - Polyline ( me : mutable; - ACGroup : CGroup from Graphic3d; - ListVertex : Array1OfVertex from Graphic3d; - EvalMinMax : Boolean from Standard = Standard_True ) - is redefined static; - ---Purpose: call_togl_polyline - - Polyline ( me : mutable; - ACGroup : CGroup from Graphic3d; - ListVertex : Array1OfVertexC from Graphic3d; - EvalMinMax : Boolean from Standard = Standard_True ) - is redefined static; - ---Purpose: call_togl_polyline - - ----------------------------------------- - -- Category: Methods to create Quadrangle - -- for Purpose : see Graphic3d_Group.cdl - ----------------------------------------- - - QuadrangleMesh ( me : mutable; - ACGroup : CGroup from Graphic3d; - ListVertex : Array2OfVertex from Graphic3d; - EvalMinMax : Boolean from Standard = Standard_True ) - is redefined static; - ---Purpose: call_togl_quadrangle - - QuadrangleMesh ( me : mutable; - ACGroup : CGroup from Graphic3d; - ListVertex : Array2OfVertexN from Graphic3d; - EvalMinMax : Boolean from Standard = Standard_True ) - is redefined static; - ---Purpose: call_togl_quadrangle - - QuadrangleMesh ( me : mutable; - ACGroup : CGroup from Graphic3d; - ListVertex : Array2OfVertexNT from Graphic3d; - EvalMinMax : Boolean from Standard = Standard_True ) - is redefined static; - ---Purpose: call_togl_quadrangle - - QuadrangleSet ( me : mutable; - ACGroup : CGroup from Graphic3d; - ListVertex : Array1OfVertex from Graphic3d; - ListEdge : Array1OfEdge from Aspect; - EvalMinMax : Boolean from Standard = Standard_True ) - is redefined static; - ---Purpose: call_togl_polygon_indices - - QuadrangleSet ( me : mutable; - ACGroup : CGroup from Graphic3d; - ListVertex : Array1OfVertexN from Graphic3d; - ListEdge : Array1OfEdge from Aspect; - EvalMinMax : Boolean from Standard = Standard_True ) - is redefined static; - ---Purpose: call_togl_polygon_indices - - QuadrangleSet ( me : mutable; - ACGroup : CGroup from Graphic3d; - ListVertex : Array1OfVertexNT from Graphic3d; - ListEdge : Array1OfEdge from Aspect; - EvalMinMax : Boolean from Standard = Standard_True ) - is redefined static; - ---Purpose: call_togl_polygon_indices - - QuadrangleSet ( me : mutable; - ACGroup : CGroup from Graphic3d; - ListVertex : Array1OfVertexC from Graphic3d; - ListEdge : Array1OfEdge from Aspect; - EvalMinMax : Boolean from Standard = Standard_True ) - is redefined static; - ---Purpose: call_togl_polygon_indices - - QuadrangleSet ( me : mutable; - ACGroup : CGroup from Graphic3d; - ListVertex : Array1OfVertexNC from Graphic3d; - ListEdge : Array1OfEdge from Aspect; - EvalMinMax : Boolean from Standard = Standard_True ) - is redefined static; - ---Purpose: call_togl_polygon_indices - - ---------------------------------------- - -- Category: Methods to create Text - -- for Purpose : see Graphic3d_Group.cdl - ---------------------------------------- - - Text ( me : mutable; - ACGroup : CGroup from Graphic3d; - AText : CString from Standard; - APoint : Vertex from Graphic3d; - AHeight : Real from Standard; - AAngle : PlaneAngle from Quantity; - ATp : TextPath from Graphic3d; - AHta : HorizontalTextAlignment from Graphic3d; - AVta : VerticalTextAlignment from Graphic3d; - EvalMinMax : Boolean from Standard = Standard_True ) - is redefined static; - ---Purpose: call_togl_text - - Text ( me : mutable; - ACGroup : CGroup from Graphic3d; - AText : CString from Standard; - APoint : Vertex from Graphic3d; - AHeight : Real from Standard; - EvalMinMax : Boolean from Standard = Standard_True ) - is redefined static; - ---Purpose: call_togl_text - - Text ( me : mutable; - ACGroup : CGroup from Graphic3d; - AText : ExtendedString from TCollection; - APoint : Vertex from Graphic3d; - AHeight : Real from Standard; - AAngle : PlaneAngle from Quantity; - ATp : TextPath from Graphic3d; - AHta : HorizontalTextAlignment from Graphic3d; - AVta : VerticalTextAlignment from Graphic3d; - EvalMinMax : Boolean from Standard = Standard_True ) - is redefined static; - ---Purpose: call_togl_text - - Text ( me : mutable; - ACGroup : CGroup from Graphic3d; - AText : ExtendedString from TCollection; - APoint : Vertex from Graphic3d; - AHeight : Real from Standard; - EvalMinMax : Boolean from Standard = Standard_True ) - is redefined static; - ---Purpose: call_togl_text - - ---------------------------------------- - ---Category: Methods to create Triangle - -- for Purpose : see Graphic3d_Group.cdl - ---------------------------------------- - - TriangleMesh ( me : mutable; - ACGroup : CGroup from Graphic3d; - ListVertex : Array1OfVertex from Graphic3d; - EvalMinMax : Boolean from Standard = Standard_True ) - is redefined static; - ---Purpose: call_togl_triangle - - TriangleMesh ( me : mutable; - ACGroup : CGroup from Graphic3d; - ListVertex : Array1OfVertexN from Graphic3d; - EvalMinMax : Boolean from Standard = Standard_True ) - is redefined static; - ---Purpose: call_togl_triangle - - TriangleMesh ( me : mutable; - ACGroup : CGroup from Graphic3d; - ListVertex : Array1OfVertexNT from Graphic3d; - EvalMinMax : Boolean from Standard = Standard_True ) - is redefined static; - ---Purpose: call_togl_triangle - - TriangleSet ( me : mutable; - ACGroup : CGroup from Graphic3d; - ListVertex : Array1OfVertex from Graphic3d; - ListEdge : Array1OfEdge from Aspect; - EvalMinMax : Boolean from Standard = Standard_True ) - is redefined static; - ---Purpose: call_togl_polygon_indices - - TriangleSet ( me : mutable; - ACGroup : CGroup from Graphic3d; - ListVertex : Array1OfVertexN from Graphic3d; - ListEdge : Array1OfEdge from Aspect; - EvalMinMax : Boolean from Standard = Standard_True ) - is redefined static; - ---Purpose: call_togl_polygon_indices - - TriangleSet ( me : mutable; - ACGroup : CGroup from Graphic3d; - ListVertex : Array1OfVertexNT from Graphic3d; - ListEdge : Array1OfEdge from Aspect; - EvalMinMax : Boolean from Standard = Standard_True ) - is redefined static; - ---Purpose: call_togl_polygon_indices - - TriangleSet ( me : mutable; - ACGroup : CGroup from Graphic3d; - ListVertex : Array1OfVertexC from Graphic3d; - ListEdge : Array1OfEdge from Aspect; - EvalMinMax : Boolean from Standard = Standard_True ) - is redefined static; - ---Purpose: call_togl_polygon_indices - - TriangleSet ( me : mutable; - ACGroup : CGroup from Graphic3d; - ListVertex : Array1OfVertexNC from Graphic3d; - ListEdge : Array1OfEdge from Aspect; - EvalMinMax : Boolean from Standard = Standard_True ) - is redefined static; - ---Purpose: call_togl_polygon_indices - - PrimitiveArray( me : mutable; - ACGroup : CGroup from Graphic3d; - parray : PrimitiveArray from Graphic3d; - EvalMinMax : Boolean from Standard = Standard_True ) - is redefined static; - ---Purpose: call_togl_parray - - UserDraw( me : mutable; - ACGroup : CGroup from Graphic3d; - AUserDraw : CUserDraw from Graphic3d ) - is redefined static; - ---Purpose: call_togl_userdraw - - EnableVBO( me : mutable; - status : Boolean from Standard ) - is redefined static; - ---Purpose: enables/disables usage of OpenGL vertex buffer arrays while drawing primitiev arrays - - - ---------------------------------------- - ---Category: Methods to create Triedron - -- for Purpose : see Graphic3d_Group.cdl - ---------------------------------------- - - ZBufferTriedronSetup ( me : mutable; - XColor : NameOfColor from Quantity = Quantity_NOC_RED; - YColor : NameOfColor from Quantity = Quantity_NOC_GREEN; - ZColor : NameOfColor from Quantity = Quantity_NOC_BLUE1; - SizeRatio : Real from Standard = 0.8; - AxisDiametr : Real from Standard = 0.05; - NbFacettes : Integer from Standard = 12) - is redefined static; - ---Purpose: call_togl_ztriedron_setup - - TriedronDisplay ( me : mutable; - ACView : CView from Graphic3d; - APosition : TypeOfTriedronPosition from Aspect = Aspect_TOTP_CENTER; - AColor : NameOfColor from Quantity = Quantity_NOC_WHITE ; - AScale : Real from Standard = 0.02; - AsWireframe : Boolean from Standard = Standard_True ) - is redefined static; - ---Purpose: call_togl_triedron_display - - - TriedronErase ( me : mutable; - ACView : CView from Graphic3d) - is redefined static; - ---Purpose: call_togl_triedron_erase - - - TriedronEcho ( me : mutable; - ACView : CView from Graphic3d; - AType : TypeOfTriedronEcho from Aspect = Aspect_TOTE_NONE ) - is redefined static; - ---Purpose: call_togl_triedron_echo - - --------------------------------- - ---Category: Graduated trihedron - -------------------------------- - - GraduatedTrihedronDisplay(me : mutable; - view : CView from Graphic3d; - cubic : CGraduatedTrihedron from Graphic3d) - ---Purpose: call_togl_graduatedtrihedron_display - is redefined static; - - GraduatedTrihedronErase(me : mutable; - view : CView from Graphic3d) - ---Purpose: call_togl_graduatedtrihedron_erase - is redefined static; - - GraduatedTrihedronMinMaxValues(me : mutable; - xmin : ShortReal from Standard; - ymin : ShortReal from Standard; - zmin : ShortReal from Standard; - xmax : ShortReal from Standard; - ymax : ShortReal from Standard; - zmax : ShortReal from Standard) - ---Purpose: call_togl_graduatedtrihedron_minmaxvalues - is redefined static; - - ---------------------------------------- - -- Category: Internal methods - -- for Purpose : see Graphic3d_Group.cdl - ---------------------------------------- - - Bezier ( me : mutable; - ACGroup : CGroup from Graphic3d; - ListVertex : Array1OfVertex from Graphic3d; - EvalMinMax : Boolean from Standard = Standard_True ) - is redefined static; - ---Purpose: call_togl_bezier - - Bezier ( me : mutable; - ACGroup : CGroup from Graphic3d; - ListVertex : Array1OfVertex from Graphic3d; - ListWeight : Array1OfReal from TColStd; - EvalMinMax : Boolean from Standard = Standard_True ) - is redefined static; - ---Purpose: call_togl_bezier_weight - - --------------------------- - -- Category: Animation mode - --------------------------- - - BeginAnimation ( me : mutable; - ACView : CView from Graphic3d) - is redefined static; - ---Purpose: call_togl_begin_animation - - EndAnimation ( me : mutable; - ACView : CView from Graphic3d) - is redefined static; - ---Purpose: call_togl_end_animation - - ---------------------------------- - -- Category: Ajout mode methods - ---------------------------------- - - BeginAddMode ( me : mutable; - ACView : CView from Graphic3d) - returns Boolean from Standard - is redefined static; - ---Purpose: call_togl_begin_ajout_mode - - EndAddMode ( me : mutable) - is redefined static; - ---Purpose: call_togl_end_ajout_mode - - ---------------------------------- - -- Category: Immediat mode methods - ---------------------------------- - - BeginImmediatMode ( me : mutable; - ACView : CView from Graphic3d; - ACUnderLayer : CLayer2d from Aspect; - ACOverLayer : CLayer2d from Aspect; - DoubleBuffer : Boolean from Standard; - RetainMode : Boolean from Standard) - returns Boolean from Standard - is redefined static; - ---Purpose: call_togl_begin_immediat_mode - - BeginPolyline ( me : mutable ) - is redefined static; - ---Purpose: call_togl_begin_polyline - - ClearImmediatMode ( me : mutable; ACView : CView from Graphic3d; - aFlush : Boolean from Standard = Standard_True) - is redefined static; - ---Purpose: call_togl_clear_immediat_mode - - Draw ( me : mutable; - X : ShortReal from Standard; - Y : ShortReal from Standard; - Z : ShortReal from Standard ) - is redefined static; - ---Purpose: call_togl_draw - - DrawStructure ( me : mutable; - ACStructure : CStructure from Graphic3d ) - is redefined static; - ---Purpose: call_togl_draw_structure - - EndImmediatMode ( me : mutable; - Synchronize : Integer from Standard ) - is redefined static; - ---Purpose: call_togl_end_immediat_mode - - EndPolyline ( me : mutable ) - is redefined static; - ---Purpose: call_togl_end_polyline - - Move ( me : mutable; - X : ShortReal from Standard; - Y : ShortReal from Standard; - Z : ShortReal from Standard ) - is redefined static; - ---Purpose: call_togl_move - - SetLineColor ( me : mutable; - R : ShortReal from Standard; - G : ShortReal from Standard; - B : ShortReal from Standard ) - is redefined static; - ---Purpose: call_togl_set_linecolor - - SetLineType ( me : mutable; - Type : Integer from Standard ) - is redefined static; - ---Purpose: call_togl_set_linetype - - SetLineWidth ( me : mutable; - Width : ShortReal from Standard ) - is redefined static; - ---Purpose: call_togl_set_linewidth - - SetMinMax ( me : mutable; - X1 : ShortReal from Standard; - Y1 : ShortReal from Standard; - Z1 : ShortReal from Standard; - X2 : ShortReal from Standard; - Y2 : ShortReal from Standard; - Z2 : ShortReal from Standard ) - is redefined static; - ---Purpose: call_togl_set_minmax - - Transform ( me : mutable; - AMatrix : Array2OfReal from TColStd; - AType : TypeOfComposition from Graphic3d ) - is redefined static; - ---Purpose: call_togl_transform - - ----------------------------- - -- Category: Textures methods - ----------------------------- - - CreateTexture ( me; - Type : TypeOfTexture from Graphic3d; - Image : AlienImage from AlienImage; - FileName : CString from Standard; - TexUpperBounds : HArray1OfReal from TColStd ) - returns Integer from Standard - is redefined static; - ---Purpose: - - DestroyTexture ( me; - TexId : Integer from Standard ) - is redefined static; - ---Purpose: - - ModifyTexture ( me; - TexId : Integer from Standard; - AValue : CInitTexture from Graphic3d ) - is redefined static; - ---Purpose: - - ------------------------------- - -- Category: Layer mode methods - ------------------------------- - - Layer ( me : mutable; - ACLayer : in out CLayer2d from Aspect ) - is redefined static; - ---Purpose: call_togl_layer2d - - RemoveLayer ( me : mutable; - ACLayer : CLayer2d from Aspect ) - is redefined static; - ---Purpose: call_togl_removelayer2d - - BeginLayer ( me : mutable; - ACLayer : CLayer2d from Aspect ) - is redefined static; - ---Purpose: call_togl_begin_layer2d - - BeginPolygon2d ( me : mutable ) - is redefined static; - ---Purpose: call_togl_begin_polygon2d - - BeginPolyline2d ( me : mutable ) - is redefined static; - ---Purpose: call_togl_begin_polyline2d - - ClearLayer ( me : mutable; - ACLayer : CLayer2d from Aspect ) - is redefined static; - ---Purpose: call_togl_clear_layer2d - - Draw ( me : mutable; - X : ShortReal from Standard; - Y : ShortReal from Standard ) - is redefined static; - ---Purpose: call_togl_draw2d - - Edge ( me : mutable; - X : ShortReal from Standard; - Y : ShortReal from Standard ) - is redefined static; - ---Purpose: call_togl_edge2d - - EndLayer ( me : mutable ) - is redefined static; - ---Purpose: call_togl_end_layer2d - - EndPolygon2d ( me : mutable ) - is redefined static; - ---Purpose: call_togl_end_polygon2d - - EndPolyline2d ( me : mutable ) - is redefined static; - ---Purpose: call_togl_end_polyline2d - - Move ( me : mutable; - X : ShortReal from Standard; - Y : ShortReal from Standard ) - is redefined static; - ---Purpose: call_togl_move2d - - Rectangle ( me : mutable; - X, Y : ShortReal from Standard; - Width, Height : ShortReal from Standard ) - is redefined static; - ---Purpose: call_togl_rectangle2d - - SetColor ( me : mutable; - R : ShortReal from Standard; - G : ShortReal from Standard; - B : ShortReal from Standard ) - is redefined static; - ---Purpose: call_togl_set_color - - SetTransparency ( me : mutable; - ATransparency : ShortReal from Standard ) - is redefined static; - ---Purpose: call_togl_set_transparency - - UnsetTransparency ( me : mutable ) - is redefined static; - ---Purpose: call_togl_unset_transparency - - SetLineAttributes ( me : mutable; - Type : Integer from Standard; - Width : ShortReal from Standard ) - is redefined static; - ---Purpose: call_togl_set_line_attributes - - SetTextAttributes ( me : mutable; - FontName : CString from Standard; - Type : Integer from Standard; - R : ShortReal from Standard; - G : ShortReal from Standard; - B : ShortReal from Standard ) - is redefined static; - ---Purpose: call_togl_set_text_attributes - - - Text ( me : mutable; - AText : CString from Standard; - X, Y : ShortReal from Standard; - AHeight : ShortReal from Standard ) - is redefined static; - ---Purpose: call_togl_text2d - - TextSize( me; - AText : CString from Standard; - AHeight : ShortReal from Standard; - AWidth : in out ShortReal from Standard; - AnAscent : in out ShortReal from Standard; - ADescent : in out ShortReal from Standard ) - is redefined static; - ---Purpose: call_togl_textsize2d - - SetBackFacingModel ( me : mutable; - aView : CView from Graphic3d ) - is redefined static; - ---Purpose: call_togl_backfacing - - Print (me; - ACView : CView from Graphic3d; - ACUnderLayer : CLayer2d from Aspect; - ACOverLayer : CLayer2d from Aspect; - hPrnDC : Handle from Aspect; - showBackground : Boolean; - filename : CString; - printAlgorithm : PrintAlgo from Aspect = Aspect_PA_STRETCH; - theScaleFactor : Real from Standard = 1.0 ) - returns Boolean from Standard is redefined static; - ---Level: Internal - ---Purpose: print the contents of all layers of the view to the printer. - -- : Pass the PrinterDeviceContext (HDC), - -- : When set to FALSE then print the view without background color - -- (background is white) - -- else set to TRUE for printing with current background color. - -- : If != NULL, then the view will be printed to a file. - -- : Select print algorithm: stretch, tile. - -- : Scaling coefficient, used internally to scale the - -- printings accordingly to the scale factor selected in the printer - -- properties dialog. - -- Returns Standard_True if the data is passed to the printer, otherwise - -- Standard_False if the print operation failed due to the printer errors, - -- or lack of system memory. This might be related to insufficient memory - -- or some internal errors. All this errors are indicated by the message - -- boxes (on level of OpenGl_GraphicDriver). - -- Warning: This function can reuse FBO assigned to the view - -- Please take it into account if you use it for your purposes; - ---Warning: Works only under Windows. - - - Export( me: mutable; - theFileName : CString from Standard; - theFormat : ExportFormat from Graphic3d; - theSortType : SortType from Graphic3d; - theWidth, theHeight : Integer from Standard; - theView : CView from Graphic3d; - theLayerUnder : CLayer2d from Aspect; - theLayerOver : CLayer2d from Aspect; - thePrecision : Real from Standard = 0.005; - theProgressBarFunc : Address from Standard = NULL; - theProgressObject : Address from Standard = NULL ) - returns Boolean from Standard - is redefined virtual; - ---Purpose: - -- Export scene into the one of the Vector graphics formats (SVG, PS, PDF...). - -- Requires gl2ps library. - -- In contrast to Bitmaps, Vector graphics is scalable (so you may got quality benefits on printing to laser printer). - -- Notice however that results may differ a lot and do not contain some elements. - -- EMF export format requiers modified gl2ps library and available only on Windows platform. - - - SetDepthTestEnabled( me; view : CView from Graphic3d; - isEnabled : Boolean from Standard ) - is redefined static; - ---Purpose: call_togl_depthtest() - - IsDepthTestEnabled( me; view : CView from Graphic3d ) - returns Boolean from Standard is redefined static; - ---Purpose: call_togl_isdepthtest() - - ReadDepths( me; view : CView from Graphic3d; - x, y : Integer; - width, height : Integer; - buffer : Address ) - is redefined static; - ---Purpose: Reads depths of shown pixels of the given - -- rectangle (glReadPixels with GL_DEPTH_COMPONENT) - - FBOCreate( me : mutable; - view : CView from Graphic3d; - width, height : Integer from Standard ) - returns PtrFrameBuffer from Graphic3d - is redefined static; - ---Purpose: Generate offscreen FBO (needs OpenGL2+ hardware) - -- If not supported on hardware returns NULL. - - FBORelease( me : mutable; - view : CView from Graphic3d; - fboPtr : in out PtrFrameBuffer from Graphic3d ) - is redefined static; - ---Purpose: Remove offscreen FBO - - FBOGetDimensions( me : mutable; - view : CView from Graphic3d; - fboPtr : PtrFrameBuffer from Graphic3d; - width, height : out Integer from Standard; - widthMax, heightMax : out Integer from Standard ) - is redefined static; - ---Purpose: Read offscreen FBO configuration. - - FBOChangeViewport( me : mutable; - view : CView from Graphic3d; - fboPtr : in out PtrFrameBuffer from Graphic3d; - width, height : Integer from Standard ) - is redefined static; - ---Purpose: Change offscreen FBO viewport. - - BufferDump( me : mutable; - view : CView from Graphic3d; - buffer : in out CRawBufferData from Image ) - returns Boolean from Standard - is redefined static; - ---Purpose: Dump active rendering buffer into specified memory buffer. - - SetGLLightEnabled( me; view : CView from Graphic3d; - isEnabled : Boolean from Standard ) - is redefined static; - ---Purpose: call_togl_gllight() - - IsGLLightEnabled( me; view : CView from Graphic3d ) - returns Boolean from Standard is redefined static; - ---Purpose: call_togl_isgllight() - - --ListOfAvalableFontNames( me; - -- lst: out NListOfHAsciiString from Graphic3d ) - -- returns Boolean from Standard - -- is redefined; - -- Purpose: Initialize list of names of avalable system fonts - -- returns Standard_False if fails - -- ABD Integration support of system fonts (using FTGL and FreeType) - - RemovePrimitiveArray( me : mutable; - theCGroup : CGroup from Graphic3d; - thePArray : PrimitiveArray from Graphic3d ) - is redefined static; - ---Purpose: Clear visualization data in graphical driver and - -- stop displaying the primitives array of the graphical group - -- . This method is internal and should be used - -- by Graphic3d_Group only. - -end GraphicDriver from OpenGl; diff --git a/src/OpenGl/OpenGl_GraphicDriver.cxx b/src/OpenGl/OpenGl_GraphicDriver.cxx index f9fcfcba06..38a4d6df94 100755 --- a/src/OpenGl/OpenGl_GraphicDriver.cxx +++ b/src/OpenGl/OpenGl_GraphicDriver.cxx @@ -1,29 +1,24 @@ +// File: OpenGl_GraphicDriver.cxx +// Created: 20 October 2011 +// Author: Sergey ZERCHANINOV +// Copyright: OPEN CASCADE 2011 -// File OpenGl_GraphicDriver.cxx -// Created Mardi 28 janvier 1997 -// Author CAL +#include -//-Copyright MatraDatavision 1997 +#include +#include -//-Version +IMPLEMENT_STANDARD_HANDLE(OpenGl_GraphicDriver,Graphic3d_GraphicDriver) +IMPLEMENT_STANDARD_RTTIEXT(OpenGl_GraphicDriver,Graphic3d_GraphicDriver) -//-Design Declaration des variables specifiques aux Drivers - -//-Warning Un driver encapsule les Pex, Phigs et OpenGl drivers - -//-References - -//-Language C++ 2.0 - -//-Declarations - -// for the class -#include -#include - -//-Aliases - -//-Global data definitions +namespace +{ + // Global maps - shared by whole TKOpenGl module. To be removed. + static NCollection_DataMap TheMapOfView (1, NCollection_BaseAllocator::CommonBaseAllocator()); + static NCollection_DataMap TheMapOfWS (1, NCollection_BaseAllocator::CommonBaseAllocator()); + static NCollection_DataMap TheMapOfStructure (1, NCollection_BaseAllocator::CommonBaseAllocator()); + static Standard_Boolean TheToUseVbo = Standard_True; +}; // Pour eviter de "mangler" MetaGraphicDriverFactory, le nom de la // fonction qui cree un Graphic3d_GraphicDriver. @@ -32,41 +27,62 @@ // classe Graphic3d_GraphicDevice extern "C" { #ifdef WNT /* disable MS VC++ warning on C-style function returning C++ object */ -#pragma warning(push) -#pragma warning(disable:4190) + #pragma warning(push) + #pragma warning(disable:4190) #endif - Standard_EXPORT Handle(Graphic3d_GraphicDriver) MetaGraphicDriverFactory - (const Standard_CString AShrName); - Standard_EXPORT Handle(Graphic3d_GraphicDriver) MetaGraphicDriverFactory - (const Standard_CString AShrName) { - Handle(OpenGl_GraphicDriver) aOpenDriver = new OpenGl_GraphicDriver (AShrName); - return aOpenDriver; - // return new OpenGl_GraphicDriver (AShrName); - } + Standard_EXPORT Handle(Graphic3d_GraphicDriver) MetaGraphicDriverFactory (const Standard_CString AShrName) + { + Handle(OpenGl_GraphicDriver) aOpenDriver = new OpenGl_GraphicDriver (AShrName); + return aOpenDriver; + } #ifdef WNT -#pragma warning(pop) + #pragma warning(pop) #endif } -//-Constructors - -OpenGl_GraphicDriver::OpenGl_GraphicDriver (const Standard_CString AShrName):Graphic3d_GraphicDriver (AShrName) +OpenGl_GraphicDriver::OpenGl_GraphicDriver (const Standard_CString theShrName) +: Graphic3d_GraphicDriver (theShrName) { + // } -//-Methods, in order - Standard_ShortReal OpenGl_GraphicDriver::DefaultTextHeight() const { return 16.; } -GLboolean OpenGl_QueryExtensionGLX (const char *extName) +NCollection_DataMap& OpenGl_GraphicDriver::GetMapOfViews() +{ + return TheMapOfView; +} + +NCollection_DataMap& OpenGl_GraphicDriver::GetMapOfWorkspaces() +{ + return TheMapOfWS; +} + +NCollection_DataMap& OpenGl_GraphicDriver::GetMapOfStructures() +{ + return TheMapOfStructure; +} + +//TsmInitUpdateState +void OpenGl_GraphicDriver::InvalidateAllWorkspaces() +{ + for (NCollection_DataMap::Iterator anIt (OpenGl_GraphicDriver::GetMapOfWorkspaces()); + anIt.More(); anIt.Next()) + { + anIt.ChangeValue()->Invalidate(); + anIt.ChangeValue()->EraseAnimation(); + } +} + +Standard_Boolean OpenGl_GraphicDriver::ToUseVBO() { - return QueryExtensionGLX(const_cast(extName)); + return TheToUseVbo; } -GLboolean OpenGl_QueryExtension (const char *extName) +void OpenGl_GraphicDriver::EnableVBO (const Standard_Boolean theToTurnOn) { - return QueryExtension(const_cast(extName)); + TheToUseVbo = theToTurnOn; } diff --git a/src/OpenGl/OpenGl_GraphicDriver.hxx b/src/OpenGl/OpenGl_GraphicDriver.hxx new file mode 100644 index 0000000000..c2e8420824 --- /dev/null +++ b/src/OpenGl/OpenGl_GraphicDriver.hxx @@ -0,0 +1,317 @@ +// File: OpenGl_GraphicDriver.hxx +// Created: 20 October 2011 +// Author: Sergey ZERCHANINOV +// Copyright: OPEN CASCADE 2011 + +#ifndef _OpenGl_GraphicDriver_HeaderFile +#define _OpenGl_GraphicDriver_HeaderFile + +#include +#include + +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class TColStd_Array1OfInteger; +class TColStd_Array1OfReal; +class TColStd_Array2OfReal; +class TColStd_HArray1OfByte; +class Graphic3d_VertexNC; +class Graphic3d_Vector; +class Quantity_Color; +class Graphic3d_Vertex; +class Aspect_Array1OfEdge; +class TCollection_ExtendedString; +class AlienImage_AlienImage; +class TColStd_HArray1OfReal; +class Handle(OpenGl_View); +class Handle(OpenGl_Workspace); +class OpenGl_Structure; + +//! This class defines an OpenGl graphic driver
+class OpenGl_GraphicDriver : public Graphic3d_GraphicDriver +{ + public: + + //! Constructor + Standard_EXPORT OpenGl_GraphicDriver (const Standard_CString theShrName); + + Standard_EXPORT Standard_Boolean Begin (const Standard_CString ADisplay); + Standard_EXPORT Standard_Boolean Begin (const Aspect_Display ADisplay); + Standard_EXPORT void End (); + Standard_EXPORT Standard_Integer InquireLightLimit (); + Standard_EXPORT void InquireMat (const Graphic3d_CView& ACView, TColStd_Array2OfReal& AMatO, TColStd_Array2OfReal& AMatM); + Standard_EXPORT Standard_Integer InquireViewLimit (); + Standard_EXPORT Standard_Boolean InquireTextureAvailable (); + Standard_EXPORT void Blink (const Graphic3d_CStructure& ACStructure,const Standard_Boolean Create); + Standard_EXPORT void BoundaryBox (const Graphic3d_CStructure& ACStructure, const Standard_Boolean Create); + Standard_EXPORT void HighlightColor (const Graphic3d_CStructure& ACStructure, const Standard_ShortReal R, const Standard_ShortReal G, const Standard_ShortReal B, const Standard_Boolean Create); + Standard_EXPORT void NameSetStructure (const Graphic3d_CStructure& ACStructure); + +public: // Methods for graphical groups + + Standard_EXPORT void ClearGroup (const Graphic3d_CGroup& ACGroup); + Standard_EXPORT void CloseGroup (const Graphic3d_CGroup& ACGroup); + Standard_EXPORT void FaceContextGroup (const Graphic3d_CGroup& theCGroup, + const Standard_Integer theNoInsert); + Standard_EXPORT void Group (Graphic3d_CGroup& theCGroup); + Standard_EXPORT void LineContextGroup (const Graphic3d_CGroup& theCGroup, + const Standard_Integer theNoInsert); + Standard_EXPORT void MarkerContextGroup (const Graphic3d_CGroup& theCGroup, + const Standard_Integer theNoInsert); + Standard_EXPORT void MarkerContextGroup (const Graphic3d_CGroup& theCGroup, + const Standard_Integer theNoInsert, + const Standard_Integer theMarkWidth, + const Standard_Integer theMarkHeight, + const Handle(TColStd_HArray1OfByte)& theTexture); + Standard_EXPORT void OpenGroup (const Graphic3d_CGroup& theCGroup); + Standard_EXPORT void RemoveGroup (const Graphic3d_CGroup& theCGroup); + Standard_EXPORT void TextContextGroup (const Graphic3d_CGroup& theCGroup, + const Standard_Integer theNoInsert); + +public: // Methods for graphical structures + + Standard_EXPORT void ClearStructure (const Graphic3d_CStructure& theCStructure); + Standard_EXPORT void ContextStructure (const Graphic3d_CStructure& theCStructure); + Standard_EXPORT void Connect (const Graphic3d_CStructure& theFather, + const Graphic3d_CStructure& theSon); + Standard_EXPORT void Disconnect (const Graphic3d_CStructure& theFather, + const Graphic3d_CStructure& theSon); + Standard_EXPORT void DisplayStructure (const Graphic3d_CView& theCView, + const Graphic3d_CStructure& theCStructure, + const Standard_Integer thePriority); + Standard_EXPORT void EraseStructure (const Graphic3d_CView& theCView, + const Graphic3d_CStructure& theCStructure); + Standard_EXPORT void RemoveStructure (const Graphic3d_CStructure& theCStructure); + Standard_EXPORT void Structure (Graphic3d_CStructure& theCStructure); + +public: + + Standard_EXPORT void DumpGroup (const Graphic3d_CGroup& theCGroup); + Standard_EXPORT void DumpStructure (const Graphic3d_CStructure& theCStructure); + Standard_EXPORT void DumpView (const Graphic3d_CView& theCView); + Standard_EXPORT Standard_Boolean ElementExploration (const Graphic3d_CStructure& ACStructure, const Standard_Integer ElementNumber, Graphic3d_VertexNC& AVertex, Graphic3d_Vector& AVector); + Standard_EXPORT Graphic3d_TypeOfPrimitive ElementType (const Graphic3d_CStructure& ACStructure, const Standard_Integer ElementNumber); + Standard_EXPORT void InitPick (); + Standard_EXPORT void Pick (Graphic3d_CPick& ACPick); + Standard_EXPORT void PickId (const Graphic3d_CGroup& ACGroup); + Standard_EXPORT void ActivateView (const Graphic3d_CView& ACView); + Standard_EXPORT void AntiAliasing (const Graphic3d_CView& ACView, const Standard_Boolean AFlag); + Standard_EXPORT void Background (const Graphic3d_CView& ACView); + Standard_EXPORT void GradientBackground (const Graphic3d_CView& ACView, const Quantity_Color& AColor1, const Quantity_Color& AColor2, const Aspect_GradientFillMethod FillStyle); + Standard_EXPORT void BackgroundImage (const Standard_CString FileName, const Graphic3d_CView& ACView, const Aspect_FillMethod FillStyle); + Standard_EXPORT void SetBgImageStyle (const Graphic3d_CView& ACView, const Aspect_FillMethod FillStyle); + Standard_EXPORT void SetBgGradientStyle (const Graphic3d_CView& ACView, const Aspect_GradientFillMethod FillStyle); + Standard_EXPORT void ClipLimit (const Graphic3d_CView& ACView, const Standard_Boolean AWait); + Standard_EXPORT void DeactivateView (const Graphic3d_CView& ACView); + Standard_EXPORT void DepthCueing (const Graphic3d_CView& ACView, const Standard_Boolean AFlag); + Standard_EXPORT Standard_Boolean ProjectRaster (const Graphic3d_CView& ACView, const Standard_ShortReal AX, const Standard_ShortReal AY, const Standard_ShortReal AZ, Standard_Integer& AU, Standard_Integer& AV); + Standard_EXPORT Standard_Boolean UnProjectRaster (const Graphic3d_CView& ACView, const Standard_Integer Axm, const Standard_Integer Aym, const Standard_Integer AXM, const Standard_Integer AYM, const Standard_Integer AU, const Standard_Integer AV, Standard_ShortReal& AX, Standard_ShortReal& AY, Standard_ShortReal& AZ); + Standard_EXPORT Standard_Boolean UnProjectRasterWithRay (const Graphic3d_CView& ACView, const Standard_Integer Axm, const Standard_Integer Aym, const Standard_Integer AXM, const Standard_Integer AYM, const Standard_Integer AU, const Standard_Integer AV, Standard_ShortReal& AX, Standard_ShortReal& AY, Standard_ShortReal& AZ, Standard_ShortReal& DX, Standard_ShortReal& DY, Standard_ShortReal& DZ); + Standard_EXPORT void RatioWindow (const Graphic3d_CView& ACView); + Standard_EXPORT void Redraw (const Graphic3d_CView& ACView, const Aspect_CLayer2d& ACUnderLayer, const Aspect_CLayer2d& ACOverLayer, const Standard_Integer x = 0, const Standard_Integer y = 0, const Standard_Integer width = 0, const Standard_Integer height = 0); + Standard_EXPORT void RemoveView (const Graphic3d_CView& ACView); + Standard_EXPORT void SetLight (const Graphic3d_CView& ACView); + Standard_EXPORT void SetPlane (const Graphic3d_CView& ACView); + Standard_EXPORT void SetVisualisation (const Graphic3d_CView& ACView); + Standard_EXPORT void TransformStructure (const Graphic3d_CStructure& ACStructure); + Standard_EXPORT void DegenerateStructure (const Graphic3d_CStructure& ACStructure); + Standard_EXPORT void Transparency (const Graphic3d_CView& ACView, const Standard_Boolean AFlag); + Standard_EXPORT void Update (const Graphic3d_CView& ACView, const Aspect_CLayer2d& ACUnderLayer, const Aspect_CLayer2d& ACOverLayer); + Standard_EXPORT Standard_Boolean View (Graphic3d_CView& ACView); + Standard_EXPORT void ViewMapping (const Graphic3d_CView& ACView, const Standard_Boolean AWait); + Standard_EXPORT void ViewOrientation (const Graphic3d_CView& ACView,const Standard_Boolean AWait); + Standard_EXPORT void Environment (const Graphic3d_CView& ACView); + Standard_EXPORT void Marker (const Graphic3d_CGroup& ACGroup, const Graphic3d_Vertex& APoint, const Standard_Boolean EvalMinMax = Standard_True); + Standard_EXPORT void MarkerSet (const Graphic3d_CGroup& ACGroup, const Graphic3d_Array1OfVertex& ListVertex, const Standard_Boolean EvalMinMax = Standard_True); + Standard_EXPORT void Polygon (const Graphic3d_CGroup& ACGroup, const Graphic3d_Array1OfVertex& ListVertex, const Graphic3d_TypeOfPolygon AType = Graphic3d_TOP_CONVEX, const Standard_Boolean EvalMinMax = Standard_True); + Standard_EXPORT void Polygon (const Graphic3d_CGroup& ACGroup, const Graphic3d_Array1OfVertex& ListVertex, const Graphic3d_Vector& Normal, const Graphic3d_TypeOfPolygon AType = Graphic3d_TOP_CONVEX, const Standard_Boolean EvalMinMax = Standard_True); + Standard_EXPORT void Polygon (const Graphic3d_CGroup& ACGroup, const Graphic3d_Array1OfVertexN& ListVertex, const Graphic3d_TypeOfPolygon AType = Graphic3d_TOP_CONVEX, const Standard_Boolean EvalMinMax = Standard_True); + Standard_EXPORT void Polygon (const Graphic3d_CGroup& ACGroup, const Graphic3d_Array1OfVertexN& ListVertex, const Graphic3d_Vector& Normal, const Graphic3d_TypeOfPolygon AType = Graphic3d_TOP_CONVEX, const Standard_Boolean EvalMinMax = Standard_True); + Standard_EXPORT void Polygon (const Graphic3d_CGroup& ACGroup, const Graphic3d_Array1OfVertexNT& ListVertex, const Graphic3d_TypeOfPolygon AType = Graphic3d_TOP_CONVEX, const Standard_Boolean EvalMinMax = Standard_True); + Standard_EXPORT void PolygonHoles (const Graphic3d_CGroup& ACGroup, const TColStd_Array1OfInteger& Bounds, const Graphic3d_Array1OfVertex& ListVertex, const Standard_Boolean EvalMinMax = Standard_True); + Standard_EXPORT void PolygonHoles (const Graphic3d_CGroup& ACGroup, const TColStd_Array1OfInteger& Bounds, const Graphic3d_Array1OfVertex& ListVertex, const Graphic3d_Vector& Normal, const Standard_Boolean EvalMinMax = Standard_True); + Standard_EXPORT void PolygonHoles (const Graphic3d_CGroup& ACGroup, const TColStd_Array1OfInteger& Bounds, const Graphic3d_Array1OfVertexN& ListVertex, const Standard_Boolean EvalMinMax = Standard_True); + Standard_EXPORT void PolygonHoles (const Graphic3d_CGroup& ACGroup, const TColStd_Array1OfInteger& Bounds, const Graphic3d_Array1OfVertexN& ListVertex, const Graphic3d_Vector& Normal, const Standard_Boolean EvalMinMax = Standard_True); + Standard_EXPORT void Polyline (const Graphic3d_CGroup& ACGroup, const Standard_Real X1, const Standard_Real Y1, const Standard_Real Z1, const Standard_Real X2, const Standard_Real Y2, const Standard_Real Z2, const Standard_Boolean EvalMinMax = Standard_True); + Standard_EXPORT void Polyline (const Graphic3d_CGroup& ACGroup, const Graphic3d_Array1OfVertex& ListVertex, const Standard_Boolean EvalMinMax = Standard_True); + Standard_EXPORT void Polyline (const Graphic3d_CGroup& ACGroup, const Graphic3d_Array1OfVertexC& ListVertex, const Standard_Boolean EvalMinMax = Standard_True); + Standard_EXPORT void QuadrangleMesh (const Graphic3d_CGroup& ACGroup, const Graphic3d_Array2OfVertex& ListVertex, const Standard_Boolean EvalMinMax = Standard_True); + Standard_EXPORT void QuadrangleMesh (const Graphic3d_CGroup& ACGroup, const Graphic3d_Array2OfVertexN& ListVertex, const Standard_Boolean EvalMinMax = Standard_True); + Standard_EXPORT void QuadrangleMesh (const Graphic3d_CGroup& ACGroup, const Graphic3d_Array2OfVertexNT& ListVertex, const Standard_Boolean EvalMinMax = Standard_True); + Standard_EXPORT void Text (const Graphic3d_CGroup& ACGroup, const Standard_CString AText, const Graphic3d_Vertex& APoint, const Standard_Real AHeight, const Quantity_PlaneAngle AAngle, const Graphic3d_TextPath ATp, const Graphic3d_HorizontalTextAlignment AHta, const Graphic3d_VerticalTextAlignment AVta, const Standard_Boolean EvalMinMax = Standard_True); + Standard_EXPORT void Text (const Graphic3d_CGroup& ACGroup, const Standard_CString AText, const Graphic3d_Vertex& APoint, const Standard_Real AHeight, const Standard_Boolean EvalMinMax = Standard_True); + Standard_EXPORT void Text (const Graphic3d_CGroup& ACGroup, const TCollection_ExtendedString& AText, const Graphic3d_Vertex& APoint, const Standard_Real AHeight, const Quantity_PlaneAngle AAngle, const Graphic3d_TextPath ATp, const Graphic3d_HorizontalTextAlignment AHta, const Graphic3d_VerticalTextAlignment AVta, const Standard_Boolean EvalMinMax = Standard_True); + Standard_EXPORT void Text (const Graphic3d_CGroup& ACGroup, const TCollection_ExtendedString& AText, const Graphic3d_Vertex& APoint, const Standard_Real AHeight, const Standard_Boolean EvalMinMax = Standard_True); + Standard_EXPORT void TriangleMesh (const Graphic3d_CGroup& ACGroup,const Graphic3d_Array1OfVertex& ListVertex,const Standard_Boolean EvalMinMax = Standard_True); + Standard_EXPORT void TriangleMesh (const Graphic3d_CGroup& ACGroup,const Graphic3d_Array1OfVertexN& ListVertex,const Standard_Boolean EvalMinMax = Standard_True); + Standard_EXPORT void TriangleMesh (const Graphic3d_CGroup& ACGroup,const Graphic3d_Array1OfVertexNT& ListVertex,const Standard_Boolean EvalMinMax = Standard_True); + Standard_EXPORT void TriangleSet (const Graphic3d_CGroup& ACGroup,const Graphic3d_Array1OfVertex& ListVertex,const Aspect_Array1OfEdge& ListEdge,const Standard_Boolean EvalMinMax = Standard_True); + Standard_EXPORT void TriangleSet (const Graphic3d_CGroup& ACGroup,const Graphic3d_Array1OfVertexN& ListVertex,const Aspect_Array1OfEdge& ListEdge,const Standard_Boolean EvalMinMax = Standard_True); + Standard_EXPORT void TriangleSet (const Graphic3d_CGroup& ACGroup,const Graphic3d_Array1OfVertexNT& ListVertex,const Aspect_Array1OfEdge& ListEdge,const Standard_Boolean EvalMinMax = Standard_True); + Standard_EXPORT void TriangleSet (const Graphic3d_CGroup& ACGroup,const Graphic3d_Array1OfVertexC& ListVertex,const Aspect_Array1OfEdge& ListEdge,const Standard_Boolean EvalMinMax = Standard_True); + Standard_EXPORT void TriangleSet (const Graphic3d_CGroup& ACGroup,const Graphic3d_Array1OfVertexNC& ListVertex,const Aspect_Array1OfEdge& ListEdge,const Standard_Boolean EvalMinMax = Standard_True); + Standard_EXPORT void PrimitiveArray (const Graphic3d_CGroup& ACGroup,const Graphic3d_PrimitiveArray& parray,const Standard_Boolean EvalMinMax = Standard_True); + Standard_EXPORT void UserDraw (const Graphic3d_CGroup& ACGroup,const Graphic3d_CUserDraw& AUserDraw); + Standard_EXPORT void ZBufferTriedronSetup (const Quantity_NameOfColor XColor = Quantity_NOC_RED, const Quantity_NameOfColor YColor = Quantity_NOC_GREEN, const Quantity_NameOfColor ZColor = Quantity_NOC_BLUE1, const Standard_Real SizeRatio = 0.8, const Standard_Real AxisDiametr = 0.05, const Standard_Integer NbFacettes = 12); + Standard_EXPORT void TriedronDisplay (const Graphic3d_CView& ACView, const Aspect_TypeOfTriedronPosition APosition = Aspect_TOTP_CENTER, const Quantity_NameOfColor AColor = Quantity_NOC_WHITE, const Standard_Real AScale = 0.02, const Standard_Boolean AsWireframe = Standard_True); + Standard_EXPORT void TriedronErase (const Graphic3d_CView& ACView); + Standard_EXPORT void TriedronEcho (const Graphic3d_CView& ACView, const Aspect_TypeOfTriedronEcho AType = Aspect_TOTE_NONE); + Standard_EXPORT void GraduatedTrihedronDisplay (const Graphic3d_CView& view, const Graphic3d_CGraduatedTrihedron& cubic); + Standard_EXPORT void GraduatedTrihedronErase (const Graphic3d_CView& view); + Standard_EXPORT void GraduatedTrihedronMinMaxValues (const Standard_ShortReal xmin, const Standard_ShortReal ymin, const Standard_ShortReal zmin, const Standard_ShortReal xmax, const Standard_ShortReal ymax, const Standard_ShortReal zmax); + Standard_EXPORT void BeginAnimation (const Graphic3d_CView& ACView); + Standard_EXPORT void EndAnimation (const Graphic3d_CView& ACView); + Standard_EXPORT Standard_Boolean BeginAddMode (const Graphic3d_CView& ACView); + Standard_EXPORT void EndAddMode (); + Standard_EXPORT Standard_Boolean BeginImmediatMode(const Graphic3d_CView& ACView, const Aspect_CLayer2d& ACUnderLayer, const Aspect_CLayer2d& ACOverLayer, const Standard_Boolean DoubleBuffer, const Standard_Boolean RetainMode); + Standard_EXPORT void BeginPolyline (); + Standard_EXPORT void ClearImmediatMode (const Graphic3d_CView& ACView,const Standard_Boolean aFlush = Standard_True); + Standard_EXPORT void Draw (const Standard_ShortReal X, const Standard_ShortReal Y, const Standard_ShortReal Z); + Standard_EXPORT void DrawStructure (const Graphic3d_CStructure& ACStructure); + Standard_EXPORT void EndImmediatMode (const Standard_Integer Synchronize); + Standard_EXPORT void EndPolyline (); + Standard_EXPORT void Move (const Standard_ShortReal X, const Standard_ShortReal Y, const Standard_ShortReal Z); + Standard_EXPORT void SetLineColor (const Standard_ShortReal R, const Standard_ShortReal G, const Standard_ShortReal B); + Standard_EXPORT void SetLineType (const Standard_Integer Type); + Standard_EXPORT void SetLineWidth (const Standard_ShortReal Width); + Standard_EXPORT void SetMinMax (const Standard_ShortReal X1, const Standard_ShortReal Y1, const Standard_ShortReal Z1, const Standard_ShortReal X2, const Standard_ShortReal Y2, const Standard_ShortReal Z2); + Standard_EXPORT void Transform (const TColStd_Array2OfReal& AMatrix, const Graphic3d_TypeOfComposition AType); + Standard_EXPORT void Layer (Aspect_CLayer2d& ACLayer); + Standard_EXPORT void RemoveLayer (const Aspect_CLayer2d& ACLayer); + Standard_EXPORT void BeginLayer (const Aspect_CLayer2d& ACLayer); + Standard_EXPORT void BeginPolygon2d (); + Standard_EXPORT void BeginPolyline2d (); + Standard_EXPORT void ClearLayer (const Aspect_CLayer2d& ACLayer); + Standard_EXPORT void Draw (const Standard_ShortReal X,const Standard_ShortReal Y); + Standard_EXPORT void Edge (const Standard_ShortReal X,const Standard_ShortReal Y); + Standard_EXPORT void EndLayer (); + Standard_EXPORT void EndPolygon2d (); + Standard_EXPORT void EndPolyline2d (); + Standard_EXPORT void Move (const Standard_ShortReal X,const Standard_ShortReal Y); + Standard_EXPORT void Rectangle (const Standard_ShortReal X,const Standard_ShortReal Y,const Standard_ShortReal Width,const Standard_ShortReal Height); + Standard_EXPORT void SetColor (const Standard_ShortReal R,const Standard_ShortReal G,const Standard_ShortReal B); + Standard_EXPORT void SetTransparency (const Standard_ShortReal ATransparency); + Standard_EXPORT void UnsetTransparency (); + Standard_EXPORT void SetLineAttributes (const Standard_Integer Type,const Standard_ShortReal Width); + Standard_EXPORT void SetTextAttributes (const Standard_CString FontName,const Standard_Integer Type,const Standard_ShortReal R,const Standard_ShortReal G,const Standard_ShortReal B); + Standard_EXPORT void Text (const Standard_CString AText,const Standard_ShortReal X,const Standard_ShortReal Y,const Standard_ShortReal AHeight); + Standard_EXPORT void TextSize (const Standard_CString AText,const Standard_ShortReal AHeight,Standard_ShortReal& AWidth,Standard_ShortReal& AnAscent,Standard_ShortReal& ADescent) const; + Standard_EXPORT void SetBackFacingModel (const Graphic3d_CView& aView); + //! print the contents of all layers of the view to the printer.
+ //! : Pass the PrinterDeviceContext (HDC),
+ //! : When set to FALSE then print the view without background color
+ //! (background is white)
+ //! else set to TRUE for printing with current background color.
+ //! : If != NULL, then the view will be printed to a file.
+ //! : Select print algorithm: stretch, tile.
+ //! : Scaling coefficient, used internally to scale the
+ //! printings accordingly to the scale factor selected in the printer
+ //! properties dialog.
+ //! Returns Standard_True if the data is passed to the printer, otherwise
+ //! Standard_False if the print operation failed due to the printer errors,
+ //! or lack of system memory. This might be related to insufficient memory
+ //! or some internal errors. All this errors are indicated by the message
+ //! boxes (on level of OpenGl_GraphicDriver).
+ //! Warning: This function can reuse FBO assigned to the view
+ //! Please take it into account if you use it for your purposes;
+ Standard_EXPORT Standard_Boolean Print (const Graphic3d_CView& ACView, const Aspect_CLayer2d& ACUnderLayer, const Aspect_CLayer2d& ACOverLayer, const Aspect_Handle hPrnDC, const Standard_Boolean showBackground, const Standard_CString filename, const Aspect_PrintAlgo printAlgorithm = Aspect_PA_STRETCH, const Standard_Real theScaleFactor = 1.0) const; + Standard_EXPORT void SetDepthTestEnabled (const Graphic3d_CView& view,const Standard_Boolean isEnabled) const; + Standard_EXPORT Standard_Boolean IsDepthTestEnabled (const Graphic3d_CView& view) const; + //! Reads depths of shown pixels of the given rectangle (glReadPixels with GL_DEPTH_COMPONENT)
+ Standard_EXPORT void ReadDepths (const Graphic3d_CView& view,const Standard_Integer x,const Standard_Integer y,const Standard_Integer width,const Standard_Integer height,const Standard_Address buffer) const; + //! Generate offscreen FBO (needs OpenGL2+ hardware)
+ //! If not supported on hardware returns NULL.
+ Standard_EXPORT Graphic3d_PtrFrameBuffer FBOCreate (const Graphic3d_CView& view, const Standard_Integer width, const Standard_Integer height); + //! Remove offscreen FBO
+ Standard_EXPORT void FBORelease (const Graphic3d_CView& view, Graphic3d_PtrFrameBuffer& fboPtr); + //! Dump active rendering buffer into specified memory buffer.
+ Standard_EXPORT Standard_Boolean BufferDump (const Graphic3d_CView& view, Image_CRawBufferData& buffer); + Standard_EXPORT void SetGLLightEnabled (const Graphic3d_CView& view,const Standard_Boolean isEnabled) const; + Standard_EXPORT Standard_Boolean IsGLLightEnabled (const Graphic3d_CView& view) const; + //! Clear visualization data in graphical driver and stop
+ //! displaying the primitives array of the graphical group .
+ //! This method is internal and should be used by Graphic3d_Group only.
+ Standard_EXPORT void RemovePrimitiveArray(const Graphic3d_CGroup& theCGroup,const Graphic3d_PrimitiveArray& thePArray); + Standard_EXPORT Standard_Integer InquirePlaneLimit(); + Standard_EXPORT Standard_Integer CreateTexture(const Graphic3d_TypeOfTexture Type,const Handle(AlienImage_AlienImage)& Image,const Standard_CString FileName,const Handle(TColStd_HArray1OfReal)& TexUpperBounds) const; + Standard_EXPORT void DestroyTexture(const Standard_Integer TexId) const; + Standard_EXPORT void ModifyTexture(const Standard_Integer TexId,const Graphic3d_CInitTexture& AValue) const; + Standard_EXPORT Standard_ShortReal DefaultTextHeight() const; + Standard_EXPORT void FBOGetDimensions(const Graphic3d_CView& view,const Graphic3d_PtrFrameBuffer fboPtr,Standard_Integer& width,Standard_Integer& height,Standard_Integer& widthMax,Standard_Integer& heightMax); + Standard_EXPORT void FBOChangeViewport(const Graphic3d_CView& view,Graphic3d_PtrFrameBuffer& fboPtr,const Standard_Integer width,const Standard_Integer height); + Standard_EXPORT Standard_Boolean Export(const Standard_CString theFileName,const Graphic3d_ExportFormat theFormat,const Graphic3d_SortType theSortType,const Standard_Integer theWidth,const Standard_Integer theHeight,const Graphic3d_CView& theView,const Aspect_CLayer2d& theLayerUnder,const Aspect_CLayer2d& theLayerOver,const Standard_Real thePrecision = 0.005,const Standard_Address theProgressBarFunc = NULL,const Standard_Address theProgressObject = NULL); + +public: + + //! Returns true if VBO usage does not forbidden. + Standard_EXPORT static Standard_Boolean ToUseVBO(); + + //! VBO usage can be forbidden by this method even if it is supported by GL driver. + //! Notice that disabling of VBO will cause rendering performance degradation. + //! Warning! This method should be called only before any primitives are displayed in GL scene! + Standard_EXPORT void EnableVBO (const Standard_Boolean theToTurnOn); + +private: + + //! Access the global map of views. + static NCollection_DataMap& GetMapOfViews(); + + //! Access the global map of workspaces. + static NCollection_DataMap& GetMapOfWorkspaces(); + + //! Access the global map of structures. + static NCollection_DataMap& GetMapOfStructures(); + + //! Invalidates all workspaces - thus they will be redrawn on next update call. + static void InvalidateAllWorkspaces(); + +public: + + DEFINE_STANDARD_RTTI(OpenGl_GraphicDriver) +}; + +#endif //_OpenGl_GraphicDriver_HeaderFile diff --git a/src/OpenGl/OpenGl_GraphicDriver_1.cxx b/src/OpenGl/OpenGl_GraphicDriver_1.cxx index ce7c418b71..7b596874b4 100755 --- a/src/OpenGl/OpenGl_GraphicDriver_1.cxx +++ b/src/OpenGl/OpenGl_GraphicDriver_1.cxx @@ -1,36 +1,15 @@ +// File: OpenGl_GraphicDriver_1.cxx +// Created: 20 October 2011 +// Author: Sergey ZERCHANINOV +// Copyright: OPEN CASCADE 2011 +#include -// File OpenGl_GraphicDriver_1.cxx -// Created Mardi 28 janvier 1997 -// Author CAL -// Modified GG 27/12/02 IMP120302 Add new method Begin(Aspect_Display) +#include +#include -//-Copyright MatraDatavision 1997 - -//-Version - -//-Design Declaration des variables specifiques aux Drivers - -//-Warning Un driver encapsule les Pex et OpenGl drivers - -//-References - -//-Language C++ 2.0 - -//-Declarations - -// for the class -#include - -#include - -#include - -//-Aliases - -//-Global data definitions - -//-Methods, in order +#include +#include //======================================================================= //function : Begin @@ -39,24 +18,17 @@ Standard_Boolean OpenGl_GraphicDriver::Begin (const Standard_CString ADisplay) { - - - Standard_Boolean Result; - - if (MyTraceLevel) { - PrintFunction ("call_togl_begin"); - PrintString ("Display", ADisplay); + try + { + openglDisplay = new OpenGl_Display(ADisplay); + return Standard_True; } - Result = call_togl_begin ((Standard_PCharacter)ADisplay); - if (MyTraceLevel) { - PrintIResult ("call_togl_begin", Result); + catch (Standard_Failure) + { } - - return Result; - + return Standard_False; } -//RIC120302 //======================================================================= //function : Begin //purpose : @@ -64,34 +36,25 @@ Standard_Boolean OpenGl_GraphicDriver::Begin (const Standard_CString ADisplay) Standard_Boolean OpenGl_GraphicDriver::Begin (const Aspect_Display ADisplay) { - - Standard_Boolean Result; - - if (MyTraceLevel) { - PrintFunction ("call_togl_begin_display"); + try + { + openglDisplay = new OpenGl_Display(ADisplay); + return Standard_True; } - Result = call_togl_begin_display (ADisplay); - if (MyTraceLevel) { - PrintIResult ("call_togl_begin_display", Result); + catch (Standard_Failure) + { } - - return Result; - + return Standard_False; } -//RIC120302 //======================================================================= //function : End //purpose : //======================================================================= -void OpenGl_GraphicDriver::End () { - - if (MyTraceLevel) { - PrintFunction ("call_togl_end"); - } - call_togl_end (); - +void OpenGl_GraphicDriver::End () +{ + openglDisplay.Nullify(); } //======================================================================= @@ -99,16 +62,15 @@ void OpenGl_GraphicDriver::End () { //purpose : //======================================================================= -void OpenGl_GraphicDriver::BeginAnimation (const Graphic3d_CView& ACView) { - - Graphic3d_CView MyCView = ACView; - - if (MyTraceLevel) { - PrintFunction ("call_togl_begin_animation"); - PrintCView (MyCView, 1); +void OpenGl_GraphicDriver::BeginAnimation (const Graphic3d_CView& ACView) +{ + const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView; + if (aCView) + { + const Standard_Boolean UpdateAM = (ACView.IsDegenerates && !ACView.IsDegeneratesPrev) || (!ACView.IsDegenerates && ACView.IsDegeneratesPrev); + aCView->WS->BeginAnimation(ACView.IsDegenerates != 0,UpdateAM); + ((Graphic3d_CView*)(&ACView))->IsDegeneratesPrev = ACView.IsDegenerates; //szvgl: temporary } - call_togl_begin_animation (&MyCView); - } //======================================================================= @@ -116,14 +78,9 @@ void OpenGl_GraphicDriver::BeginAnimation (const Graphic3d_CView& ACView) { //purpose : //======================================================================= -void OpenGl_GraphicDriver::EndAnimation (const Graphic3d_CView& ACView) { - - Graphic3d_CView MyCView = ACView; - - if (MyTraceLevel) { - PrintFunction ("call_togl_end_animation"); - PrintCView (MyCView, 1); - } - call_togl_end_animation (&MyCView); - +void OpenGl_GraphicDriver::EndAnimation (const Graphic3d_CView& ACView) +{ + const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView; + if (aCView) + aCView->WS->EndAnimation(); } diff --git a/src/OpenGl/OpenGl_GraphicDriver_2.cxx b/src/OpenGl/OpenGl_GraphicDriver_2.cxx index 1751db14b2..c81b1b6e57 100755 --- a/src/OpenGl/OpenGl_GraphicDriver_2.cxx +++ b/src/OpenGl/OpenGl_GraphicDriver_2.cxx @@ -1,125 +1,40 @@ +// File: OpenGl_GraphicDriver_2.cxx +// Created: 20 October 2011 +// Author: Sergey ZERCHANINOV +// Copyright: OPEN CASCADE 2011 +#include -// File OpenGl_GraphicDriver_2.cxx -// Created Mardi 28 janvier 1997 -// Author CAL - -//-Copyright MatraDatavision 1997 - -//-Version - -//-Design Declaration des variables specifiques aux Drivers - -//-Warning Un driver encapsule les Pex et OpenGl drivers - -//-References - -//-Language C++ 2.0 - -//-Declarations - -// for the class -#include - -#include +#include +#include +#include #include -//-Aliases - -//-Global data definitions - -//-Methods, in order - -Standard_Integer OpenGl_GraphicDriver::InquireLightLimit () { - - if (MyTraceLevel) { - PrintFunction ("call_togl_inquirelight"); - } - Standard_Integer Result = call_togl_inquirelight (); - if (MyTraceLevel) { - PrintIResult ("call_togl_inquirelight", Result); - } - return Result; - +Standard_Integer OpenGl_GraphicDriver::InquireLightLimit () +{ + return (openglDisplay.IsNull()? 0 : openglDisplay->Facilities().MaxLights); } -void OpenGl_GraphicDriver::InquireMat (const Graphic3d_CView& ACView, TColStd_Array2OfReal& AMatO, TColStd_Array2OfReal& AMatM) { - - Graphic3d_CView MyCView = ACView; - - Standard_Integer i, j; - - CALL_DEF_MATRIX4X4 ori_matrix; - CALL_DEF_MATRIX4X4 map_matrix; - - if (MyTraceLevel) { - PrintFunction ("call_togl_inquiremat"); - PrintCView (MyCView, 1); - } - if (call_togl_inquiremat (&MyCView, ori_matrix, map_matrix) == 0) - for (i=0; i<=3; i++) - for (j=0; j<=3; j++) { - AMatO (i, j) = Standard_Real (ori_matrix[i][j]); - AMatM (i, j) = Standard_Real (map_matrix[i][j]); - } - else - for (i=0; i<=3; i++) - for (j=0; j<=3; j++) { - if (i == j) { - AMatM (i, j) = 1.0; - AMatO (i, j) = 1.0; - } - else { - AMatM (i, j) = 0.0; - AMatO (i, j) = 0.0; - } - } - - if (MyTraceLevel) { - PrintMatrix ("Orientation", AMatO); - PrintMatrix ("Mapping", AMatM); - } - +void OpenGl_GraphicDriver::InquireMat (const Graphic3d_CView& ACView, TColStd_Array2OfReal& AMatO, TColStd_Array2OfReal& AMatM) +{ + const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView; + if (aCView) + aCView->View->GetMatrices(AMatO,AMatM,ACView.Orientation.IsCustomMatrix); } -Standard_Integer OpenGl_GraphicDriver::InquirePlaneLimit () { - - if (MyTraceLevel) { - PrintFunction ("call_togl_inquireplane"); - } - Standard_Integer Result = call_togl_inquireplane (); - if (MyTraceLevel) { - PrintIResult ("call_togl_inquireplane", Result); - } - return Result; - +Standard_Integer OpenGl_GraphicDriver::InquireViewLimit () +{ + return (openglDisplay.IsNull()? 0 : openglDisplay->Facilities().MaxViews); } -Standard_Integer OpenGl_GraphicDriver::InquireViewLimit () { - - if (MyTraceLevel) { - PrintFunction ("call_togl_inquireview"); - } - Standard_Integer Result = call_togl_inquireview (); - if (MyTraceLevel) { - PrintIResult ("call_togl_inquireview", Result); - } - return Result; - +Standard_Boolean OpenGl_GraphicDriver::InquireTextureAvailable () +{ + return Standard_True; } - - -Standard_Boolean OpenGl_GraphicDriver::InquireTextureAvailable () { - - if (MyTraceLevel) { - PrintFunction ("call_togl_inquiretexture"); - } - Standard_Integer Result = call_togl_inquiretexture (); - if (MyTraceLevel) { - PrintIResult ("call_togl_inquiretexture", Result); - } - return Result; - +Standard_Integer OpenGl_GraphicDriver::InquirePlaneLimit () +{ + return call_togl_inquireplane(); } + diff --git a/src/OpenGl/OpenGl_GraphicDriver_3.cxx b/src/OpenGl/OpenGl_GraphicDriver_3.cxx index 4e36c9f664..4e8fc767ae 100755 --- a/src/OpenGl/OpenGl_GraphicDriver_3.cxx +++ b/src/OpenGl/OpenGl_GraphicDriver_3.cxx @@ -1,176 +1,107 @@ +// File: OpenGl_GraphicDriver_3.cxx +// Created: 20 October 2011 +// Author: Sergey ZERCHANINOV +// Copyright: OPEN CASCADE 2011 +#include -// File OpenGl_GraphicDriver_3.cxx -// Created Mardi 28 janvier 1997 -// Author CAL +#include -//-Copyright MatraDatavision 1997 +#include +#include -//-Version - -//-Design Declaration des variables specifiques aux Drivers - -//-Warning Un driver encapsule les Pex et OpenGl drivers - -//-References - -//-Language C++ 2.0 - -//-Declarations - -// for the class -#include - -#include - - -#include - -int GenerateMarkerBitmap( int theId, unsigned int theWidth, unsigned int theHeight, unsigned char* theArray); - -//-Aliases - -//-Global data definitions - -//-Methods, in order - -void OpenGl_GraphicDriver::ClearGroup (const Graphic3d_CGroup& ACGroup) { - - Graphic3d_CGroup MyCGroup = ACGroup; - - if (MyTraceLevel) - { - PrintFunction ("call_togl_cleargroup"); - PrintCGroup (MyCGroup, 1); - } - call_togl_cleargroup (&MyCGroup); +void OpenGl_GraphicDriver::ClearGroup (const Graphic3d_CGroup& theCGroup) +{ + if (theCGroup.ptrGroup == NULL) + return; + ((OpenGl_Group* )theCGroup.ptrGroup)->Clear(); + InvalidateAllWorkspaces(); } -void OpenGl_GraphicDriver::CloseGroup (const Graphic3d_CGroup& ACGroup) { - - Graphic3d_CGroup MyCGroup = ACGroup; - - if (MyTraceLevel) { - PrintFunction ("call_togl_closegroup"); - PrintCGroup (MyCGroup, 1); - } - call_togl_closegroup (&MyCGroup); - +void OpenGl_GraphicDriver::CloseGroup (const Graphic3d_CGroup& ) +{ + // Do nothing } -void OpenGl_GraphicDriver::FaceContextGroup (const Graphic3d_CGroup& ACGroup, const Standard_Integer NoInsert) { - - Graphic3d_CGroup MyCGroup = ACGroup; - - if (MyTraceLevel) { - PrintFunction ("call_togl_facecontextgroup"); - PrintCGroup (MyCGroup, 1); - PrintInteger ("NoInsert", NoInsert); - } - call_togl_facecontextgroup (&MyCGroup, int (NoInsert)); +void OpenGl_GraphicDriver::FaceContextGroup (const Graphic3d_CGroup& theCGroup, + const Standard_Integer theNoInsert) +{ + if (!theCGroup.ContextFillArea.IsDef || theCGroup.ptrGroup == NULL) + return; + ((OpenGl_Group* )theCGroup.ptrGroup)->SetAspectFace (theCGroup.ContextFillArea, theNoInsert); + InvalidateAllWorkspaces(); } -void OpenGl_GraphicDriver::Group (Graphic3d_CGroup& ACGroup) { - - Graphic3d_CGroup MyCGroup = ACGroup; - - if (MyTraceLevel) { - PrintFunction ("call_togl_group"); - PrintCGroup (MyCGroup, 1); +void OpenGl_GraphicDriver::Group (Graphic3d_CGroup& theCGroup) +{ + OpenGl_Structure* aStructure = (OpenGl_Structure* )theCGroup.Struct->ptrStructure; + if (aStructure) + { + theCGroup.ptrGroup = aStructure->AddGroup(); + InvalidateAllWorkspaces(); } - call_togl_group (&MyCGroup); - } -void OpenGl_GraphicDriver::LineContextGroup (const Graphic3d_CGroup& ACGroup, const Standard_Integer NoInsert) { - - Graphic3d_CGroup MyCGroup = ACGroup; - - if (MyTraceLevel) { - PrintFunction ("call_togl_linecontextgroup"); - PrintCGroup (MyCGroup, 1); - PrintInteger ("NoInsert", NoInsert); - } - call_togl_linecontextgroup (&MyCGroup, int (NoInsert)); +void OpenGl_GraphicDriver::LineContextGroup (const Graphic3d_CGroup& theCGroup, + const Standard_Integer theNoInsert) +{ + if (!theCGroup.ContextLine.IsDef || theCGroup.ptrGroup == NULL) return; + ((OpenGl_Group* )theCGroup.ptrGroup)->SetAspectLine (theCGroup.ContextLine, theNoInsert); + InvalidateAllWorkspaces(); } -void OpenGl_GraphicDriver::MarkerContextGroup (const Graphic3d_CGroup& ACGroup, const Standard_Integer NoInsert) { - - Graphic3d_CGroup MyCGroup = ACGroup; - - if (MyTraceLevel) { - PrintFunction ("call_togl_markercontextgroup"); - PrintCGroup (MyCGroup, 1); - PrintInteger ("NoInsert", NoInsert); - } - call_togl_markercontextgroup (&MyCGroup, int (NoInsert)); +void OpenGl_GraphicDriver::MarkerContextGroup (const Graphic3d_CGroup& theCGroup, + const Standard_Integer theNoInsert) +{ + if (!theCGroup.ContextMarker.IsDef || theCGroup.ptrGroup == NULL) return; + ((OpenGl_Group* )theCGroup.ptrGroup)->SetAspectMarker (theCGroup.ContextMarker, theNoInsert); + InvalidateAllWorkspaces(); } -void OpenGl_GraphicDriver::MarkerContextGroup (const Graphic3d_CGroup& ACGroup, - const Standard_Integer NoInsert, - const Standard_Integer AMarkWidth, - const Standard_Integer AMarkHeight, - const Handle(TColStd_HArray1OfByte)& ATexture ) +void OpenGl_GraphicDriver::MarkerContextGroup (const Graphic3d_CGroup& theCGroup, + const Standard_Integer theNoInsert, + const Standard_Integer theMarkWidth, + const Standard_Integer theMarkHeight, + const Handle(TColStd_HArray1OfByte)& theTexture) { + if(!theCGroup.ContextMarker.IsDef) + return; - Graphic3d_CGroup MyCGroup = ACGroup; - - int aByteWidth = AMarkWidth / 8; + if (!openglDisplay.IsNull()) + openglDisplay->AddUserMarker ((int )theCGroup.ContextMarker.Scale, theMarkWidth, theMarkHeight, theTexture); - unsigned char *anArray = (unsigned char*) malloc(ATexture->Length()); - for( int anIndex = ATexture->Upper() - ATexture->Lower() - aByteWidth + 1; anIndex >= 0; anIndex -= aByteWidth ) - for( int i = 0; i < aByteWidth; i++ ) - anArray[ATexture->Upper() - ATexture->Lower() - aByteWidth + 1 - anIndex + i ] = ATexture->Value( anIndex + i + 1 ); - - GenerateMarkerBitmap( (int)ACGroup.ContextMarker.Scale, AMarkWidth, AMarkHeight, anArray ); - if (MyTraceLevel) { - PrintFunction ("call_togl_markercontextgroup"); - PrintCGroup (MyCGroup, 1); - PrintInteger ("NoInsert", NoInsert); + if (theCGroup.ptrGroup != NULL) + { + ((OpenGl_Group* )theCGroup.ptrGroup)->SetAspectMarker (theCGroup.ContextMarker, theNoInsert); + InvalidateAllWorkspaces(); } - call_togl_markercontextgroup (&MyCGroup, int (NoInsert)); - - free(anArray); } - -void OpenGl_GraphicDriver::OpenGroup (const Graphic3d_CGroup& ACGroup) { - - Graphic3d_CGroup MyCGroup = ACGroup; - - if (MyTraceLevel) { - PrintFunction ("call_togl_opengroup"); - PrintCGroup (MyCGroup, 1); - } - call_togl_opengroup (&MyCGroup); - +void OpenGl_GraphicDriver::OpenGroup (const Graphic3d_CGroup& ) +{ + // Do nothing } -void OpenGl_GraphicDriver::RemoveGroup (const Graphic3d_CGroup& ACGroup) { - - Graphic3d_CGroup MyCGroup = ACGroup; - - if (MyTraceLevel) { - PrintFunction ("call_togl_removegroup"); - PrintCGroup (MyCGroup, 1); - } - call_togl_removegroup (&MyCGroup); +void OpenGl_GraphicDriver::RemoveGroup (const Graphic3d_CGroup& theCGroup) +{ + OpenGl_Structure* aStructure = (OpenGl_Structure* )theCGroup.Struct->ptrStructure; + if (aStructure == NULL) + return; + aStructure->RemoveGroup ((const OpenGl_Group* )theCGroup.ptrGroup); + InvalidateAllWorkspaces(); } -void OpenGl_GraphicDriver::TextContextGroup (const Graphic3d_CGroup& ACGroup, const Standard_Integer NoInsert) { - - Graphic3d_CGroup MyCGroup = ACGroup; - - if (MyTraceLevel) { - PrintFunction ("call_togl_textcontextgroup"); - PrintCGroup (MyCGroup, 1); - PrintInteger ("NoInsert", NoInsert); - } - call_togl_textcontextgroup (&MyCGroup, int (NoInsert)); +void OpenGl_GraphicDriver::TextContextGroup (const Graphic3d_CGroup& theCGroup, + const Standard_Integer theNoInsert) +{ + if (!theCGroup.ContextText.IsDef || theCGroup.ptrGroup == NULL) + return; + ((OpenGl_Group* )theCGroup.ptrGroup)->SetAspectText (theCGroup.ContextText, theNoInsert); + InvalidateAllWorkspaces(); } diff --git a/src/OpenGl/OpenGl_GraphicDriver_4.cxx b/src/OpenGl/OpenGl_GraphicDriver_4.cxx index 6046e205c6..0a939fed3d 100755 --- a/src/OpenGl/OpenGl_GraphicDriver_4.cxx +++ b/src/OpenGl/OpenGl_GraphicDriver_4.cxx @@ -1,142 +1,117 @@ +// File: OpenGl_GraphicDriver_4.cxx +// Created: 20 October 2011 +// Author: Sergey ZERCHANINOV +// Copyright: OPEN CASCADE 2011 +#include -// File OpenGl_GraphicDriver_4.cxx -// Created Mardi 28 janvier 1997 -// Author CAL +#include +#include +#include -//-Copyright MatraDatavision 1997 +void OpenGl_GraphicDriver::ClearStructure (const Graphic3d_CStructure& theCStructure) +{ + OpenGl_Structure* aStructure = (OpenGl_Structure* )theCStructure.ptrStructure; + if (aStructure == NULL) + return; -//-Version - -//-Design Declaration des variables specifiques aux Drivers - -//-Warning Un driver encapsule les Pex et OpenGl drivers - -//-References - -//-Language C++ 2.0 - -//-Declarations - -// for the class -#include - -#include - -#include - -//-Aliases + aStructure->Clear(); + InvalidateAllWorkspaces(); +} -//-Global data definitions +void OpenGl_GraphicDriver::ContextStructure (const Graphic3d_CStructure& theCStructure) +{ + OpenGl_Structure* aStructure = (OpenGl_Structure* )theCStructure.ptrStructure; + if (aStructure == NULL) + return; -//-Methods, in order + aStructure->SetTransformPersistence (theCStructure.TransformPersistence); -void OpenGl_GraphicDriver::ClearStructure (const Graphic3d_CStructure& ACStructure) { + if (theCStructure.ContextLine.IsDef) + aStructure->SetAspectLine (theCStructure.ContextLine); - Graphic3d_CStructure MyCStructure = ACStructure; + if (theCStructure.ContextFillArea.IsDef) + aStructure->SetAspectFace (theCStructure.ContextFillArea); + if (theCStructure.ContextMarker.IsDef) + aStructure->SetAspectMarker (theCStructure.ContextMarker); - if (MyTraceLevel) { - PrintFunction ("call_togl_clearstructure"); - PrintCStructure (MyCStructure, 1); - } - call_togl_clearstructure (&MyCStructure); + if (theCStructure.ContextText.IsDef) + aStructure->SetAspectText (theCStructure.ContextText); + InvalidateAllWorkspaces(); } -void OpenGl_GraphicDriver::Connect (const Graphic3d_CStructure& AFather, const Graphic3d_CStructure& ASon) { - - Graphic3d_CStructure MyFather = AFather; - Graphic3d_CStructure MySon = ASon; - - if (MyTraceLevel) { - PrintFunction ("call_togl_connect"); - PrintString ("AFather", ""); - PrintCStructure (MyFather, 1); - PrintString ("ASon", ""); - PrintCStructure (MySon, 1); - } - call_togl_connect (&MyFather, &MySon); - +void OpenGl_GraphicDriver::Connect (const Graphic3d_CStructure& theFather, + const Graphic3d_CStructure& theSon) +{ + OpenGl_Structure* aFather = (OpenGl_Structure* )theFather.ptrStructure; + OpenGl_Structure* aSon = (OpenGl_Structure* )theSon.ptrStructure; + if (aFather && aSon) + aFather->Connect(aSon); } -void OpenGl_GraphicDriver::ContextStructure (const Graphic3d_CStructure& ACStructure) { - - Graphic3d_CStructure MyCStructure = ACStructure; - - if (MyTraceLevel) { - PrintFunction ("call_togl_contextstructure"); - PrintCStructure (MyCStructure, 1); - PrintCStructure (MyCStructure, 2); - } - call_togl_contextstructure (&MyCStructure); - +void OpenGl_GraphicDriver::Disconnect (const Graphic3d_CStructure& theFather, + const Graphic3d_CStructure& theSon) +{ + OpenGl_Structure* aFather = (OpenGl_Structure* )theFather.ptrStructure; + OpenGl_Structure* aSon = (OpenGl_Structure* )theSon.ptrStructure; + if (aFather && aSon) + aFather->Disconnect(aSon); } -void OpenGl_GraphicDriver::Disconnect (const Graphic3d_CStructure& AFather, const Graphic3d_CStructure& ASon) { - - Graphic3d_CStructure MyFather = AFather; - Graphic3d_CStructure MySon = ASon; - - if (MyTraceLevel) { - PrintFunction ("call_togl_disconnect"); - PrintString ("AFather", ""); - PrintCStructure (AFather, 1); - PrintString ("ASon", ""); - PrintCStructure (MySon, 1); - } - call_togl_disconnect (&MyFather, &MySon); - +void OpenGl_GraphicDriver::DisplayStructure (const Graphic3d_CView& theCView, + const Graphic3d_CStructure& theCStructure, + const Standard_Integer thePriority) +{ + const OpenGl_CView* aCView = (const OpenGl_CView* )theCView.ptrView; + OpenGl_Structure* aStructure = (OpenGl_Structure* )theCStructure.ptrStructure; + if (aCView == NULL || aStructure == NULL) + return; + + aCView->View->DisplayStructure (aStructure, thePriority); + aCView->WS->Invalidate(); } -void OpenGl_GraphicDriver::DisplayStructure (const Graphic3d_CView& ACView, const Graphic3d_CStructure& ACStructure, const Standard_Integer APriority) { - - Graphic3d_CView MyCView = ACView; - Graphic3d_CStructure MyCStructure = ACStructure; - - if (MyTraceLevel) { - PrintFunction ("call_togl_displaystructure"); - PrintCView (MyCView, 1); - PrintCStructure (MyCStructure, 1); - PrintInteger ("Priority", APriority); - } - call_togl_displaystructure (&MyCView, MyCStructure.Id, int (APriority)); +void OpenGl_GraphicDriver::EraseStructure (const Graphic3d_CView& theCView, + const Graphic3d_CStructure& theCStructure) +{ + const OpenGl_CView* aCView = (const OpenGl_CView* )theCView.ptrView; + OpenGl_Structure* aStructure = (OpenGl_Structure* )theCStructure.ptrStructure; + if (aCView == NULL || aStructure == NULL) + return; + aCView->View->EraseStructure (aStructure); + aCView->WS->Invalidate(); } -void OpenGl_GraphicDriver::EraseStructure (const Graphic3d_CView& ACView, const Graphic3d_CStructure& ACStructure) { - - Graphic3d_CView MyCView = ACView; - Graphic3d_CStructure MyCStructure = ACStructure; - - if (MyTraceLevel) { - PrintFunction ("call_togl_erasestructure"); - PrintCView (MyCView, 1); - PrintCStructure (MyCStructure, 1); - } - call_togl_erasestructure (MyCView.ViewId, MyCStructure.Id); +void OpenGl_GraphicDriver::RemoveStructure (const Graphic3d_CStructure& theCStructure) +{ + if (!GetMapOfStructures().IsBound (theCStructure.Id)) + return; + OpenGl_Structure* aStructure = OpenGl_GraphicDriver::GetMapOfStructures().Find (theCStructure.Id); + OpenGl_GraphicDriver::GetMapOfStructures().UnBind (theCStructure.Id); + delete aStructure; + InvalidateAllWorkspaces(); } -void OpenGl_GraphicDriver::RemoveStructure (const Graphic3d_CStructure& ACStructure) { +void OpenGl_GraphicDriver::Structure (Graphic3d_CStructure& theCStructure) +{ + RemoveStructure (theCStructure); - Graphic3d_CStructure MyCStructure = ACStructure; - - if (MyTraceLevel) { - PrintFunction ("call_togl_removestructure"); - PrintCStructure (MyCStructure, 1); - } - call_togl_removestructure (&MyCStructure); - -} + OpenGl_Structure* aStructure = new OpenGl_Structure(); -void OpenGl_GraphicDriver::Structure (Graphic3d_CStructure& ACStructure) { + aStructure->SetDegenerateModel (theCStructure.ContextFillArea.DegenerationMode, + theCStructure.ContextFillArea.SkipRatio); - Graphic3d_CStructure MyCStructure = ACStructure; - if (MyTraceLevel) { - PrintFunction ("call_togl_structure"); - PrintCStructure (MyCStructure, 1); - } - call_togl_structure (&MyCStructure); + Standard_Integer aStatus = 0; + if (theCStructure.highlight) aStatus |= OPENGL_NS_HIGHLIGHT; + if (!theCStructure.visible) aStatus |= OPENGL_NS_HIDE; + if (theCStructure.pick) aStatus |= OPENGL_NS_PICK; + aStructure->SetNamedStatus (aStatus); + theCStructure.ptrStructure = aStructure; + OpenGl_GraphicDriver::GetMapOfStructures().Bind (theCStructure.Id, aStructure); + InvalidateAllWorkspaces(); } diff --git a/src/OpenGl/OpenGl_GraphicDriver_5.cxx b/src/OpenGl/OpenGl_GraphicDriver_5.cxx index 2f62b4cf57..8838f729a0 100755 --- a/src/OpenGl/OpenGl_GraphicDriver_5.cxx +++ b/src/OpenGl/OpenGl_GraphicDriver_5.cxx @@ -1,147 +1,33 @@ +// File: OpenGl_GraphicDriver_5.cxx +// Created: 20 October 2011 +// Author: Sergey ZERCHANINOV +// Copyright: OPEN CASCADE 2011 +#include -// File OpenGl_GraphicDriver_5.cxx -// Created Mardi 28 janvier 1997 -// Author CAL - -//-Copyright MatraDatavision 1997 - -//-Version - -//-Design Declaration des variables specifiques aux Drivers - -//-Warning Un driver encapsule les Pex et OpenGl drivers - -//-References - -//-Language C++ 2.0 - -//-Declarations - -// for the class -#include - -#include - -#include - -//-Aliases - -//-Global data definitions - -//-Methods, in order - -void OpenGl_GraphicDriver::DumpGroup (const Graphic3d_CGroup& ACGroup) { - - Graphic3d_CGroup MyCGroup = ACGroup; - - if (MyTraceLevel) { - PrintFunction ("call_togl_structure_exploration"); - PrintCGroup (MyCGroup, 1); - } - call_togl_structure_exploration - (long (MyCGroup.Struct->Id), long (MyCGroup.LabelBegin), long (MyCGroup.LabelEnd)); - +void OpenGl_GraphicDriver::DumpGroup (const Graphic3d_CGroup& ACGroup) +{ + // Do nothing } -void OpenGl_GraphicDriver::DumpStructure (const Graphic3d_CStructure& ACStructure) { - - Graphic3d_CStructure MyCStructure = ACStructure; - - if (MyTraceLevel) { - PrintFunction ("call_togl_structure_exploration"); - PrintCStructure (MyCStructure, 1); - } - call_togl_structure_exploration (long (MyCStructure.Id), 0, 0); - +void OpenGl_GraphicDriver::DumpStructure (const Graphic3d_CStructure& ACStructure) +{ + // Do nothing } -void OpenGl_GraphicDriver::DumpView (const Graphic3d_CView& ACView) { - - Graphic3d_CView MyCView = ACView; - - if (MyTraceLevel) { - PrintFunction ("call_togl_view_exploration"); - PrintCView (MyCView, 1); - } - call_togl_view_exploration (long (MyCView.ViewId)); - +void OpenGl_GraphicDriver::DumpView (const Graphic3d_CView& ACView) +{ + // Do nothing } -Standard_Boolean OpenGl_GraphicDriver::ElementExploration (const Graphic3d_CStructure & ACStructure, const Standard_Integer ElementNumber, Graphic3d_VertexNC& AVertex, Graphic3d_Vector& AVector) { - - Graphic3d_CStructure MyCStructure = ACStructure; - - Quantity_Color AColor; - long AType; - - CALL_DEF_POINT Pt; - CALL_DEF_NORMAL Npt, Nfa; - CALL_DEF_COLOR Cpt; - - if (MyTraceLevel) { - PrintFunction ("call_togl_element_exploration"); - PrintCStructure (MyCStructure, 1); - } - call_togl_element_exploration (MyCStructure.Id, ElementNumber, &AType, &Pt, &Npt, &Cpt, &Nfa); - - if (! AType) return (Standard_False); - else { - AVertex.SetCoord - (double (Pt.x), double (Pt.y), double (Pt.z)); - AVertex.SetNormal - (double (Npt.dx), double (Npt.dy), double (Npt.dz)); - AColor.SetValues - (double (Cpt.r), double (Cpt.g), - double (Cpt.b), Quantity_TOC_RGB); - AVertex.SetColor (AColor); - AVector.SetCoord - (double (Nfa.dx), double (Nfa.dy), double (Nfa.dz)); - return (Standard_True); - } +Standard_Boolean OpenGl_GraphicDriver::ElementExploration (const Graphic3d_CStructure & ACStructure, const Standard_Integer ElementNumber, Graphic3d_VertexNC& AVertex, Graphic3d_Vector& AVector) +{ + // Do nothing + return (Standard_False); } -Graphic3d_TypeOfPrimitive OpenGl_GraphicDriver::ElementType (const Graphic3d_CStructure & ACStructure, const Standard_Integer ElementNumber) { - - Graphic3d_CStructure MyCStructure = ACStructure; - - long AType; - Graphic3d_TypeOfPrimitive top; - - if (MyTraceLevel) { - PrintFunction ("call_togl_element_type"); - PrintCStructure (MyCStructure, 1); - } - call_togl_element_type (MyCStructure.Id, ElementNumber, &AType); - - switch (AType) { - - case 0: - top = Graphic3d_TOP_UNDEFINED; - break; - case 1: - top = Graphic3d_TOP_POLYLINE; - break; - case 2: - top = Graphic3d_TOP_POLYGON; - break; - case 3: - top = Graphic3d_TOP_TRIANGLEMESH; - break; - case 4: - top = Graphic3d_TOP_QUADRANGLEMESH; - break; - case 5: - top = Graphic3d_TOP_TEXT; - break; - case 6: - top = Graphic3d_TOP_MARKER; - break; - default: - top = Graphic3d_TOP_UNDEFINED; - break; - - } - - return (top); +Graphic3d_TypeOfPrimitive OpenGl_GraphicDriver::ElementType (const Graphic3d_CStructure & ACStructure, const Standard_Integer ElementNumber) +{ + // Do nothing + return Graphic3d_TOP_UNDEFINED; } diff --git a/src/OpenGl/OpenGl_GraphicDriver_6.cxx b/src/OpenGl/OpenGl_GraphicDriver_6.cxx index 916538b16d..e1d44b3eea 100755 --- a/src/OpenGl/OpenGl_GraphicDriver_6.cxx +++ b/src/OpenGl/OpenGl_GraphicDriver_6.cxx @@ -1,65 +1,21 @@ -// File OpenGl_GraphicDriver_6.cxx -// Created Mardi 28 janvier 1997 -// Author CAL +// File: OpenGl_GraphicDriver_6.cxx +// Created: 20 October 2011 +// Author: Sergey ZERCHANINOV +// Copyright: OPEN CASCADE 2011 -//-Copyright MatraDatavision 1997 - -//-Version - -//-Design Declaration des variables specifiques aux Drivers - -//-Warning Un driver encapsule les Pex et OpenGl drivers - -//-References - -//-Language C++ 2.0 - -//-Declarations - -// for the class -#include - -#include - -#include - -//-Aliases - -//-Global data definitions - -//-Methods, in order - -void OpenGl_GraphicDriver::InitPick () { - - - if (MyTraceLevel) { - PrintFunction ("call_togl_init_pick"); - } - call_togl_init_pick (); +#include +void OpenGl_GraphicDriver::InitPick () +{ + // Do nothing } -void OpenGl_GraphicDriver::Pick (Graphic3d_CPick& ACPick) { - - Graphic3d_CPick MyCPick = ACPick; - - - if (MyTraceLevel) { - PrintFunction ("call_togl_pick"); - PrintCPick (MyCPick, 1); - } - call_togl_pick (&ACPick); - +void OpenGl_GraphicDriver::Pick (Graphic3d_CPick& ACPick) +{ + // Do nothing } -void OpenGl_GraphicDriver::PickId (const Graphic3d_CGroup& ACGroup) { - - Graphic3d_CGroup MyCGroup = ACGroup; - - if (MyTraceLevel) { - PrintFunction ("call_togl_pickid"); - PrintCGroup (MyCGroup, 1); - } - call_togl_pickid (&MyCGroup); - +void OpenGl_GraphicDriver::PickId (const Graphic3d_CGroup& ACGroup) +{ + // Do nothing } diff --git a/src/OpenGl/OpenGl_GraphicDriver_7.cxx b/src/OpenGl/OpenGl_GraphicDriver_7.cxx index 9bf0aa4479..ef278e8ca2 100755 --- a/src/OpenGl/OpenGl_GraphicDriver_7.cxx +++ b/src/OpenGl/OpenGl_GraphicDriver_7.cxx @@ -1,328 +1,224 @@ +// File: OpenGl_GraphicDriver_7.cxx +// Created: 20 October 2011 +// Author: Sergey ZERCHANINOV +// Copyright: OPEN CASCADE 2011 -// File OpenGl_GraphicDriver_7.cxx -// Created Mardi 28 janvier 1997 -// Author CAL -// Modified GG 10/11/99 PRO19603 Change the Redraw method (add redraw area capabillity) -// EUG 07/10/99 G003 Add DegenerateStructure() and -// SetBackFacingModel() methods. +#include -//-Copyright MatraDatavision 1997 - -//-Version - -//-Design Declaration des variables specifiques aux Drivers - -//-Warning Un driver encapsule les Pex et OpenGl drivers - -//-References - -//-Language C++ 2.0 - -//-Declarations - -// for the class -#include - -#include -#include - -#include -#include -#include -#include #include -//-Aliases - -//-Global data definitions - -//-Methods, in order - -void OpenGl_GraphicDriver::ActivateView (const Graphic3d_CView& ACView) { +#include +#include +#include - Graphic3d_CView MyCView = ACView; - - if (MyTraceLevel) { - PrintFunction ("call_togl_activateview"); - PrintCView (MyCView, 1); - } - call_togl_activateview (&MyCView); +/*----------------------------------------------------------------------*/ +void OpenGl_GraphicDriver::ActivateView (const Graphic3d_CView& ACView) +{ + const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView; + if (aCView) + aCView->WS->SetActiveView(aCView->View); } -void OpenGl_GraphicDriver::AntiAliasing (const Graphic3d_CView& ACView, const Standard_Boolean AFlag) { - - Graphic3d_CView MyCView = ACView; - - if (MyTraceLevel) { - PrintFunction ("call_togl_antialiasing"); - PrintCView (MyCView, 1); - PrintBoolean ("AFlag", AFlag); - } - call_togl_antialiasing (&MyCView, (AFlag ? 1 : 0)); - +void OpenGl_GraphicDriver::AntiAliasing (const Graphic3d_CView& ACView, const Standard_Boolean AFlag) +{ + const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView; + if (aCView) + aCView->View->SetAntiAliasing(AFlag); } -void OpenGl_GraphicDriver::Background (const Graphic3d_CView& ACView) { - - Graphic3d_CView MyCView = ACView; - - if (MyTraceLevel) { - PrintFunction ("call_togl_background"); - PrintCView (MyCView, 1); +void OpenGl_GraphicDriver::Background (const Graphic3d_CView& ACView) +{ + const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView; + if (aCView) + { + aCView->WS->SetBackgroundColor(ACView.DefWindow.Background.r,ACView.DefWindow.Background.g,ACView.DefWindow.Background.b); + aCView->WS->Invalidate(); } - call_togl_background (&MyCView); - } -void OpenGl_GraphicDriver::GradientBackground(const Graphic3d_CView& ACView, +void OpenGl_GraphicDriver::GradientBackground (const Graphic3d_CView& ACView, const Quantity_Color& AColor1, const Quantity_Color& AColor2, - const Aspect_GradientFillMethod AType){ - - Graphic3d_CView MyCView = ACView; - - if (MyTraceLevel) { - PrintFunction ("call_togl_gradient_background"); - PrintCView (MyCView, 1); + const Aspect_GradientFillMethod AType) +{ + const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView; + if (aCView) + { + aCView->View->SetBackgroundGradient(AColor1,AColor2,AType); + aCView->WS->Invalidate(); } - Standard_Real R1,G1,B1,R2,G2,B2; - AColor1.Values( R1, G1, B1, Quantity_TOC_RGB ); - AColor2.Values( R2, G2, B2, Quantity_TOC_RGB ); - TEL_COLOUR tcolor1, tcolor2; - tcolor1.rgb[0] = R1; - tcolor1.rgb[1] = G1; - tcolor1.rgb[2] = B1; - tcolor1.rgb[3] = 0; - tcolor2.rgb[0] = R2; - tcolor2.rgb[1] = G2; - tcolor2.rgb[2] = B2; - tcolor2.rgb[3] = 0; - - call_togl_gradient_background (MyCView.WsId, AType, &tcolor1, &tcolor2); - } - -void OpenGl_GraphicDriver::Blink (const Graphic3d_CStructure& ACStructure, const Standard_Boolean Create) { - - Graphic3d_CStructure MyCStructure = ACStructure; - - if (MyTraceLevel) { - PrintFunction ("call_togl_blink"); - PrintCStructure (MyCStructure, 1); - PrintBoolean ("Create", Create); - } - call_togl_blink (&MyCStructure, (Create ? 1 : 0)); - +void OpenGl_GraphicDriver::Blink (const Graphic3d_CStructure &, const Standard_Boolean) +{ + // Do nothing } -void OpenGl_GraphicDriver::BoundaryBox (const Graphic3d_CStructure& ACStructure, const Standard_Boolean Create) { - - Graphic3d_CStructure MyCStructure = ACStructure; - - if (MyTraceLevel) { - PrintFunction ("call_togl_boundarybox"); - PrintCStructure (MyCStructure, 1); - PrintBoolean ("Create", Create); - } - call_togl_boundarybox (&MyCStructure, (Create ? 1 : 0)); +void OpenGl_GraphicDriver::BoundaryBox (const Graphic3d_CStructure& ACStructure, const Standard_Boolean Create) +{ + OpenGl_Structure *astructure = (OpenGl_Structure *)ACStructure.ptrStructure; + if (!astructure) + return; + if ( Create ) + astructure->SetHighlightBox(ACStructure.BoundBox); + else + astructure->ClearHighlightBox(); } -void OpenGl_GraphicDriver::HighlightColor (const Graphic3d_CStructure& ACStructure, const Standard_ShortReal R, const Standard_ShortReal G, const Standard_ShortReal B, const Standard_Boolean Create) { - - Graphic3d_CStructure MyCStructure = ACStructure; - - if (MyTraceLevel) { - PrintFunction ("call_togl_highlightcolor"); - PrintCStructure (MyCStructure, 1); - PrintShortReal ("R", R); - PrintShortReal ("G", G); - PrintShortReal ("B", B); - } - CALL_DEF_COLOR acolor; - acolor.r = R; - acolor.g = G; - acolor.b = B; - call_togl_highlightcolor (&MyCStructure, &acolor, (Create ? 1 : 0)); +void OpenGl_GraphicDriver::HighlightColor (const Graphic3d_CStructure& ACStructure, const Standard_ShortReal R, const Standard_ShortReal G, const Standard_ShortReal B, const Standard_Boolean Create) +{ + OpenGl_Structure *astructure = (OpenGl_Structure *)ACStructure.ptrStructure; + if (!astructure) + return; + if ( Create ) + astructure->SetHighlightColor(R,G,B); + else + astructure->ClearHighlightColor(); } -void OpenGl_GraphicDriver::NameSetStructure (const Graphic3d_CStructure& ACStructure) { - - Graphic3d_CStructure MyCStructure = ACStructure; - - if (MyTraceLevel) { - PrintFunction ("call_togl_namesetstructure"); - PrintCStructure (MyCStructure, 1); +void OpenGl_GraphicDriver::NameSetStructure (const Graphic3d_CStructure& ACStructure) +{ + OpenGl_Structure *astructure = (OpenGl_Structure *)ACStructure.ptrStructure; + if (astructure) + { + Standard_Integer aStatus = 0; + if (ACStructure.highlight) aStatus |= OPENGL_NS_HIGHLIGHT; + if (!ACStructure.visible) aStatus |= OPENGL_NS_HIDE; + if (ACStructure.pick) aStatus |= OPENGL_NS_PICK; + astructure->SetNamedStatus( aStatus ); } - call_togl_namesetstructure (&MyCStructure); - } -void OpenGl_GraphicDriver::ClipLimit (const Graphic3d_CView& ACView, const Standard_Boolean AWait) { - - Graphic3d_CView MyCView = ACView; - - if (MyTraceLevel) { - PrintFunction ("call_togl_cliplimit"); - PrintCView (MyCView, 1); - PrintBoolean ("AWait", AWait); +void OpenGl_GraphicDriver::ClipLimit (const Graphic3d_CView& ACView, const Standard_Boolean AWait) +{ + const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView; + if (aCView) + { + aCView->View->SetClipLimit(ACView); + if (!AWait && !ACView.DefBitmap.bitmap) + { + aCView->WS->Resize(ACView.DefWindow); + aCView->WS->Invalidate(); + } } - call_togl_cliplimit (&MyCView, (AWait ? 1 : 0)); - } -void OpenGl_GraphicDriver::DeactivateView (const Graphic3d_CView& ACView) { - Graphic3d_CView MyCView = ACView; - - if (MyTraceLevel) { - PrintFunction ("call_togl_deactivateview"); - PrintCView (MyCView, 1); +void OpenGl_GraphicDriver::DeactivateView (const Graphic3d_CView& ACView) +{ + const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView; + if (aCView) + { + const Handle(OpenGl_View) aDummyView; + aCView->WS->SetActiveView(aDummyView); } - call_togl_deactivateview (&MyCView); - } -void OpenGl_GraphicDriver::DepthCueing (const Graphic3d_CView& ACView, const Standard_Boolean AFlag) { - - Graphic3d_CView MyCView = ACView; - - if (MyTraceLevel) { - PrintFunction ("call_togl_depthcueing"); - PrintCView (MyCView, 1); - PrintBoolean ("AFlag", AFlag); - } - call_togl_depthcueing (&MyCView, (AFlag ? 1 : 0)); - +void OpenGl_GraphicDriver::DepthCueing (const Graphic3d_CView& ACView, const Standard_Boolean AFlag) +{ + const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView; + if (aCView) + aCView->View->SetFog(ACView, AFlag); } -Standard_Boolean OpenGl_GraphicDriver::ProjectRaster (const Graphic3d_CView& ACView, const Standard_ShortReal AX, const Standard_ShortReal AY, const Standard_ShortReal AZ, Standard_Integer& AU, Standard_Integer& AV) { - - Graphic3d_CView MyCView = ACView; +Standard_Boolean OpenGl_GraphicDriver::ProjectRaster (const Graphic3d_CView& ACView, const Standard_ShortReal AX, const Standard_ShortReal AY, const Standard_ShortReal AZ, Standard_Integer& AU, Standard_Integer& AV) +{ + const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView; + if (!aCView) + return Standard_False; - Standard_Integer Result; + Standard_Integer aWidth = aCView->WS->Width(); + Standard_Integer aHeight = aCView->WS->Height(); - if (MyTraceLevel) { - PrintFunction ("call_togl_project_raster"); - PrintCView (MyCView, 1); - } //if we want project something before to dump it into pixmap - if ( ACView.DefBitmap.bitmap ) { - Result = call_togl_adopt_to_rect( ACView.ViewId, - ACView.DefBitmap.width, - ACView.DefBitmap.height ); - if (MyTraceLevel) { - PrintIResult ("call_togl_adopt_to_rect", Result); - } - if (Result) - return Standard_False; - } - - Result = call_togl_project_raster (ACView.ViewId, AX, AY, AZ, &AU, &AV); - if (MyTraceLevel) { - PrintIResult ("call_togl_project_raster", Result); + //For right copution of projection before dumping to pixmap + if ( ACView.DefBitmap.bitmap ) + { + aWidth = ACView.DefBitmap.width; + aHeight = ACView.DefBitmap.height; } - if ( ACView.DefBitmap.bitmap ) { - Result = call_togl_adopt_to_rect( ACView.ViewId, - ACView.DefWindow.dx, - ACView.DefWindow.dy ); - if (MyTraceLevel) { - PrintIResult ("call_togl_adopt_to_rect", Result); - } - if (Result) - return Standard_False; + Standard_ShortReal xr, yr; + if (aCView->View->ProjectObjectToRaster(aWidth, aHeight, AX, AY, AZ, xr, yr)) + { + AU = (Standard_Integer) xr; + AV = aHeight - (Standard_Integer) yr; + return Standard_True; } - return (Result == 0 ? Standard_True : Standard_False); - + return Standard_False; } -Standard_Boolean OpenGl_GraphicDriver::UnProjectRaster (const Graphic3d_CView& ACView, const Standard_Integer Axm, const Standard_Integer Aym, const Standard_Integer AXM, const Standard_Integer AYM, const Standard_Integer AU, const Standard_Integer AV, Standard_ShortReal& Ax, Standard_ShortReal& Ay, Standard_ShortReal& Az) { - - Graphic3d_CView MyCView = ACView; +Standard_Boolean OpenGl_GraphicDriver::UnProjectRaster (const Graphic3d_CView& ACView, const Standard_Integer Axm, const Standard_Integer Aym, const Standard_Integer AXM, const Standard_Integer AYM, const Standard_Integer AU, const Standard_Integer AV, Standard_ShortReal& Ax, Standard_ShortReal& Ay, Standard_ShortReal& Az) +{ + const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView; + if (!aCView) + return Standard_False; - Standard_Integer Result; - - if (MyTraceLevel) { - PrintFunction ("call_togl_unproject_raster"); - PrintCView (MyCView, 1); - } - Result = call_togl_unproject_raster - (ACView.ViewId, Axm, Aym, AXM, AYM, AU, AV, &Ax, &Ay, &Az); - if (MyTraceLevel) { - PrintIResult ("call_togl_unproject_raster", Result); - } - return (Result == 0 ? Standard_True : Standard_False); + const Standard_Integer aWidth = aCView->WS->Width(); + const Standard_Integer aHeight = aCView->WS->Height(); + /* + Patched by P.Dolbey: the window pixel height decreased by one + in order for yr to remain within valid coordinate range [0; Ym -1] + where Ym means window pixel height. + */ + return aCView->View->ProjectRasterToObject( aWidth, aHeight, AU, (AYM-1)-Aym-AV, Ax, Ay, Az ); } -Standard_Boolean OpenGl_GraphicDriver::UnProjectRasterWithRay (const Graphic3d_CView& ACView, const Standard_Integer Axm, const Standard_Integer Aym, const Standard_Integer AXM, const Standard_Integer AYM, const Standard_Integer AU, const Standard_Integer AV, Standard_ShortReal& Ax, Standard_ShortReal& Ay, Standard_ShortReal& Az, Standard_ShortReal& Dx, Standard_ShortReal& Dy, Standard_ShortReal& Dz) { - - Graphic3d_CView MyCView = ACView; +Standard_Boolean OpenGl_GraphicDriver::UnProjectRasterWithRay (const Graphic3d_CView& ACView, const Standard_Integer Axm, const Standard_Integer Aym, const Standard_Integer AXM, const Standard_Integer AYM, const Standard_Integer AU, const Standard_Integer AV, Standard_ShortReal& Ax, Standard_ShortReal& Ay, Standard_ShortReal& Az, Standard_ShortReal& Dx, Standard_ShortReal& Dy, Standard_ShortReal& Dz) +{ + const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView; + if (!aCView) + return Standard_False; - Standard_Integer Result; - - if (MyTraceLevel) { - PrintFunction ("call_togl_unproject_raster_with_ray"); - PrintCView (MyCView, 1); - } - Result = call_togl_unproject_raster_with_ray - (ACView.ViewId, Axm, Aym, AXM, AYM, AU, AV, &Ax, &Ay, &Az, &Dx, &Dy, &Dz); - if (MyTraceLevel) { - PrintIResult ("call_togl_unproject_raster_with_ray", Result); - } - return (Result == 0 ? Standard_True : Standard_False); + const Standard_Integer aWidth = aCView->WS->Width(); + const Standard_Integer aHeight = aCView->WS->Height(); + return aCView->View->ProjectRasterToObjectWithRay( aWidth, aHeight, AU, AYM-Aym-AV, Ax, Ay, Az, Dx, Dy, Dz ); } -void OpenGl_GraphicDriver::RatioWindow (const Graphic3d_CView& ACView) { - - Graphic3d_CView MyCView = ACView; +void OpenGl_GraphicDriver::RatioWindow (const Graphic3d_CView& ACView) +{ + const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView; + if (!aCView) + if( !ACView.DefBitmap.bitmap ) + aCView->WS->Resize(ACView.DefWindow); +} - if (MyTraceLevel) { - PrintFunction ("call_togl_ratio_window"); - PrintCView (MyCView, 1); +void OpenGl_GraphicDriver::Redraw (const Graphic3d_CView& ACView, const Aspect_CLayer2d& ACUnderLayer, const Aspect_CLayer2d& ACOverLayer, const Standard_Integer x, const Standard_Integer y, const Standard_Integer width, const Standard_Integer height) +{ + const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView; + if (aCView) + { + /*if( width <= 0 || height <= 0 ) + aCView->WS->Redraw(ACView, ACUnderLayer, ACOverLayer); + else + aCView->WS->RedrawArea(ACView, ACUnderLayer, ACOverLayer, x, y, width, height);*/ + // Always do full redraw + aCView->WS->Redraw(ACView, ACUnderLayer, ACOverLayer); } - call_togl_ratio_window (&MyCView); - } -void OpenGl_GraphicDriver::Redraw (const Graphic3d_CView& ACView, const Aspect_CLayer2d& ACUnderLayer, const Aspect_CLayer2d& ACOverLayer, const Standard_Integer x, const Standard_Integer y, const Standard_Integer width, const Standard_Integer height) { - - Graphic3d_CView MyCView = ACView; - Aspect_CLayer2d MyCUnderLayer = ACUnderLayer; - Aspect_CLayer2d MyCOverLayer = ACOverLayer; - - if (MyTraceLevel) { - PrintFunction ("call_togl_redraw"); - PrintCView (MyCView, 1); - } - //PRO19603 - if( width <= 0 || height <= 0 ) - call_togl_redraw (&MyCView, &MyCUnderLayer, &MyCOverLayer); - else { - call_togl_redraw_area (&MyCView, &MyCUnderLayer, &MyCOverLayer, - x, y, width, height); - } - //PRO19603 +Graphic3d_PtrFrameBuffer OpenGl_GraphicDriver::FBOCreate (const Graphic3d_CView& ACView, const Standard_Integer theWidth, const Standard_Integer theHeight) +{ + const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView; + if (aCView) + return aCView->WS->FBOCreate(theWidth, theHeight); + return (Graphic3d_PtrFrameBuffer)NULL; } -Graphic3d_PtrFrameBuffer OpenGl_GraphicDriver::FBOCreate (const Graphic3d_CView& theCView, - const Standard_Integer theWidth, - const Standard_Integer theHeight) { +Graphic3d_PtrFrameBuffer OpenGl_Workspace::FBOCreate (const Standard_Integer theWidth, const Standard_Integer theHeight) +{ // activate OpenGL context - CMN_KEY_DATA aData; - if ((TsmGetWSAttri (theCView.WsId, WSWindow, &aData) != TSuccess) || - (TxglWinset (call_thedisplay, (WINDOW) aData.ldata) != TSuccess)) - { + if (!Activate()) return NULL; - } + // create the FBO OpenGl_FrameBuffer* aFrameBuffer = new OpenGl_FrameBuffer(); - if (!aFrameBuffer->Init (theWidth, theHeight)) + if (!aFrameBuffer->Init (GetGlContext(), theWidth, theHeight)) { delete aFrameBuffer; return NULL; @@ -330,24 +226,28 @@ Graphic3d_PtrFrameBuffer OpenGl_GraphicDriver::FBOCreate (const Graphic3d_CView& return (Graphic3d_PtrFrameBuffer )aFrameBuffer; } -void OpenGl_GraphicDriver::FBORelease (const Graphic3d_CView& theCView, - Graphic3d_PtrFrameBuffer& theFBOPtr) +void OpenGl_GraphicDriver::FBORelease (const Graphic3d_CView& ACView, Graphic3d_PtrFrameBuffer& theFBOPtr) { if (theFBOPtr == NULL) - { return; + const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView; + if (aCView) + { + aCView->WS->FBORelease(theFBOPtr); + theFBOPtr = NULL; } +} + +void OpenGl_Workspace::FBORelease (Graphic3d_PtrFrameBuffer theFBOPtr) +{ // activate OpenGL context - CMN_KEY_DATA aData; - if ((TsmGetWSAttri (theCView.WsId, WSWindow, &aData) != TSuccess) || - (TxglWinset (call_thedisplay, (WINDOW) aData.ldata) != TSuccess)) - { + if (!Activate()) return; - } + // release the object - OpenGl_FrameBuffer* aFrameBuffer = (OpenGl_FrameBuffer* )theFBOPtr; + OpenGl_FrameBuffer* aFrameBuffer = (OpenGl_FrameBuffer*)theFBOPtr; + aFrameBuffer->Release (GetGlContext()); delete aFrameBuffer; - theFBOPtr = NULL; } void OpenGl_GraphicDriver::FBOGetDimensions (const Graphic3d_CView& , @@ -386,7 +286,6 @@ void OpenGl_GraphicDriver::FBOChangeViewport (const Graphic3d_CView& , #define GL_BGRA 0x80E1 #endif - static inline GLenum TFormatToGLEnum (const TRawBufferDataFormat theTFormat) { switch (theTFormat) @@ -414,8 +313,15 @@ static inline GLenum TTypeToGLEnum (const TRawBufferDataType theTType) } } -Standard_Boolean OpenGl_GraphicDriver::BufferDump (const Graphic3d_CView& theCView, - Image_CRawBufferData& theBuffer) +Standard_Boolean OpenGl_GraphicDriver::BufferDump (const Graphic3d_CView& ACView, Image_CRawBufferData& theBuffer) +{ + const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView; + if (aCView) + return aCView->WS->BufferDump((OpenGl_FrameBuffer *)ACView.ptrFBO,theBuffer); + return Standard_False; +} + +Standard_Boolean OpenGl_Workspace::BufferDump (OpenGl_FrameBuffer *theFBOPtr, Image_CRawBufferData& theBuffer) { GLenum aFormat = TFormatToGLEnum (theBuffer.format); GLenum aType = TTypeToGLEnum (theBuffer.type); @@ -429,19 +335,15 @@ Standard_Boolean OpenGl_GraphicDriver::BufferDump (const Graphic3d_CView& theCVi } // activate OpenGL context - CMN_KEY_DATA aData; - if ((TsmGetWSAttri (theCView.WsId, WSWindow, &aData) != TSuccess) || - (TxglWinset (call_thedisplay, (WINDOW) aData.ldata) != TSuccess)) - { + if (!Activate()) return Standard_False; - } // bind FBO if used - OpenGl_FrameBuffer* aFrameBuffer = (OpenGl_FrameBuffer* )theCView.ptrFBO; + OpenGl_FrameBuffer* aFrameBuffer = theFBOPtr; GLint aReadBufferPrev = GL_BACK; if (aFrameBuffer != NULL && aFrameBuffer->IsValid()) { - aFrameBuffer->BindBuffer(); + aFrameBuffer->BindBuffer (GetGlContext()); } else { @@ -465,7 +367,7 @@ Standard_Boolean OpenGl_GraphicDriver::BufferDump (const Graphic3d_CView& theCVi if (aFrameBuffer != NULL && aFrameBuffer->IsValid()) { - aFrameBuffer->UnbindBuffer(); + aFrameBuffer->UnbindBuffer (GetGlContext()); } else { @@ -474,169 +376,133 @@ Standard_Boolean OpenGl_GraphicDriver::BufferDump (const Graphic3d_CView& theCVi return Standard_True; } -void OpenGl_GraphicDriver::RemoveView (const Graphic3d_CView& ACView) { - - Graphic3d_CView MyCView = ACView; +void OpenGl_GraphicDriver::RemoveView (const Graphic3d_CView& ACView) +{ + if (GetMapOfViews().IsBound (ACView.ViewId)) + GetMapOfViews().UnBind (ACView.ViewId); - if (MyTraceLevel) { - PrintFunction ("call_togl_removeview"); - PrintCView (MyCView, 1); - } - call_togl_removeview (&MyCView); + if (GetMapOfWorkspaces().IsBound (ACView.WsId)) + GetMapOfWorkspaces().UnBind (ACView.WsId); + OpenGl_CView *aCView = (OpenGl_CView *)ACView.ptrView; + delete aCView; + ((Graphic3d_CView *)&ACView)->ptrView = NULL; } -void OpenGl_GraphicDriver::SetLight (const Graphic3d_CView& ACView) { - - Graphic3d_CView MyCView = ACView; - - if (MyTraceLevel) { - PrintFunction ("call_togl_setlight"); - PrintCView (MyCView, 1); - } - call_togl_setlight (&MyCView); - +void OpenGl_GraphicDriver::SetLight (const Graphic3d_CView& ACView) +{ + const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView; + if (aCView) + aCView->View->SetLights(ACView.Context); } -void OpenGl_GraphicDriver::SetPlane (const Graphic3d_CView& ACView) { - - Graphic3d_CView MyCView = ACView; - - if (MyTraceLevel) { - PrintFunction ("call_togl_setplane"); - PrintCView (MyCView, 1); - } - call_togl_setplane (&MyCView); - +void OpenGl_GraphicDriver::SetPlane (const Graphic3d_CView& ACView) +{ + const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView; + if (aCView) + aCView->View->SetClippingPlanes(ACView.Context); } -void OpenGl_GraphicDriver::SetVisualisation (const Graphic3d_CView& ACView) { - - Graphic3d_CView MyCView = ACView; - - if (MyTraceLevel) { - PrintFunction ("call_togl_setvisualisation"); - PrintCView (MyCView, 1); +void OpenGl_GraphicDriver::SetVisualisation (const Graphic3d_CView& ACView) +{ + const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView; + if (aCView) + { + aCView->View->SetVisualisation(ACView.Context); + aCView->WS->UseZBuffer() = ( ACView.Context.Visualization == 0? (ACView.Context.ZBufferActivity == 1) : (ACView.Context.ZBufferActivity != 0) ); } - call_togl_setvisualisation (&MyCView); - } -void OpenGl_GraphicDriver::TransformStructure (const Graphic3d_CStructure& ACStructure) { - - Graphic3d_CStructure MyCStructure = ACStructure; - - if (MyTraceLevel) { - PrintFunction ("call_togl_transformstructure"); - PrintCStructure (MyCStructure, 1); - } - call_togl_transformstructure (&MyCStructure); - +void OpenGl_GraphicDriver::TransformStructure (const Graphic3d_CStructure& ACStructure) +{ + OpenGl_Structure *astructure = (OpenGl_Structure *)ACStructure.ptrStructure; + if (astructure) + astructure->SetTransformation(&(ACStructure.Transformation[0][0])); } -void OpenGl_GraphicDriver :: DegenerateStructure ( - const Graphic3d_CStructure& ACStructure - ) { - Graphic3d_CStructure MyCStructure = ACStructure; - - if ( MyTraceLevel ) { - - PrintFunction ( "call_togl_degeneratestructure" ); - PrintCStructure ( MyCStructure, 1 ); - - } // end if - - call_togl_degeneratestructure ( &MyCStructure ); - } // end OpenGl_GraphicDriver :: DegenerateStructure - - void OpenGl_GraphicDriver::Transparency (const Graphic3d_CView& ACView, const Standard_Boolean AFlag) { - - Graphic3d_CView MyCView = ACView; +void OpenGl_GraphicDriver::DegenerateStructure (const Graphic3d_CStructure& ACStructure) +{ + OpenGl_Structure *astructure = (OpenGl_Structure *)ACStructure.ptrStructure; + if (astructure) + astructure->SetDegenerateModel( ACStructure.ContextFillArea.DegenerationMode, ACStructure.ContextFillArea.SkipRatio ); +} - if (MyTraceLevel) { - PrintFunction ("call_togl_transparency"); - PrintCView (MyCView, 1); - PrintBoolean ("AFlag", AFlag); - } - call_togl_transparency (MyCView.WsId, MyCView.ViewId, (AFlag ? 1 : 0)); +void OpenGl_GraphicDriver::Transparency (const Graphic3d_CView& ACView, const Standard_Boolean AFlag) +{ + const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView; + if (aCView) + aCView->WS->UseTransparency(AFlag); +} - } +void OpenGl_GraphicDriver::Update (const Graphic3d_CView& ACView, const Aspect_CLayer2d& ACUnderLayer, const Aspect_CLayer2d& ACOverLayer) +{ + const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView; + if (aCView) + aCView->WS->Update(ACView,ACUnderLayer,ACOverLayer); +} - void OpenGl_GraphicDriver::Update (const Graphic3d_CView& ACView, const Aspect_CLayer2d& ACUnderLayer, const Aspect_CLayer2d& ACOverLayer) { +Standard_Boolean OpenGl_GraphicDriver::View (Graphic3d_CView& ACView) +{ + if (openglDisplay.IsNull()) + return Standard_False; - Graphic3d_CView MyCView = ACView; - Aspect_CLayer2d MyCUnderLayer = ACUnderLayer; - Aspect_CLayer2d MyCOverLayer = ACOverLayer; + if (GetMapOfViews().IsBound (ACView.ViewId)) + GetMapOfViews().UnBind (ACView.ViewId); - if (MyTraceLevel) { - PrintFunction ("call_togl_update"); - PrintCView (MyCView, 1); - } - call_togl_update (&MyCView, &MyCUnderLayer, &MyCOverLayer); + if (GetMapOfWorkspaces().IsBound (ACView.WsId)) + GetMapOfWorkspaces().UnBind (ACView.WsId); + Handle(OpenGl_Workspace) aWS = Handle(OpenGl_Workspace)::DownCast(openglDisplay->GetWindow( ACView.DefWindow.XWindow )); + if ( aWS.IsNull() ) + { + aWS = new OpenGl_Workspace( openglDisplay, ACView.DefWindow, ACView.GContext ); + openglDisplay->SetWindow( ACView.DefWindow.XWindow, aWS ); } - Standard_Boolean OpenGl_GraphicDriver::View (Graphic3d_CView& ACView) { + GetMapOfWorkspaces().Bind (ACView.WsId, aWS); - Graphic3d_CView MyCView = ACView; - Standard_Integer Result; + Handle(OpenGl_View) aView = new OpenGl_View( ACView.Context ); + GetMapOfViews().Bind (ACView.ViewId, aView); - if (MyTraceLevel) { - PrintFunction ("call_togl_view"); - PrintCView (MyCView, 1); - } - Result = call_togl_view (&MyCView); - if (MyTraceLevel) { - PrintIResult ("call_togl_view", Result); - } - return (Result == 1 ? Standard_True : Standard_False); + OpenGl_CView *aCView = new OpenGl_CView; + aCView->View = aView; + aCView->WS = aWS; + ACView.ptrView = aCView; - } - - void OpenGl_GraphicDriver::ViewMapping (const Graphic3d_CView& ACView, const Standard_Boolean AWait) { - - Graphic3d_CView MyCView = ACView; - Standard_Integer Result; + return Standard_True; +} - if (MyTraceLevel) { - PrintFunction ("call_togl_viewmapping"); - PrintCView (MyCView, 1); - PrintBoolean ("AWait", AWait); - } - Result = call_togl_viewmapping (&MyCView, (AWait ? 1 : 0)); - if (MyTraceLevel) { - PrintIResult ("call_togl_viewmapping", Result); +void OpenGl_GraphicDriver::ViewMapping (const Graphic3d_CView& ACView, const Standard_Boolean AWait) +{ + const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView; + if (aCView) + { + aCView->View->SetMapping(ACView); + if (!AWait && !ACView.DefBitmap.bitmap) + { + aCView->WS->Resize(ACView.DefWindow); + aCView->WS->Invalidate(); } - } +} - void OpenGl_GraphicDriver::ViewOrientation (const Graphic3d_CView& ACView, const Standard_Boolean AWait) { - - Graphic3d_CView MyCView = ACView; - Standard_Integer Result; - - if (MyTraceLevel) { - PrintFunction ("call_togl_vieworientation"); - PrintCView (MyCView, 1); - PrintBoolean ("AWait", AWait); - } - Result = call_togl_vieworientation (&MyCView, (AWait ? 1 : 0)); - if (MyTraceLevel) { - PrintIResult ("call_togl_viewmapping", Result); +void OpenGl_GraphicDriver::ViewOrientation (const Graphic3d_CView& ACView, const Standard_Boolean AWait) +{ + const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView; + if (aCView) + { + aCView->View->SetOrientation(ACView); + if (!AWait && !ACView.DefBitmap.bitmap) + { + aCView->WS->Resize(ACView.DefWindow); + aCView->WS->Invalidate(); } - } +} - void OpenGl_GraphicDriver :: SetBackFacingModel ( const Graphic3d_CView& aView ) - { - Graphic3d_CView myView = aView; - - if ( MyTraceLevel ) { - - PrintFunction ( "call_togl_backfacing" ); - PrintCView ( myView, 1 ); - - } // end if - - call_togl_backfacing ( &myView ); - } // end Graphic3d_GraphicDriver :: SetBackFacingModel +void OpenGl_GraphicDriver::SetBackFacingModel (const Graphic3d_CView& ACView) +{ + const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView; + if (aCView) + aCView->View->SetBackfacing(ACView.Backfacing); +} diff --git a/src/OpenGl/OpenGl_GraphicDriver_703.cxx b/src/OpenGl/OpenGl_GraphicDriver_703.cxx index f6d2412390..39088b9e8f 100755 --- a/src/OpenGl/OpenGl_GraphicDriver_703.cxx +++ b/src/OpenGl/OpenGl_GraphicDriver_703.cxx @@ -1,508 +1,140 @@ +// File: OpenGl_GraphicDriver_703.cxx +// Created: 20 October 2011 +// Author: Sergey ZERCHANINOV +// Copyright: OPEN CASCADE 2011 -// File OpenGl_GraphicDriver_703.cxx -// Created Mardi 28 janvier 1997 -// Author CAL +#include -//-Copyright MatraDatavision 1997 - -//-Version - -//-Design Declaration des variables specifiques aux Drivers - -//-Warning Un driver encapsule les Pex et OpenGl drivers - -//-References - -//-Language C++ 2.0 - -//-Declarations - -// for the class -#include #include +#include +#include +#include -#include - -#include - -int GenerateMarkerBitmap( unsigned int theWidth, unsigned int theHeight, unsigned char* theArray); - -//-Aliases - -//-Global data definitions - -//-Methods, in order - -void OpenGl_GraphicDriver::Marker (const Graphic3d_CGroup& ACGroup, const Graphic3d_Vertex& APoint, const Standard_Boolean ) +static void OpenGl_CreateMarkers(const Graphic3d_CGroup& ACGroup, const Standard_Integer NbPoints, const Graphic3d_Vertex *Points) { + OpenGl_MarkerSet *amarkerset = new OpenGl_MarkerSet( NbPoints, Points ); + ((OpenGl_Group *)ACGroup.ptrGroup)->AddElement( TelMarkerSet, amarkerset ); +} - Graphic3d_CGroup MyCGroup = ACGroup; - - CALL_DEF_MARKER amarker; - - amarker.x = float (APoint.X ()); - amarker.y = float (APoint.Y ()); - amarker.z = float (APoint.Z ()); - - Standard_Real AMR, AMG, AMB, R, G, B; - Aspect_TypeOfMarker AMType; - Standard_Real AMScale, AScale; - - // Sauvegarde des valeurs initiales - AMR = R = Standard_Real (MyCGroup.ContextMarker.Color.r); - AMG = G = Standard_Real (MyCGroup.ContextMarker.Color.g); - AMB = B = Standard_Real (MyCGroup.ContextMarker.Color.b); - AMType = Aspect_TypeOfMarker (MyCGroup.ContextMarker.MarkerType); - AMScale = AScale = Standard_Real (MyCGroup.ContextMarker.Scale); +void OpenGl_GraphicDriver::Marker (const Graphic3d_CGroup& ACGroup, const Graphic3d_Vertex& APoint, const Standard_Boolean ) +{ + if (!ACGroup.ptrGroup) + return; - int noinsert = 0; - Standard_Real H, L, S; - Standard_Real LastS; - Standard_Real Limit=0, Delta; + const Aspect_TypeOfMarker AType = Aspect_TypeOfMarker (ACGroup.ContextMarker.MarkerType); - switch (AMType) + switch (AType) { + case Aspect_TOM_POINT : + case Aspect_TOM_PLUS : + case Aspect_TOM_STAR : + case Aspect_TOM_O : + case Aspect_TOM_X : + case Aspect_TOM_O_POINT : + case Aspect_TOM_O_PLUS : + case Aspect_TOM_O_STAR : + case Aspect_TOM_O_X : + case Aspect_TOM_RING1 : + case Aspect_TOM_RING2 : + case Aspect_TOM_RING3 : + case Aspect_TOM_USERDEFINED: + OpenGl_CreateMarkers(ACGroup, 1, &APoint); + break; - case Aspect_TOM_POINT : - case Aspect_TOM_PLUS : - case Aspect_TOM_STAR : - case Aspect_TOM_O : - case Aspect_TOM_X : - case Aspect_TOM_USERDEFINED: - if (MyTraceLevel) + case Aspect_TOM_BALL : { - PrintFunction ("call_togl_marker"); - PrintCGroup (MyCGroup, 1); - } - call_togl_marker (&MyCGroup, &amarker); - break; - - case Aspect_TOM_O_POINT : - MyCGroup.ContextMarker.IsDef = 1; - - // we draw the circle - MyCGroup.ContextMarker.MarkerType = - int (Aspect_TOM_O); - call_togl_markercontextgroup (&MyCGroup, noinsert); + const Standard_Real Delta = 0.1; - MyCGroup.ContextMarker.IsSet = 1; + Standard_Real R, G, B, H, L, S, AScale; + R = Standard_Real (ACGroup.ContextMarker.Color.r); + G = Standard_Real (ACGroup.ContextMarker.Color.g); + B = Standard_Real (ACGroup.ContextMarker.Color.b); + AScale = Standard_Real (ACGroup.ContextMarker.Scale); - if (MyTraceLevel) { - PrintFunction ("call_togl_marker"); - PrintCGroup (MyCGroup, 1); - } - call_togl_marker (&MyCGroup, &amarker); - - // we draw the point - MyCGroup.ContextMarker.MarkerType = - int (Aspect_TOM_POINT); - call_togl_markercontextgroup (&MyCGroup, noinsert); - if (MyTraceLevel) { - PrintFunction ("call_togl_marker"); - PrintCGroup (MyCGroup, 1); - } - call_togl_marker (&MyCGroup, &amarker); - break; - - case Aspect_TOM_O_PLUS : - MyCGroup.ContextMarker.IsDef = 1; - - // we draw the circle - MyCGroup.ContextMarker.MarkerType = - int (Aspect_TOM_O); - call_togl_markercontextgroup (&MyCGroup, noinsert); - - MyCGroup.ContextMarker.IsSet = 1; - - if (MyTraceLevel) { - PrintFunction ("call_togl_marker"); - PrintCGroup (MyCGroup, 1); - } - call_togl_marker (&MyCGroup, &amarker); - - // we draw the plus - MyCGroup.ContextMarker.MarkerType = - int (Aspect_TOM_PLUS); - call_togl_markercontextgroup (&MyCGroup, noinsert); - if (MyTraceLevel) { - PrintFunction ("call_togl_marker"); - PrintCGroup (MyCGroup, 1); - } - call_togl_marker (&MyCGroup, &amarker); - break; - - case Aspect_TOM_O_STAR : - MyCGroup.ContextMarker.IsDef = 1; - - // we draw the circle - MyCGroup.ContextMarker.MarkerType = - int (Aspect_TOM_O); - call_togl_markercontextgroup (&MyCGroup, noinsert); - - MyCGroup.ContextMarker.IsSet = 1; - - if (MyTraceLevel) { - PrintFunction ("call_togl_marker"); - PrintCGroup (MyCGroup, 1); - } - call_togl_marker (&MyCGroup, &amarker); - - // we draw the star - MyCGroup.ContextMarker.MarkerType = - int (Aspect_TOM_STAR); - call_togl_markercontextgroup (&MyCGroup, noinsert); - if (MyTraceLevel) { - PrintFunction ("call_togl_marker"); - PrintCGroup (MyCGroup, 1); - } - call_togl_marker (&MyCGroup, &amarker); - break; - - case Aspect_TOM_O_X : - MyCGroup.ContextMarker.IsDef = 1; - - // we draw the circle - MyCGroup.ContextMarker.MarkerType = - int (Aspect_TOM_O); - call_togl_markercontextgroup (&MyCGroup, noinsert); - - MyCGroup.ContextMarker.IsSet = 1; - - if (MyTraceLevel) { - PrintFunction ("call_togl_marker"); - PrintCGroup (MyCGroup, 1); - } - call_togl_marker (&MyCGroup, &amarker); - - // we draw the cross - MyCGroup.ContextMarker.MarkerType = - int (Aspect_TOM_X); - call_togl_markercontextgroup (&MyCGroup, noinsert); - if (MyTraceLevel) { - PrintFunction ("call_togl_marker"); - PrintCGroup (MyCGroup, 1); - } - call_togl_marker (&MyCGroup, &amarker); - break; - - case Aspect_TOM_BALL : - MyCGroup.ContextMarker.IsDef = 1; - - // we draw a set of circles - MyCGroup.ContextMarker.MarkerType = - int (Aspect_TOM_O); - Delta = 0.1; - while (AScale >= 1.0) { - Quantity_Color::RgbHls (R, G, B, H, L, S); - // Modification de la saturation de 5 % - LastS = S; - S = S - S * 0.05; - if (S < 0.0) S = LastS; - Quantity_Color::HlsRgb (H, L, S, R, G, B); - MyCGroup.ContextMarker.Color.r = float (R); - MyCGroup.ContextMarker.Color.g = float (G); - MyCGroup.ContextMarker.Color.b = float (B); - MyCGroup.ContextMarker.Scale = float (AScale); - call_togl_markercontextgroup (&MyCGroup, noinsert); - - MyCGroup.ContextMarker.IsSet = 1; - - if (MyTraceLevel) { - PrintFunction ("call_togl_marker"); - PrintCGroup (MyCGroup, 1); - } - call_togl_marker (&MyCGroup, &amarker); - AScale -= Delta; - } - break; - - case Aspect_TOM_RING1 : - case Aspect_TOM_RING2 : - case Aspect_TOM_RING3 : - MyCGroup.ContextMarker.IsDef = 1; - - // we draw a set of circles - MyCGroup.ContextMarker.MarkerType = - int (Aspect_TOM_O); - if (AMType == Aspect_TOM_RING1) - Limit = AScale - AScale * 0.8; - if (AMType == Aspect_TOM_RING2) - Limit = AScale - AScale * 0.5; - if (AMType == Aspect_TOM_RING3) - Limit = AScale - AScale * 0.2; - Delta = 0.1; - while (AScale > Limit && AScale >= 1.0) { - MyCGroup.ContextMarker.Scale = float (AScale); - call_togl_markercontextgroup (&MyCGroup, noinsert); - - MyCGroup.ContextMarker.IsSet = 1; - - if (MyTraceLevel) { - PrintFunction ("call_togl_marker"); - PrintCGroup (MyCGroup, 1); + // we draw a set of circles + CALL_DEF_CONTEXTMARKER AContext; + AContext.MarkerType = int (Aspect_TOM_O); + while (AScale >= 1.0) + { + Quantity_Color::RgbHls (R, G, B, H, L, S); + // Modification de la saturation de 5 % + S *= 0.95; + Quantity_Color::HlsRgb (H, L, S, R, G, B); + AContext.Color.r = float (R); + AContext.Color.g = float (G); + AContext.Color.b = float (B); + AContext.Scale = float (AScale); + ((OpenGl_Group *)ACGroup.ptrGroup)->SetAspectMarker(AContext, Standard_False); + OpenGl_CreateMarkers(ACGroup, 1, &APoint); + AScale -= Delta; } - call_togl_marker (&MyCGroup, &amarker); - AScale -= Delta; + break; } - break ; - default: - break ; + default: + break; } - - // Restauration des valeurs initiales - MyCGroup.ContextMarker.Color.r = float (AMR); - MyCGroup.ContextMarker.Color.g = float (AMR); - MyCGroup.ContextMarker.Color.b = float (AMR); - MyCGroup.ContextMarker.MarkerType = int (AMType); - MyCGroup.ContextMarker.Scale = float (AMScale); - } void OpenGl_GraphicDriver::MarkerSet (const Graphic3d_CGroup& ACGroup, - const Graphic3d_Array1OfVertex& ListVertex, - const Standard_Boolean ) + const Graphic3d_Array1OfVertex& ListVertex, + const Standard_Boolean ) { - // const Standard_Boolean EvalMinMax) { - - Graphic3d_CGroup MyCGroup = ACGroup; - - //static void (*fp2) (Graphic3d_CGroup *, CALL_DEF_LISTMARKERS *) = NULL; - - //if (! fp2) { - //OSD_Function osdfp = NULL; - //osdfp = MySharedLibrary.DlSymb ("call_togl_marker_set"); - //fp2 = (void (*)(Graphic3d_CGroup *, CALL_DEF_LISTMARKERS *)) osdfp; - //if (! osdfp) - //Aspect_DriverDefinitionError::Raise - //(MySharedLibrary.DlError ()); - //} + if (!ACGroup.ptrGroup) + return; - //static void (*fp3) (Graphic3d_CGroup *, int) = NULL; + const Standard_Integer nb = ListVertex.Length(); + const Graphic3d_Vertex *arr = &ListVertex( ListVertex.Lower() ); - //if (! fp3) { - //OSD_Function osdfp = NULL; - //osdfp = MySharedLibrary.DlSymb ("call_togl_markercontextgroup"); - //fp3 = (void (*)(Graphic3d_CGroup *, int)) osdfp; - //if (! osdfp) - //Aspect_DriverDefinitionError::Raise - //(MySharedLibrary.DlError ()); - //} - - Standard_Integer Lower = ListVertex.Lower (); - - CALL_DEF_LISTMARKERS almarkers; - - almarkers.NbMarkers = int (ListVertex.Length ()); - almarkers.Markers = (CALL_DEF_MARKER *) &ListVertex (Lower); - - Standard_Real AMR, AMG, AMB, R, G, B; - Aspect_TypeOfMarker AMType; - Standard_Real AMScale, AScale; - - // Sauvegarde des valeurs initiales - AMR = R = Standard_Real (MyCGroup.ContextMarker.Color.r); - AMG = G = Standard_Real (MyCGroup.ContextMarker.Color.g); - AMB = B = Standard_Real (MyCGroup.ContextMarker.Color.b); - AMType = Aspect_TypeOfMarker (MyCGroup.ContextMarker.MarkerType); - AMScale = AScale = Standard_Real (MyCGroup.ContextMarker.Scale); - - int noinsert = 0; - Standard_Real H, L, S; - Standard_Real LastS; - Standard_Real Limit=0, Delta; - - switch (AMType) { + const Aspect_TypeOfMarker AType = Aspect_TypeOfMarker (ACGroup.ContextMarker.MarkerType); + switch (AType) + { case Aspect_TOM_POINT : case Aspect_TOM_PLUS : case Aspect_TOM_STAR : case Aspect_TOM_O : case Aspect_TOM_X : - case Aspect_TOM_USERDEFINED: - if (MyTraceLevel) { - PrintFunction ("call_togl_marker_set"); - PrintCGroup (MyCGroup, 1); - } - call_togl_marker_set (&MyCGroup, &almarkers); - break; - case Aspect_TOM_O_POINT : - MyCGroup.ContextMarker.IsDef = 1; - - // we draw the circle - MyCGroup.ContextMarker.MarkerType = - int (Aspect_TOM_O); - call_togl_markercontextgroup (&MyCGroup, noinsert); - - MyCGroup.ContextMarker.IsSet = 1; - - if (MyTraceLevel) { - PrintFunction ("call_togl_marker_set"); - PrintCGroup (MyCGroup, 1); - } - call_togl_marker_set (&MyCGroup, &almarkers); - - // we draw the point - MyCGroup.ContextMarker.MarkerType = - int (Aspect_TOM_POINT); - call_togl_markercontextgroup (&MyCGroup, noinsert); - if (MyTraceLevel) { - PrintFunction ("call_togl_marker_set"); - PrintCGroup (MyCGroup, 1); - } - call_togl_marker_set (&MyCGroup, &almarkers); - break; - case Aspect_TOM_O_PLUS : - MyCGroup.ContextMarker.IsDef = 1; - - // we draw the circle - MyCGroup.ContextMarker.MarkerType = - int (Aspect_TOM_O); - call_togl_markercontextgroup (&MyCGroup, noinsert); - - MyCGroup.ContextMarker.IsSet = 1; - - if (MyTraceLevel) { - PrintFunction ("call_togl_marker_set"); - PrintCGroup (MyCGroup, 1); - } - call_togl_marker_set (&MyCGroup, &almarkers); - - // we draw the plus - MyCGroup.ContextMarker.MarkerType = - int (Aspect_TOM_PLUS); - call_togl_markercontextgroup (&MyCGroup, noinsert); - if (MyTraceLevel) { - PrintFunction ("call_togl_marker_set"); - PrintCGroup (MyCGroup, 1); - } - call_togl_marker_set (&MyCGroup, &almarkers); - break; - case Aspect_TOM_O_STAR : - MyCGroup.ContextMarker.IsDef = 1; - - // we draw the circle - MyCGroup.ContextMarker.MarkerType = - int (Aspect_TOM_O); - call_togl_markercontextgroup (&MyCGroup, noinsert); - - MyCGroup.ContextMarker.IsSet = 1; - - if (MyTraceLevel) { - PrintFunction ("call_togl_marker_set"); - PrintCGroup (MyCGroup, 1); - } - call_togl_marker_set (&MyCGroup, &almarkers); - - // we draw the star - MyCGroup.ContextMarker.MarkerType = - int (Aspect_TOM_STAR); - call_togl_markercontextgroup (&MyCGroup, noinsert); - if (MyTraceLevel) { - PrintFunction ("call_togl_marker_set"); - PrintCGroup (MyCGroup, 1); - } - call_togl_marker_set (&MyCGroup, &almarkers); - break; - case Aspect_TOM_O_X : - MyCGroup.ContextMarker.IsDef = 1; - - // we draw the circle - MyCGroup.ContextMarker.MarkerType = - int (Aspect_TOM_O); - call_togl_markercontextgroup (&MyCGroup, noinsert); - - MyCGroup.ContextMarker.IsSet = 1; - - if (MyTraceLevel) { - PrintFunction ("call_togl_marker_set"); - PrintCGroup (MyCGroup, 1); - } - call_togl_marker_set (&MyCGroup, &almarkers); - - // we draw the cross - MyCGroup.ContextMarker.MarkerType = - int (Aspect_TOM_X); - call_togl_markercontextgroup (&MyCGroup, noinsert); - if (MyTraceLevel) { - PrintFunction ("call_togl_marker_set"); - PrintCGroup (MyCGroup, 1); - } - call_togl_marker_set (&MyCGroup, &almarkers); + case Aspect_TOM_RING1 : + case Aspect_TOM_RING2 : + case Aspect_TOM_RING3 : + case Aspect_TOM_USERDEFINED: + OpenGl_CreateMarkers(ACGroup, nb, arr); break; case Aspect_TOM_BALL : - MyCGroup.ContextMarker.IsDef = 1; + { + const Standard_Real Delta = 0.1; + + Standard_Real R, G, B, H, L, S, AScale; + R = Standard_Real (ACGroup.ContextMarker.Color.r); + G = Standard_Real (ACGroup.ContextMarker.Color.g); + B = Standard_Real (ACGroup.ContextMarker.Color.b); + AScale = Standard_Real (ACGroup.ContextMarker.Scale); // we draw a set of circles - MyCGroup.ContextMarker.MarkerType = - int (Aspect_TOM_O); - Delta = 0.1; - while (AScale >= 1.0) { + CALL_DEF_CONTEXTMARKER AContext; + AContext.MarkerType = int (Aspect_TOM_O); + while (AScale >= 1.0) + { Quantity_Color::RgbHls (R, G, B, H, L, S); // Modification de la saturation de 5 % - LastS = S; - S = S - S * 0.05; - if (S < 0.0) S = LastS; + S *= 0.95; Quantity_Color::HlsRgb (H, L, S, R, G, B); - MyCGroup.ContextMarker.Color.r = float (R); - MyCGroup.ContextMarker.Color.g = float (G); - MyCGroup.ContextMarker.Color.b = float (B); - MyCGroup.ContextMarker.Scale = float (AScale); - call_togl_markercontextgroup (&MyCGroup, noinsert); - - MyCGroup.ContextMarker.IsSet = 1; - - if (MyTraceLevel) { - PrintFunction ("call_togl_marker_set"); - PrintCGroup (MyCGroup, 1); - } - call_togl_marker_set (&MyCGroup, &almarkers); - AScale -= Delta; - } - break; - - case Aspect_TOM_RING1 : - case Aspect_TOM_RING2 : - case Aspect_TOM_RING3 : - MyCGroup.ContextMarker.IsDef = 1; - - // we draw a set of circles - MyCGroup.ContextMarker.MarkerType = - int (Aspect_TOM_O); - if (AMType == Aspect_TOM_RING1) - Limit = AScale - AScale * 0.8; - if (AMType == Aspect_TOM_RING2) - Limit = AScale - AScale * 0.5; - if (AMType == Aspect_TOM_RING3) - Limit = AScale - AScale * 0.2; - Delta = 0.1; - while (AScale > Limit && AScale >= 1.0) { - MyCGroup.ContextMarker.Scale = float (AScale); - call_togl_markercontextgroup (&MyCGroup, noinsert); - - MyCGroup.ContextMarker.IsSet = 1; - - if (MyTraceLevel) { - PrintFunction ("call_togl_marker_set"); - PrintCGroup (MyCGroup, 1); - } - call_togl_marker_set (&MyCGroup, &almarkers); - AScale -= Delta; + AContext.Color.r = float (R); + AContext.Color.g = float (G); + AContext.Color.b = float (B); + AContext.Scale = float (AScale); + ((OpenGl_Group *)ACGroup.ptrGroup)->SetAspectMarker(AContext, Standard_False); + OpenGl_CreateMarkers(ACGroup, nb, arr); + AScale -= Delta; } break; + } default: break; } - - // Restauration des valeurs initiales - MyCGroup.ContextMarker.Color.r = float (AMR); - MyCGroup.ContextMarker.Color.g = float (AMR); - MyCGroup.ContextMarker.Color.b = float (AMR); - MyCGroup.ContextMarker.MarkerType = int (AMType); - MyCGroup.ContextMarker.Scale = float (AMScale); - } diff --git a/src/OpenGl/OpenGl_GraphicDriver_705.cxx b/src/OpenGl/OpenGl_GraphicDriver_705.cxx index 683e615b9d..bfa08183f0 100755 --- a/src/OpenGl/OpenGl_GraphicDriver_705.cxx +++ b/src/OpenGl/OpenGl_GraphicDriver_705.cxx @@ -1,610 +1,89 @@ +// File: OpenGl_GraphicDriver_705.cxx +// Created: 20 October 2011 +// Author: Sergey ZERCHANINOV +// Copyright: OPEN CASCADE 2011 -// File OpenGl_GraphicDriver_705.cxx -// Created Mardi 28 janvier 1997 -// Author CAL -// Modified -// 27/07/97 ; PCT : ajout coordonnee texture +#include -//-Copyright MatraDatavision 1997 - -//-Version - -//-Design Declaration des variables specifiques aux Drivers - -//-Warning Un driver encapsule les Pex et OpenGl drivers - -//-References - -//-Language C++ 2.0 - -//-Declarations - -// for the class -#include - -#include - -#include - -//-Aliases - -//-Global data definitions - -//-Methods, in order +#include +#include void OpenGl_GraphicDriver::Polygon (const Graphic3d_CGroup& ACGroup, - const Graphic3d_Array1OfVertex& ListVertex, - const Graphic3d_TypeOfPolygon AType, - const Standard_Boolean ) + const Graphic3d_Array1OfVertex& AListVertex, + const Graphic3d_TypeOfPolygon AType, + const Standard_Boolean ) { - Graphic3d_CGroup MyCGroup = ACGroup; - - Standard_Integer i; - Standard_Integer Lower = ListVertex.Lower (); - - CALL_DEF_FACET afacet; - - i = ListVertex.Length (); - - afacet.TypeFacet = int (AType); - - afacet.NormalIsDefined = 0; - afacet.ColorIsDefined = 0; - - afacet.NbPoints = int (i); - afacet.TypePoints = 1; - afacet.UPoints.Points = (CALL_DEF_POINT *) &ListVertex (Lower); - - if (MyTraceLevel) { - PrintFunction ("call_togl_polygon"); - PrintCGroup (MyCGroup, 1); + if (ACGroup.ptrGroup) + { + OpenGl_Polygon *apolygon = new OpenGl_Polygon( AListVertex, AType ); + ((OpenGl_Group *)ACGroup.ptrGroup)->AddElement( TelPolygon, apolygon ); } - call_togl_polygon (&MyCGroup, &afacet); - } -void OpenGl_GraphicDriver::Polygon (const Graphic3d_CGroup& ACGroup, - const Graphic3d_Array1OfVertex& ListVertex, - const Graphic3d_Vector& Normal, - const Graphic3d_TypeOfPolygon AType, - const Standard_Boolean ) +void OpenGl_GraphicDriver::Polygon (const Graphic3d_CGroup& , + const Graphic3d_Array1OfVertex& , + const Graphic3d_Vector& , + const Graphic3d_TypeOfPolygon , + const Standard_Boolean ) { - Graphic3d_CGroup MyCGroup = ACGroup; - - - Standard_Real X, Y, Z; - - Standard_Integer i; - Standard_Integer Lower = ListVertex.Lower (); - - CALL_DEF_FACET afacet; - - i = ListVertex.Length (); - - afacet.TypeFacet = int (AType); - - afacet.NormalIsDefined = 1; - afacet.ColorIsDefined = 0; - - Normal.Coord (X, Y, Z); - afacet.Normal.dx = float (X); - afacet.Normal.dy = float (Y); - afacet.Normal.dz = float (Z); - - afacet.NbPoints = int (i); - afacet.TypePoints = 1; - afacet.UPoints.Points = (CALL_DEF_POINT *) &ListVertex (Lower); - - if (MyTraceLevel) { - PrintFunction ("call_togl_polygon"); - PrintCGroup (MyCGroup, 1); - } - call_togl_polygon (&MyCGroup, &afacet); - + // Do nothing } -void OpenGl_GraphicDriver::Polygon (const Graphic3d_CGroup& ACGroup, - const Graphic3d_Array1OfVertexN& ListVertex, - const Graphic3d_TypeOfPolygon AType, - const Standard_Boolean ) +void OpenGl_GraphicDriver::Polygon (const Graphic3d_CGroup& , + const Graphic3d_Array1OfVertexN& , + const Graphic3d_TypeOfPolygon , + const Standard_Boolean ) { - - Graphic3d_CGroup MyCGroup = ACGroup; - - Standard_Real X, Y, Z; - Standard_Real DX, DY, DZ; - - Standard_Integer i, j; - Standard_Integer Lower = ListVertex.Lower (); - Standard_Integer Upper = ListVertex.Upper (); - - CALL_DEF_FACET afacet; - CALL_DEF_POINTN *points; - - i = ListVertex.Length (); - - // Allocation dynamique - points = new CALL_DEF_POINTN [i]; - - afacet.TypeFacet = int (AType); - - afacet.NormalIsDefined = 0; - afacet.ColorIsDefined = 0; - - afacet.NbPoints = int (i); - afacet.TypePoints = 2; - afacet.UPoints.PointsN = points; - - // Parcours des sommets - for (j=0, i=Lower; i<=Upper; i++, j++) { - ListVertex (i).Coord (X, Y, Z); - points[j].Point.x = float (X); - points[j].Point.y = float (Y); - points[j].Point.z = float (Z); - ListVertex (i).Normal (DX, DY, DZ); - points[j].Normal.dx = float (DX); - points[j].Normal.dy = float (DY); - points[j].Normal.dz = float (DZ); - } - - if (MyTraceLevel) { - PrintFunction ("call_togl_polygon"); - PrintCGroup (MyCGroup, 1); - } - call_togl_polygon (&MyCGroup, &afacet); - - // Desallocation dynamique - delete [] points; - + // Do nothing } -void OpenGl_GraphicDriver::Polygon (const Graphic3d_CGroup& ACGroup, - const Graphic3d_Array1OfVertexN& ListVertex, - const Graphic3d_Vector& Normal, - const Graphic3d_TypeOfPolygon AType, - const Standard_Boolean ) +void OpenGl_GraphicDriver::Polygon (const Graphic3d_CGroup& , + const Graphic3d_Array1OfVertexN& , + const Graphic3d_Vector& , + const Graphic3d_TypeOfPolygon , + const Standard_Boolean ) { - Graphic3d_CGroup MyCGroup = ACGroup; - - - Standard_Real X, Y, Z; - Standard_Real DX, DY, DZ; - - Standard_Integer i, j; - Standard_Integer Lower = ListVertex.Lower (); - Standard_Integer Upper = ListVertex.Upper (); - - CALL_DEF_FACET afacet; - CALL_DEF_POINTN *points; - - i = ListVertex.Length (); - - // Allocation dynamique - points = new CALL_DEF_POINTN [i]; - - afacet.TypeFacet = int (AType); - - afacet.NormalIsDefined = 1; - afacet.ColorIsDefined = 0; - - Normal.Coord (DX, DY, DZ); - afacet.Normal.dx = float (DX); - afacet.Normal.dy = float (DY); - afacet.Normal.dz = float (DZ); - - afacet.NbPoints = int (i); - afacet.TypePoints = 2; - afacet.UPoints.PointsN = points; - - // Parcours des sommets - for (j=0, i=Lower; i<=Upper; i++, j++) { - ListVertex (i).Coord (X, Y, Z); - points[j].Point.x = float (X); - points[j].Point.y = float (Y); - points[j].Point.z = float (Z); - ListVertex (i).Normal (DX, DY, DZ); - points[j].Normal.dx = float (DX); - points[j].Normal.dy = float (DY); - points[j].Normal.dz = float (DZ); - } - - if (MyTraceLevel) { - PrintFunction ("call_togl_polygon"); - PrintCGroup (MyCGroup, 1); - } - call_togl_polygon (&MyCGroup, &afacet); - - // Desallocation dynamique - delete [] points; - + // Do nothing } - -void OpenGl_GraphicDriver::Polygon(const Graphic3d_CGroup& ACGroup, - const Graphic3d_Array1OfVertexNT& ListVertex, - const Graphic3d_TypeOfPolygon AType, - const Standard_Boolean ) +void OpenGl_GraphicDriver::Polygon (const Graphic3d_CGroup& , + const Graphic3d_Array1OfVertexNT& , + const Graphic3d_TypeOfPolygon , + const Standard_Boolean ) { - - Graphic3d_CGroup MyCGroup = ACGroup; - - - Standard_Real X, Y, Z; - Standard_Real DX, DY, DZ; - Standard_Real TX, TY; - - Standard_Integer i, j; - Standard_Integer Lower = ListVertex.Lower (); - Standard_Integer Upper = ListVertex.Upper (); - - CALL_DEF_FACET afacet; - CALL_DEF_POINTNT *points; - - i = ListVertex.Length (); - - // Allocation dynamique - points = new CALL_DEF_POINTNT [i]; - - afacet.TypeFacet = int (AType); - - afacet.NormalIsDefined = 0; - afacet.ColorIsDefined = 0; - - afacet.NbPoints = int (i); - afacet.TypePoints = 5; - afacet.UPoints.PointsNT = points; - - // Parcours des sommets - for (j=0, i=Lower; i<=Upper; i++, j++) { - ListVertex (i).Coord (X, Y, Z); - points[j].Point.x = float (X); - points[j].Point.y = float (Y); - points[j].Point.z = float (Z); - ListVertex (i).Normal (DX, DY, DZ); - points[j].Normal.dx = float (DX); - points[j].Normal.dy = float (DY); - points[j].Normal.dz = float (DZ); - ListVertex (i).TextureCoordinate(TX, TY); - points[j].TextureCoord.tx = float(TX); - points[j].TextureCoord.ty = float(TY); - } - - if (MyTraceLevel) { - PrintFunction ("call_togl_polygon"); - PrintCGroup (MyCGroup, 1); - } - call_togl_polygon (&MyCGroup, &afacet); - - // Desallocation dynamique - delete [] points; - + // Do nothing } - -void OpenGl_GraphicDriver::PolygonHoles (const Graphic3d_CGroup& ACGroup, - const TColStd_Array1OfInteger& Bounds, - const Graphic3d_Array1OfVertex& ListVertex, - const Standard_Boolean ) +void OpenGl_GraphicDriver::PolygonHoles (const Graphic3d_CGroup& , + const TColStd_Array1OfInteger& , + const Graphic3d_Array1OfVertex& , + const Standard_Boolean ) { - - Graphic3d_CGroup MyCGroup = ACGroup; - - Standard_Real X, Y, Z; - - Standard_Integer i, ii; - Standard_Integer j; - Standard_Integer k, kk; - Standard_Integer nb_points; - Standard_Integer begin_points; - Standard_Integer end_points; - Standard_Integer Lower, Upper; - - CALL_DEF_LISTFACETS alfacets; - CALL_DEF_FACET *facets; - CALL_DEF_POINT *points; - - i = ListVertex.Length (); - j = Bounds.Length (); - - // Allocation dynamique - points = new CALL_DEF_POINT [i]; - facets = new CALL_DEF_FACET [j]; - - alfacets.NbFacets = int (j); - alfacets.LFacets = facets; - - begin_points = ListVertex.Lower (); - end_points = ListVertex.Upper (); - - Lower = Bounds.Lower (); - Upper = Bounds.Upper (); - - nb_points = 0; - - // Parcours des facettes - for (k=0, kk=Lower; kk<=Upper; k++, kk++) { - facets[k].TypeFacet = 0; /* TOP_UNKNOWN */ - - facets[k].NormalIsDefined = 0; - facets[k].ColorIsDefined = 0; - - facets[k].NbPoints = int (Bounds.Value (kk)); - facets[k].TypePoints = 1; - facets[k].UPoints.Points = (points + nb_points); - - // Parcours des sommets - for (i=0, ii=begin_points; - ((ii<=end_points) || (i==facets[k].NbPoints-1)); - i++, ii++) { - ListVertex (ii).Coord (X, Y, Z); - points[nb_points+i].x = float (X); - points[nb_points+i].y = float (Y); - points[nb_points+i].z = float (Z); - } - begin_points += facets[k].NbPoints; - nb_points += facets[k].NbPoints; - } - - if (MyTraceLevel) { - PrintFunction ("call_togl_polygon_holes"); - PrintCGroup (MyCGroup, 1); - } - call_togl_polygon_holes (&MyCGroup, &alfacets); - - // Desallocation dynamique - delete [] points; - delete [] facets; - + // Do nothing } -void OpenGl_GraphicDriver::PolygonHoles (const Graphic3d_CGroup& ACGroup, - const TColStd_Array1OfInteger& Bounds, - const Graphic3d_Array1OfVertex& ListVertex, - const Graphic3d_Vector& Normal, - const Standard_Boolean ) +void OpenGl_GraphicDriver::PolygonHoles (const Graphic3d_CGroup& , + const TColStd_Array1OfInteger& , + const Graphic3d_Array1OfVertex& , + const Graphic3d_Vector& , + const Standard_Boolean ) { - - Graphic3d_CGroup MyCGroup = ACGroup; - - Standard_Real X, Y, Z; - Standard_Real NX, NY, NZ; - - Standard_Integer i, ii; - Standard_Integer j; - Standard_Integer k, kk; - Standard_Integer nb_points; - Standard_Integer begin_points; - Standard_Integer end_points; - Standard_Integer Lower, Upper; - - CALL_DEF_LISTFACETS alfacets; - CALL_DEF_FACET *facets; - CALL_DEF_POINT *points; - - i = ListVertex.Length (); - j = Bounds.Length (); - - // Allocation dynamique - points = new CALL_DEF_POINT [i]; - facets = new CALL_DEF_FACET [j]; - - alfacets.NbFacets = int (j); - alfacets.LFacets = facets; - - begin_points = ListVertex.Lower (); - end_points = ListVertex.Upper (); - - Lower = Bounds.Lower (); - Upper = Bounds.Upper (); - - nb_points = 0; - - Normal.Coord (NX, NY, NZ); - - // Parcours des facettes - for (k=0, kk=Lower; kk<=Upper; k++, kk++) { - facets[k].TypeFacet = 0; /* TOP_UNKNOWN */ - - facets[k].ColorIsDefined = 0; - facets[k].NormalIsDefined = 1; - facets[k].Normal.dx = float (NX); - facets[k].Normal.dy = float (NY); - facets[k].Normal.dz = float (NZ); - - facets[k].NbPoints = int (Bounds.Value (kk)); - facets[k].TypePoints = 1; - facets[k].UPoints.Points = (points + nb_points); - - // Parcours des sommets - for (i=0, ii=begin_points; - ((ii<=end_points) || (i==facets[k].NbPoints-1)); - i++, ii++) { - ListVertex (ii).Coord (X, Y, Z); - points[nb_points+i].x = float (X); - points[nb_points+i].y = float (Y); - points[nb_points+i].z = float (Z); - } - begin_points += facets[k].NbPoints; - nb_points += facets[k].NbPoints; - } - - if (MyTraceLevel) { - PrintFunction ("call_togl_polygon_holes"); - PrintCGroup (MyCGroup, 1); - } - call_togl_polygon_holes (&MyCGroup, &alfacets); - - // Desallocation dynamique - delete [] points; - delete [] facets; - + // Do nothing } -void OpenGl_GraphicDriver::PolygonHoles (const Graphic3d_CGroup& ACGroup, - const TColStd_Array1OfInteger& Bounds, - const Graphic3d_Array1OfVertexN& ListVertex, - const Standard_Boolean ) +void OpenGl_GraphicDriver::PolygonHoles (const Graphic3d_CGroup& , + const TColStd_Array1OfInteger& , + const Graphic3d_Array1OfVertexN& , + const Standard_Boolean ) { - - Graphic3d_CGroup MyCGroup = ACGroup; - - Standard_Real X, Y, Z; - Standard_Real DX, DY, DZ; - - Standard_Integer i, ii; - Standard_Integer j; - Standard_Integer k, kk; - Standard_Integer nb_points; - Standard_Integer begin_points; - Standard_Integer end_points; - Standard_Integer Lower, Upper; - - CALL_DEF_LISTFACETS alfacets; - CALL_DEF_FACET *facets; - CALL_DEF_POINTN *points; - - i = ListVertex.Length (); - j = Bounds.Length (); - - // Allocation dynamique - points = new CALL_DEF_POINTN [i]; - facets = new CALL_DEF_FACET [j]; - - alfacets.NbFacets = int (j); - alfacets.LFacets = facets; - - begin_points = ListVertex.Lower (); - end_points = ListVertex.Upper (); - - Lower = Bounds.Lower (); - Upper = Bounds.Upper (); - - nb_points = 0; - - // Parcours des facettes - for (k=0, kk=Lower; kk<=Upper; k++, kk++) { - facets[k].TypeFacet = 0; /* TOP_UNKNOWN */ - - facets[k].NormalIsDefined = 0; - facets[k].ColorIsDefined = 0; - - facets[k].NbPoints = int (Bounds.Value (kk)); - facets[k].TypePoints = 2; - facets[k].UPoints.PointsN = (points + nb_points); - - // Parcours des sommets - for (i=0, ii=begin_points; - ((ii<=end_points) || (i==facets[k].NbPoints-1)); - i++, ii++) { - ListVertex (ii).Coord (X, Y, Z); - points[nb_points+i].Point.x = float (X); - points[nb_points+i].Point.y = float (Y); - points[nb_points+i].Point.z = float (Z); - ListVertex (ii).Normal (DX, DY, DZ); - points[nb_points+i].Normal.dx = float (DX); - points[nb_points+i].Normal.dy = float (DY); - points[nb_points+i].Normal.dz = float (DZ); - } - begin_points += facets[k].NbPoints; - nb_points += facets[k].NbPoints; - } - - if (MyTraceLevel) { - PrintFunction ("call_togl_polygon_holes"); - PrintCGroup (MyCGroup, 1); - } - call_togl_polygon_holes (&MyCGroup, &alfacets); - - // Desallocation dynamique - delete [] points; - delete [] facets; - + // Do nothing } -void OpenGl_GraphicDriver::PolygonHoles (const Graphic3d_CGroup& ACGroup, - const TColStd_Array1OfInteger& Bounds, - const Graphic3d_Array1OfVertexN& ListVertex, - const Graphic3d_Vector& Normal, - const Standard_Boolean ) +void OpenGl_GraphicDriver::PolygonHoles (const Graphic3d_CGroup& , + const TColStd_Array1OfInteger& , + const Graphic3d_Array1OfVertexN& , + const Graphic3d_Vector& , + const Standard_Boolean ) { - - Graphic3d_CGroup MyCGroup = ACGroup; - - Standard_Real X, Y, Z; - Standard_Real DX, DY, DZ; - Standard_Real NX, NY, NZ; - - Standard_Integer i, ii; - Standard_Integer j; - Standard_Integer k, kk; - Standard_Integer nb_points; - Standard_Integer begin_points; - Standard_Integer end_points; - Standard_Integer Lower, Upper; - - CALL_DEF_LISTFACETS alfacets; - CALL_DEF_FACET *facets; - CALL_DEF_POINTN *points; - - i = ListVertex.Length (); - j = Bounds.Length (); - - // Allocation dynamique - points = new CALL_DEF_POINTN [i]; - facets = new CALL_DEF_FACET [j]; - - alfacets.NbFacets = int (j); - alfacets.LFacets = facets; - - begin_points = ListVertex.Lower (); - end_points = ListVertex.Upper (); - - Lower = Bounds.Lower (); - Upper = Bounds.Upper (); - - nb_points = 0; - - Normal.Coord (NX, NY, NZ); - - // Parcours des facettes - for (k=0, kk=Lower; kk<=Upper; k++, kk++) { - facets[k].TypeFacet = 0; /* TOP_UNKNOWN */ - - facets[k].ColorIsDefined = 0; - facets[k].NormalIsDefined = 1; - facets[k].Normal.dx = float (NX); - facets[k].Normal.dy = float (NY); - facets[k].Normal.dz = float (NZ); - - facets[k].NbPoints = int (Bounds.Value (kk)); - facets[k].TypePoints = 2; - facets[k].UPoints.PointsN = (points + nb_points); - - // Parcours des sommets - for (i=0, ii=begin_points; - ((ii<=end_points) || (i==facets[k].NbPoints-1)); - i++, ii++) { - ListVertex (ii).Coord (X, Y, Z); - points[nb_points+i].Point.x = float (X); - points[nb_points+i].Point.y = float (Y); - points[nb_points+i].Point.z = float (Z); - ListVertex (ii).Normal (DX, DY, DZ); - points[nb_points+i].Normal.dx = float (DX); - points[nb_points+i].Normal.dy = float (DY); - points[nb_points+i].Normal.dz = float (DZ); - } - begin_points += facets[k].NbPoints; - nb_points += facets[k].NbPoints; - } - - if (MyTraceLevel) { - PrintFunction ("call_togl_polygon_holes"); - PrintCGroup (MyCGroup, 1); - } - call_togl_polygon_holes (&MyCGroup, &alfacets); - - // Desallocation dynamique - delete [] points; - delete [] facets; - + // Do nothing } diff --git a/src/OpenGl/OpenGl_GraphicDriver_707.cxx b/src/OpenGl/OpenGl_GraphicDriver_707.cxx index 365e29f9ad..d478f742c4 100755 --- a/src/OpenGl/OpenGl_GraphicDriver_707.cxx +++ b/src/OpenGl/OpenGl_GraphicDriver_707.cxx @@ -1,147 +1,47 @@ +// File: OpenGl_GraphicDriver_707.cxx +// Created: 20 October 2011 +// Author: Sergey ZERCHANINOV +// Copyright: OPEN CASCADE 2011 -// File OpenGl_GraphicDriver_707.cxx -// Created Mardi 28 janvier 1997 -// Author CAL +#include -//-Copyright MatraDatavision 1997 - -//-Version - -//-Design Declaration des variables specifiques aux Drivers - -//-Warning Un driver encapsule les Pex et OpenGl drivers - -//-References - -//-Language C++ 2.0 - -//-Declarations - -// for the class -#include - -#include - -#include - -//-Aliases - -//-Global data definitions - -//-Methods, in order +#include +#include void OpenGl_GraphicDriver::Polyline (const Graphic3d_CGroup& ACGroup, - const Graphic3d_Array1OfVertex& ListVertex, - const Standard_Boolean ) + const Graphic3d_Array1OfVertex& AListVertex, + const Standard_Boolean ) { - - Graphic3d_CGroup MyCGroup = ACGroup; - - Standard_Integer i; - Standard_Integer Lower = ListVertex.Lower (); - - CALL_DEF_LISTPOINTS alpoints; - - i = ListVertex.Length (); - - alpoints.NbPoints = int (i); - alpoints.TypePoints = 1; - alpoints.UPoints.Points = (CALL_DEF_POINT *) &ListVertex (Lower); - - if (MyTraceLevel) { - PrintFunction ("call_togl_polyline"); - PrintCGroup (MyCGroup, 1); + if (ACGroup.ptrGroup) + { + OpenGl_Polyline *apolyline = new OpenGl_Polyline( AListVertex ); + ((OpenGl_Group *)ACGroup.ptrGroup)->AddElement( TelPolyline, apolyline ); } - call_togl_polyline (&MyCGroup, &alpoints); - } void OpenGl_GraphicDriver::Polyline (const Graphic3d_CGroup& ACGroup, - const Graphic3d_Array1OfVertexC& ListVertex, - const Standard_Boolean ) + const Graphic3d_Array1OfVertexC& AListVertex, + const Standard_Boolean ) { - - Graphic3d_CGroup MyCGroup = ACGroup; - - - Standard_Real X, Y, Z; - Standard_Real R, G, B; - - Standard_Integer i, j; - Standard_Integer Lower = ListVertex.Lower (); - Standard_Integer Upper = ListVertex.Upper (); - - CALL_DEF_LISTPOINTS alpoints; - CALL_DEF_POINTC *points; - - i = ListVertex.Length (); - - // Allocation dynamique - points = new CALL_DEF_POINTC [i]; - - alpoints.NbPoints = int (i); - alpoints.TypePoints = 3; - alpoints.UPoints.PointsC= points; - - Lower = ListVertex.Lower (); - Upper = ListVertex.Upper (); - - // Parcours des sommets - for (j=0, i=Lower; i<=Upper; i++, j++) { - ListVertex (i).Coord (X, Y, Z); - (ListVertex (i).Color ()).Values (R, G, B, Quantity_TOC_RGB); - points[j].Color.r = float (R); - points[j].Color.g = float (G); - points[j].Color.b = float (B); - points[j].Point.x = float (X); - points[j].Point.y = float (Y); - points[j].Point.z = float (Z); - } - - if (MyTraceLevel) { - PrintFunction ("call_togl_polyline"); - PrintCGroup (MyCGroup, 1); + if (ACGroup.ptrGroup) + { + OpenGl_Polyline *apolyline = new OpenGl_Polyline( AListVertex ); + ((OpenGl_Group *)ACGroup.ptrGroup)->AddElement( TelPolyline, apolyline ); } - call_togl_polyline (&MyCGroup, &alpoints); - - // Desallocation dynamique - delete [] points; - } void OpenGl_GraphicDriver::Polyline (const Graphic3d_CGroup& ACGroup, - const Standard_Real X1, - const Standard_Real Y1, - const Standard_Real Z1, - const Standard_Real X2, - const Standard_Real Y2, - const Standard_Real Z2, - const Standard_Boolean ) + const Standard_Real X1, + const Standard_Real Y1, + const Standard_Real Z1, + const Standard_Real X2, + const Standard_Real Y2, + const Standard_Real Z2, + const Standard_Boolean ) { - - Graphic3d_CGroup TheGroup = ACGroup; - - CALL_DEF_LISTPOINTS alpoints; - - CALL_DEF_POINT *points; - - // Allocation dynamique - points = new CALL_DEF_POINT [2]; - - alpoints.NbPoints = 2; - alpoints.TypePoints = 1; - alpoints.UPoints.Points = points; - - points[0].x = float (X1); - points[0].y = float (Y1); - points[0].z = float (Z1); - points[1].x = float (X2); - points[1].y = float (Y2); - points[1].z = float (Z2); - - call_togl_polyline (&TheGroup, &alpoints); - - // Desallocation dynamique - delete [] points; - + if (ACGroup.ptrGroup) + { + OpenGl_Polyline *apolyline = new OpenGl_Polyline( X1, Y1, Z1, X2, Y2, Z2 ); + ((OpenGl_Group *)ACGroup.ptrGroup)->AddElement( TelPolyline, apolyline ); + } } diff --git a/src/OpenGl/OpenGl_GraphicDriver_709.cxx b/src/OpenGl/OpenGl_GraphicDriver_709.cxx index 1377c1deb3..2d30d22faf 100755 --- a/src/OpenGl/OpenGl_GraphicDriver_709.cxx +++ b/src/OpenGl/OpenGl_GraphicDriver_709.cxx @@ -1,627 +1,42 @@ +// File: OpenGl_GraphicDriver_709.cxx +// Created: 20 October 2011 +// Author: Sergey ZERCHANINOV +// Copyright: OPEN CASCADE 2011 -// File OpenGl_GraphicDriver_709.cxx -// Created Mardi 28 janvier 1997 -// Author CAL -// Modified -// 27/08/97 ; PCT : ajout coordonnee texture +#include -//-Copyright MatraDatavision 1997 - -//-Version - -//-Design Declaration des variables specifiques aux Drivers - -//-Warning Un driver encapsule les Pex et OpenGl drivers - -//-References - -//-Language C++ 2.0 - -//-Declarations - -// for the class -#include - -#include - -#include - -//-Aliases - -//-Global data definitions - -//-Methods, in order +#include +#include void OpenGl_GraphicDriver::QuadrangleMesh (const Graphic3d_CGroup& ACGroup, - const Graphic3d_Array2OfVertex& ListVertex, - const Standard_Boolean ) -{ - - Graphic3d_CGroup MyCGroup = ACGroup; - - Standard_Real X, Y, Z; - - Standard_Integer i, j, k; - Standard_Integer LowerRow = ListVertex.LowerRow (); - Standard_Integer UpperRow = ListVertex.UpperRow (); - Standard_Integer LowerCol = ListVertex.LowerCol (); - Standard_Integer UpperCol = ListVertex.UpperCol (); - - CALL_DEF_QUAD aquad; - CALL_DEF_POINT *points; - - i = ListVertex.RowLength (); - j = ListVertex.ColLength (); - - // Allocation dynamique - points = new CALL_DEF_POINT [i*j]; - - aquad.NbPoints = int (i*j); - aquad.TypePoints = 1; - aquad.SizeRow = int (i); - aquad.SizeCol = int (j); - aquad.UPoints.Points = points; - - // Parcours des sommets - k = 0; - for (i=LowerRow; i<=UpperRow; i++) - for (j=LowerCol; j<=UpperCol; j++) { - ListVertex (i, j).Coord (X, Y, Z); - points[k].x = float (X); - points[k].y = float (Y); - points[k].z = float (Z); - k++; - } - - if (MyTraceLevel) { - PrintFunction ("call_togl_quadrangle"); - PrintCGroup (MyCGroup, 1); - } - call_togl_quadrangle (&MyCGroup, &aquad); - - // Desallocation dynamique - delete [] points; - -} - -void OpenGl_GraphicDriver::QuadrangleMesh (const Graphic3d_CGroup& ACGroup, - const Graphic3d_Array2OfVertexN& ListVertex, - const Standard_Boolean ) -{ - - Graphic3d_CGroup MyCGroup = ACGroup; - - Standard_Real X, Y, Z; - Standard_Real DX, DY, DZ; - - Standard_Integer i, j, k; - Standard_Integer LowerRow = ListVertex.LowerRow (); - Standard_Integer UpperRow = ListVertex.UpperRow (); - Standard_Integer LowerCol = ListVertex.LowerCol (); - Standard_Integer UpperCol = ListVertex.UpperCol (); - - CALL_DEF_QUAD aquad; - CALL_DEF_POINTN *points; - - i = ListVertex.RowLength (); - j = ListVertex.ColLength (); - - // Allocation dynamique - points = new CALL_DEF_POINTN [i*j]; - - aquad.NbPoints = int (i*j); - aquad.TypePoints = 2; - aquad.SizeRow = int (i); - aquad.SizeCol = int (j); - aquad.UPoints.PointsN = points; - - // Parcours des sommets - k = 0; - for (i=LowerRow; i<=UpperRow; i++) - for (j=LowerCol; j<=UpperCol; j++) { - ListVertex (i, j).Coord (X, Y, Z); - points[k].Point.x = float (X); - points[k].Point.y = float (Y); - points[k].Point.z = float (Z); - ListVertex (i, j).Normal (DX, DY, DZ); - points[k].Normal.dx = float (DX); - points[k].Normal.dy = float (DY); - points[k].Normal.dz = float (DZ); - k++; - } - - if (MyTraceLevel) { - PrintFunction ("call_togl_quadrangle"); - PrintCGroup (MyCGroup, 1); - } - call_togl_quadrangle (&MyCGroup, &aquad); - - // Desallocation dynamique - delete [] points; - -} - - -void OpenGl_GraphicDriver::QuadrangleMesh(const Graphic3d_CGroup& ACGroup, - const Graphic3d_Array2OfVertexNT& ListVertex, + const Graphic3d_Array2OfVertex& ListVertex, const Standard_Boolean ) { - - Graphic3d_CGroup MyCGroup = ACGroup; - - Standard_Real X, Y, Z; - Standard_Real DX, DY, DZ; - - Standard_Integer i, j, k; - Standard_Integer LowerRow = ListVertex.LowerRow (); - Standard_Integer UpperRow = ListVertex.UpperRow (); - Standard_Integer LowerCol = ListVertex.LowerCol (); - Standard_Integer UpperCol = ListVertex.UpperCol (); - - CALL_DEF_QUAD aquad; - CALL_DEF_POINTNT *points; - - i = ListVertex.RowLength (); - j = ListVertex.ColLength (); - - // Allocation dynamique - points = new CALL_DEF_POINTNT [i*j]; - - aquad.NbPoints = int (i*j); - aquad.TypePoints = 5; - aquad.SizeRow = int (i); - aquad.SizeCol = int (j); - aquad.UPoints.PointsNT = points; - - // Parcours des sommets - k = 0; - for (i=LowerRow; i<=UpperRow; i++) - for (j=LowerCol; j<=UpperCol; j++) { - ListVertex (i, j).Coord (X, Y, Z); - points[k].Point.x = float (X); - points[k].Point.y = float (Y); - points[k].Point.z = float (Z); - ListVertex (i, j).Normal (DX, DY, DZ); - points[k].Normal.dx = float (DX); - points[k].Normal.dy = float (DY); - points[k].Normal.dz = float (DZ); - ListVertex (i, j).TextureCoordinate(DX,DY); - points[k].TextureCoord.tx = float(DX); - points[k].TextureCoord.ty = float(DY); - k++; - } - - if (MyTraceLevel) { - PrintFunction ("call_togl_quadrangle"); - PrintCGroup (MyCGroup, 1); - } - call_togl_quadrangle (&MyCGroup, &aquad); - - // Desallocation dynamique - delete [] points; - -} - - -void OpenGl_GraphicDriver::QuadrangleSet (const Graphic3d_CGroup& ACGroup, - const Graphic3d_Array1OfVertex& ListVertex, - const Aspect_Array1OfEdge& ListEdge, - const Standard_Boolean ) -{ - - Graphic3d_CGroup MyCGroup = ACGroup; - - Standard_Integer i, j, k; - Standard_Integer Lower, Upper; - Standard_Integer OffSet; - - CALL_DEF_LISTPOINTS alpoints; - CALL_DEF_LISTEDGES aledges; - CALL_DEF_EDGE *edges; - - // Permettra une generalisation plus facile a une methode du style - // PolygonSet (ListVertex, ListEdge, Bounds). - int *integers; - CALL_DEF_LISTINTEGERS albounds; - - i = ListVertex.Length (); - j = ListEdge.Length (); - k = int (j/4); - - Lower = ListVertex.Lower (); - Upper = ListVertex.Upper (); - OffSet = Lower; - - // Allocation dynamique - edges = new CALL_DEF_EDGE [j]; - integers= new int [k]; - - alpoints.NbPoints = int (i); - alpoints.TypePoints = 1; - alpoints.UPoints.Points = (CALL_DEF_POINT *) &ListVertex (Lower); - - aledges.NbEdges = int (j); - aledges.Edges = edges; - - albounds.NbIntegers = int (k); - albounds.Integers = integers; - - Lower = ListEdge.Lower (); - Upper = ListEdge.Upper (); - - // Parcours des aretes - for (j=0, i=Lower; i<=Upper; i++, j++) { - edges[j].Index1 = int (ListEdge (i).FirstIndex ()-OffSet); - edges[j].Index2 = int (ListEdge (i).LastIndex ()-OffSet); - edges[j].Type = int (ListEdge (i).Type ()); + if (ACGroup.ptrGroup) + { + OpenGl_QuadrangleStrip *aqstrip = new OpenGl_QuadrangleStrip( ListVertex ); + ((OpenGl_Group *)ACGroup.ptrGroup)->AddElement( TelQuadrangle, aqstrip ); } - - // Parcours des limites (ici toutes les limites sont egales a 4. - for (j=0; jAddElement( TelQuadrangle, aqstrip ); } - - Lower = ListEdge.Lower (); - Upper = ListEdge.Upper (); - - // Parcours des aretes - for (j=0, i=Lower; i<=Upper; i++, j++) { - edges[j].Index1 = int (ListEdge (i).FirstIndex ()-OffSet); - edges[j].Index2 = int (ListEdge (i).LastIndex ()-OffSet); - edges[j].Type = int (ListEdge (i).Type ()); - } - - // Parcours des limites (ici toutes les limites sont egales a 4. - for (j=0; jAddElement( TelQuadrangle, aqstrip ); } - - // Parcours des limites (ici toutes les limites sont egales a 4. - for (j=0; j -// File OpenGl_GraphicDriver_710.cxx -// Created Mardi 28 janvier 1997 -// Author CAL - -//-Copyright MatraDatavision 1997 - -//-Version - -//-Design Declaration des variables specifiques aux Drivers - -//-Warning Un driver encapsule les Pex et OpenGl drivers - -//-References - -//-Language C++ 2.0 - -//-Declarations - -// for the class -#include #include - -#include - -#include - -//-Aliases - -//-Global data definitions - -//-Methods, in order +#include +#include void OpenGl_GraphicDriver::Text ( @@ -76,29 +52,15 @@ void OpenGl_GraphicDriver::Text const Standard_Boolean ) { - Graphic3d_CGroup MyCGroup = ACGroup; - - CALL_DEF_TEXT atext; - - Standard_Real X, Y, Z; - APoint.Coord (X, Y, Z); - atext.Position.x = float (X); - atext.Position.y = float (Y); - atext.Position.z = float (Z); - atext.Height = float (AHeight); - if (atext.Height < 0) - atext.Height = DefaultTextHeight(); - atext.Angle = float (AAngle); - atext.Path = int (ATp); - atext.HAlign = int (AHta); - atext.VAlign = int (AVta); - atext.string = (unsigned short *)AText.ToExtString (); - - if (MyTraceLevel) { - PrintFunction ("call_togl_text"); - PrintCGroup (MyCGroup, 1); + if (ACGroup.ptrGroup) + { + Standard_Real theHeight = AHeight; + if (theHeight < 0.) + theHeight = DefaultTextHeight(); + + OpenGl_Text *atext = new OpenGl_Text( AText, APoint, theHeight, AHta, AVta ); + ((OpenGl_Group *)ACGroup.ptrGroup)->AddElement( TelText, atext ); } - call_togl_text (&MyCGroup, &atext); } void OpenGl_GraphicDriver::Text @@ -110,27 +72,13 @@ void OpenGl_GraphicDriver::Text const Standard_Boolean ) { - Graphic3d_CGroup MyCGroup = ACGroup; - - CALL_DEF_TEXT atext; - - Standard_Real X, Y, Z; - APoint.Coord (X, Y, Z); - atext.Position.x = float (X); - atext.Position.y = float (Y); - atext.Position.z = float (Z); - atext.Height = float (AHeight); - if (atext.Height < 0) - atext.Height = DefaultTextHeight(); - atext.Angle = float (M_PI / 2.); - atext.Path = int (Graphic3d_TP_RIGHT); - atext.HAlign = int (Graphic3d_HTA_LEFT); - atext.VAlign = int (Graphic3d_VTA_BOTTOM); - atext.string = (unsigned short *)AText.ToExtString (); - - if (MyTraceLevel) { - PrintFunction ("call_togl_text"); - PrintCGroup (MyCGroup, 1); + if (ACGroup.ptrGroup) + { + Standard_Real theHeight = AHeight; + if (theHeight < 0.) + theHeight = DefaultTextHeight(); + + OpenGl_Text *atext = new OpenGl_Text( AText, APoint, theHeight, Graphic3d_HTA_LEFT, Graphic3d_VTA_BOTTOM ); + ((OpenGl_Group *)ACGroup.ptrGroup)->AddElement( TelText, atext ); } - call_togl_text (&MyCGroup, &atext); } diff --git a/src/OpenGl/OpenGl_GraphicDriver_711.cxx b/src/OpenGl/OpenGl_GraphicDriver_711.cxx index e2b91840c1..38a051474c 100755 --- a/src/OpenGl/OpenGl_GraphicDriver_711.cxx +++ b/src/OpenGl/OpenGl_GraphicDriver_711.cxx @@ -1,617 +1,103 @@ -// File OpenGl_GraphicDriver_711.cxx -// Created Mardi 28 janvier 1997 -// Author CAL -// -// Modified -// 27/08/97 ; PCT : ajout coordonne texture +// File: OpenGl_GraphicDriver_711.cxx +// Created: 20 October 2011 +// Author: Sergey ZERCHANINOV +// Copyright: OPEN CASCADE 2011 -//-Copyright MatraDatavision 1997 +#include -//-Version - -//-Design Declaration des variables specifiques aux Drivers - -//-Warning Un driver encapsule les Pex et OpenGl drivers - -//-References - -//-Language C++ 2.0 - -//-Declarations - -// for the class -#include -#include - - -#include - -#include - -//-Aliases - -//-Global data definitions - -//-Methods, in order +#include +#include +#include void OpenGl_GraphicDriver::TriangleMesh (const Graphic3d_CGroup& ACGroup, - const Graphic3d_Array1OfVertex& ListVertex, - const Standard_Boolean ) + const Graphic3d_Array1OfVertex& ListVertex, + const Standard_Boolean ) { - - Graphic3d_CGroup MyCGroup = ACGroup; - - Standard_Integer Lower = ListVertex.Lower (); - - CALL_DEF_TRIKE atrike; - - atrike.NbPoints = int (ListVertex.Length ()); - atrike.TypePoints = 1; - atrike.UPoints.Points = (CALL_DEF_POINT *) &ListVertex (Lower); - - if (MyTraceLevel) { - PrintFunction ("call_togl_triangle"); - PrintCGroup (MyCGroup, 1); + if (ACGroup.ptrGroup) + { + OpenGl_TriangleStrip *atstrip = new OpenGl_TriangleStrip( ListVertex ); + ((OpenGl_Group *)ACGroup.ptrGroup)->AddElement( TelTriangleMesh, atstrip ); } - call_togl_triangle (&MyCGroup, &atrike); - } void OpenGl_GraphicDriver::TriangleMesh (const Graphic3d_CGroup& ACGroup, - const Graphic3d_Array1OfVertexN& ListVertex, - const Standard_Boolean ) + const Graphic3d_Array1OfVertexN& ListVertex, + const Standard_Boolean ) { - - Graphic3d_CGroup MyCGroup = ACGroup; - - Standard_Real X, Y, Z; - Standard_Real DX, DY, DZ; - - Standard_Integer i, j; - Standard_Integer Lower = ListVertex.Lower (); - Standard_Integer Upper = ListVertex.Upper (); - - CALL_DEF_TRIKE atrike; - CALL_DEF_POINTN *points; - - i = ListVertex.Length (); - - // Allocation dynamique - points = new CALL_DEF_POINTN [i]; - - atrike.NbPoints = int (i); - atrike.TypePoints = 2; - atrike.UPoints.PointsN = points; - - // Parcours des sommets - for (j=0, i=Lower; i<=Upper; i++, j++) { - ListVertex (i).Coord (X, Y, Z); - points[j].Point.x = float (X); - points[j].Point.y = float (Y); - points[j].Point.z = float (Z); - ListVertex (i).Normal (DX, DY, DZ); - points[j].Normal.dx = float (DX); - points[j].Normal.dy = float (DY); - points[j].Normal.dz = float (DZ); - } - - if (MyTraceLevel) { - PrintFunction ("call_togl_triangle"); - PrintCGroup (MyCGroup, 1); + if (ACGroup.ptrGroup) + { + OpenGl_TriangleStrip *atstrip = new OpenGl_TriangleStrip( ListVertex ); + ((OpenGl_Group *)ACGroup.ptrGroup)->AddElement( TelTriangleMesh, atstrip ); } - call_togl_triangle (&MyCGroup, &atrike); - - // Desallocation dynamique - delete [] points; - } - void OpenGl_GraphicDriver::TriangleMesh(const Graphic3d_CGroup& ACGroup, - const Graphic3d_Array1OfVertexNT& ListVertex, - const Standard_Boolean ) + const Graphic3d_Array1OfVertexNT& ListVertex, + const Standard_Boolean ) { - - Graphic3d_CGroup MyCGroup = ACGroup; - - Standard_Real X, Y, Z; - Standard_Real DX, DY, DZ; - - Standard_Integer i, j; - Standard_Integer Lower = ListVertex.Lower (); - Standard_Integer Upper = ListVertex.Upper (); - - CALL_DEF_TRIKE atrike; - CALL_DEF_POINTNT *points; - - i = ListVertex.Length (); - - // Allocation dynamique - points = new CALL_DEF_POINTNT [i]; - - atrike.NbPoints = int (i); - atrike.TypePoints = 5; - atrike.UPoints.PointsNT = points; - - // Parcours des sommets - for (j=0, i=Lower; i<=Upper; i++, j++) { - ListVertex (i).Coord (X, Y, Z); - points[j].Point.x = float (X); - points[j].Point.y = float (Y); - points[j].Point.z = float (Z); - ListVertex (i).Normal (DX, DY, DZ); - points[j].Normal.dx = float (DX); - points[j].Normal.dy = float (DY); - points[j].Normal.dz = float (DZ); - ListVertex (i).TextureCoordinate(DX,DY); - points[j].TextureCoord.tx = float(DX); - points[j].TextureCoord.ty = float(DY); - } - - if (MyTraceLevel) { - PrintFunction ("call_togl_triangle"); - PrintCGroup (MyCGroup, 1); + if (ACGroup.ptrGroup) + { + OpenGl_TriangleStrip *atstrip = new OpenGl_TriangleStrip( ListVertex ); + ((OpenGl_Group *)ACGroup.ptrGroup)->AddElement( TelTriangleMesh, atstrip ); } - call_togl_triangle (&MyCGroup, &atrike); - - // Desallocation dynamique - delete [] points; - } void OpenGl_GraphicDriver::TriangleSet (const Graphic3d_CGroup& ACGroup, - const Graphic3d_Array1OfVertex& ListVertex, - const Aspect_Array1OfEdge& ListEdge, - const Standard_Boolean ) + const Graphic3d_Array1OfVertex& ListVertex, + const Aspect_Array1OfEdge& ListEdge, + const Standard_Boolean ) { - - Graphic3d_CGroup MyCGroup = ACGroup; - - OSD_Timer theTimer; - Standard_Real seconds, CPUtime; - Standard_Integer minutes, hours; - - Standard_Integer i, j, k; - Standard_Integer Lower, Upper; - Standard_Integer OffSet; - - CALL_DEF_LISTPOINTS alpoints; - CALL_DEF_LISTEDGES aledges; - CALL_DEF_EDGE *edges; - - // Permettra une generalisation plus facile a une methode du style - // PolygonSet (ListVertex, ListEdge, Bounds). - int *integers; - CALL_DEF_LISTINTEGERS albounds; - - theTimer.Reset();theTimer.Start(); - - i = ListVertex.Length (); - j = ListEdge.Length (); - k = int (j/3); - - Lower = ListVertex.Lower (); - Upper = ListVertex.Upper (); - OffSet = Lower; - - // Allocation dynamique - edges = new CALL_DEF_EDGE [j]; - integers= new int [k]; - -#ifdef a - alpoints.NbPoints = int (i); -#else - alpoints.NbPoints = i; -#endif - alpoints.TypePoints = 1; - alpoints.UPoints.Points = (CALL_DEF_POINT *) &ListVertex (Lower); - -#ifdef a - aledges.NbEdges = int (j); -#else - aledges.NbEdges = j; -#endif - aledges.Edges = edges; - -#ifdef a - albounds.NbIntegers = int (k); -#else - albounds.NbIntegers = k; -#endif - albounds.Integers = integers; - - Lower = ListEdge.Lower (); - Upper = ListEdge.Upper (); - - // Parcours des aretes - for (j=0, i=Lower; i<=Upper; i++, j++) { -#ifdef a - edges[j].Index1 = int (ListEdge (i).FirstIndex ()-OffSet); - edges[j].Index2 = int (ListEdge (i).LastIndex ()-OffSet); - edges[j].Type = int (ListEdge (i).Type ()); -#else - edges[j].Index1 = ListEdge (i).FirstIndex ()-OffSet; - edges[j].Index2 = ListEdge (i).LastIndex ()-OffSet; - edges[j].Type = ListEdge (i).Type (); -#endif + if (ACGroup.ptrGroup) + { + OpenGl_Mesh *amesh = new OpenGl_Mesh (ListVertex, ListEdge); + ((OpenGl_Group *)ACGroup.ptrGroup)->AddElement( TelPolygonIndices, amesh ); } - - // Parcours des limites (ici toutes les limites sont egales a 3. - for (j=0; jAddElement( TelPolygonIndices, amesh ); } - - // Parcours des limites (ici toutes les limites sont egales a 3. - for (j=0; jAddElement( TelPolygonIndices, amesh ); } - - Lower = ListEdge.Lower (); - Upper = ListEdge.Upper (); - - // Parcours des aretes - for (j=0, i=Lower; i<=Upper; i++, j++) { - edges[j].Index1 = int (ListEdge (i).FirstIndex ()-OffSet); - edges[j].Index2 = int (ListEdge (i).LastIndex ()-OffSet); - edges[j].Type = int (ListEdge (i).Type ()); - } - - // Parcours des limites (ici toutes les limites sont egales a 3. - for (j=0; jAddElement( TelPolygonIndices, amesh ); } - - Lower = ListEdge.Lower (); - Upper = ListEdge.Upper (); - - // Parcours des aretes - for (j=0, i=Lower; i<=Upper; i++, j++) { - edges[j].Index1 = int (ListEdge (i).FirstIndex ()-OffSet); - edges[j].Index2 = int (ListEdge (i).LastIndex ()-OffSet); - edges[j].Type = int (ListEdge (i).Type ()); - } - - // Parcours des limites (ici toutes les limites sont egales a 3. - for (j=0; jAddElement( TelPolygonIndices, amesh ); } - - // Parcours des limites (ici toutes les limites sont egales a 3. - for (j=0; j - -#include - -#include - -//-Aliases - -//-Global data definitions - -//-Methods, in order - -void OpenGl_GraphicDriver::Bezier (const Graphic3d_CGroup& ACGroup, - const Graphic3d_Array1OfVertex& ListVertex, - const Standard_Boolean ) -{ - - Graphic3d_CGroup MyCGroup = ACGroup; - - Standard_Integer Lower = ListVertex.Lower (); - - CALL_DEF_LISTPOINTS alpoints; - - alpoints.NbPoints = int (ListVertex.Length ()); - alpoints.TypePoints = 1; - alpoints.UPoints.Points = (CALL_DEF_POINT *) &ListVertex (Lower); - - if (MyTraceLevel) { - PrintFunction ("call_togl_bezier"); - PrintCGroup (MyCGroup, 1); - } - call_togl_bezier (&MyCGroup, &alpoints); - -} - -void OpenGl_GraphicDriver::Bezier (const Graphic3d_CGroup& ACGroup, - const Graphic3d_Array1OfVertex& ListVertex, - const TColStd_Array1OfReal& ListWeight, - const Standard_Boolean ) -{ - - Graphic3d_CGroup MyCGroup = ACGroup; - - Standard_Integer i, j; - Standard_Integer Lower = ListVertex.Lower (); - Standard_Integer Upper = ListVertex.Upper (); - - CALL_DEF_LISTREALS alweights; - float *weights; - CALL_DEF_LISTPOINTS alpoints; - - j = ListWeight.Length (); - - alpoints.NbPoints = int (ListVertex.Length ()); - alpoints.TypePoints = 1; - alpoints.UPoints.Points = (CALL_DEF_POINT *) &ListVertex (Lower); - - weights = new float [j]; - alweights.NbReals = j; - alweights.Reals = weights; - - Lower = ListWeight.Lower (); - Upper = ListWeight.Upper (); - - // Parcours des poids - for (j=0, i=Lower; i<=Upper; i++, j++) - weights[j] = float (ListWeight (i)); - - if (MyTraceLevel) { - PrintFunction ("call_togl_bezier_weight"); - PrintCGroup (MyCGroup, 1); - } - call_togl_bezier_weight (&MyCGroup, &alpoints, &alweights); - - // Desallocation dynamique - delete [] weights; - -} diff --git a/src/OpenGl/OpenGl_GraphicDriver_713.cxx b/src/OpenGl/OpenGl_GraphicDriver_713.cxx index 7ace67d077..64fd7e83bb 100755 --- a/src/OpenGl/OpenGl_GraphicDriver_713.cxx +++ b/src/OpenGl/OpenGl_GraphicDriver_713.cxx @@ -1,80 +1,67 @@ -// File OpenGl_GraphicDriver_713.cxx -// Created 22-10-01 -// Author SAV +// File: OpenGl_GraphicDriver_713.cxx +// Created: 20 October 2011 +// Author: Sergey ZERCHANINOV +// Copyright: OPEN CASCADE 2011 -// SAV 09/07/02 merged with OpenGl_GraphicDriver_713.cxx created 16/06/2000 by ATS,SPK,GG : G005 -// implementation of PARRAY method +#include -#include +#include +#include +#include -#include +#include - -#include -#include - - -#define BUC61044 /* 25/10/01 SAV ; added functionality to control gl depth testing -from higher API */ -#define BUC61045 /* 25/10/01 SAV ; added functionality to control gl lighting -from higher API */ - - -void OpenGl_GraphicDriver::SetDepthTestEnabled( const Graphic3d_CView& view, - const Standard_Boolean isEnabled ) const +void OpenGl_GraphicDriver::SetDepthTestEnabled( const Graphic3d_CView& ACView, const Standard_Boolean isEnabled ) const { - -#ifdef BUC61044 - Graphic3d_CView MyCView = view; - call_togl_depthtest( &MyCView, isEnabled ); -#endif - + const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView; + if (aCView) + aCView->WS->UseDepthTest() = isEnabled; } -Standard_Boolean OpenGl_GraphicDriver -::IsDepthTestEnabled( const Graphic3d_CView& view ) const +Standard_Boolean OpenGl_GraphicDriver::IsDepthTestEnabled( const Graphic3d_CView& ACView ) const { -#ifdef BUC61044 - Graphic3d_CView MyCView = view; - return call_togl_isdepthtest (&MyCView) != 0; -#endif + const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView; + if (aCView) + return aCView->WS->UseDepthTest(); + return Standard_False; } -void OpenGl_GraphicDriver::ReadDepths( const Graphic3d_CView& view, - const Standard_Integer x, - const Standard_Integer y, - const Standard_Integer width, - const Standard_Integer height, - const Standard_Address buffer ) const +void OpenGl_GraphicDriver::ReadDepths( const Graphic3d_CView& ACView, + const Standard_Integer x, + const Standard_Integer y, + const Standard_Integer width, + const Standard_Integer height, + const Standard_Address buffer ) const { - TelReadDepths (view.WsId, x, y, width, height, (float*) buffer); + const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView; + if (aCView) + aCView->WS->ReadDepths(x, y, width, height, (float*) buffer); } -void OpenGl_GraphicDriver::SetGLLightEnabled( const Graphic3d_CView& view, - const Standard_Boolean isEnabled ) const +void OpenGl_GraphicDriver::SetGLLightEnabled( const Graphic3d_CView& ACView, const Standard_Boolean isEnabled ) const { -#ifdef BUC61045 - Graphic3d_CView MyCView = view; - call_togl_gllight( &MyCView, isEnabled ); -#endif + const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView; + if (aCView) + aCView->WS->UseGLLight() = isEnabled; } -Standard_Boolean OpenGl_GraphicDriver -::IsGLLightEnabled( const Graphic3d_CView& view ) const +Standard_Boolean OpenGl_GraphicDriver::IsGLLightEnabled( const Graphic3d_CView& ACView ) const { -#ifdef BUC61045 - Graphic3d_CView MyCView = view; - return call_togl_isgllight (&MyCView) != 0; -#endif + const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView; + if (aCView) + return aCView->WS->UseGLLight(); + return Standard_False; } -void OpenGl_GraphicDriver :: PrimitiveArray( const Graphic3d_CGroup& ACGroup, - const Graphic3d_PrimitiveArray& parray, - const Standard_Boolean EvalMinMax ) +void OpenGl_GraphicDriver::PrimitiveArray( const Graphic3d_CGroup& ACGroup, + const Graphic3d_PrimitiveArray& parray, + const Standard_Boolean EvalMinMax ) { - Graphic3d_CGroup MyCGroup = ACGroup; - - if( parray ) call_togl_parray (&MyCGroup,parray); + if ( ACGroup.ptrGroup && parray ) + { + OpenGl_PrimitiveArray *aparray = new OpenGl_PrimitiveArray( (CALL_DEF_PARRAY *) parray ); + ((OpenGl_Group *)ACGroup.ptrGroup)->AddElement( TelParray, aparray ); + } } //======================================================================= @@ -85,25 +72,30 @@ void OpenGl_GraphicDriver :: PrimitiveArray( const Graphic3d_CGroup& ACGroup, // Graphic3d_Group only. //======================================================================= -void OpenGl_GraphicDriver::RemovePrimitiveArray (const Graphic3d_CGroup& theCGroup, - const Graphic3d_PrimitiveArray& thePArray) +void OpenGl_GraphicDriver::RemovePrimitiveArray (const Graphic3d_CGroup& ACGroup, + const Graphic3d_PrimitiveArray& thePArray) { - Graphic3d_CGroup MyCGroup = theCGroup; - if (thePArray != NULL) call_togl_parray_remove (&MyCGroup, thePArray); + if ( ACGroup.ptrGroup && thePArray ) + { + ((OpenGl_Group *)ACGroup.ptrGroup)->RemovePrimitiveArray( (CALL_DEF_PARRAY *) thePArray ); + } } -void OpenGl_GraphicDriver :: UserDraw ( const Graphic3d_CGroup& ACGroup, - const Graphic3d_CUserDraw& AUserDraw ) -{ - Graphic3d_CGroup MyCGroup = ACGroup; - Graphic3d_CUserDraw MyUserDraw = AUserDraw; +static OpenGl_UserDrawCallback MyUserDrawCallback = NULL; - call_togl_userdraw (&MyCGroup,&MyUserDraw); +OpenGl_UserDrawCallback& UserDrawCallback () +{ + return MyUserDrawCallback; } -extern int VBOenabled; - -void OpenGl_GraphicDriver :: EnableVBO( const Standard_Boolean flag ) +void OpenGl_GraphicDriver::UserDraw ( const Graphic3d_CGroup& ACGroup, + const Graphic3d_CUserDraw& AUserDraw ) { - VBOenabled = flag; + if (ACGroup.ptrGroup && MyUserDrawCallback) + { + OpenGl_Element *auserdraw = (*MyUserDrawCallback)(&AUserDraw); + + if (auserdraw != 0) + ((OpenGl_Group *)ACGroup.ptrGroup)->AddElement( TelUserdraw, auserdraw ); + } } diff --git a/src/OpenGl/OpenGl_GraphicDriver_8.cxx b/src/OpenGl/OpenGl_GraphicDriver_8.cxx index 39853acc1a..4fdc04e131 100755 --- a/src/OpenGl/OpenGl_GraphicDriver_8.cxx +++ b/src/OpenGl/OpenGl_GraphicDriver_8.cxx @@ -1,242 +1,132 @@ -// File OpenGl_GraphicDriver_8.cxx -// Created Mardi 28 janvier 1997 -// Author CAL +// File: OpenGl_GraphicDriver_8.cxx +// Created: 20 October 2011 +// Author: Sergey ZERCHANINOV +// Copyright: OPEN CASCADE 2011 -//-Copyright MatraDatavision 1997 +#include -//-Version +#include +#include -//-Design Declaration des variables specifiques aux Drivers +static Handle(OpenGl_Workspace) myImmediateWS; -//-Warning Un driver encapsule les Pex et OpenGl drivers +/*----------------------------------------------------------------------*/ -//-References - -//-Language C++ 2.0 - -//-Declarations - -// for the class -#include - -#include - - -#include - -//-Aliases - -//-Global data definitions - -//-Methods, in order - - -Standard_Boolean OpenGl_GraphicDriver::BeginAddMode (const Graphic3d_CView& ACView) +Standard_Boolean OpenGl_GraphicDriver::BeginAddMode (const Graphic3d_CView& ACView) { + if (ACView.ViewId == -1) + return Standard_False; - Graphic3d_CView MyCView = ACView; - Standard_Boolean Result; - - if (MyTraceLevel) { - PrintFunction ("call_togl_begin_ajout_mode"); - PrintCView (MyCView, 1); + const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView; + if (aCView && aCView->WS->BeginAddMode()) + { + myImmediateWS = aCView->WS; + return Standard_True; } - Result = call_togl_begin_ajout_mode (&MyCView); - if (MyTraceLevel) { - PrintIResult ("call_togl_begin_ajout_mode", Result); - } - return Result; + return Standard_False; } -void OpenGl_GraphicDriver::EndAddMode (void) +void OpenGl_GraphicDriver::EndAddMode (void) { - - if (MyTraceLevel) { - PrintFunction ("call_togl_end_ajout_mode"); + if (!myImmediateWS.IsNull()) + { + myImmediateWS->EndAddMode(); + myImmediateWS.Nullify(); } - call_togl_end_ajout_mode (); - } -Standard_Boolean OpenGl_GraphicDriver::BeginImmediatMode (const Graphic3d_CView& ACView, const Aspect_CLayer2d& ACUnderLayer, const Aspect_CLayer2d& ACOverLayer, const Standard_Boolean DoubleBuffer, const Standard_Boolean RetainMode) +Standard_Boolean OpenGl_GraphicDriver::BeginImmediatMode (const Graphic3d_CView& ACView, const Aspect_CLayer2d& ACUnderLayer, const Aspect_CLayer2d& ACOverLayer, const Standard_Boolean DoubleBuffer, const Standard_Boolean RetainMode) { + if (ACView.ViewId == -1) + return Standard_False; - Graphic3d_CView MyCView = ACView; - Aspect_CLayer2d MyCUnderLayer = ACUnderLayer; - Aspect_CLayer2d MyCOverLayer = ACOverLayer; - Standard_Boolean Result; - - - if (MyTraceLevel) { - PrintFunction ("call_togl_begin_immediat_mode"); - PrintCView (MyCView, 1); - PrintBoolean ("DoubleBuffer", DoubleBuffer); - PrintBoolean ("RetainMode", RetainMode); + const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView; + if (aCView && aCView->WS->BeginImmediatMode(ACView, DoubleBuffer, RetainMode)) + { + myImmediateWS = aCView->WS; + return Standard_True; } - Result = call_togl_begin_immediat_mode - (&MyCView, &MyCUnderLayer, &MyCOverLayer, - (DoubleBuffer ? 1 : 0), (RetainMode ? 1 : 0)); - if (MyTraceLevel) { - PrintIResult ("call_togl_begin_immediat_mode", Result); - } - return Result; + return Standard_False; } -void OpenGl_GraphicDriver::BeginPolyline () +void OpenGl_GraphicDriver::BeginPolyline () { - - if (MyTraceLevel) { - PrintFunction ("call_togl_begin_polyline"); - } - call_togl_begin_polyline (); - + if (!myImmediateWS.IsNull()) + myImmediateWS->BeginPolyline(); } -void OpenGl_GraphicDriver::ClearImmediatMode (const Graphic3d_CView& ACView, - const Standard_Boolean aFlush) +void OpenGl_GraphicDriver::ClearImmediatMode (const Graphic3d_CView& ACView, const Standard_Boolean aFlush) { - - Graphic3d_CView MyCView = ACView; - - if (MyTraceLevel) { - PrintFunction ("call_togl_clear_immediat_mode"); - PrintCView (MyCView, 1); - } - call_togl_clear_immediat_mode (&MyCView, aFlush); - + const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView; + if (aCView) + aCView->WS->ClearImmediatMode(ACView,aFlush); } -void OpenGl_GraphicDriver::Draw (const Standard_ShortReal X, const Standard_ShortReal Y, const Standard_ShortReal Z) +void OpenGl_GraphicDriver::Draw (const Standard_ShortReal X, const Standard_ShortReal Y, const Standard_ShortReal Z) { - - - if (MyTraceLevel) { - PrintFunction ("call_togl_draw"); - PrintShortReal ("X", X); - PrintShortReal ("Y", Y); - PrintShortReal ("Z", Z); - } - call_togl_draw (X, Y, Z); - + if (!myImmediateWS.IsNull()) + myImmediateWS->Draw(X,Y,Z); } -void OpenGl_GraphicDriver::DrawStructure (const Graphic3d_CStructure& ACStructure) { - - Graphic3d_CStructure MyCStructure = ACStructure; - - if (MyTraceLevel) { - PrintFunction ("call_togl_draw_structure"); - PrintCStructure (MyCStructure, 1); - } - call_togl_draw_structure (ACStructure.Id); +void OpenGl_GraphicDriver::DrawStructure (const Graphic3d_CStructure& ACStructure) +{ + OpenGl_Structure *astructure = (OpenGl_Structure *)ACStructure.ptrStructure; + if (!astructure) + return; + if (!myImmediateWS.IsNull()) + myImmediateWS->DrawStructure(astructure); } -void OpenGl_GraphicDriver::EndImmediatMode (const Standard_Integer Synchronize) +void OpenGl_GraphicDriver::EndImmediatMode (const Standard_Integer Synchronize) { - - if (MyTraceLevel) { - PrintFunction ("call_togl_end_immediat_mode"); - PrintInteger ("Synchronize", Synchronize); + if (!myImmediateWS.IsNull()) + { + myImmediateWS->EndImmediatMode(); + myImmediateWS.Nullify(); } - call_togl_end_immediat_mode (int (Synchronize)); - } -void OpenGl_GraphicDriver::EndPolyline () +void OpenGl_GraphicDriver::EndPolyline () { - - if (MyTraceLevel) { - PrintFunction ("call_togl_end_polyline"); - } - call_togl_end_polyline (); - + if (!myImmediateWS.IsNull()) + myImmediateWS->EndPolyline(); } -void OpenGl_GraphicDriver::Move (const Standard_ShortReal X, const Standard_ShortReal Y, const Standard_ShortReal Z) +void OpenGl_GraphicDriver::Move (const Standard_ShortReal X, const Standard_ShortReal Y, const Standard_ShortReal Z) { - - if (MyTraceLevel) { - PrintFunction ("call_togl_move"); - PrintShortReal ("X", X); - PrintShortReal ("Y", Y); - PrintShortReal ("Z", Z); - } - call_togl_move (X, Y, Z); - + if (!myImmediateWS.IsNull()) + myImmediateWS->Move(X,Y,Z); } -void OpenGl_GraphicDriver::SetLineColor (const Standard_ShortReal R, const Standard_ShortReal G, const Standard_ShortReal B) +void OpenGl_GraphicDriver::SetLineColor (const Standard_ShortReal R, const Standard_ShortReal G, const Standard_ShortReal B) { - - if (MyTraceLevel) { - PrintFunction ("call_togl_set_linecolor"); - PrintShortReal ("R", R); - PrintShortReal ("G", G); - PrintShortReal ("B", B); - } - call_togl_set_linecolor (R, G, B); - + if (!myImmediateWS.IsNull()) + myImmediateWS->SetLineColor(R,G,B); } -void OpenGl_GraphicDriver::SetLineType (const Standard_Integer Type) +void OpenGl_GraphicDriver::SetLineType (const Standard_Integer Type) { - - if (MyTraceLevel) { - PrintFunction ("call_togl_set_linetype"); - PrintInteger ("Type", Type); - } - call_togl_set_linetype (long (Type)); - + if (!myImmediateWS.IsNull()) + myImmediateWS->SetLineType(Type); } void OpenGl_GraphicDriver::SetLineWidth (const Standard_ShortReal Width) { - - if (MyTraceLevel) { - PrintFunction ("call_togl_set_linewidth"); - PrintShortReal ("Width", Width); - } - call_togl_set_linewidth (float (Width)); - + if (!myImmediateWS.IsNull()) + myImmediateWS->SetLineWidth(Width); } void OpenGl_GraphicDriver::SetMinMax (const Standard_ShortReal X1, const Standard_ShortReal Y1, const Standard_ShortReal Z1, const Standard_ShortReal X2, const Standard_ShortReal Y2, const Standard_ShortReal Z2) { - - if (MyTraceLevel) { - PrintFunction ("call_togl_set_minmax"); - PrintShortReal ("X1", X1); - PrintShortReal ("Y1", Y1); - PrintShortReal ("Z1", Z1); - PrintShortReal ("X2", X2); - PrintShortReal ("Y2", Y2); - PrintShortReal ("Z2", Z2); - } - call_togl_set_minmax (X1, Y1, Z1, X2, Y2, Z2); - + if (!myImmediateWS.IsNull()) + myImmediateWS->SetMinMax(X1,Y1,Z1,X2,Y2,Z2); } void OpenGl_GraphicDriver::Transform (const TColStd_Array2OfReal& AMatrix, const Graphic3d_TypeOfComposition AType) { - - float theMatrix[4][4]; - Standard_Integer i, j; - Standard_Integer lr, lc; - - lr = AMatrix.LowerRow (); - lc = AMatrix.LowerCol (); - - for (i=0; i<=3; i++) - for (j=0; j<=3; j++) - theMatrix[i][j] = float (AMatrix (i+lr, j+lc)); - - if (MyTraceLevel) { - PrintFunction ("call_togl_transform"); - PrintMatrix ("AMatrix", AMatrix); - } - call_togl_transform (theMatrix, (AType == Graphic3d_TOC_REPLACE) ? 1 : 0); - + if (!myImmediateWS.IsNull()) + myImmediateWS->Transform(AMatrix,AType); } diff --git a/src/OpenGl/OpenGl_GraphicDriver_9.cxx b/src/OpenGl/OpenGl_GraphicDriver_9.cxx index 30d29a0d24..5587b7b8b4 100755 --- a/src/OpenGl/OpenGl_GraphicDriver_9.cxx +++ b/src/OpenGl/OpenGl_GraphicDriver_9.cxx @@ -1,53 +1,137 @@ -// File OpenGl_GraphicDriver_9.cxx -// Created 1/08/97 -// Author PCT -// Modified -// 16-09-98 ; BGN : Points d'entree du Triedre (S3819, Phase 1) -// 22-09-98 ; BGN : S3989 (anciennement S3819) -// TypeOfTriedron* from Aspect (pas Graphic3d) - -//-Copyright MatraDatavision 1997 - -//-Version - -//-Design Declaration des variables specifiques aux Drivers - -//-Warning Un driver encapsule les Pex et OpenGl drivers - -//-References - -//-Language C++ 2.0 - -//-Declarations +// File: OpenGl_GraphicDriver_9.cxx +// Created: 20 October 2011 +// Author: Sergey ZERCHANINOV +// Copyright: OPEN CASCADE 2011 + +#include +#include +#include +#include +#include +#include -// for the class +#include +#include +#include +#include -#define IMP131100 //GG_Enable to creates more than one texture -// with the same name. +void OpenGl_GraphicDriver::Environment(const Graphic3d_CView& ACView) +{ + const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView; + if (aCView) + { + aCView->View->SetTextureEnv(ACView.Context.TexEnvId); + aCView->View->SetSurfaceDetail((Visual3d_TypeOfSurfaceDetail)ACView.Context.SurfaceDetail); + } +} -#define OCC1188 //SAV added methods to set background image +// +// Triedron methods : the Triedron is a non-zoomable object. +// -#include +void OpenGl_GraphicDriver::ZBufferTriedronSetup ( + const Quantity_NameOfColor XColor, + const Quantity_NameOfColor YColor, + const Quantity_NameOfColor ZColor, + const Standard_Real SizeRatio, + const Standard_Real AxisDiametr, + const Standard_Integer NbFacettes) +{ + OpenGl_Trihedron::Setup(XColor,YColor,ZColor,SizeRatio,AxisDiametr,NbFacettes); +} -#include -#include -#include -#include +void OpenGl_GraphicDriver::TriedronDisplay ( + const Graphic3d_CView& ACView, + const Aspect_TypeOfTriedronPosition APosition, + const Quantity_NameOfColor AColor, + const Standard_Real AScale, + const Standard_Boolean AsWireframe ) +{ + const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView; + if (aCView) + { + aCView->View->TriedronDisplay(APosition, AColor, AScale, AsWireframe); + aCView->WS->Invalidate(); + } +} -#include +void OpenGl_GraphicDriver::TriedronErase (const Graphic3d_CView& ACView) +{ + const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView; + if (aCView) + { + aCView->View->TriedronErase(); + aCView->WS->Invalidate(); + } +} -#include -#include +void OpenGl_GraphicDriver::TriedronEcho (const Graphic3d_CView& ACView,const Aspect_TypeOfTriedronEcho AType ) +{ + // Do nothing +} +void OpenGl_GraphicDriver::BackgroundImage( const Standard_CString FileName, + const Graphic3d_CView& ACView, + const Aspect_FillMethod FillStyle ) +{ + const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView; + if (aCView) + { + aCView->View->CreateBackgroundTexture( FileName, FillStyle ); + aCView->WS->Invalidate(); + } +} -#include +void OpenGl_GraphicDriver::SetBgImageStyle( const Graphic3d_CView& ACView, + const Aspect_FillMethod FillStyle ) +{ + const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView; + if (aCView) + { + aCView->View->SetBackgroundTextureStyle( FillStyle ); + aCView->WS->Invalidate(); + } +} +void OpenGl_GraphicDriver::SetBgGradientStyle(const Graphic3d_CView& ACView,const Aspect_GradientFillMethod FillType) +{ + const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView; + if (aCView) + { + aCView->View->SetBackgroundGradientType(FillType); + aCView->WS->Invalidate(); + } +} -//-Aliases +void OpenGl_GraphicDriver::GraduatedTrihedronDisplay(const Graphic3d_CView& ACView, const Graphic3d_CGraduatedTrihedron& cubic) +{ + const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView; + if (aCView) + { + aCView->View->GraduatedTrihedronDisplay(cubic); + aCView->WS->Invalidate(); + } +} -//-Global data definitions +void OpenGl_GraphicDriver::GraduatedTrihedronErase(const Graphic3d_CView& ACView) +{ + const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView; + if (aCView) + { + aCView->View->GraduatedTrihedronErase(); + aCView->WS->Invalidate(); + } +} -//-Methods, in order +void OpenGl_GraphicDriver::GraduatedTrihedronMinMaxValues(const Standard_ShortReal xmin, + const Standard_ShortReal ymin, + const Standard_ShortReal zmin, + const Standard_ShortReal xmax, + const Standard_ShortReal ymax, + const Standard_ShortReal zmax) +{ + OpenGl_GraduatedTrihedron::SetMinMax(xmin, ymin, zmin, xmax, ymax, zmax); +} // Helper function, returns the nearest power of two greater than the argument value inline Standard_Integer GetNearestPow2(Standard_Integer theValue) @@ -59,13 +143,13 @@ inline Standard_Integer GetNearestPow2(Standard_Integer theValue) return aRes; } -Standard_Integer OpenGl_GraphicDriver::CreateTexture(const Graphic3d_TypeOfTexture Type,const Handle_AlienImage_AlienImage &Image,const Standard_CString FileName,const Handle(TColStd_HArray1OfReal)& TexUpperBounds) const +Standard_Integer OpenGl_GraphicDriver::CreateTexture (const Graphic3d_TypeOfTexture Type, + const Handle_AlienImage_AlienImage &Image, + const Standard_CString FileName, + const Handle(TColStd_HArray1OfReal)& TexUpperBounds) const { - // transmutation de l'image en un bon tableau RGBA pour la toolkit des textures - // lamentable d'un point de vue vitesse... Handle(Image_Image) MyPic = Image->ToImage(); - //TODO: The temporary fix in order to make AIS_TexturedShape work. To be improved in next release. Standard_Integer aGlWidth = (Type == Graphic3d_TOT_2D_MIPMAP) ? MyPic->Width() : GetNearestPow2(MyPic->Width()); Standard_Integer aGlHeight = (Type == Graphic3d_TOT_2D_MIPMAP) ? MyPic->Height() : GetNearestPow2(MyPic->Height()); @@ -81,15 +165,10 @@ Standard_Integer OpenGl_GraphicDriver::CreateTexture(const Graphic3d_TypeOfTextu if (MyImageData == NULL) return -1; -#ifdef IMP131100 - static Standard_Integer textureRank=0; char textureName[16]; Standard_PCharacter fileName = textureName; sprintf(fileName,"Tex%d",++textureRank); -#else - Standard_CString fileName = FileName -#endif for (j = MyPic->Height() - 1; j >= 0; j--) for (i = 0; i < aGlWidth; i++){ @@ -150,141 +229,3 @@ void OpenGl_GraphicDriver::ModifyTexture(const Standard_Integer TexId,const Grap { call_togl_modify_texture(TexId, (CALL_DEF_INIT_TEXTURE *)&AValue); } - - - - -void OpenGl_GraphicDriver::Environment(const Graphic3d_CView& ACView) -{ - call_togl_environment((CALL_DEF_VIEW *)&ACView); -} - - -// -// Triedron methods : the Triedron is a non-zoomable object. -// - -void OpenGl_GraphicDriver::ZBufferTriedronSetup ( - const Quantity_NameOfColor XColor, - const Quantity_NameOfColor YColor, - const Quantity_NameOfColor ZColor, - const Standard_Real SizeRatio, - const Standard_Real AxisDiametr, - const Standard_Integer NbFacettes) -{ - float Xrgb[3]; - float Yrgb[3]; - float Zrgb[3]; - Standard_Real R,G,B; - Quantity_Color(XColor).Values(R, G, B, Quantity_TOC_RGB); - Xrgb[0] = float (R); - Xrgb[1] = float (G); - Xrgb[2] = float (B); - Quantity_Color(YColor).Values(R, G, B, Quantity_TOC_RGB); - Yrgb[0] = float (R); - Yrgb[1] = float (G); - Yrgb[2] = float (B); - Quantity_Color(ZColor).Values(R, G, B, Quantity_TOC_RGB); - Zrgb[0] = float (R); - Zrgb[1] = float (G); - Zrgb[2] = float (B); - - call_togl_ztriedron_setup(Xrgb, Yrgb, Zrgb, - (Standard_ShortReal)(SizeRatio), (Standard_ShortReal)(AxisDiametr), NbFacettes); -} - -void OpenGl_GraphicDriver::TriedronDisplay ( - const Graphic3d_CView& ACView, - const Aspect_TypeOfTriedronPosition APosition, - const Quantity_NameOfColor AColor, - const Standard_Real AScale, - const Standard_Boolean AsWireframe ) -{ - Standard_Real R,G,B; - float r,g,b; - Quantity_Color Color(AColor); - Color.Values(R,G,B,Quantity_TOC_RGB); - r = float (R); - g = float (G); - b = float (B); - - call_togl_triedron_display((CALL_DEF_VIEW *)&ACView,(int)APosition, r,g,b, (float)AScale, AsWireframe); -} - -void OpenGl_GraphicDriver::TriedronErase (const Graphic3d_CView& ACView) -{ - call_togl_triedron_erase((CALL_DEF_VIEW *)&ACView); -} - -void OpenGl_GraphicDriver::TriedronEcho (const Graphic3d_CView& ACView,const Aspect_TypeOfTriedronEcho AType ) -{ - call_togl_triedron_echo( (CALL_DEF_VIEW *)&ACView,AType ); -} - -void OpenGl_GraphicDriver::BackgroundImage( const Standard_CString FileName, - const Graphic3d_CView& ACView, - const Aspect_FillMethod FillStyle ) -{ -#ifdef OCC1188 - Graphic3d_CView MyCView = ACView; - Standard_Integer width, height; - Handle(Image_Image) image; - - Standard_Boolean result = AlienImage::LoadImageFile( FileName, image, width, height ); - - if ( result ) { - unsigned char *data = (unsigned char*)malloc( width * height * 3 ); - unsigned char *pdata = data; - Standard_Integer i,j; - Quantity_Color color; - - if ( data != NULL ) { - for ( j = height - 1; j >= 0; j-- ) - for ( i = 0; i < width; i++ ) { - color = image->PixelColor( i, j ); - *pdata++ = (int)( 255 * color.Red() ); - *pdata++ = (int)( 255 * color.Green() ); - *pdata++ = (int)( 255 * color.Blue() ); - } - call_togl_create_bg_texture( (CALL_DEF_VIEW*)&MyCView, width, height, data, (int)FillStyle ); - // delete data here - free( data ); - } - } -#endif // OCC1188 -} - -void OpenGl_GraphicDriver::SetBgImageStyle( const Graphic3d_CView& ACView, - const Aspect_FillMethod FillStyle ) -{ -#ifdef OCC1188 - Graphic3d_CView MyCView = ACView; - call_togl_set_bg_texture_style( (CALL_DEF_VIEW*)&MyCView, (int)FillStyle ); -#endif //OCC1188 -} - -void OpenGl_GraphicDriver::SetBgGradientStyle(const Graphic3d_CView& ACView,const Aspect_GradientFillMethod FillType) -{ - call_togl_set_gradient_type( ACView.WsId, FillType); -} - -void OpenGl_GraphicDriver::GraduatedTrihedronDisplay(const Graphic3d_CView& view, - const Graphic3d_CGraduatedTrihedron& cubic) -{ - call_togl_graduatedtrihedron_display((CALL_DEF_VIEW*)&view, cubic); -} - -void OpenGl_GraphicDriver::GraduatedTrihedronErase(const Graphic3d_CView& view) -{ - call_togl_graduatedtrihedron_erase((CALL_DEF_VIEW*)&view); -} - -void OpenGl_GraphicDriver::GraduatedTrihedronMinMaxValues(const Standard_ShortReal xmin, - const Standard_ShortReal ymin, - const Standard_ShortReal zmin, - const Standard_ShortReal xmax, - const Standard_ShortReal ymax, - const Standard_ShortReal zmax) -{ - call_togl_graduatedtrihedron_minmaxvalues(xmin, ymin, zmin, xmax, ymax, zmax); -} \ No newline at end of file diff --git a/src/OpenGl/OpenGl_GraphicDriver_Export.cxx b/src/OpenGl/OpenGl_GraphicDriver_Export.cxx index fd3c319528..75945000a4 100755 --- a/src/OpenGl/OpenGl_GraphicDriver_Export.cxx +++ b/src/OpenGl/OpenGl_GraphicDriver_Export.cxx @@ -2,7 +2,7 @@ /* Includes */ /************************************************************************/ -#include +#include #include #ifdef HAVE_GL2PS diff --git a/src/OpenGl/OpenGl_GraphicDriver_Layer.cxx b/src/OpenGl/OpenGl_GraphicDriver_Layer.cxx index b00046b77d..3b263d9954 100755 --- a/src/OpenGl/OpenGl_GraphicDriver_Layer.cxx +++ b/src/OpenGl/OpenGl_GraphicDriver_Layer.cxx @@ -1,229 +1,331 @@ +// File: OpenGl_GraphicDriver_Layer.cxx +// Created: 20 October 2011 +// Author: Sergey ZERCHANINOV +// Copyright: OPEN CASCADE 2011 -// File OpenGl_GraphicDriver_Layer.cxx -// Created Mardi 3 novembre 1998 -// Author CAL +#include -//-Copyright MatraDatavision 1998 +#include -//-Version +#include -//-Design Declaration des variables specifiques aux Drivers +#include +#include +#include -//-Warning Un driver encapsule les Pex et OpenGl drivers +/*----------------------------------------------------------------------*/ -//-References - -//-Language C++ 2.0 +struct OpenGl_LAYER_PROP +{ + int ListId; -//-Declarations + TEL_COLOUR Color; + int NbPoints; + int LineType; + float LineWidth; + int FontCurrent; -// for the class -#include + Standard_Boolean FontChanged; -#include + OpenGl_AspectText AspectText; + OpenGl_TextParam TextParam; +}; -#include +/*----------------------------------------------------------------------*/ -//-Aliases -#define NO_DEBUG +static const TEL_COLOUR myDefaultColor = {{ 1.F, 1.F, 1.F, 1.F }}; +static const CALL_DEF_CONTEXTTEXT myDefaultContextText = +{ + 1, //IsDef + 1, //IsSet + "Courier", //Font + 0.3F, //Space + 1.F, //Expan + { 1.F, 1.F, 1.F }, //Color + (int)Aspect_TOST_NORMAL, //Style + (int)Aspect_TODT_NORMAL, //DisplayType + { 1.F, 1.F, 1.F }, //ColorSubTitle + 0, //TextZoomable + 0.F, //TextAngle + (int)OSD_FA_Regular //TextFontAspect +}; + +static Standard_Boolean TheLayerIsOpen = Standard_False; +static OpenGl_LAYER_PROP TheLayerProp; + +/*----------------------------------------------------------------------*/ + +void InitLayerProp (const int AListId) +{ + TheLayerProp.ListId = AListId; -//-Global data definitions + if (AListId) + { + TheLayerProp.Color = myDefaultColor; + TheLayerProp.NbPoints = 0; + TheLayerProp.LineType = -1; + TheLayerProp.LineWidth = -1.F; + TheLayerProp.FontCurrent = 0; -//-Methods, in order + TheLayerProp.FontChanged = Standard_False; -void OpenGl_GraphicDriver::Layer (Aspect_CLayer2d& ACLayer) { - Aspect_CLayer2d MyCLayer = ACLayer; + TheLayerProp.AspectText.SetContext(myDefaultContextText); - if (MyTraceLevel) { - PrintFunction ("call_togl_layer2d"); - PrintInteger ("ALayerType", int (ACLayer.layerType)); - } - call_togl_layer2d (&MyCLayer); - ACLayer = MyCLayer; -#ifdef DEBUG - cout << "OpenGl_GraphicDriver::Layer" << endl; - call_def_ptrLayer ptrLayer; - ptrLayer = (call_def_ptrLayer) MyCLayer.ptrLayer; - if (ptrLayer == NULL) - cout << "\tptrLayer == NULL" << endl; - else - cout << "\tptrLayer->listIndex = " << ptrLayer->listIndex << endl; -#endif -} - -void OpenGl_GraphicDriver::RemoveLayer (const Aspect_CLayer2d& ACLayer) { - Aspect_CLayer2d MyCLayer = ACLayer; - - if (MyTraceLevel) { - PrintFunction ("call_togl_removelayer2d"); - PrintInteger ("ALayerType", int (ACLayer.layerType)); + TheLayerProp.TextParam.Height = -1; + TheLayerProp.TextParam.HAlign = Graphic3d_HTA_LEFT; + TheLayerProp.TextParam.VAlign = Graphic3d_VTA_BOTTOM; } - call_togl_removelayer2d (&MyCLayer); } -void OpenGl_GraphicDriver::BeginLayer (const Aspect_CLayer2d& ACLayer) { - Aspect_CLayer2d MyCLayer = ACLayer; +/*----------------------------------------------------------------------*/ - if (MyTraceLevel) { - PrintFunction ("call_togl_begin_layer2d"); - PrintInteger ("ALayerType", int (ACLayer.layerType)); - } - call_togl_begin_layer2d (&MyCLayer); +void OpenGl_GraphicDriver::Layer (Aspect_CLayer2d& ACLayer) +{ + ACLayer.ptrLayer = (call_def_ptrLayer) malloc (sizeof (CALL_DEF_PTRLAYER)); + ACLayer.ptrLayer->listIndex = glGenLists(1); } -void OpenGl_GraphicDriver::BeginPolygon2d () { - if (MyTraceLevel) { - PrintFunction ("call_togl_begin_polygon2d"); - } - call_togl_begin_polygon2d (); +/*----------------------------------------------------------------------*/ + +void OpenGl_GraphicDriver::RemoveLayer (const Aspect_CLayer2d& ACLayer) +{ + if (!ACLayer.ptrLayer) return; + if (!ACLayer.ptrLayer->listIndex) return; + if (TheLayerProp.ListId == ACLayer.ptrLayer->listIndex) + EndLayer(); + glDeleteLists (ACLayer.ptrLayer->listIndex, 1); + ACLayer.ptrLayer->listIndex = 0; + //szvgl: memory leak here? + //free ( ACLayer.ptrLayer ); + //ACLayer.ptrLayer = NULL; } -void OpenGl_GraphicDriver::BeginPolyline2d () { - if (MyTraceLevel) { - PrintFunction ("call_togl_begin_polyline2d"); - } - call_togl_begin_polyline2d (); +/*----------------------------------------------------------------------*/ + +void OpenGl_GraphicDriver::BeginLayer (const Aspect_CLayer2d& ACLayer) +{ + call_def_ptrLayer ptrLayer = (call_def_ptrLayer) ACLayer.ptrLayer; + if (!ptrLayer) return; + + InitLayerProp(ptrLayer->listIndex); + if (!TheLayerProp.ListId) return; + + glEnable(GL_TEXTURE_2D); + //GLboolean stat = glIsEnabled( GL_TEXTURE_2D ); + + glNewList (TheLayerProp.ListId, GL_COMPILE); + TheLayerIsOpen = Standard_True; } -void OpenGl_GraphicDriver::ClearLayer (const Aspect_CLayer2d& ACLayer) { - Aspect_CLayer2d MyCLayer = ACLayer; +void OpenGl_GraphicDriver::BeginPolygon2d () +{ + if (!TheLayerProp.ListId) return; + TheLayerProp.NbPoints = 0; + glBegin (GL_POLYGON); +} - if (MyTraceLevel) { - PrintFunction ("call_togl_clear_layer2d"); - PrintInteger ("ALayerType", int (ACLayer.layerType)); - } - call_togl_clear_layer2d (&MyCLayer); +void OpenGl_GraphicDriver::BeginPolyline2d () +{ + if (!TheLayerProp.ListId) return; + TheLayerProp.NbPoints = 0; + glBegin (GL_LINE_STRIP); } -void OpenGl_GraphicDriver::Draw (const Standard_ShortReal X, const Standard_ShortReal Y) { - if (MyTraceLevel) { - PrintFunction ("call_togl_draw2d"); - PrintShortReal ("X", X); - PrintShortReal ("Y", Y); - } - call_togl_draw2d (X, Y); +void OpenGl_GraphicDriver::ClearLayer (const Aspect_CLayer2d& ACLayer) +{ + if (!ACLayer.ptrLayer) return; + + InitLayerProp(ACLayer.ptrLayer->listIndex); + if (!TheLayerProp.ListId) return; + + glNewList (TheLayerProp.ListId, GL_COMPILE); + glEndList (); } -void OpenGl_GraphicDriver::Edge (const Standard_ShortReal X, const Standard_ShortReal Y) { - if (MyTraceLevel) { - PrintFunction ("call_togl_edge2d"); - PrintShortReal ("X", X); - PrintShortReal ("Y", Y); - } - call_togl_edge2d (X, Y); +void OpenGl_GraphicDriver::Draw (const Standard_ShortReal X, const Standard_ShortReal Y) +{ + if (!TheLayerProp.ListId) return; + TheLayerProp.NbPoints++; + glVertex3f (X, Y, 0.F); } -void OpenGl_GraphicDriver::EndLayer () { - if (MyTraceLevel) { - PrintFunction ("call_togl_end_layer2d"); - } - call_togl_end_layer2d (); +void OpenGl_GraphicDriver::Edge (const Standard_ShortReal X, const Standard_ShortReal Y) +{ + if (!TheLayerProp.ListId) return; + TheLayerProp.NbPoints++; + glVertex3f (X, Y, 0.F); } -void OpenGl_GraphicDriver::EndPolygon2d () { - if (MyTraceLevel) { - PrintFunction ("call_togl_end_polygon2d"); +void OpenGl_GraphicDriver::EndLayer () +{ + if (!TheLayerProp.ListId) return; + if (TheLayerIsOpen) + { + glEndList(); + TheLayerIsOpen = Standard_False; } - call_togl_end_polygon2d (); + TheLayerProp.ListId = 0; } -void OpenGl_GraphicDriver::EndPolyline2d () { - if (MyTraceLevel) { - PrintFunction ("call_togl_end_polyline2d"); - } - call_togl_end_polyline2d (); +void OpenGl_GraphicDriver::EndPolygon2d () +{ + if (!TheLayerProp.ListId) return; + glEnd (); } -void OpenGl_GraphicDriver::Move (const Standard_ShortReal X, const Standard_ShortReal Y) { - if (MyTraceLevel) { - PrintFunction ("call_togl_move2d"); - PrintShortReal ("X", X); - PrintShortReal ("Y", Y); - } - call_togl_move2d (X, Y); +void OpenGl_GraphicDriver::EndPolyline2d () +{ + if (!TheLayerProp.ListId) return; + glEnd (); } -void OpenGl_GraphicDriver::Rectangle (const Standard_ShortReal X, const Standard_ShortReal Y, const Standard_ShortReal Width, const Standard_ShortReal Height) { - if (MyTraceLevel) { - PrintFunction ("call_togl_rectangle2d"); - PrintShortReal ("X", X); - PrintShortReal ("Y", Y); - PrintShortReal ("Width", Width); - PrintShortReal ("Height", Height); +void OpenGl_GraphicDriver::Move (const Standard_ShortReal X, const Standard_ShortReal Y) +{ + if (!TheLayerProp.ListId) return; + if (TheLayerProp.NbPoints) + { + glEnd (); + TheLayerProp.NbPoints = 0; + glBegin (GL_LINE_STRIP); } - call_togl_rectangle2d (X, Y, Width, Height); + TheLayerProp.NbPoints++; + glVertex3f (X, Y, 0.F); } -void OpenGl_GraphicDriver::SetColor (const Standard_ShortReal R, const Standard_ShortReal G, const Standard_ShortReal B) { - if (MyTraceLevel) { - PrintFunction ("call_togl_set_color"); - PrintShortReal ("R", R); - PrintShortReal ("G", G); - PrintShortReal ("B", B); - } - call_togl_set_color (R, G, B); +void OpenGl_GraphicDriver::Rectangle (const Standard_ShortReal X, const Standard_ShortReal Y, const Standard_ShortReal Width, const Standard_ShortReal Height) +{ + if (!TheLayerProp.ListId) return; + glRectf (X, Y, X + Width, Y + Height); } -void OpenGl_GraphicDriver::SetTransparency (const Standard_ShortReal ATransparency) { - if (MyTraceLevel) { - PrintFunction ("call_togl_set_transparency"); - PrintShortReal ("Transparency", ATransparency); - } - call_togl_set_transparency (ATransparency); +void OpenGl_GraphicDriver::SetColor (const Standard_ShortReal R, const Standard_ShortReal G, const Standard_ShortReal B) +{ + if (!TheLayerProp.ListId) return; + TheLayerProp.Color.rgb[0] = R; + TheLayerProp.Color.rgb[1] = G; + TheLayerProp.Color.rgb[2] = B; + glColor3fv (TheLayerProp.Color.rgb); } -void OpenGl_GraphicDriver::UnsetTransparency () { - if (MyTraceLevel) { - PrintFunction ("call_togl_unset_transparency"); - } - call_togl_unset_transparency (); +void OpenGl_GraphicDriver::SetTransparency (const Standard_ShortReal ATransparency) +{ + if (!TheLayerProp.ListId) return; + TheLayerProp.Color.rgb[3] = ATransparency; + glEnable (GL_BLEND); + glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glColor4fv (TheLayerProp.Color.rgb); +} + +void OpenGl_GraphicDriver::UnsetTransparency () +{ + if (!TheLayerProp.ListId) return; + TheLayerProp.Color.rgb[3] = 1.F; + glDisable (GL_BLEND); } -void OpenGl_GraphicDriver::SetLineAttributes (const Standard_Integer Type, const Standard_ShortReal Width) { - if (MyTraceLevel) { - PrintFunction ("call_togl_set_line_attributes"); - PrintInteger ("Type", Type); - PrintShortReal ("Width", Width); +void OpenGl_GraphicDriver::SetLineAttributes (const Standard_Integer Type, const Standard_ShortReal Width) +{ + if (!TheLayerProp.ListId || openglDisplay.IsNull()) return; + + if (TheLayerProp.LineType != Type) + { + TheLayerProp.LineType = Type; + openglDisplay->SetTypeOfLine((Aspect_TypeOfLine) Type); + } + if (TheLayerProp.LineWidth != Width) + { + TheLayerProp.LineWidth = Width; + glLineWidth ((GLfloat) Width); } - call_togl_set_line_attributes (Type, Width); } -void OpenGl_GraphicDriver::SetTextAttributes (const Standard_CString Font, const Standard_Integer AType, const Standard_ShortReal R, const Standard_ShortReal G, const Standard_ShortReal B) { - if (MyTraceLevel) { - PrintFunction ("call_togl_set_text_attributes"); - PrintString ("Font", Font); - PrintInteger ("Type", AType); - PrintShortReal ("R", R); - PrintShortReal ("G", G); - PrintShortReal ("B", B); +void OpenGl_GraphicDriver::SetTextAttributes (const Standard_CString Font, const Standard_Integer AType, const Standard_ShortReal R, const Standard_ShortReal G, const Standard_ShortReal B) +{ + if (!TheLayerProp.ListId || openglDisplay.IsNull()) return; + + if ( strcmp ( TheLayerProp.AspectText.Font(), Font ) != 0 || + (int)TheLayerProp.AspectText.DisplayType() != AType ) + { + CALL_DEF_CONTEXTTEXT aContextText = myDefaultContextText; + + aContextText.Font = (char*)Font; + aContextText.DisplayType = AType; + aContextText.Color.r = R; + aContextText.Color.g = G; + aContextText.Color.b = B; + TheLayerProp.AspectText.SetContext(aContextText); + + TheLayerProp.FontCurrent = openglDisplay->FindFont(TheLayerProp.AspectText.Font(), TheLayerProp.AspectText.FontAspect(), TheLayerProp.TextParam.Height); + + TheLayerProp.FontChanged = Standard_True; } - call_togl_set_text_attributes ((Tchar*)Font, AType, R, G, B); -} +} -void OpenGl_GraphicDriver::Text (const Standard_CString AText, const Standard_ShortReal X, const Standard_ShortReal Y, const Standard_ShortReal Height) +void OpenGl_GraphicDriver::Text (const Standard_CString AText, const Standard_ShortReal X, const Standard_ShortReal Y, const Standard_ShortReal AHeight) { - if (MyTraceLevel) { - PrintFunction ("call_togl_text2d"); - PrintString ("Text", AText); - PrintShortReal ("X", X); - PrintShortReal ("Y", Y); - PrintShortReal ("Height", Height); + if (!TheLayerProp.ListId || openglDisplay.IsNull()) return; + + const Standard_ShortReal height = (AHeight < 0)? DefaultTextHeight() : AHeight; + + if ( TheLayerProp.TextParam.Height != height || TheLayerProp.FontChanged || TheLayerProp.FontCurrent == 0 ) + { + TheLayerProp.TextParam.Height = (int )height; + TheLayerProp.FontCurrent = openglDisplay->FindFont(TheLayerProp.AspectText.Font(), TheLayerProp.AspectText.FontAspect(), (int )height); + TheLayerProp.FontChanged = Standard_False; } - const Standard_ShortReal h = (Height < 0)? DefaultTextHeight() : Height; + TCollection_ExtendedString estr(AText); - call_togl_text2d ((Techar *)estr.ToExtString(), X, Y, h); + const Techar *s = (const Techar *)estr.ToExtString(); + + //szv: conversion of Techar to wchar_t + wchar_t *s1 = (wchar_t*)s; + if (sizeof(Techar) != sizeof(wchar_t)) + { + Tint i = 0; while (s[i++]); + s1 = new wchar_t[i]; + i = 0; while (s1[i++] = (wchar_t)(*s++)); + } + + openglDisplay->RenderText(s1, 1, (float)X, (float)Y, 0.F, &TheLayerProp.AspectText, &TheLayerProp.TextParam); + + //szv: delete temporary wide string + if (sizeof(Techar) != sizeof(wchar_t)) + delete[] s1; } void OpenGl_GraphicDriver::TextSize (const Standard_CString AText, const Standard_ShortReal AHeight, Standard_ShortReal& AWidth, Standard_ShortReal& AnAscent, Standard_ShortReal& ADescent) const { + if (!TheLayerProp.ListId || openglDisplay.IsNull()) return; + + const Standard_ShortReal height = (AHeight < 0)? DefaultTextHeight() : AHeight; + + if ( TheLayerProp.TextParam.Height != height || TheLayerProp.FontChanged || TheLayerProp.FontCurrent == 0 ) + { + TheLayerProp.TextParam.Height = (int )height; + TheLayerProp.FontCurrent = openglDisplay->FindFont(TheLayerProp.AspectText.Font(), TheLayerProp.AspectText.FontAspect(), (int )height); + TheLayerProp.FontChanged = Standard_False; + } + TCollection_ExtendedString estr(AText); - call_togl_textsize2d ((Techar *)estr.ToExtString(), AHeight, &AWidth, &AnAscent, &ADescent); - if (MyTraceLevel) { - PrintFunction ("call_togl_textsize2d"); - PrintString ("Text", AText); - PrintShortReal ("AHeight", AHeight); - PrintShortReal ("AWidth", AWidth); - PrintShortReal ("AnAscent", AnAscent); - PrintShortReal ("ADescent", ADescent); + const Techar *s = (const Techar *)estr.ToExtString(); + + //szv: conversion of Techar to wchar_t + wchar_t *s1 = (wchar_t*)s; + if (sizeof(Techar) != sizeof(wchar_t)) + { + Tint i = 0; while (s[i++]); + s1 = new wchar_t[i]; + i = 0; while (s1[i++] = (wchar_t)(*s++)); } + + int aWidth = 0, anAscent = 0, aDescent = 0; + openglDisplay->StringSize(s1, aWidth, anAscent, aDescent); + + //szv: delete temporary wide string + if (sizeof(Techar) != sizeof(wchar_t)) + delete[] s1; + + AWidth = (Standard_ShortReal) aWidth; + AnAscent = (Standard_ShortReal) anAscent; + ADescent = (Standard_ShortReal) aDescent; } diff --git a/src/OpenGl/OpenGl_GraphicDriver_print.cxx b/src/OpenGl/OpenGl_GraphicDriver_print.cxx index ef1646a603..bcbbb93a34 100755 --- a/src/OpenGl/OpenGl_GraphicDriver_print.cxx +++ b/src/OpenGl/OpenGl_GraphicDriver_print.cxx @@ -1,22 +1,12 @@ -// File OpenGl_GraphicDriver_print.c -// Created March 2000 -// Author THA -// e-mail t-hartl@muenchen.matra-dtv.fr +// File: OpenGl_GraphicDriver_print.cxx +// Created: 20 October 2011 +// Author: Sergey ZERCHANINOV +// Copyright: OPEN CASCADE 2011 -/************************************************************************/ -/* Includes */ -/************************************************************************/ +#include -#include -#include #include - -#include - - -/************************************************************************/ -/* Print Methods */ -/************************************************************************/ +#include Standard_Boolean OpenGl_GraphicDriver::Print (const Graphic3d_CView& ACView, @@ -28,22 +18,12 @@ Standard_Boolean OpenGl_GraphicDriver::Print const Aspect_PrintAlgo printAlgorithm, const Standard_Real theScaleFactor) const { - #ifdef WNT - Graphic3d_CView MyCView = ACView; - Aspect_CLayer2d MyCUnderLayer = ACUnderLayer; - Aspect_CLayer2d MyCOverLayer = ACOverLayer; - - if (MyTraceLevel) { - PrintFunction ("call_togl_print"); - PrintCView (MyCView, 1); - } - return call_togl_print (&MyCView, &MyCUnderLayer, &MyCOverLayer, - hPrintDC, (int)showBackground, filename, - (int)printAlgorithm, (float)theScaleFactor); + const OpenGl_CView *aCView = (const OpenGl_CView *)ACView.ptrView; + if (aCView) + return aCView->WS->Print(ACView,ACUnderLayer,ACOverLayer,hPrintDC,showBackground,filename,printAlgorithm,theScaleFactor); #else - Standard_NotImplemented::Raise ("OpenGl_GraphicDriver::Print is implemented " - "only on Windows"); - return Standard_False; + Standard_NotImplemented::Raise ("OpenGl_GraphicDriver::Print is implemented only on Windows"); #endif + return Standard_False; } diff --git a/src/OpenGl/OpenGl_Group.cxx b/src/OpenGl/OpenGl_Group.cxx new file mode 100644 index 0000000000..c54e15383b --- /dev/null +++ b/src/OpenGl/OpenGl_Group.cxx @@ -0,0 +1,282 @@ +// File: OpenGl_Group.cxx +// Created: 1 August 2011 +// Author: Sergey ZERCHANINOV +// Copyright: OPEN CASCADE 2011 + +#include + +#include +#include + +/*----------------------------------------------------------------------*/ + +OpenGl_Group::OpenGl_Group () +: myAspectLine(NULL), + myAspectFace(NULL), + myAspectMarker(NULL), + myAspectText(NULL), + myFirst(NULL), myLast(NULL) +{ +} + +OpenGl_Group::~OpenGl_Group() +{ + Clear(); +} + +/*----------------------------------------------------------------------*/ + +void OpenGl_Group::SetAspectLine (const CALL_DEF_CONTEXTLINE& theContext, + const Standard_Boolean theIsGlobal) +{ + if (theIsGlobal || myFirst == NULL) + { + if (myAspectLine == NULL) + myAspectLine = new OpenGl_AspectLine(); + myAspectLine->SetContext (theContext); + } + else + { + OpenGl_AspectLine* anAspectLine = new OpenGl_AspectLine(); + anAspectLine->SetContext (theContext); + AddElement (TelNil/*TelAspectLine*/, anAspectLine); + } +} + +/*----------------------------------------------------------------------*/ + +void OpenGl_Group::SetAspectFace (const CALL_DEF_CONTEXTFILLAREA& theContext, + const Standard_Boolean theIsGlobal) +{ + if (theIsGlobal || myFirst == NULL) + { + if (myAspectFace == NULL) + myAspectFace = new OpenGl_AspectFace(); + myAspectFace->SetContext (theContext); + } + else + { + OpenGl_AspectFace* anAspectFace = new OpenGl_AspectFace(); + anAspectFace->SetContext (theContext); + AddElement (TelNil/*TelAspectFace*/, anAspectFace); + } +} + +/*----------------------------------------------------------------------*/ + +void OpenGl_Group::SetAspectMarker (const CALL_DEF_CONTEXTMARKER& theContext, + const Standard_Boolean theIsGlobal) +{ + if (theIsGlobal || myFirst == NULL) + { + if (myAspectMarker == NULL) + myAspectMarker = new OpenGl_AspectMarker(); + myAspectMarker->SetContext (theContext); + } + else + { + OpenGl_AspectMarker* anAspectMarker = new OpenGl_AspectMarker(); + anAspectMarker->SetContext (theContext); + AddElement (TelNil/*TelAspectMarker*/, anAspectMarker); + } +} + +/*----------------------------------------------------------------------*/ + +void OpenGl_Group::SetAspectText (const CALL_DEF_CONTEXTTEXT& theContext, + const Standard_Boolean theIsGlobal) +{ + if (theIsGlobal || myFirst == NULL) + { + if (myAspectText == NULL) + myAspectText = new OpenGl_AspectText(); + myAspectText->SetContext (theContext); + } + else + { + OpenGl_AspectText* anAspectText = new OpenGl_AspectText(); + anAspectText->SetContext (theContext); + AddElement ( TelNil/*TelAspectText*/, anAspectText); + } +} + +/*----------------------------------------------------------------------*/ + +void OpenGl_Group::AddElement (const TelType AType, OpenGl_Element *AElem ) +{ + OpenGl_ElementNode *node = new OpenGl_ElementNode(); + + node->type = AType; + node->elem = AElem; + node->next = NULL; + (myLast? myLast->next : myFirst) = node; + myLast = node; +} + +/*----------------------------------------------------------------------*/ + +void OpenGl_Group::Clear () +{ + if (myAspectLine) + { + // Delete line context + delete myAspectLine; + myAspectLine = NULL; + } + if (myAspectFace) + { + // Delete face context + delete myAspectFace; + myAspectFace = NULL; + } + if (myAspectMarker) + { + // Delete marker context + delete myAspectMarker; + myAspectMarker = NULL; + } + if (myAspectText) + { + // Delete text context + delete myAspectText; + myAspectText = NULL; + } + // Delete elements + while (myFirst) + { + OpenGl_ElementNode *next = myFirst->next; + delete myFirst->elem; + delete myFirst; + myFirst = next; + } + myLast = NULL; +} + +/*----------------------------------------------------------------------*/ + +void OpenGl_Group::RemovePrimitiveArray (CALL_DEF_PARRAY *APArray) +{ + OpenGl_ElementNode *prevnode = NULL, *node = myFirst; + while (node) + { + if (node->type == TelParray) + { + CALL_DEF_PARRAY *aCurPArray = ((const OpenGl_PrimitiveArray *)node->elem)->PArray(); + + // validate for correct pointer + if (aCurPArray->num_bounds == APArray->num_bounds && + aCurPArray->num_edges == APArray->num_edges && + aCurPArray->num_vertexs == APArray->num_vertexs && + aCurPArray->type == APArray->type) + { + (prevnode? prevnode->next : myFirst) = node->next; + if (!myFirst) myLast = NULL; + delete node->elem; + delete node; + break; + } + } + prevnode = node; + node = node->next; + } +} + +/*----------------------------------------------------------------------*/ + +void OpenGl_Group::Render (const Handle(OpenGl_Workspace) &AWorkspace) const +{ + // Is rendering in ADD or IMMEDIATE mode? + const Standard_Boolean isImmediate = (AWorkspace->NamedStatus & (OPENGL_NS_ADD | OPENGL_NS_IMMEDIATE)) != 0; + + // Setup aspects + const OpenGl_AspectLine *aspect_line = AWorkspace->AspectLine(Standard_False); + const OpenGl_AspectFace *aspect_face = AWorkspace->AspectFace(Standard_False); + const OpenGl_AspectMarker *aspect_marker = AWorkspace->AspectMarker(Standard_False); + const OpenGl_AspectText *aspect_text = AWorkspace->AspectText(Standard_False); + if (myAspectLine) + AWorkspace->SetAspectLine(myAspectLine); + if (myAspectFace) + AWorkspace->SetAspectFace(myAspectFace); + if (myAspectMarker) + AWorkspace->SetAspectMarker(myAspectMarker); + if (myAspectText) + AWorkspace->SetAspectText(myAspectText); + + // Render group elements + OpenGl_ElementNode *node = myFirst; + while (node) + { + switch (node->type) + { + case TelPolyline: + case TelMarker: + case TelMarkerSet: + case TelText: + { + glDisable(GL_LIGHTING); + + if (isImmediate) + { + glDepthMask(GL_FALSE); + } + else if ( (AWorkspace->NamedStatus & OPENGL_NS_ANIMATION) != 0 && + (AWorkspace->NamedStatus & OPENGL_NS_WIREFRAME) == 0 && + AWorkspace->DegenerateModel != 0 ) + { + glDisable( GL_DEPTH_TEST ); + if ( AWorkspace->NamedStatus & OPENGL_NS_TEXTURE ) DisableTexture(); + AWorkspace->NamedStatus |= OPENGL_NS_WIREFRAME; + } + + node->elem->Render( AWorkspace ); + + if ( !isImmediate && (AWorkspace->NamedStatus & OPENGL_NS_TEXTURE) != 0 ) EnableTexture(); + break; + } + + case TelPolygon: + case TelPolygonIndices: + case TelQuadrangle: + case TelTriangleMesh: + { + if (isImmediate) + { + glDepthMask(GL_FALSE); + } + else if ( (AWorkspace->NamedStatus & OPENGL_NS_ANIMATION) != 0 && + (AWorkspace->NamedStatus & OPENGL_NS_WIREFRAME) != 0 && + AWorkspace->DegenerateModel < 2 ) + { + if ( AWorkspace->NamedStatus & OPENGL_NS_TEXTURE ) EnableTexture (); + + glEnable( GL_DEPTH_TEST ); + AWorkspace->NamedStatus &= ~OPENGL_NS_WIREFRAME; + } + + if ( AWorkspace->NamedStatus & OPENGL_NS_HIGHLIGHT ) + AWorkspace->DisablePolygonOffset(); + + node->elem->Render( AWorkspace ); + + if ( AWorkspace->NamedStatus & OPENGL_NS_HIGHLIGHT ) + AWorkspace->EnablePolygonOffset(); + break; + } + + default: + { + node->elem->Render( AWorkspace ); + break; + } + } + node = node->next; + } + + // Restore aspects + AWorkspace->SetAspectLine(aspect_line); + AWorkspace->SetAspectFace(aspect_face); + AWorkspace->SetAspectMarker(aspect_marker); + AWorkspace->SetAspectText(aspect_text); +} + +/*----------------------------------------------------------------------*/ diff --git a/src/OpenGl/OpenGl_Group.hxx b/src/OpenGl/OpenGl_Group.hxx new file mode 100644 index 0000000000..65b44833cb --- /dev/null +++ b/src/OpenGl/OpenGl_Group.hxx @@ -0,0 +1,59 @@ +// File: OpenGl_Group.hxx +// Created: 1 August 2011 +// Author: Sergey ZERCHANINOV +// Copyright: OPEN CASCADE 2011 + +#ifndef _OpenGl_Group_Header +#define _OpenGl_Group_Header + +#include + +#include + +#include +#include +#include +#include + +#include + +struct OpenGl_ElementNode +{ + TelType type; + OpenGl_Element *elem; + OpenGl_ElementNode *next; + IMPLEMENT_MEMORY_OPERATORS +}; + +class OpenGl_Group : public OpenGl_Element +{ + public: + OpenGl_Group (); + virtual ~OpenGl_Group(); + + void SetAspectLine (const CALL_DEF_CONTEXTLINE &AContext, const Standard_Boolean IsGlobal = Standard_True); + void SetAspectFace (const CALL_DEF_CONTEXTFILLAREA &AContext, const Standard_Boolean IsGlobal = Standard_True); + void SetAspectMarker (const CALL_DEF_CONTEXTMARKER &AContext, const Standard_Boolean IsGlobal = Standard_True); + void SetAspectText (const CALL_DEF_CONTEXTTEXT &AContext, const Standard_Boolean IsGlobal = Standard_True); + + void AddElement (const TelType, OpenGl_Element * ); + void Clear (); + + void RemovePrimitiveArray (CALL_DEF_PARRAY *APArray); + + virtual void Render (const Handle(OpenGl_Workspace) &AWorkspace) const; + + protected: + + OpenGl_AspectLine *myAspectLine; + OpenGl_AspectFace *myAspectFace; + OpenGl_AspectMarker *myAspectMarker; + OpenGl_AspectText *myAspectText; + + OpenGl_ElementNode *myFirst, *myLast; + + public: + IMPLEMENT_MEMORY_OPERATORS +}; + +#endif //_OpenGl_Group_Header diff --git a/src/OpenGl/OpenGl_Light.hxx b/src/OpenGl/OpenGl_Light.hxx new file mode 100644 index 0000000000..b4bec031e7 --- /dev/null +++ b/src/OpenGl/OpenGl_Light.hxx @@ -0,0 +1,30 @@ +// File: OpenGl_Light.hxx +// Created: 13 July 2011 +// Author: Sergey ZERCHANINOV +// Copyright: OPEN CASCADE 2011 + +#ifndef OpenGl_Light_Header +#define OpenGl_Light_Header + +#include + +#include + +#define OpenGLMaxLights 8 + +struct OpenGl_Light +{ + TLightType type; + int HeadLight; + TEL_COLOUR col; + Tfloat pos[3]; + Tfloat dir[3]; + Tfloat shine; + Tfloat atten[2]; + Tfloat angle; + IMPLEMENT_MEMORY_OPERATORS +}; + +typedef NCollection_List OpenGl_ListOfLight; + +#endif //OpenGl_Light_Header diff --git a/src/OpenGl/OpenGl_LightBox.cxx b/src/OpenGl/OpenGl_LightBox.cxx deleted file mode 100755 index 630d815ffb..0000000000 --- a/src/OpenGl/OpenGl_LightBox.cxx +++ /dev/null @@ -1,605 +0,0 @@ -/*********************************************************************** - -FONCTION : ----------- -Gestion des light sous OpenGL - - -REMARQUES: ----------- - -- We can't take in account GL_QUADRATIC_ATTENUATION. - -- Position des lumieres. Il faut faire le glLight(GL_POSITION) apres la -gestion des matrices de transformation (GL_MODELVIEW). - -- Se mefier de GL_POSITION pour les lumieres directionelle. GL_POSITION -indique bien la position ou se trouve la lumiere. Comme on a une direction -comme valeur il faut l'inverser. - - -FONCTIONNEMENT: ---------------- -- La variable lightOn permet d'optimiser le changement d'etat des lumieres. -Ceci permet d'eviter d'appeler glIsEnable(GL_LIGHTING). Il faut bien sur -que l'on utilise les 2 points d'entree LightOn() et LightOff(). -L'init de la variable est faite par call_func_redraw_all_structs (OpenGl_funcs.c) - - -HISTORIQUE DES MODIFICATIONS : --------------------------------- -20-06-97 : PCT ; creation -30-06-96 : FMN ; Integration -18-07-96 : FMN, PCT ; Correction indice, ajout IsLightOn() -25-07-97 : CAL ; Portage NT (include OpenGl_tgl_all.h) -07-10-97 : FMN ; Simplification WNT - -************************************************************************/ - -/*----------------------------------------------------------------------*/ -/* -* Includes -*/ - -#include - -#include -#include - -#include -#include - -#include -#include - -/*----------------------------------------------------------------------*/ -/* -* Constantes -*/ -#ifndef DEBUG -#define DEBUG 0 -#endif - -#define NO_PRINT_DEBUG - -#define GROW_SIZE_WKS 10 -#define GROW_SIZE_LIGHT 8 - -/*----------------------------------------------------------------------*/ -/* -* Types definis -*/ -struct TEL_LIGHT_DATA -{ - Tint LightID; - TEL_LIGHT light; - IMPLEMENT_MEMORY_OPERATORS -}; - -struct TEL_LIGHT_WKS -{ - Tint wks; - int lights_count; - int lights_size; - TEL_LIGHT_DATA *lights; - IMPLEMENT_MEMORY_OPERATORS -}; - - -/*----------------------------------------------------------------------*/ -/* -* Variables statiques -*/ - -static TEL_LIGHT_WKS *wks = NULL; -static int wks_count = 0; -static int wks_size = 0; - -static GLfloat default_amb[4] = { 0.0, 0.0, 0.0, 1.0 }; -static GLfloat default_sptdir[3] = { 0.0, 0.0, -1.0 }; -static GLfloat default_sptexpo = 0.0; -static GLfloat default_sptcutoff = 180.0; - -static GLboolean lightOn = GL_FALSE; - -/*----------------------------------------------------------------------*/ -/* -* Fonctions privees -*/ - -/*-----------------------------------------------------------------*/ -/* -* Set des lumieres -*/ -static void bind_light(TEL_LIGHT *lptr, int *gl_lid) -{ - GLfloat data_amb[4]; - GLfloat data_diffu[4]; - GLfloat data_pos[4]; - GLfloat data_sptdir[3]; - GLfloat data_sptexpo; - GLfloat data_sptcutoff; - GLfloat data_constantattenuation; - GLfloat data_linearattenuation; - GLint cur_matrix; - - - /* on n'a droit qu'a 8 lights avec OpenGL... */ - if (*gl_lid > GL_LIGHT7) return; - - - /* la light est une headlight ? */ - if (lptr->HeadLight) - { - glGetIntegerv(GL_MATRIX_MODE, &cur_matrix); - glMatrixMode(GL_MODELVIEW); - glPushMatrix(); - glLoadIdentity(); - } - - - /* set la light en fonction de son type */ - switch (lptr->type) - { - case TLightAmbient: - data_amb[0] = lptr->col.rgb[0]; - data_amb[1] = lptr->col.rgb[1]; - data_amb[2] = lptr->col.rgb[2]; - data_amb[3] = 1.0; - - /*------------------------- Ambient ---------------------------*/ - /* - * The GL_AMBIENT parameter refers to RGBA intensity of the ambient - * light. - */ - glLightModelfv(GL_LIGHT_MODEL_AMBIENT, data_amb); - -#if DEBUG - printf("OpenGL_LightBox::bind_light:LightAmbient \n"); - printf("\tGL_LIGHT_MODEL_AMBIENT %f %f %f \n", data_amb[0], data_amb[1], data_amb[2]); -#endif - break; - - - case TLightDirectional: - data_diffu[0] = lptr->col.rgb[0]; - data_diffu[1] = lptr->col.rgb[1]; - data_diffu[2] = lptr->col.rgb[2]; - data_diffu[3] = 1.0; - - /*------------------------- Direction ---------------------------*/ - /* From Open GL Programming Rev 1 Guide Chapt 6 : - Lighting The Mathematics of Lighting ( p 168 ) - - Directional Light Source ( Infinite ) : - if the last parameter of GL_POSITION , w , is zero, the - corresponding light source is a Directional one. - - GL_SPOT_CUTOFF a 180 signifie que ce n'est pas un spot. - To create a realistic effect, set the GL_SPECULAR parameter - to the same value as the GL_DIFFUSE. - */ - - data_pos[0] = -lptr->dir[0]; - data_pos[1] = -lptr->dir[1]; - data_pos[2] = -lptr->dir[2]; - data_pos[3] = 0.0; - - glLightfv(*gl_lid, GL_AMBIENT, default_amb); - glLightfv(*gl_lid, GL_DIFFUSE, data_diffu); - glLightfv(*gl_lid, GL_SPECULAR, data_diffu); - - glLightfv(*gl_lid, GL_POSITION, data_pos); - glLightfv(*gl_lid, GL_SPOT_DIRECTION, default_sptdir); - glLightf(*gl_lid, GL_SPOT_EXPONENT, default_sptexpo); - glLightf(*gl_lid, GL_SPOT_CUTOFF, default_sptcutoff); - -#if DEBUG - printf("OpenGL_LightBox::bind_light:LightDirection \n"); - printf("\tGL_AMBIENT %f %f %f \n", default_amb[0], default_amb[1], default_amb[2]); - printf("\tGL_DIFFUSE %f %f %f \n", data_diffu[0], data_diffu[1], data_diffu[2]); - printf("\tGL_SPECULAR %f %f %f \n", data_diffu[0], data_diffu[1], data_diffu[2]); - printf("\tGL_POSITION %f %f %f \n", data_pos[0], data_pos[1], data_pos[2]); -#endif - break; - - - case TLightPositional: - data_diffu[0] = lptr->col.rgb[0]; - data_diffu[1] = lptr->col.rgb[1]; - data_diffu[2] = lptr->col.rgb[2]; - data_diffu[3] = 1.0; - - /*------------------------- Position -----------------------------*/ - /* From Open GL Programming Rev 1 Guide Chapt 6 : - Lighting The Mathematics of Lighting ( p 168 ) - Positional Light Source : - if the last parameter of GL_POSITION , w , is nonzero, - the corresponding light source is a Positional one. - - GL_SPOT_CUTOFF a 180 signifie que ce n'est pas un spot. - - To create a realistic effect, set the GL_SPECULAR parameter - to the same value as the GL_DIFFUSE. - */ - - data_pos[0] = lptr->pos[0]; - data_pos[1] = lptr->pos[1]; - data_pos[2] = lptr->pos[2]; - data_pos[3] = 1.0; - - data_constantattenuation = lptr->atten[0]; - data_linearattenuation = lptr->atten[1]; - - glLightfv(*gl_lid, GL_AMBIENT, default_amb); - glLightfv(*gl_lid, GL_DIFFUSE, data_diffu); - glLightfv(*gl_lid, GL_SPECULAR, data_diffu); - - glLightfv(*gl_lid, GL_POSITION, data_pos); - glLightfv(*gl_lid, GL_SPOT_DIRECTION, default_sptdir); - glLightf(*gl_lid, GL_SPOT_EXPONENT, default_sptexpo); - glLightf(*gl_lid, GL_SPOT_CUTOFF, default_sptcutoff); - glLightf(*gl_lid, GL_CONSTANT_ATTENUATION, data_constantattenuation); - glLightf(*gl_lid, GL_LINEAR_ATTENUATION, data_linearattenuation); - glLightf(*gl_lid, GL_QUADRATIC_ATTENUATION, 0.0); - -#if DEBUG - printf("OpenGL_LightBox::bind_light:LightPosition \n"); - printf("\tGL_AMBIENT %f %f %f \n", default_amb[0], default_amb[1], default_amb[2]); - printf("\tGL_DIFFUSE %f %f %f \n", data_diffu[0], data_diffu[1], data_diffu[2]); - printf("\tGL_SPECULAR %f %f %f \n", data_diffu[0], data_diffu[1], data_diffu[2]); - printf("\tGL_POSITION %f %f %f \n", data_pos[0], data_pos[1], data_pos[2]); -#endif - break; - - - case TLightSpot: - data_diffu[0] = lptr->col.rgb[0]; - data_diffu[1] = lptr->col.rgb[1]; - data_diffu[2] = lptr->col.rgb[2]; - data_diffu[3] = 1.0; - - data_pos[0] = lptr->pos[0]; - data_pos[1] = lptr->pos[1]; - data_pos[2] = lptr->pos[2]; - data_pos[3] = 1.0; - - data_sptdir[0] = lptr->dir[0]; - data_sptdir[1] = lptr->dir[1]; - data_sptdir[2] = lptr->dir[2]; - - data_sptexpo = ( float )lptr->shine * 128.0F; - data_sptcutoff = ( float )(lptr->angle * 180.0F)/( float )M_PI; - - data_constantattenuation = lptr->atten[0]; - data_linearattenuation = lptr->atten[1]; - - glLightfv(*gl_lid, GL_AMBIENT, default_amb); - glLightfv(*gl_lid, GL_DIFFUSE, data_diffu); - glLightfv(*gl_lid, GL_SPECULAR, data_diffu); - - glLightfv(*gl_lid, GL_POSITION, data_pos); - glLightfv(*gl_lid, GL_SPOT_DIRECTION, data_sptdir); - glLightf(*gl_lid, GL_SPOT_EXPONENT, data_sptexpo); - glLightf(*gl_lid, GL_SPOT_CUTOFF, data_sptcutoff); - glLightf(*gl_lid, GL_CONSTANT_ATTENUATION, data_constantattenuation); - glLightf(*gl_lid, GL_LINEAR_ATTENUATION, data_linearattenuation); - glLightf(*gl_lid, GL_QUADRATIC_ATTENUATION, 0.0); - -#if DEBUG - printf("OpenGL_LightBox::bind_light:LightSpot \n"); - printf("\tGL_AMBIENT %f %f %f \n", default_amb[0], default_amb[1], default_amb[2]); - printf("\tGL_DIFFUSE %f %f %f \n", data_diffu[0], data_diffu[1], data_diffu[2]); - printf("\tGL_SPECULAR %f %f %f \n", data_diffu[0], data_diffu[1], data_diffu[2]); - printf("\tGL_POSITION %f %f %f \n", data_pos[0], data_pos[1], data_pos[2]); - printf("\tGL_SPOT_DIRECTION %f %f %f \n", data_sptdir[0], data_sptdir[1], data_sptdir[2]); - printf("\tGL_SPOT_EXPONENT %f \n", data_sptexpo); - printf("\tGL_SPOT_CUTOFF %f \n", data_sptcutoff); - printf("\tGL_CONSTANT_ATTENUATION %f \n", data_constantattenuation); - printf("\tGL_LINEAR_ATTENUATION %f \n", data_linearattenuation); -#endif - break; - } - - - if (lptr->type != TLightAmbient) - { -#if DEBUG - printf("OpenGL_LightBox::bind_light:glEnable %d \n", *gl_lid); -#endif - glEnable(*gl_lid); - (*gl_lid)++; - } - - - /* si la light etait une headlight alors restaure la matrice precedente */ - if (lptr->HeadLight) - { - glPopMatrix(); - glMatrixMode(cur_matrix); - } -} - - -/*-----------------------------------------------------------------*/ -/* -* recherche de la liste de lampe d'une wks, creation d'une liste si non existante -*/ -static int find_wks(Tint WksID, int alloc) -{ - int i; - - /* recherche la wks dans la liste si elle existe */ - for (i=0; i on fait de la place si yen a plus */ - if (wks_count == wks_size ) - { - wks_size += GROW_SIZE_WKS; - if (!wks) - wks = new TEL_LIGHT_WKS[wks_size]; - else -#if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x530) - wks = (TEL_LIGHT_WKS*)realloc(wks, wks_size*sizeof(TEL_LIGHT_WKS)); -#else - wks = cmn_resizemem(wks, wks_size); -#endif - - if (!wks) - return -1; - } - - wks[wks_count].wks = WksID; - wks[wks_count].lights = NULL; - wks[wks_count].lights_size = 0; - wks[wks_count].lights_count = 0; - - return wks_count++; -} - -/*-----------------------------------------------------------------*/ -/* -* recherche une lampe d'une wks, creation d'une lampe si elle n'existe pas -*/ -static int find_light(int WksIdx, Tint LightID, int alloc) -{ - int i; - TEL_LIGHT_DATA *lights; - - - /* recherche la light dans la liste de la wks */ - lights = wks[WksIdx].lights; - for (i=0; i on cree une lampe */ - if (wks[WksIdx].lights_count == wks[WksIdx].lights_size) - { - wks[WksIdx].lights_size += GROW_SIZE_LIGHT; - if (!wks[WksIdx].lights) - wks[WksIdx].lights = new TEL_LIGHT_DATA[wks[WksIdx].lights_size]; - else - wks[WksIdx].lights = -#if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x530) - (TEL_LIGHT_DATA*)realloc( wks[WksIdx].lights, - wks[WksIdx].lights_size*sizeof(TEL_LIGHT_DATA) ); -#else - cmn_resizemem( wks[WksIdx].lights, - wks[WksIdx].lights_size ); -#endif - if (!wks[WksIdx].lights) - return -1; - } - - return wks[WksIdx].lights_count++; -} - - -/*----------------------------------------------------------------------*/ -/* -* Fonctions publiques -*/ - - -/*-----------------------------------------------------------------*/ -/* -* Ajout d'une lumiere dans la Wks -*/ -TStatus AddLight(Tint WksID, Tint LightID, tel_light light) -{ - int wks_entry; - int light_entry; - -#if DEBUG - printf("AddLight %d dans wks %d [wds_count=%d]\n", LightID, WksID, wks_count); -#endif - - /* obtient le numero de la liste de lights de la wks */ - wks_entry = find_wks(WksID, 1); - if (wks_entry == -1) return TFailure; - - /* recherche le numero de la lampe si elle existe */ - light_entry = find_light(wks_entry, LightID, 1); - if (light_entry == -1) return TFailure; - - /* met a jour la light */ - wks[wks_entry].lights[light_entry].LightID = LightID; - wks[wks_entry].lights[light_entry].light = *light; - -#if DEBUG - printf("ajout ok\n"); -#endif - return TSuccess; -} - - -/*-----------------------------------------------------------------*/ -/* -* Maj des lumieres de la Wks -*/ -TStatus UpdateLight(Tint WksID) -{ - int wks_entry; - int i; - int gl_lid; - - -#if DEBUG - printf("UpdateLight %d\n", WksID); -#endif - - /* vire toutes les lights des le depart avant une re-init complete */ - for (i=GL_LIGHT0; i<=GL_LIGHT7; i++) - glDisable(i); - glLightModelfv(GL_LIGHT_MODEL_AMBIENT, default_amb); - - /* recherche la liste de light de la wks */ - wks_entry = find_wks(WksID, 0); - if (wks_entry == -1) return TFailure; - -#if DEBUG - printf("*** Update: nb = %d\n", wks[wks_entry].lights_count); -#endif - - /* set les lights */ - gl_lid = GL_LIGHT0; - for (i=0; i 0) LightOn(); - -#if DEBUG - printf("update ok\n"); -#endif - - return TSuccess; -} - - -/*-----------------------------------------------------------------*/ -/* -* Remove une lumiere de la Wks -*/ -TStatus RemoveLight(Tint WksID, Tint LightID) -{ - int wks_entry; - int light_entry; - - - /* recherche de la wks */ - wks_entry = find_wks(WksID, 0); - if (wks_entry == -1) return TFailure; - - /* recherche de la light */ - light_entry = find_light(wks_entry, LightID, 0); - if (light_entry == -1) return TFailure; - - /* retire la light */ - memcpy(&wks[wks_entry].lights[light_entry], - &wks[wks_entry].lights[light_entry+1], - (wks[wks_entry].lights_count - light_entry - 1)*sizeof(TEL_LIGHT_DATA)); - wks[wks_entry].lights_count--; - -#if DEBUG - printf("RemoveLight %d dans wks %d [wds_count=%d]\n", LightID, WksID, wks_count); -#endif - - return TSuccess; -} - - -/*-----------------------------------------------------------------*/ -/* -* Remove des lumieres de la Wks -*/ -TStatus RemoveWksLight(Tint WksID) -{ - int wks_entry; - - /* recherche de la wks */ - wks_entry = find_wks(WksID, 0); - if (wks_entry == -1) return TFailure; - - /* destruction de toute la wks */ - free(wks[wks_entry].lights); - memcpy(&wks[wks_entry], - &wks[wks_entry+1], - (wks_count - wks_entry - 1)*sizeof(TEL_LIGHT_WKS)); - wks_count--; - - return TSuccess; -} - - -/*-----------------------------------------------------------------*/ -/* -* Reset de toutes les lights d'une Wks -*/ -TStatus ResetWksLight(Tint WksID) -{ - int wks_entry; - - /* recherche de la wks */ - wks_entry = find_wks(WksID, 0); - if (wks_entry == -1) return TFailure; - - /* destruction de toutes les lights */ - wks[wks_entry].lights_count = 0; - - return TSuccess; -} - - -/*-----------------------------------------------------------------*/ -/* -* Enable des lights -*/ -void LightOn(void) -{ -#ifdef PRINT_DEBUG - if(IsLightOn()) - printf("LightOn(): lighting already enabled!"); - else - printf("LightOn() succeeded"); -#endif - glEnable(GL_LIGHTING); -} - - -/*-----------------------------------------------------------------*/ -/* -* Disable des lights -*/ -void LightOff(void) -{ -#ifdef PRINT_DEBUG - if(!IsLightOn()) - printf("LightOff(): lighting already disabled!"); - else - printf("LightOff() succeeded"); -#endif - glDisable(GL_LIGHTING); -} -/*-----------------------------------------------------------------*/ - -/* -* IsEnable des lights -*/ - -GLboolean IsLightOn(void) -{ - return glIsEnabled(GL_LIGHTING); -} -/*-----------------------------------------------------------------*/ diff --git a/src/OpenGl/OpenGl_LightBox.hxx b/src/OpenGl/OpenGl_LightBox.hxx deleted file mode 100755 index 387d7f9f06..0000000000 --- a/src/OpenGl/OpenGl_LightBox.hxx +++ /dev/null @@ -1,112 +0,0 @@ -/*********************************************************************** - -FONCTION : ----------- -Gestion des light sous OpenGL - - -REMARQUES: ----------- - - -HISTORIQUE DES MODIFICATIONS : --------------------------------- -20-06-97 : PCT ; creation -30-06-97 : FMN ; Integration -18-07-97 : FMN ; Ajout IsLightOn() -02-10-97 : FMN ; Ajout gl.h pour WNT - -************************************************************************/ - -/*----------------------------------------------------------------------*/ - -#ifndef __OPENGL_LIGHTBOX_H_ -#define __OPENGL_LIGHTBOX_H_ - -/*----------------------------------------------------------------------*/ -/* -* Includes -*/ - -#include - -#include -#include -#include - - -/*----------------------------------------------------------------------*/ -/* -* Constantes -*/ - -#define OpenGLMaxLights 8 - -/*----------------------------------------------------------------------*/ -/* -* Types definis -*/ - -typedef struct -{ - TLightType type; - int HeadLight; - TEL_COLOUR col; - Tfloat pos[3]; - Tfloat dir[3]; - Tfloat shine; - Tfloat atten[2]; - Tfloat angle; -} TEL_LIGHT, *tel_light; - - -/*----------------------------------------------------------------------*/ -/* -* Prototypes -*/ - -/* -* Ajout d'une lumiere dans la Wks -*/ -extern TStatus AddLight(Tint WksID, Tint LightID, tel_light light); - -/* -* Maj des lumieres de la Wks -*/ -extern TStatus UpdateLight(Tint WksID); - -/* -* Remove une lumiere de la Wks -*/ -extern TStatus RemoveLight(Tint WksID, Tint LightID); - -/* -* Remove des lumieres de la Wks -*/ -extern TStatus RemoveWksLight(Tint WksID); - -/* -* Reset de toutes les lights d'une Wks -*/ -extern TStatus ResetWksLight(Tint WksID); - -/* -* Enable des lights -*/ -extern void LightOn(void); - -/* -* Disable des lights -*/ -extern void LightOff(void); - -/* -* IsEnable des lights -*/ -extern GLboolean IsLightOn(void); - -/*----------------------------------------------------------------------*/ - -#endif /* __OPENGL_LIGHTBOX_H_ */ - -/*----------------------------------------------------------------------*/ diff --git a/src/OpenGl/OpenGl_Marker.cxx b/src/OpenGl/OpenGl_Marker.cxx new file mode 100644 index 0000000000..acfa0299dc --- /dev/null +++ b/src/OpenGl/OpenGl_Marker.cxx @@ -0,0 +1,93 @@ +// File: OpenGl_Marker.cxx +// Created: 13 July 2011 +// Author: Sergey ZERCHANINOV +// Copyright: OPEN CASCADE 2011 + +#include + +#include +#include + +#include +#include +#include + +/*----------------------------------------------------------------------*/ + +void OpenGl_Marker::Render (const Handle(OpenGl_Workspace) &AWorkspace) const +{ + const OpenGl_AspectMarker *aspect_marker = AWorkspace->AspectMarker( Standard_True ); + + // Use highlight colours + glColor3fv( (AWorkspace->NamedStatus & OPENGL_NS_HIGHLIGHT)? AWorkspace->HighlightColor->rgb : aspect_marker->Color().rgb ); + + switch ( aspect_marker->Type() ) + { + case Aspect_TOM_O_POINT : + { + const char *str = AWorkspace->GetDisplay()->GetStringForMarker( Aspect_TOM_O, aspect_marker->Scale() ); + glRasterPos3fv( myPoint.xyz ); + AWorkspace->GetDisplay()->SetBaseForMarker(); + glCallLists( strlen( str ), GL_UNSIGNED_BYTE, (const GLubyte *) str ); + } + case Aspect_TOM_POINT : + { + glPointSize( aspect_marker->Scale() ); + glBegin( GL_POINTS ); + glVertex3fv( myPoint.xyz ); + glEnd(); + break; + } + default: + { + glRasterPos3fv( myPoint.xyz ); + switch ( aspect_marker->Type() ) + { + case Aspect_TOM_RING1 : + case Aspect_TOM_RING2 : + case Aspect_TOM_RING3 : + { + const float ADelta = 0.1f; + float AScale = aspect_marker->Scale(); + float ALimit = 0.f; + if (aspect_marker->Type() == Aspect_TOM_RING1) + ALimit = AScale * 0.2f; + else if (aspect_marker->Type() == Aspect_TOM_RING2) + ALimit = AScale * 0.5f; + else + ALimit = AScale * 0.8f; + AWorkspace->GetDisplay()->SetBaseForMarker(); + while (AScale > ALimit && AScale >= 1.f) + { + const char *str = AWorkspace->GetDisplay()->GetStringForMarker( Aspect_TOM_O, AScale ); + glCallLists( strlen( str ), GL_UNSIGNED_BYTE, (const GLubyte *) str ); + AScale -= ADelta; + } + break; + } + case Aspect_TOM_USERDEFINED : + { + glCallList( openglDisplay->GetUserMarkerListIndex( (int)aspect_marker->Scale() ) ); + break; + } + default : + { + AWorkspace->GetDisplay()->SetBaseForMarker(); + const char *str = AWorkspace->GetDisplay()->GetStringForMarker( aspect_marker->Type(), aspect_marker->Scale() ); + glCallLists( strlen( str ), GL_UNSIGNED_BYTE, (const GLubyte *)str ); + } + } + GLint mode; + glGetIntegerv( GL_RENDER_MODE, &mode ); + if( mode==GL_FEEDBACK ) + { + glBegin( GL_POINTS ); + glVertex3fv( myPoint.xyz ); + glEnd(); + /* it is necessary to indicate end of marker information*/ + } + } + } +} + +/*----------------------------------------------------------------------*/ diff --git a/src/OpenGl/OpenGl_Marker.hxx b/src/OpenGl/OpenGl_Marker.hxx new file mode 100644 index 0000000000..036028e86f --- /dev/null +++ b/src/OpenGl/OpenGl_Marker.hxx @@ -0,0 +1,30 @@ +// File: OpenGl_Marker.hxx +// Created: 13 July 2011 +// Author: Sergey ZERCHANINOV +// Copyright: OPEN CASCADE 2011 + +#ifndef OpenGl_Marker_Header +#define OpenGl_Marker_Header + +#include + +#include + +class OpenGl_Marker : public OpenGl_Element +{ + public: + + OpenGl_Marker (const TEL_POINT &APoint) : myPoint(APoint) {} + virtual ~OpenGl_Marker () {} + + virtual void Render (const Handle(OpenGl_Workspace) &AWorkspace) const; + + protected: + + TEL_POINT myPoint; + + public: + IMPLEMENT_MEMORY_OPERATORS +}; + +#endif //OpenGl_Marker_Header diff --git a/src/OpenGl/OpenGl_MarkerSet.cxx b/src/OpenGl/OpenGl_MarkerSet.cxx new file mode 100644 index 0000000000..b0d1877351 --- /dev/null +++ b/src/OpenGl/OpenGl_MarkerSet.cxx @@ -0,0 +1,129 @@ +// File: OpenGl_MarkerSet.cxx +// Created: 13 July 2011 +// Author: Sergey ZERCHANINOV +// Copyright: OPEN CASCADE 2011 + +#include + +#include +#include + +#include +#include +#include + +/*----------------------------------------------------------------------*/ + +OpenGl_MarkerSet::OpenGl_MarkerSet (const Standard_Integer ANbPoints, const Graphic3d_Vertex *APoints) +: myNbPoints(ANbPoints), + myPoints(new TEL_POINT[ANbPoints]) +{ + memcpy( myPoints, APoints, ANbPoints*sizeof(TEL_POINT) ); +} + +/*----------------------------------------------------------------------*/ + +OpenGl_MarkerSet::~OpenGl_MarkerSet () +{ + if (myPoints) + delete[] myPoints; +} + +/*----------------------------------------------------------------------*/ + +void OpenGl_MarkerSet::Render (const Handle(OpenGl_Workspace) &AWorkspace) const +{ + const OpenGl_AspectMarker *aspect_marker = AWorkspace->AspectMarker( Standard_True ); + + // Use highlight colors + glColor3fv( (AWorkspace->NamedStatus & OPENGL_NS_HIGHLIGHT)? AWorkspace->HighlightColor->rgb : aspect_marker->Color().rgb ); + + const TEL_POINT *ptr; + Tint i; + + switch ( aspect_marker->Type() ) + { + case Aspect_TOM_O_POINT : + { + const char *str = AWorkspace->GetDisplay()->GetStringForMarker( Aspect_TOM_O, aspect_marker->Scale() ); + AWorkspace->GetDisplay()->SetBaseForMarker(); + for( i = 0, ptr = myPoints; i < myNbPoints; i++, ptr++ ) + { + glRasterPos3fv( ptr->xyz ); + glCallLists( strlen( str ), GL_UNSIGNED_BYTE, (const GLubyte *) str ); + } + } + case Aspect_TOM_POINT : + { + glPointSize( aspect_marker->Scale() ); + glBegin( GL_POINTS ); + for( i = 0, ptr = myPoints; i < myNbPoints; i++, ptr++ ) + glVertex3fv( ptr->xyz ); + glEnd(); + break; + } + default: + { + switch ( aspect_marker->Type() ) + { + case Aspect_TOM_RING1 : + case Aspect_TOM_RING2 : + case Aspect_TOM_RING3 : + { + const float ADelta = 0.1f; + float AScale = aspect_marker->Scale(); + float ALimit = 0.f; + if (aspect_marker->Type() == Aspect_TOM_RING1) + ALimit = AScale * 0.2f; + else if (aspect_marker->Type() == Aspect_TOM_RING2) + ALimit = AScale * 0.5f; + else + ALimit = AScale * 0.8f; + AWorkspace->GetDisplay()->SetBaseForMarker(); + for( i = 0, ptr = myPoints; i < myNbPoints; i++, ptr++ ) + { + glRasterPos3fv( ptr->xyz ); + AScale = aspect_marker->Scale(); + while (AScale > ALimit && AScale >= 1.f) + { + const char *str = AWorkspace->GetDisplay()->GetStringForMarker( Aspect_TOM_O, AScale ); + glCallLists( strlen( str ), GL_UNSIGNED_BYTE, (const GLubyte *) str ); + AScale -= ADelta; + } + } + break; + } + case Aspect_TOM_USERDEFINED : + { + for( i = 0, ptr = myPoints; i < myNbPoints; i++, ptr++ ) + { + glRasterPos3fv( ptr->xyz ); + glCallList( openglDisplay->GetUserMarkerListIndex( (int)aspect_marker->Scale() ) ); + } + break; + } + default : + { + AWorkspace->GetDisplay()->SetBaseForMarker(); + const char *str = AWorkspace->GetDisplay()->GetStringForMarker( aspect_marker->Type(), aspect_marker->Scale() ); + for( i = 0, ptr = myPoints; i < myNbPoints; i++, ptr++ ) + { + glRasterPos3fv( ptr->xyz ); + glCallLists( strlen( str ), GL_UNSIGNED_BYTE, (const GLubyte *) str ); + } + } + } + GLint mode; + glGetIntegerv( GL_RENDER_MODE, &mode ); + if( mode==GL_FEEDBACK ) + { + glBegin( GL_POINTS ); + for( i = 0, ptr = myPoints; i < myNbPoints; i++, ptr++ ) + glVertex3fv( ptr->xyz ); + glEnd(); + } + } + } +} + +/*----------------------------------------------------------------------*/ diff --git a/src/OpenGl/OpenGl_MarkerSet.hxx b/src/OpenGl/OpenGl_MarkerSet.hxx new file mode 100644 index 0000000000..c7425dc1f2 --- /dev/null +++ b/src/OpenGl/OpenGl_MarkerSet.hxx @@ -0,0 +1,33 @@ +// File: OpenGl_MarkerSet.hxx +// Created: 13 July 2011 +// Author: Sergey ZERCHANINOV +// Copyright: OPEN CASCADE 2011 + +#ifndef OpenGl_MarkerSet_Header +#define OpenGl_MarkerSet_Header + +#include + +#include + +#include + +class OpenGl_MarkerSet : public OpenGl_Element +{ + public: + + OpenGl_MarkerSet (const Standard_Integer ANbPoints, const Graphic3d_Vertex *APoints); + virtual ~OpenGl_MarkerSet (); + + virtual void Render (const Handle(OpenGl_Workspace) &AWorkspace) const; + + protected: + + Tint myNbPoints; + TEL_POINT *myPoints; + + public: + IMPLEMENT_MEMORY_OPERATORS +}; + +#endif //OpenGl_MarkerSet_Header diff --git a/src/OpenGl/OpenGl_Matrix.cxx b/src/OpenGl/OpenGl_Matrix.cxx new file mode 100644 index 0000000000..e5be7457dd --- /dev/null +++ b/src/OpenGl/OpenGl_Matrix.cxx @@ -0,0 +1,31 @@ +// File: OpenGl_Matrix.cxx +// Created: 13 July 2011 +// Author: Sergey ZERCHANINOV +// Copyright: OPEN CASCADE 2011 + +#include + +/*----------------------------------------------------------------------*/ + +void OpenGl_Multiplymat3 (OpenGl_Matrix *c, const OpenGl_Matrix *a, const OpenGl_Matrix *b) +{ + int row, col, i; + for (row = 0; row < 4; row++) { + for (col = 0; col < 4; col++) { + float sum = 0.F; + for (i = 0; i < 4; i++) + sum += a->mat[row][i] * b->mat[i][col]; + c->mat[row][col] = sum; + } + } +} + +/*----------------------------------------------------------------------*/ + +void OpenGl_Transposemat3 (OpenGl_Matrix *c, const OpenGl_Matrix *a) +{ + Tint row, col; + for (row = 0; row < 4; row++) + for (col = 0; col < 4; col++) + c->mat[row][col] = a->mat[col][row]; +} diff --git a/src/OpenGl/OpenGl_Matrix.hxx b/src/OpenGl/OpenGl_Matrix.hxx new file mode 100644 index 0000000000..48caf79d0a --- /dev/null +++ b/src/OpenGl/OpenGl_Matrix.hxx @@ -0,0 +1,20 @@ +// File: OpenGl_Matrix.hxx +// Created: 20 September 2011 +// Author: Sergey ZERCHANINOV +// Copyright: OPEN CASCADE 2011 + +#ifndef OpenGl_Matrix_Header +#define OpenGl_Matrix_Header + +#include + +struct OpenGl_Matrix +{ + float mat[4][4]; + IMPLEMENT_MEMORY_OPERATORS +}; + +Standard_EXPORT void OpenGl_Multiplymat3 (OpenGl_Matrix *c, const OpenGl_Matrix *a, const OpenGl_Matrix *b); +Standard_EXPORT void OpenGl_Transposemat3 (OpenGl_Matrix *c, const OpenGl_Matrix *a); + +#endif //OpenGl_Matrix_Header diff --git a/src/OpenGl/OpenGl_Memory.cxx b/src/OpenGl/OpenGl_Memory.cxx deleted file mode 100755 index dba397fc4a..0000000000 --- a/src/OpenGl/OpenGl_Memory.cxx +++ /dev/null @@ -1,6 +0,0 @@ -#include - -OpenGl_MemoryMgr::OpenGl_MemoryMgr(){} -OpenGl_MemoryMgr::OpenGl_MemoryMgr(const OpenGl_MemoryMgr&){} -OpenGl_MemoryMgr::~OpenGl_MemoryMgr(){} - diff --git a/src/OpenGl/OpenGl_Memory.hxx b/src/OpenGl/OpenGl_Memory.hxx index bc03f8f552..f875a574b2 100755 --- a/src/OpenGl/OpenGl_Memory.hxx +++ b/src/OpenGl/OpenGl_Memory.hxx @@ -2,13 +2,6 @@ #define OPENGL_MEMORY_H #include -#include -#include -#include -#include -#include -#include - template XType *cmn_resizemem( XType *ptr, Tint size ) { @@ -24,11 +17,4 @@ template XType *cmn_resizemem( XType *ptr, Tint size ) return ptr; } -class OpenGl_MemoryMgr { -private: - OpenGl_MemoryMgr(); - OpenGl_MemoryMgr(const OpenGl_MemoryMgr&); - ~OpenGl_MemoryMgr(); -}; - #endif //OPENGL_MEMORY_H diff --git a/src/OpenGl/OpenGl_Mesh.cxx b/src/OpenGl/OpenGl_Mesh.cxx new file mode 100644 index 0000000000..db63adab7d --- /dev/null +++ b/src/OpenGl/OpenGl_Mesh.cxx @@ -0,0 +1,925 @@ +// File: OpenGl_Mesh.cxx +// Created: 13 July 2011 +// Author: Sergey ZERCHANINOV +// Copyright: OPEN CASCADE 2011 + +#define OCC749 /* SAV 19/09/02 added processing of colored vertices */ +#define OCC7824 /* ASL 26/01/05 transparency of polygon with colors assigned to vertices */ + +/*----------------------------------------------------------------------*/ +/* +* Includes +*/ + +#include +#include + +#include + +#include +#include + +#include +#include + +#include + +static long s_Rand = 1L; +# define OPENGL_RAND() ( ( unsigned )( s_Rand = s_Rand * 214013L + 2531011L ) ) + +/*----------------------------------------------------------------------*/ +/* +* Prototypes +*/ + +typedef TEL_INDEXPOLY_DATA* tel_indexpoly_data; + +void set_drawable_items ( GLboolean*, int, const float ); + +/*----------------------------------------------------------------------*/ + +void OpenGl_Mesh::draw_indexpoly (const Tint front_lighting_model, + const Aspect_InteriorStyle interior_style, + const TEL_COLOUR *edge_colour, + const OPENGL_SURF_PROP *prop, + const Handle(OpenGl_Workspace) &AWorkspace) const +{ + Tint i, j, k, a, newList = 0; + Tint lighting_model; + + /* Following pointers have been provided for performance improvement */ + Tint *ind; + tel_point pfn, pvn, pv; + tel_colour pvc, pfc; + tel_texture_coord pvt; + + ind = myData.indices; + pfn = myData.fnormals; + pvn = myData.vnormals; + pvc = myData.vcolours; + pfc = myData.fcolours; + pv = myData.vertices; + pvt = myData.vtexturecoord; + if ( AWorkspace->DegenerateModel < 2 && interior_style != Aspect_IS_EMPTY ) + { + if ( AWorkspace->NamedStatus & OPENGL_NS_HIGHLIGHT ) + { + pvc = 0; + pfc = 0; + } + + if ( interior_style == Aspect_IS_HIDDENLINE) + { + pvc = 0; + pfc = 0; + } + + if ( front_lighting_model ) + glEnable(GL_LIGHTING); + else + glDisable(GL_LIGHTING); + + lighting_model = front_lighting_model; + + if ( (AWorkspace->NamedStatus & OPENGL_NS_ANIMATION) == 0 ) + goto doDraw; /* Disable object display list out of animation */ + /* window's context and bitmap's one */ + + if ( myDS->model != lighting_model || !myDS->list || + myDS->model == -1 || ( AWorkspace->DegenerateModel && myDS->skipRatio != AWorkspace->SkipRatio )) + { + myDS->skipRatio = AWorkspace->SkipRatio; + myDS->model = lighting_model; + myDS->degMode = AWorkspace->DegenerateModel; + if ( AWorkspace->SkipRatio <= 0.f ) { + if ( !myDS->list ) myDS->list = glGenLists ( 1 ); + + glNewList ( myDS->list, GL_COMPILE_AND_EXECUTE ); + newList = 1; +doDraw: + if ( !lighting_model ) + { + if ( myData.num_bounds == 3 ) + glBegin ( GL_TRIANGLES ); + else if ( myData.num_bounds == 4 ) + glBegin ( GL_QUADS ); + else glBegin ( GL_POLYGON ); + + if ( pvc ) + { + for ( i = 0, j = 0, a = 0; i < myData.num_facets; ++i ) + { + a = j + myData.num_bounds; + for ( ; j < a; ++j ) + { + glColor3fv ( pvc[ ind[ j ] ].rgb ); + glVertex3fv ( pv[ ind[ j ] ].xyz ); + } + } + } + else if ( pfc ) + { + for ( i = 0, j = 0, a = 0; i < myData.num_facets; ++i ) + { + a = j + myData.num_bounds; + glColor3fv ( pfc[ i ].rgb ); + for ( ; j < a; ++j ) glVertex3fv ( pv[ ind[ j ] ].xyz ); + } + } + else + { + for ( i = 0, j = 0, a = 0; i < myData.num_facets; ++i ) + { + a = j + myData.num_bounds; + for ( ; j < a; ++j ) glVertex3fv ( pv[ ind[ j ] ].xyz ); + } + } + glEnd (); + } + else + { + /* lighting_model != TelLModelNone */ + if ( myData.num_bounds == 3 ) + glBegin ( GL_TRIANGLES ); + else if ( myData.num_bounds == 4 ) + glBegin ( GL_QUADS ); + else glBegin ( GL_POLYGON ); + +#ifdef OCC749 + for ( i = a = 0; i < myData.num_facets; ++i ) { + j = a; a += myData.num_bounds; + if( pfn ) glNormal3fv ( pfn[ i ].xyz ); + if( pfc && !prop->isphysic ) { + GLfloat diff[4], ambi[4], emsv[4], r, g, b; + + ambi[3] = diff[3] = emsv[3] = prop->trans; + + r = pfc[ i ].rgb[0]; g = pfc[ i ].rgb[1]; b = pfc[ i ].rgb[2]; + + if( prop->color_mask & OPENGL_AMBIENT_MASK ) { + ambi[0] = prop->amb * r; + ambi[1] = prop->amb * g; + ambi[2] = prop->amb * b; + glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, ambi); + } + if( prop->color_mask & OPENGL_DIFFUSE_MASK ) { + diff[0] = prop->diff * r; + diff[1] = prop->diff * g; + diff[2] = prop->diff * b; + glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, diff); + } + if( prop->color_mask & OPENGL_EMISSIVE_MASK ) { + emsv[0] = prop->emsv * r; + emsv[1] = prop->emsv * g; + emsv[2] = prop->emsv * b; + glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, emsv); + } + } + for ( ; j < a; ++j ) { + k = ind[ j ]; + if( pvn ) glNormal3fv ( pvn[ k ].xyz ); + if( pvc && !prop->isphysic ) { + GLfloat diff[4], ambi[4], emsv[4], r, g, b; + + ambi[3] = diff[3] = emsv[3] = prop->trans; + + r = pvc[ k ].rgb[0]; g = pvc[ k ].rgb[1]; b = pvc[ k ].rgb[2]; + + if( prop->color_mask & OPENGL_AMBIENT_MASK ) { + ambi[0] = prop->amb * r; + ambi[1] = prop->amb * g; + ambi[2] = prop->amb * b; + glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, ambi); + } + if( prop->color_mask & OPENGL_DIFFUSE_MASK ) { + diff[0] = prop->diff * r; + diff[1] = prop->diff * g; + diff[2] = prop->diff * b; + glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, diff); + } + if( prop->color_mask & OPENGL_EMISSIVE_MASK ) { + emsv[0] = prop->emsv * r; + emsv[1] = prop->emsv * g; + emsv[2] = prop->emsv * b; + glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, emsv); + } + } + if( pvt && (AWorkspace->NamedStatus & OPENGL_NS_FORBIDSETTEX) == 0 ) glTexCoord2fv ( pvt[ k ].xy ); + glVertex3fv ( pv[ k ].xyz ); + } /* end for ( j . . . ) */ + } /* end for ( i . . . ) */ + glEnd (); +#else + if ( pvn ) { + if ( pvt && (AWorkspace->NamedStatus & OPENGL_NS_FORBIDSETTEX) == 0 ) + for ( i = 0, j = 0, a = 0; i < myData.num_facets; ++i ) { + a = j + myData.num_bounds; + for ( ; j < a; ++j ) { + glNormal3fv ( pvn[ ind[ j ] ].xyz ); + glTexCoord2fv ( pvt[ ind[ j ] ].xy ); + glVertex3fv ( pv[ ind[ j ] ].xyz ); + } /* end for ( j . . . ) */ + } /* end for ( i . . . ) */ + else + for ( i = 0, j = 0, a = 0; i < myData.num_facets; ++i ) { + a = j + myData.num_bounds; + for ( ; j < a; ++j ) { + glNormal3fv ( pvn[ ind[ j ] ].xyz ); + glVertex3fv ( pv[ ind[ j ] ].xyz ); + } /* end for ( j . . . ) */ + } /* end for ( i . . . ) */ + } else { /* !pvn */ + for ( i = 0, j = 0, a = 0; i < myData.num_facets; ++i ) { + a = j + myData.num_bounds; + glNormal3fv ( pfn[ i ].xyz ); + for ( ; j < a; ++j ) glVertex3fv ( pv[ ind[ j ] ].xyz ); + } /* end for */ + } /* end else */ + glEnd (); +#endif /* OCC749 */ + + } /* end else */ + } else if ( AWorkspace->SkipRatio < 1.f ) { + if ( !myDS->dlist ) myDS->dlist = glGenLists ( 1 ); + glNewList ( myDS->dlist, GL_COMPILE_AND_EXECUTE ); + newList = 1; + set_drawable_items ( myDS->bDraw, myData.num_facets, AWorkspace->SkipRatio ); + if ( !lighting_model ) { + if ( myData.num_bounds == 3 ) + glBegin ( GL_TRIANGLES ); + else if ( myData.num_bounds == 4 ) + glBegin ( GL_QUADS ); + else glBegin ( GL_POLYGON ); + + if ( pvc ) { + for ( i = 0, j = 0, a = 0; i < myData.num_facets; ++i ) { + a = j + myData.num_bounds; + if ( myDS->bDraw[ i ] ) + for ( ; j < a; ++j ) { + glColor3fv ( pvc[ ind[ j ] ].rgb ); + glVertex3fv ( pv[ ind[ j ] ].xyz ); + } /* end for ( j . . . ) */ + else j = a; + } /* end for ( i . . . ) */ + } else if ( pfc ) { + for ( i = 0, j = 0, a = 0; i < myData.num_facets; ++i ) { + a = j + myData.num_bounds; + if ( myDS->bDraw[ i ] ) { + glColor3fv ( pfc[ i ].rgb ); + for ( ; j < a; ++j ) glVertex3fv ( pv[ ind[ j ] ].xyz ); + } else j = a; + } /* end for */ + } else { + for ( i = 0, j = 0, a = 0; i < myData.num_facets; ++i ) { + a = j + myData.num_bounds; + if ( myDS->bDraw[ i ] ) + for ( ; j < a; ++j ) glVertex3fv ( pv[ ind[ j ] ].xyz ); + else j = a; + } /* end for */ + } /* end else */ + glEnd (); + } else { /* lighting_model != TelLModelNone */ + if ( myData.num_bounds == 3 ) + glBegin ( GL_TRIANGLES ); + else if ( myData.num_bounds == 4 ) + glBegin ( GL_QUADS ); + else glBegin ( GL_POLYGON ); + + if ( pvn ) { + if ( pvt && (AWorkspace->NamedStatus & OPENGL_NS_FORBIDSETTEX) == 0 ) + for ( i = 0, j = 0, a = 0; i < myData.num_facets; ++i ) { + a = j + myData.num_bounds; + if ( myDS->bDraw[ i ] ) + for ( ; j < a; ++j ) { + glNormal3fv ( pvn[ ind[ j ] ].xyz ); + glTexCoord2fv ( pvt[ ind[ j ] ].xy ); + glVertex3fv ( pv[ ind[ j ] ].xyz ); + } /* end for ( j . . . ) */ + else j = a; + } /* end for ( i . . . ) */ + else + for ( i = 0, j = 0, a = 0; i < myData.num_facets; ++i ) { + a = j + myData.num_bounds; + if ( myDS->bDraw[ i ] ) + for ( ; j < a; ++j ) { + glNormal3fv ( pvn[ ind[ j ] ].xyz ); + glVertex3fv ( pv[ ind[ j ] ].xyz ); + } /* end for ( j . . . ) */ + else j = a; + } /* end for ( i . . . ) */ + } else { /* !pvn */ + for ( i = 0, j = 0, a = 0; i < myData.num_facets; ++i ) { + a = j + myData.num_bounds; + if ( myDS->bDraw[ i ] ) { + glNormal3fv ( pfn[ i ].xyz ); + for ( ; j < a; ++j ) glVertex3fv ( pv[ ind[ j ] ].xyz ); + } else j = a; + } /* end for */ + } /* end else */ + glEnd (); + } /* end else */ + } else { + if ( !myDS->dlist ) myDS->dlist = glGenLists ( 1 ); + glNewList ( myDS->dlist, GL_COMPILE_AND_EXECUTE ); + newList = 1; + } /* end else */ + if ( newList ) glEndList (); + if ( AWorkspace->DegenerateModel ) return; + } else { + glCallList ( AWorkspace->SkipRatio <= 0.f ? myDS->list : myDS->dlist ); + if ( AWorkspace->DegenerateModel ) return; + } /* end else */ + } + + i = 0; + + switch ( AWorkspace->DegenerateModel ) + { + default: + break; + + case 2: /* XXX_TDM_WIREFRAME */ + i = 1; + break; + + case 3: /* XXX_TDM_MARKER */ + draw_degenerates_as_points ( AWorkspace->SkipRatio ); + return; + + case 4: /* XXX_TDM_BBOX */ + draw_degenerates_as_bboxs (); + return; + } + + draw_edges ( edge_colour, interior_style, i, AWorkspace ); +} + +/*----------------------------------------------------------------------*/ + +void OpenGl_Mesh::draw_edges (const TEL_COLOUR *edge_colour, const Aspect_InteriorStyle interior_style, + Tint forceDraw, const Handle(OpenGl_Workspace) &AWorkspace) const +{ + const OpenGl_AspectFace *aspect_face = AWorkspace->AspectFace( Standard_True ); + + if ( interior_style != Aspect_IS_HIDDENLINE && !forceDraw && aspect_face->Context().Edge == TOff ) + return; + + glDisable(GL_LIGHTING); + const GLboolean texture_on = IsTextureEnabled(); + if (texture_on) DisableTexture(); + + // Setup line aspect + const OpenGl_AspectLine *aspect_line_old = AWorkspace->SetAspectLine( aspect_face->AspectEdge() ); + AWorkspace->AspectLine( Standard_True ); + + tel_point pv = myData.vertices; + Tint *ind = myData.indices; + Tint *vis = myData.edge_vis; + + Tint i, j, a, newList = 0; + + if ( !forceDraw ) { + + glColor3fv ( edge_colour -> rgb ); + glPushAttrib ( GL_POLYGON_BIT ); + glPolygonMode ( GL_FRONT_AND_BACK, GL_LINE ); + + for ( i = 0, j = 0, a = 0; i < myData.num_facets; ++i ) { + + a = j + myData.num_bounds; + + glBegin ( GL_POLYGON ); + + for ( ; j < a; ++j ) { + + glEdgeFlag ( ( GLboolean )( vis[ j ] == 1 ? GL_TRUE : GL_FALSE ) ); + glVertex3fv ( pv[ ind[ j ] ].xyz ); + + } /* end for */ + + glEnd(); + + glEdgeFlag ( GL_TRUE ); + + } /* end for */ + + glPopAttrib (); + + } else { + + if ( (AWorkspace->NamedStatus & OPENGL_NS_ANIMATION) == 0 ) + goto doDraw; /* Disable object display list out of animation */ + + if ( myDS->degMode != 2 || myDS->skipRatio != AWorkspace->SkipRatio || !myDS->dlist ) { + + if ( !myDS->dlist ) myDS->dlist = glGenLists ( 1 ); + + myDS->degMode = 2; + myDS->skipRatio = AWorkspace->SkipRatio; + glNewList ( myDS->dlist, GL_COMPILE_AND_EXECUTE ); + newList = 1; + +doDraw: + glPushAttrib ( GL_POLYGON_BIT | GL_DEPTH_BUFFER_BIT ); + + glEdgeFlag ( GL_TRUE ); + glDisable ( GL_DEPTH_TEST ); + glPolygonMode ( GL_FRONT_AND_BACK, GL_LINE ); + + if ( AWorkspace->SkipRatio <= 0.f ) + + for ( i = 0, j = 0, a = 0; i < myData.num_facets; ++i ) { + + a = j + myData.num_bounds; + + glBegin ( GL_POLYGON ); + + for ( ; j < a; ++j ) glVertex3fv ( pv[ ind[ j ] ].xyz ); + + glEnd(); + + } /* end for */ + + else if ( AWorkspace->SkipRatio < 1.f ) { + + set_drawable_items ( myDS->bDraw, myData.num_facets, AWorkspace->SkipRatio ); + + for ( i = 0, j = 0, a = 0; i < myData.num_facets; ++i ) { + + a = j + myData.num_bounds; + + if ( myDS->bDraw[ i ] ) { + + glBegin ( GL_POLYGON ); + + for ( ; j < a; ++j ) glVertex3fv ( pv[ ind[ j ] ].xyz ); + + glEnd(); + + } else j = a; + + } /* end for */ + + } /* end if */ + + glPopAttrib (); + if ( newList ) glEndList (); + + } else glCallList ( myDS->dlist ); + + } /* end else */ + + // Restore line context + AWorkspace->SetAspectLine( aspect_line_old ); + + if (texture_on) EnableTexture(); +} + +/*----------------------------------------------------------------------*/ + +void OpenGl_Mesh::draw_degenerates_as_points (const float aSkipRatio) const +{ + Tint* ind, *vis; + Tint i, j, n, a, newList = 0; + GLfloat pt[ 3 ]; + tel_point pv; + + pv = myData.vertices; + ind = myData.indices; + vis = myData.edge_vis; + + glDisable(GL_LIGHTING); + + if ( myDS->degMode != 3 || myDS->skipRatio != aSkipRatio || !myDS->dlist ) { + + if ( !myDS->dlist ) myDS->dlist = glGenLists ( 1 ); + + myDS->degMode = 3; + myDS->skipRatio = aSkipRatio; + glNewList ( myDS->dlist, GL_COMPILE_AND_EXECUTE ); + newList = 1; + + if ( aSkipRatio <= 0.f ) { + + glBegin ( GL_POINTS ); + + for ( i = 0, j = 0, a = 0; i < myData.num_facets; ++i ) { + + n = myData.num_bounds; + a = j + n; + + for ( pt [ 0 ] = pt[ 1 ] = pt[ 2 ] = 0.; j < a; ++j ) { + + pt[ 0 ] += pv[ ind[ j ] ].xyz[ 0 ]; + pt[ 1 ] += pv[ ind[ j ] ].xyz[ 1 ]; + pt[ 2 ] += pv[ ind[ j ] ].xyz[ 2 ]; + + } /* end for ( j ) */ + + pt[ 0 ] /= n; + pt[ 1 ] /= n; + pt[ 2 ] /= n; + + glVertex3fv ( pt ); + + } /* end for ( i ) */ + + glEnd (); + + } else if ( aSkipRatio < 1.f ) { + + set_drawable_items ( myDS->bDraw, myData.num_facets, aSkipRatio ); + + glBegin ( GL_POINTS ); + + for ( i = 0, j = 0, a = 0; i < myData.num_facets; ++i ) { + + n = myData.num_bounds; + a = j + n; + + if ( myDS->bDraw[ i ] ) { + + for ( pt [ 0 ] = pt[ 1 ] = pt[ 2 ] = 0.; j < a; ++j ) { + + pt[ 0 ] += pv[ ind[ j ] ].xyz[ 0 ]; + pt[ 1 ] += pv[ ind[ j ] ].xyz[ 1 ]; + pt[ 2 ] += pv[ ind[ j ] ].xyz[ 2 ]; + + } /* end for ( j ) */ + + pt[ 0 ] /= n; + pt[ 1 ] /= n; + pt[ 2 ] /= n; + + glVertex3fv ( pt ); + + } else j = a; + + } /* end for ( i ) */ + + glEnd (); + + } /* end if */ + + glEndList (); + + } else glCallList ( myDS->dlist ); + +} + +void OpenGl_Mesh::draw_degenerates_as_bboxs () const +{ + Tint* ind, *vis; + Tint i, j, n, a, newList = 0; + GLfloat minp[ 3 ] = { FLT_MAX, FLT_MAX, FLT_MAX }; + GLfloat maxp[ 3 ] = { FLT_MIN, FLT_MIN, FLT_MIN }; + tel_point pv; + + pv = myData.vertices; + ind = myData.indices; + vis = myData.edge_vis; + + glDisable(GL_LIGHTING); + + if ( myDS->degMode != 4 || !myDS->dlist ) { + + if ( !myDS->dlist ) myDS->dlist = glGenLists ( 1 ); + + myDS->degMode = 4; + + glNewList ( myDS->dlist, GL_COMPILE_AND_EXECUTE ); + newList = 1; + + for ( i = 0, j = 0, a = 0; i < myData.num_facets; ++i ) { + + n = myData.num_bounds; + a = j + n; + + for ( ; j < a; ++j ) { + + if ( pv[ ind[ j ] ].xyz[ 0 ] < minp[ 0 ] ) + minp[ 0 ] = pv[ ind[ j ] ].xyz[ 0 ] ; + if ( pv[ ind[ j ] ].xyz[ 1 ] < minp[ 1 ] ) + minp[ 1 ] = pv[ ind[ j ] ].xyz[ 1 ] ; + if ( pv[ ind[ j ] ].xyz[ 2 ] < minp[ 2 ] ) + minp[ 2 ] = pv[ ind[ j ] ].xyz[ 2 ] ; + + if ( pv[ ind[ j ] ].xyz[ 0 ] > maxp[ 0 ] ) + maxp[ 0 ] = pv[ ind[ j ] ].xyz[ 0 ] ; + if ( pv[ ind[ j ] ].xyz[ 1 ] > maxp[ 1 ] ) + maxp[ 1 ] = pv[ ind[ j ] ].xyz[ 1 ] ; + if ( pv[ ind[ j ] ].xyz[ 2 ] > maxp[ 2 ] ) + maxp[ 2 ] = pv[ ind[ j ] ].xyz[ 2 ] ; + + } /* end for ( j ) */ + + } /* end for ( i ) */ + + /* OCC11904 -- Temporarily disable environment mapping */ + glPushAttrib(GL_ENABLE_BIT); + glDisable(GL_TEXTURE_1D); + glDisable(GL_TEXTURE_2D); + + glBegin ( GL_LINE_STRIP ); + + glVertex3fv ( minp ); + glVertex3f ( minp[ 0 ], maxp[ 1 ], minp[ 2 ] ); + glVertex3f ( minp[ 0 ], maxp[ 1 ], maxp[ 2 ] ); + glVertex3f ( minp[ 0 ], minp[ 1 ], maxp[ 2 ] ); + glVertex3f ( minp[ 0 ], minp[ 1 ], minp[ 2 ] ); + + glVertex3f ( maxp[ 0 ], minp[ 1 ], minp[ 2 ] ); + glVertex3f ( maxp[ 0 ], maxp[ 1 ], minp[ 2 ] ); + glVertex3f ( maxp[ 0 ], maxp[ 1 ], maxp[ 2 ] ); + glVertex3f ( maxp[ 0 ], minp[ 1 ], maxp[ 2 ] ); + glVertex3f ( maxp[ 0 ], minp[ 1 ], minp[ 2 ] ); + + glVertex3f ( maxp[ 0 ], minp[ 1 ], maxp[ 2 ] ); + glVertex3f ( minp[ 0 ], minp[ 1 ], maxp[ 2 ] ); + glVertex3f ( minp[ 0 ], maxp[ 1 ], maxp[ 2 ] ); + glVertex3fv ( maxp ); + glVertex3f ( maxp[ 0 ], maxp[ 1 ], minp[ 2 ] ); + glVertex3f ( minp[ 0 ], maxp[ 1 ], minp[ 2 ] ); + + glEnd(); + glPopAttrib(); + glEndList (); + + } else glCallList ( myDS->dlist ); +} + +/*----------------------------------------------------------------------*/ + +void set_drawable_items ( GLboolean* pbDraw, int n, const float aSkipRatio ) +{ + memset ( pbDraw, 0, sizeof ( GLboolean ) * n ); + + int i = ( int )( ( 1.0F - aSkipRatio ) * n ); + + while ( i-- ) pbDraw[ OPENGL_RAND() % n ] = 1; +} + +/*----------------------------------------------------------------------*/ + +OpenGl_Mesh::OpenGl_Mesh (const Graphic3d_Array1OfVertex& AListVertex, const Aspect_Array1OfEdge& AListEdge) +{ + const Standard_Integer nv = AListVertex.Length(); + + // Dynamic allocation + TEL_POINT *points = new TEL_POINT[nv]; + memcpy( points, &AListVertex(AListVertex.Lower()), nv*sizeof(TEL_POINT) ); + + Init (nv,points,NULL,NULL,NULL,AListEdge,3); +} + +/*----------------------------------------------------------------------*/ + +OpenGl_Mesh::OpenGl_Mesh (const Graphic3d_Array1OfVertexN& AListVertex, const Aspect_Array1OfEdge& AListEdge) +{ + const Standard_Integer nv = AListVertex.Length (); + + // Dynamic allocation + TEL_POINT *points = new TEL_POINT[nv]; + TEL_POINT *normals = new TEL_POINT[nv]; + + Standard_Integer i = 0, j = AListVertex.Lower(); + Standard_Real X, Y, Z; + for ( ; i < nv; i++, j++) + { + AListVertex(j).Coord(X, Y, Z); + points[i].xyz[0] = float (X); + points[i].xyz[1] = float (Y); + points[i].xyz[2] = float (Z); + AListVertex(j).Normal(X, Y, Z); + normals[i].xyz[0] = float (X); + normals[i].xyz[1] = float (Y); + normals[i].xyz[2] = float (Z); + } + + Init (nv,points,normals,NULL,NULL,AListEdge,3); +} + +/*----------------------------------------------------------------------*/ + +OpenGl_Mesh::OpenGl_Mesh (const Graphic3d_Array1OfVertexC& AListVertex, const Aspect_Array1OfEdge& AListEdge) +{ + const Standard_Integer nv = AListVertex.Length (); + + // Dynamic allocation + TEL_POINT *points = new TEL_POINT[nv]; + TEL_COLOUR *colors = new TEL_COLOUR[nv]; + + Standard_Integer i = 0, j = AListVertex.Lower(); + Standard_Real X, Y, Z; + for ( ; i < nv; i++, j++) + { + AListVertex(j).Coord(X, Y, Z); + points[i].xyz[0] = float (X); + points[i].xyz[1] = float (Y); + points[i].xyz[2] = float (Z); + AListVertex(j).Color().Values (X, Y, Z, Quantity_TOC_RGB); + colors[i].rgb[0] = float (X); + colors[i].rgb[1] = float (Y); + colors[i].rgb[2] = float (Z); + colors[i].rgb[3] = 1.0F; + } + + Init (nv,points,NULL,colors,NULL,AListEdge,3); +} + +/*----------------------------------------------------------------------*/ + +OpenGl_Mesh::OpenGl_Mesh (const Graphic3d_Array1OfVertexNC& AListVertex, const Aspect_Array1OfEdge& AListEdge) +{ + const Standard_Integer nv = AListVertex.Length (); + + // Dynamic allocation + TEL_POINT *points = new TEL_POINT[nv]; + TEL_POINT *normals = new TEL_POINT[nv]; + TEL_COLOUR *colors = new TEL_COLOUR[nv]; + + Standard_Integer i = 0, j = AListVertex.Lower(); + Standard_Real X, Y, Z; + for ( ; i < nv; i++, j++) + { + AListVertex(j).Coord(X, Y, Z); + points[i].xyz[0] = float (X); + points[i].xyz[1] = float (Y); + points[i].xyz[2] = float (Z); + AListVertex(j).Normal(X, Y, Z); + normals[i].xyz[0] = float (X); + normals[i].xyz[1] = float (Y); + normals[i].xyz[2] = float (Z); + AListVertex(j).Color().Values (X, Y, Z, Quantity_TOC_RGB); + colors[i].rgb[0] = float (X); + colors[i].rgb[1] = float (Y); + colors[i].rgb[2] = float (Z); + colors[i].rgb[3] = 1.0F; + } + + Init (nv,points,normals,colors,NULL,AListEdge,3); +} + +/*----------------------------------------------------------------------*/ + +OpenGl_Mesh::OpenGl_Mesh (const Graphic3d_Array1OfVertexNT& AListVertex, const Aspect_Array1OfEdge& AListEdge) +{ + const Standard_Integer nv = AListVertex.Length (); + + // Dynamic allocation + TEL_POINT *points = new TEL_POINT[nv]; + TEL_POINT *normals = new TEL_POINT[nv]; + TEL_TEXTURE_COORD *tcoords = new TEL_TEXTURE_COORD[nv]; + + Standard_Integer i = 0, j = AListVertex.Lower(); + Standard_Real X, Y, Z; + for ( ; i < nv; i++, j++) + { + AListVertex(j).Coord(X, Y, Z); + points[i].xyz[0] = float (X); + points[i].xyz[1] = float (Y); + points[i].xyz[2] = float (Z); + AListVertex(j).Normal(X, Y, Z); + normals[i].xyz[0] = float (X); + normals[i].xyz[1] = float (Y); + normals[i].xyz[2] = float (Z); + AListVertex(j).TextureCoordinate(X, Y); + tcoords[i].xy[0] = float(X); + tcoords[i].xy[1] = float(Y); + } + + Init (nv,points,normals,NULL,tcoords,AListEdge,3); +} + +/*----------------------------------------------------------------------*/ + +void OpenGl_Mesh::Init (const Tint ANbVertices, tel_point AVertices, + tel_point AVNormals, tel_colour AVColors, tel_texture_coord ATCoords, + const Aspect_Array1OfEdge& AListEdge, const Tint ANbBounds) +{ + // Get number of bounds in a facet + myData.num_bounds = ANbBounds; + + // Get number of vertices + myData.num_vertices = ANbVertices; + + // Get vertices + myData.vertices = AVertices; + + // Get number of edges + const Standard_Integer nb_edges = AListEdge.Length (); + + myData.indices = new Tint[nb_edges]; + myData.edge_vis = new Tint[nb_edges]; + + const Standard_Integer LowerE = AListEdge.Lower (); + const Standard_Integer UpperE = AListEdge.Upper (); + + // Loop on edges + Standard_Integer i, j; + for (j=0, i=LowerE; i<=UpperE; i++, j++) + { + myData.indices[j] = AListEdge(i).FirstIndex() - LowerE; //LastIndex unused + myData.edge_vis[j] = AListEdge(i).Type() ? TOff : TOn; + } + + // Get number of facets + myData.num_facets = nb_edges / ANbBounds; + + myData.vnormals = AVNormals; + if (AVNormals) + { + myData.vertex_flag = TEL_VT_NORMAL; + for( i = 0; i < ANbVertices; i++ ) + vecnrm( myData.vnormals[i].xyz ); + } + else + { + myData.vertex_flag = TEL_VT_NONE; + } + + myData.vcolours = AVColors; + myData.vtexturecoord = ATCoords; + + myData.facet_flag = TEL_FA_NONE; + myData.fnormals = new TEL_POINT[myData.num_facets]; + for( i = 0, j = 0; i < myData.num_facets; i++ ) + { + TelGetPolygonNormal( myData.vertices, &myData.indices[j], myData.num_bounds, myData.fnormals[i].xyz ); + j += myData.num_bounds; + } + + myData.fcolours = NULL; + + myDS = new DS_INTERNAL(); + myDS->list = 0; + myDS->dlist = 0; + myDS->degMode = 0; + myDS->model = -1; + myDS->skipRatio = 0.0F; + myDS->bDraw = new unsigned char[myData.num_facets]; +} + +/*----------------------------------------------------------------------*/ + +OpenGl_Mesh::~OpenGl_Mesh () +{ + if( myData.edge_vis ) + delete[] myData.edge_vis; + if( myData.indices ) + delete[] myData.indices; + if( myData.fcolours ) + delete[] myData.fcolours; + if( myData.fnormals ) + delete[] myData.fnormals; + if( myData.vertices ) + delete[] myData.vertices; + if( myData.vcolours ) + delete[] myData.vcolours; + if( myData.vnormals ) + delete[] myData.vnormals; + if( myData.vtexturecoord ) + delete[] myData.vtexturecoord; + + if ( myDS ) + { + if ( GET_GL_CONTEXT() != NULL ) + { + if ( myDS->list ) glDeleteLists ( myDS->list, 1 ); + if ( myDS->dlist ) glDeleteLists ( myDS->dlist, 1 ); + } + + if ( myDS->bDraw ) + delete[] myDS->bDraw; + + delete myDS; + } +} + +/*----------------------------------------------------------------------*/ + +void OpenGl_Mesh::Render (const Handle(OpenGl_Workspace) &AWorkspace) const +{ + const OpenGl_AspectFace *aspect_face = AWorkspace->AspectFace( Standard_True ); + + Tint front_lighting_model = aspect_face->Context().IntFront.color_mask; + const TEL_COLOUR *interior_colour = &aspect_face->Context().IntFront.matcol; + const TEL_COLOUR *edge_colour = &aspect_face->AspectEdge()->Color(); + + // Use highlight colors + if ( AWorkspace->NamedStatus & OPENGL_NS_HIGHLIGHT ) + { + edge_colour = interior_colour = AWorkspace->HighlightColor; + front_lighting_model = 0; + } + + glColor3fv( interior_colour->rgb ); + + draw_indexpoly( front_lighting_model, + aspect_face->Context().InteriorStyle, + edge_colour, + &aspect_face->Context().IntFront, + AWorkspace ); +} + +/*----------------------------------------------------------------------*/ diff --git a/src/OpenGl/OpenGl_Mesh.hxx b/src/OpenGl/OpenGl_Mesh.hxx new file mode 100644 index 0000000000..69157e2908 --- /dev/null +++ b/src/OpenGl/OpenGl_Mesh.hxx @@ -0,0 +1,78 @@ +// File: OpenGl_Mesh.hxx +// Created: 13 July 2011 +// Author: Sergey ZERCHANINOV +// Copyright: OPEN CASCADE 2011 + +#ifndef OpenGl_Mesh_Header +#define OpenGl_Mesh_Header + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +struct TEL_INDEXPOLY_DATA +{ + Tint num_vertices; /* Number of vertices */ + Tint num_facets; /* Number of facets (triangles, quadrangles or polygons) */ + Tint num_bounds; /* Number of bounds in a facet (3, 4 or more) */ + Tint facet_flag; /* TEL_FA_NONE or TEL_FA_NORMAL */ + Tint vertex_flag; /* TEL_VT_NONE or TEL_VT_NORMAL */ + Tint *edge_vis; /* Edge visibility indicators for each edge */ + Tint *indices; /* Connectivity array */ + tel_point fnormals; /* Facet normals */ + tel_colour fcolours; /* Facet colour values */ + tel_point vertices; /* Vertices */ + tel_colour vcolours; /* Vertex colour values */ + tel_point vnormals; /* Vertex normals */ + tel_texture_coord vtexturecoord; /* Texture Coordinates */ + IMPLEMENT_MEMORY_OPERATORS +}; + +class OpenGl_Mesh : public OpenGl_Element +{ + public: + + OpenGl_Mesh (const Graphic3d_Array1OfVertex& AListVertex, const Aspect_Array1OfEdge& AListEdge); + OpenGl_Mesh (const Graphic3d_Array1OfVertexN& AListVertex, const Aspect_Array1OfEdge& AListEdge); + OpenGl_Mesh (const Graphic3d_Array1OfVertexC& AListVertex, const Aspect_Array1OfEdge& AListEdge); + OpenGl_Mesh (const Graphic3d_Array1OfVertexNC& AListVertex, const Aspect_Array1OfEdge& AListEdge); + OpenGl_Mesh (const Graphic3d_Array1OfVertexNT& AListVertex, const Aspect_Array1OfEdge& AListEdge); + + virtual ~OpenGl_Mesh (); + + virtual void Render (const Handle(OpenGl_Workspace) &AWorkspace) const; + + protected: + + void Init (const Tint ANbVertices, tel_point AVertices, + tel_point AVNormals, tel_colour AVColors, tel_texture_coord ATCoords, + const Aspect_Array1OfEdge& AListEdge, const Tint ANbBounds); + + void draw_indexpoly (const Tint, /* front_lighting_model, */ + const Aspect_InteriorStyle, /* interior_style, */ + const TEL_COLOUR *, /* edge_colour, */ + const OPENGL_SURF_PROP *, + const Handle(OpenGl_Workspace) &) const; + + void draw_degenerates_as_points (const float) const; + + void draw_degenerates_as_bboxs () const; + + void draw_edges (const TEL_COLOUR *, const Aspect_InteriorStyle, Tint, const Handle(OpenGl_Workspace) &) const; + + TEL_INDEXPOLY_DATA myData; + DS_INTERNAL *myDS; + + public: + IMPLEMENT_MEMORY_OPERATORS +}; + +#endif //OpenGl_Mesh_Header diff --git a/src/OpenGl/OpenGl_NamedStatus.hxx b/src/OpenGl/OpenGl_NamedStatus.hxx new file mode 100644 index 0000000000..cd1f0f7dc9 --- /dev/null +++ b/src/OpenGl/OpenGl_NamedStatus.hxx @@ -0,0 +1,29 @@ +// File: OpenGl_NamedStatus.hxx +// Created: 20 September 2011 +// Author: Sergey ZERCHANINOV +// Copyright: OPEN CASCADE 2011 + +#ifndef _OpenGl_NamedStatus_Header +#define _OpenGl_NamedStatus_Header + +// Dynamic fields +#define OPENGL_NS_HIDE (1<<0) +#define OPENGL_NS_PICK (1<<1) +#define OPENGL_NS_HIGHLIGHT (1<<2) +#define OPENGL_NS_WIREFRAME (1<<3) +#define OPENGL_NS_RESMAT (1<<4) +#define OPENGL_NS_ADD (1<<5) +#define OPENGL_NS_IMMEDIATE (1<<6) +#define OPENGL_NS_TEXTURE (1<<7) +#define OPENGL_NS_ANTIALIASING (1<<8) +#define OPENGL_NS_ANIMATION (1<<9) +#define OPENGL_NS_UPDATEAM (1<<10) +#define OPENGL_NS_DEGENERATION (1<<11) +#define OPENGL_NS_2NDPASSNEED (1<<12) +#define OPENGL_NS_2NDPASSDO (1<<13) +#define OPENGL_NS_FORBIDSETTEX (1<<14) +#define OPENGL_NS_FLIST (1<<15) +#define OPENGL_NS_WHITEBACK (1<<16) +#define OPENGL_NS_ISBITMAP (1<<17) + +#endif //_OpenGl_NamedStatus_Header diff --git a/src/OpenGl/OpenGl_Polygon.cxx b/src/OpenGl/OpenGl_Polygon.cxx new file mode 100644 index 0000000000..2fce78863a --- /dev/null +++ b/src/OpenGl/OpenGl_Polygon.cxx @@ -0,0 +1,704 @@ +// File: OpenGl_Polygon.cxx +// Created: 13 July 2011 +// Author: Sergey ZERCHANINOV +// Copyright: OPEN CASCADE 2011 + +#include + +#include + +#include +#include +#include +#include + +#include +#include + +#include + +#if (defined(_WIN32) || defined(__WIN32__)) + #define STATIC +#else + #define STATIC static +#endif + +struct EXTRA_VERTEX +{ + GLfloat vert[3]; + int ind; + IMPLEMENT_MEMORY_OPERATORS +}; +typedef EXTRA_VERTEX* extra_vertex; + +struct SEQ_ +{ + Tint ts_num, ts_alloc; + void **tmesh_sequence; + GLenum triangle_type; /* FSXXX OPTI */ + IMPLEMENT_MEMORY_OPERATORS +}; + +struct OPENGL_DISPLAY_PGN +{ + Tint num_of_seq; + Tint num_alloc; + SEQ_ *seq; + IMPLEMENT_MEMORY_OPERATORS +}; + +static void bgntriangulate( const TEL_POLYGON_DATA *, void (APIENTRY*)() ); +static void endtriangulate(void); + +#ifndef GLU_VERSION_1_2 + #define GLUtesselator GLUtriangulatorObj + void gluTessBeginContour(); + void gluTessBeginPolygon(); + void gluTessEndPolygon(); + void gluTessEndContour(); + #define GLU_TESS_BEGIN 100100 + #define GLU_TESS_VERTEX 100101 + #define GLU_TESS_END 100102 + #define GLU_TESS_ERROR 100103 + #define GLU_TESS_COMBINE 100105 +#endif + +/*----------------------------------------------------------------------*/ + +void OpenGl_Polygon::draw_polygon (const Handle(OpenGl_Workspace) &AWorkspace, Tint front_lighting_model) const +{ + Tint i; + + tel_point ptr; + tel_point pvn; + tel_colour pfc, pvc; + tel_texture_coord pvt; + + pfc = myData.fcolour; + pvc = myData.vcolours; + pvn = myData.vnormals; + pvt = myData.vtexturecoord; + + if ( AWorkspace->NamedStatus & OPENGL_NS_HIGHLIGHT ) + pvc = pfc = NULL; + + ptr = myData.vertices; + if ( pfc ) + glColor3fv( pfc->rgb ); + if ( front_lighting_model ) + glNormal3fv( myData.fnormal.xyz ); + + if( myData.reverse_order ) glFrontFace( GL_CW ); + + if (myData.num_vertices == 3) glBegin(GL_TRIANGLES); + else if(myData.num_vertices == 4) glBegin(GL_QUADS); + else glBegin(GL_POLYGON); + if( front_lighting_model ) + { + if( pvn ) + { + if (pvt && (AWorkspace->NamedStatus & OPENGL_NS_FORBIDSETTEX) == 0) + for( i=0; ixyz ); + } + else + for( i=0; ixyz ); + } + } + else + { + for( i=0; ixyz ); + } + } + } + else + { + if( pvc ) + { + for( i=0; ixyz ); + } + } + else + { + for( i=0; ixyz ); + } + } + } + glEnd(); + if( myData.reverse_order ) glFrontFace( GL_CCW ); + +} + +/*----------------------------------------------------------------------*/ + +/* JWR - allow varying the size */ + +#define INCREMENT 8 + +static int seq_increment = INCREMENT; + +static const TEL_POLYGON_DATA *DaTa; +static GLUtesselator *tripak = 0; + +STATIC void APIENTRY +out_bgntmesh( GLenum triangle_type ) +{ + OPENGL_DISPLAY_PGN *dis = DaTa->dsply; + + dis->num_of_seq++; + if( dis->num_alloc < dis->num_of_seq ) + { + dis->num_alloc += seq_increment; + + if( dis->seq == 0 ) + { + dis->seq = new SEQ_[dis->num_alloc]; + } + else + { +#if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x530) + dis->seq = (SEQ_*)realloc( dis->seq, dis->num_alloc*sizeof(SEQ_) ); +#else + dis->seq = cmn_resizemem( dis->seq, dis->num_alloc ); +#endif + } + } + dis->seq[ dis->num_of_seq - 1 ].ts_num = 0; + dis->seq[ dis->num_of_seq - 1 ].ts_alloc = 0; + dis->seq[ dis->num_of_seq - 1 ].tmesh_sequence = 0; + +#ifdef JWR_DEC_TRIFAN_BUG + dis->seq[ dis->num_of_seq - 1 ].triangle_type = GL_POLYGON; + glBegin(GL_POLYGON); +#else + dis->seq[ dis->num_of_seq - 1 ].triangle_type = triangle_type; + glBegin(triangle_type); +#endif +} + +/*----------------------------------------------------------------------*/ + +STATIC void APIENTRY +out_vert1( void *data ) +{ + SEQ_ *s = &( DaTa->dsply->seq[ DaTa->dsply->num_of_seq - 1 ] ); + + s->ts_num++; + if( s->ts_alloc < s->ts_num ) + { + s->ts_alloc += seq_increment; + + if( s->tmesh_sequence == 0 ) + { + s->tmesh_sequence = new void*[s->ts_alloc]; + } + else + { +#if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x530) + s->tmesh_sequence = (void**)realloc( s->tmesh_sequence, s->ts_alloc*sizeof(void*)); +#else + s->tmesh_sequence = cmn_resizemem( s->tmesh_sequence, s->ts_alloc); +#endif + } + } + s->tmesh_sequence[ s->ts_num - 1 ] = data; + + + if ( data < (void *)0xffff ) { + long a = (long)data; + + glVertex3fv( DaTa->vertices[a].xyz ); + } + else { + extra_vertex b = (extra_vertex) data; + + glVertex3fv( b->vert ); + } + +} + +/*----------------------------------------------------------------------*/ + +STATIC void APIENTRY +out_vert2( void *data ) +{ + SEQ_ *s = &( DaTa->dsply->seq[ DaTa->dsply->num_of_seq - 1 ] ); + + s->ts_num++; + if( s->ts_alloc < s->ts_num ) + { + s->ts_alloc += seq_increment; + + if( s->tmesh_sequence == 0 ) + { + s->tmesh_sequence = new void*[s->ts_alloc]; + } + else + { +#if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x530) + s->tmesh_sequence = (void**)( s->tmesh_sequence, s->ts_alloc*sizeof(void*) ); +#else + s->tmesh_sequence = cmn_resizemem( s->tmesh_sequence, s->ts_alloc ); +#endif + } + } + s->tmesh_sequence[ s->ts_num - 1 ] = data; + + if ( data < (void *)0xffff ) { + long a = (long)data; + + glColor3fv( DaTa->vcolours[a].rgb ); + glVertex3fv( DaTa->vertices[a].xyz ); + } + else { + extra_vertex b = (extra_vertex) data; + + glColor3fv( DaTa->vcolours[(b->ind)].rgb ); + glVertex3fv( b->vert ); + } +} + +/*----------------------------------------------------------------------*/ + +STATIC void APIENTRY +out_vert3( void *data ) +{ + SEQ_ *s = &( DaTa->dsply->seq[ DaTa->dsply->num_of_seq - 1 ] ); + + s->ts_num++; + if( s->ts_alloc < s->ts_num ) + { + s->ts_alloc += seq_increment; + + if( s->tmesh_sequence == 0 ) + { + s->tmesh_sequence = new void*[s->ts_alloc]; + } + else + { +#if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x530) + s->tmesh_sequence = (void**)realloc( s->tmesh_sequence, s->ts_alloc*sizeof(void*) ); +#else + s->tmesh_sequence = cmn_resizemem( s->tmesh_sequence, s->ts_alloc ); +#endif + } + } + s->tmesh_sequence[ s->ts_num - 1 ] = data; + + if ( data <= (void *)0xffff ) { + long a = (long)data; + + glNormal3fv( DaTa->vnormals[a].xyz ); + glVertex3fv( DaTa->vertices[a].xyz); + } + else { + extra_vertex b = (extra_vertex) data; + + glNormal3fv( DaTa->vnormals[(b->ind)].xyz ); + glVertex3fv( b->vert ); + } +} + +/*----------------------------------------------------------------------*/ + +STATIC void APIENTRY +mycombine( GLdouble coords[3], int *data, GLfloat w[4], void **dataout) +{ + extra_vertex new_vertex = (extra_vertex) malloc(sizeof(EXTRA_VERTEX)); + + new_vertex->vert[0] = ( float )coords[0]; + new_vertex->vert[1] = ( float )coords[1]; + new_vertex->vert[2] = ( float )coords[2]; + new_vertex->ind = *data; + *dataout = new_vertex; +} + +/*----------------------------------------------------------------------*/ + +STATIC void APIENTRY +out_endtmesh( void ) +{ + glEnd(); +} + +/*----------------------------------------------------------------------*/ + +STATIC void APIENTRY +out_error( GLenum error ) +{ + printf( "POLYGON : %s\n", (char *) gluErrorString(error) ); +} + +/*----------------------------------------------------------------------*/ + +static void +bgntriangulate(const TEL_POLYGON_DATA *d, void ( APIENTRY * out_ver)() ) +{ + DaTa = d; + + tripak = gluNewTess(); + +#if defined(linux) && !defined(NOGLUfuncptr) + gluTessCallback( tripak, GLU_TESS_BEGIN, (_GLUfuncptr)(out_bgntmesh) ); + gluTessCallback( tripak, GLU_TESS_VERTEX, out_ver ); + gluTessCallback( tripak, GLU_TESS_END, out_endtmesh ); + gluTessCallback( tripak, GLU_TESS_ERROR, (_GLUfuncptr)(out_error) ); + gluTessCallback( tripak, GLU_TESS_COMBINE, (_GLUfuncptr)(mycombine) ); +#else + gluTessCallback( tripak, GLU_TESS_BEGIN, (void (APIENTRY*)())out_bgntmesh ); + gluTessCallback( tripak, GLU_TESS_VERTEX, (void (APIENTRY*)())out_ver ); + gluTessCallback( tripak, GLU_TESS_END, (void (APIENTRY*)())out_endtmesh ); + gluTessCallback( tripak, GLU_TESS_ERROR, (void (APIENTRY*)())out_error ); + gluTessCallback( tripak, GLU_TESS_COMBINE, (void (APIENTRY*)())mycombine ); +#endif +} + +/*----------------------------------------------------------------------*/ + +static void +endtriangulate() +{ + DaTa = 0; + gluDeleteTess(tripak); +} + +/*----------------------------------------------------------------------*/ + +void OpenGl_Polygon::draw_polygon_concav (const Handle(OpenGl_Workspace) &AWorkspace, Tint front_lighting_model) const +{ + long i; + + tel_point pvn; + tel_point ptr; + tel_colour pfc, pvc; + GLdouble xyz[3]; + + pfc = myData.fcolour; + pvc = myData.vcolours; + pvn = myData.vnormals; + + if ( AWorkspace->NamedStatus & OPENGL_NS_HIGHLIGHT ) + pvc = pfc = NULL; + + ptr = myData.vertices; + DaTa = &myData; + + if ( pfc ) + glColor3fv( pfc->rgb ); + if ( front_lighting_model ) + glNormal3fv( myData.fnormal.xyz ); + + if( myData.reverse_order ) glFrontFace( GL_CW ); + + if( !myData.dsply ) + { + if( front_lighting_model ) + { + if( pvn ) + { + bgntriangulate(&myData, (void (APIENTRY*)())out_vert3); + } + else + { + bgntriangulate(&myData, (void (APIENTRY*)())out_vert1); + } + } + else + { + if( pvc ) + { + bgntriangulate(&myData, (void (APIENTRY*)())out_vert2); + } + else + { + bgntriangulate(&myData, (void (APIENTRY*)())out_vert1); + } + } + gluTessBeginPolygon( tripak, NULL ); + gluTessBeginContour( tripak); + + for( i=0; ixyz[0]; + xyz[1] = ptr->xyz[1]; + xyz[2] = ptr->xyz[2]; +#ifndef WNT + gluTessVertex( tripak, xyz,(void * ) i ); +#else + { + double v[ 3 ] = {ptr -> xyz[ 0 ], ptr -> xyz[ 1 ], ptr -> xyz[ 2 ]}; + gluTessVertex ( tripak, v, ( void* )i ); + } +#endif /* WNT */ + } + gluTessEndContour( tripak ); + gluTessEndPolygon( tripak ); + endtriangulate(); + } + else + { + if( front_lighting_model ) + { + draw_tmesh( pvn? 3 : 1 ); + } + else + { + draw_tmesh( pvc? 2 : 1 ); + } + } + + if( myData.reverse_order ) glFrontFace( GL_CCW ); +} + +/*----------------------------------------------------------------------*/ + +void OpenGl_Polygon::draw_edges (const TEL_COLOUR *edge_colour, const Aspect_InteriorStyle interior_style, const Handle(OpenGl_Workspace) &AWorkspace) const +{ + const OpenGl_AspectFace *aspect_face = AWorkspace->AspectFace( Standard_True ); + + if ( interior_style != Aspect_IS_HIDDENLINE && aspect_face->Context().Edge == TOff ) + return; + + glDisable(GL_LIGHTING); + const GLboolean texture_on = IsTextureEnabled(); + if (texture_on) DisableTexture(); + + // Setup line aspect + const OpenGl_AspectLine *aspect_line_old = AWorkspace->SetAspectLine( aspect_face->AspectEdge() ); + AWorkspace->AspectLine( Standard_True ); + + Tint i; + tel_point ptr = myData.vertices; + + glColor3fv( edge_colour->rgb ); + + glBegin(GL_LINE_LOOP); + for( i=0; ixyz ); + } + glEnd(); + + // Restore line context + AWorkspace->SetAspectLine( aspect_line_old ); + + if (texture_on) EnableTexture(); +} + +/*----------------------------------------------------------------------*/ + +void OpenGl_Polygon::draw_tmesh ( Tint v ) const +{ + Tint i, j, k; + SEQ_ *s; + extra_vertex b; + + OPENGL_DISPLAY_PGN *dis = myData.dsply; + for( i = 0; i < dis->num_of_seq; i++ ) + { + s = &(dis->seq[i]); + + glBegin(s->triangle_type); + switch( v ) + { + case 1: + { + for( j = 0, k = 0; j < s->ts_num; j++ ) + { + if ( s->tmesh_sequence[j] < (void *)0xffff ) + glVertex3fv( myData.vertices[ (long)s->tmesh_sequence[ j ] ].xyz ); + else { + extra_vertex b = (extra_vertex)s->tmesh_sequence[j]; + glVertex3fv( b->vert ); + } + + } + break; + } + case 2: + { + for( j = 0, k = 0; j < s->ts_num; j++ ) + { + if ( s->tmesh_sequence[j] < (void *)0xffff ) { + glColor3fv( myData.vcolours[ (long) s->tmesh_sequence[ j ] ].rgb ); + glVertex3fv( myData.vertices[ (long) s->tmesh_sequence[ j ] ].xyz ); + } else { + b = (extra_vertex) s->tmesh_sequence[j]; + glColor3fv( myData.vcolours[(b->ind)].rgb); + glVertex3fv( b->vert ); + } + } + break; + } + case 3: + { + for( j = 0, k = 0; j < s->ts_num; j++ ) + { + if ( s->tmesh_sequence[j] < (void *)0xffff ) { + glNormal3fv( myData.vnormals[ (long) s->tmesh_sequence[ j ] ].xyz); + glVertex3fv( myData.vertices[ (long) s->tmesh_sequence[ j ] ].xyz); + } else { + b = (extra_vertex) s->tmesh_sequence[j]; + glNormal3fv( myData.vnormals[(b->ind)].xyz); + glVertex3fv( b->vert ); + } + } + break; + } + } + glEnd(); + } +} + +/*----------------------------------------------------------------------*/ + +OpenGl_Polygon::OpenGl_Polygon (const Graphic3d_Array1OfVertex& AListVertex, + const Graphic3d_TypeOfPolygon AType) +{ + const Standard_Integer nv = AListVertex.Length(); + + myData.num_vertices = nv; + + myData.vertices = new TEL_POINT[nv]; + memcpy( myData.vertices, &AListVertex(AListVertex.Lower()), nv*sizeof(TEL_POINT) ); + + myData.vertex_flag = TEL_VT_NONE; + myData.vnormals = NULL; + + myData.vcolours = NULL; + + myData.vtexturecoord = NULL; + + myData.reverse_order = 0; + + myData.facet_flag = TEL_FA_NONE; + TelGetPolygonNormal( myData.vertices, NULL, nv, myData.fnormal.xyz ); + + myData.fcolour = NULL; + +#if defined(__sgi) || defined(IRIX) + // Pb with tesselator on sgi + myData.shape_flag = TEL_SHAPE_CONVEX; +#else + switch (AType) + { + case Graphic3d_TOP_UNKNOWN : + myData.shape_flag = TEL_SHAPE_UNKNOWN; + break; + case Graphic3d_TOP_COMPLEX : + myData.shape_flag = TEL_SHAPE_COMPLEX; + break; + case Graphic3d_TOP_CONCAVE : + myData.shape_flag = TEL_SHAPE_CONCAVE; + break; + //case Graphic3d_TOP_CONVEX : + default : + myData.shape_flag = TEL_SHAPE_CONVEX; + break; + } +#endif + + myData.dsply = new OPENGL_DISPLAY_PGN(); + myData.dsply->num_of_seq = 0; + myData.dsply->num_alloc = 0; + myData.dsply->seq = NULL; +} + +/*----------------------------------------------------------------------*/ + +OpenGl_Polygon::~OpenGl_Polygon () +{ + if( myData.fcolour ) + delete myData.fcolour; + if( myData.vertices ) + delete[] myData.vertices; + if( myData.vcolours ) + delete[] myData.vcolours; + if( myData.vnormals ) + delete[] myData.vnormals; + if ( myData.vtexturecoord ) + delete myData.vtexturecoord; + + if ( myData.dsply ) + { + Tint i, j; + + for( i = 0; i < myData.dsply->num_of_seq; i++ ) + { + if(myData.dsply->seq[i].tmesh_sequence) { + for ( j = 0; j < myData.dsply->seq[i].ts_num ; j++ ) { + if ( myData.dsply->seq[i].tmesh_sequence[j] >= (void *)0xffff ) + free(myData.dsply->seq[i].tmesh_sequence[j]); + } + } + delete[] myData.dsply->seq[i].tmesh_sequence; + } + delete[] myData.dsply->seq; + delete myData.dsply; + } +} + +/*----------------------------------------------------------------------*/ + +void OpenGl_Polygon::Render (const Handle(OpenGl_Workspace) &AWorkspace) const +{ + const OpenGl_AspectFace *aspect_face = AWorkspace->AspectFace( Standard_True ); + + Tint front_lighting_model = aspect_face->Context().IntFront.color_mask; + const Aspect_InteriorStyle interior_style = aspect_face->Context().InteriorStyle; + const TEL_COLOUR *interior_colour = &aspect_face->Context().IntFront.matcol; + const TEL_COLOUR *edge_colour = &aspect_face->AspectEdge()->Color(); + + // Use highlight colous + if ( AWorkspace->NamedStatus & OPENGL_NS_HIGHLIGHT ) + { + edge_colour = interior_colour = AWorkspace->HighlightColor; + front_lighting_model = 0; + } + + if( interior_style != Aspect_IS_EMPTY && AWorkspace->DegenerateModel < 2 ) + { + if ( front_lighting_model ) + glEnable(GL_LIGHTING); + else + glDisable(GL_LIGHTING); + + glColor3fv( interior_colour->rgb ); + + if( myData.shape_flag != TEL_SHAPE_CONVEX ) + draw_polygon_concav( AWorkspace, front_lighting_model ); + else + draw_polygon( AWorkspace, front_lighting_model ); + } + + /* OCC11904 -- Temporarily disable environment mapping */ + glPushAttrib(GL_ENABLE_BIT); + glDisable(GL_TEXTURE_1D); + glDisable(GL_TEXTURE_2D); + + switch ( AWorkspace->DegenerateModel ) + { + default: + draw_edges ( edge_colour, interior_style, AWorkspace ); + break; + case 3: /* marker degeneration */ + break; + } + + glPopAttrib(); /* skt: GL_ENABLE_BIT*/ +} + +/*----------------------------------------------------------------------*/ diff --git a/src/OpenGl/OpenGl_Polygon.hxx b/src/OpenGl/OpenGl_Polygon.hxx new file mode 100644 index 0000000000..c5089a7758 --- /dev/null +++ b/src/OpenGl/OpenGl_Polygon.hxx @@ -0,0 +1,62 @@ +// File: OpenGl_Polygon.hxx +// Created: 13 July 2011 +// Author: Sergey ZERCHANINOV +// Copyright: OPEN CASCADE 2011 + +#ifndef OpenGl_Polygon_Header +#define OpenGl_Polygon_Header + +#include +#include +#include +#include + +#include + +struct OPENGL_DISPLAY_PGN; + +struct TEL_POLYGON_DATA +{ + Tint num_vertices; /* Number of vertices */ + Tint facet_flag; /* TEL_FA_NONE or TEL_FA_NORMAL */ + Tint vertex_flag; /* TEL_VT_NONE or TEL_VT_NORMAL */ + Tint shape_flag; /* TEL_SHAPE_UNKNOWN or TEL_SHAPE_COMPLEX or + TEL_SHAPE_CONVEX or TEL_SHAPE_CONCAVE */ + Tint reverse_order; /* 1 if polygon vertex must be display in reverse order */ + TEL_POINT fnormal; /* Facet normal */ + tel_colour fcolour; /* Facet colour */ + tel_point vertices; /* Vertices */ + tel_colour vcolours; /* Vertex colour values */ + tel_point vnormals; /* Vertex normals */ + tel_texture_coord vtexturecoord; /* Texture Coordinates */ + OPENGL_DISPLAY_PGN *dsply; + IMPLEMENT_MEMORY_OPERATORS +}; + +class OpenGl_Polygon : public OpenGl_Element +{ + public: + + OpenGl_Polygon (const Graphic3d_Array1OfVertex& AListVertex, + const Graphic3d_TypeOfPolygon AType); + virtual ~OpenGl_Polygon (); + + virtual void Render (const Handle(OpenGl_Workspace) &AWorkspace) const; + + protected: + + void draw_polygon_concav (const Handle(OpenGl_Workspace) &AWorkspace, Tint) const; + + void draw_polygon (const Handle(OpenGl_Workspace) &AWorkspace, Tint) const; + + void draw_tmesh (Tint) const; + + void draw_edges (const TEL_COLOUR *, const Aspect_InteriorStyle, const Handle(OpenGl_Workspace) &) const; + + TEL_POLYGON_DATA myData; + + public: + IMPLEMENT_MEMORY_OPERATORS +}; + +#endif //OpenGl_Polygon_Header diff --git a/src/OpenGl/OpenGl_Polyline.cxx b/src/OpenGl/OpenGl_Polyline.cxx new file mode 100644 index 0000000000..061dd4f7ea --- /dev/null +++ b/src/OpenGl/OpenGl_Polyline.cxx @@ -0,0 +1,111 @@ +// File: OpenGl_Polyline.cxx +// Created: 13 July 2011 +// Author: Sergey ZERCHANINOV +// Copyright: OPEN CASCADE 2011 + +#include + +#include +#include + +#include +#include + +/*----------------------------------------------------------------------*/ + +OpenGl_Polyline::OpenGl_Polyline (const Graphic3d_Array1OfVertex& AListVertex) +: myNbVertices(AListVertex.Length()), + myVertices(NULL), + myColors(NULL) +{ + myVertices = new TEL_POINT[myNbVertices]; + memcpy( myVertices, &AListVertex(AListVertex.Lower()), myNbVertices*sizeof(TEL_POINT) ); +} + +/*----------------------------------------------------------------------*/ + +OpenGl_Polyline::OpenGl_Polyline (const Graphic3d_Array1OfVertexC& AListVertex) +: myNbVertices(AListVertex.Length()), + myVertices(NULL), + myColors(NULL) +{ + myVertices = new TEL_POINT[myNbVertices]; + myColors = new TEL_COLOUR[myNbVertices]; + + Standard_Integer i = 0, j = AListVertex.Lower(); + Standard_Real X, Y, Z; + for ( ; i < myNbVertices; i++, j++) + { + AListVertex(j).Coord(X, Y, Z); + myVertices[i].xyz[0] = float (X); + myVertices[i].xyz[1] = float (Y); + myVertices[i].xyz[2] = float (Z); + AListVertex(j).Color().Values(X, Y, Z, Quantity_TOC_RGB); + myColors[i].rgb[0] = float (X); + myColors[i].rgb[1] = float (Y); + myColors[i].rgb[2] = float (Z); + myColors[i].rgb[3] = 1.0F; + } +} + +/*----------------------------------------------------------------------*/ + +OpenGl_Polyline::OpenGl_Polyline (const Standard_Real X1,const Standard_Real Y1,const Standard_Real Z1, + const Standard_Real X2,const Standard_Real Y2,const Standard_Real Z2) +: myNbVertices(2), + myVertices(new TEL_POINT[2]), + myColors(NULL) +{ + myVertices[0].xyz[0] = float (X1); + myVertices[0].xyz[1] = float (Y1); + myVertices[0].xyz[2] = float (Z1); + myVertices[1].xyz[0] = float (X2); + myVertices[1].xyz[1] = float (Y2); + myVertices[1].xyz[2] = float (Z2); +} + +/*----------------------------------------------------------------------*/ + +OpenGl_Polyline::~OpenGl_Polyline () +{ + if ( myVertices ) + delete[] myVertices; + if( myColors ) + delete[] myColors; +} + +/*----------------------------------------------------------------------*/ + +void OpenGl_Polyline::Render (const Handle(OpenGl_Workspace)& theWorkspace) const +{ + // Apply line aspect + const OpenGl_AspectLine* anAspectLine = theWorkspace->AspectLine (Standard_True); + + // Temporarily disable environment mapping + glPushAttrib (GL_ENABLE_BIT); + glDisable (GL_TEXTURE_1D); + glDisable (GL_TEXTURE_2D); + + glBegin (theWorkspace->DegenerateModel != 3 ? GL_LINE_STRIP : GL_POINTS); + if (!myColors || (theWorkspace->NamedStatus & OPENGL_NS_HIGHLIGHT)) + { + // Use highlight colors + glColor3fv ((theWorkspace->NamedStatus & OPENGL_NS_HIGHLIGHT) ? theWorkspace->HighlightColor->rgb : anAspectLine->Color().rgb); + + for (Tint i = 0; i < myNbVertices; ++i) + glVertex3fv (myVertices[i].xyz); + } + else + { + for (Tint i = 0; i < myNbVertices; ++i) + { + glColor3fv (myColors[i].rgb); + glVertex3fv (myVertices[i].xyz); + } + } + glEnd(); + + glPopAttrib(); +} + +/*----------------------------------------------------------------------*/ diff --git a/src/OpenGl/OpenGl_Polyline.hxx b/src/OpenGl/OpenGl_Polyline.hxx new file mode 100644 index 0000000000..72b5f3f3d9 --- /dev/null +++ b/src/OpenGl/OpenGl_Polyline.hxx @@ -0,0 +1,38 @@ +// File: OpenGl_Polyline.hxx +// Created: 13 July 2011 +// Author: Sergey ZERCHANINOV +// Copyright: OPEN CASCADE 2011 + +#ifndef OpenGl_Polyline_Header +#define OpenGl_Polyline_Header + +#include + +#include + +#include +#include + +class OpenGl_Polyline : public OpenGl_Element +{ + public: + + OpenGl_Polyline (const Graphic3d_Array1OfVertex& AListVertex); + OpenGl_Polyline (const Graphic3d_Array1OfVertexC& AListVertex); + OpenGl_Polyline (const Standard_Real X1,const Standard_Real Y1,const Standard_Real Z1, + const Standard_Real X2,const Standard_Real Y2,const Standard_Real Z2); + virtual ~OpenGl_Polyline (); + + virtual void Render (const Handle(OpenGl_Workspace) &AWorkspace) const; + + protected: + + Tint myNbVertices; // Number of vertices in vertices array + tel_point myVertices; // Vertices array of length myNbVertices + tel_colour myColors; // Vertex color values for each vertex + + public: + IMPLEMENT_MEMORY_OPERATORS +}; + +#endif //OpenGl_Polyline_Header diff --git a/src/OpenGl/OpenGl_PrimitiveArray.cxx b/src/OpenGl/OpenGl_PrimitiveArray.cxx index 70aa0f20ba..d1756ab4bd 100755 --- a/src/OpenGl/OpenGl_PrimitiveArray.cxx +++ b/src/OpenGl/OpenGl_PrimitiveArray.cxx @@ -1,1777 +1,1791 @@ -/* -File OpenGl_PrimitiveArray.c - -Created 16/06/2000 : ATS : G005 : Modified version of OpenGl_indexpolygons.c, which use glDrawArrays or glDrawElements for rendering of primitive -21.06.03 : SAN : suppress display at all in animation mode if degenartion ratio == 1 (FULL_DEGENER) -03.07.03 : SAN : draw_degenerates_as_lines() function - all client states disabled except GL_VERTEX_ARRAY -in order to avoid exceptions in animation mode (OCC3192) -*/ - -#define xOGLBUG /* UNFORTUNATLY the edge flags are attached to vertexes -and not to the edges. So the edge visibillity flags array -is not usable. -*/ - -#define xPRINT - -#define TEST - -#define FULL_DEGENER -#define OCC3192 - - -#ifndef OGL_Max -#define OGL_Max(a,b) ((a) > (b) ? (a) : (b)) -#endif - -#ifndef OGL_Rand -static unsigned long vRand = 1L; -#define OGL_Rand() (vRand = vRand * 214013L + 2531011L) -#endif - - -#define OCC7833 /* ASL 26/01/05 transparency of polygon with colors assigned to vertices */ - -/*----------------------------------------------------------------------*/ -/* -* Includes -*/ +// File: OpenGl_PrimitiveArray.cxx +// Created: 13 July 2011 +// Author: Sergey ZERCHANINOV +// Copyright: OPEN CASCADE 2011 #include +#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include #include #include +#include +#include + #include -#include -#include - -# include -# define DEF_DS_INTERNAL -# include - -#include - -extern GLboolean g_fBitmap; - -typedef CALL_DEF_PARRAY *call_def_parray; - -#define GL_ARRAY_BUFFER_ARB 0x8892 -#define GL_STATIC_DRAW_ARB 0x88E4 -#define GL_ELEMENTS_ARRAY_BUFFER_ARB 0x8893 -#define GL_EDGE_FLAG_ARRAY_EXT 0x8079 - -#ifdef WNT -typedef void (APIENTRY* PFNGLBINDBUFFERARBPROC) (GLenum target, GLuint buffer); -typedef void (APIENTRY* PFNGLDELETEBUFFERSARBPROC) (GLsizei n, const GLuint *buffers); -typedef void (APIENTRY* PFNGLGENBUFFERSARBPROC) (GLsizei n, GLuint *buffers); -typedef void (APIENTRY* PFNGLBUFFERDATAARBPROC) (GLenum target, int size, const GLvoid *data, GLenum usage); -#else//WNT -typedef void (*PFNGLBINDBUFFERARBPROC) (GLenum target, GLuint buffer); -typedef void (*PFNGLDELETEBUFFERSARBPROC) (GLsizei n, const GLuint *buffers); -typedef void (*PFNGLGENBUFFERSARBPROC) (GLsizei n, GLuint *buffers); -#if defined ( __sgi ) -typedef void (*PFNGLBUFFERDATAARBPROC) (GLenum target, int size, const GLvoid *data, GLenum usage); -#else -typedef void (*PFNGLBUFFERDATAARBPROC) (GLenum target, GLsizeiptrARB size, const GLvoid *data, GLenum usage); -#endif - -#endif//WNT - -PFNGLGENBUFFERSARBPROC glVBOGenBuffersARB = NULL; // VBO Name Generation Procedure -PFNGLBINDBUFFERARBPROC glVBOBindBufferARB = NULL; // VBO Bind Procedure -PFNGLBUFFERDATAARBPROC glVBOBufferDataARB = NULL; // VBO Data Loading Procedure -PFNGLDELETEBUFFERSARBPROC glVBODeleteBuffersARB = NULL; // VBO Data Deleting Procedure - -int VBOExtension = 0; -int VBOenabled = 1; - -#define VBO_NOT_INITIALIZED -1 -#define VBO_ERROR 0 -#define VBO_OK 1 - -#ifndef WNT -#define glGetProcAddress( x ) glXGetProcAddress( (const GLubyte*) x ) -#else -#define glGetProcAddress( x ) wglGetProcAddress( x ) -#endif - -void clearRAMMemory( CALL_DEF_PARRAY* p ) + +enum { - if( p->bufferVBO[VBOEdges] ){ - Standard::Free((Standard_Address&)p->edges); - p->edges = NULL; - } - if( p->bufferVBO[VBOVertices] ){ - Standard::Free((Standard_Address&)p->vertices); - p->vertices = NULL; - } - if( p->bufferVBO[VBOVcolours] ){ - Standard::Free((Standard_Address&)p->vcolours); - p->vcolours = NULL; - } - if( p->bufferVBO[VBOVnormals] ){ - Standard::Free((Standard_Address&)p->vnormals); - p->vnormals = NULL; - } - if( p->bufferVBO[VBOVtexels] ){ - Standard::Free((Standard_Address&)p->vtexels); - p->vtexels = NULL; - } - if( p->edge_vis ){ - Standard::Free((Standard_Address&)p->edge_vis); - p->edge_vis = NULL; - } -} + VBO_NOT_INITIALIZED = -1, + VBO_ERROR = 0, + VBO_OK = 1 +}; + +namespace +{ + static unsigned long vRand = 1L; + #define OGL_Rand() (vRand = vRand * 214013L + 2531011L) +}; -void clearGraphicRAMMemory( CALL_DEF_PARRAY* p ) +// ======================================================================= +// function : clearMemoryOwn +// purpose : +// ======================================================================= +void OpenGl_PrimitiveArray::clearMemoryOwn() const { - if( p->bufferVBO[VBOEdges] ){ - glVBODeleteBuffersARB( 1 , &p->bufferVBO[VBOEdges]); + if (myPArray->bufferVBO[VBOEdges] != 0) + { + Standard::Free ((Standard_Address& )myPArray->edges); + myPArray->edges = NULL; } - if( p->bufferVBO[VBOVertices] ){ - glVBODeleteBuffersARB( 1 , &p->bufferVBO[VBOVertices]); + if (myPArray->bufferVBO[VBOVertices] != 0) + { + Standard::Free ((Standard_Address& )myPArray->vertices); + myPArray->vertices = NULL; } - if( p->bufferVBO[VBOVcolours] ){ - glVBODeleteBuffersARB( 1 , &p->bufferVBO[VBOVcolours]); + if (myPArray->bufferVBO[VBOVcolours] != 0) + { + Standard::Free ((Standard_Address& )myPArray->vcolours); + myPArray->vcolours = NULL; } - if( p->bufferVBO[VBOVnormals] ){ - glVBODeleteBuffersARB( 1 , &p->bufferVBO[VBOVnormals]); - } - if( p->bufferVBO[VBOVtexels] ){ - glVBODeleteBuffersARB( 1 , &p->bufferVBO[VBOVtexels]); + if (myPArray->bufferVBO[VBOVnormals] != 0) + { + Standard::Free ((Standard_Address& )myPArray->vnormals); + myPArray->vnormals = NULL; + } + if (myPArray->bufferVBO[VBOVtexels] != 0) + { + Standard::Free ((Standard_Address& )myPArray->vtexels); + myPArray->vtexels = NULL; + } + if (myPArray->edge_vis != NULL) /// ???? + { + Standard::Free ((Standard_Address& )myPArray->edge_vis); + myPArray->edge_vis = NULL; } - glVBOBindBufferARB(GL_ARRAY_BUFFER_ARB, 0); - glVBOBindBufferARB(GL_ELEMENTS_ARRAY_BUFFER_ARB, 0); } -int checkSizeForGraphicMemory( CALL_DEF_PARRAY* p ) +// ======================================================================= +// function : clearMemoryGL +// purpose : +// ======================================================================= +void OpenGl_PrimitiveArray::clearMemoryGL (const Handle(OpenGl_Context)& theGlContext) const { - if( GL_OUT_OF_MEMORY == glGetError() ){ - p->flagBufferVBO = VBO_ERROR; - clearGraphicRAMMemory(p); + if (myPArray->bufferVBO[VBOEdges] != 0) + { + theGlContext->arbVBO->glDeleteBuffersARB (1, &myPArray->bufferVBO[VBOEdges]); + } + if (myPArray->bufferVBO[VBOVertices] != 0) + { + theGlContext->arbVBO->glDeleteBuffersARB (1, &myPArray->bufferVBO[VBOVertices]); + } + if (myPArray->bufferVBO[VBOVcolours] != 0) + { + theGlContext->arbVBO->glDeleteBuffersARB (1, &myPArray->bufferVBO[VBOVcolours]); } - else - p->flagBufferVBO = VBO_OK; - return p->flagBufferVBO ; + if (myPArray->bufferVBO[VBOVnormals] != 0) + { + theGlContext->arbVBO->glDeleteBuffersARB (1, &myPArray->bufferVBO[VBOVnormals]); + } + if (myPArray->bufferVBO[VBOVtexels] != 0) + { + theGlContext->arbVBO->glDeleteBuffersARB (1, &myPArray->bufferVBO[VBOVtexels]); + } + theGlContext->arbVBO->glBindBufferARB (GL_ARRAY_BUFFER_ARB, 0); + theGlContext->arbVBO->glBindBufferARB (GL_ELEMENTS_ARRAY_BUFFER_ARB, 0); } -int initVBO() +// ======================================================================= +// function : checkSizeForGraphicMemory +// purpose : +// ======================================================================= +Standard_Boolean OpenGl_PrimitiveArray::checkSizeForGraphicMemory (const Handle(OpenGl_Context)& theGlContext) const { - if(CheckExtension((char *)"GL_ARB_vertex_buffer_object",(const char *)glGetString( GL_EXTENSIONS ))){ - glVBOGenBuffersARB = (PFNGLGENBUFFERSARBPROC) glGetProcAddress("glGenBuffersARB"); - glVBOBindBufferARB = (PFNGLBINDBUFFERARBPROC) glGetProcAddress("glBindBufferARB"); - glVBOBufferDataARB = (PFNGLBUFFERDATAARBPROC) glGetProcAddress("glBufferDataARB"); - glVBODeleteBuffersARB = (PFNGLDELETEBUFFERSARBPROC) glGetProcAddress("glDeleteBuffersARB"); - VBOExtension = 1; - return 1; - } - return 0; + if (glGetError() == GL_OUT_OF_MEMORY) + { + myPArray->flagBufferVBO = VBO_ERROR; + clearMemoryGL (theGlContext); + } + else + { + myPArray->flagBufferVBO = VBO_OK; + } + return myPArray->flagBufferVBO == VBO_OK; } -static void BuildVBO( CALL_DEF_PARRAY* p ) +// ======================================================================= +// function : BuildVBO +// purpose : +// ======================================================================= +Standard_Boolean OpenGl_PrimitiveArray::BuildVBO (const Handle(OpenGl_Workspace)& theWorkspace) const { int size_reqd = 0; - if( p->edges ){ - size_reqd = ( p->num_edges * sizeof( Tint ) ); - glVBOGenBuffersARB( 1, &p->bufferVBO[VBOEdges] ); - glVBOBindBufferARB( GL_ELEMENTS_ARRAY_BUFFER_ARB, p->bufferVBO[VBOEdges] ); - glVBOBufferDataARB( GL_ELEMENTS_ARRAY_BUFFER_ARB, size_reqd , p->edges, GL_STATIC_DRAW_ARB ); - if( checkSizeForGraphicMemory( p ) == VBO_ERROR ) - return; + const Handle(OpenGl_Context)& aGlContext = theWorkspace->GetGlContext(); + if (myPArray->edges != NULL) + { + size_reqd = myPArray->num_edges * sizeof(Tint); + aGlContext->arbVBO->glGenBuffersARB (1, &myPArray->bufferVBO[VBOEdges]); + aGlContext->arbVBO->glBindBufferARB (GL_ELEMENTS_ARRAY_BUFFER_ARB, myPArray->bufferVBO[VBOEdges]); + aGlContext->arbVBO->glBufferDataARB (GL_ELEMENTS_ARRAY_BUFFER_ARB, size_reqd, myPArray->edges, GL_STATIC_DRAW_ARB); + if (!checkSizeForGraphicMemory (aGlContext)) + return Standard_False; } - if( p->vertices ){ - size_reqd = ( p->num_vertexs * sizeof( TEL_POINT ) ); - glVBOGenBuffersARB( 1, &p->bufferVBO[VBOVertices]); - glVBOBindBufferARB( GL_ARRAY_BUFFER_ARB, p->bufferVBO[VBOVertices] ); - glVBOBufferDataARB( GL_ARRAY_BUFFER_ARB, size_reqd , p->vertices, GL_STATIC_DRAW_ARB ); - if( checkSizeForGraphicMemory( p ) == VBO_ERROR ) - return; + if (myPArray->vertices != NULL) + { + size_reqd = myPArray->num_vertexs * sizeof(TEL_POINT); + aGlContext->arbVBO->glGenBuffersARB (1, &myPArray->bufferVBO[VBOVertices]); + aGlContext->arbVBO->glBindBufferARB (GL_ARRAY_BUFFER_ARB, myPArray->bufferVBO[VBOVertices]); + aGlContext->arbVBO->glBufferDataARB (GL_ARRAY_BUFFER_ARB, size_reqd, myPArray->vertices, GL_STATIC_DRAW_ARB); + if (!checkSizeForGraphicMemory (aGlContext)) + return Standard_False; } - if( p->vcolours ){ - size_reqd = ( p->num_vertexs * sizeof( Tint ) ); - glVBOGenBuffersARB( 1, &p->bufferVBO[VBOVcolours] ); - glVBOBindBufferARB( GL_ARRAY_BUFFER_ARB, p->bufferVBO[VBOVcolours]); - glVBOBufferDataARB( GL_ARRAY_BUFFER_ARB, size_reqd , p->vcolours, GL_STATIC_DRAW_ARB ); - if( checkSizeForGraphicMemory( p ) == VBO_ERROR ) - return; + if (myPArray->vcolours != NULL) + { + size_reqd = myPArray->num_vertexs * sizeof(Tint); + aGlContext->arbVBO->glGenBuffersARB (1, &myPArray->bufferVBO[VBOVcolours]); + aGlContext->arbVBO->glBindBufferARB (GL_ARRAY_BUFFER_ARB, myPArray->bufferVBO[VBOVcolours]); + aGlContext->arbVBO->glBufferDataARB (GL_ARRAY_BUFFER_ARB, size_reqd, myPArray->vcolours, GL_STATIC_DRAW_ARB); + if (!checkSizeForGraphicMemory (aGlContext)) + return Standard_False; } - if( p->vnormals ){ - size_reqd = ( p->num_vertexs * sizeof( TEL_POINT ) ); - glVBOGenBuffersARB( 1, &p->bufferVBO[VBOVnormals] ); - glVBOBindBufferARB( GL_ARRAY_BUFFER_ARB, p->bufferVBO[VBOVnormals] ); - glVBOBufferDataARB( GL_ARRAY_BUFFER_ARB, size_reqd , p->vnormals, GL_STATIC_DRAW_ARB ); - if( checkSizeForGraphicMemory( p ) == VBO_ERROR) - return; + if (myPArray->vnormals != NULL) + { + size_reqd = myPArray->num_vertexs * sizeof(TEL_POINT); + aGlContext->arbVBO->glGenBuffersARB (1, &myPArray->bufferVBO[VBOVnormals]); + aGlContext->arbVBO->glBindBufferARB (GL_ARRAY_BUFFER_ARB, myPArray->bufferVBO[VBOVnormals]); + aGlContext->arbVBO->glBufferDataARB (GL_ARRAY_BUFFER_ARB, size_reqd, myPArray->vnormals, GL_STATIC_DRAW_ARB); + if (!checkSizeForGraphicMemory (aGlContext)) + return Standard_False; } - if( p->vtexels ){ - size_reqd = ( p->num_vertexs * sizeof( TEL_TEXTURE_COORD ) ); - glVBOGenBuffersARB( 1, &p->bufferVBO[VBOVtexels] ); - glVBOBindBufferARB( GL_ARRAY_BUFFER_ARB, p->bufferVBO[VBOVtexels] ); - glVBOBufferDataARB( GL_ARRAY_BUFFER_ARB, size_reqd , p->vtexels , GL_STATIC_DRAW_ARB ); - if( checkSizeForGraphicMemory( p ) == VBO_ERROR ) - return; - } - - if( p->flagBufferVBO == VBO_OK ) - clearRAMMemory(p); - - //specify context for VBO resource - p->contextId = (Standard_Address)GET_GL_CONTEXT(); - -} - -/*----------------------------------------------------------------------*/ -/* -* Constantes -*/ - -/*----------------------------------------------------------------------*/ -/* -* Prototypes -*/ - -static TStatus ParrayDisplay( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus ParrayAdd( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus ParrayDelete( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus ParrayPrint( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus ParrayInquire( TSM_ELEM_DATA, Tint, cmn_key* ); - -/*static GLboolean lighting_mode;*/ - -static void draw_array( - call_def_parray, - Tint, /* highlight_flag */ - Tint, /* front_lighting_model, */ - Tint, /* interior_style, */ - Tint, /* edge_flag, */ - tel_colour, /* interior_colour, */ - tel_colour, /* line_colour, */ - tel_colour /* edge_colour, */ -#ifdef OCC7833 - ,tel_surf_prop -#endif - ); - -static void draw_edges ( call_def_parray, tel_colour ); -static void draw_degenerates_as_points ( call_def_parray, tel_colour ); -static void draw_degenerates_as_lines ( call_def_parray, tel_colour ); -static void draw_degenerates_as_bboxs ( call_def_parray, tel_colour ); - -static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) = -{ - NULL, /* PickTraverse */ - ParrayDisplay, - ParrayAdd, - ParrayDelete, - 0, - 0 -}; -static GLenum draw_mode; - -/*----------------------------------------------------------------------*/ -/* -* Variables externes -*/ - -extern Tint ForbidSetTextureMapping; /* currently defined in tsm/tsm.c */ - -extern int g_nDegenerateModel; -extern float g_fSkipRatio; + if (myPArray->vtexels) + { + size_reqd = myPArray->num_vertexs * sizeof(TEL_TEXTURE_COORD); + aGlContext->arbVBO->glGenBuffersARB (1, &myPArray->bufferVBO[VBOVtexels]); + aGlContext->arbVBO->glBindBufferARB (GL_ARRAY_BUFFER_ARB, myPArray->bufferVBO[VBOVtexels]); + aGlContext->arbVBO->glBufferDataARB (GL_ARRAY_BUFFER_ARB, size_reqd, myPArray->vtexels, GL_STATIC_DRAW_ARB); + if (!checkSizeForGraphicMemory (aGlContext)) + return Standard_False; + } -/*----------------------------------------------------------------------*/ + if (myPArray->flagBufferVBO == VBO_OK) + clearMemoryOwn(); -MtblPtr -TelParrayInitClass( TelType* el ) -{ - *el = TelParray; - return MtdTbl; + // specify context for VBO resource + myPArray->contextId = (Standard_Address )theWorkspace->GetGContext(); + return Standard_True; } -/*----------------------------------------------------------------------*/ - -static TStatus -ParrayAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k ) +// ======================================================================= +// function : DrawArrays +// purpose : Auxiliary method to split Feedback/Normal rendering modes +// ======================================================================= +inline void DrawArrays (const Handle(OpenGl_Workspace)& theWorkspace, + const CALL_DEF_PARRAY* thePArray, + const Standard_Boolean theIsFeedback, + GLenum theMode, + GLint theFirst, + GLsizei theCount) { + if (!theIsFeedback) + { + glDrawArrays (theMode, theFirst, theCount); + return; + } - if( k[0]->id != PARRAY_ID ) return TFailure; - - ((tsm_elem_data)(d.pdata))->pdata = k[0]->data.pdata; - - return TSuccess; + glBegin (theMode); + for (int anIter = theFirst; anIter < (theFirst + theCount); ++anIter) + { + if (thePArray->vnormals != NULL) + glNormal3fv (thePArray->vnormals[anIter].xyz); + if (thePArray->vtexels != NULL && (theWorkspace->NamedStatus & OPENGL_NS_FORBIDSETTEX) == 0) + glTexCoord3fv (thePArray->vtexels[anIter].xy); + if (thePArray->vertices != NULL) + glVertex3fv (thePArray->vertices[anIter].xyz); + if (thePArray->vcolours != NULL) + glColor4ubv((GLubyte* )thePArray->vcolours[anIter]); + } + glEnd(); } -/*----------------------------------------------------------------------*/ - -static TStatus -ParrayDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k ) +// ======================================================================= +// function : DrawElements +// purpose : Auxiliary method to split Feedback/Normal rendering modes +// ======================================================================= +inline void DrawElements (const Handle(OpenGl_Workspace)& theWorkspace, + const CALL_DEF_PARRAY* thePArray, + const Standard_Boolean theIsFeedback, + GLenum theMode, + GLsizei theCount, + GLenum* theIndices) { - CMN_KEY k11, k12, k17, k18, k111, k114, k115; - - Tint front_lighting_model; - Tint interior_style; - TEL_COLOUR interior_colour; - TEL_COLOUR edge_colour; - TEL_COLOUR line_colour; - Tint edge_flag; - -#ifdef OCC7833 - CMN_KEY k117; - TEL_SURF_PROP prop; -#endif - - call_def_parray d = (call_def_parray)data.pdata; - - k12.id = TelInteriorReflectanceEquation; - k17.id = TelInteriorStyle; - k18.id = TelEdgeFlag; - k111.id = TelInteriorColour; - k111.data.pdata = &interior_colour; - k114.id = TelEdgeColour; - k114.data.pdata = &edge_colour; - k115.id = TelPolylineColour; - k115.data.pdata = &line_colour; - -#ifdef OCC7833 - k117.id = TelSurfaceAreaProperties; - k117.data.pdata = ∝ -#endif - -#ifdef OCC7833 - TsmGetAttri( 7, &k12, &k17, &k18, &k111, &k114, &k115, &k117 ); -#else - TsmGetAttri( 6, &k12, &k17, &k18, &k111, &k114, &k115 ); -#endif - - front_lighting_model = k12.data.ldata; - interior_style = k17.data.ldata; - edge_flag = k18.data.ldata; - -#ifdef PRINT - printf("ParrayDisplay type %d\n",d->type); -#endif - - /* - * Use highlight colours - */ - - if( k[0]->id == TOn ) { - TEL_HIGHLIGHT hrep; - - k11.id = TelHighlightIndex; - TsmGetAttri( 1, &k11 ); - if( TelGetHighlightRep( TglActiveWs, k11.data.ldata, &hrep ) == TSuccess ) { - if( hrep.type == TelHLForcedColour ) { - edge_colour = interior_colour = line_colour = hrep.col; - front_lighting_model = CALL_PHIGS_REFL_NONE; - } else if( hrep.type == TelHLColour ) { - edge_colour = hrep.col; - k[0]->id = TOff; - } - } else { - TelGetHighlightRep( TglActiveWs, 0, &hrep ); - if( hrep.type == TelHLForcedColour ) { - edge_colour = interior_colour = line_colour = hrep.col; - front_lighting_model = CALL_PHIGS_REFL_NONE; - } else if( hrep.type == TelHLColour ) { - edge_colour = hrep.col; - k[0]->id = TOff; - } - } + if (!theIsFeedback) + { + glDrawElements (theMode, theCount, GL_UNSIGNED_INT, theIndices); + return; } - draw_array( d, k[0]->id, - front_lighting_model, - interior_style, - edge_flag, - &interior_colour, - &line_colour, - &edge_colour -#ifdef OCC7833 - ,&prop -#endif - ); - - return TSuccess; - -} - -/*----------------------------------------------------------------------*/ - -static void -draw_primitive_array( call_def_parray p, GLenum mode, GLint first, GLsizei count ) -{ - int i; - glBegin( mode ); - for( i=first; i<(first + count); i++ ){ - if( p->vnormals ) - glNormal3fv( p->vnormals[i].xyz ); - if( p->vtexels && !ForbidSetTextureMapping ) - glTexCoord3fv( p->vtexels[i].xy ); - if( p->vertices ) - glVertex3fv( p->vertices[i].xyz ); - if ( p->vcolours ) - glColor4ubv( (GLubyte*) p->vcolours[i] ); + GLenum anIndex; + glBegin (theMode); + for (GLsizei anIter = 0; anIter < theCount; ++anIter) + { + anIndex = theIndices[anIter]; + if (thePArray->vnormals != NULL) + glNormal3fv (thePArray->vnormals[anIndex].xyz); + if (thePArray->vtexels != NULL && (theWorkspace->NamedStatus & OPENGL_NS_FORBIDSETTEX) == 0) + glTexCoord3fv (thePArray->vtexels[anIndex].xy); + if (thePArray->vertices != NULL) + glVertex3fv (thePArray->vertices[anIndex].xyz); + if (thePArray->vcolours != NULL) + glColor4ubv ((GLubyte* )thePArray->vcolours[anIndex]); } glEnd(); } -/*----------------------------------------------------------------------*/ -static void -draw_primitive_elements( call_def_parray p, GLenum mode, GLsizei count, GLenum type, GLenum *indices ) +// ======================================================================= +// function : DrawArray +// purpose : +// ======================================================================= +void OpenGl_PrimitiveArray::DrawArray (Tint theLightingModel, + const Aspect_InteriorStyle theInteriorStyle, + Tint theEdgeFlag, + const TEL_COLOUR* theInteriorColour, + const TEL_COLOUR* theLineColour, + const TEL_COLOUR* theEdgeColour, + const OPENGL_SURF_PROP* theFaceProp, + const Handle(OpenGl_Workspace)& theWorkspace) const { - int i; - GLenum index; - glBegin( mode ); - for( i=0; ivnormals ) - glNormal3fv( p->vnormals[index].xyz ); - if( p->vtexels && !ForbidSetTextureMapping ) - glTexCoord3fv( p->vtexels[index].xy ); - if( p->vertices ) - glVertex3fv( p->vertices[index].xyz ); - if ( p->vcolours ) - glColor4ubv( (GLubyte*) p->vcolours[index] ); - } - glEnd(); -} -/*----------------------------------------------------------------------*/ -static void -draw_array( call_def_parray p, Tint hflag, - Tint lighting_model, - Tint interior_style, - Tint edge_flag, - tel_colour interior_colour, - tel_colour line_colour, - tel_colour edge_colour -#ifdef OCC7833 - ,tel_surf_prop prop -#endif - ){ + const Handle(OpenGl_Context)& aGlContext = theWorkspace->GetGlContext(); + Tint i,n; Tint transp = 0; GLint renderMode; - /* Following pointers have been provided for performance improvement */ - tel_colour pfc; - Tint * pvc; - - pvc = p->vcolours; - pfc = p->fcolours; - -#ifdef OCC7833 - if( pvc ){ - for( i=0; inum_vertexs; i++ ){ - transp = (int)(prop->trans * 255.); -#if defined (sparc) || defined (__sparc__) || defined (__sparc) - pvc[i] = ( pvc[i] & 0xffffff00 ); - pvc[i] += transp ; - -#else - pvc[i] = ( pvc[i] & 0x00ffffff ); + // Following pointers have been provided for performance improvement + tel_colour pfc = myPArray->fcolours; + Tint* pvc = myPArray->vcolours; + if (pvc != NULL) + { + for (i = 0; i < myPArray->num_vertexs; ++i) + { + transp = int(theFaceProp->trans * 255.0f); + #if defined (sparc) || defined (__sparc__) || defined (__sparc) + pvc[i] = (pvc[i] & 0xffffff00); + pvc[i] += transp; + #else + pvc[i] = (pvc[i] & 0x00ffffff); pvc[i] += transp << 24; -#endif + #endif } } -#endif - switch( p->type ) { + switch (myPArray->type) + { case TelPointsArrayType: - draw_mode = GL_POINTS; - glColor3fv( line_colour->rgb ); - break; case TelPolylinesArrayType: - draw_mode = GL_LINE_STRIP; - glColor3fv( line_colour->rgb ); - break; case TelSegmentsArrayType: - draw_mode = GL_LINES; - glColor3fv( line_colour->rgb ); + glColor3fv (theLineColour->rgb); break; case TelPolygonsArrayType: - draw_mode = GL_POLYGON; - glColor3fv( interior_colour->rgb ); - break; case TelTrianglesArrayType: - draw_mode = GL_TRIANGLES; - glColor3fv( interior_colour->rgb ); - break; case TelQuadranglesArrayType: - draw_mode = GL_QUADS; - glColor3fv( interior_colour->rgb ); - break; case TelTriangleStripsArrayType: - draw_mode = GL_TRIANGLE_STRIP; - glColor3fv( interior_colour->rgb ); - break; case TelQuadrangleStripsArrayType: - draw_mode = GL_QUAD_STRIP; - glColor3fv( interior_colour->rgb ); - break; case TelTriangleFansArrayType: - draw_mode = GL_TRIANGLE_FAN; - glColor3fv( interior_colour->rgb ); + glColor3fv (theInteriorColour->rgb); break; - default: - return; } - /* OCC11904 -- Temporarily disable environment mapping */ - if( draw_mode <= GL_LINE_STRIP ){ - glPushAttrib(GL_ENABLE_BIT); - glDisable(GL_TEXTURE_1D); - glDisable(GL_TEXTURE_2D); + // Temporarily disable environment mapping + if (myDrawMode <= GL_LINE_STRIP) + { + glPushAttrib (GL_ENABLE_BIT); + glDisable (GL_TEXTURE_1D); + glDisable (GL_TEXTURE_2D); } - if( p->VBOEnabled == -1 ){ - p->VBOEnabled = VBOenabled; - if( VBOExtension == 0) - initVBO(); - if( (VBOExtension == 1) && (p->VBOEnabled != 0)) - BuildVBO( p ); - } - - - #ifdef PRINT - printf(" $$$ g_nDegenerateModel %d\n",g_nDegenerateModel); - #endif - if ( g_nDegenerateModel < 2 && - ( (draw_mode > GL_LINE_STRIP && interior_style != TSM_EMPTY) || - (draw_mode <= GL_LINE_STRIP /*&& !hflag*/)) ) { - - if( hflag == TOn ) { + if (theWorkspace->DegenerateModel < 2 && + ((myDrawMode > GL_LINE_STRIP && theInteriorStyle != Aspect_IS_EMPTY) || + (myDrawMode <= GL_LINE_STRIP))) + { + if (theWorkspace->NamedStatus & OPENGL_NS_HIGHLIGHT) + { pfc = NULL; pvc = NULL; } - if ( interior_style == TSM_HIDDENLINE) { - edge_flag = 1; + if (theInteriorStyle == Aspect_IS_HIDDENLINE) + { + theEdgeFlag = 1; pfc = NULL; pvc = NULL; } - /*OCC12297 - Sometimes the GL_LIGHTING mode is activated here - without LightOn() call for an unknown reason, so it is necessary - to call LightOn() to synchronize LightOn/Off mechanism*/ - LightOn(); - - if( lighting_model == CALL_PHIGS_REFL_NONE || draw_mode <= GL_LINE_STRIP ) - LightOff(); - - glGetIntegerv( GL_RENDER_MODE, &renderMode ); - - if ( p->num_vertexs > 0 && p->flagBufferVBO != VBO_OK) { - if( renderMode != GL_FEEDBACK ){ - if( p->vertices ) { - glVertexPointer(3, GL_FLOAT, 0, p->vertices);/* array of vertices */ - glEnableClientState(GL_VERTEX_ARRAY); - } - - if( p->vnormals ) { - glNormalPointer(GL_FLOAT, 0, p->vnormals);/* array of normals */ - glEnableClientState(GL_NORMAL_ARRAY); - } - - if ( p->vtexels) { - glTexCoordPointer(2, GL_FLOAT, 0, p->vtexels);/* array of texture coordinates */ - glEnableClientState(GL_TEXTURE_COORD_ARRAY); - } + // Sometimes the GL_LIGHTING mode is activated here + // without glEnable(GL_LIGHTING) call for an unknown reason, so it is necessary + // to call glEnable(GL_LIGHTING) to synchronize Light On/Off mechanism* + if (theLightingModel == 0 || myDrawMode <= GL_LINE_STRIP) + glDisable (GL_LIGHTING); + else + glEnable (GL_LIGHTING); + + glGetIntegerv (GL_RENDER_MODE, &renderMode); + + if (myPArray->num_vertexs > 0 + && myPArray->flagBufferVBO != VBO_OK + && renderMode != GL_FEEDBACK) + { + if (myPArray->vertices != NULL) + { + glVertexPointer (3, GL_FLOAT, 0, myPArray->vertices); // array of vertices + glEnableClientState (GL_VERTEX_ARRAY); + } + if (myPArray->vnormals != NULL) + { + glNormalPointer (GL_FLOAT, 0, myPArray->vnormals); // array of normals + glEnableClientState (GL_NORMAL_ARRAY); + } + if (myPArray->vtexels != NULL) + { + glTexCoordPointer (2, GL_FLOAT, 0, myPArray->vtexels); // array of texture coordinates + glEnableClientState (GL_TEXTURE_COORD_ARRAY); + } - if ( pvc ) { -#ifdef OCC7833 - glColorPointer(4, GL_UNSIGNED_BYTE, 0, pvc); /* array of colors */ -#else - glColorPointer(3, GL_UNSIGNED_BYTE, 0, pvc); /* array of colors */ -#endif - glEnableClientState(GL_COLOR_ARRAY); - glColorMaterial(GL_FRONT_AND_BACK,GL_AMBIENT_AND_DIFFUSE); - glEnable(GL_COLOR_MATERIAL); - } + if (pvc != NULL) + { + glColorPointer (4, GL_UNSIGNED_BYTE, 0, pvc); // array of colors + glEnableClientState (GL_COLOR_ARRAY); + glColorMaterial (GL_FRONT_AND_BACK,GL_AMBIENT_AND_DIFFUSE); + glEnable (GL_COLOR_MATERIAL); } } - - //Bindings concrete pointer in accordance with VBO buffer - //Using VBO - if ( p->num_vertexs > 0 && p->flagBufferVBO == VBO_OK ) { - if( p->bufferVBO[VBOVertices] ){ - glVBOBindBufferARB( GL_ARRAY_BUFFER_ARB, p->bufferVBO[VBOVertices]); - glVertexPointer(3, GL_FLOAT, 0, (char *) NULL);// array of vertices - glEnableClientState(GL_VERTEX_ARRAY); + else if (myPArray->num_vertexs > 0 + && myPArray->flagBufferVBO == VBO_OK) + { + // Bindings concrete pointer in accordance with VBO buffer + if (myPArray->bufferVBO[VBOVertices] != 0) + { + aGlContext->arbVBO->glBindBufferARB (GL_ARRAY_BUFFER_ARB, myPArray->bufferVBO[VBOVertices]); + glVertexPointer (3, GL_FLOAT, 0, NULL); // array of vertices + glEnableClientState (GL_VERTEX_ARRAY); } - - if( p->bufferVBO[VBOVnormals] ){ - glVBOBindBufferARB( GL_ARRAY_BUFFER_ARB, p->bufferVBO[VBOVnormals]); - glNormalPointer(GL_FLOAT, 0, (char *) NULL);// array of normals - glEnableClientState(GL_NORMAL_ARRAY); + if (myPArray->bufferVBO[VBOVnormals] != 0) + { + aGlContext->arbVBO->glBindBufferARB (GL_ARRAY_BUFFER_ARB, myPArray->bufferVBO[VBOVnormals]); + glNormalPointer (GL_FLOAT, 0, NULL); // array of normals + glEnableClientState (GL_NORMAL_ARRAY); } - - if ( p->bufferVBO[VBOVtexels] && !ForbidSetTextureMapping ) { - glVBOBindBufferARB( GL_ARRAY_BUFFER_ARB, p->bufferVBO[VBOVtexels]); - glTexCoordPointer(2, GL_FLOAT, 0, (char *) NULL);/* array of texture coordinates */ - glEnableClientState(GL_TEXTURE_COORD_ARRAY); + if (myPArray->bufferVBO[VBOVtexels] != 0 && (theWorkspace->NamedStatus & OPENGL_NS_FORBIDSETTEX) == 0) + { + aGlContext->arbVBO->glBindBufferARB (GL_ARRAY_BUFFER_ARB, myPArray->bufferVBO[VBOVtexels]); + glTexCoordPointer (2, GL_FLOAT, 0, NULL); // array of texture coordinates + glEnableClientState (GL_TEXTURE_COORD_ARRAY); } - - if ( p->bufferVBO[VBOVcolours] ) { - glVBOBindBufferARB( GL_ARRAY_BUFFER_ARB, p->bufferVBO[VBOVcolours]); - glColorPointer( 4, GL_UNSIGNED_BYTE, 0, (char *) NULL);// array of colors - glEnableClientState(GL_COLOR_ARRAY); - glColorMaterial(GL_FRONT_AND_BACK,GL_AMBIENT_AND_DIFFUSE); - glEnable(GL_COLOR_MATERIAL); + if (myPArray->bufferVBO[VBOVcolours] != 0) + { + aGlContext->arbVBO->glBindBufferARB (GL_ARRAY_BUFFER_ARB, myPArray->bufferVBO[VBOVcolours]); + glColorPointer (4, GL_UNSIGNED_BYTE, 0, NULL); // array of colors + glEnableClientState (GL_COLOR_ARRAY); + glColorMaterial (GL_FRONT_AND_BACK,GL_AMBIENT_AND_DIFFUSE); + glEnable (GL_COLOR_MATERIAL); } } + // OCC22236 NOTE: draw for all situations: - // 1) draw elements from p->bufferVBO[VBOEdges] indicies array + // 1) draw elements from myPArray->bufferVBO[VBOEdges] indicies array // 2) draw elements from vertice array, when bounds defines count of primitive's verts. // 3) draw primitive by vertexes if no edges and bounds array is specified - if( p->flagBufferVBO == VBO_OK ){ - if ( p->num_edges > 0 && p->bufferVBO[VBOEdges] ) { - glVBOBindBufferARB(GL_ELEMENTS_ARRAY_BUFFER_ARB, p->bufferVBO[VBOEdges]); // for edge indices - - // draw primitives by vertex count with the indicies - if( p->num_bounds > 0 ) { - Tint* offset = 0; - for( i = 0, offset = 0 ; i < p->num_bounds ; i++ ) { - glDrawElements(draw_mode, p->bounds[i], GL_UNSIGNED_INT, offset); - offset += p->bounds[i]; + if (myPArray->flagBufferVBO == VBO_OK) + { + if (myPArray->num_edges > 0 && myPArray->bufferVBO[VBOEdges] != 0) + { + aGlContext->arbVBO->glBindBufferARB (GL_ELEMENTS_ARRAY_BUFFER_ARB, myPArray->bufferVBO[VBOEdges]); // for edge indices + if (myPArray->num_bounds > 0) + { + // draw primitives by vertex count with the indicies + Tint* anOffset = NULL; + for (i = 0; i < myPArray->num_bounds; ++i) + { + glDrawElements (myDrawMode, myPArray->bounds[i], GL_UNSIGNED_INT, anOffset); + anOffset += myPArray->bounds[i]; } } - // draw one (or sequential) primitive by the indicies - else { - glDrawElements(draw_mode, p->num_edges , GL_UNSIGNED_INT, 0); + else + { + // draw one (or sequential) primitive by the indicies + glDrawElements (myDrawMode, myPArray->num_edges, GL_UNSIGNED_INT, NULL); } } - else if( p->num_bounds > 0 ) { - for( i = n = 0 ; i < p->num_bounds ; i ++ ){ - glDrawArrays(draw_mode, n, p->bounds[i]); - n += p->bounds[i]; + else if (myPArray->num_bounds > 0) + { + for (i = n = 0; i < myPArray->num_bounds; ++i) + { + glDrawArrays (myDrawMode, n, myPArray->bounds[i]); + n += myPArray->bounds[i]; } } - else { - glDrawArrays(draw_mode, 0, p->num_vertexs); + else + { + glDrawArrays (myDrawMode, 0, myPArray->num_vertexs); } - //bind with 0 - glVBOBindBufferARB(GL_ARRAY_BUFFER_ARB, 0); - glVBOBindBufferARB(GL_ELEMENTS_ARRAY_BUFFER_ARB, 0); + // bind with 0 + aGlContext->arbVBO->glBindBufferARB (GL_ARRAY_BUFFER_ARB, 0); + aGlContext->arbVBO->glBindBufferARB (GL_ELEMENTS_ARRAY_BUFFER_ARB, 0); } - else { - if( p->num_bounds > 0 ) { - if( p->num_edges > 0 ) { - for( i=n=0 ; inum_bounds ; i++ ) { - if( pfc ) glColor3fv ( pfc[i].rgb ); - if( renderMode == GL_FEEDBACK ) - draw_primitive_elements( p, draw_mode, p->bounds[i], - GL_UNSIGNED_INT,(GLenum*) &p->edges[n]); - else - glDrawElements( draw_mode, p->bounds[i], - GL_UNSIGNED_INT, &p->edges[n]); - n += p->bounds[i]; - } - } else { - for( i=n=0 ; inum_bounds ; i++ ) { - if( pfc ) - glColor3fv ( pfc[i].rgb ); - if( renderMode == GL_FEEDBACK ) - draw_primitive_array( p, draw_mode, n, p->bounds[i]); - else - { - glDrawArrays( draw_mode, n, p->bounds[i]); - } - n += p->bounds[i]; - } + else + { + if (myPArray->num_bounds > 0) + { + if (myPArray->num_edges > 0) + { + for (i = n = 0; i < myPArray->num_bounds; ++i) + { + if (pfc != NULL) glColor3fv (pfc[i].rgb); + DrawElements (theWorkspace, myPArray, (renderMode == GL_FEEDBACK), myDrawMode, + myPArray->bounds[i], (GLenum* )&myPArray->edges[n]); + n += myPArray->bounds[i]; + } + } + else + { + for (i = n = 0; i < myPArray->num_bounds; ++i) + { + if (pfc != NULL) + { + glColor3fv (pfc[i].rgb); } - } else if( p->num_edges > 0 ) { - if( renderMode == GL_FEEDBACK ) - draw_primitive_elements( p, draw_mode, p->num_edges, - GL_UNSIGNED_INT,(GLenum*) &p->edges[0]); - else - glDrawElements( draw_mode, p->num_edges, GL_UNSIGNED_INT, p->edges); - } else { - if( renderMode == GL_FEEDBACK ) - draw_primitive_array( p, draw_mode, 0, p->num_vertexs); - else - glDrawArrays( draw_mode, 0, p->num_vertexs); + DrawArrays (theWorkspace, myPArray, (renderMode == GL_FEEDBACK), myDrawMode, + n, myPArray->bounds[i]); + n += myPArray->bounds[i]; + } } + } + else if (myPArray->num_edges > 0) + { + DrawElements (theWorkspace, myPArray, (renderMode == GL_FEEDBACK), myDrawMode, + myPArray->num_edges, (GLenum* )myPArray->edges); + } + else + { + DrawArrays (theWorkspace, myPArray, (renderMode == GL_FEEDBACK), myDrawMode, + 0, myPArray->num_vertexs); + } } -#ifdef TEST - if( p->bufferVBO[VBOVcolours] || pvc ) { - glDisable(GL_COLOR_MATERIAL); - TelResetMaterial(); + if (myPArray->bufferVBO[VBOVcolours] != 0 || pvc != NULL) + { + glDisable (GL_COLOR_MATERIAL); + theWorkspace->NamedStatus |= OPENGL_NS_RESMAT; // Reset material } -#endif - - if( p->bufferVBO[VBOVertices] || p->vertices ) - glDisableClientState(GL_VERTEX_ARRAY); - if( p->bufferVBO[VBOVcolours] || p->vcolours ) - glDisableClientState(GL_COLOR_ARRAY); - if( p->bufferVBO[VBOVnormals] || p->vnormals ) - glDisableClientState(GL_NORMAL_ARRAY); - if ( (p->bufferVBO[VBOVtexels] && !ForbidSetTextureMapping ) || p->vtexels ) - glDisableClientState(GL_TEXTURE_COORD_ARRAY); - - if ( g_nDegenerateModel ){ - if(draw_mode <= GL_LINE_STRIP) + + if (myPArray->bufferVBO[VBOVertices] != 0 || myPArray->vertices != NULL) + glDisableClientState (GL_VERTEX_ARRAY); + if (myPArray->bufferVBO[VBOVcolours] != 0 || myPArray->vcolours != NULL) + glDisableClientState (GL_COLOR_ARRAY); + if (myPArray->bufferVBO[VBOVnormals] != 0 || myPArray->vnormals != NULL) + glDisableClientState (GL_NORMAL_ARRAY); + if ((myPArray->bufferVBO[VBOVtexels] != 0 && (theWorkspace->NamedStatus & OPENGL_NS_FORBIDSETTEX) == 0) || myPArray->vtexels != NULL) + glDisableClientState (GL_TEXTURE_COORD_ARRAY); + + if (theWorkspace->DegenerateModel) + { + if (myDrawMode <= GL_LINE_STRIP) + { glPopAttrib(); + } return; } } - if( edge_flag || g_nDegenerateModel ) - switch ( g_nDegenerateModel ) { - default: /* XXX_TDM_NODE or TINY */ - /* - On some NVIDIA graphic cards, using glEdgeFlagPointer() in - combination with VBO ( edge flag data put into a VBO buffer) - leads to a crash in a driver. Therefore, edge flags are simply - igonored when VBOs are enabled, so all the edges are drawn if - edge visibility is turned on. In order to draw edges selectively, - either disable VBO or turn off edge visibilty in the current - primitive array and create a separate primitive array (segments) - and put edges to be drawn into it. - */ - draw_edges ( p, edge_flag ? edge_colour : interior_colour ); + if (theEdgeFlag || theWorkspace->DegenerateModel) + { + switch (theWorkspace->DegenerateModel) + { + default: // XXX_TDM_NODE or TINY + // On some NVIDIA graphic cards, using glEdgeFlagPointer() in + // combination with VBO ( edge flag data put into a VBO buffer) + // leads to a crash in a driver. Therefore, edge flags are simply + // igonored when VBOs are enabled, so all the edges are drawn if + // edge visibility is turned on. In order to draw edges selectively, + // either disable VBO or turn off edge visibilty in the current + // primitive array and create a separate primitive array (segments) + // and put edges to be drawn into it. + DrawEdges (theEdgeFlag ? theEdgeColour : theInteriorColour, theWorkspace); + break; + // DegenerateModel(as Lines, Points, BBoxs) are used only without VBO + case 2: // XXX_TDM_WIREFRAME + if (myPArray->VBOEnabled == 0) + DrawDegeneratesAsLines ((theEdgeFlag ? theEdgeColour : theInteriorColour), theWorkspace); + break; + case 3: // XXX_TDM_MARKER + if (myPArray->VBOEnabled == 0) + DrawDegeneratesAsPoints ((theEdgeFlag ? theEdgeColour : theInteriorColour), theWorkspace->SkipRatio); break; - // DegenerateModel(as Lines, Points, BBoxs) are used only without VBO - case 2: /* XXX_TDM_WIREFRAME */ - if( p->VBOEnabled == 0 ) - draw_degenerates_as_lines ( p, edge_flag ? edge_colour : interior_colour ); - break; - case 3: /* XXX_TDM_MARKER */ - if( p->VBOEnabled == 0 ) - draw_degenerates_as_points ( p, edge_flag ? edge_colour : interior_colour ); - break; - case 4: /* XXX_TDM_BBOX */ - if( p->VBOEnabled == 0 ) - draw_degenerates_as_bboxs ( p, edge_flag ? edge_colour : interior_colour ); - break; - } - - if(draw_mode <= GL_LINE_STRIP) + case 4: // XXX_TDM_BBOX + if (myPArray->VBOEnabled == 0) + DrawDegeneratesAsBBoxs (theEdgeFlag ? theEdgeColour : theInteriorColour); + break; + } + } + + if (myDrawMode <= GL_LINE_STRIP) glPopAttrib(); } -/*----------------------------------------------------------------------*/ - -static TStatus -ParrayDelete( TSM_ELEM_DATA data, Tint n, cmn_key *k ) +// ======================================================================= +// function : DrawEdges +// purpose : +// ======================================================================= +void OpenGl_PrimitiveArray::DrawEdges (const TEL_COLOUR* theEdgeColour, + const Handle(OpenGl_Workspace)& theWorkspace) const { - call_def_parray p = (call_def_parray)data.pdata; - if( p->VBOEnabled == VBO_OK ) { - OpenGl_ResourceCleaner* resCleaner = OpenGl_ResourceCleaner::GetInstance(); - if( p->bufferVBO[VBOEdges] ) - resCleaner->AddResource( (GLCONTEXT)p->contextId, new OpenGl_ResourceVBO(p->bufferVBO[VBOEdges]) ); - if( p->bufferVBO[VBOVertices] ) - resCleaner->AddResource( (GLCONTEXT)p->contextId, new OpenGl_ResourceVBO(p->bufferVBO[VBOVertices]) ); - if( p->bufferVBO[VBOVcolours] ) - resCleaner->AddResource( (GLCONTEXT)p->contextId, new OpenGl_ResourceVBO(p->bufferVBO[VBOVcolours]) ); - if( p->bufferVBO[VBOVnormals] ) - resCleaner->AddResource( (GLCONTEXT)p->contextId, new OpenGl_ResourceVBO(p->bufferVBO[VBOVnormals]) ); - if( p->bufferVBO[VBOVtexels] ) - resCleaner->AddResource( (GLCONTEXT)p->contextId, new OpenGl_ResourceVBO(p->bufferVBO[VBOVtexels]) ); - } - - return TSuccess; -} + glDisable (GL_LIGHTING); -/*----------------------------------------------------------------------*/ + const Handle(OpenGl_Context)& aGlContext = theWorkspace->GetGlContext(); + const OpenGl_AspectLine* anAspectLineOld = NULL; + if (myDrawMode > GL_LINE_STRIP) + { + anAspectLineOld = theWorkspace->SetAspectLine (theWorkspace->AspectFace (Standard_True)->AspectEdge()); + theWorkspace->AspectLine (Standard_True); -static void -draw_edges ( call_def_parray p, tel_colour edge_colour ) -{ - Tint i, j, n; - Tint edge_type=0, line_type_preserve=0; - Tfloat edge_width=0, line_width_preserve=0; - /* GLboolean texture_on;*/ + glPushAttrib (GL_POLYGON_BIT); + glPolygonMode (GL_FRONT_AND_BACK, GL_LINE); + } + Tint i, j, n; GLint renderMode; - - LightOff(); - - if( draw_mode > GL_LINE_STRIP ) { - CMN_KEY k, k1, k2, k3, k4; - - k1.id = TelPolylineWidth; - k2.id = TelPolylineType; - k3.id = TelEdgeType; - k4.id = TelEdgeWidth; - - TsmGetAttri( 4, &k1, &k2, &k3, &k4 ); - - line_width_preserve = k1.data.fdata; - line_type_preserve = k2.data.ldata; - edge_type = k3.data.ldata; - edge_width = k4.data.fdata; - - if( line_width_preserve != edge_width ) { - k.id = TelPolylineWidth; - k.data.fdata = edge_width; - TsmSetAttri( 1, &k ); - } - if( line_type_preserve != edge_type ) { - k.id = TelPolylineType; - k.data.ldata = edge_type; - TsmSetAttri( 1, &k ); - } - - glPushAttrib( GL_POLYGON_BIT ); - glPolygonMode( GL_FRONT_AND_BACK, GL_LINE ); - } // OCC22236 NOTE: draw edges for all situations: - // 1) draw elements with GL_LINE style as edges from p->bufferVBO[VBOEdges] indicies array + // 1) draw elements with GL_LINE style as edges from myPArray->bufferVBO[VBOEdges] indicies array // 2) draw elements from vertice array, when bounds defines count of primitive's verts. // 3) draw primitive's edges by vertexes if no edges and bounds array is specified - if(p->flagBufferVBO == VBO_OK) + if (myPArray->flagBufferVBO == VBO_OK) { - glVBOBindBufferARB( GL_ARRAY_BUFFER_ARB, p->bufferVBO[VBOVertices] ); - glEnableClientState( GL_VERTEX_ARRAY ); - glColor3fv( edge_colour->rgb ); - if ( p->num_edges > 0 && p->bufferVBO[VBOEdges] ) { - glVBOBindBufferARB(GL_ELEMENTS_ARRAY_BUFFER_ARB, p->bufferVBO[VBOEdges]); - + aGlContext->arbVBO->glBindBufferARB (GL_ARRAY_BUFFER_ARB, myPArray->bufferVBO[VBOVertices]); + glEnableClientState (GL_VERTEX_ARRAY); + glColor3fv (theEdgeColour->rgb); + if (myPArray->num_edges > 0 && myPArray->bufferVBO[VBOEdges]) + { + aGlContext->arbVBO->glBindBufferARB (GL_ELEMENTS_ARRAY_BUFFER_ARB, myPArray->bufferVBO[VBOEdges]); + // draw primitives by vertex count with the indicies - if( p->num_bounds > 0 ) { + if (myPArray->num_bounds > 0) + { Tint* offset = 0; - for( i = 0, offset = 0 ; i < p->num_bounds ; i++ ) { - glDrawElements( draw_mode, p->bounds[i], GL_UNSIGNED_INT, offset); - offset += p->bounds[i]; + for (i = 0, offset = 0; i < myPArray->num_bounds; ++i) + { + glDrawElements (myDrawMode, myPArray->bounds[i], GL_UNSIGNED_INT, offset); + offset += myPArray->bounds[i]; } } // draw one (or sequential) primitive by the indicies - else { - glDrawElements( draw_mode, p->num_edges , GL_UNSIGNED_INT, 0); + else + { + glDrawElements (myDrawMode, myPArray->num_edges, GL_UNSIGNED_INT, NULL); } } - else if( p->num_bounds > 0 ) { - for( i = n = 0 ; i < p->num_bounds ; i ++ ){ - glDrawArrays( draw_mode, n, p->bounds[i]); - n += p->bounds[i]; + else if (myPArray->num_bounds > 0) + { + for (i = n = 0; i < myPArray->num_bounds; ++i) + { + glDrawArrays (myDrawMode, n, myPArray->bounds[i]); + n += myPArray->bounds[i]; } } - else { - glDrawArrays( draw_mode, 0, p->num_vertexs); + else + { + glDrawArrays (myDrawMode, 0, myPArray->num_vertexs); } // unbind buffers - glDisableClientState(GL_VERTEX_ARRAY); - glVBOBindBufferARB(GL_ARRAY_BUFFER_ARB, 0); - glVBOBindBufferARB(GL_ELEMENTS_ARRAY_BUFFER_ARB, 0); - } - else { - - glEnableClientState(GL_VERTEX_ARRAY); - glVertexPointer(3, GL_FLOAT, 0, p->vertices); /* array of vertices */ -#ifdef OGLBUG - if( p->edge_vis ) { - glEnableClientState(GL_EDGE_FLAG_ARRAY); - glEdgeFlagPointer( sizeof(Tchar), p->edge_vis); - } else - glDisableClientState(GL_EDGE_FLAG_ARRAY); -#endif - - glGetIntegerv( GL_RENDER_MODE, &renderMode ); - - glColor3fv( edge_colour->rgb ); - if( p->num_bounds > 0 ) { - if( p->num_edges > 0 ) { - for( i=n=0 ; inum_bounds ; i++ ) { -#ifndef OGLBUG - if( p->edge_vis ) { - glBegin( draw_mode ); - for( j=0 ; jbounds[i] ; j++ ) { - glEdgeFlag( p->edge_vis[n+j] ); - glVertex3fv( &p->vertices[p->edges[n+j]].xyz[0] ); - } - glEnd(); - } else -#endif - if( renderMode == GL_FEEDBACK ) - draw_primitive_elements( p, draw_mode, p->bounds[i], - GL_UNSIGNED_INT, (GLenum*)&p->edges[n]); - else - glDrawElements( draw_mode, p->bounds[i], - GL_UNSIGNED_INT, &p->edges[n]); - n += p->bounds[i]; + glDisableClientState (GL_VERTEX_ARRAY); + aGlContext->arbVBO->glBindBufferARB (GL_ARRAY_BUFFER_ARB, 0); + aGlContext->arbVBO->glBindBufferARB (GL_ELEMENTS_ARRAY_BUFFER_ARB, 0); + } + else + { + glEnableClientState (GL_VERTEX_ARRAY); + glVertexPointer (3, GL_FLOAT, 0, myPArray->vertices); // array of vertices + glGetIntegerv (GL_RENDER_MODE, &renderMode); + + glColor3fv (theEdgeColour->rgb); + if (myPArray->num_bounds > 0) + { + if (myPArray->num_edges > 0) + { + for (i = n = 0; i < myPArray->num_bounds; ++i) + { + if (myPArray->edge_vis) + { + glBegin (myDrawMode); + for (j = 0; j < myPArray->bounds[i]; ++j) + { + glEdgeFlag (myPArray->edge_vis[n+j]); + glVertex3fv (&myPArray->vertices[myPArray->edges[n+j]].xyz[0]); + } + glEnd(); } - } else { - for( i=n=0 ; inum_bounds ; i++ ) { - if( renderMode == GL_FEEDBACK ) - draw_primitive_array( p, draw_mode, n, p->bounds[i]); - else - glDrawArrays( draw_mode, n, p->bounds[i]); - n += p->bounds[i]; + else + { + DrawElements (theWorkspace, myPArray, (renderMode == GL_FEEDBACK), myDrawMode, + myPArray->bounds[i], (GLenum* )&myPArray->edges[n]); } + n += myPArray->bounds[i]; } - } - else if( p->num_edges > 0 ) { -#ifndef OGLBUG - if( p->edge_vis ) { - glBegin( draw_mode ); - for( i=0 ; inum_edges ; i++ ) { - glEdgeFlag( p->edge_vis[i] ); - glVertex3fv( &p->vertices[p->edges[i]].xyz[0] ); - } - glEnd(); - } else -#endif - if( renderMode == GL_FEEDBACK ) - draw_primitive_elements( p, draw_mode, p->num_edges, - GL_UNSIGNED_INT,(GLenum*) p->edges); + } else - glDrawElements( draw_mode, p->num_edges, - GL_UNSIGNED_INT, p->edges); - } else { - if( renderMode == GL_FEEDBACK ) - draw_primitive_array( p, draw_mode, 0, p->num_vertexs); + { + for (i = n = 0 ; i < myPArray->num_bounds; ++i) + { + DrawArrays (theWorkspace, myPArray, (renderMode == GL_FEEDBACK), myDrawMode, + n, myPArray->bounds[i]); + n += myPArray->bounds[i]; + } + } + } + else if (myPArray->num_edges > 0) + { + if (myPArray->edge_vis) + { + glBegin (myDrawMode); + for (i = 0; i < myPArray->num_edges; ++i) + { + glEdgeFlag (myPArray->edge_vis[i]); + glVertex3fv (&myPArray->vertices[myPArray->edges[i]].xyz[0]); + } + glEnd(); + } else - glDrawArrays( draw_mode, 0, p->num_vertexs); + { + DrawElements (theWorkspace, myPArray, (renderMode == GL_FEEDBACK), myDrawMode, + myPArray->num_edges, (GLenum* )myPArray->edges); } } - - if( draw_mode > GL_LINE_STRIP ) { - CMN_KEY k; - if( line_width_preserve != edge_width ) { - k.id = TelPolylineWidth; - k.data.fdata = line_width_preserve; - TsmSetAttri( 1, &k ); - } - if( line_type_preserve != edge_type ) { - k.id = TelPolylineType; - k.data.ldata = line_type_preserve; - TsmSetAttri( 1, &k ); + else + { + DrawArrays (theWorkspace, myPArray, (renderMode == GL_FEEDBACK), myDrawMode, + 0, myPArray->num_vertexs); } + } + + if (myDrawMode > GL_LINE_STRIP) + { + // Restore line context + theWorkspace->SetAspectLine (anAspectLineOld); glPopAttrib(); } } -/*----------------------------------------------------------------------*/ -static void draw_degenerates_points_as_points ( call_def_parray p ) { - - Tint j; - tel_point pv = p -> vertices; - -#ifdef FULL_DEGENER - if ( g_fSkipRatio == 1. ) - return; -#endif - - for ( j=0 ; jnum_vertexs ; j++ ) { - glVertex3fv ( &pv[j].xyz[0] ); +// ======================================================================= +// function : DrawDegeneratesPointsAsPoints +// purpose : +// ======================================================================= +void OpenGl_PrimitiveArray::DrawDegeneratesPointsAsPoints() const +{ + tel_point pv = myPArray->vertices; + for (Tint aVertId = 0; aVertId < myPArray->num_vertexs; ++aVertId) + { + glVertex3fv (&pv[aVertId].xyz[0]); } -} - -/*----------------------------------------------------------------------*/ -static void draw_degenerates_lines_as_points ( call_def_parray p ) { - - Tint j; - GLfloat pt[ 3 ]; - tel_point pv = p -> vertices; +} -#ifdef FULL_DEGENER - if ( g_fSkipRatio == 1. ) - return; -#endif - - for ( j=0 ; jnum_vertexs ; j+=2 ) { - pt[0] = pt[1] = pt[2] = 0.; - pt[ 0 ] += pv[j].xyz[ 0 ]; - pt[ 1 ] += pv[j].xyz[ 1 ]; - pt[ 2 ] += pv[j].xyz[ 2 ]; - pt[ 0 ] += pv[j+1].xyz[ 0 ]; - pt[ 1 ] += pv[j+1].xyz[ 1 ]; - pt[ 2 ] += pv[j+1].xyz[ 2 ]; - pt[ 0 ] /= 2; - pt[ 1 ] /= 2; - pt[ 2 ] /= 2; - glVertex3fv ( pt ); +// ======================================================================= +// function : DrawDegeneratesLinesAsPoints +// purpose : +// ======================================================================= +void OpenGl_PrimitiveArray::DrawDegeneratesLinesAsPoints() const +{ + GLfloat pt[3]; + tel_point pv = myPArray->vertices; + + Tint j = 0; + while (j < myPArray->num_vertexs) + { + pt[0] = pv[j].xyz[0]; + pt[1] = pv[j].xyz[1]; + pt[2] = pv[j].xyz[2]; ++j; + pt[0] += pv[j].xyz[0]; + pt[1] += pv[j].xyz[1]; + pt[2] += pv[j].xyz[2]; ++j; + pt[0] *= 0.5f; + pt[1] *= 0.5f; + pt[2] *= 0.5f; + glVertex3fv (pt); } } -/*----------------------------------------------------------------------*/ -static void draw_degenerates_triangles_as_points ( call_def_parray p ) { - - Tint i, j, iv; - GLfloat pt[ 3 ]; - tel_point pv = p -> vertices; - -#ifdef FULL_DEGENER - if ( g_fSkipRatio == 1. ) - return; -#endif - - if( p->num_edges > 0 ) { - for ( j=0 ; jnum_edges ; j+=3 ) { - pt[0] = pt[1] = pt[2] = 0.; - for ( i=0 ; i<3 ; i++ ) { - iv = p->edges[j+i]; - pt[ 0 ] += pv[iv].xyz[ 0 ]; - pt[ 1 ] += pv[iv].xyz[ 1 ]; - pt[ 2 ] += pv[iv].xyz[ 2 ]; +// ======================================================================= +// function : DrawDegeneratesTrianglesAsPoints +// purpose : +// ======================================================================= +void OpenGl_PrimitiveArray::DrawDegeneratesTrianglesAsPoints() const +{ + Tint i, j, iv; + GLfloat pt[ 3 ]; + tel_point pv = myPArray->vertices; + + if (myPArray->num_edges > 0) + { + for (j = 0; j < myPArray->num_edges; j += 3) + { + iv = myPArray->edges[j]; + pt[0] = pv[iv].xyz[0]; + pt[1] = pv[iv].xyz[1]; + pt[2] = pv[iv].xyz[2]; + for (i = 1; i < 3; ++i) + { + iv = myPArray->edges[j+i]; + pt[0] += pv[iv].xyz[0]; + pt[1] += pv[iv].xyz[1]; + pt[2] += pv[iv].xyz[2]; } - pt[ 0 ] /= 3; - pt[ 1 ] /= 3; - pt[ 2 ] /= 3; - glVertex3fv ( pt ); + pt[0] /= 3.f; + pt[1] /= 3.f; + pt[2] /= 3.f; + glVertex3fv (pt); } - } else { - for ( j=0 ; jnum_vertexs ; j+=3 ) { - pt[0] = pt[1] = pt[2] = 0.; - for ( i=0 ; i<3 ; i++ ) { - pt[ 0 ] += pv[j+i].xyz[ 0 ]; - pt[ 1 ] += pv[j+i].xyz[ 1 ]; - pt[ 2 ] += pv[j+i].xyz[ 2 ]; + } + else + { + for (j = 0; j < myPArray->num_vertexs; j += 3) + { + pt[0] = pv[j].xyz[0]; + pt[1] = pv[j].xyz[1]; + pt[2] = pv[j].xyz[2]; + for (i = 1; i < 3; ++i) + { + pt[0] += pv[j+i].xyz[0]; + pt[1] += pv[j+i].xyz[1]; + pt[2] += pv[j+i].xyz[2]; } - pt[ 0 ] /= 3; - pt[ 1 ] /= 3; - pt[ 2 ] /= 3; - glVertex3fv ( pt ); + pt[0] /= 3.f; + pt[1] /= 3.f; + pt[2] /= 3.f; + glVertex3fv (pt); } } -} - -/*----------------------------------------------------------------------*/ -static void draw_degenerates_trianglestrips_as_points ( call_def_parray p ) { - - Tint i, j, k, n; - GLfloat pt[ 3 ]; - tel_point pv = p -> vertices; - -#ifdef FULL_DEGENER - if ( g_fSkipRatio == 1. ) - return; -#endif +} - if( p->num_bounds > 0 ) { - for ( k=n=0 ; knum_bounds ; k++ ) { - for ( j=0 ; jbounds[k]-2 ; j++ ) { - pt[0] = pt[1] = pt[2] = 0.; - for ( i=0 ; i<3 ; i++ ) { - pt[ 0 ] += pv[n+j+i].xyz[ 0 ]; - pt[ 1 ] += pv[n+j+i].xyz[ 1 ]; - pt[ 2 ] += pv[n+j+i].xyz[ 2 ]; +// ======================================================================= +// function : DrawDegeneratesTrianglesAsPoints +// purpose : +// ======================================================================= +void OpenGl_PrimitiveArray::DrawDegeneratesTrianglestripsAsPoints() const +{ + Tint i, j, k, n; + GLfloat pt[ 3 ]; + tel_point pv = myPArray->vertices; + + if (myPArray->num_bounds > 0) + { + for (k = n = 0; k < myPArray->num_bounds; ++k) + { + for (j = 0; j < myPArray->bounds[k] - 2; ++j) + { + pt[0] = pv[n+j].xyz[0]; + pt[1] = pv[n+j].xyz[1]; + pt[2] = pv[n+j].xyz[2]; + for (i = 1; i < 3; ++i) + { + pt[0] += pv[n+j+i].xyz[0]; + pt[1] += pv[n+j+i].xyz[1]; + pt[2] += pv[n+j+i].xyz[2]; } - pt[ 0 ] /= 3; - pt[ 1 ] /= 3; - pt[ 2 ] /= 3; - glVertex3fv ( pt ); + pt[0] /= 3.f; + pt[1] /= 3.f; + pt[2] /= 3.f; + glVertex3fv (pt); } - n += p->bounds[k]; + n += myPArray->bounds[k]; } - } else { - for ( j=0 ; jnum_vertexs-2 ; j++ ) { - pt[0] = pt[1] = pt[2] = 0.; - for ( i=0 ; i<3 ; i++ ) { - pt[ 0 ] += pv[j+i].xyz[ 0 ]; - pt[ 1 ] += pv[j+i].xyz[ 1 ]; - pt[ 2 ] += pv[j+i].xyz[ 2 ]; + } + else + { + for (j = 0; j < myPArray->num_vertexs - 2; ++j) + { + pt[0] = pv[j].xyz[0]; + pt[1] = pv[j].xyz[1]; + pt[2] = pv[j].xyz[2]; + for (i = 1; i < 3; ++i) + { + pt[0] += pv[j+i].xyz[0]; + pt[1] += pv[j+i].xyz[1]; + pt[2] += pv[j+i].xyz[2]; } - pt[ 0 ] /= 3; - pt[ 1 ] /= 3; - pt[ 2 ] /= 3; - glVertex3fv ( pt ); + pt[0] /= 3.f; + pt[1] /= 3.f; + pt[2] /= 3.f; + glVertex3fv (pt); } } -} - -/*----------------------------------------------------------------------*/ -static void draw_degenerates_polygons_as_points ( call_def_parray p ) { - - Tint j, k, n, iv; - GLfloat pt[ 3 ]; - tel_point pv = p -> vertices; - -#ifdef FULL_DEGENER - if ( g_fSkipRatio == 1. ) - return; -#endif +} - if( p->num_bounds > 0 ) { - if( p->num_edges > 0 ) { - for ( k=n=0 ; knum_bounds ; k++ ) { - pt[0] = pt[1] = pt[2] = 0.; - for ( j=0 ; jbounds[k] ; j++ ) { - iv = p->edges[n+j]; - pt[ 0 ] += pv[iv].xyz[ 0 ]; - pt[ 1 ] += pv[iv].xyz[ 1 ]; - pt[ 2 ] += pv[iv].xyz[ 2 ]; +// ======================================================================= +// function : DrawDegeneratesPolygonsAsPoints +// purpose : +// ======================================================================= +void OpenGl_PrimitiveArray::DrawDegeneratesPolygonsAsPoints() const +{ + Tint j, k, n, iv; + GLfloat pt[3]; + tel_point pv = myPArray->vertices; + + if (myPArray->num_bounds > 0) + { + if (myPArray->num_edges > 0) + { + for (k = n = 0; k < myPArray->num_bounds; ++k) + { + pt[0] = pt[1] = pt[2] = 0.0; + for (j = 0; j < myPArray->bounds[k]; ++j) + { + iv = myPArray->edges[n+j]; + pt[0] += pv[iv].xyz[0]; + pt[1] += pv[iv].xyz[1]; + pt[2] += pv[iv].xyz[2]; } - pt[ 0 ] /= p->bounds[k]; - pt[ 1 ] /= p->bounds[k]; - pt[ 2 ] /= p->bounds[k]; - glVertex3fv ( pt ); - n += p->bounds[k]; + pt[0] /= myPArray->bounds[k]; + pt[1] /= myPArray->bounds[k]; + pt[2] /= myPArray->bounds[k]; + glVertex3fv (pt); + n += myPArray->bounds[k]; } - } else { - for ( k=n=0 ; knum_bounds ; k++ ) { - pt[0] = pt[1] = pt[2] = 0.; - for ( j=0 ; jbounds[k] ; j++ ) { - pt[ 0 ] += pv[n+j].xyz[ 0 ]; - pt[ 1 ] += pv[n+j].xyz[ 1 ]; - pt[ 2 ] += pv[n+j].xyz[ 2 ]; + } + else + { + for (k = n = 0; k < myPArray->num_bounds; ++k) + { + pt[0] = pt[1] = pt[2] = 0.0; + for (j = 0; j < myPArray->bounds[k]; ++j) + { + pt[0] += pv[n+j].xyz[0]; + pt[1] += pv[n+j].xyz[1]; + pt[2] += pv[n+j].xyz[2]; } - pt[ 0 ] /= p->bounds[k]; - pt[ 1 ] /= p->bounds[k]; - pt[ 2 ] /= p->bounds[k]; - glVertex3fv ( pt ); - n += p->bounds[k]; + pt[0] /= myPArray->bounds[k]; + pt[1] /= myPArray->bounds[k]; + pt[2] /= myPArray->bounds[k]; + glVertex3fv (pt); + n += myPArray->bounds[k]; } } - } else if( p->num_edges > 0 ) { - pt[0] = pt[1] = pt[2] = 0.; - for ( j=0 ; jnum_edges ; j++ ) { - iv = p->edges[j]; - pt[ 0 ] += pv[iv].xyz[ 0 ]; - pt[ 1 ] += pv[iv].xyz[ 1 ]; - pt[ 2 ] += pv[iv].xyz[ 2 ]; + } + else if (myPArray->num_edges > 0) + { + pt[0] = pt[1] = pt[2] = 0.0; + for (j = 0; j < myPArray->num_edges; ++j) + { + iv = myPArray->edges[j]; + pt[0] += pv[iv].xyz[0]; + pt[1] += pv[iv].xyz[1]; + pt[2] += pv[iv].xyz[2]; } - pt[ 0 ] /= p->num_edges; - pt[ 1 ] /= p->num_edges; - pt[ 2 ] /= p->num_edges; - glVertex3fv ( pt ); - } else { - pt[0] = pt[1] = pt[2] = 0.; - for ( j=0 ; jnum_vertexs ; j++ ) { - pt[ 0 ] += pv[j].xyz[ 0 ]; - pt[ 1 ] += pv[j].xyz[ 1 ]; - pt[ 2 ] += pv[j].xyz[ 2 ]; + pt[0] /= myPArray->num_edges; + pt[1] /= myPArray->num_edges; + pt[2] /= myPArray->num_edges; + glVertex3fv (pt); + } + else + { + pt[0] = pt[1] = pt[2] = 0.0; + for (j = 0; j < myPArray->num_vertexs; ++j) + { + pt[0] += pv[j].xyz[0]; + pt[1] += pv[j].xyz[1]; + pt[2] += pv[j].xyz[2]; } - pt[ 0 ] /= p->num_vertexs; - pt[ 1 ] /= p->num_vertexs; - pt[ 2 ] /= p->num_vertexs; - glVertex3fv ( pt ); + pt[0] /= myPArray->num_vertexs; + pt[1] /= myPArray->num_vertexs; + pt[2] /= myPArray->num_vertexs; + glVertex3fv (pt); } -} - -/*----------------------------------------------------------------------*/ -static void draw_degenerates_quadrangles_as_points ( call_def_parray p ) { - - Tint i, j, iv; - GLfloat pt[ 3 ]; - tel_point pv = p -> vertices; - -#ifdef FULL_DEGENER - if ( g_fSkipRatio == 1. ) - return; -#endif +} - if( p->num_edges > 0 ) { - for ( j=0 ; jnum_edges ; j+=4 ) { - pt[0] = pt[1] = pt[2] = 0.; - for ( i=0 ; i<4 ; i++ ) { - iv = p->edges[j+i]; - pt[ 0 ] += pv[iv].xyz[ 0 ]; - pt[ 1 ] += pv[iv].xyz[ 1 ]; - pt[ 2 ] += pv[iv].xyz[ 2 ]; +// ======================================================================= +// function : DrawDegeneratesQuadranglesAsPoints +// purpose : +// ======================================================================= +void OpenGl_PrimitiveArray::DrawDegeneratesQuadranglesAsPoints() const +{ + Tint i, j, iv; + GLfloat pt[ 3 ]; + tel_point pv = myPArray->vertices; + + if (myPArray->num_edges > 0) + { + for (j = 0; j < myPArray->num_edges; j += 4) + { + pt[0] = pt[1] = pt[2] = 0.0; + for (i = 0; i < 4; ++i) + { + iv = myPArray->edges[j+i]; + pt[0] += pv[iv].xyz[0]; + pt[1] += pv[iv].xyz[1]; + pt[2] += pv[iv].xyz[2]; } - pt[ 0 ] /= 4; - pt[ 1 ] /= 4; - pt[ 2 ] /= 4; + pt[0] /= 4; + pt[1] /= 4; + pt[2] /= 4; glVertex3fv ( pt ); } - } else { - for ( j=0 ; jnum_vertexs ; j+=4 ) { - pt[0] = pt[1] = pt[2] = 0.; - for ( i=0 ; i<4 ; i++ ) { - pt[ 0 ] += pv[j+i].xyz[ 0 ]; - pt[ 1 ] += pv[j+i].xyz[ 1 ]; - pt[ 2 ] += pv[j+i].xyz[ 2 ]; + } + else + { + for (j = 0; j < myPArray->num_vertexs; j += 4) + { + pt[0] = pt[1] = pt[2] = 0.0; + for (i = 0; i < 4; ++i) + { + pt[0] += pv[j+i].xyz[0]; + pt[1] += pv[j+i].xyz[1]; + pt[2] += pv[j+i].xyz[2]; } - pt[ 0 ] /= 4; - pt[ 1 ] /= 4; - pt[ 2 ] /= 4; - glVertex3fv ( pt ); + pt[0] /= 4; + pt[1] /= 4; + pt[2] /= 4; + glVertex3fv (pt); } } } -/*----------------------------------------------------------------------*/ -static void draw_degenerates_quadranglestrips_as_points ( call_def_parray p ) { - - Tint i, j, k, n; - GLfloat pt[ 3 ]; - tel_point pv = p -> vertices; - -#ifdef FULL_DEGENER - if ( g_fSkipRatio == 1. ) - return; -#endif - - if( p->num_bounds > 0 ) { - for ( k=n=0 ; knum_bounds ; k++ ) { - for ( j=0 ; jbounds[k]-2 ; j+=2 ) { +// ======================================================================= +// function : DrawDegeneratesAsPoints +// purpose : +// ======================================================================= +void OpenGl_PrimitiveArray::DrawDegeneratesQuadranglestripsAsPoints() const +{ + Tint i, j, k, n; + GLfloat pt[3]; + tel_point pv = myPArray->vertices; + + if (myPArray->num_bounds > 0) + { + for (k = n = 0; k < myPArray->num_bounds; ++k) + { + for (j = 0; j < myPArray->bounds[k] - 2; j += 2) + { pt[0] = pt[1] = pt[2] = 0.; - for ( i=0 ; i<4 ; i++ ) { - pt[ 0 ] += pv[n+j+i].xyz[ 0 ]; - pt[ 1 ] += pv[n+j+i].xyz[ 1 ]; - pt[ 2 ] += pv[n+j+i].xyz[ 2 ]; + for (i = 0; i < 4; ++i) + { + pt[0] += pv[n+j+i].xyz[0]; + pt[1] += pv[n+j+i].xyz[1]; + pt[2] += pv[n+j+i].xyz[2]; } - pt[ 0 ] /= 4; - pt[ 1 ] /= 4; - pt[ 2 ] /= 4; - glVertex3fv ( pt ); + pt[0] /= 4; + pt[1] /= 4; + pt[2] /= 4; + glVertex3fv (pt); } - n += p->bounds[k]; + n += myPArray->bounds[k]; } - } else { - for ( j=0 ; jnum_vertexs-2 ; j+=2 ) { + } + else + { + for (j = 0; j < myPArray->num_vertexs - 2; j += 2) + { pt[0] = pt[1] = pt[2] = 0.; - for ( i=0 ; i<4 ; i++ ) { - pt[ 0 ] += pv[j+i].xyz[ 0 ]; - pt[ 1 ] += pv[j+i].xyz[ 1 ]; - pt[ 2 ] += pv[j+i].xyz[ 2 ]; + for (i = 0; i < 4; ++i) + { + pt[0] += pv[j+i].xyz[0]; + pt[1] += pv[j+i].xyz[1]; + pt[2] += pv[j+i].xyz[2]; } - pt[ 0 ] /= 4; - pt[ 1 ] /= 4; - pt[ 2 ] /= 4; - glVertex3fv ( pt ); + pt[0] /= 4; + pt[1] /= 4; + pt[2] /= 4; + glVertex3fv (pt); } } -} +} -/*----------------------------------------------------------------------*/ -static void draw_degenerates_as_points ( call_def_parray p, - tel_colour edge_colour ) +// ======================================================================= +// function : DrawDegeneratesAsPoints +// purpose : +// ======================================================================= +void OpenGl_PrimitiveArray::DrawDegeneratesAsPoints (const TEL_COLOUR* theEdgeColour, + const float theSkipRatio) const { + if (theSkipRatio >= 1.0f) + return; - GLboolean zbuff_state = glIsEnabled(GL_DEPTH_TEST); - LightOff (); - if( zbuff_state ) glDisable(GL_DEPTH_TEST); - glColor3fv( edge_colour->rgb ); - glBegin ( GL_POINTS ); - switch( draw_mode ) { - case GL_POINTS: - draw_degenerates_points_as_points( p ); - break; - case GL_LINES: - draw_degenerates_lines_as_points( p ); - break; - case GL_LINE_STRIP: - case GL_POLYGON: - draw_degenerates_polygons_as_points( p ); - break; - case GL_TRIANGLES: - draw_degenerates_triangles_as_points( p ); - break; - case GL_QUADS: - draw_degenerates_quadrangles_as_points( p ); - break; - case GL_TRIANGLE_FAN: - case GL_TRIANGLE_STRIP: - draw_degenerates_trianglestrips_as_points( p ); - break; - case GL_QUAD_STRIP: - draw_degenerates_quadranglestrips_as_points( p ); - break; - default: - break; + GLboolean zbuff_state = glIsEnabled (GL_DEPTH_TEST); + glDisable (GL_LIGHTING); + if (zbuff_state) + glDisable (GL_DEPTH_TEST); + glColor3fv (theEdgeColour->rgb); + + glBegin (GL_POINTS); + switch (myDrawMode) + { + case GL_POINTS: + DrawDegeneratesPointsAsPoints(); + break; + case GL_LINES: + DrawDegeneratesLinesAsPoints(); + break; + case GL_LINE_STRIP: + case GL_POLYGON: + DrawDegeneratesPolygonsAsPoints(); + break; + case GL_TRIANGLES: + DrawDegeneratesTrianglesAsPoints(); + break; + case GL_QUADS: + DrawDegeneratesQuadranglesAsPoints(); + break; + case GL_TRIANGLE_FAN: + case GL_TRIANGLE_STRIP: + DrawDegeneratesTrianglestripsAsPoints(); + break; + case GL_QUAD_STRIP: + DrawDegeneratesQuadranglestripsAsPoints(); + break; + default: + break; } - - glEnd (); - - if( zbuff_state ) glEnable(GL_DEPTH_TEST); + glEnd(); + if (zbuff_state) + glEnable (GL_DEPTH_TEST); } -/*----------------------------------------------------------------------*/ -static void draw_degenerates_lines_as_lines ( call_def_parray p ) { - - Tint i,j,n,iv; - tel_point pv = p -> vertices; +// ======================================================================= +// function : DrawDegeneratesLinesAsLines +// purpose : +// ======================================================================= +void OpenGl_PrimitiveArray::DrawDegeneratesLinesAsLines (const float theSkipRatio) const +{ + Tint i, iv; + tel_point pv = myPArray->vertices; - n = p->num_vertexs; - j = (int)((1.-g_fSkipRatio)*n); - while ( j-- ) { + Tint n = myPArray->num_vertexs; + Tint j = int((1.0f - theSkipRatio) * n); + for (; j > 0; --j) + { i = OGL_Rand() % n; - p->keys[i] = -p->keys[i]; - }; - - if( p->num_bounds > 0 ) { - if( p->num_edges > 0 ) { - for ( i=n=0 ; inum_bounds ; i++ ) { - glBegin ( GL_LINES ); - for ( j=0 ; jbounds[i] ; j++ ) { - iv = p->edges[n+j]; - if( p->keys[iv] < 0 ) { - p->keys[iv] = -p->keys[iv]; - glVertex3fv ( pv[iv].xyz ); + myPArray->keys[i] = -myPArray->keys[i]; + } + + if (myPArray->num_bounds > 0) + { + if (myPArray->num_edges > 0) + { + for (i = n = 0; i < myPArray->num_bounds; ++i) + { + glBegin (GL_LINES); + for (j = 0; j < myPArray->bounds[i]; ++j) + { + iv = myPArray->edges[n + j]; + if (myPArray->keys[iv] < 0) + { + myPArray->keys[iv] = -myPArray->keys[iv]; + glVertex3fv (pv[iv].xyz); } } glEnd(); - n += p->bounds[i]; + n += myPArray->bounds[i]; } - } else { - for ( i=n=0 ; inum_bounds ; i++ ) { - glBegin ( GL_LINES ); - for ( j=0 ; jbounds[i] ; j++ ) { - if( p->keys[n+j] < 0 ) { - p->keys[n+j] = -p->keys[n+j]; - glVertex3fv ( pv[n+j].xyz ); + } + else + { + for (i = n = 0; i < myPArray->num_bounds; ++i) + { + glBegin (GL_LINES); + for (j = 0; j < myPArray->bounds[i]; ++j) + { + if (myPArray->keys[n+j] < 0) + { + myPArray->keys[n+j] = -myPArray->keys[n+j]; + glVertex3fv (pv[n+j].xyz); } } glEnd(); - n += p->bounds[i]; + n += myPArray->bounds[i]; } } - } else if( p->num_edges > 0 ) { - glBegin ( GL_LINES ); - for ( j=0 ; jnum_edges ; j++ ) { - iv = p->edges[j]; - if( p->keys[iv] < 0 ) { - p->keys[iv] = -p->keys[iv]; - glVertex3fv ( pv[iv].xyz ); + } + else if (myPArray->num_edges > 0) + { + glBegin (GL_LINES); + for (j = 0; j < myPArray->num_edges; ++j) + { + iv = myPArray->edges[j]; + if (myPArray->keys[iv] < 0) + { + myPArray->keys[iv] = -myPArray->keys[iv]; + glVertex3fv (pv[iv].xyz); } } glEnd(); - } else { - glBegin ( GL_LINES ); - for ( j=0 ; jnum_vertexs ; j++ ) { - if( p->keys[j] < 0 ) { - p->keys[j] = -p->keys[j]; - glVertex3fv ( pv[j].xyz ); + } + else + { + glBegin (GL_LINES); + for (j = 0; j < myPArray->num_vertexs; ++j) + { + if (myPArray->keys[j] < 0) + { + myPArray->keys[j] = -myPArray->keys[j]; + glVertex3fv (pv[j].xyz); } } glEnd(); } -} +} -/*----------------------------------------------------------------------*/ -static void draw_degenerates_triangles_as_lines ( call_def_parray p ) +// ======================================================================= +// function : DrawDegeneratesTrianglesAsLines +// purpose : +// ======================================================================= +void OpenGl_PrimitiveArray::DrawDegeneratesTrianglesAsLines (const float theSkipRatio) const { + Tint i, iv; + tel_point pv = myPArray->vertices; - Tint i,j,n,iv; - tel_point pv = p -> vertices; - - n = p->num_vertexs/3; - j = (int)((1.-g_fSkipRatio)*n); - while ( j-- ) { + Tint n = myPArray->num_vertexs / 3; + Tint j = int((1.0f - theSkipRatio) * n); + for (; j > 0; --j) + { i = OGL_Rand() % n; i *= 3; - p->keys[i] = -p->keys[i]; - }; - - if( p->num_edges > 0 ) { - for ( j=0 ; jnum_edges ; j+=3 ) { - iv = p->edges[j]; - if( p->keys[iv] < 0 ) { - p->keys[iv] = -p->keys[iv]; - glBegin ( GL_LINE_LOOP ); - for ( i=0 ; i<3 ; i++ ) { - iv = p->edges[j+i]; - glVertex3fv ( pv[iv].xyz ); + myPArray->keys[i] = -myPArray->keys[i]; + } + + if (myPArray->num_edges > 0) + { + for (j = 0; j < myPArray->num_edges; j += 3) + { + iv = myPArray->edges[j]; + if (myPArray->keys[iv] < 0) + { + myPArray->keys[iv] = -myPArray->keys[iv]; + glBegin (GL_LINE_LOOP); + for (i = 0; i < 3; ++i) + { + iv = myPArray->edges[j+i]; + glVertex3fv (pv[iv].xyz); } glEnd(); } } - } else { - for ( j=0 ; jnum_vertexs ; j+=3 ) { - if( p->keys[j] < 0 ) { - p->keys[j] = -p->keys[j]; - glBegin ( GL_LINE_LOOP ); - for ( i=0 ; i<3 ; i++ ) { - glVertex3fv ( pv[j+i].xyz ); + } + else + { + for (j = 0; j < myPArray->num_vertexs; j += 3) + { + if (myPArray->keys[j] < 0) + { + myPArray->keys[j] = -myPArray->keys[j]; + glBegin (GL_LINE_LOOP); + for (i = 0; i < 3; ++i) + { + glVertex3fv (pv[j+i].xyz); } glEnd(); } } } -} +} -/*----------------------------------------------------------------------*/ -static void draw_degenerates_trianglestrips_as_lines ( call_def_parray p ) +// ======================================================================= +// function : DrawDegeneratesTrianglesAsLines +// purpose : +// ======================================================================= +void OpenGl_PrimitiveArray::DrawDegeneratesTrianglestripsAsLines (const float theSkipRatio) const { - - Tint i,j,k,n,ni; - tel_point pv = p -> vertices; - - if( p->num_bounds > 0 ) { - for ( i=n=0 ; inum_bounds ; i++ ) { - ni = p->bounds[i]-2; - k = (int)((1.-g_fSkipRatio)*ni); - while ( k-- ) { + Tint i, j, k, n, ni; + tel_point pv = myPArray->vertices; + + if (myPArray->num_bounds > 0) + { + for (i = n = 0; i < myPArray->num_bounds; ++i) + { + ni = myPArray->bounds[i] - 2; + k = int((1.0f - theSkipRatio) * ni); + for (; k > 0; --k) + { j = OGL_Rand() % ni; j += 2; - p->keys[n+j] = -p->keys[n+j]; - }; - for ( j=2 ; jbounds[i] ; j++ ) { - if( p->keys[n+j] < 0 ) { - p->keys[n+j] = -p->keys[n+j]; - glBegin ( GL_LINE_LOOP ); - glVertex3fv ( pv[n+j-2].xyz ); - glVertex3fv ( pv[n+j-1].xyz ); - glVertex3fv ( pv[n+j].xyz ); + myPArray->keys[n+j] = -myPArray->keys[n+j]; + } + for (j = 2; j < myPArray->bounds[i]; ++j) + { + if (myPArray->keys[n+j] < 0) + { + myPArray->keys[n+j] = -myPArray->keys[n+j]; + glBegin (GL_LINE_LOOP); + glVertex3fv (pv[n+j-2].xyz); + glVertex3fv (pv[n+j-1].xyz); + glVertex3fv (pv[n+j].xyz); glEnd(); } } - n += p->bounds[i]; + n += myPArray->bounds[i]; } - } else { - ni = p->num_vertexs-2; - k = (int)((1.-g_fSkipRatio)*ni); - while ( k-- ) { + } + else + { + ni = myPArray->num_vertexs - 2; + k = int((1.0f - theSkipRatio) * ni); + for (; k > 0; --k) + { j = OGL_Rand() % ni; j += 2; - p->keys[j] = -p->keys[j]; - }; - for ( j=2 ; jnum_vertexs ; j++ ) { - if( p->keys[j] < 0 ) { - p->keys[j] = -p->keys[j]; - glBegin ( GL_LINE_LOOP ); - glVertex3fv ( pv[j-2].xyz ); - glVertex3fv ( pv[j-1].xyz ); - glVertex3fv ( pv[j].xyz ); + myPArray->keys[j] = -myPArray->keys[j]; + } + for (j = 2; j < myPArray->num_vertexs; ++j) + { + if (myPArray->keys[j] < 0) + { + myPArray->keys[j] = -myPArray->keys[j]; + glBegin (GL_LINE_LOOP); + glVertex3fv (pv[j-2].xyz); + glVertex3fv (pv[j-1].xyz); + glVertex3fv (pv[j].xyz); glEnd(); } } } -} +} -/*----------------------------------------------------------------------*/ -static void draw_degenerates_polygons_as_lines ( call_def_parray p ) +// ======================================================================= +// function : DrawDegeneratesPolygonsAsLines +// purpose : +// ======================================================================= +void OpenGl_PrimitiveArray::DrawDegeneratesPolygonsAsLines (const float theSkipRatio) const { - Tint i,j,n,iv; - tel_point pv = p -> vertices; + Tint i, iv; + tel_point pv = myPArray->vertices; - n = p->num_vertexs; - j = (int)((1.-g_fSkipRatio)*n); - while ( j-- ) { + Tint n = myPArray->num_vertexs; + Tint j = int((1.0f - theSkipRatio) * n); + for (; j > 0; --j) + { i = OGL_Rand() % n; - p->keys[i] = -p->keys[i]; - }; - - if( p->num_bounds > 0 ) { - if( p->num_edges > 0 ) { - for ( i=n=0 ; inum_bounds ; i++ ) { - glBegin ( GL_LINE_LOOP ); - for ( j=0 ; jbounds[i] ; j++ ) { - iv = p->edges[n+j]; - if( p->keys[iv] < 0 ) { - p->keys[iv] = -p->keys[iv]; - glVertex3fv ( pv[iv].xyz ); + myPArray->keys[i] = -myPArray->keys[i]; + } + + if (myPArray->num_bounds > 0) + { + if (myPArray->num_edges > 0) + { + for (i = n = 0; i < myPArray->num_bounds; ++i) + { + glBegin (GL_LINE_LOOP); + for (j = 0; j < myPArray->bounds[i]; ++j) + { + iv = myPArray->edges[n+j]; + if (myPArray->keys[iv] < 0) + { + myPArray->keys[iv] = -myPArray->keys[iv]; + glVertex3fv (pv[iv].xyz); } } glEnd(); - n += p->bounds[i]; + n += myPArray->bounds[i]; } - } else { - for ( i=n=0 ; inum_bounds ; i++ ) { - glBegin ( GL_LINE_LOOP ); - for ( j=0 ; jbounds[i] ; j++ ) { - if( p->keys[n+j] < 0 ) { - p->keys[n+j] = -p->keys[n+j]; - glVertex3fv ( pv[n+j].xyz ); + } + else + { + for (i = n = 0; i < myPArray->num_bounds; ++i) + { + glBegin (GL_LINE_LOOP); + for (j = 0; j < myPArray->bounds[i]; ++j) + { + if (myPArray->keys[n+j] < 0) + { + myPArray->keys[n+j] = -myPArray->keys[n+j]; + glVertex3fv (pv[n+j].xyz); } } glEnd(); - n += p->bounds[i]; + n += myPArray->bounds[i]; } } - } else if( p->num_edges > 0 ) { - glBegin ( GL_LINE_LOOP ); - for ( j=0 ; jnum_edges ; j++ ) { - iv = p->edges[j]; - if( p->keys[iv] < 0 ) { - p->keys[iv] = -p->keys[iv]; - glVertex3fv ( pv[iv].xyz ); + } + else if (myPArray->num_edges > 0) + { + glBegin (GL_LINE_LOOP); + for (j = 0; j < myPArray->num_edges; ++j) + { + iv = myPArray->edges[j]; + if (myPArray->keys[iv] < 0) + { + myPArray->keys[iv] = -myPArray->keys[iv]; + glVertex3fv (pv[iv].xyz); } } glEnd(); - } else { - glBegin ( GL_LINE_LOOP ); - for ( j=0 ; jnum_vertexs ; j++ ) { - if( p->keys[j] < 0 ) { - p->keys[j] = -p->keys[j]; - glVertex3fv ( pv[j].xyz ); + } + else + { + glBegin (GL_LINE_LOOP); + for (j = 0; j < myPArray->num_vertexs; ++j) + { + if (myPArray->keys[j] < 0) + { + myPArray->keys[j] = -myPArray->keys[j]; + glVertex3fv (pv[j].xyz); } } glEnd(); } - } -/*----------------------------------------------------------------------*/ -static void draw_degenerates_quadrangles_as_lines ( call_def_parray p ) -{ - - Tint i,j,n,iv; - tel_point pv = p -> vertices; +// ======================================================================= +// function : DrawDegeneratesQuadranglesAsLines +// purpose : +// ======================================================================= +void OpenGl_PrimitiveArray::DrawDegeneratesQuadranglesAsLines (const float theSkipRatio) const +{ + Tint i, iv; + tel_point pv = myPArray->vertices; - n = p->num_vertexs/4; - j = (int)((1.-g_fSkipRatio)*n); - while ( j-- ) { + Tint n = myPArray->num_vertexs / 4; + Tint j = int((1.0f - theSkipRatio) * n); + for (; j > 0; --j) + { i = OGL_Rand() % n; i *= 4; - p->keys[i] = -p->keys[i]; - }; - - if( p->num_edges > 0 ) { - for ( j=0 ; jnum_edges ; j+=4 ) { - iv = p->edges[j]; - if( p->keys[iv] < 0 ) { - p->keys[iv] = -p->keys[iv]; - glBegin ( GL_LINE_LOOP ); - for ( i=0 ; i<4 ; i++ ) { - iv = p->edges[j+i]; - glVertex3fv ( pv[iv].xyz ); + myPArray->keys[i] = -myPArray->keys[i]; + } + + if (myPArray->num_edges > 0) + { + for (j = 0; j < myPArray->num_edges; j += 4) + { + iv = myPArray->edges[j]; + if (myPArray->keys[iv] < 0) + { + myPArray->keys[iv] = -myPArray->keys[iv]; + glBegin (GL_LINE_LOOP); + for (i = 0; i < 4; ++i) + { + iv = myPArray->edges[j+i]; + glVertex3fv (pv[iv].xyz); } glEnd(); } } - } else { - for ( j=0 ; jnum_vertexs ; j+=4 ) { - if( p->keys[j] < 0 ) { - p->keys[j] = -p->keys[j]; - glBegin ( GL_LINE_LOOP ); - for ( i=0 ; i<4 ; i++ ) { - glVertex3fv ( pv[j+i].xyz ); + } + else + { + for (j = 0; j < myPArray->num_vertexs; j += 4) + { + if (myPArray->keys[j] < 0) + { + myPArray->keys[j] = -myPArray->keys[j]; + glBegin (GL_LINE_LOOP); + for (i = 0; i < 4; ++i) + { + glVertex3fv (pv[j+i].xyz); } glEnd(); } } } -} +} -/*----------------------------------------------------------------------*/ -static void draw_degenerates_quadranglestrips_as_lines ( call_def_parray p ) +// ======================================================================= +// function : DrawDegeneratesQuadranglesAsLines +// purpose : +// ======================================================================= +void OpenGl_PrimitiveArray::DrawDegeneratesQuadranglestripsAsLines (const float theSkipRatio) const { - - Tint i,j,k,n,ni; - tel_point pv = p -> vertices; - - if( p->num_bounds > 0 ) { - for ( i=n=0 ; inum_bounds ; i++ ) { - ni = p->bounds[i]/2-2; - k = (int)((1.-g_fSkipRatio)*ni); - while ( k-- ) { - j = OGL_Rand() % ni; j = j*2+2; - p->keys[n+j] = -p->keys[n+j]; - }; - for ( j=3 ; jbounds[i] ; j+=2 ) { - if( p->keys[n+j] < 0 ) { - p->keys[n+j] = -p->keys[n+j]; - glBegin ( GL_LINE_LOOP ); - glVertex3fv ( pv[n+j-3].xyz ); - glVertex3fv ( pv[n+j-2].xyz ); - glVertex3fv ( pv[n+j-1].xyz ); - glVertex3fv ( pv[n+j].xyz ); + Tint i, j, k, n, ni; + tel_point pv = myPArray->vertices; + + if (myPArray->num_bounds > 0) + { + for (i = n = 0; i < myPArray->num_bounds; ++i) + { + ni = myPArray->bounds[i] / 2 - 2; + k = int((1.0f - theSkipRatio) * ni); + for (; k > 0; --k) + { + j = OGL_Rand() % ni; j = j * 2 + 2; + myPArray->keys[n+j] = -myPArray->keys[n+j]; + } + for (j = 3; j < myPArray->bounds[i]; j += 2) + { + if (myPArray->keys[n+j] < 0) + { + myPArray->keys[n+j] = -myPArray->keys[n+j]; + glBegin (GL_LINE_LOOP); + glVertex3fv (pv[n+j-3].xyz); + glVertex3fv (pv[n+j-2].xyz); + glVertex3fv (pv[n+j-1].xyz); + glVertex3fv (pv[n+j].xyz); glEnd(); } } - n += p->bounds[i]; + n += myPArray->bounds[i]; + } + } + else + { + ni = myPArray->num_vertexs / 2 - 2; + k = int((1.0f - theSkipRatio) * ni); + for (; k > 0; --k) + { + j = OGL_Rand() % ni; j = j * 2 + 2; + myPArray->keys[j] = -myPArray->keys[j]; } - } else { - ni = p->num_vertexs/2-2; - k = (int)((1.-g_fSkipRatio)*ni); - while ( k-- ) { - j = OGL_Rand() % ni; j = j*2+2; - p->keys[j] = -p->keys[j]; - }; - for ( j=3 ; jnum_vertexs ; j+=2 ) { - if( p->keys[j] < 0 ) { - p->keys[j] = -p->keys[j]; - glBegin ( GL_LINE_LOOP ); - glVertex3fv ( pv[j-3].xyz ); - glVertex3fv ( pv[j-2].xyz ); - glVertex3fv ( pv[j-1].xyz ); - glVertex3fv ( pv[j].xyz ); + for (j = 3; j < myPArray->num_vertexs; j += 2) + { + if (myPArray->keys[j] < 0) + { + myPArray->keys[j] = -myPArray->keys[j]; + glBegin (GL_LINE_LOOP); + glVertex3fv (pv[j-3].xyz); + glVertex3fv (pv[j-2].xyz); + glVertex3fv (pv[j-1].xyz); + glVertex3fv (pv[j].xyz); glEnd(); } } } -} +} -/*----------------------------------------------------------------------*/ -static void draw_degenerates_as_lines ( call_def_parray p, - tel_colour edge_colour ) +// ======================================================================= +// function : DrawDegeneratesAsLines +// purpose : +// ======================================================================= +void OpenGl_PrimitiveArray::DrawDegeneratesAsLines (const TEL_COLOUR* theEdgeColour, + const Handle(OpenGl_Workspace)& theWorkspace) const { + const float aSkipRatio = theWorkspace->SkipRatio; - GLint renderMode; - - GLboolean zbuff_state = glIsEnabled(GL_DEPTH_TEST); + GLboolean zbuff_state = glIsEnabled (GL_DEPTH_TEST); - LightOff (); + glDisable (GL_LIGHTING); - if( zbuff_state ) glDisable(GL_DEPTH_TEST); + if (zbuff_state) + glDisable (GL_DEPTH_TEST); - glColor3fv( edge_colour->rgb ); + glColor3fv (theEdgeColour->rgb); - if( g_fSkipRatio != 0 ) switch( draw_mode ) { + if (aSkipRatio != 0.0f) + { + switch (myDrawMode) + { case GL_POINTS: - draw_degenerates_points_as_points( p ); + if (aSkipRatio < 1.0f) + DrawDegeneratesPointsAsPoints(); break; case GL_LINES: - draw_degenerates_lines_as_lines( p ); + DrawDegeneratesLinesAsLines (aSkipRatio); break; case GL_LINE_STRIP: case GL_POLYGON: - draw_degenerates_polygons_as_lines( p ); + DrawDegeneratesPolygonsAsLines (aSkipRatio); break; case GL_TRIANGLES: - draw_degenerates_triangles_as_lines( p ); + DrawDegeneratesTrianglesAsLines (aSkipRatio); break; case GL_QUADS: - draw_degenerates_quadrangles_as_lines( p ); + DrawDegeneratesQuadranglesAsLines (aSkipRatio); break; case GL_TRIANGLE_FAN: case GL_TRIANGLE_STRIP: - draw_degenerates_trianglestrips_as_lines( p ); + DrawDegeneratesTrianglestripsAsLines (aSkipRatio); break; case GL_QUAD_STRIP: - draw_degenerates_quadranglestrips_as_lines( p ); + DrawDegeneratesQuadranglestripsAsLines (aSkipRatio); break; default: break; + } } - else { + else + { int i,n; - -#ifdef OCC3192 - GLboolean color_array_mode, - edge_flag_array_mode, - index_array_mode, - normal_array_mode, - texture_coord_array_mode, - vertex_array_mode; -#endif - glPushAttrib( GL_POLYGON_BIT ); - glPolygonMode( GL_FRONT_AND_BACK, GL_LINE ); - -#ifdef OCC3192 - color_array_mode = glIsEnabled( GL_COLOR_ARRAY ); - edge_flag_array_mode = glIsEnabled( GL_EDGE_FLAG_ARRAY ); - index_array_mode = glIsEnabled( GL_INDEX_ARRAY ); - normal_array_mode = glIsEnabled( GL_NORMAL_ARRAY ); - texture_coord_array_mode = glIsEnabled( GL_TEXTURE_COORD_ARRAY ); - vertex_array_mode = glIsEnabled( GL_VERTEX_ARRAY ); - - glDisableClientState( GL_COLOR_ARRAY ); - glDisableClientState( GL_EDGE_FLAG_ARRAY ); - glDisableClientState( GL_INDEX_ARRAY ); - glDisableClientState( GL_NORMAL_ARRAY ); - glDisableClientState( GL_TEXTURE_COORD_ARRAY ); - - if( !vertex_array_mode ) glEnableClientState( GL_VERTEX_ARRAY ); -#else - glEnableClientState( GL_VERTEX_ARRAY ); -#endif - glVertexPointer(3, GL_FLOAT, 0, p->vertices); /* array of vertices */ - - glGetIntegerv( GL_RENDER_MODE, &renderMode ); - - if( p->num_bounds > 0 ) { - if( p->num_edges > 0 ) { - for( i=n=0 ; inum_bounds ; i++ ) { - if( renderMode == GL_FEEDBACK ) - draw_primitive_elements( p, draw_mode, p->bounds[i], - GL_UNSIGNED_INT, (GLenum*) &p->edges[n]); - else - glDrawElements( draw_mode, p->bounds[i], - GL_UNSIGNED_INT, &p->edges[n]); - n += p->bounds[i]; - } - } else { - for( i=n=0 ; inum_bounds ; i++ ) { - if( renderMode == GL_FEEDBACK ) - draw_primitive_array( p, draw_mode, n, p->bounds[i]); - else - glDrawArrays( draw_mode, n, p->bounds[i]); - n += p->bounds[i]; + glPushAttrib (GL_POLYGON_BIT); + glPolygonMode (GL_FRONT_AND_BACK, GL_LINE); + + GLboolean color_array_mode = glIsEnabled (GL_COLOR_ARRAY); + GLboolean edge_flag_array_mode = glIsEnabled (GL_EDGE_FLAG_ARRAY); + GLboolean index_array_mode = glIsEnabled (GL_INDEX_ARRAY); + GLboolean normal_array_mode = glIsEnabled (GL_NORMAL_ARRAY); + GLboolean texture_coord_array_mode = glIsEnabled (GL_TEXTURE_COORD_ARRAY); + GLboolean vertex_array_mode = glIsEnabled (GL_VERTEX_ARRAY); + + glDisableClientState (GL_COLOR_ARRAY); + glDisableClientState (GL_EDGE_FLAG_ARRAY); + glDisableClientState (GL_INDEX_ARRAY); + glDisableClientState (GL_NORMAL_ARRAY); + glDisableClientState (GL_TEXTURE_COORD_ARRAY); + + if (!vertex_array_mode) + glEnableClientState (GL_VERTEX_ARRAY); + + glVertexPointer (3, GL_FLOAT, 0, myPArray->vertices); // array of vertices + + GLint renderMode; + glGetIntegerv (GL_RENDER_MODE, &renderMode); + + if (myPArray->num_bounds > 0) + { + if (myPArray->num_edges > 0) + { + for (i = n = 0; i < myPArray->num_bounds; ++i) + { + DrawElements (theWorkspace, myPArray, (renderMode == GL_FEEDBACK), myDrawMode, + myPArray->bounds[i], (GLenum* )&myPArray->edges[n]); + n += myPArray->bounds[i]; } } - } else if( p->num_edges > 0 ) { - if( renderMode == GL_FEEDBACK ) - draw_primitive_elements( p, draw_mode, p->num_edges, - GL_UNSIGNED_INT, (GLenum*) p->edges); - else - glDrawElements( draw_mode, p->num_edges, - GL_UNSIGNED_INT, p->edges); - } else { - if( renderMode == GL_FEEDBACK ) - draw_primitive_array( p, draw_mode, 0, p->num_vertexs); else - glDrawArrays( draw_mode, 0, p->num_vertexs); + { + for (i = n = 0; i < myPArray->num_bounds; ++i) + { + DrawArrays (theWorkspace, myPArray, (renderMode == GL_FEEDBACK), myDrawMode, + n, myPArray->bounds[i]); + n += myPArray->bounds[i]; + } + } + } + else if (myPArray->num_edges > 0) + { + DrawElements (theWorkspace, myPArray, (renderMode == GL_FEEDBACK), myDrawMode, + myPArray->num_edges, (GLenum* )myPArray->edges); + } + else + { + DrawArrays (theWorkspace, myPArray, (renderMode == GL_FEEDBACK), myDrawMode, + 0, myPArray->num_vertexs); } -#ifdef OCC3192 - if( !vertex_array_mode ) glDisableClientState( GL_VERTEX_ARRAY ); + if (!vertex_array_mode) glDisableClientState (GL_VERTEX_ARRAY); + + if (color_array_mode) glEnableClientState (GL_COLOR_ARRAY); + if (edge_flag_array_mode) glEnableClientState (GL_EDGE_FLAG_ARRAY); + if (index_array_mode) glEnableClientState (GL_INDEX_ARRAY); + if (normal_array_mode) glEnableClientState (GL_NORMAL_ARRAY); + if (texture_coord_array_mode) glEnableClientState (GL_TEXTURE_COORD_ARRAY); - if( color_array_mode ) glEnableClientState( GL_COLOR_ARRAY ); - if( edge_flag_array_mode ) glEnableClientState( GL_EDGE_FLAG_ARRAY ); - if( index_array_mode ) glEnableClientState( GL_INDEX_ARRAY ); - if( normal_array_mode ) glEnableClientState( GL_NORMAL_ARRAY ); - if( texture_coord_array_mode ) glEnableClientState( GL_TEXTURE_COORD_ARRAY ); -#endif glPopAttrib(); } - if( zbuff_state ) glEnable(GL_DEPTH_TEST); - + if (zbuff_state) + glEnable(GL_DEPTH_TEST); } -static void draw_degenerates_as_bboxs ( call_def_parray p, - tel_colour edge_colour ) +// ======================================================================= +// function : DrawDegeneratesAsBBoxs +// purpose : +// ======================================================================= +void OpenGl_PrimitiveArray::DrawDegeneratesAsBBoxs (const TEL_COLOUR* theEdgeColour) const { + GLfloat minp[3] = { FLT_MAX, FLT_MAX, FLT_MAX }; + GLfloat maxp[3] = { FLT_MIN, FLT_MIN, FLT_MIN }; + tel_point pv = myPArray->vertices; + + glDisable (GL_LIGHTING); + + glColor3fv (theEdgeColour->rgb); + + for (Tint i = 0; i < myPArray->num_vertexs; ++i) + { + if (pv[i].xyz[0] < minp[0]) + minp[0] = pv[i].xyz[0]; + if (pv[i].xyz[1] < minp[1]) + minp[1] = pv[i].xyz[1]; + if (pv[i].xyz[2] < minp[2]) + minp[2] = pv[i].xyz[2]; + + if (pv[i].xyz[0] > maxp[0]) + maxp[0] = pv[i].xyz[0]; + if (pv[i].xyz[1] > maxp[1]) + maxp[1] = pv[i].xyz[1]; + if (pv[i].xyz[2] > maxp[2]) + maxp[2] = pv[i].xyz[2]; + } + + glBegin (GL_LINE_STRIP); + + glVertex3fv (minp); + glVertex3f (minp[0], maxp[1], minp[2]); + glVertex3f (minp[0], maxp[1], maxp[2]); + glVertex3f (minp[0], minp[1], maxp[2]); + glVertex3f (minp[0], minp[1], minp[2]); + + glVertex3f (maxp[0], minp[1], minp[2]); + glVertex3f (maxp[0], maxp[1], minp[2]); + glVertex3f (maxp[0], maxp[1], maxp[2]); + glVertex3f (maxp[0], minp[1], maxp[2]); + glVertex3f (maxp[0], minp[1], minp[2]); - Tint i; - GLfloat minp[ 3 ] = { FLT_MAX, FLT_MAX, FLT_MAX }; - GLfloat maxp[ 3 ] = { FLT_MIN, FLT_MIN, FLT_MIN }; - tel_point pv = p -> vertices; - - LightOff (); - - glColor3fv( edge_colour->rgb ); - - for ( i=0 ; inum_vertexs ; ++i ) { - if ( pv[ i ].xyz[ 0 ] < minp[ 0 ] ) - minp[ 0 ] = pv[ i ].xyz[ 0 ] ; - if ( pv[ i ].xyz[ 1 ] < minp[ 1 ] ) - minp[ 1 ] = pv[ i ].xyz[ 1 ] ; - if ( pv[ i ].xyz[ 2 ] < minp[ 2 ] ) - minp[ 2 ] = pv[ i ].xyz[ 2 ] ; - - if ( pv[ i ].xyz[ 0 ] > maxp[ 0 ] ) - maxp[ 0 ] = pv[ i ].xyz[ 0 ] ; - if ( pv[ i ].xyz[ 1 ] > maxp[ 1 ] ) - maxp[ 1 ] = pv[ i ].xyz[ 1 ] ; - if ( pv[ i ].xyz[ 2 ] > maxp[ 2 ] ) - maxp[ 2 ] = pv[ i ].xyz[ 2 ] ; - } /* end for ( i ) */ - - glBegin ( GL_LINE_STRIP ); - - glVertex3fv ( minp ); - glVertex3f ( minp[ 0 ], maxp[ 1 ], minp[ 2 ] ); - glVertex3f ( minp[ 0 ], maxp[ 1 ], maxp[ 2 ] ); - glVertex3f ( minp[ 0 ], minp[ 1 ], maxp[ 2 ] ); - glVertex3f ( minp[ 0 ], minp[ 1 ], minp[ 2 ] ); - - glVertex3f ( maxp[ 0 ], minp[ 1 ], minp[ 2 ] ); - glVertex3f ( maxp[ 0 ], maxp[ 1 ], minp[ 2 ] ); - glVertex3f ( maxp[ 0 ], maxp[ 1 ], maxp[ 2 ] ); - glVertex3f ( maxp[ 0 ], minp[ 1 ], maxp[ 2 ] ); - glVertex3f ( maxp[ 0 ], minp[ 1 ], minp[ 2 ] ); - - glVertex3f ( maxp[ 0 ], minp[ 1 ], maxp[ 2 ] ); - glVertex3f ( minp[ 0 ], minp[ 1 ], maxp[ 2 ] ); - glVertex3f ( minp[ 0 ], maxp[ 1 ], maxp[ 2 ] ); - glVertex3fv ( maxp ); - glVertex3f ( maxp[ 0 ], maxp[ 1 ], minp[ 2 ] ); - glVertex3f ( minp[ 0 ], maxp[ 1 ], minp[ 2 ] ); + glVertex3f (maxp[0], minp[1], maxp[2]); + glVertex3f (minp[0], minp[1], maxp[2]); + glVertex3f (minp[0], maxp[1], maxp[2]); + glVertex3fv (maxp); + glVertex3f (maxp[0], maxp[1], minp[2]); + glVertex3f (minp[0], maxp[1], minp[2]); glEnd(); +} -} /* end draw_degenerates_as_bboxs */ +// ======================================================================= +// function : OpenGl_PrimitiveArray +// purpose : +// ======================================================================= +OpenGl_PrimitiveArray::OpenGl_PrimitiveArray (CALL_DEF_PARRAY* thePArray) +: myPArray (thePArray), + myDrawMode (GL_NONE) +{ + switch (myPArray->type) + { + case TelPointsArrayType: + myDrawMode = GL_POINTS; + break; + case TelPolylinesArrayType: + myDrawMode = GL_LINE_STRIP; + break; + case TelSegmentsArrayType: + myDrawMode = GL_LINES; + break; + case TelPolygonsArrayType: + myDrawMode = GL_POLYGON; + break; + case TelTrianglesArrayType: + myDrawMode = GL_TRIANGLES; + break; + case TelQuadranglesArrayType: + myDrawMode = GL_QUADS; + break; + case TelTriangleStripsArrayType: + myDrawMode = GL_TRIANGLE_STRIP; + break; + case TelQuadrangleStripsArrayType: + myDrawMode = GL_QUAD_STRIP; + break; + case TelTriangleFansArrayType: + myDrawMode = GL_TRIANGLE_FAN; + break; + } +} + +// ======================================================================= +// function : ~OpenGl_PrimitiveArray +// purpose : +// ======================================================================= +OpenGl_PrimitiveArray::~OpenGl_PrimitiveArray () +{ + if (myPArray == NULL) + return; + + if (myPArray->VBOEnabled == VBO_OK) + { + OpenGl_ResourceCleaner* aResCleaner = OpenGl_ResourceCleaner::GetInstance(); + if (myPArray->bufferVBO[VBOEdges] != 0) + aResCleaner->AddResource ((GLCONTEXT )myPArray->contextId, + new OpenGl_ResourceVBO (myPArray->bufferVBO[VBOEdges])); + if (myPArray->bufferVBO[VBOVertices] != 0) + aResCleaner->AddResource ((GLCONTEXT )myPArray->contextId, + new OpenGl_ResourceVBO (myPArray->bufferVBO[VBOVertices])); + if (myPArray->bufferVBO[VBOVcolours] != 0) + aResCleaner->AddResource ((GLCONTEXT )myPArray->contextId, + new OpenGl_ResourceVBO (myPArray->bufferVBO[VBOVcolours])); + if (myPArray->bufferVBO[VBOVnormals] != 0) + aResCleaner->AddResource ((GLCONTEXT )myPArray->contextId, + new OpenGl_ResourceVBO (myPArray->bufferVBO[VBOVnormals])); + if (myPArray->bufferVBO[VBOVtexels] != 0) + aResCleaner->AddResource ((GLCONTEXT )myPArray->contextId, + new OpenGl_ResourceVBO (myPArray->bufferVBO[VBOVtexels])); + } +} + +// ======================================================================= +// function : Render +// purpose : +// ======================================================================= +void OpenGl_PrimitiveArray::Render (const Handle(OpenGl_Workspace)& theWorkspace) const +{ + if (myPArray == NULL || myDrawMode == GL_NONE) + return; + + // create VBOs on first render call + if (myPArray->VBOEnabled == -1) // special value for uninitialized state + { + myPArray->VBOEnabled = OpenGl_GraphicDriver::ToUseVBO() && (theWorkspace->GetGlContext()->arbVBO != NULL); + if (myPArray->VBOEnabled != 0) + BuildVBO (theWorkspace); + } + + switch (myPArray->type) + { + case TelPointsArrayType: + case TelPolylinesArrayType: + case TelSegmentsArrayType: + { + glDisable (GL_LIGHTING); + + if ((theWorkspace->NamedStatus & OPENGL_NS_ANIMATION) != 0 && + (theWorkspace->NamedStatus & OPENGL_NS_WIREFRAME) == 0 && + theWorkspace->DegenerateModel) + { + glDisable (GL_DEPTH_TEST); + if (theWorkspace->NamedStatus & OPENGL_NS_TEXTURE) + DisableTexture(); + theWorkspace->NamedStatus |= OPENGL_NS_WIREFRAME; + } + break; + } + case TelPolygonsArrayType: + case TelTrianglesArrayType: + case TelQuadranglesArrayType: + case TelTriangleStripsArrayType: + case TelTriangleFansArrayType: + case TelQuadrangleStripsArrayType: + { + if ((theWorkspace->NamedStatus & OPENGL_NS_ANIMATION) != 0 && + (theWorkspace->NamedStatus & OPENGL_NS_WIREFRAME) != 0 && + theWorkspace->DegenerateModel < 2) + { + if (theWorkspace->NamedStatus & OPENGL_NS_TEXTURE) + EnableTexture(); + glEnable (GL_DEPTH_TEST); + theWorkspace->NamedStatus &= ~OPENGL_NS_WIREFRAME; + } + break; + } + default: + break; + } + + const OpenGl_AspectFace* anAspectFace = theWorkspace->AspectFace (Standard_True); + const OpenGl_AspectLine* anAspectLine = theWorkspace->AspectLine (Standard_True); + + Tint aFrontLightingModel = anAspectFace->Context().IntFront.color_mask; + const TEL_COLOUR* anInteriorColor = &anAspectFace->Context().IntFront.matcol; + const TEL_COLOUR* anEdgeColor = &anAspectFace->AspectEdge()->Color(); + const TEL_COLOUR* aLineColor = &anAspectLine->Color(); + + // Use highlight colors + if (theWorkspace->NamedStatus & OPENGL_NS_HIGHLIGHT) + { + anEdgeColor = anInteriorColor = aLineColor = theWorkspace->HighlightColor; + aFrontLightingModel = 0; + } + + DrawArray (aFrontLightingModel, + anAspectFace->Context().InteriorStyle, + anAspectFace->Context().Edge, + anInteriorColor, + aLineColor, + anEdgeColor, + &anAspectFace->Context().IntFront, + theWorkspace); + + switch (myPArray->type) + { + case TelPointsArrayType: + case TelPolylinesArrayType: + case TelSegmentsArrayType: + { + if (theWorkspace->NamedStatus & OPENGL_NS_TEXTURE) + EnableTexture(); + } + } +} diff --git a/src/OpenGl/OpenGl_PrimitiveArray.hxx b/src/OpenGl/OpenGl_PrimitiveArray.hxx new file mode 100644 index 0000000000..2fb036f925 --- /dev/null +++ b/src/OpenGl/OpenGl_PrimitiveArray.hxx @@ -0,0 +1,86 @@ +// File: OpenGl_PrimitiveArray.hxx +// Created: 13 July 2011 +// Author: Sergey ZERCHANINOV +// Copyright: OPEN CASCADE 2011 + +#ifndef OpenGl_PrimitiveArray_Header +#define OpenGl_PrimitiveArray_Header + +#include + +#include +#include + +#include + +struct OPENGL_SURF_PROP; + +class OpenGl_PrimitiveArray : public OpenGl_Element +{ +public: + + //! Default constructor + OpenGl_PrimitiveArray (CALL_DEF_PARRAY* thePArray); + + //! Destructor + virtual ~OpenGl_PrimitiveArray(); + + //! Render primitives to the window + virtual void Render (const Handle(OpenGl_Workspace)& theWorkspace) const; + + CALL_DEF_PARRAY* PArray() const { return myPArray; } + +private: + + //! VBO initialization procedures + Standard_Boolean BuildVBO (const Handle(OpenGl_Workspace)& theWorkspace) const; + void clearMemoryOwn() const; + void clearMemoryGL (const Handle(OpenGl_Context)& theGlContext) const; + Standard_Boolean checkSizeForGraphicMemory (const Handle(OpenGl_Context)& theGlContext) const; + + //! Main procedure to draw array + void DrawArray (Tint theLightingModel, + const Aspect_InteriorStyle theInteriorStyle, + Tint theEdgeFlag, + const TEL_COLOUR* theInteriorColour, + const TEL_COLOUR* theLineColour, + const TEL_COLOUR* theEdgeColour, + const OPENGL_SURF_PROP* theFaceProp, + const Handle(OpenGl_Workspace)& theWorkspace) const; + + //! Auxiliary procedures + void DrawEdges (const TEL_COLOUR* theEdgeColour, + const Handle(OpenGl_Workspace)& theWorkspace) const; + + void DrawDegeneratesAsPoints (const TEL_COLOUR* theEdgeColour, + const float theSkipRatio) const; + void DrawDegeneratesAsLines (const TEL_COLOUR* theEdgeColour, + const Handle(OpenGl_Workspace)& theWorkspace) const; + void DrawDegeneratesAsBBoxs (const TEL_COLOUR* theEdgeColour) const; + + void DrawDegeneratesPointsAsPoints() const; + void DrawDegeneratesLinesAsPoints() const; + void DrawDegeneratesLinesAsLines (const float theSkipRatio) const; + void DrawDegeneratesTrianglesAsPoints() const; + void DrawDegeneratesTrianglesAsLines (const float theSkipRatio) const; + void DrawDegeneratesTrianglestripsAsPoints() const; + void DrawDegeneratesTrianglestripsAsLines (const float theSkipRatio) const; + void DrawDegeneratesQuadranglesAsPoints() const; + void DrawDegeneratesQuadranglesAsLines (const float theSkipRatio) const; + void DrawDegeneratesQuadranglestripsAsPoints() const; + void DrawDegeneratesQuadranglestripsAsLines (const float theSkipRatio) const; + void DrawDegeneratesPolygonsAsPoints() const; + void DrawDegeneratesPolygonsAsLines (const float theSkipRatio) const; + +protected: + + mutable CALL_DEF_PARRAY* myPArray; + GLenum myDrawMode; + +public: + + IMPLEMENT_MEMORY_OPERATORS + +}; + +#endif //OpenGl_PrimitiveArray_Header diff --git a/src/OpenGl/OpenGl_PrinterContext.cxx b/src/OpenGl/OpenGl_PrinterContext.cxx index 4e3d4b2a9c..1dea19d0b1 100644 --- a/src/OpenGl/OpenGl_PrinterContext.cxx +++ b/src/OpenGl/OpenGl_PrinterContext.cxx @@ -5,7 +5,7 @@ #include OpenGl_PrinterContext* OpenGl_PrinterContext::g_PrinterContext = NULL; -GLCONTEXT OpenGl_PrinterContext::g_ContextId = NULL; +GLCONTEXT OpenGl_PrinterContext::g_ContextId = NULL; //======================================================================= //function : OpenGl_PrinterContext diff --git a/src/OpenGl/OpenGl_PrinterContext.hxx b/src/OpenGl/OpenGl_PrinterContext.hxx index 2f117fd164..909122f3a3 100644 --- a/src/OpenGl/OpenGl_PrinterContext.hxx +++ b/src/OpenGl/OpenGl_PrinterContext.hxx @@ -15,6 +15,8 @@ #include #include +#include + class Standard_Transient; class Handle(Standard_Type); class Handle(MMgt_TShared); @@ -107,10 +109,18 @@ private: GLCONTEXT myCtx; // the printer context could be created only in method call_togl_print - friend Standard_Boolean call_togl_print (CALL_DEF_VIEW *, CALL_DEF_LAYER *, + /*friend Standard_Boolean call_togl_print (CALL_DEF_VIEW *, CALL_DEF_LAYER *, CALL_DEF_LAYER *, const Aspect_Drawable, const int, - const char*, const int, const float); + const char*, const int, const float);*/ + friend Standard_Boolean OpenGl_Workspace::Print (const Graphic3d_CView& ACView, + const Aspect_CLayer2d& ACUnderLayer, + const Aspect_CLayer2d& ACOverLayer, + const Aspect_Handle hPrintDC, + const Standard_Boolean showBackground, + const Standard_CString filename, + const Aspect_PrintAlgo printAlgorithm, + const Standard_Real theScaleFactor); }; #endif diff --git a/src/OpenGl/OpenGl_PriorityList.cxx b/src/OpenGl/OpenGl_PriorityList.cxx new file mode 100644 index 0000000000..7ef24401e4 --- /dev/null +++ b/src/OpenGl/OpenGl_PriorityList.cxx @@ -0,0 +1,57 @@ +// File: OpenGl_PriorityList.cxx +// Created: 2 November 2011 +// Author: Sergey ZERCHANINOV +// Copyright: OPEN CASCADE 2011 + +#include + +#include + +/*----------------------------------------------------------------------*/ + +void OpenGl_PriorityList::Add (const OpenGl_Structure *AStructure,const Standard_Integer APriority) +{ + Standard_Integer anIndex = APriority; + if (anIndex < 0) anIndex = 0; + else if (anIndex >= myArray.Length()) anIndex = myArray.Length()-1; + myArray(anIndex).Append(AStructure); + myNbStructures++; +} + +/*----------------------------------------------------------------------*/ + +void OpenGl_PriorityList::Remove (const OpenGl_Structure *AStructure) +{ + const Standard_Integer aNbPr = myArray.Length(); + Standard_Integer i = 0; + OpenGl_SequenceOfStructure::Iterator its; + for (; i < aNbPr; i++) + { + OpenGl_SequenceOfStructure &aSeq = myArray(i); + for (its.Init(aSeq); its.More(); its.Next()) + { + if (its.Value() == AStructure) + { + aSeq.Remove(its); + myNbStructures--; + return; + } + } + } +} + +/*----------------------------------------------------------------------*/ + +void OpenGl_PriorityList::Render (const Handle(OpenGl_Workspace) &AWorkspace) const +{ + const Standard_Integer aNbPr = myArray.Length(); + Standard_Integer i = 0; + OpenGl_SequenceOfStructure::Iterator its; + for (; i < aNbPr; i++) + { + for (its.Init(myArray(i)); its.More(); its.Next()) + its.Value()->Render(AWorkspace); + } +} + +/*----------------------------------------------------------------------*/ diff --git a/src/OpenGl/OpenGl_PriorityList.hxx b/src/OpenGl/OpenGl_PriorityList.hxx new file mode 100644 index 0000000000..294cb9a41d --- /dev/null +++ b/src/OpenGl/OpenGl_PriorityList.hxx @@ -0,0 +1,44 @@ +// File: OpenGl_PriorityList.hxx +// Created: 2 November 2011 +// Author: Sergey ZERCHANINOV +// Copyright: OPEN CASCADE 2011 + +#ifndef _OpenGl_PriorityList_Header +#define _OpenGl_PriorityList_Header + +#include +#include + +#include + +#include + +class OpenGl_Structure; + +typedef NCollection_Sequence OpenGl_SequenceOfStructure; +typedef NCollection_Array1 OpenGl_ArrayOfStructure; + +class OpenGl_PriorityList +{ + public: + + OpenGl_PriorityList (const Standard_Integer ANbPriorities = 11) : myArray(0,(ANbPriorities-1)), myNbStructures(0) {} + virtual ~OpenGl_PriorityList () {} + + void Add (const OpenGl_Structure *AStructure, const Standard_Integer APriority); + void Remove (const OpenGl_Structure *AStructure); + + Standard_Integer NbStructures () const { return myNbStructures; } + + void Render (const Handle(OpenGl_Workspace) &AWorkspace) const; + + protected: + + OpenGl_ArrayOfStructure myArray; + Standard_Integer myNbStructures; + + public: + IMPLEMENT_MEMORY_OPERATORS +}; + +#endif //_OpenGl_PriorityList_Header diff --git a/src/OpenGl/OpenGl_QuadrangleStrip.cxx b/src/OpenGl/OpenGl_QuadrangleStrip.cxx new file mode 100644 index 0000000000..6e7645145a --- /dev/null +++ b/src/OpenGl/OpenGl_QuadrangleStrip.cxx @@ -0,0 +1,773 @@ +// File: OpenGl_QuadrangleStrip.cxx +// Created: 13 July 2011 +// Author: Sergey ZERCHANINOV +// Copyright: OPEN CASCADE 2011 + +#include +#include + +#include + +#include +#include + +#include +#include + +/*----------------------------------------------------------------------*/ + +#define OPENGL_RAND() ( ( unsigned )( s_Rand = s_Rand * 214013L + 2531011L ) ) + +/*----------------------------------------------------------------------*/ + +extern void draw_degenerates_as_points ( PDS_INTERNAL, tel_point, Tint, const Handle(OpenGl_Workspace) & ); +extern void draw_degenerates_as_bboxs ( PDS_INTERNAL, tel_point, Tint, const Handle(OpenGl_Workspace) & ); +extern void set_drawable_items ( GLboolean*, int, const float ); + +/*----------------------------------------------------------------------*/ + +void OpenGl_QuadrangleStrip::draw_qstrip (const Tint front_lighting_model, + const Aspect_InteriorStyle interior_style, + const TEL_COLOUR *edge_colour, + const Handle(OpenGl_Workspace) &AWorkspace) const +{ + Tint i, m, newList = 0; + Tint nf, nv, nr, nc; + Tint lighting_model; + + tel_point pfn = myData.fnormals; + tel_colour pfc = myData.fcolours; + tel_point pv = myData.vertices; + tel_colour pvc = myData.vcolours; + tel_point pvn = myData.vnormals; + tel_texture_coord pvt = myData.vtexturecoord; + + if ( AWorkspace->NamedStatus & OPENGL_NS_HIGHLIGHT ) + { + pvc = 0; + pfc = 0; + } + + if ( AWorkspace->DegenerateModel < 2 && interior_style != Aspect_IS_EMPTY ) + { + if ( front_lighting_model ) + glEnable(GL_LIGHTING); + else + glDisable(GL_LIGHTING); + + lighting_model = front_lighting_model; + nr = myData.num_rows; + nc = myData.num_columns; + nf = nr * nc; + nv = ( nr + 1 ) * ( nc + 1 ); + if ( (AWorkspace->NamedStatus & OPENGL_NS_ANIMATION) == 0 ) + goto doDraw; /* Disable object display list out of animation */ + /* window's context and bitmap's one */ + if ( myDS->model != front_lighting_model || !myDS->list || myDS->model == -1 || + ( AWorkspace->DegenerateModel && myDS->skipRatio != AWorkspace->SkipRatio ) ) + { + myDS->skipRatio = AWorkspace->SkipRatio; + myDS->model = front_lighting_model; + myDS->degMode = AWorkspace->DegenerateModel; + + if ( AWorkspace->SkipRatio == 0.f ) { + + if ( !myDS->list ) myDS->list = glGenLists ( 1 ); + + glNewList ( myDS->list, GL_COMPILE_AND_EXECUTE ); + newList = 1; +doDraw: + if ( lighting_model ) + { + if ( pvt && (AWorkspace->NamedStatus & OPENGL_NS_FORBIDSETTEX) == 0 ) + { + for ( m = 0; m < nr; ++m ) + { + glBegin ( GL_QUAD_STRIP ); + glNormal3fv ( pvn[ m * ( nc + 1 ) ].xyz ); + glTexCoord2fv ( pvt[ m * ( nc + 1 ) ].xy ); + glVertex3fv ( pv[ m * ( nc + 1 ) ].xyz ); + glNormal3fv ( pvn[ ( m + 1 ) * ( nc + 1 ) ].xyz ); + glTexCoord2fv ( pvt[ ( m + 1 ) * ( nc + 1 ) ].xy ); + glVertex3fv ( pv[ ( m + 1 ) * ( nc + 1 ) ].xyz ); + for ( i = 1; i < nc + 1; ++i ) + { + glNormal3fv ( pvn[ i + m * ( nc + 1 ) ].xyz ); + glTexCoord2fv ( pvt[ i + m * ( nc + 1 ) ].xy ); + glVertex3fv ( pv[ i + m * ( nc + 1 ) ].xyz ); + glNormal3fv ( pvn[ i + ( m + 1 ) * ( nc + 1 ) ].xyz ); + glTexCoord2fv ( pvt[ i + ( m + 1 ) * ( nc + 1 ) ].xy ); + glVertex3fv ( pv[ i + ( m + 1 ) * ( nc + 1 ) ].xyz ); + } + glEnd (); + } + } + else + { + for ( m = 0; m < nr; ++m ) + { + glBegin ( GL_QUAD_STRIP ); + glNormal3fv ( pvn[ m * ( nc + 1 ) ].xyz ); + glVertex3fv ( pv[ m * ( nc + 1 ) ].xyz ); + glNormal3fv ( pvn[ ( m + 1 ) * ( nc + 1 ) ].xyz ); + glVertex3fv ( pv[ ( m + 1 ) * ( nc + 1 ) ].xyz ); + for ( i = 1; i < nc + 1; ++i ) + { + glNormal3fv ( pvn[ i + m * ( nc + 1 ) ].xyz ); + glVertex3fv ( pv[ i + m * ( nc + 1 ) ].xyz ); + glNormal3fv ( pvn[ i + ( m + 1 ) * ( nc + 1 ) ].xyz ); + glVertex3fv ( pv[ i + ( m + 1 ) * ( nc + 1 ) ].xyz ); + } + glEnd (); + } + } + } + else + { + if ( pvc ) + { + for ( m = 0; m < nr; ++m ) + { + glBegin ( GL_QUAD_STRIP ); + glColor3fv ( pvc[ m * ( nc + 1 ) ].rgb ); + glVertex3fv ( pv[ m * ( nc + 1 ) ].xyz ); + glColor3fv ( pvc[ ( m + 1 ) * ( nc + 1 ) ].rgb ); + glVertex3fv ( pv[ ( m + 1 ) * ( nc + 1 ) ].xyz ); + for ( i = 1; i < nc + 1; ++i ) + { + glColor3fv ( pvc[ i + m * ( nc + 1 ) ].rgb ); + glVertex3fv ( pv[ i + m * ( nc + 1 ) ].xyz ); + glColor3fv ( pvc[ i + ( m + 1 ) * ( nc + 1 ) ].rgb ); + glVertex3fv ( pv[ i + ( m + 1 ) * ( nc + 1 ) ].xyz ); + } + glEnd (); + } + } + else if ( pfc ) + { + glColor3fv ( pfc[ 0 ].rgb ); + for ( m = 0; m < nr; ++m ) + { + glBegin ( GL_QUAD_STRIP ); + glColor3fv ( pfc[ m * nc ].rgb ); + glVertex3fv ( pv[ m * ( nc + 1 ) ].xyz ); + glVertex3fv ( pv[ ( m + 1 ) * ( nc + 1 ) ].xyz ); + for ( i = 1; i < nc + 1; ++i ) + { + glVertex3fv ( pv[ i + m * ( nc + 1 ) ].xyz ); + glColor3fv ( pfc[ i - 1 + m * nc ].rgb ); + glVertex3fv ( pv[ i + ( m + 1 ) * ( nc + 1 ) ].xyz ); + } + glEnd (); + } + } + else + { + for ( m = 0; m < nr; ++m ) + { + glBegin ( GL_QUAD_STRIP ); + glVertex3fv ( pv[ m * ( nc + 1 ) ].xyz ); + glVertex3fv ( pv[ ( m + 1 ) * ( nc + 1 ) ].xyz ); + for ( i = 1; i < nc + 1; ++i ) + { + glVertex3fv( pv[ i + m * ( nc + 1 ) ].xyz ); + glVertex3fv( pv[ i + ( m + 1 ) * ( nc + 1 ) ].xyz ); + } + glEnd (); + } + } + } + } + else if ( AWorkspace->SkipRatio < 1.f ) + { + set_drawable_items ( myDS->bDraw, nr, AWorkspace->SkipRatio ); + + if ( !myDS->dlist ) myDS->dlist = glGenLists ( 1 ); + + glNewList ( myDS->dlist, GL_COMPILE_AND_EXECUTE ); + newList = 1; + + if ( lighting_model ) + { + if ( pvt && (AWorkspace->NamedStatus & OPENGL_NS_FORBIDSETTEX) == 0 ) + { + for ( m = 0; m < nr; ++m ) + { + if ( myDS->bDraw[ m ] ) + { + glBegin ( GL_QUADS ); + glNormal3fv ( pvn[ m * ( nc + 1 ) ].xyz ); + glTexCoord2fv ( pvt[ m * ( nc + 1 ) ].xy ); + glVertex3fv ( pv[ m * ( nc + 1 ) ].xyz ); + glNormal3fv ( pvn[ ( m + 1 ) * ( nc + 1 ) ].xyz ); + glTexCoord2fv ( pvt[ ( m + 1 ) * ( nc + 1 ) ].xy ); + glVertex3fv ( pv[ ( m + 1 ) * ( nc + 1 ) ].xyz ); + for ( i = 1; i < nc + 1; ++i ) + { + glNormal3fv ( pvn[ i + ( m + 1 ) * ( nc + 1 ) ].xyz ); + glTexCoord2fv ( pvt[ i + ( m + 1 ) * ( nc + 1 ) ].xy ); + glVertex3fv ( pv[ i + ( m + 1 ) * ( nc + 1 ) ].xyz ); + glNormal3fv ( pvn[ i + m * ( nc + 1 ) ].xyz ); + glTexCoord2fv ( pvt[ i + m * ( nc + 1 ) ].xy ); + glVertex3fv ( pv[ i + m * ( nc + 1 ) ].xyz ); + } + glEnd (); + } + } + } + else + { + for ( m = 0; m < nr; ++m ) + { + if ( myDS->bDraw[ m ] ) + { + glBegin ( GL_QUADS ); + glNormal3fv ( pvn[ m * ( nc + 1 ) ].xyz ); + glVertex3fv ( pv[ m * ( nc + 1 ) ].xyz ); + glNormal3fv ( pvn[ ( m + 1 ) * ( nc + 1 ) ].xyz ); + glVertex3fv ( pv[ ( m + 1 ) * ( nc + 1 ) ].xyz ); + for ( i = 1; i < nc + 1; ++i ) + { + glNormal3fv ( pvn[ i + ( m + 1 ) * ( nc + 1 ) ].xyz ); + glVertex3fv ( pv[ i + ( m + 1 ) * ( nc + 1 ) ].xyz ); + glNormal3fv ( pvn[ i + m * ( nc + 1 ) ].xyz ); + glVertex3fv ( pv[ i + m * ( nc + 1 ) ].xyz ); + } + glEnd (); + } + } + } + } + else + { + if ( pvc ) + { + for ( m = 0; m < nr; ++m ) + { + if ( myDS->bDraw[ m ] ) + { + glBegin ( GL_QUAD_STRIP ); + glColor3fv ( pvc[ m * ( nc + 1 ) ].rgb ); + glVertex3fv ( pv[ m * ( nc + 1 ) ].xyz ); + glColor3fv ( pvc[ ( m + 1 ) * ( nc + 1 ) ].rgb ); + glVertex3fv ( pv[ ( m + 1 ) * ( nc + 1 ) ].xyz ); + for ( i = 1; i < nc + 1; ++i ) + { + glColor3fv ( pvc[ i + ( m + 1 ) * ( nc + 1 ) ].rgb ); + glVertex3fv ( pv[ i + ( m + 1 ) * ( nc + 1 ) ].xyz ); + glColor3fv ( pvc[ i + m * ( nc + 1 ) ].rgb ); + glVertex3fv ( pv[ i + m * ( nc + 1 ) ].xyz ); + } + glEnd (); + } + } + } + else if ( pfc ) + { + glColor3fv ( pfc[ 0 ].rgb ); + for ( m = 0; m < nr; ++m ) + { + if ( myDS->bDraw[ m ] ) + { + glBegin ( GL_QUADS ); + glColor3fv ( pfc[ m * nc ].rgb ); + glVertex3fv ( pv[ m * ( nc + 1 ) ].xyz ); + glVertex3fv ( pv[ ( m + 1 ) * ( nc + 1 ) ].xyz ); + for ( i = 1; i < nc + 1; ++i ) + { + glColor3fv ( pfc[ i - 1 + m * nc ].rgb ); + glVertex3fv ( pv[ i + ( m + 1 ) * ( nc + 1 ) ].xyz ); + glVertex3fv ( pv[ i + m * ( nc + 1 ) ].xyz ); + } + glEnd (); + } + } + } + else + { + for ( m = 0; m < nr; ++m ) + { + if ( myDS->bDraw[ m ] ) + { + glBegin ( GL_QUADS ); + glVertex3fv ( pv[ m * ( nc + 1 ) ].xyz ); + glVertex3fv ( pv[ ( m + 1 ) * ( nc + 1 ) ].xyz ); + for ( i = 1; i < nc + 1; ++i ) + { + glVertex3fv( pv[ i + ( m + 1 ) * ( nc + 1 ) ].xyz ); + glVertex3fv( pv[ i + m * ( nc + 1 ) ].xyz ); + } + glEnd (); + } + } + } + } + } + else + { + if ( !myDS->dlist ) myDS->dlist = glGenLists ( 1 ); + + glNewList ( myDS->dlist, GL_COMPILE_AND_EXECUTE ); + newList = 1; + + } /* end else */ + if ( newList ) glEndList (); + + if ( AWorkspace->DegenerateModel ) return; + + } else { + + glCallList ( AWorkspace->SkipRatio <= 0.f ? myDS->list : myDS->dlist ); + + if ( AWorkspace->DegenerateModel ) return; + + } /* end else */ + } + + i = 0; + + /* OCC11904 -- Temporarily disable environment mapping */ + glPushAttrib(GL_ENABLE_BIT); + glDisable(GL_TEXTURE_1D); + glDisable(GL_TEXTURE_2D); + + switch ( AWorkspace->DegenerateModel ) + { + default: + break; + + case 2: /* XXX_TDM_WIREFRAME */ + i = 1; + break; + + case 3: /* XXX_TDM_MARKER */ + draw_degenerates_as_points ( myDS, myData.vertices, ( myData.num_rows + 1 ) * ( myData.num_columns + 1 ), AWorkspace ); + glPopAttrib(); + return; + + case 4: /* XXX_TDM_BBOX */ + draw_degenerates_as_bboxs ( myDS, myData.vertices, ( myData.num_rows + 1 ) * ( myData.num_columns + 1 ), AWorkspace ); + glPopAttrib(); + return; + } /* end switch */ + + draw_edges ( edge_colour, interior_style, i, AWorkspace ); + + glPopAttrib(); +} + +/*----------------------------------------------------------------------*/ + +void OpenGl_QuadrangleStrip::draw_edges (const TEL_COLOUR *edge_colour, const Aspect_InteriorStyle interior_style, + Tint forceDraw, const Handle(OpenGl_Workspace) &AWorkspace) const +{ + const OpenGl_AspectFace *aspect_face = AWorkspace->AspectFace( Standard_True ); + + if ( interior_style != Aspect_IS_HIDDENLINE && !forceDraw && aspect_face->Context().Edge == TOff ) + return; + + glDisable(GL_LIGHTING); + const GLboolean texture_on = IsTextureEnabled(); + if ( texture_on ) DisableTexture(); + + // Setup line aspect + const OpenGl_AspectLine *aspect_line_old = AWorkspace->SetAspectLine( aspect_face->AspectEdge() ); + AWorkspace->AspectLine( Standard_True ); + + tel_point pv = myData.vertices; + Tint nc = myData.num_columns; + Tint nf = myData.num_rows * myData.num_columns; + + Tint newList = 0; + + if ( !forceDraw ) + draw_line_strip ( edge_colour, nf, nc ); + else + { + if ( (AWorkspace->NamedStatus & OPENGL_NS_ANIMATION) == 0 ) + goto doDraw; /* Disable object display list out of animation */ + if ( myDS->degMode != 2 || myDS->skipRatio != AWorkspace->SkipRatio || !myDS->dlist ) { + + if ( !myDS->dlist ) myDS->dlist = glGenLists ( 1 ); + + myDS->degMode = 2; + myDS->skipRatio = AWorkspace->SkipRatio; + glNewList ( myDS->dlist, GL_COMPILE_AND_EXECUTE ); + newList = 1; +doDraw: + glPushAttrib ( GL_DEPTH_BUFFER_BIT ); + glDisable ( GL_DEPTH_TEST ); + + if ( AWorkspace->SkipRatio <= 0.f ) + + draw_line_strip ( edge_colour, nf, nc ); + + else if ( AWorkspace->SkipRatio < 1.f ) { + + int i, m1, m2, n1, n2, n3, n4; + + set_drawable_items ( myDS->bDraw, nf, AWorkspace->SkipRatio ); + + glColor3fv ( edge_colour -> rgb ); + + for ( i = 0; i < nf; ++i ) + + if ( myDS->bDraw[ i ] ) { + + glBegin ( GL_LINE_STRIP ); + m1 = i / nc; + m2 = i % nc; + n1 = m1 * ( nc + 1 ) + m2; + n2 = n1 + nc + 1; + n3 = n2 + 1; + n4 = n1 + 1; + + glVertex3fv ( myData.vertices[ n1 ].xyz ); + glVertex3fv ( myData.vertices[ n2 ].xyz ); + glVertex3fv ( myData.vertices[ n3 ].xyz ); + glVertex3fv ( myData.vertices[ n4 ].xyz ); + glVertex3fv ( myData.vertices[ n1 ].xyz ); + glEnd(); + + } /* end if */ + + } /* end if */ + + glPopAttrib (); + if ( newList ) glEndList (); + + } else glCallList ( myDS->dlist ); + + } /* end else */ + + // Restore line context + AWorkspace->SetAspectLine( aspect_line_old ); + + if ( texture_on ) EnableTexture (); +} + +void OpenGl_QuadrangleStrip::draw_line_strip (const TEL_COLOUR *c, Tint nf, Tint nc) const +{ + int i, m1, m2, n1, n2, n3, n4; + + glColor3fv ( c->rgb ); + + for ( i = 0; i < nf; ++i ) + { + glBegin ( GL_LINE_STRIP ); + m1 = i / nc; + m2 = i % nc; + n1 = m1 * ( nc + 1 ) + m2; + n2 = n1 + nc + 1; + n3 = n2 + 1; + n4 = n1 + 1; + + glVertex3fv ( myData.vertices[ n1 ].xyz ); + glVertex3fv ( myData.vertices[ n2 ].xyz ); + glVertex3fv ( myData.vertices[ n3 ].xyz ); + glVertex3fv ( myData.vertices[ n4 ].xyz ); + glVertex3fv ( myData.vertices[ n1 ].xyz ); + glEnd(); + } +} + +/*----------------------------------------------------------------------*/ + +OpenGl_QuadrangleStrip::OpenGl_QuadrangleStrip (const Graphic3d_Array2OfVertex& AListVertex) +{ + const Standard_Integer nbr = AListVertex.RowLength (); + const Standard_Integer nbc = AListVertex.ColLength (); + const Standard_Integer nbf = nbr*nbc; + + // Dynamic allocation + TEL_POINT *points = new TEL_POINT[nbf]; + + const Standard_Integer LowerRow = AListVertex.LowerRow (); + const Standard_Integer UpperRow = AListVertex.UpperRow (); + const Standard_Integer LowerCol = AListVertex.LowerCol (); + const Standard_Integer UpperCol = AListVertex.UpperCol (); + + Standard_Integer i, j, k = 0; + Standard_Real X, Y, Z; + for (i=LowerRow; i<=UpperRow; i++) + for (j=LowerCol; j<=UpperCol; j++) + { + AListVertex (i, j).Coord (X, Y, Z); + points[k].xyz[0] = float (X); + points[k].xyz[1] = float (Y); + points[k].xyz[2] = float (Z); + k++; + } + + Init(nbr,nbc,points,NULL,NULL,NULL,NULL,NULL,TEL_SHAPE_UNKNOWN); +} + +/*----------------------------------------------------------------------*/ + +OpenGl_QuadrangleStrip::OpenGl_QuadrangleStrip (const Graphic3d_Array2OfVertexN& AListVertex) +{ + const Standard_Integer nbr = AListVertex.RowLength (); + const Standard_Integer nbc = AListVertex.ColLength (); + const Standard_Integer nbf = nbr*nbc; + + // Dynamic allocation + TEL_POINT *points = new TEL_POINT[nbf]; + TEL_POINT *normals = new TEL_POINT[nbf]; + + const Standard_Integer LowerRow = AListVertex.LowerRow (); + const Standard_Integer UpperRow = AListVertex.UpperRow (); + const Standard_Integer LowerCol = AListVertex.LowerCol (); + const Standard_Integer UpperCol = AListVertex.UpperCol (); + + Standard_Integer i, j, k = 0; + Standard_Real X, Y, Z; + for (i=LowerRow; i<=UpperRow; i++) + for (j=LowerCol; j<=UpperCol; j++) + { + AListVertex (i, j).Coord (X, Y, Z); + points[k].xyz[0] = float (X); + points[k].xyz[1] = float (Y); + points[k].xyz[2] = float (Z); + AListVertex (i, j).Normal (X, Y, Z); + normals[k].xyz[0] = float (X); + normals[k].xyz[1] = float (Y); + normals[k].xyz[2] = float (Z); + k++; + } + + Init(nbr,nbc,points,normals,NULL,NULL,NULL,NULL,TEL_SHAPE_UNKNOWN); +} + +/*----------------------------------------------------------------------*/ + +OpenGl_QuadrangleStrip::OpenGl_QuadrangleStrip (const Graphic3d_Array2OfVertexNT& AListVertex) +{ + const Standard_Integer nbr = AListVertex.RowLength (); + const Standard_Integer nbc = AListVertex.ColLength (); + const Standard_Integer nbf = nbr*nbc; + + // Dynamic allocation + TEL_POINT *points = new TEL_POINT[nbf]; + TEL_POINT *normals = new TEL_POINT[nbf]; + TEL_TEXTURE_COORD *tcoords = new TEL_TEXTURE_COORD[nbf]; + + const Standard_Integer LowerRow = AListVertex.LowerRow (); + const Standard_Integer UpperRow = AListVertex.UpperRow (); + const Standard_Integer LowerCol = AListVertex.LowerCol (); + const Standard_Integer UpperCol = AListVertex.UpperCol (); + + Standard_Integer i, j, k = 0; + Standard_Real X, Y, Z; + for (i=LowerRow; i<=UpperRow; i++) + for (j=LowerCol; j<=UpperCol; j++) + { + AListVertex (i, j).Coord (X, Y, Z); + points[k].xyz[0] = float (X); + points[k].xyz[1] = float (Y); + points[k].xyz[2] = float (Z); + AListVertex (i, j).Normal (X, Y, Z); + normals[k].xyz[0] = float (X); + normals[k].xyz[1] = float (Y); + normals[k].xyz[2] = float (Z); + AListVertex (i, j).TextureCoordinate(X, Y); + tcoords[k].xy[0] = float(X); + tcoords[k].xy[1] = float(Y); + k++; + } + + Init(nbr,nbc,points,normals,NULL,tcoords,NULL,NULL,TEL_SHAPE_UNKNOWN); +} + +/*----------------------------------------------------------------------*/ + +void OpenGl_QuadrangleStrip::Init (const Tint ANbRows, const Tint ANbCols, tel_point AVertices, + tel_point AVNormals, tel_colour AVColors, tel_texture_coord ATCoords, + tel_point AFNormals, tel_colour AFColors, const Tint AShapeFlag) +{ + myData.num_rows = ANbRows; + myData.num_columns = ANbCols; + + const Tint nf = ANbRows * ANbCols; + const Tint nv = ( ANbRows+1 ) * ( ANbCols+1 ); + + Tint i; + + // Store vertices + myData.vertices = AVertices; + + // Store or compute (based on vertices) facet normals + if (AFNormals) + { + myData.facet_flag = TEL_FA_NORMAL; + myData.fnormals = new TEL_POINT[nf]; + memcpy( myData.fnormals, AFNormals, nf*sizeof(TEL_POINT) ); + for( i = 0; i < nf; i++ ) + vecnrm( myData.fnormals[i].xyz ); + } + else + { + myData.facet_flag = TEL_FA_NONE; + myData.fnormals = new TEL_POINT[nf]; + for( i = 0; i < nf; i++ ) + { + const Tint r = i/ANbCols; + const Tint c = i%ANbCols; + const Tint id = r*(ANbCols+1) + c; + + TEL_POINT p1, p2, p3, p4; + + p1 = myData.vertices[id]; + p2 = myData.vertices[id+ANbCols+1]; + p3 = myData.vertices[id+ANbCols+2]; + p4 = myData.vertices[id+1]; + + p4.xyz[0] -= p2.xyz[0]; + p4.xyz[1] -= p2.xyz[1]; + p4.xyz[2] -= p2.xyz[2]; + + p4.xyz[0] += p1.xyz[0]; + p4.xyz[1] += p1.xyz[1]; + p4.xyz[2] += p1.xyz[2]; + + TelGetNormal( p4.xyz, p1.xyz, p3.xyz, myData.fnormals[i].xyz ); + } + } + + // Store or compute (based on facet normals) vertex normals + if (AVNormals) + { + myData.vertex_flag = TEL_VT_NORMAL; + myData.vnormals = AVNormals; + for( i = 0; i < nv; i++ ) + vecnrm( myData.vnormals[i].xyz ); + } + else + { + myData.vertex_flag = TEL_VT_NONE; + myData.vnormals = new TEL_POINT[nv]; + Tint r, c, id; + for( i = 0; i < nv; i++ ) + { + if( i == 0 ) + myData.vnormals[i] = myData.fnormals[i]; + else if( i == (nv-1) ) + myData.vnormals[i] = myData.fnormals[nf-1]; + else if( i == (nv-ANbCols-1) ) + myData.vnormals[i] = myData.fnormals[nf-ANbCols]; + else if( i == ANbCols ) + myData.vnormals[i] = myData.fnormals[i-1]; + else if( i%(ANbCols+1) == 0 ) + { + r = i/(myData.num_columns+1); + myData.vnormals[i].xyz[0] = ( myData.fnormals[(r-1)*ANbCols].xyz[0] + myData.fnormals[r*ANbCols].xyz[0] ) / 2.0F; + myData.vnormals[i].xyz[1] = ( myData.fnormals[(r-1)*ANbCols].xyz[1] + myData.fnormals[r*ANbCols].xyz[1] ) / 2.0F; + myData.vnormals[i].xyz[2] = ( myData.fnormals[(r-1)*ANbCols].xyz[2] + myData.fnormals[r*ANbCols].xyz[2] ) / 2.0F; + } + else if( i <= ANbCols ) + { + myData.vnormals[i].xyz[0] = ( myData.fnormals[i-1].xyz[0] + myData.fnormals[i].xyz[0] ) / 2.0F; + myData.vnormals[i].xyz[1] = ( myData.fnormals[i-1].xyz[1] + myData.fnormals[i].xyz[1] ) / 2.0F; + myData.vnormals[i].xyz[2] = ( myData.fnormals[i-1].xyz[2] + myData.fnormals[i].xyz[2] ) / 2.0F; + } + else if( i >= (nv-ANbCols-1 ) ) + { + c = i%(ANbCols+1); + id = nf-ANbCols+c; + + myData.vnormals[i].xyz[0] = ( myData.fnormals[id-1].xyz[0] + myData.fnormals[id].xyz[0] ) / 2.0F; + myData.vnormals[i].xyz[1] = ( myData.fnormals[id-1].xyz[1] + myData.fnormals[id].xyz[1] ) / 2.0F; + myData.vnormals[i].xyz[2] = ( myData.fnormals[id-1].xyz[2] + myData.fnormals[id].xyz[2] ) / 2.0F; + } + else if( (i+1)%(ANbCols+1) == 0 ) + { + r = (i+1)/(ANbCols+1); + myData.vnormals[i].xyz[0] = ( myData.fnormals[(r-1)*ANbCols-1].xyz[0] + myData.fnormals[r*ANbCols-1].xyz[0] ) / 2.0F; + myData.vnormals[i].xyz[1] = ( myData.fnormals[(r-1)*ANbCols-1].xyz[1] + myData.fnormals[r*ANbCols-1].xyz[1] ) / 2.0F; + myData.vnormals[i].xyz[2] = ( myData.fnormals[(r-1)*ANbCols-1].xyz[2] + myData.fnormals[r*ANbCols-1].xyz[2] ) / 2.0F; + } + else + { + r = i/(ANbCols+1); + c = i%(ANbCols+1); + + id = r*ANbCols+c; + + myData.vnormals[i].xyz[0] = ( myData.fnormals[id].xyz[0] + myData.fnormals[id-ANbCols].xyz[0] + myData.fnormals[id-1].xyz[0] + myData.fnormals[id-ANbCols-1].xyz[0] ) / 4.0F; + myData.vnormals[i].xyz[1] = ( myData.fnormals[id].xyz[1] + myData.fnormals[id-ANbCols].xyz[1] + myData.fnormals[id-1].xyz[1] + myData.fnormals[id-ANbCols-1].xyz[1] ) / 4.0F; + myData.vnormals[i].xyz[2] = ( myData.fnormals[id].xyz[2] + myData.fnormals[id-ANbCols].xyz[2] + myData.fnormals[id-1].xyz[2] + myData.fnormals[id-ANbCols-1].xyz[2] ) / 4.0F; + } + } + } + + myData.vcolours = AVColors; + myData.vtexturecoord = ATCoords; + myData.fcolours = AFColors; + + myData.shape_flag = AShapeFlag; + + myDS = new DS_INTERNAL; + myDS->list = 0; + myDS->dlist = 0; + myDS->degMode = 0; + myDS->model = -1; + myDS->skipRatio = 0.0F; + myDS->bDraw = new unsigned char[nv]; +} + +/*----------------------------------------------------------------------*/ + +OpenGl_QuadrangleStrip::~OpenGl_QuadrangleStrip () +{ + if( myData.fnormals ) + delete[] myData.fnormals; + if( myData.fcolours ) + delete[] myData.fcolours; + if( myData.vertices ) + delete[] myData.vertices; + if( myData.vcolours ) + delete[] myData.vcolours; + if( myData.vnormals ) + delete[] myData.vnormals; + if ( myData.vtexturecoord ) + delete[] myData.vtexturecoord; + + if ( myDS ) + { + if ( GET_GL_CONTEXT() != NULL ) + { + if ( myDS->list ) glDeleteLists ( myDS->list, 1 ); + if ( myDS->dlist ) glDeleteLists ( myDS->dlist, 1 ); + } + if ( myDS->bDraw ) + delete[] myDS->bDraw; + + delete myDS; + } +} + +/*----------------------------------------------------------------------*/ + +void OpenGl_QuadrangleStrip::Render (const Handle(OpenGl_Workspace) &AWorkspace) const +{ + const OpenGl_AspectFace *aspect_face = AWorkspace->AspectFace( Standard_True ); + + Tint front_lighting_model = aspect_face->Context().IntFront.color_mask; + const TEL_COLOUR *interior_colour = &aspect_face->Context().IntFront.matcol; + const TEL_COLOUR *edge_colour = &aspect_face->AspectEdge()->Color(); + + // Use highlight colors + if ( AWorkspace->NamedStatus & OPENGL_NS_HIGHLIGHT ) + { + edge_colour = interior_colour = AWorkspace->HighlightColor; + front_lighting_model = 0; + } + + glColor3fv( interior_colour->rgb ); + + draw_qstrip( front_lighting_model, + aspect_face->Context().InteriorStyle, + edge_colour, + AWorkspace ); +} + +/*----------------------------------------------------------------------*/ diff --git a/src/OpenGl/OpenGl_QuadrangleStrip.hxx b/src/OpenGl/OpenGl_QuadrangleStrip.hxx new file mode 100644 index 0000000000..9c7d5b8a74 --- /dev/null +++ b/src/OpenGl/OpenGl_QuadrangleStrip.hxx @@ -0,0 +1,66 @@ +// File: OpenGl_QuadrangleStrip.hxx +// Created: 13 July 2011 +// Author: Sergey ZERCHANINOV +// Copyright: OPEN CASCADE 2011 + +#ifndef OpenGl_QuadrangleStrip_Header +#define OpenGl_QuadrangleStrip_Header + +#include +#include +#include +#include +#include + +#include + +struct OPENGL_QSTRIP_DATA +{ + Tint shape_flag; /* TEL_SHAPE_UNKNOWN or TEL_SHAPE_COMPLEX or + TEL_SHAPE_CONVEX or TEL_SHAPE_CONCAVE */ + Tint facet_flag; /* TEL_FA_NONE or TEL_FA_NORMAL */ + Tint vertex_flag; /* TEL_VT_NONE or TEL_VT_NORMAL */ + Tint num_rows, num_columns; /* Number of rows and columns */ + tel_point fnormals; /* Facet normals */ + tel_colour fcolours; /* Facet colours */ + tel_point vertices; /* Vertices */ + tel_colour vcolours; /* Vertex colour values */ + tel_point vnormals; /* Vertex normals */ + tel_texture_coord vtexturecoord; /* Texture coordinates */ + IMPLEMENT_MEMORY_OPERATORS +}; + +class OpenGl_QuadrangleStrip : public OpenGl_Element +{ + public: + + OpenGl_QuadrangleStrip (const Graphic3d_Array2OfVertex& AListVertex); + OpenGl_QuadrangleStrip (const Graphic3d_Array2OfVertexN& AListVertex); + OpenGl_QuadrangleStrip (const Graphic3d_Array2OfVertexNT& AListVertex); + virtual ~OpenGl_QuadrangleStrip (); + + virtual void Render (const Handle(OpenGl_Workspace) &AWorkspace) const; + + protected: + + void Init (const Tint ANbRows, const Tint ANbCols, tel_point AVertices, + tel_point AVNormals, tel_colour AVColors, tel_texture_coord ATCoords, + tel_point AFNormals, tel_colour AFColors, const Tint AShapeFlag); + + void draw_qstrip (const Tint, /* front_lighting_model, */ + const Aspect_InteriorStyle, /* interior_style, */ + const TEL_COLOUR *, /* edge_colour, */ + const Handle(OpenGl_Workspace) &) const; + + void draw_edges (const TEL_COLOUR *, const Aspect_InteriorStyle, Tint, const Handle(OpenGl_Workspace) &) const; + + void draw_line_strip (const TEL_COLOUR *, Tint, Tint) const; + + OPENGL_QSTRIP_DATA myData; + DS_INTERNAL *myDS; + + public: + IMPLEMENT_MEMORY_OPERATORS +}; + +#endif //OpenGl_QuadrangleStrip_Header diff --git a/src/OpenGl/OpenGl_Resource.hxx b/src/OpenGl/OpenGl_Resource.hxx index 9bb9a44b59..0cf314e42f 100755 --- a/src/OpenGl/OpenGl_Resource.hxx +++ b/src/OpenGl/OpenGl_Resource.hxx @@ -14,6 +14,7 @@ class Standard_Transient; class Handle(Standard_Type); class Handle(MMgt_TShared); +class Handle(OpenGl_Context); class OpenGl_ResourceCleaner; //! Class represents basic OpenGl memory resource, which @@ -34,14 +35,14 @@ public: OpenGl_Resource(const OpenGl_Resource& theBase) : myId(theBase.myId) { } //! Copy operation - OpenGl_Resource& operator = (const OpenGl_Resource& theBase) + OpenGl_Resource& operator= (const OpenGl_Resource& theBase) { this->myId = theBase.myId; return *this; } //! Destructor - virtual ~OpenGl_Resource() { } + virtual ~OpenGl_Resource() {} //! method clean() is accessible only by OpenGl_ResourceCleaner friend class OpenGl_ResourceCleaner; @@ -50,7 +51,7 @@ protected: //! Clean procedure, should be called only by OpenGl_ResourceCleaner; //! Each type of resource has its own cleaning procedure - virtual void Clean() = 0; + virtual void Clean (const Handle(OpenGl_Context)& theGlContext) = 0; protected: diff --git a/src/OpenGl/OpenGl_ResourceCleaner.cxx b/src/OpenGl/OpenGl_ResourceCleaner.cxx index d1a3c3c527..543f5b500b 100755 --- a/src/OpenGl/OpenGl_ResourceCleaner.cxx +++ b/src/OpenGl/OpenGl_ResourceCleaner.cxx @@ -130,31 +130,31 @@ void OpenGl_ResourceCleaner::ClearShared() //purpose : Clear the unused resources for active OpenGl context //======================================================================= -void OpenGl_ResourceCleaner::Cleanup() +void OpenGl_ResourceCleaner::Cleanup (const Handle(OpenGl_Context)& theGlContext) { GLCONTEXT aContext = GET_GL_CONTEXT(); + if (aContext == NULL) + return; - // if we have active context, we can delete the resources - if (aContext != NULL) - // if the context is found in shared list - if (mySharedContexts.Contains(aContext)) + // if the context is found in shared list + if (mySharedContexts.Contains (aContext)) + { + while (mySharedQueue.Size() > 0) { - while(mySharedQueue.Size() > 0) - { - mySharedQueue.Front()->Clean(); // delete resource memory - mySharedQueue.Pop(); - } + mySharedQueue.Front()->Clean (theGlContext); // delete resource memory + mySharedQueue.Pop(); } - // if the context is found in non-shared list - else if (myInstanceQueue.IsBound(aContext)) + } + // if the context is found in non-shared list + else if (myInstanceQueue.IsBound (aContext)) + { + QueueOfResources* aQueue = &myInstanceQueue.ChangeFind (aContext); + while (aQueue->Size() > 0) { - QueueOfResources * aQueue = &myInstanceQueue.ChangeFind(aContext); - while(aQueue->Size() > 0) - { - aQueue->Front()->Clean(); // delete resource memory - aQueue->Pop(); - } + aQueue->Front()->Clean (theGlContext); // delete resource memory + aQueue->Pop(); } + } } //======================================================================= diff --git a/src/OpenGl/OpenGl_ResourceCleaner.hxx b/src/OpenGl/OpenGl_ResourceCleaner.hxx index a6ae69871b..23837cf468 100755 --- a/src/OpenGl/OpenGl_ResourceCleaner.hxx +++ b/src/OpenGl/OpenGl_ResourceCleaner.hxx @@ -13,7 +13,8 @@ #include class OpenGl_Resource; -class Handle_OpenGl_Resource; +class Handle(OpenGl_Resource); +class Handle(OpenGl_Context); typedef NCollection_Queue QueueOfResources; typedef NCollection_DataMap DataMapOfContextsResources; @@ -56,7 +57,7 @@ public: //! You should add the cleaner resources by AddResources method; //! It is suggested to call this method right before the OpenGl //! new frame drawing procedure starts. - void Cleanup(); + void Cleanup (const Handle(OpenGl_Context)& theGlContext); //! Remove the OpenGl context from the OpenGl_ResourceCleaner control list. void RemoveContext(GLCONTEXT theContext); diff --git a/src/OpenGl/OpenGl_ResourceTexture.cxx b/src/OpenGl/OpenGl_ResourceTexture.cxx index 9b5d27b95a..8a7e36efce 100755 --- a/src/OpenGl/OpenGl_ResourceTexture.cxx +++ b/src/OpenGl/OpenGl_ResourceTexture.cxx @@ -4,42 +4,32 @@ #include #include -#include - -#ifdef __sgi -#define glGenTextures glGenTexturesEXT -#define glDeleteTextures glDeleteTexturesEXT -#define glBindTexture glBindTextureEXT -#endif /* IRIX */ //======================================================================= //function : OpenGl_ResourceTexture //purpose : Constructor //======================================================================= - -OpenGl_ResourceTexture::OpenGl_ResourceTexture(GLuint theId) -: OpenGl_Resource(theId) +OpenGl_ResourceTexture::OpenGl_ResourceTexture (GLuint theId) +: OpenGl_Resource (theId) { - + // } //======================================================================= //function : OpenGl_ResourceTexture //purpose : Copy constructor //======================================================================= - -OpenGl_ResourceTexture::OpenGl_ResourceTexture(const OpenGl_ResourceTexture& theResource) -: OpenGl_Resource(theResource) +OpenGl_ResourceTexture::OpenGl_ResourceTexture (const OpenGl_ResourceTexture& theResource) +: OpenGl_Resource (theResource) { - + // } //======================================================================= //function : Clean //purpose : free OpenGl memory allocated for texture resource //======================================================================= - -void OpenGl_ResourceTexture::Clean() +void OpenGl_ResourceTexture::Clean (const Handle(OpenGl_Context)& theGlContext) { - glDeleteTextures(1, &myId); + glDeleteTextures (1, &myId); } diff --git a/src/OpenGl/OpenGl_ResourceTexture.hxx b/src/OpenGl/OpenGl_ResourceTexture.hxx index 1ab4d51def..0b3ea346ff 100755 --- a/src/OpenGl/OpenGl_ResourceTexture.hxx +++ b/src/OpenGl/OpenGl_ResourceTexture.hxx @@ -30,7 +30,7 @@ protected: //! Clean procedure for texture resource; //! Should be called by the OpenGl_ResourceCleaner - void Clean(); + virtual void Clean (const Handle(OpenGl_Context)& theGlContext); }; diff --git a/src/OpenGl/OpenGl_ResourceVBO.cxx b/src/OpenGl/OpenGl_ResourceVBO.cxx index 7201fe1f59..37ac6a49a9 100755 --- a/src/OpenGl/OpenGl_ResourceVBO.cxx +++ b/src/OpenGl/OpenGl_ResourceVBO.cxx @@ -3,43 +3,38 @@ // Author: Anton POLETAEV #include -#include -#include - -typedef void (APIENTRY* PFNGLDELETEBUFFERSARBPROC) (GLsizei n, const GLuint *buffers); - -extern PFNGLDELETEBUFFERSARBPROC glVBODeleteBuffersARB; -extern int VBOExtension; +#include //======================================================================= //function : OpenGl_ResourceVBO //purpose : Constructor //======================================================================= - -OpenGl_ResourceVBO::OpenGl_ResourceVBO(GLuint theId) -: OpenGl_Resource(theId) +OpenGl_ResourceVBO::OpenGl_ResourceVBO (GLuint theId) +: OpenGl_Resource (theId) { - + // } //======================================================================= //function : OpenGl_ResourceVBO //purpose : Copy constructor //======================================================================= - -OpenGl_ResourceVBO::OpenGl_ResourceVBO( const OpenGl_ResourceVBO& theResource) -: OpenGl_Resource(theResource) +OpenGl_ResourceVBO::OpenGl_ResourceVBO (const OpenGl_ResourceVBO& theResource) +: OpenGl_Resource (theResource) { - + // } //======================================================================= //function : Clean //purpose : free OpenGl memory allocated for vbo resource //======================================================================= - -void OpenGl_ResourceVBO::Clean() +void OpenGl_ResourceVBO::Clean (const Handle(OpenGl_Context)& theGlContext) { - if (VBOExtension) - glVBODeleteBuffersARB( 1 , &myId ); + if (theGlContext->arbVBO == NULL) + { + std::cerr << "OpenGl_ResourceVBO::Clean(), active GL context doesn't support VBO!\n"; + return; + } + theGlContext->arbVBO->glDeleteBuffersARB (1 , &myId); } diff --git a/src/OpenGl/OpenGl_ResourceVBO.hxx b/src/OpenGl/OpenGl_ResourceVBO.hxx index 6f212ccb1b..5004d601c7 100755 --- a/src/OpenGl/OpenGl_ResourceVBO.hxx +++ b/src/OpenGl/OpenGl_ResourceVBO.hxx @@ -30,7 +30,7 @@ protected: //! Clean procedure for VBO resource; //! Should be called by the OpenGl_ResourceCleaner - void Clean(); + virtual void Clean (const Handle(OpenGl_Context)& theGlContext); }; diff --git a/src/OpenGl/OpenGl_Structure.cxx b/src/OpenGl/OpenGl_Structure.cxx new file mode 100644 index 0000000000..1421082d10 --- /dev/null +++ b/src/OpenGl/OpenGl_Structure.cxx @@ -0,0 +1,448 @@ +// File: OpenGl_Structure.cxx +// Created: 1 August 2011 +// Author: Sergey ZERCHANINOV +// Copyright: OPEN CASCADE 2011 + +#include + +#include +#include +#include + +#include +#include + + +/*----------------------------------------------------------------------*/ + +static void call_util_transpose_mat (float tmat[16], float mat[4][4]) +{ + int i, j; + + for (i=0; i<4; i++) + for (j=0; j<4; j++) + tmat[j*4+i] = mat[i][j]; +} + +/*----------------------------------------------------------------------*/ + +OpenGl_Structure::OpenGl_Structure () +: myTransformation(NULL), + myTransPers(NULL), + myDegenerateModel(NULL), + myAspectLine(NULL), + myAspectFace(NULL), + myAspectMarker(NULL), + myAspectText(NULL), + myHighlightBox(NULL), + myHighlightColor(NULL), + myNamedStatus(0) +{ +} + +/*----------------------------------------------------------------------*/ + +OpenGl_Structure::~OpenGl_Structure () +{ + if (myTransformation) + { + delete myTransformation; + myTransformation = NULL; + } + if (myTransPers) + { + delete myTransPers; + myTransPers = NULL; + } + if (myDegenerateModel) + { + delete myDegenerateModel; + myDegenerateModel = NULL; + } + if (myAspectLine) + { + delete myAspectLine; + myAspectLine = NULL; + } + if (myAspectFace) + { + delete myAspectFace; + myAspectFace = NULL; + } + if (myAspectMarker) + { + delete myAspectMarker; + myAspectMarker = NULL; + } + if (myAspectText) + { + delete myAspectText; + myAspectText = NULL; + } + ClearHighlightColor(); + // Delete groups + Clear(); +} + +/*----------------------------------------------------------------------*/ + +void OpenGl_Structure::SetTransformation(const float *AMatrix) +{ + if (!myTransformation) + myTransformation = new OpenGl_Matrix; + + matcpy( myTransformation->mat, AMatrix ); +} + +/*----------------------------------------------------------------------*/ + +void OpenGl_Structure::SetTransformPersistence(const CALL_DEF_TRANSFORM_PERSISTENCE &ATransPers) +{ + if (!myTransPers) + myTransPers = new TEL_TRANSFORM_PERSISTENCE; + + myTransPers->mode = ATransPers.Flag; + myTransPers->pointX = ATransPers.Point.x; + myTransPers->pointY = ATransPers.Point.y; + myTransPers->pointZ = ATransPers.Point.z; +} + +/*----------------------------------------------------------------------*/ + +void OpenGl_Structure::SetDegenerateModel (const Standard_Integer AMode, const float ASkipRatio) +{ + if (!myDegenerateModel) + myDegenerateModel = new DEGENERATION; + + myDegenerateModel->mode = AMode; + myDegenerateModel->skipRatio = ASkipRatio; +} + +/*----------------------------------------------------------------------*/ + +void OpenGl_Structure::SetAspectLine (const CALL_DEF_CONTEXTLINE &AContext) +{ + if (!myAspectLine) + myAspectLine = new OpenGl_AspectLine; + myAspectLine->SetContext( AContext ); +} + +/*----------------------------------------------------------------------*/ + +void OpenGl_Structure::SetAspectFace (const CALL_DEF_CONTEXTFILLAREA &AContext) +{ + if (!myAspectFace) + myAspectFace = new OpenGl_AspectFace; + myAspectFace->SetContext( AContext ); +} + +/*----------------------------------------------------------------------*/ + +void OpenGl_Structure::SetAspectMarker (const CALL_DEF_CONTEXTMARKER &AContext) +{ + if (!myAspectMarker) + myAspectMarker = new OpenGl_AspectMarker; + myAspectMarker->SetContext( AContext ); +} + +/*----------------------------------------------------------------------*/ + +void OpenGl_Structure::SetAspectText (const CALL_DEF_CONTEXTTEXT &AContext) +{ + if (!myAspectText) + myAspectText = new OpenGl_AspectText; + myAspectText->SetContext( AContext ); +} + +/*----------------------------------------------------------------------*/ + +void OpenGl_Structure::SetHighlightBox (const CALL_DEF_BOUNDBOX &ABoundBox) +{ + if (!myHighlightBox) + myHighlightBox = new OpenGl_Group; + else + myHighlightBox->Clear(); + + CALL_DEF_CONTEXTLINE context_line; + context_line.Color = ABoundBox.Color; + context_line.LineType = Aspect_TOL_SOLID; + context_line.Width = 1.0f; + myHighlightBox->SetAspectLine( context_line ); + +#define CALL_MAX_BOUNDBOXSIZE 16 + + Graphic3d_Array1OfVertex points(1,CALL_MAX_BOUNDBOXSIZE); + const float Xm = ABoundBox.Pmin.x; + const float Ym = ABoundBox.Pmin.y; + const float Zm = ABoundBox.Pmin.z; + const float XM = ABoundBox.Pmax.x; + const float YM = ABoundBox.Pmax.y; + const float ZM = ABoundBox.Pmax.z; + points( 1).SetCoord(Xm,Ym,Zm); + points( 2).SetCoord(Xm,Ym,ZM); + points( 3).SetCoord(Xm,YM,ZM); + points( 4).SetCoord(Xm,YM,Zm); + points( 5).SetCoord(Xm,Ym,Zm); + points( 6).SetCoord(XM,Ym,Zm); + points( 7).SetCoord(XM,Ym,ZM); + points( 8).SetCoord(XM,YM,ZM); + points( 9).SetCoord(XM,YM,Zm); + points(10).SetCoord(XM,Ym,Zm); + points(11).SetCoord(XM,YM,Zm); + points(12).SetCoord(Xm,YM,Zm); + points(13).SetCoord(Xm,YM,ZM); + points(14).SetCoord(XM,YM,ZM); + points(15).SetCoord(XM,Ym,ZM); + points(16).SetCoord(Xm,Ym,ZM); + + OpenGl_Polyline *apolyline = new OpenGl_Polyline(points); + myHighlightBox->AddElement( TelPolyline, apolyline ); +} + +/*----------------------------------------------------------------------*/ + +void OpenGl_Structure::ClearHighlightBox () +{ + if (myHighlightBox) + { + delete myHighlightBox; + myHighlightBox = NULL; + } +} + +/*----------------------------------------------------------------------*/ + +void OpenGl_Structure::SetHighlightColor (const Standard_ShortReal R, const Standard_ShortReal G, const Standard_ShortReal B) +{ + ClearHighlightBox(); + if (!myHighlightColor) + myHighlightColor = new TEL_COLOUR; + + myHighlightColor->rgb[0] = R; + myHighlightColor->rgb[1] = G; + myHighlightColor->rgb[2] = B; + myHighlightColor->rgb[3] = 1.F; +} + +/*----------------------------------------------------------------------*/ + +void OpenGl_Structure::ClearHighlightColor () +{ + ClearHighlightBox(); + if (myHighlightColor) + { + delete myHighlightColor; + myHighlightColor = NULL; + } +} + +/*----------------------------------------------------------------------*/ + +void OpenGl_Structure::Connect (const OpenGl_Structure *AStructure) +{ + Disconnect (AStructure); + myConnected.Append(AStructure); +} + +/*----------------------------------------------------------------------*/ + +void OpenGl_Structure::Disconnect (const OpenGl_Structure *AStructure) +{ + OpenGl_ListOfStructure::Iterator its(myConnected); + while (its.More()) + { + // Check for the given structure + if (its.Value() == AStructure) + { + myConnected.Remove(its); + return; + } + its.Next(); + } +} + +/*----------------------------------------------------------------------*/ + +OpenGl_Group * OpenGl_Structure::AddGroup () +{ + // Create new group + OpenGl_Group *g = new OpenGl_Group; + myGroups.Append(g); + return g; +} + +/*----------------------------------------------------------------------*/ + +void OpenGl_Structure::RemoveGroup (const OpenGl_Group *AGroup) +{ + OpenGl_ListOfGroup::Iterator itg(myGroups); + while (itg.More()) + { + // Check for the given group + if (itg.Value() == AGroup) + { + // Delete object + delete AGroup; + myGroups.Remove(itg); + return; + } + itg.Next(); + } +} + +/*----------------------------------------------------------------------*/ + +void OpenGl_Structure::Clear () +{ + OpenGl_ListOfGroup::Iterator itg(myGroups); + while (itg.More()) + { + // Delete objects + delete itg.Value(); + itg.Next(); + } + myGroups.Clear(); +} + +/*----------------------------------------------------------------------*/ + +void OpenGl_Structure::Render (const Handle(OpenGl_Workspace) &AWorkspace) const +{ + // Process the structure only if visible + if ( myNamedStatus & OPENGL_NS_HIDE ) + return; + + // Render named status + const Standard_Integer named_status = AWorkspace->NamedStatus; + AWorkspace->NamedStatus |= myNamedStatus; + + // Is rendering in ADD or IMMEDIATE mode? + const Standard_Boolean isImmediate = (AWorkspace->NamedStatus & (OPENGL_NS_ADD | OPENGL_NS_IMMEDIATE)) != 0; + + // Apply local transformation + GLint matrix_mode = 0; + const OpenGl_Matrix *local_trsf = NULL; + if (myTransformation) + { + if (isImmediate) + { + float mat16[16]; + call_util_transpose_mat (mat16, myTransformation->mat); + glGetIntegerv (GL_MATRIX_MODE, &matrix_mode); + glMatrixMode (GL_MODELVIEW); + glPushMatrix (); + glScalef (1.F, 1.F, 1.F); + glMultMatrixf (mat16); + } + else + { + glMatrixMode (GL_MODELVIEW); + glPushMatrix(); + + local_trsf = AWorkspace->SetStructureMatrix(myTransformation); + } + } + + // Apply transform persistence + const TEL_TRANSFORM_PERSISTENCE *trans_pers = NULL; + if ( myTransPers && myTransPers->mode != 0 ) + { + trans_pers = AWorkspace->ActiveView()->BeginTransformPersistence( myTransPers ); + } + + // Apply degeneration + if (myDegenerateModel) + { + if ( AWorkspace->NamedStatus & OPENGL_NS_DEGENERATION ) + { + AWorkspace->DegenerateModel = myDegenerateModel->mode; + switch ( AWorkspace->DegenerateModel ) + { + case 0: break; + + default: + glLineWidth ( 1.0 ); + glDisable ( GL_LINE_STIPPLE ); + + case 1: + AWorkspace->SkipRatio = myDegenerateModel->skipRatio; + } + } + } + + // Apply aspects + const OpenGl_AspectLine *aspect_line = AWorkspace->AspectLine(Standard_False); + const OpenGl_AspectFace *aspect_face = AWorkspace->AspectFace(Standard_False); + const OpenGl_AspectMarker *aspect_marker = AWorkspace->AspectMarker(Standard_False); + const OpenGl_AspectText *aspect_text = AWorkspace->AspectText(Standard_False); + if (myAspectLine) + AWorkspace->SetAspectLine(myAspectLine); + if (myAspectFace) + AWorkspace->SetAspectFace(myAspectFace); + if (myAspectMarker) + AWorkspace->SetAspectMarker(myAspectMarker); + if (myAspectText) + AWorkspace->SetAspectText(myAspectText); + + // Apply highlight box + if (myHighlightBox) + myHighlightBox->Render( AWorkspace ); + + // Apply highlight color + const TEL_COLOUR *highlight_color = AWorkspace->HighlightColor; + if (myHighlightColor) + AWorkspace->HighlightColor = myHighlightColor; + + // Render connected structures + OpenGl_ListOfStructure::Iterator its(myConnected); + while (its.More()) + { + its.Value()->Render(AWorkspace); + its.Next(); + } + + // Render groups + OpenGl_ListOfGroup::Iterator itg(myGroups); + while (itg.More()) + { + itg.Value()->Render(AWorkspace); + itg.Next(); + } + + // Restore highlight color + AWorkspace->HighlightColor = highlight_color; + + // Restore aspects + AWorkspace->SetAspectLine(aspect_line); + AWorkspace->SetAspectFace(aspect_face); + AWorkspace->SetAspectMarker(aspect_marker); + AWorkspace->SetAspectText(aspect_text); + + // Restore transform persistence + if ( myTransPers && myTransPers->mode != 0 ) + { + AWorkspace->ActiveView()->BeginTransformPersistence( trans_pers ); + } + + // Restore local transformation + if (myTransformation) + { + if (isImmediate) + { + glPopMatrix (); + glMatrixMode (matrix_mode); + } + else + { + AWorkspace->SetStructureMatrix(local_trsf); + + glMatrixMode (GL_MODELVIEW); + glPopMatrix(); + } + } + + // Restore named status + AWorkspace->NamedStatus = named_status; +} + +/*----------------------------------------------------------------------*/ diff --git a/src/OpenGl/OpenGl_Structure.hxx b/src/OpenGl/OpenGl_Structure.hxx new file mode 100644 index 0000000000..1c76d4be01 --- /dev/null +++ b/src/OpenGl/OpenGl_Structure.hxx @@ -0,0 +1,82 @@ +// File: OpenGl_Structure.hxx +// Created: 1 August 2011 +// Author: Sergey ZERCHANINOV +// Copyright: OPEN CASCADE 2011 + +#ifndef OpenGl_Structure_Header +#define OpenGl_Structure_Header + +#include +#include + +#include +#include +#include +#include + +#include +#include + +typedef NCollection_List OpenGl_ListOfStructure; +typedef NCollection_List OpenGl_ListOfGroup; + +class OpenGl_Structure : public OpenGl_Element +{ + public: + OpenGl_Structure (); + virtual ~OpenGl_Structure (); + + void SetTransformation (const float *AMatrix); + + void SetTransformPersistence (const CALL_DEF_TRANSFORM_PERSISTENCE &ATransPers); + + void SetDegenerateModel (const Standard_Integer AMode, const float ASkipRatio); + + void SetAspectLine (const CALL_DEF_CONTEXTLINE &AContext); + void SetAspectFace (const CALL_DEF_CONTEXTFILLAREA &AContext); + void SetAspectMarker (const CALL_DEF_CONTEXTMARKER &AContext); + void SetAspectText (const CALL_DEF_CONTEXTTEXT &AContext); + + void SetHighlightBox (const CALL_DEF_BOUNDBOX &ABoundBox); + void ClearHighlightBox (); + + void SetHighlightColor (const Standard_ShortReal R, const Standard_ShortReal G, const Standard_ShortReal B); + void ClearHighlightColor (); + + void SetNamedStatus (const Standard_Integer aStatus) { myNamedStatus = aStatus; } + + void Connect (const OpenGl_Structure *astructure); + void Disconnect (const OpenGl_Structure *astructure); + + OpenGl_Group * AddGroup (); + void RemoveGroup (const OpenGl_Group *); + void Clear (); + + virtual void Render (const Handle(OpenGl_Workspace) &AWorkspace) const; + + protected: + + //Structure_LABBegin + OpenGl_Matrix *myTransformation; + TEL_TRANSFORM_PERSISTENCE *myTransPers; + DEGENERATION *myDegenerateModel; + OpenGl_AspectLine *myAspectLine; + OpenGl_AspectFace *myAspectFace; + OpenGl_AspectMarker *myAspectMarker; + OpenGl_AspectText *myAspectText; + //Structure_LABHighlight + OpenGl_Group *myHighlightBox; + TEL_COLOUR *myHighlightColor; + //Structure_LABVisibility + //Structure_LABPick + int myNamedStatus; //Structure_LABNameSet + + OpenGl_ListOfStructure myConnected; + + OpenGl_ListOfGroup myGroups; + + public: + IMPLEMENT_MEMORY_OPERATORS +}; + +#endif //OpenGl_Structure_Header diff --git a/src/OpenGl/OpenGl_Text.cxx b/src/OpenGl/OpenGl_Text.cxx new file mode 100644 index 0000000000..fa8929c6e8 --- /dev/null +++ b/src/OpenGl/OpenGl_Text.cxx @@ -0,0 +1,213 @@ +// File: OpenGl_Text.cxx +// Created: 13 July 2011 +// Author: Sergey ZERCHANINOV +// Copyright: OPEN CASCADE 2011 + +#include + +#if (!defined(_WIN32) && !defined(__WIN32__)) + #include +#endif + +#include +#include + +#include + +#include +#include + +/*----------------------------------------------------------------------*/ + +OpenGl_Text::OpenGl_Text (const TCollection_ExtendedString& AText, + const Graphic3d_Vertex& APoint, + const Standard_Real AHeight, + const Graphic3d_HorizontalTextAlignment AHta, + const Graphic3d_VerticalTextAlignment AVta) +: myString(NULL) +{ + const Techar *str = (const Techar *) AText.ToExtString(); + + //szv: instead of strlen + 1 + int i = 0; while (str[i++]); + + wchar_t *wstr = new wchar_t[i]; + + //szv: instead of memcpy + i = 0; while (wstr[i++] = (wchar_t)(*str++)); + if (myString) delete[] myString; + myString = wstr; + + Standard_Real X, Y, Z; + APoint.Coord(X, Y, Z); + myAttachPnt.xyz[0] = float (X); + myAttachPnt.xyz[1] = float (Y); + myAttachPnt.xyz[2] = float (Z); + + myParam.Height = int (AHeight); + + myParam.HAlign = AHta; + myParam.VAlign = AVta; +} + +/*----------------------------------------------------------------------*/ + +OpenGl_Text::~OpenGl_Text () +{ + if (myString) + delete[] myString; +} + +/*----------------------------------------------------------------------*/ + +void OpenGl_Text::Render (const Handle(OpenGl_Workspace) &AWorkspace) const +{ + if ( AWorkspace->DegenerateModel > 0 && AWorkspace->SkipRatio >= 1.f ) + return; + + const OpenGl_AspectText *aspect_text = AWorkspace->AspectText( Standard_True ); + + const TEL_COLOUR *tcolor, *scolor; + + // Use highlight colours + if( AWorkspace->NamedStatus & OPENGL_NS_HIGHLIGHT ) + { + tcolor = scolor = AWorkspace->HighlightColor; + } + else + { + tcolor = &aspect_text->Color(); + scolor = &aspect_text->SubtitleColor(); + } + + // Handle annotation style + GLboolean flag_zbuffer = GL_FALSE; + if (aspect_text->StyleType() == Aspect_TOST_ANNOTATION) + { + flag_zbuffer = glIsEnabled(GL_DEPTH_TEST); + if (flag_zbuffer) glDisable(GL_DEPTH_TEST); + } + + AWorkspace->SetTextParam(&myParam); + + GLboolean blend_state = GL_FALSE; + GLdouble modelMatrix[16], projMatrix[16]; + GLint viewport[4]; + GLdouble objrefX, objrefY, objrefZ; + GLdouble objX, objY, objZ; + GLdouble obj1X, obj1Y, obj1Z; + GLdouble obj2X, obj2Y, obj2Z; + GLdouble obj3X, obj3Y, obj3Z; + GLdouble winx1, winy1, winz1; + GLdouble winx, winy, winz; + GLint status; + + /* display type of text */ + if (aspect_text->DisplayType() != Aspect_TODT_NORMAL) + { + /* Optimisation: il faudrait ne faire le Get qu'une fois par Redraw */ + glGetIntegerv (GL_VIEWPORT, viewport); + glGetDoublev (GL_MODELVIEW_MATRIX, modelMatrix); + glGetDoublev (GL_PROJECTION_MATRIX, projMatrix); + + switch (aspect_text->DisplayType()) + { + case Aspect_TODT_BLEND: + blend_state = glIsEnabled(GL_BLEND); + if (!blend_state) glEnable(GL_BLEND); + glEnable(GL_COLOR_LOGIC_OP); + glLogicOp(GL_XOR); + break; + case Aspect_TODT_SUBTITLE: + { + int sWidth, sAscent, sDescent; + AWorkspace->StringSize(myString, sWidth, sAscent, sDescent); + + objrefX = (float)myAttachPnt.xyz[0]; + objrefY = (float)myAttachPnt.xyz[1]; + objrefZ = (float)myAttachPnt.xyz[2]; + status = gluProject (objrefX, objrefY, objrefZ, modelMatrix, projMatrix, viewport, + &winx1, &winy1, &winz1); + + winx = winx1; + winy = winy1-sDescent; + winz = winz1+0.00001; + status = gluUnProject (winx, winy, winz, modelMatrix, projMatrix, viewport, + &objX, &objY, &objZ); + + winx = winx1 + sWidth; + winy = winy1-sDescent; + winz = winz1+0.00001; /* il vaut mieux F+B / 1000000 ? */ + status = gluUnProject (winx, winy, winz, modelMatrix, projMatrix, viewport, + &obj1X, &obj1Y, &obj1Z); + + winx = winx1 + sWidth; + winy = winy1 + sAscent; + winz = winz1+0.00001; + status = gluUnProject (winx, winy, winz, modelMatrix, projMatrix, viewport, + &obj2X, &obj2Y, &obj2Z); + + winx = winx1; + winy = winy1+ sAscent; + winz = winz1+0.00001; + status = gluUnProject (winx, winy, winz, modelMatrix, projMatrix, viewport, + &obj3X, &obj3Y, &obj3Z); + + glColor3fv( scolor->rgb ); + glBegin(GL_POLYGON); + glVertex3d(objX, objY, objZ); + glVertex3d(obj1X, obj1Y, obj1Z); + glVertex3d(obj2X, obj2Y, obj2Z); + glVertex3d(obj3X, obj3Y, obj3Z); + glEnd(); + break; + } + + case Aspect_TODT_DEKALE: + objrefX = (float)myAttachPnt.xyz[0]; + objrefY = (float)myAttachPnt.xyz[1]; + objrefZ = (float)myAttachPnt.xyz[2]; + status = gluProject (objrefX, objrefY, objrefZ, modelMatrix, projMatrix, viewport, + &winx1, &winy1, &winz1); + + winx = winx1+1; + winy = winy1+1; + winz = winz1+0.00001; + status = gluUnProject (winx, winy, winz, modelMatrix, projMatrix, viewport, + &objX, &objY, &objZ); + + glColor3fv( scolor->rgb ); + AWorkspace->RenderText( myString, 0, (float)objX, (float)objY,(float)objZ ); + winx = winx1-1; + winy = winy1-1; + status = gluUnProject (winx, winy, winz, modelMatrix, projMatrix, viewport, + &objX, &objY, &objZ); + + AWorkspace->RenderText( myString, 0, (float)objX, (float)objY,(float)objZ ); + winx = winx1-1; + winy = winy1+1; + status = gluUnProject (winx, winy, winz, modelMatrix, projMatrix, viewport, + &objX, &objY, &objZ); + + AWorkspace->RenderText( myString, 0, (float)objX, (float)objY,(float)objZ ); + winx = winx1+1; + winy = winy1-1; + status = gluUnProject (winx, winy, winz, modelMatrix, projMatrix, viewport, + &objX, &objY, &objZ); + AWorkspace->RenderText( myString, 0, (float)objX, (float)objY,(float)objZ ); + break; + } + } + + glColor3fv( tcolor->rgb ); + AWorkspace->RenderText( myString, 0, (float)myAttachPnt.xyz[0], (float)myAttachPnt.xyz[1],(float)myAttachPnt.xyz[2] ); + /* maj attributs */ + if (flag_zbuffer) glEnable(GL_DEPTH_TEST); + if (aspect_text->DisplayType() == Aspect_TODT_BLEND) + { + if (!blend_state) glDisable(GL_BLEND); + glDisable(GL_COLOR_LOGIC_OP); + } +} + +/*----------------------------------------------------------------------*/ diff --git a/src/OpenGl/OpenGl_Text.hxx b/src/OpenGl/OpenGl_Text.hxx new file mode 100644 index 0000000000..614d8beac1 --- /dev/null +++ b/src/OpenGl/OpenGl_Text.hxx @@ -0,0 +1,41 @@ +// File: OpenGl_Text.hxx +// Created: 13 July 2011 +// Author: Sergey ZERCHANINOV +// Copyright: OPEN CASCADE 2011 + +#ifndef OpenGl_Text_Header +#define OpenGl_Text_Header + +#include + +#include + +#include +#include +#include +#include + +class OpenGl_Text : public OpenGl_Element +{ + public: + + OpenGl_Text (const TCollection_ExtendedString& AText, + const Graphic3d_Vertex& APoint, + const Standard_Real AHeight, + const Graphic3d_HorizontalTextAlignment AHta, + const Graphic3d_VerticalTextAlignment AVta); + virtual ~OpenGl_Text (); + + virtual void Render (const Handle(OpenGl_Workspace) &AWorkspace) const; + + protected: + + OpenGl_TextParam myParam; + TEL_POINT myAttachPnt; + const wchar_t *myString; + + public: + IMPLEMENT_MEMORY_OPERATORS +}; + +#endif //OpenGl_Text_Header diff --git a/src/OpenGl/OpenGl_TextParam.hxx b/src/OpenGl/OpenGl_TextParam.hxx new file mode 100644 index 0000000000..10e1e14dd6 --- /dev/null +++ b/src/OpenGl/OpenGl_TextParam.hxx @@ -0,0 +1,21 @@ +// File: OpenGl_TextParam.hxx +// Created: 20 September 2011 +// Author: Sergey ZERCHANINOV +// Copyright: OPEN CASCADE 2011 + +#ifndef _OpenGl_TextParam_Header +#define _OpenGl_TextParam_Header + +#include +#include +#include + +struct OpenGl_TextParam +{ + int Height; + Graphic3d_HorizontalTextAlignment HAlign; + Graphic3d_VerticalTextAlignment VAlign; + IMPLEMENT_MEMORY_OPERATORS +}; + +#endif //_OpenGl_TextParam_Header diff --git a/src/OpenGl/OpenGl_TextRender.cxx b/src/OpenGl/OpenGl_TextRender.cxx deleted file mode 100755 index 147ae52f2a..0000000000 --- a/src/OpenGl/OpenGl_TextRender.cxx +++ /dev/null @@ -1,507 +0,0 @@ -/* -* Includes -*/ -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#ifdef HAVE_GL2PS -#include -#endif - -/*-----------------------------------------------------------------------------*/ -/* -* Prototypes variables statiques -*/ - -int OpenGl_TextRender::curFont = -1; -int OpenGl_TextRender::curSize = -1; -int OpenGl_TextRender::curScale = -1; -int OpenGl_TextRender::curTexFont = -1; - -OpenGl_TextRender::FontMapNode OpenGl_TextRender::fontMap[] = { - -#ifdef WNT - - { "Courier" , "Courier New" , OSD_FA_Regular }, - { "Times-Roman" , "Times New Roman", OSD_FA_Regular }, - { "Times-Bold" , "Times New Roman", OSD_FA_Bold }, - { "Times-Italic" , "Times New Roman", OSD_FA_Italic }, - { "Times-BoldItalic" , "Times New Roman", OSD_FA_BoldItalic }, - { "ZapfChancery-MediumItalic", "Script" , OSD_FA_Regular }, - { "Symbol" , "Symbol" , OSD_FA_Regular }, - { "ZapfDingbats" , "WingDings" , OSD_FA_Regular }, - { "Rock" , "Arial" , OSD_FA_Regular }, - { "Iris" , "Lucida Console" , OSD_FA_Regular } - -#else //X11 - - { "Courier" , "Courier" , OSD_FA_Regular }, - { "Times-Roman" , "Times" , OSD_FA_Regular }, - { "Times-Bold" , "Times" , OSD_FA_Bold }, - { "Times-Italic" , "Times" , OSD_FA_Italic }, - { "Times-BoldItalic" , "Times" , OSD_FA_BoldItalic }, - { "Arial" , "Helvetica" , OSD_FA_Regular }, - { "ZapfChancery-MediumItalic", "-adobe-itc zapf chancery-medium-i-normal--*-*-*-*-*-*-iso8859-1" , OSD_FA_Regular }, - { "Symbol" , "-adobe-symbol-medium-r-normal--*-*-*-*-*-*-adobe-fontspecific" , OSD_FA_Regular }, - { "ZapfDingbats" , "-adobe-itc zapf dingbats-medium-r-normal--*-*-*-*-*-*-adobe-fontspecific" , OSD_FA_Regular }, - { "Rock" , "-sgi-rock-medium-r-normal--*-*-*-*-p-*-iso8859-1" , OSD_FA_Regular }, - { "Iris" , "--iris-medium-r-normal--*-*-*-*-m-*-iso8859-1" , OSD_FA_Regular } -#endif - -}; - -OpenGl_TextRender::FontEntry OpenGl_TextRender::fontEntry[] = { - - { "Courier" , "Courier New" }, - { "Times-Roman" , "Times New Roman" }, - { "Times-Bold" , "Times New Roman Bold" }, - { "Times-Italic" , "Times New Roman Italic" }, - { "Times-BoldItalic" , "Times New Roman Bold Italic" }, - { "ZapfChancery-MediumItalic", "Script" }, - { "Symbol" , "Symbol" }, - { "ZapfDingbats" , "WingDings" }, - { "Rock" , "Arial" }, - { "Iris" , "Lucida Console" } - -}; - -#define NUM_FONT_ENTRIES (sizeof(fontMap)/sizeof(FontMapNode)) - -/*-----------------------------------------------------------------------------*/ - -/* -* Constants -*/ - -#ifdef HAVE_GL2PS -void OpenGl_TextRender::getGL2PSFontName(char *src_font, char *ps_font) -{ - /* - Convert font name used for rendering to some "good" font names - that produce good vector text - */ - static char const *family[] = {"Helvetica", "Courier", "Times"}; - static char const *italic[] = {"Oblique", "Oblique", "Italic"}; - static char const *base[] = {"", "", "-Roman"}; - - int font = 0; - int isBold = 0; - int isItalic = 0; - - - if( strstr( src_font, "Symbol" ) ){ - sprintf( ps_font, "%s", "Symbol" ); - return; - } - - if( strstr( src_font, "ZapfDingbats" ) ){ - sprintf( ps_font, "%s", "WingDings" ); - return; - } - - if ( strstr( src_font, "Courier" ) ){ - font = 1; - } - else if ( strstr( src_font, "Times" ) ){ - font = 2; - } - - if ( strstr( src_font, "Bold" ) ){ - isBold = 1; - } - - if ( strstr( src_font, "Italic" ) || strstr( src_font, "Oblique" ) ){ - isItalic = 1; - } - - if ( isBold ){ - sprintf( ps_font, "%s-%s", family[font], "Bold"); - if ( isItalic ){ - sprintf(ps_font, "%s%s", ps_font, italic[font]); - } - } - else if ( isItalic ) - { - sprintf( ps_font, "%s-%s", family[font], italic[font] ); - } - else - { - sprintf( ps_font, "%s%s", family[font], base[font] ); - } -} -#endif - -/*-----------------------------------------------------------------------------*/ - -/* -* Constructors -*/ - -OpenGl_TextRender::OpenGl_TextRender() -: _CurrentFontId(-1), -_XCurrentScale(1.f), -_YCurrentScale(1.f) { -} - - - -/*-----------------------------------------------------------------------------*/ - -/* -* Fonctions publiques -*/ - -OpenGl_TextRender* OpenGl_TextRender::instance() { - static OpenGl_TextRender* _textRend = NULL; - if ( _textRend == NULL ) - { - _textRend = new OpenGl_TextRender(); - } - - return _textRend; -} - - -/*----------------------------------------------------------------------*/ -OpenGl_TextRender::FontMapNode OpenGl_TextRender::searchFontInMap( Handle(TCollection_HAsciiString)& fontName ) { - for ( int i = 0; i < NUM_FONT_ENTRIES; ++i ) - { - TCollection_AsciiString compare_String(fontMap[i].enumName) ; - if(compare_String.IsEqual( fontName->ToCString() )) - { - return fontMap[i]; - } - } - //default font returns - return fontMap[0]; -} - -/*-----------------------------------------------------------------------------*/ - -Tint OpenGl_TextRender::FindFont ( Tchar* fontName, - OSD_FontAspect aspect, - Tfloat bestSize, - Tfloat xScale , - Tfloat yScale ) -{ - if (!fontName) - return -1; - OpenGl_FontMgr* mgr = OpenGl_FontMgr::instance(); - - Handle(TCollection_HAsciiString) family_name - = new TCollection_HAsciiString((char*)fontName); - - curFont = mgr->request_font(family_name, - aspect, - Standard_Integer(bestSize) ); - - if( curFont == -1 ) { - //try to use font names mapping - FontMapNode newTempFont = searchFontInMap ( family_name ); - curFont = mgr->request_font( new TCollection_HAsciiString(newTempFont.FontName), - newTempFont.fontAspect, - Standard_Integer(bestSize) ); - } - - // Requested family name not found -> serach for any font family with given aspect and height - family_name = new TCollection_HAsciiString( "" ); - if ( curFont == -1 ) { - curFont = mgr->request_font(family_name, aspect, Standard_Integer(bestSize) ); - } - - // The last resort: trying to use ANY font available in the system - if ( curFont == -1 ) { - curFont = mgr->request_font(family_name, OSD_FA_Undefined, -1 ); - } - - if ( curFont != -1 ) - mgr->setCurrentScale( xScale, yScale ); - return curFont; - -} - -/*-----------------------------------------------------------------------------*/ -void OpenGl_TextRender::StringSize(const wchar_t *str, GLint *Width, GLint *Ascent, GLint *Descent) -{ - - /* int dir, asc, des;*/ - *Ascent = 0; - *Descent = 0; - *Width = 0; - if (curFont != -1) { - OpenGl_FontMgr* mgr = OpenGl_FontMgr::instance(); - const FTFont* font = mgr->fontById( curFont ); - if ( font ) { - *Width = GLint( mgr->computeWidth( curFont, str ) ); - *Ascent = GLint( font->Ascender() ); - *Descent = GLint( font->Descender() ); - } - } -#ifdef TRACE - printf("sizeString::asc = %d des = %d width = %d \n", *Ascent, *Descent, *Width); -#endif - -} - -/*-----------------------------------------------------------------------------*/ - -void OpenGl_TextRender::RenderText ( const wchar_t* str, GLuint base, int is2d, GLfloat x, GLfloat y, GLfloat z ) -{ - GLdouble projMatrix[4][4], modelMatrix[4][4]; - GLint viewport[4]; - GLint widthFont, ascentFont, descentFont; - GLdouble xdis = 0., ydis = 0.; - GLint renderMode; - - // FTFont changes texture state when it renders and computes size for the text - glPushAttrib(GL_TEXTURE_BIT); - StringSize(str, &widthFont, &ascentFont, &descentFont ); - - GLdouble identityMatrix[4][4] = - { - {1.,0.,0.,0.}, - {0.,1.,0.,0.}, - {0.,0.,1.,0.}, - {0.,0.,0.,1.} - }; - - TEL_ALIGN_DATA align; - - CMN_KEY key; - key.id = TelTextAlign; - key.data.pdata = &align; - TsmGetAttri( 1, &key ); - - Tfloat angle = 0; - CMN_KEY keyAngle; - keyAngle.id = TelTextAngle;//This flag responding about Angle text - TsmGetAttri( 1, &keyAngle ); - angle = keyAngle.data.ldata; - - Tint zoom = 0; - CMN_KEY keyZoom; - keyZoom.id = TelTextZoomable;//This flag responding about Zoomable text - TsmGetAttri( 1, &keyZoom ); - zoom = keyZoom.data.ldata; - - OpenGl_TextRender* textRender = OpenGl_TextRender::instance(); - int vh = 2 ; - int vv = 2 ; - - switch( align.Hmode ) - { - case CALL_PHIGS_HOR_LEFT://0 - xdis =0.; vh = 1; - break; - case CALL_PHIGS_HOR_CENTER://1 - xdis = -(GLdouble)widthFont / 2.0; vh = 2; - break; - case CALL_PHIGS_HOR_RIGHT://2 - xdis = -(GLdouble)widthFont; vh = 3; - break; - default: - xdis = 0.; - } - - switch( align.Vmode ) - { - case CALL_PHIGS_VERT_BOTTOM://0 - ydis = 0.; vv = 1; - break; - case CALL_PHIGS_VERT_CENTER://1 - ydis = -(GLdouble)(ascentFont) / 2.0 - descentFont; vv = 2; - break; - case CALL_PHIGS_VERT_TOP://2 - ydis = -(GLdouble)ascentFont - descentFont; vv= 3; - break; - default: - ydis = 0.; - } - - OpenGl_FontMgr* mgr = OpenGl_FontMgr::instance(); - - const FTFont* fnt = mgr->fontById( curFont ); - if ( !fnt ) { - glPopAttrib(); - return; - } - - float export_h = 1.; - - glMatrixMode(GL_MODELVIEW); - glPushMatrix(); - if (is2d) { - glLoadIdentity(); - glTranslatef(x, y, 0.f); - glRotatef( 180, 1, 0, 0 ); - } - else { - GLdouble wx, wy, wz; - GLdouble x1, y1, z1; - GLdouble x2, y2, z2; - - glGetDoublev( GL_MODELVIEW_MATRIX, (GLdouble*)modelMatrix ); - glGetDoublev( GL_PROJECTION_MATRIX, (GLdouble*)projMatrix ); - glGetIntegerv( GL_VIEWPORT, (GLint*)viewport ); - - gluProject( x, y, z, - (GLdouble*)modelMatrix, - (GLdouble*)projMatrix, - (GLint*)viewport, - &wx, &wy, &wz ); - glLoadIdentity(); - gluUnProject( wx, wy, wz, - (GLdouble*)identityMatrix, (GLdouble*)projMatrix, (GLint*)viewport, - &x1, &y1 , &z1 ); - - GLdouble h = (GLdouble)fnt->FaceSize(); - - - gluUnProject( wx, wy + h - 1., wz, - (GLdouble*)identityMatrix, (GLdouble*)projMatrix, (GLint*)viewport, - &x2, &y2, &z2 ); - - h = (y2-y1)/h; - - glTranslated( x1, y1 , z1 ); - glRotated(angle, 0, 0, 1); - glTranslated(xdis, ydis, 0); - - if( ! zoom ) - { -#ifdef WNT - // if the context has assigned printer context, use it's parameters - OpenGl_PrinterContext* aPrinterContext = - OpenGl_PrinterContext::GetPrinterContext( GET_GL_CONTEXT() ); - if( aPrinterContext ) - { - // get printing scaling in x and y dimensions - GLfloat aTextScalex = 1, aTextScaley = 1; - aPrinterContext->GetScale( aTextScalex, aTextScaley ); - - // text should be scaled in all directions with same - // factor to save its proportions, so use height (y) scaling - // as it is better for keeping text/3d graphics proportions - glScalef( aTextScaley, aTextScaley, aTextScaley ); - } -#endif - glScaled( h, h, h ); - } - else - { - export_h = h; - } - } - glGetIntegerv(GL_RENDER_MODE, &renderMode); - if ( renderMode == GL_FEEDBACK ) - { -#ifdef HAVE_GL2PS - CMN_KEY keyfontName; - keyfontName.id = TelTextFont;//This flag responding about TextFontName - TsmGetAttri( 1, &keyfontName ); - char *fontName = new char[strlen((char*)keyfontName.data.pdata) + 1]; - strcpy(fontName,(char*)keyfontName.data.pdata); - - export_h = (GLdouble)fnt->FaceSize() / export_h; - int aligment = alignmentforgl2ps( vh, vv ); - glPopMatrix(); - ExportText( str, fontName, export_h, angle, aligment, x, y, z, is2d!=0 ); - delete [] fontName; -#endif - } - else - { - mgr->render_text( curFont, str, is2d ); - glPopMatrix(); - } - glPopAttrib(); - -} - -#ifdef HAVE_GL2PS -int OpenGl_TextRender::alignmentforgl2ps(int vh, int vy) -{ - if( vh == 1 && vy == 1) - { - return 5; - } - if( vh == 2 && vy == 1) - { - return 4; - } - if( vh == 3 && vy == 1) - { - return 6; - } - - if( vh == 1 && vy == 2) - { - return 2; - } - if( vh == 2 && vy == 2) - { - return 1; - } - if( vh == 3 && vy == 2) - { - return 3; - } - - if( vh == 1 && vy == 3) - { - return 8; - } - if( vh == 2 && vy == 3) - { - return 7; - } - if( vh == 3 && vy == 3) - { - return 9; - } - return 0; -}; -#endif - -/*-----------------------------------------------------------------------------*/ -void OpenGl_TextRender::ExportText( const wchar_t* text, char* fontname, GLfloat height, GLfloat angle, GLint alignment, - GLfloat x, GLfloat y, GLfloat z, GLboolean is2d ) -{ -#ifdef HAVE_GL2PS - - GLubyte zero = 0; - char ps_font[64]; - - getGL2PSFontName(fontname, ps_font); - - if( is2d ) - glRasterPos2f( x, y ); - else - glRasterPos3f( x, y, z ); - - glBitmap( 1, 1, 0, 0, 0, 0, &zero ); - - //szv: workaround for gl2ps! - const int len = 4 * (wcslen(text) + 1); //szv: should be more than enough - char *astr = new char[len]; - wcstombs(astr,text,len); - gl2psTextOpt(astr, ps_font, height, alignment, angle); - delete[] astr; - -#endif -} diff --git a/src/OpenGl/OpenGl_TextRender.hxx b/src/OpenGl/OpenGl_TextRender.hxx deleted file mode 100755 index 9af9692ab2..0000000000 --- a/src/OpenGl/OpenGl_TextRender.hxx +++ /dev/null @@ -1,77 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include - -#define NUM_FONT_SIZES 40 -#define NUM_CHAR_FONT 1024 -#define CACHE_SIZE 30 - -class OpenGl_TextRender -{ - public: - - static OpenGl_TextRender* instance(); - Tint FindFont ( Tchar*, OSD_FontAspect, Tfloat, Tfloat = 1. , Tfloat = 1.); - - void StringSize( const wchar_t *text, GLint *width, GLint *ascent, GLint *descent); - void RenderText( const wchar_t*, GLuint, int, GLfloat, GLfloat, GLfloat ); - void ExportText( const wchar_t* text, char* fontname, GLfloat height, GLfloat angle, GLint alingment, GLfloat x, GLfloat y, GLfloat z, GLboolean is2d ); -#ifdef HAVE_GL2PS - static void getGL2PSFontName(char *src_font, char *ps_font); -#endif - - private: - - static int curFont ; - static int curSize ; - static int curScale ; - static int curTexFont ; -#ifdef HAVE_GL2PS - int alignmentforgl2ps(int Hmode, int Vmode); -#endif - - struct FontMapNode - { - char* enumName; - char* FontName; - OSD_FontAspect fontAspect; - }; - - struct FontEntry - { - char* name; - char* xlfd; - float xsizes[NUM_FONT_SIZES]; - int count; - }; - - FontMapNode searchFontInMap( Handle(TCollection_HAsciiString)& fontName ); - - static FontMapNode fontMap[]; - static FontEntry fontEntry[]; - - OpenGl_TextRender(); - OpenGl_TextRender( const OpenGl_TextRender& ){}; - OpenGl_TextRender& operator = ( const OpenGl_TextRender&){ return *this;}; - ~OpenGl_TextRender(){}; - - - struct OGLFont_Cache - { - FTFont* Font; - Standard_Integer FontHeight; - GLCONTEXT GlContext; - }; - - typedef NCollection_DataMap FontCache; - FontCache _FontCache; - Standard_Integer _CurrentFontId; - Standard_ShortReal _XCurrentScale, - _YCurrentScale; - -}; diff --git a/src/OpenGl/OpenGl_TextureBox.cxx b/src/OpenGl/OpenGl_TextureBox.cxx index f429c64408..1daa3ab2f5 100755 --- a/src/OpenGl/OpenGl_TextureBox.cxx +++ b/src/OpenGl/OpenGl_TextureBox.cxx @@ -23,18 +23,6 @@ * generation de texture automatique en OBJECT_LINEAR * rendu avec MODULATE * -* Remarques: -* ~~~~~~~~~~~ -* Pour utiliser le binding des textures il faut que les 2 extensions -* -* o GL_EXT_texture_object: -* - glBindTextureEXT, glGenTexturesEXT, glDeleteTexturesEXT -* -* Attention: -* ~~~~~~~~~~~ -* Ce package a ete teste sur SGI, OSF, SUN, HP et WNT. -* -* * Historique des modifications * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * 22-05-97: PCT ; Creation @@ -60,58 +48,27 @@ * 22-07-98: FGU ; Ajout fonctions TransferTexture_To_Data() et TransferData_To_Texture() * */ -/*----------------------------------------------------------------------*/ - -#define IMP141100 /*GG_Allocates and free texture block count -// correctly -*/ - -/*----------------------------------------------------------------------*/ -/* -* Includes -*/ #include #include #include #include -#include -#include -#include +#include #include +#include #include #include #include - -/*----------------------------------------------------------------------*/ -/* -* Constantes -*/ - -#define XPRINT -#define XEXTENSION - #define GROW_TEXTURES 8 #define GROW_TEXTURES_DATA 8 #define GROW_CONTEXT 8 -#ifdef __sgi -#define glGenTextures glGenTexturesEXT -#define glDeleteTextures glDeleteTexturesEXT -#define glBindTexture glBindTextureEXT -#endif /* IRIX */ - #ifndef max -#define max(a,b) ((a) > (b)) ? (a) : (b); + #define max(a,b) ((a) > (b)) ? (a) : (b); #endif -/*----------------------------------------------------------------------*/ -/* -* Types definis -*/ - typedef enum {TEXDATA_NONE, TEXDATA_1D, TEXDATA_2D, TEXDATA_2DMM} texDataStatus; typedef enum {TEX_NONE, TEX_ALLOCATED} texStatus; @@ -178,9 +135,6 @@ static GLfloat tgenparams[] = { 0.0 ,1.0 ,0.0 ,0.0}; static GLenum status2type[] = { GL_NONE, GL_TEXTURE_1D, GL_TEXTURE_2D, GL_TEXTURE_2D }; -static GLboolean init_extension = GL_FALSE; -static GLboolean use_bind_texture = GL_FALSE; - /*----------------------------------------------------------------------*/ /* * Fonctions privees @@ -231,11 +185,7 @@ static TextureDataID FindFreeTextureData(void) for (i=0; iAddResource(textab[ID].context[i], + new OpenGl_ResourceTexture(textab[ID].number[i])) ) { - if( !OpenGl_ResourceCleaner::GetInstance()->AddResource(textab[ID].context[i], - new OpenGl_ResourceTexture(textab[ID].number[i])) ) - { - GL_MAKE_CURRENT(GetCurrentDisplay(), - textab[ID].drawable[i], - textab[ID].context[i]); - - /*This check has been added to avoid exception, - which is raised when trying to delete textures when no rendering context - is available*/ - cur_context = GET_GL_CONTEXT(); - if( cur_context ) - glDeleteTextures(1, &textab[ID].number[i]); - notResource = true; - } - else - isResource = true; + GL_MAKE_CURRENT((openglDisplay.IsNull() ? (Display* )NULL : (Display* )openglDisplay->GetDisplay()), + textab[ID].drawable[i], + textab[ID].context[i]); + + // This check has been added to avoid exception, + // which is raised when trying to delete textures when no rendering context is available + cur_context = GET_GL_CONTEXT(); + if (cur_context) + glDeleteTextures (1, &textab[ID].number[i]); + notResource = true; + } + else + { + isResource = true; } - - if( !isResource && cur_context ) - glFinish(); } - if( notResource ) - GL_MAKE_CURRENT(GetCurrentDisplay(),cur_drawable,cur_context); + if( !isResource && cur_context ) + glFinish(); + } - texdata[data].status = TEXDATA_NONE; -#ifndef IMP141100 - textures_data_count--; -#else - if( data+1 == textures_data_count ) textures_data_count--; -#endif - free(textab[ID].context); - free(textab[ID].drawable); - free(textab[ID].use_bind_texture); - free(textab[ID].number); + if( notResource ) + GL_MAKE_CURRENT((openglDisplay.IsNull() ? (Display* )NULL : (Display* )openglDisplay->GetDisplay()), + cur_drawable, cur_context); + + texdata[data].status = TEXDATA_NONE; + if (data + 1 == textures_data_count) + { + --textures_data_count; + } - } /* use_bind_texture */ -#endif /* GL_EXT_texture_object */ + free(textab[ID].context); + free(textab[ID].drawable); + free(textab[ID].use_bind_texture); + free(textab[ID].number); } textab[ID].status = TEX_NONE; -#ifndef IMP141100 - textures_count--; -#else - if( ID+1 == textures_count ) textures_count--; -#endif + if (ID + 1 == textures_count) + { + --textures_count; + } current_texture_data = TEXTUREDATA_ERROR; } diff --git a/src/OpenGl/OpenGl_TriangleStrip.cxx b/src/OpenGl/OpenGl_TriangleStrip.cxx new file mode 100644 index 0000000000..45996c933f --- /dev/null +++ b/src/OpenGl/OpenGl_TriangleStrip.cxx @@ -0,0 +1,725 @@ +// File: OpenGl_TriangleStrip.cxx +// Created: 13 July 2011 +// Author: Sergey ZERCHANINOV +// Copyright: OPEN CASCADE 2011 + +#include +#include + +#include + +#include +#include + +#include +#include + +/*----------------------------------------------------------------------*/ + +void draw_degenerates_as_points ( PDS_INTERNAL, tel_point, Tint, const Handle(OpenGl_Workspace) & ); +void draw_degenerates_as_bboxs ( PDS_INTERNAL, tel_point, Tint, const Handle(OpenGl_Workspace) & ); +extern void set_drawable_items ( GLboolean*, int, const float ); + +/*----------------------------------------------------------------------*/ + +void OpenGl_TriangleStrip::draw_tmesh (const Tint front_lighting_model, + const Aspect_InteriorStyle interior_style, + const TEL_COLOUR *edge_colour, + const Handle(OpenGl_Workspace) &AWorkspace) const +{ + Tint i, newList = 0; + + tel_point pfn = myData.fnormals; + tel_colour pfc = myData.fcolours; + tel_point pv = myData.vertices; + tel_colour pvc = myData.vcolours; + tel_point pvn = myData.vnormals; + tel_texture_coord pvt = myData.vtexturecoord; + + if ( AWorkspace->NamedStatus & OPENGL_NS_HIGHLIGHT ) pvc = pfc = 0; + + if ( AWorkspace->DegenerateModel < 2 && interior_style != Aspect_IS_EMPTY ) + { + if ( front_lighting_model ) + glEnable(GL_LIGHTING); + else + glDisable(GL_LIGHTING); + + if ( (AWorkspace->NamedStatus & OPENGL_NS_ANIMATION) == 0 ) + goto doDraw; /* Disable object display list out of animation */ + if ( myDS->model != front_lighting_model || !myDS->list || myDS->model == -1 || + ( AWorkspace->DegenerateModel && myDS->skipRatio != AWorkspace->SkipRatio ) ) + { + myDS->skipRatio = AWorkspace->SkipRatio; + myDS->model = front_lighting_model; + myDS->degMode = AWorkspace->DegenerateModel; + + if ( AWorkspace->SkipRatio <= 0.f ) { + + if ( !myDS->list ) myDS->list = glGenLists ( 1 ); + + glNewList ( myDS->list, GL_COMPILE_AND_EXECUTE ); + newList = 1; +doDraw: + glBegin ( GL_TRIANGLE_STRIP ); + + if ( front_lighting_model ) + { + if ( pvt && (AWorkspace->NamedStatus & OPENGL_NS_FORBIDSETTEX) == 0 ) + { + for ( i = 0; i < myData.num_facets + 2; ++i ) + { + glNormal3fv ( pvn[ i ].xyz ); + glTexCoord2fv ( pvt[ i ].xy ); + glVertex3fv ( pv [ i ].xyz ); + } + } + else + for ( i = 0; i < myData.num_facets + 2; ++i ) + { + glNormal3fv( pvn[ i ].xyz ); + glVertex3fv( pv[ i ].xyz ); + } + } + else + { + if ( pvc ) + { + for ( i = 0; i < myData.num_facets + 2; ++i ) + { + glColor3fv ( pvc[ i ].rgb ); + glVertex3fv ( pv [ i ].xyz ); + } + } + else if ( pfc ) + { + glColor3fv ( pfc[ 0 ].rgb ); + glVertex3fv ( pv [ 0 ].xyz ); + glVertex3fv ( pv [ 1 ].xyz ); + for ( i = 2; i < myData.num_facets + 2; ++i ) + { + glColor3fv ( pfc[ i - 2 ].rgb ); + glVertex3fv( pv [ i ].xyz ); + } + } + else + for ( i = 0; i < myData.num_facets + 2; ++i ) glVertex3fv ( pv[ i ].xyz ); + } + glEnd (); + } + else if ( AWorkspace->SkipRatio < 1.f ) + { + set_drawable_items ( myDS->bDraw, myData.num_facets + 2, AWorkspace->SkipRatio ); + + if ( !myDS->dlist ) myDS->dlist = glGenLists ( 1 ); + + glNewList ( myDS->dlist, GL_COMPILE_AND_EXECUTE ); + newList = 1; + + glBegin ( GL_TRIANGLES ); + + if ( front_lighting_model ) + { + if ( pvt && (AWorkspace->NamedStatus & OPENGL_NS_FORBIDSETTEX) == 0 ) + { + for ( i = 0; i < myData.num_facets; ++i ) + { + if ( myDS->bDraw[ i ] ) + { + if ( i % 2 ) + { + glNormal3fv ( pvn[ i ].xyz ); + glTexCoord2fv ( pvt[ i ].xy ); + glVertex3fv ( pv [ i ].xyz ); + glNormal3fv ( pvn[ i + 2 ].xyz ); + glTexCoord2fv ( pvt[ i + 2 ].xy ); + glVertex3fv ( pv [ i + 2 ].xyz ); + glNormal3fv ( pvn[ i + 1 ].xyz ); + glTexCoord2fv ( pvt[ i + 1 ].xy ); + glVertex3fv ( pv [ i + 1 ].xyz ); + } + else + { + glNormal3fv ( pvn[ i + 2 ].xyz ); + glTexCoord2fv ( pvt[ i + 2 ].xy ); + glVertex3fv ( pv [ i + 2 ].xyz ); + glNormal3fv ( pvn[ i ].xyz ); + glTexCoord2fv ( pvt[ i ].xy ); + glVertex3fv ( pv [ i ].xyz ); + glNormal3fv ( pvn[ i + 1 ].xyz ); + glTexCoord2fv ( pvt[ i + 1 ].xy ); + glVertex3fv ( pv [ i + 1 ].xyz ); + } + } + } + } + else + { + for ( i = 0; i < myData.num_facets; ++i ) + { + if ( myDS->bDraw[ i ] ) + { + if ( i % 2 ) + { + glNormal3fv( pvn[ i ].xyz ); + glVertex3fv( pv[ i ].xyz ); + glNormal3fv( pvn[ i + 2 ].xyz ); + glVertex3fv( pv[ i + 2 ].xyz ); + glNormal3fv( pvn[ i + 1 ].xyz ); + glVertex3fv( pv[ i + 1 ].xyz ); + } + else + { + glNormal3fv( pvn[ i + 2 ].xyz ); + glVertex3fv( pv[ i + 2 ].xyz ); + glNormal3fv( pvn[ i ].xyz ); + glVertex3fv( pv[ i ].xyz ); + glNormal3fv( pvn[ i + 1 ].xyz ); + glVertex3fv( pv[ i + 1 ].xyz ); + } + } + } + } + } + else + { + if ( pvc ) + { + for ( i = 0; i < myData.num_facets; ++i ) + { + if ( myDS->bDraw[ i ] ) + { + if ( i % 2 ) + { + glColor3fv ( pvc[ i ].rgb ); + glVertex3fv ( pv [ i ].xyz ); + glColor3fv ( pvc[ i + 2 ].rgb ); + glVertex3fv ( pv [ i + 2 ].xyz ); + glColor3fv ( pvc[ i + 1 ].rgb ); + glVertex3fv ( pv [ i + 1 ].xyz ); + } + else + { + glColor3fv ( pvc[ i + 2 ].rgb ); + glVertex3fv ( pv [ i + 2 ].xyz ); + glColor3fv ( pvc[ i ].rgb ); + glVertex3fv ( pv [ i ].xyz ); + glColor3fv ( pvc[ i + 1 ].rgb ); + glVertex3fv ( pv [ i + 1 ].xyz ); + } + } + } + } + else if ( pfc ) + { + for ( i = 0; i < myData.num_facets; ++i ) + { + if ( myDS->bDraw[ i ] ) + { + if ( i % 2 ) + { + glColor3fv ( pfc[ i ].rgb ); + glVertex3fv( pv [ i ].xyz ); + glColor3fv ( pfc[ i + 2 ].rgb ); + glVertex3fv( pv [ i + 2 ].xyz ); + glColor3fv ( pfc[ i + 1 ].rgb ); + glVertex3fv( pv [ i + 1 ].xyz ); + } + else + { + glColor3fv ( pfc[ i + 2 ].rgb ); + glVertex3fv( pv [ i + 2 ].xyz ); + glColor3fv ( pfc[ i ].rgb ); + glVertex3fv( pv [ i ].xyz ); + glColor3fv ( pfc[ i + 1 ].rgb ); + glVertex3fv( pv [ i + 1 ].xyz ); + } + } + } + } + else + { + for ( i = 0; i < myData.num_facets; ++i ) + { + if ( myDS->bDraw[ i ] ) + { + if ( i % 2 ) + { + glVertex3fv ( pv[ i ].xyz ); + glVertex3fv ( pv[ i + 2 ].xyz ); + glVertex3fv ( pv[ i + 1 ].xyz ); + } + else + { + glVertex3fv ( pv[ i + 2 ].xyz ); + glVertex3fv ( pv[ i ].xyz ); + glVertex3fv ( pv[ i + 1 ].xyz ); + } + } + } + } + } + glEnd (); + } + else + { + if ( !myDS->dlist ) myDS->dlist = glGenLists ( 1 ); + + glNewList ( myDS->dlist, GL_COMPILE_AND_EXECUTE ); + newList = 1; + } + if ( newList ) glEndList (); + + if ( AWorkspace->DegenerateModel ) return; + } + else + { + glCallList ( AWorkspace->SkipRatio <= 0.f ? myDS->list : myDS->dlist ); + if ( AWorkspace->DegenerateModel ) return; + } + } + + i = 0; + + /* OCC11904 -- Temporarily disable environment mapping */ + glPushAttrib(GL_ENABLE_BIT); + glDisable(GL_TEXTURE_1D); + glDisable(GL_TEXTURE_2D); + + switch ( AWorkspace->DegenerateModel ) + { + default: + break; + + case 2: /* XXX_TDM_WIREFRAME */ + i = 1; + break; + + case 3: /* XXX_TDM_MARKER */ + draw_degenerates_as_points ( myDS, myData.vertices, myData.num_facets + 2, AWorkspace ); + glPopAttrib(); + return; + + case 4: /* XXX_TDM_BBOX */ + draw_degenerates_as_bboxs ( myDS, myData.vertices, myData.num_facets + 2, AWorkspace ); + glPopAttrib(); + return; + } + + draw_edges ( edge_colour, interior_style, i, AWorkspace ); + + glPopAttrib(); +} + +/*----------------------------------------------------------------------*/ + +void OpenGl_TriangleStrip::draw_edges (const TEL_COLOUR *edge_colour, const Aspect_InteriorStyle interior_style, + Tint forceDraw, const Handle(OpenGl_Workspace) &AWorkspace) const +{ + const OpenGl_AspectFace *aspect_face = AWorkspace->AspectFace( Standard_True ); + + if ( interior_style != Aspect_IS_HIDDENLINE && !forceDraw && aspect_face->Context().Edge == TOff ) + return; + + glDisable(GL_LIGHTING); + const GLboolean texture_on = IsTextureEnabled(); + if ( texture_on ) DisableTexture(); + + // Setup line aspect + const OpenGl_AspectLine *aspect_line_old = AWorkspace->SetAspectLine( aspect_face->AspectEdge() ); + AWorkspace->AspectLine( Standard_True ); + + tel_point pv = myData.vertices; + Tint i, newList = 0; + + glColor3fv ( edge_colour->rgb ); + if ( !forceDraw ) + draw_line_loop (); + else + { + if ( (AWorkspace->NamedStatus & OPENGL_NS_ANIMATION) == 0 ) + goto doDraw; /* Disable object display list out of animation */ + if ( myDS->degMode != 2 || myDS->skipRatio != AWorkspace->SkipRatio || !myDS->dlist ) { + + if ( !myDS->dlist ) myDS->dlist = glGenLists ( 1 ); + + myDS->degMode = 2; + myDS->skipRatio = AWorkspace->SkipRatio; + glNewList ( myDS->dlist, GL_COMPILE_AND_EXECUTE ); + newList = 1; +doDraw: + glPushAttrib ( GL_DEPTH_BUFFER_BIT ); + glDisable ( GL_DEPTH_TEST ); + + if ( AWorkspace->SkipRatio <= 0.f ) + + draw_line_loop (); + + else if ( AWorkspace->SkipRatio < 1.f ) { + + set_drawable_items ( myDS->bDraw, myData.num_facets + 2, AWorkspace->SkipRatio ); + + for ( i = 0; i < myData.num_facets; ++i ) + + if ( myDS->bDraw[ i ] ) { + + glBegin ( GL_LINE_LOOP ); + glVertex3fv ( pv[ i ].xyz ); + glVertex3fv ( pv[ i + 1 ].xyz ); + glVertex3fv ( pv[ i + 2 ].xyz ); + glEnd(); + + } /* end if */ + + } /* end if */ + + glPopAttrib (); + if ( newList ) glEndList (); + + } else glCallList ( myDS->dlist ); + + } /* end else */ + + // Restore line context + AWorkspace->SetAspectLine( aspect_line_old ); + + if ( texture_on ) EnableTexture (); +} + +void draw_degenerates_as_points ( PDS_INTERNAL pd, tel_point p, Tint n, const Handle(OpenGl_Workspace) &AWorkspace ) +{ + int i, newList = 0; + + glDisable(GL_LIGHTING); + if ( (AWorkspace->NamedStatus & OPENGL_NS_ANIMATION) == 0 ) + goto doDraw; /* Disable object display list out of animation */ + if ( pd -> degMode != 3 || pd -> skipRatio != AWorkspace->SkipRatio || !pd -> dlist ) { + + if ( !pd -> dlist ) pd -> dlist = glGenLists ( 1 ); + + pd -> degMode = 3; + pd -> skipRatio = AWorkspace->SkipRatio; + glNewList ( pd -> dlist, GL_COMPILE_AND_EXECUTE ); + newList = 1; + + if ( AWorkspace->SkipRatio <= 0.f ) { +doDraw: + glBegin ( GL_POINTS ); + + for ( i = 0; i < n; ++i ) glVertex3fv ( p[ i ].xyz ); + + glEnd (); + + } else if ( AWorkspace->SkipRatio < 1.f ) { + + set_drawable_items ( pd -> bDraw, n, AWorkspace->SkipRatio ); + + glBegin ( GL_POINTS ); + + for ( i = 0; i < n; ++i ) + + if ( pd -> bDraw[ i ] ) glVertex3fv ( p[ i ].xyz ); + + glEnd (); + + } /* end if */ + if ( newList ) glEndList (); + + } else glCallList ( pd -> dlist ); + +} /* end draw_degenerates_as_points */ + +void draw_degenerates_as_bboxs ( PDS_INTERNAL pd, tel_point p, Tint n, const Handle(OpenGl_Workspace) &AWorkspace ) +{ + int i, newList = 0; + GLfloat minp[ 3 ] = { FLT_MAX, FLT_MAX, FLT_MAX }; + GLfloat maxp[ 3 ] = { FLT_MIN, FLT_MIN, FLT_MIN }; + + glDisable(GL_LIGHTING); + if ( (AWorkspace->NamedStatus & OPENGL_NS_ANIMATION) == 0 ) + goto doDraw; /* Disable object display list out of animation */ + if ( pd -> degMode != 4 || !pd -> dlist ) { + + if ( !pd -> dlist ) pd -> dlist = glGenLists ( 1 ); + + pd -> degMode = 4; + + glNewList ( pd -> dlist, GL_COMPILE_AND_EXECUTE ); + newList = 1; +doDraw: + for ( i = 0; i < n; ++i ) { + + TEL_POINT pt = p[ i ]; + + if ( pt.xyz[ 0 ] < minp[ 0 ] ) + minp[ 0 ] = pt.xyz[ 0 ] ; + if ( pt.xyz[ 1 ] < minp[ 1 ] ) + minp[ 1 ] = pt.xyz[ 1 ] ; + if ( pt.xyz[ 2 ] < minp[ 2 ] ) + minp[ 2 ] = pt.xyz[ 2 ] ; + + if ( pt.xyz[ 0 ] > maxp[ 0 ] ) + maxp[ 0 ] = pt.xyz[ 0 ] ; + if ( pt.xyz[ 1 ] > maxp[ 1 ] ) + maxp[ 1 ] = pt.xyz[ 1 ] ; + if ( pt.xyz[ 2 ] > maxp[ 2 ] ) + maxp[ 2 ] = pt.xyz[ 2 ] ; + + } /* end for */ + + glBegin ( GL_LINE_STRIP ); + + glVertex3fv ( minp ); + glVertex3f ( minp[ 0 ], maxp[ 1 ], minp[ 2 ] ); + glVertex3f ( minp[ 0 ], maxp[ 1 ], maxp[ 2 ] ); + glVertex3f ( minp[ 0 ], minp[ 1 ], maxp[ 2 ] ); + glVertex3f ( minp[ 0 ], minp[ 1 ], minp[ 2 ] ); + + glVertex3f ( maxp[ 0 ], minp[ 1 ], minp[ 2 ] ); + glVertex3f ( maxp[ 0 ], maxp[ 1 ], minp[ 2 ] ); + glVertex3f ( maxp[ 0 ], maxp[ 1 ], maxp[ 2 ] ); + glVertex3f ( maxp[ 0 ], minp[ 1 ], maxp[ 2 ] ); + glVertex3f ( maxp[ 0 ], minp[ 1 ], minp[ 2 ] ); + + glVertex3f ( maxp[ 0 ], minp[ 1 ], maxp[ 2 ] ); + glVertex3f ( minp[ 0 ], minp[ 1 ], maxp[ 2 ] ); + glVertex3f ( minp[ 0 ], maxp[ 1 ], maxp[ 2 ] ); + glVertex3fv ( maxp ); + glVertex3f ( maxp[ 0 ], maxp[ 1 ], minp[ 2 ] ); + glVertex3f ( minp[ 0 ], maxp[ 1 ], minp[ 2 ] ); + + glEnd(); + if ( newList ) glEndList (); + + } else glCallList ( pd -> dlist ); + +} /* end draw_degenerates_as_bboxs */ + +void OpenGl_TriangleStrip::draw_line_loop () const +{ + int i; + + for ( i = 0; i < myData.num_facets; ++i ) + { + glBegin ( GL_LINE_LOOP ); + glVertex3fv ( myData.vertices[ i ].xyz ); + glVertex3fv ( myData.vertices[ i + 1 ].xyz ); + glVertex3fv ( myData.vertices[ i + 2 ].xyz ); + glEnd(); + } +} + +/*----------------------------------------------------------------------*/ + +OpenGl_TriangleStrip::OpenGl_TriangleStrip (const Graphic3d_Array1OfVertex& AListVertex) +{ + const Standard_Integer nv = AListVertex.Length(); + TEL_POINT *points = new TEL_POINT[nv]; + memcpy( points, &AListVertex(AListVertex.Lower()), nv*sizeof(TEL_POINT) ); + + Init(nv - 2,points,NULL,NULL,NULL,NULL,NULL); +} + +/*----------------------------------------------------------------------*/ + +OpenGl_TriangleStrip::OpenGl_TriangleStrip (const Graphic3d_Array1OfVertexN& AListVertex) +{ + const Standard_Integer nv = AListVertex.Length (); + + // Dynamic allocation + TEL_POINT *points = new TEL_POINT[nv]; + TEL_POINT *normals = new TEL_POINT[nv]; + + Standard_Integer i = 0, j = AListVertex.Lower(); + Standard_Real X, Y, Z; + for ( ; i < nv; i++, j++) + { + AListVertex(j).Coord (X, Y, Z); + points[i].xyz[0] = float (X); + points[i].xyz[1] = float (Y); + points[i].xyz[2] = float (Z); + AListVertex(j).Normal (X, Y, Z); + normals[i].xyz[0] = float (X); + normals[i].xyz[1] = float (Y); + normals[i].xyz[2] = float (Z); + } + + Init(nv - 2,points,normals,NULL,NULL,NULL,NULL); +} + +/*----------------------------------------------------------------------*/ + +OpenGl_TriangleStrip::OpenGl_TriangleStrip (const Graphic3d_Array1OfVertexNT& AListVertex) +{ + const Standard_Integer nv = AListVertex.Length(); + + // Dynamic allocation + TEL_POINT *points = new TEL_POINT[nv]; + TEL_POINT *normals = new TEL_POINT[nv]; + TEL_TEXTURE_COORD *tcoords = new TEL_TEXTURE_COORD[nv]; + + Standard_Integer i = 0, j = AListVertex.Upper(); + Standard_Real X, Y, Z; + for ( ; i < nv; i++, j++) + { + AListVertex(j).Coord (X, Y, Z); + points[i].xyz[0] = float (X); + points[i].xyz[1] = float (Y); + points[i].xyz[2] = float (Z); + AListVertex(j).Normal (X, Y, Z); + normals[i].xyz[0] = float (X); + normals[i].xyz[1] = float (Y); + normals[i].xyz[2] = float (Z); + AListVertex(j).TextureCoordinate(X, Y); + tcoords[i].xy[0] = float(X); + tcoords[i].xy[1] = float(Y); + } + + Init(nv - 2,points,normals,NULL,tcoords,NULL,NULL); +} + +/*----------------------------------------------------------------------*/ + +void OpenGl_TriangleStrip::Init (const Tint ANbFacets, tel_point AVertices, + tel_point AVNormals, tel_colour AVColors, tel_texture_coord ATCoords, + tel_point AFNormals, tel_colour AFColors) +{ + myData.num_facets = ANbFacets; + + const Tint nv = ANbFacets + 2; + + Tint i; + + // Store vertices + myData.vertices = AVertices; + + // Store or compute (based on vertices) facet normals + if (AFNormals) + { + myData.facet_flag = TEL_FA_NORMAL; + myData.fnormals = AFNormals; + for( i = 0; i < ANbFacets; i++ ) + vecnrm( myData.fnormals[i].xyz ); + } + else + { + myData.facet_flag = TEL_FA_NONE; + myData.fnormals = new TEL_POINT[ANbFacets]; + for( i = 0; i < ANbFacets; i++ ) + { + if( i & 1 ) { + TelGetNormal( myData.vertices[i].xyz, myData.vertices[i+2].xyz, myData.vertices[i+1].xyz, myData.fnormals[i].xyz ); + } else { + TelGetNormal( myData.vertices[i].xyz, myData.vertices[i+1].xyz, myData.vertices[i+2].xyz, myData.fnormals[i].xyz ); + } + } + } + + // Store or compute (based on facet normals) vertex normals + if (AVNormals) + { + myData.vertex_flag = TEL_VT_NORMAL; + myData.vnormals = AVNormals; + for( i = 0; i < nv; i++ ) + vecnrm( myData.vnormals[i].xyz ); + } + else + { + myData.vertex_flag = TEL_VT_NONE; + myData.vnormals = new TEL_POINT[nv]; + for( i = 2; i < ANbFacets; i++ ) + { + myData.vnormals[i].xyz[0] = ( myData.fnormals[i-2].xyz[0] + myData.fnormals[i-1].xyz[0] + myData.fnormals[i].xyz[0] ) / 3.0F; + myData.vnormals[i].xyz[1] = ( myData.fnormals[i-2].xyz[1] + myData.fnormals[i-1].xyz[1] + myData.fnormals[i].xyz[1] ) / 3.0F; + myData.vnormals[i].xyz[2] = ( myData.fnormals[i-2].xyz[2] + myData.fnormals[i-1].xyz[2] + myData.fnormals[i].xyz[2] ) / 3.0F; + } + myData.vnormals[0] = myData.fnormals[0]; + if( ANbFacets > 1 ) + { + myData.vnormals[1].xyz[0] = ( myData.fnormals[0].xyz[0] + myData.fnormals[1].xyz[0] ) / 2.0F; + myData.vnormals[1].xyz[1] = ( myData.fnormals[0].xyz[1] + myData.fnormals[1].xyz[1] ) / 2.0F; + myData.vnormals[1].xyz[2] = ( myData.fnormals[0].xyz[2] + myData.fnormals[1].xyz[2] ) / 2.0F; + } + else + myData.vnormals[1] = myData.fnormals[0]; + // last vertex + myData.vnormals[ANbFacets+1] = myData.fnormals[ANbFacets-1]; + // second last vertex + if( ANbFacets > 1 ) + { + myData.vnormals[ANbFacets].xyz[0] = ( myData.fnormals[ANbFacets-1].xyz[0] + myData.fnormals[ANbFacets-2].xyz[0] ) / 2.0F; + myData.vnormals[ANbFacets].xyz[1] = ( myData.fnormals[ANbFacets-1].xyz[1] + myData.fnormals[ANbFacets-2].xyz[1] ) / 2.0F; + myData.vnormals[ANbFacets].xyz[2] = ( myData.fnormals[ANbFacets-1].xyz[2] + myData.fnormals[ANbFacets-2].xyz[2] ) / 2.0F; + } + } + + myData.vcolours = AVColors; + myData.vtexturecoord = ATCoords; + myData.fcolours = AFColors; + + myDS = new DS_INTERNAL(); + myDS->list = 0; + myDS->dlist = 0; + myDS->degMode = 0; + myDS->model = -1; + myDS->skipRatio = 0.0F; + myDS->bDraw = new unsigned char[nv]; +} + +/*----------------------------------------------------------------------*/ + +OpenGl_TriangleStrip::~OpenGl_TriangleStrip () +{ + if( myData.fnormals ) + delete[] myData.fnormals; + if( myData.fcolours ) + delete[] myData.fcolours; + if( myData.vertices ) + delete[] myData.vertices; + if( myData.vcolours ) + delete[] myData.vcolours; + if( myData.vnormals ) + delete[] myData.vnormals; + if ( myData.vtexturecoord ) + delete[] myData.vtexturecoord; + + if ( myDS ) + { + if ( GET_GL_CONTEXT() != NULL ) + { + if ( myDS->list ) glDeleteLists ( myDS->list, 1 ); + if ( myDS->dlist ) glDeleteLists ( myDS->dlist, 1 ); + } + if ( myDS->bDraw ) + delete[] myDS->bDraw; + + delete myDS; + } +} + +/*----------------------------------------------------------------------*/ + +void OpenGl_TriangleStrip::Render (const Handle(OpenGl_Workspace) &AWorkspace) const +{ + const OpenGl_AspectFace *aspect_face = AWorkspace->AspectFace( Standard_True ); + + Tint front_lighting_model = aspect_face->Context().IntFront.color_mask; + const TEL_COLOUR *interior_colour = &aspect_face->Context().IntFront.matcol; + const TEL_COLOUR *edge_colour = &aspect_face->AspectEdge()->Color(); + + // Use highlight colors + if ( AWorkspace->NamedStatus & OPENGL_NS_HIGHLIGHT ) + { + edge_colour = interior_colour = AWorkspace->HighlightColor; + front_lighting_model = 0; + } + + glColor3fv( interior_colour->rgb ); + + draw_tmesh( front_lighting_model, + aspect_face->Context().InteriorStyle, + edge_colour, + AWorkspace ); +} + +/*----------------------------------------------------------------------*/ diff --git a/src/OpenGl/OpenGl_TriangleStrip.hxx b/src/OpenGl/OpenGl_TriangleStrip.hxx new file mode 100644 index 0000000000..78bede7bd2 --- /dev/null +++ b/src/OpenGl/OpenGl_TriangleStrip.hxx @@ -0,0 +1,64 @@ +// File: OpenGl_TriangleStrip.hxx +// Created: 13 July 2011 +// Author: Sergey ZERCHANINOV +// Copyright: OPEN CASCADE 2011 + +#ifndef OpenGl_TriangleStrip_Header +#define OpenGl_TriangleStrip_Header + +#include +#include +#include +#include +#include + +#include + +struct TEL_TMESH_DATA +{ + Tint num_facets; /* Number of facets */ + Tint facet_flag; /* TEL_FA_NONE or TEL_FA_NORMAL */ + Tint vertex_flag;/* TEL_VT_NONE or TEL_VT_NORMAL */ + tel_point fnormals; /* length = num_facets */ + tel_colour fcolours; /* length = num_facets */ + tel_point vertices; /* length = num_facets + 2 */ + tel_colour vcolours; /* length = num_facets + 2 */ + tel_point vnormals; /* length = num_facets + 2 */ + tel_texture_coord vtexturecoord; /* Texture coordinates */ + IMPLEMENT_MEMORY_OPERATORS +}; + +class OpenGl_TriangleStrip : public OpenGl_Element +{ + public: + + OpenGl_TriangleStrip (const Graphic3d_Array1OfVertex& AListVertex); + OpenGl_TriangleStrip (const Graphic3d_Array1OfVertexN& AListVertex); + OpenGl_TriangleStrip (const Graphic3d_Array1OfVertexNT& AListVertex); + virtual ~OpenGl_TriangleStrip (); + + virtual void Render (const Handle(OpenGl_Workspace) &AWorkspace) const; + + protected: + + void Init (const Tint ANbFacets, tel_point AVertices, + tel_point AVNormals, tel_colour AVColors, tel_texture_coord ATCoords, + tel_point AFNormals, tel_colour AFColors); + + void draw_tmesh (const Tint, /* front_lighting_model, */ + const Aspect_InteriorStyle, /* interior_style */ + const TEL_COLOUR *, /* edge_colour */ + const Handle(OpenGl_Workspace) &) const; + + void draw_edges (const TEL_COLOUR *, const Aspect_InteriorStyle, Tint, const Handle(OpenGl_Workspace) &) const; + + void draw_line_loop () const; + + TEL_TMESH_DATA myData; + DS_INTERNAL *myDS; + + public: + IMPLEMENT_MEMORY_OPERATORS +}; + +#endif //OpenGl_TriangleStrip_Header diff --git a/src/OpenGl/OpenGl_Trihedron.cxx b/src/OpenGl/OpenGl_Trihedron.cxx new file mode 100644 index 0000000000..07348fa7fb --- /dev/null +++ b/src/OpenGl/OpenGl_Trihedron.cxx @@ -0,0 +1,797 @@ +// File: OpenGl_Trihedron.cxx +// Created: 20 September 2011 +// Author: Sergey ZERCHANINOV +// Copyright: OPEN CASCADE 2011 + +#define QTOCC_PATCH /* Active QtOPENCASCADE patches */ + +#include + +#include +#include +#include +#include /* pour M_PI */ + +#include + +#include /* pour CALL_DEF_STRUCTURE */ +#include /* pour CALL_DEF_VIEW */ +#include + +#include + +#ifdef HAVE_GL2PS +#include +#endif + +#ifdef HAVE_CONFIG_H +#include +#endif +#ifdef HAVE_STRING_H +#include +#endif + +#include +#include +#include + +IMPLEMENT_STANDARD_HANDLE(OpenGl_Trihedron,MMgt_TShared) +IMPLEMENT_STANDARD_RTTIEXT(OpenGl_Trihedron,MMgt_TShared) + +/*----------------------------------------------------------------------*/ +/* +* Constantes +*/ + +#define NO_DEBUG +#define NO_PRINT +#define NO_PRINT_MATRIX + +#ifndef M_PI +# define M_PI 3.14159265358979323846 +#endif + +static const CALL_DEF_CONTEXTLINE myDefaultContextLine = +{ + 1, //IsDef + 1, //IsSet + { 1.F, 1.F, 1.F }, //Color + Aspect_TOL_SOLID, //LineType + 1.F //Width +}; + +static const CALL_DEF_CONTEXTTEXT myDefaultContextText = +{ + 1, //IsDef + 1, //IsSet + "Courier", //Font + 0.3F, //Space + 1.0F, //Expan + { 1.F, 1.F, 1.F }, //Color + Aspect_TOST_NORMAL, //Style + Aspect_TODT_NORMAL, //DisplayType + { 1.F, 1.F, 1.F }, //ColorSubTitle + 0, //TextZoomable + 0.F, //TextAngle + OSD_FA_Regular //TextFontAspect +}; + +/*----------------------------------------------------------------------*/ +/* +* Variables statiques +*/ + +/* Default parameters for ZBUFFER triheron */ +static TEL_COLOUR theXColor = {{ 1.F, 0.F, 0.F, 0.6F }}; +static TEL_COLOUR theYColor = {{ 0.F, 1.F, 0.F, 0.6F }}; +static TEL_COLOUR theZColor = {{ 0.F, 0.F, 1.F, 0.6F }}; +static float theRatio = 0.8f; +static float theDiameter = 0.05f; +static int theNbFacettes = 12; + +/*----------------------------------------------------------------------*/ + +/* +* affichage d'un triedre non zoomable a partir des index dans les tables +* des structures non zoomables. +* +* Triedre = Objet non Zoomable : +* on recalcule ses dimensions et son origine en fonction de la taille +* de la fenetre; on positionne selon le choix de l'init; +* et on inhibe seulement les translations. +* +*/ + +//call_triedron_redraw +void OpenGl_Trihedron::Redraw (const Handle(OpenGl_Workspace) &AWorkspace) const +{ + const Standard_Real U = AWorkspace->ActiveView()->Height(); + const Standard_Real V = AWorkspace->ActiveView()->Width(); + + /* la taille des axes est 1 proportion (fixee a l'init du triedre) */ + /* de la dimension la plus petite de la window. */ + const GLdouble L = ( U < V ? U : V ) * myScale; + + /* + * On inhibe les translations; on conserve les autres transformations. + */ + + /* on lit les matrices de transformation et de projection de la vue */ + /* pour annuler les translations (dernieres colonnes des matrices). */ + GLdouble modelMatrix[4][4]; + glGetDoublev( GL_MODELVIEW_MATRIX, (GLdouble *) modelMatrix ); + GLdouble projMatrix[4][4]; + glGetDoublev( GL_PROJECTION_MATRIX, (GLdouble *) projMatrix ); + + /* on annule la translation qui peut etre affectee a la vue */ + modelMatrix[3][0] = 0.; + modelMatrix[3][1] = 0.; + modelMatrix[3][2] = 0.; + projMatrix[3][0] = 0.; + projMatrix[3][1] = 0.; + projMatrix[3][2] = 0.; + + /* sauvegarde du contexte des matrices avant chargement */ + glMatrixMode (GL_MODELVIEW); + glPushMatrix (); + glLoadMatrixd( (GLdouble *) modelMatrix ); + glMatrixMode ( GL_PROJECTION ); + glPushMatrix (); + glLoadMatrixd( (GLdouble *) projMatrix ); + + /* + * Positionnement de l'origine du triedre selon le choix de l'init + */ + + /* on fait uniquement une translation de l'origine du Triedre */ + + switch (myPos) + { + case Aspect_TOTP_LEFT_LOWER : + glTranslated( -0.5*U + L , -0.5*V + L , 0. ); + break; + + case Aspect_TOTP_LEFT_UPPER : + glTranslated( -0.5*U + L , +0.5*V - L -L/3., 0. ); + break; + + case Aspect_TOTP_RIGHT_LOWER : + glTranslated( 0.5*U - L -L/3. , -0.5*V + L , 0. ); + break; + + case Aspect_TOTP_RIGHT_UPPER : + glTranslated( 0.5*U - L -L/3. , +0.5*V - L -L/3. , 0. ); + break; + + //case Aspect_TOTP_CENTER : + default : + break; + } + + /* + * Creation du triedre + */ + const OpenGl_AspectLine *AspectLine = AWorkspace->AspectLine( Standard_True ); + +#ifdef QTOCC_PATCH /* Fotis Sioutis 2007-11-14 15:06 + I have also seen in previous posts that the view trihedron in V3d_WIREFRAME mode + changes colors depending on the state of the view. This behaviour can be easily + corrected by altering call_triedron_redraw function in OpenGl_triedron.c of TKOpengl. + The only change needed is to erase glDisable(GL_LIGHTING) that is called before the + Axis name drawing and move this function call just before the initial axis drawing. + Below is the code portion with the modification.I don't know if this is considered to + be a bug but anyway i believe it might help some of you out there.*/ + glDisable(GL_LIGHTING); +#endif + + /* Position de l'origine */ + const GLdouble TriedronOrigin[3] = { 0.0, 0.0, 0.0 }; + + /* Position des Axes */ + GLdouble TriedronAxeX[3] = { 1.0, 0.0, 0.0 }; + GLdouble TriedronAxeY[3] = { 0.0, 1.0, 0.0 }; + GLdouble TriedronAxeZ[3] = { 0.0, 0.0, 1.0 }; + TriedronAxeX[0] = L ; + TriedronAxeY[1] = L ; + TriedronAxeZ[2] = L ; + + /* dessin des axes */ + glBegin(GL_LINES); + glVertex3dv( TriedronOrigin ); + glVertex3dv( TriedronAxeX ); + + glVertex3dv( TriedronOrigin ); + glVertex3dv( TriedronAxeY ); + + glVertex3dv( TriedronOrigin ); + glVertex3dv( TriedronAxeZ ); + glEnd(); + + /* fleches au bout des axes (= cones de la couleur demandee) */ + const GLdouble l = 0.75*L; /* distance a l'origine */ + const GLdouble rayon = L/30. ; /* rayon de la base du cone */ + const int NbFacettes = 12; /* le cone sera compose de 12 facettes triangulaires */ + const double Angle = 2. * M_PI/ NbFacettes; + + int ii; + GLdouble TriedronCoord[3] = { 1.0, 0.0, 0.0 }; + + /* solution FILAIRE des cones au bout des axes : une seule ligne */ + glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); + /* (la couleur est deja initialisee dans AspectLine) */ + /* FIN de la solution FILAIRE CHOISIE pour les cones des axes */ + + /* fleche en X */ + glBegin(GL_TRIANGLE_FAN); + glVertex3dv( TriedronAxeX ); + TriedronCoord[0] = l; + ii = NbFacettes; + while (ii >= 0 ) { + TriedronCoord[1] = rayon * sin(ii * Angle); + TriedronCoord[2] = rayon * cos(ii * Angle); + glVertex3dv( TriedronCoord ); + ii--; + } + glEnd(); + + /* fleche en Y */ + glBegin(GL_TRIANGLE_FAN); + glVertex3dv( TriedronAxeY ); + TriedronCoord[1] = l; + ii = NbFacettes; + while (ii >= 0 ) { + TriedronCoord[0] = rayon * cos(ii * Angle); + TriedronCoord[2] = rayon * sin(ii * Angle); + glVertex3dv( TriedronCoord ); + ii--; + } + glEnd(); + + /* fleche en Z */ + glBegin(GL_TRIANGLE_FAN); + glVertex3dv( TriedronAxeZ ); + TriedronCoord[2] = l; + ii = NbFacettes; + while (ii >= 0 ) { + TriedronCoord[0] = rayon * sin(ii * Angle); + TriedronCoord[1] = rayon * cos(ii * Angle); + glVertex3dv( TriedronCoord ); + ii--; + } + glEnd(); + + /* dessin de l'origine */ + TriedronCoord[2] = 0.0 ; + ii = 24 ; + const double Angle1 = 2. * M_PI/ ii; + glBegin(GL_LINE_LOOP); + while (ii >= 0 ) { + TriedronCoord[0] = rayon * sin(ii * Angle1); + TriedronCoord[1] = rayon * cos(ii * Angle1); + glVertex3dv( TriedronCoord ); + ii--; + } + glEnd(); + + /* + * Noms des axes et de l'origine + */ + const OpenGl_AspectText *AspectText = AWorkspace->AspectText( Standard_True ); + glColor3fv (AspectText->Color().rgb); + + AWorkspace->RenderText (L"X", 0, float(L + rayon), 0.0f, float(-rayon)); + AWorkspace->RenderText (L"Y", 0, float(rayon), float(L + 3.0 * rayon), float(2.0 * rayon)); + AWorkspace->RenderText (L"Z", 0, float(-2.0 * rayon), float(0.5 * rayon), float(L + 3.0 * rayon)); + + /* + * restauration du contexte des matrices + */ + glMatrixMode (GL_PROJECTION); + glPopMatrix (); + glMatrixMode (GL_MODELVIEW); + glPopMatrix (); +} + + +/******************************************************* +* Draws ZBUFFER trihedron mode +*******************************************************/ +//call_zbuffer_triedron_redraw +void OpenGl_Trihedron::RedrawZBuffer (const Handle(OpenGl_Workspace) &AWorkspace) const +{ + const Standard_Real U = AWorkspace->ActiveView()->Height(); + const Standard_Real V = AWorkspace->ActiveView()->Width(); + + GLdouble modelMatrix[4][4]; + glGetDoublev( GL_MODELVIEW_MATRIX, (GLdouble *) modelMatrix ); + GLdouble projMatrix[4][4]; + glGetDoublev( GL_PROJECTION_MATRIX, (GLdouble *) projMatrix ); + + /* Check position in the ViewPort */ +#ifdef QTOCC_PATCH /* PCD 29/09/2008 */ + /* Simple code modification recommended by Fotis Sioutis and Peter Dolbey */ + /* to remove the irritating default behaviour of triedrons using V3d_ZBUFFER */ + /* which causes the glyph to jump around the screen when the origin moves offscreen. */ + GLboolean isWithinView = GL_FALSE; +#else + /* Original code */ + GLint aViewPort[4]; /* to store view port coordinates */ + glGetIntegerv(GL_VIEWPORT, aViewPort); + GLdouble aWinCoord[3]; + /* Position de l'origine */ + const GLdouble TriedronOrigin[3] = { 0.0, 0.0, 0.0 }; + gluProject(TriedronOrigin[0], TriedronOrigin[1], TriedronOrigin[2], + (GLdouble *)modelMatrix, (GLdouble *)projMatrix, aViewPort, + &aWinCoord[0], &aWinCoord[1], &aWinCoord[2]); + + GLboolean isWithinView = !((aWinCoord[0]aViewPort[2]) || + (aWinCoord[1]aViewPort[3])); +#endif + + /* la taille des axes est 1 proportion (fixee a l'init du triedre) */ + /* de la dimension la plus petite de la window. */ + GLdouble L = ( U < V ? U : V ) * myScale; + + if (!isWithinView) + { + /* Annulate translation matrix */ + modelMatrix[3][0] = 0.; + modelMatrix[3][1] = 0.; + modelMatrix[3][2] = 0.; + projMatrix[3][0] = 0.; + projMatrix[3][1] = 0.; + projMatrix[3][2] = 0.; + + /* save matrix */ + glMatrixMode (GL_MODELVIEW); + glPushMatrix (); + //glLoadIdentity (); + glLoadMatrixd( (GLdouble *) modelMatrix); + glMatrixMode ( GL_PROJECTION ); + glPushMatrix (); + //glLoadIdentity(); + glLoadMatrixd( (GLdouble *) projMatrix); + + /* + * Define position in the view + */ + switch (myPos) + { + case Aspect_TOTP_LEFT_LOWER : + glTranslated( -0.5*U + L , -0.5*V + L , 0. ); + break; + + case Aspect_TOTP_LEFT_UPPER : + glTranslated( -0.5*U + L , +0.5*V - L -L/3. , 0. ); + break; + + case Aspect_TOTP_RIGHT_LOWER : + glTranslated( 0.5*U - L -L/3. , -0.5*V + L , 0. ); + break; + + case Aspect_TOTP_RIGHT_UPPER : + glTranslated( 0.5*U - L -L/3. , +0.5*V - L -L/3. , 0. ); + break; + + //case Aspect_TOTP_CENTER : + default : + break; + } + L *= myRatio; + } + + const OpenGl_AspectLine *AspectLine = AWorkspace->AspectLine( Standard_True ); + const TEL_COLOUR &aLineColor = AspectLine->Color(); + + /* + * Creation the trihedron + */ +#define CYLINDER_LENGTH 0.75f + + const GLuint startList = glGenLists(4); + GLUquadricObj* aQuadric = gluNewQuadric(); + + const GLboolean aIsDepthEnabled = glIsEnabled(GL_DEPTH_TEST); + +#ifndef BUG + + GLboolean aIsDepthMaskEnabled; +#ifdef QTOCC_PATCH /*PCD 02/07/07 */ + /* GL_DEPTH_WRITEMASK is not a valid argument to glIsEnabled, the */ + /* original code is shown to be broken when run under an OpenGL debugger */ + /* like GLIntercept. This is the correct way to retrieve the mask value. */ + glGetBooleanv(GL_DEPTH_WRITEMASK, &aIsDepthMaskEnabled); +#else + aIsDepthMaskEnabled = glIsEnabled(GL_DEPTH_WRITEMASK); +#endif + +#endif + + const GLdouble aCylinderLength = L * CYLINDER_LENGTH; + const GLdouble aCylinderDiametr = L * myDiameter; + const GLdouble aConeDiametr = aCylinderDiametr * 2.; + const GLdouble aConeLength = L * (1 - CYLINDER_LENGTH); + /* Correct for owerlapping */ + /* aCylinderLength += aConeLength - 1.2*aCylinderDiametr*aConeLength/aConeDiametr;*/ + + /* Create cylinder for axis */ + gluQuadricDrawStyle(aQuadric, GLU_FILL); /* smooth shaded */ + gluQuadricNormals(aQuadric, GLU_FLAT); + /* Axis */ + glNewList(startList, GL_COMPILE); + gluCylinder(aQuadric, aCylinderDiametr, aCylinderDiametr, aCylinderLength, myNbFacettes, 1); + glEndList(); + /* Cone */ + glNewList(startList + 1, GL_COMPILE); + gluCylinder(aQuadric, aConeDiametr, 0., aConeLength, myNbFacettes, 1); + glEndList(); + /* Central sphere */ + glNewList(startList + 2, GL_COMPILE); + gluSphere(aQuadric, aCylinderDiametr * 2., myNbFacettes, myNbFacettes); + glEndList(); + /* End disk */ + gluQuadricOrientation(aQuadric,GLU_INSIDE); /*szv*/ + glNewList(startList + 3, GL_COMPILE); + gluDisk(aQuadric, aCylinderDiametr, aConeDiametr, myNbFacettes, 1/*szv:2*/); + glEndList(); + + /* Store previous attributes */ + glPushAttrib(GL_LIGHTING_BIT | GL_POLYGON_BIT); + glEnable(GL_LIGHTING); + + glCullFace(GL_BACK); + glEnable(GL_CULL_FACE); + +#ifdef QTOCC_PATCH /*Fotis Sioutis | 2008-01-21 10:55 + In the function call_zbuffer_triedron_redraw of TKOpengl, + the z buffered trihedron changes colors in case there + is an object in the scene that has an explicit material + attached to it.In the trihedron display loop, + GL_COLOR_MATERIAL is enabled, but only the GL_DIFFUSE + parameter is utilized in glColorMaterial(...). + This causes the last ambient,specular and emission values + used, to stay at the stack and applied to the trihedron + (which causes the color change). + A fix is proposed , to change GL_DIFFUSE to + GL_AMBIENT_AND_DIFFUSE in glColorMaterial call in + line 946.The above of course will leave unchanged + the SPECULAR and EMISSION values. + Another proposal which would fix 100% the problem + is to use glMaterial instead of glColor on the trihedron + drawing loop. */ + const GLfloat aNULLColor[] = { 0.f, 0.f, 0.f, 0.f }; /* FS 21/01/08 */ + glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, aNULLColor); + glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, aNULLColor); + glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, aNULLColor); + glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 0.f); +#endif + + glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE); + glEnable(GL_COLOR_MATERIAL); + + if (!aIsDepthEnabled) { + glEnable(GL_DEPTH_TEST); +#ifndef BUG + glClear(GL_DEPTH_BUFFER_BIT); +#endif + } +#ifdef BUG + if (!(aIsDepthEnabled && isWithinView)) + glClear(GL_DEPTH_BUFFER_BIT); +#endif + +#ifndef BUG + if (!aIsDepthMaskEnabled) { + /* This is how the depthmask needs to be re-enabled...*/ + glDepthMask(GL_TRUE); + /* ...and not this stuff below */ + } +#endif + + /* Position des Axes */ + GLdouble TriedronAxeX[3] = { 1.0, 0.0, 0.0 }; + GLdouble TriedronAxeY[3] = { 0.0, 1.0, 0.0 }; + GLdouble TriedronAxeZ[3] = { 0.0, 0.0, 1.0 }; + TriedronAxeX[0] = L; + TriedronAxeY[1] = L; + TriedronAxeZ[2] = L; + + glMatrixMode(GL_MODELVIEW); + +#ifdef QTOCC_PATCH /* PCD 17/06/07 */ + GLint df; + glGetIntegerv (GL_DEPTH_FUNC, &df); +#else + /* +#define COLOR_REDUCE 0.3f +#ifdef BUG +#define ALPHA_REDUCE 0.4f +#else +#define ALPHA_REDUCE 1.0f +#endif + //szv:if (isWithinView) { + glDepthFunc(GL_GREATER); + glPushMatrix(); + glPushMatrix(); + glPushMatrix(); + + glColor4f(aLineColor.rgb[0]*COLOR_REDUCE, + aLineColor.rgb[1]*COLOR_REDUCE, + aLineColor.rgb[2]*COLOR_REDUCE, + ALPHA_REDUCE); + glCallList(startList+2); + + // Z axis + glColor4f(myZColor.rgb[0]*COLOR_REDUCE, + myZColor.rgb[1]*COLOR_REDUCE, + myZColor.rgb[2]*COLOR_REDUCE, + ALPHA_REDUCE); + glCallList(startList); + glTranslated(0, 0, L * CYLINDER_LENGTH); + glCallList(startList + 3); + glCallList(startList + 1); + glPopMatrix(); + + // X axis + glRotated(90.0, TriedronAxeY[0], TriedronAxeY[1], TriedronAxeY[2]); + glColor4f(myXColor.rgb[0]*COLOR_REDUCE, + myXColor.rgb[1]*COLOR_REDUCE, + myXColor.rgb[2]*COLOR_REDUCE, + ALPHA_REDUCE); + glCallList(startList); + glTranslated(0, 0, L * CYLINDER_LENGTH); + glCallList(startList + 3); + glCallList(startList + 1); + glPopMatrix(); + + // Y axis + glRotated(-90.0, TriedronAxeX[0], TriedronAxeX[1], TriedronAxeX[2]); + glColor4f(myYColor.rgb[0]*COLOR_REDUCE, + myYColor.rgb[1]*COLOR_REDUCE, + myYColor.rgb[2]*COLOR_REDUCE, + ALPHA_REDUCE); + glCallList(startList); + glTranslated(0, 0, L * CYLINDER_LENGTH); + glCallList(startList + 3); + glCallList(startList + 1); + glPopMatrix(); + + glDepthFunc(GL_LESS); + //szv:} + */ +#endif + +#ifdef QTOCC_PATCH + int i; + for (i = 0; i < 2; i++) /* PCD 11/02/08 Two pass method */ + { + if (i == 0) /* First pass */ + { + glDepthFunc(GL_ALWAYS); + } + else + { + glDepthFunc(GL_LEQUAL); + } +#endif + + glPushMatrix(); + glPushMatrix(); + glPushMatrix(); + + glColor3fv(aLineColor.rgb); + glCallList(startList+2); + + // Z axis + glColor4fv(myZColor.rgb); + glCallList(startList); + glTranslated(0, 0, L * CYLINDER_LENGTH); + glCallList(startList + 3); + glCallList(startList + 1); + glPopMatrix(); + + // X axis + glRotated(90.0, TriedronAxeY[0], TriedronAxeY[1], TriedronAxeY[2]); + glColor4fv(myXColor.rgb); + glCallList(startList); + glTranslated(0, 0, L * CYLINDER_LENGTH); + glCallList(startList + 3); + glCallList(startList + 1); + glPopMatrix(); + + // Y axis + glRotated(-90.0, TriedronAxeX[0], TriedronAxeX[1], TriedronAxeX[2]); + glColor4fv(myYColor.rgb); + glCallList(startList); + glTranslated(0, 0, L * CYLINDER_LENGTH); + glCallList(startList + 3); + glCallList(startList + 1); + glPopMatrix(); + +#ifdef QTOCC_PATCH + } +#endif + + if (!aIsDepthEnabled) + glDisable(GL_DEPTH_TEST); +#ifndef BUG + if (!aIsDepthMaskEnabled) + +#ifdef QTOCC_PATCH /*PCD 02/07/07 */ + glDepthMask(GL_FALSE); +#else + glDisable(GL_DEPTH_WRITEMASK); +#endif + +#endif + glDisable(GL_CULL_FACE); + glDisable(GL_COLOR_MATERIAL); + + gluDeleteQuadric(aQuadric); + glColor3fv (aLineColor.rgb); + +#ifdef QTOCC_PATCH /* PCD 11/02/08 */ + /* Always write the text */ + glDepthFunc(GL_ALWAYS); +#endif + + glPopAttrib(); + + /* fleches au bout des axes (= cones de la couleur demandee) */ + //const GLdouble l = 0.75*L; /* distance a l'origine */ + const GLdouble rayon = L/30. ; /* rayon de la base du cone */ + //const double Angle = 2. * M_PI/ myNbFacettes; + + glDeleteLists(startList, 4); + + glDisable(GL_LIGHTING); + + /* + * origine names + */ + const OpenGl_AspectText *AspectText = AWorkspace->AspectText( Standard_True ); + glColor3fv (AspectText->Color().rgb); + + AWorkspace->RenderText (L"X", 0, float(L + rayon), 0.0f, float(-rayon)); + AWorkspace->RenderText (L"Y", 0, float(rayon), float(L + 3.0 * rayon), float(2.0 * rayon)); + AWorkspace->RenderText (L"Z", 0, float(-2.0 * rayon), float(0.5 * rayon), float(L + 3.0 * rayon)); + +#ifdef QTOCC_PATCH + /*PCD 17/06/07 */ + glDepthFunc(df); +#endif + + if (!isWithinView) { /* restore matrix */ + glMatrixMode (GL_PROJECTION); + glPopMatrix (); + glMatrixMode (GL_MODELVIEW); + glPopMatrix (); + } +} + + +/*----------------------------------------------------------------------*/ + +/*----------------------------------------------------------------------*/ +/* +* Fonctions publiques +*/ + + +/* +* initialisation d'un triedre non zoomable dans une vue. +* ou modification des valeurs deja initialisees. +*/ + +//call_triedron_init +OpenGl_Trihedron::OpenGl_Trihedron (const Aspect_TypeOfTriedronPosition APosition, const Quantity_NameOfColor AColor, + const Standard_Real AScale, const Standard_Boolean AsWireframe) +: myPos(APosition), + myScale(AScale), + myIsWireframe(AsWireframe) +{ + Standard_Real R,G,B; + Quantity_Color Color(AColor); + Color.Values(R,G,B,Quantity_TOC_RGB); + + CALL_DEF_CONTEXTLINE aContextLine = myDefaultContextLine; + aContextLine.Color.r = (float)R; + aContextLine.Color.g = (float)G; + aContextLine.Color.b = (float)B; + myAspectLine.SetContext(aContextLine); + + CALL_DEF_CONTEXTTEXT aContextText = myDefaultContextText; + aContextText.Color.r = (float)R; + aContextText.Color.g = (float)G; + aContextText.Color.b = (float)B; + myAspectText.SetContext(aContextText); + + myXColor = theXColor; + myYColor = theYColor; + myZColor = theZColor; + + myRatio = theRatio; + myDiameter = theDiameter; + myNbFacettes = theNbFacettes; +} + +/*----------------------------------------------------------------------*/ + +/* +* destruction du triedre non zoomable d'une vue. +*/ + +//call_triedron_erase +OpenGl_Trihedron::~OpenGl_Trihedron () +{ +} + +/*----------------------------------------------------------------------*/ + +/* +* affichage d'un triedre non zoomable dans la wks awsid +* +* Triedre = Objet non Zoomable; +* on cree cette fonction pour pouvoir travailler par les structures +* utilisees par les fonctions Tsm* et TEL_VIEW_REP +* +*/ + +//call_triedron_redraw_from_wsid +void OpenGl_Trihedron::Render (const Handle(OpenGl_Workspace) &AWorkspace) const +{ + const OpenGl_AspectLine *oldAspectLine = AWorkspace->SetAspectLine(&myAspectLine); + const OpenGl_AspectText *oldAspectText = AWorkspace->SetAspectText(&myAspectText); + + /* check if GL_LIGHTING should be disabled + no enabling 'cause it will be done (if necessary: kinda Polygon types ) + during redrawing structures + */ + if (!AWorkspace->UseGLLight()) + glDisable( GL_LIGHTING ); + + /* sauvegarde du contexte (on reste dans le buffer courant) */ + const GLboolean save_texture_state = IsTextureEnabled(); + DisableTexture(); + + /* affichage du Triedre Non Zoomable */ + AWorkspace->ActiveView()->EndTransformPersistence(); + + if (myIsWireframe) + Redraw (AWorkspace); + else + RedrawZBuffer (AWorkspace); + + /* restauration du contexte */ + if (save_texture_state) EnableTexture(); + + AWorkspace->SetAspectText(oldAspectText); + AWorkspace->SetAspectLine(oldAspectLine); +} + +/*----------------------------------------------------------------------*/ +//call_ztriedron_setup +void OpenGl_Trihedron::Setup (const Quantity_NameOfColor XColor, const Quantity_NameOfColor YColor, const Quantity_NameOfColor ZColor, + const Standard_Real SizeRatio, const Standard_Real AxisDiametr, const Standard_Integer NbFacettes) +{ + Standard_Real R,G,B; + + Quantity_Color(XColor).Values(R, G, B, Quantity_TOC_RGB); + theXColor.rgb[0] = float (R); + theXColor.rgb[1] = float (G); + theXColor.rgb[2] = float (B); + + Quantity_Color(YColor).Values(R, G, B, Quantity_TOC_RGB); + theYColor.rgb[0] = float (R); + theYColor.rgb[1] = float (G); + theYColor.rgb[2] = float (B); + + Quantity_Color(ZColor).Values(R, G, B, Quantity_TOC_RGB); + theZColor.rgb[0] = float (R); + theZColor.rgb[1] = float (G); + theZColor.rgb[2] = float (B); + + theRatio = float (SizeRatio); + theDiameter = float (AxisDiametr); + theNbFacettes = NbFacettes; +} diff --git a/src/OpenGl/OpenGl_Trihedron.hxx b/src/OpenGl/OpenGl_Trihedron.hxx new file mode 100644 index 0000000000..f1d6930ebe --- /dev/null +++ b/src/OpenGl/OpenGl_Trihedron.hxx @@ -0,0 +1,55 @@ +// File: OpenGl_Trihedron.hxx +// Created: 20 September 2011 +// Author: Sergey ZERCHANINOV +// Copyright: OPEN CASCADE 2011 + +#ifndef _OpenGl_Trihedron_Header +#define _OpenGl_Trihedron_Header + +#include + +#include +#include + +#include +#include + +class OpenGl_Trihedron : public MMgt_TShared +{ + public: + OpenGl_Trihedron (const Aspect_TypeOfTriedronPosition APosition, const Quantity_NameOfColor AColor, const Standard_Real AScale, const Standard_Boolean AsWireframe); + virtual ~OpenGl_Trihedron (); + + static void Setup (const Quantity_NameOfColor XColor, const Quantity_NameOfColor YColor, const Quantity_NameOfColor ZColor, + const Standard_Real SizeRatio, const Standard_Real AxisDiametr, const Standard_Integer NbFacettes); + + void Render (const Handle(OpenGl_Workspace) &AWorkspace) const; + + // Type definition + // + DEFINE_STANDARD_RTTI(OpenGl_Trihedron) + + protected: + + void Redraw (const Handle(OpenGl_Workspace) &AWorkspace) const; + void RedrawZBuffer (const Handle(OpenGl_Workspace) &AWorkspace) const; + + Aspect_TypeOfTriedronPosition myPos; + Standard_Real myScale; + Standard_Boolean myIsWireframe; + // Parameters for zbuffered mode + TEL_COLOUR myXColor; + TEL_COLOUR myYColor; + TEL_COLOUR myZColor; + float myRatio; + float myDiameter; + int myNbFacettes; + + OpenGl_AspectLine myAspectLine; + OpenGl_AspectText myAspectText; + + public: + IMPLEMENT_MEMORY_OPERATORS +}; + +#endif //_OpenGl_Trihedron_Header diff --git a/src/OpenGl/OpenGl_View.cxx b/src/OpenGl/OpenGl_View.cxx new file mode 100644 index 0000000000..c4d986fc9a --- /dev/null +++ b/src/OpenGl/OpenGl_View.cxx @@ -0,0 +1,645 @@ +// File: OpenGl_View.cxx +// Created: 20 September 2011 +// Author: Sergey ZERCHANINOV +// Copyright: OPEN CASCADE 2011 + +#include + +#include +#include + +#include +#include + +#include +#include +#include + +#include + +IMPLEMENT_STANDARD_HANDLE(OpenGl_View,MMgt_TShared) +IMPLEMENT_STANDARD_RTTIEXT(OpenGl_View,MMgt_TShared) + +/*----------------------------------------------------------------------*/ + +static const OPENGL_BG_TEXTURE myDefaultBgTexture = { 0, 0, 0, Aspect_FM_CENTERED }; +static const OPENGL_BG_GRADIENT myDefaultBgGradient = { {{ 0.F, 0.F, 0.F, 1.F }}, {{ 0.F, 0.F, 0.F, 1.F }}, Aspect_GFM_NONE }; +static const Tmatrix3 myDefaultMatrix = { { 1.F, 0.F, 0.F, 0.F }, { 0.F, 1.F, 0.F, 0.F }, { 0.F, 0.F, 1.F, 0.F }, { 0.F, 0.F, 0.F, 1.F } }; +static const OPENGL_ZCLIP myDefaultZClip = { { Standard_True, 0.F }, { Standard_True, 1.F } }; +static const OPENGL_EXTRA_REP myDefaultExtra = +{ + //vrp + { 0.F, 0.F, 0.F }, + //vpn + { 0.F, 0.F, 1.F }, + //vup + { 0.F, 1.F, 0.F }, + //map + { + //window + { 0.F, 0.F, 1.F, 1.F }, + //viewport + { 0.F, 0.F, 0.F, 1.F, 1.F, 1.F }, + //proj + TelParallel, + //prp + { 0.F, 0.F, 0.F }, + //vpd + 0.F, + //fpd + 0.F, + //bpd + -1.F + }, + //scaleFactors + { 1.F, 1.F, 1.F } +}; + +static const OPENGL_FOG myDefaultFog = { Standard_False, 0.F, 1.F, { { 0.F, 0.F, 0.F, 1.F } } }; +static const TEL_TRANSFORM_PERSISTENCE myDefaultTransPers = { 0, 0.F, 0.F, 0.F }; + +/*----------------------------------------------------------------------*/ + +OpenGl_View::OpenGl_View (const CALL_DEF_VIEWCONTEXT &AContext) +: myTextureEnv(0), + mySurfaceDetail(Visual3d_TOD_NONE), + myBackfacing(0), + myBgTexture(myDefaultBgTexture), + myBgGradient(myDefaultBgGradient), + //myOrientationMatrix(myDefaultMatrix), + //myMappingMatrix(myDefaultMatrix), + //shield_indicator = TOn, + //shield_colour = { { 0.F, 0.F, 0.F, 1.F } }, + //border_indicator = TOff, + //border_colour = { { 0.F, 0.F, 0.F, 1.F } }, + //active_status = TOn, + myZClip(myDefaultZClip), + myExtra(myDefaultExtra), + myFog(myDefaultFog), + myVisualization(AContext.Visualization), + myIntShadingMethod(TEL_SM_GOURAUD), + myAntiAliasing(Standard_False), + myAnimationListIndex(0), + myAnimationListReady(Standard_False), + myTransPers(&myDefaultTransPers), + myIsTransPers(Standard_False), + myResetFLIST(Standard_False) +{ + // Initialize matrices + memcpy(myOrientationMatrix,myDefaultMatrix,sizeof(Tmatrix3)); + memcpy(myMappingMatrix,myDefaultMatrix,sizeof(Tmatrix3)); + + // Shading method + switch (AContext.Model) + { + case 1 : /* VISUAL3D_TOM_INTERP_COLOR */ + case 3 : /* VISUAL3D_TOM_VERTEX */ + myIntShadingMethod = TEL_SM_GOURAUD; + break; + default : + myIntShadingMethod = TEL_SM_FLAT; + break; + } +} + +/*----------------------------------------------------------------------*/ + +OpenGl_View::~OpenGl_View () +{ + if (myAnimationListIndex) + glDeleteLists((GLuint)myAnimationListIndex,1); + + if ( myBgTexture.TexId != 0 ) + glDeleteTextures( 1, (GLuint*)&(myBgTexture.TexId) ); +} + +/*----------------------------------------------------------------------*/ + +void OpenGl_View::SetBackfacing (const Standard_Integer AMode) +{ + myBackfacing = AMode; + myResetFLIST = Standard_True; +} + +/*----------------------------------------------------------------------*/ + +//call_togl_setlight +void OpenGl_View::SetLights (const CALL_DEF_VIEWCONTEXT &AContext) +{ + myLights.Clear(); + + const int nb_lights = AContext.NbActiveLight; + + int i = 0; + const CALL_DEF_LIGHT *alight = &(AContext.ActiveLight[0]); + for ( ; i < nb_lights; i++, alight++ ) + { + OpenGl_Light rep; + + switch( alight->LightType ) + { + case 0 : /* TOLS_AMBIENT */ + rep.type = TLightAmbient; + rep.col.rgb[0] = alight->Color.r; + rep.col.rgb[1] = alight->Color.g; + rep.col.rgb[2] = alight->Color.b; + break; + + case 1 : /* TOLS_DIRECTIONAL */ + rep.type = TLightDirectional; + rep.col.rgb[0] = alight->Color.r; + rep.col.rgb[1] = alight->Color.g; + rep.col.rgb[2] = alight->Color.b; + rep.dir[0] = alight->Direction.x; + rep.dir[1] = alight->Direction.y; + rep.dir[2] = alight->Direction.z; + break; + + case 2 : /* TOLS_POSITIONAL */ + rep.type = TLightPositional; + rep.col.rgb[0] = alight->Color.r; + rep.col.rgb[1] = alight->Color.g; + rep.col.rgb[2] = alight->Color.b; + rep.pos[0] = alight->Position.x; + rep.pos[1] = alight->Position.y; + rep.pos[2] = alight->Position.z; + rep.atten[0] = alight->Attenuation[0]; + rep.atten[1] = alight->Attenuation[1]; + break; + + case 3 : /* TOLS_SPOT */ + rep.type = TLightSpot; + rep.col.rgb[0] = alight->Color.r; + rep.col.rgb[1] = alight->Color.g; + rep.col.rgb[2] = alight->Color.b; + rep.pos[0] = alight->Position.x; + rep.pos[1] = alight->Position.y; + rep.pos[2] = alight->Position.z; + rep.dir[0] = alight->Direction.x; + rep.dir[1] = alight->Direction.y; + rep.dir[2] = alight->Direction.z; + rep.shine = alight->Concentration; + rep.atten[0] = alight->Attenuation[0]; + rep.atten[1] = alight->Attenuation[1]; + rep.angle = alight->Angle; + break; + } + + rep.HeadLight = alight->Headlight; + + myLights.Append(rep); + } +} + +/*----------------------------------------------------------------------*/ + +//call_togl_setplane +void OpenGl_View::SetClippingPlanes (const CALL_DEF_VIEWCONTEXT &AContext) +{ + // clear clipping planes information + myClippingPlanes.Clear(); + // update information + int i = 0; + for (; i < AContext.NbActivePlane; i++) + { + const CALL_DEF_PLANE &aCPlane = AContext.ActivePlane[i]; + if ( aCPlane.Active && aCPlane.PlaneId > 0 ) + { + OPENGL_CLIP_REP aPlane; + aPlane.equation[0] = aCPlane.CoefA; + aPlane.equation[1] = aCPlane.CoefB; + aPlane.equation[2] = aCPlane.CoefC; + aPlane.equation[3] = aCPlane.CoefD; + myClippingPlanes.Append( aPlane ); + } + } +} + +/*----------------------------------------------------------------------*/ + +//call_togl_setvisualisation +void OpenGl_View::SetVisualisation (const CALL_DEF_VIEWCONTEXT &AContext) +{ + myVisualization = AContext.Visualization; + // Shading method + switch (AContext.Model) + { + case 1 : /* VISUAL3D_TOM_INTERP_COLOR */ + case 3 : /* VISUAL3D_TOM_VERTEX */ + myIntShadingMethod = TEL_SM_GOURAUD; + break; + default : + myIntShadingMethod = TEL_SM_FLAT; + break; + } +} + +/*----------------------------------------------------------------------*/ + +//call_togl_cliplimit +void OpenGl_View::SetClipLimit (const CALL_DEF_VIEW &ACView) +{ + myZClip.Back.Limit = + ( ACView.Context.ZClipBackPlane - ACView.Mapping.BackPlaneDistance ) / + ( ACView.Mapping.FrontPlaneDistance - ACView.Mapping.BackPlaneDistance ); + myZClip.Front.Limit = + ( ACView.Context.ZClipFrontPlane - ACView.Mapping.BackPlaneDistance ) / + ( ACView.Mapping.FrontPlaneDistance - ACView.Mapping.BackPlaneDistance ); + if ( myZClip.Back.Limit < 0.F ) + myZClip.Back.Limit = 0.F; + if ( myZClip.Front.Limit > 1.F ) + myZClip.Front.Limit = 1.F; + if ( myZClip.Back.Limit > myZClip.Front.Limit ) + { + myZClip.Back.Limit = 0.F; + myZClip.Front.Limit = 1.F; + } + + myZClip.Back.IsOn = (ACView.Context.BackZClipping != 0); + myZClip.Front.IsOn = (ACView.Context.FrontZClipping != 0); +} + +/*----------------------------------------------------------------------*/ + +//call_togl_viewmapping +void OpenGl_View::SetMapping (const CALL_DEF_VIEW &ACView) +{ + const float ratio = ACView.DefWindow.dy / ACView.DefWindow.dx; + const float r_ratio = ACView.DefWindow.dx / ACView.DefWindow.dy; + + TEL_VIEW_MAPPING Map; + + Map.window.xmin = ACView.Mapping.WindowLimit.um; + Map.window.ymin = ACView.Mapping.WindowLimit.vm; + Map.window.xmax = ACView.Mapping.WindowLimit.uM; + Map.window.ymax = ACView.Mapping.WindowLimit.vM; + + Map.viewport.xmin = 0.F; + Map.viewport.xmax = ( 1.F < r_ratio ? 1.F : r_ratio ); + Map.viewport.ymin = 0.F; + Map.viewport.ymax = ( 1.F < ratio ? 1.F : ratio ); + Map.viewport.zmin = 0.F; + Map.viewport.zmax = 1.F; + + /* projection type */ + switch( ACView.Mapping.Projection ) + { + case 0 : + Map.proj = TelPerspective; + break; + case 1 : + Map.proj = TelParallel; + break; + } + + /* projection reference point */ + Map.prp[0] = ACView.Mapping.ProjectionReferencePoint.x; + Map.prp[1] = ACView.Mapping.ProjectionReferencePoint.y; + Map.prp[2] = ACView.Mapping.ProjectionReferencePoint.z; + if (!openglDisplay.IsNull() && !openglDisplay->Walkthrough()) + Map.prp[2] += ACView.Mapping.FrontPlaneDistance; + + /* view plane distance */ + Map.vpd = ACView.Mapping.ViewPlaneDistance; + + /* back plane distance */ + Map.bpd = ACView.Mapping.BackPlaneDistance; + + /* front plane distance */ + Map.fpd = ACView.Mapping.FrontPlaneDistance; + + Tint err_ind = 0; + + /* use user-defined matrix */ + if ( ACView.Mapping.IsCustomMatrix ) + { + int i, j; + for( i = 0; i < 4; i++ ) + for( j = 0; j < 4; j++ ) + myMappingMatrix[i][j] = ACView.Mapping.ProjectionMatrix[i][j]; + } + else + TelEvalViewMappingMatrix( &Map, &err_ind, myMappingMatrix ); + + if ( !err_ind ) + myExtra.map = Map; +} + +/*----------------------------------------------------------------------*/ + +//call_togl_vieworientation +void OpenGl_View::SetOrientation (const CALL_DEF_VIEW &ACView) +{ + Tfloat Vrp[3]; + Tfloat Vpn[3]; + Tfloat Vup[3]; + Tfloat ScaleFactors[3]; + + Vrp[0] = ACView.Orientation.ViewReferencePoint.x; + Vrp[1] = ACView.Orientation.ViewReferencePoint.y; + Vrp[2] = ACView.Orientation.ViewReferencePoint.z; + + Vpn[0] = ACView.Orientation.ViewReferencePlane.x; + Vpn[1] = ACView.Orientation.ViewReferencePlane.y; + Vpn[2] = ACView.Orientation.ViewReferencePlane.z; + + Vup[0] = ACView.Orientation.ViewReferenceUp.x; + Vup[1] = ACView.Orientation.ViewReferenceUp.y; + Vup[2] = ACView.Orientation.ViewReferenceUp.z; + + ScaleFactors[0] = ACView.Orientation.ViewScaleX; + ScaleFactors[1] = ACView.Orientation.ViewScaleY; + ScaleFactors[2] = ACView.Orientation.ViewScaleZ; + + Tint err_ind = 0; + + // use user-defined matrix + if ( ACView.Orientation.IsCustomMatrix ) + { + int i, j; + for( i = 0; i < 4; i++ ) + for( j = 0; j < 4; j++ ) + myOrientationMatrix[i][j] = ACView.Orientation.ModelViewMatrix[i][j]; + } + else + TelEvalViewOrientationMatrix( Vrp, Vpn, Vup, ScaleFactors, &err_ind, myOrientationMatrix ); + + if ( !err_ind ) + { + myExtra.vrp[0] = Vrp[0]; + myExtra.vrp[1] = Vrp[1]; + myExtra.vrp[2] = Vrp[2]; + + myExtra.vpn[0] = Vpn[0]; + myExtra.vpn[1] = Vpn[1]; + myExtra.vpn[2] = Vpn[2]; + + myExtra.vup[0] = Vup[0]; + myExtra.vup[1] = Vup[1]; + myExtra.vup[2] = Vup[2]; + + myExtra.scaleFactors[0] = ScaleFactors[0], + myExtra.scaleFactors[1] = ScaleFactors[1], + myExtra.scaleFactors[2] = ScaleFactors[2]; + } +} + +/*----------------------------------------------------------------------*/ + +void OpenGl_View::SetFog (const CALL_DEF_VIEW &ACView, const Standard_Boolean AFlag) +{ + if( !AFlag ) + { + myFog.IsOn = Standard_False; + } + else + { + myFog.IsOn = Standard_True; + + myFog.Front = + (ACView.Context.DepthFrontPlane - ACView.Mapping.BackPlaneDistance) / + (ACView.Mapping.FrontPlaneDistance - ACView.Mapping.BackPlaneDistance); + + myFog.Back = + (ACView.Context.DepthBackPlane - ACView.Mapping.BackPlaneDistance) / + (ACView.Mapping.FrontPlaneDistance - ACView.Mapping.BackPlaneDistance); + + if (myFog.Front < 0.F) + myFog.Front = 0.F; + else if (myFog.Front > 1.F) + myFog.Front = 1.F; + + if (myFog.Back < 0.F) + myFog.Back = 0.F; + else if (myFog.Back > 1.F) + myFog.Back = 1.F; + + if (myFog.Back > myFog.Front) + { + myFog.Front = 1.F; + myFog.Back = 0.F; + } + + myFog.Color.rgb[0] = ACView.DefWindow.Background.r; + myFog.Color.rgb[1] = ACView.DefWindow.Background.g; + myFog.Color.rgb[2] = ACView.DefWindow.Background.b; + myFog.Color.rgb[3] = 1.F; + } +} + +/*----------------------------------------------------------------------*/ + +void OpenGl_View::TriedronDisplay (const Aspect_TypeOfTriedronPosition APosition, const Quantity_NameOfColor AColor, + const Standard_Real AScale, const Standard_Boolean AsWireframe) +{ + myTrihedron = new OpenGl_Trihedron (APosition, AColor, AScale, AsWireframe); +} + +/*----------------------------------------------------------------------*/ + +void OpenGl_View::TriedronErase () +{ + myTrihedron.Nullify(); +} + +/*----------------------------------------------------------------------*/ + +void OpenGl_View::GraduatedTrihedronDisplay (const Graphic3d_CGraduatedTrihedron &data) +{ + myGraduatedTrihedron = new OpenGl_GraduatedTrihedron(data); +} + +/*----------------------------------------------------------------------*/ + +void OpenGl_View::GraduatedTrihedronErase () +{ + myGraduatedTrihedron.Nullify(); +} + +/*----------------------------------------------------------------------*/ + +//transform_persistence_end +void OpenGl_View::EndTransformPersistence () +{ + if ( myIsTransPers ) + { + /* restore matrix */ + glMatrixMode (GL_PROJECTION); + glPopMatrix (); + glMatrixMode (GL_MODELVIEW); + glPopMatrix (); + myIsTransPers = Standard_False; + } +} + +/*----------------------------------------------------------------------*/ + +//transform_persistence_begin +const TEL_TRANSFORM_PERSISTENCE * OpenGl_View::BeginTransformPersistence (const TEL_TRANSFORM_PERSISTENCE *ATransPers) +{ + const TEL_TRANSFORM_PERSISTENCE *TransPers_old = myTransPers; + + if ( ATransPers->mode == 0 ) + { + EndTransformPersistence(); + return TransPers_old; + } + + myTransPers = ATransPers; + + GLint viewport[4]; + glGetIntegerv (GL_VIEWPORT, viewport); + GLdouble modelMatrix[4][4]; + glGetDoublev( GL_MODELVIEW_MATRIX, (GLdouble *) modelMatrix ); + GLdouble projMatrix[4][4]; + glGetDoublev( GL_PROJECTION_MATRIX, (GLdouble *) projMatrix ); + + double W = viewport[2]; + double H = viewport[3]; + + if ( myIsTransPers ) + { + /* restore matrix */ + glMatrixMode (GL_PROJECTION); + glPopMatrix (); + glMatrixMode (GL_MODELVIEW); + glPopMatrix (); + } + else + myIsTransPers = Standard_True; + + glMatrixMode( GL_MODELVIEW ); + glPushMatrix(); + glLoadIdentity(); + + glMatrixMode( GL_PROJECTION ); + glPushMatrix(); + glLoadIdentity(); + + /*pre loading matrix*/ + if( ATransPers->mode & TPF_PAN ) + /* Annulate translate matrix */ + { + modelMatrix[3][0] = 0.; + modelMatrix[3][1] = 0.; + modelMatrix[3][2] = 0.; + projMatrix[3][0] = 0.; + projMatrix[3][1] = 0.; + projMatrix[3][2] = 0.; + } + + if( ATransPers->mode & TPF_ZOOM ) + /* Annulate zoom matrix */ + { + const double scaleX = myExtra.scaleFactors[0]; + const double scaleY = myExtra.scaleFactors[1]; + const double scaleZ = myExtra.scaleFactors[2]; + + for (int i = 0; i < 3; ++i) + { + modelMatrix[0][i] /= scaleX; + modelMatrix[1][i] /= scaleY; + modelMatrix[2][i] /= scaleZ; + } + + const double det2 = 0.002 / ( W > H ? projMatrix[1][1] : projMatrix[0][0]); + projMatrix[0][0] *= det2; + projMatrix[1][1] *= det2; + } + + if( ATransPers->mode & TPF_ROTATE ) + /* Annulate rotate matrix */ + { + modelMatrix[0][0] = 1.; + modelMatrix[1][1] = 1.; + modelMatrix[2][2] = 1.; + + modelMatrix[1][0] = 0.; + modelMatrix[2][0] = 0.; + modelMatrix[0][1] = 0.; + modelMatrix[2][1] = 0.; + modelMatrix[0][2] = 0.; + modelMatrix[1][2] = 0.; + } + else if( ATransPers->mode & TPF_RELATIVE_ROTATE ) + /* Initialize relative rotate matrix*/ + { + modelMatrix[3][0] = 0.; + modelMatrix[3][1] = 0.; + modelMatrix[3][2] = 0.; + + glMatrixMode( GL_MODELVIEW ); + glLoadIdentity(); + glTranslated( ATransPers->pointX, ATransPers->pointY, ATransPers->pointZ ); + } + + if( ATransPers->mode == TPF_TRIEDRON ) + { + /* Annulate translation matrix */ + modelMatrix[3][0] = 0.; + modelMatrix[3][1] = 0.; + modelMatrix[3][2] = 0.; + + projMatrix[3][0] = 0.; + projMatrix[3][1] = 0.; + projMatrix[3][2] = 0.; + + const double det2 = 0.002 / ( W > H ? projMatrix[1][1] : projMatrix[0][0]); + projMatrix[0][0] *= det2; + projMatrix[1][1] *= det2; + } + + /* load matrix */ + glMatrixMode (GL_MODELVIEW); + glMultMatrixd ((GLdouble *) modelMatrix); + + glMatrixMode (GL_PROJECTION); + glMultMatrixd ((GLdouble *) projMatrix); + + /*post loading matrix*/ + if( ATransPers->mode == TPF_TRIEDRON ) + { + glMatrixMode( GL_PROJECTION ); + + double winx, winy, winz; + const GLdouble idenMatrix[4][4] = { {1.,0.,0.,0.}, {0.,1.,0.,0.}, {0.,0.,1.,0.}, {0.,0.,0.,1.} }; + + gluUnProject( W/2., H/2., 0., (GLdouble*)idenMatrix, (GLdouble*)projMatrix, (GLint*)viewport, &winx, &winy, &winz); + double W1, H1; + W1 = winx; + H1 = winy; + gluUnProject( -W/2., -H/2., 0., (GLdouble*)idenMatrix, (GLdouble*)projMatrix, (GLint*)viewport, &winx, &winy, &winz); + double W2, H2; + W2 = winx; + H2 = winy; + + if( ATransPers->pointX == 0. && ATransPers->pointY == 0. ) + { + /*center*/ + } + else if( ATransPers->pointX > 0. && ATransPers->pointY > 0. ) + { + /*right upper*/ + glTranslated( 0.5*(W1 - W2 - ATransPers->pointZ), 0.5*(H1 - H2 - ATransPers->pointZ), 0. ); + } + else if( ATransPers->pointX > 0. && ATransPers->pointY < 0. ) + { + /*right lower*/ + glTranslated( 0.5*(W1 - W2 - ATransPers->pointZ), 0.5*(H2 - H1 + ATransPers->pointZ), 0. ); + } + else if( ATransPers->pointX < 0. && ATransPers->pointY > 0. ) + { + /*left upper*/ + glTranslated( 0.5*(W2 - W1 + ATransPers->pointZ), 0.5*(H1 - H2 - ATransPers->pointZ), 0. ); + } + else if( ATransPers->pointX < 0 && ATransPers->pointY < 0 ) + { + /*left lower*/ + glTranslated( -(W1 - W2)/2. + ATransPers->pointZ/2., -(H1-H2)/2. + ATransPers->pointZ/2., 0. ); + } + } + + return TransPers_old; +} + +/*----------------------------------------------------------------------*/ diff --git a/src/OpenGl/OpenGl_View.hxx b/src/OpenGl/OpenGl_View.hxx new file mode 100644 index 0000000000..2ba36f7a79 --- /dev/null +++ b/src/OpenGl/OpenGl_View.hxx @@ -0,0 +1,214 @@ +// File: OpenGl_View.hxx +// Created: 20 September 2011 +// Author: Sergey ZERCHANINOV +// Copyright: OPEN CASCADE 2011 + +#ifndef _OpenGl_View_Header +#define _OpenGl_View_Header + +#include +#include + +#include +#include + +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include + +#include + +#include +#include + +#include +#include +#include +#include + +struct OPENGL_BG_TEXTURE +{ + Tuint TexId; + Tint Width; + Tint Height; + Aspect_FillMethod Style; +}; + +struct OPENGL_BG_GRADIENT +{ + TEL_COLOUR color1; + TEL_COLOUR color2; + Aspect_GradientFillMethod type; +}; + +struct OPENGL_EXTRA_REP +{ + Tfloat vrp[3]; + Tfloat vpn[3]; + Tfloat vup[3]; + TEL_VIEW_MAPPING map; + Tfloat scaleFactors[3]; +}; + +struct OPENGL_CLIP_REP +{ + Standard_Real equation[4]; + IMPLEMENT_MEMORY_OPERATORS +}; + +struct OPENGL_ZCLIP +{ + struct { + Standard_Boolean IsOn; + Standard_ShortReal Limit; /* in the range [0., 1.] */ + } Back; + struct { + Standard_Boolean IsOn; + Standard_ShortReal Limit; /* in the range [0., 1.] */ + } Front; +}; + +struct OPENGL_FOG +{ + Standard_Boolean IsOn; + Standard_ShortReal Front; /* in the range [0., 1.] */ + Standard_ShortReal Back; /* in the range [0., 1.] */ + TEL_COLOUR Color; +}; + +class OpenGl_Structure; + +class OpenGl_View : public MMgt_TShared +{ + public: + OpenGl_View (const CALL_DEF_VIEWCONTEXT &AContext); + virtual ~OpenGl_View (); + + void SetTextureEnv (const Standard_Integer AId) { myTextureEnv = AId; } + void SetSurfaceDetail (const Visual3d_TypeOfSurfaceDetail AMode) { mySurfaceDetail = AMode; } + void SetBackfacing (const Standard_Integer AMode); + void SetLights (const CALL_DEF_VIEWCONTEXT &AContext); + void SetAntiAliasing (const Standard_Boolean AMode) { myAntiAliasing = AMode; } + void SetClippingPlanes (const CALL_DEF_VIEWCONTEXT &AContext); + void SetVisualisation (const CALL_DEF_VIEWCONTEXT &AContext); + + void SetClipLimit (const CALL_DEF_VIEW &ACView); + void SetMapping (const CALL_DEF_VIEW &ACView); + void SetOrientation (const CALL_DEF_VIEW &ACView); + + void SetFog (const CALL_DEF_VIEW &ACView, const Standard_Boolean AFlag); + + void TriedronDisplay (const Aspect_TypeOfTriedronPosition APosition, const Quantity_NameOfColor AColor, const Standard_Real AScale, const Standard_Boolean AsWireframe); + void TriedronErase (); + + void GraduatedTrihedronDisplay (const Graphic3d_CGraduatedTrihedron &ACubic); + void GraduatedTrihedronErase (); + + Standard_Boolean ProjectObjectToRaster (const Standard_Integer w, const Standard_Integer h, + const Standard_ShortReal x, const Standard_ShortReal y, const Standard_ShortReal z, + Standard_ShortReal &xr, Standard_ShortReal &yr); + Standard_Boolean ProjectRasterToObject (const Standard_Integer w, const Standard_Integer h, + const Standard_Integer xr, const Standard_Integer yr, + Standard_ShortReal &x, Standard_ShortReal &y, Standard_ShortReal &z); + Standard_Boolean ProjectRasterToObjectWithRay (const Standard_Integer w, const Standard_Integer h, + const Standard_Integer xr, const Standard_Integer yr, + Standard_ShortReal &x, Standard_ShortReal &y, Standard_ShortReal &z, + Standard_ShortReal &dx, Standard_ShortReal &dy, Standard_ShortReal &dz); + void GetMatrices (TColStd_Array2OfReal& theMatOrient, + TColStd_Array2OfReal& theMatMapping, + const Standard_Boolean theIsCustom) const; + + Standard_Real Height () const { return (myExtra.map.window.xmax - myExtra.map.window.xmin); } + Standard_Real Width () const { return (myExtra.map.window.ymax - myExtra.map.window.ymin); } + + Standard_Integer Backfacing () const { return myBackfacing; } + + const TEL_TRANSFORM_PERSISTENCE * BeginTransformPersistence ( const TEL_TRANSFORM_PERSISTENCE *ATransPers ); + void EndTransformPersistence (); + + void DisplayStructure (const OpenGl_Structure *AStructure, const Standard_Integer APriority) { myStructures.Add(AStructure,APriority); } + void EraseStructure (const OpenGl_Structure *AStructure) { myStructures.Remove(AStructure); } + + void CreateBackgroundTexture (const Standard_CString AFileName, const Aspect_FillMethod AFillStyle); + void SetBackgroundTextureStyle (const Aspect_FillMethod FillStyle); + void SetBackgroundGradient (const Quantity_Color& AColor1, const Quantity_Color& AColor2, const Aspect_GradientFillMethod AType); + void SetBackgroundGradientType (const Aspect_GradientFillMethod AType); + + void Render (const Handle(OpenGl_Workspace) &AWorkspace, + const Graphic3d_CView& ACView, + const Aspect_CLayer2d& ACUnderLayer, + const Aspect_CLayer2d& ACOverLayer); + + // Type definition + // + DEFINE_STANDARD_RTTI(OpenGl_View) + + protected: + + void RenderStructs (const Handle(OpenGl_Workspace) &AWorkspace); + void RedrawLayer2d (const Handle(OpenGl_Workspace) &AWorkspace, const Graphic3d_CView& ACView, const Aspect_CLayer2d& ACLayer); + + Standard_Integer myTextureEnv; //WSTextureEnv + Visual3d_TypeOfSurfaceDetail mySurfaceDetail; //WSSurfaceDetail + Standard_Integer myBackfacing; //WSBackfacing + + OPENGL_BG_TEXTURE myBgTexture; //WSBgTexture + OPENGL_BG_GRADIENT myBgGradient; //WSBgGradient + + //{ myViewRep + Tmatrix3 myOrientationMatrix; + Tmatrix3 myMappingMatrix; + + //Tint shield_indicator; + //TEL_COLOUR shield_colour; + //Tint border_indicator; + //TEL_COLOUR border_colour; + //Tint active_status; + + OPENGL_ZCLIP myZClip; + NCollection_List myClippingPlanes; + + OPENGL_EXTRA_REP myExtra; + //} + + OPENGL_FOG myFog; + Handle(OpenGl_Trihedron) myTrihedron; + Handle(OpenGl_GraduatedTrihedron) myGraduatedTrihedron; + + //View_LABViewContext + int myVisualization; + int myIntShadingMethod; + + //View_LABLight + OpenGl_ListOfLight myLights; + + //View_LABPlane + //View_LABAliasing + Standard_Boolean myAntiAliasing; + + //View_LABDepthCueing - fixed index used + + OpenGl_PriorityList myStructures; + + int myAnimationListIndex; + Standard_Boolean myAnimationListReady; + + const TEL_TRANSFORM_PERSISTENCE *myTransPers; + Standard_Boolean myIsTransPers; + + Standard_Boolean myResetFLIST; + + public: + IMPLEMENT_MEMORY_OPERATORS +}; + +#endif //_OpenGl_View_Header diff --git a/src/OpenGl/OpenGl_View_1.cxx b/src/OpenGl/OpenGl_View_1.cxx new file mode 100644 index 0000000000..d1dc0a4e56 --- /dev/null +++ b/src/OpenGl/OpenGl_View_1.cxx @@ -0,0 +1,244 @@ +// File: OpenGl_View_1.cxx +// Created: 20 September 2011 +// Author: Sergey ZERCHANINOV +// Copyright: OPEN CASCADE 2011 + +#include + +#include + +#include +#include + +#include +#include + +/*----------------------------------------------------------------------*/ + +//TelProjectionRaster in OpenGl_telem_util.cxx +Standard_Boolean OpenGl_View::ProjectObjectToRaster (const Standard_Integer w, const Standard_Integer h, + const Standard_ShortReal x, const Standard_ShortReal y, const Standard_ShortReal z, + Standard_ShortReal &xr, Standard_ShortReal &yr) +{ + int i, j, k; + + GLdouble modelMatrix[16]; + for (k = 0, i = 0; i < 4; i++) + for (j = 0; j < 4; j++, k++) + modelMatrix[k] = ( GLdouble )myOrientationMatrix[i][j]; + + GLdouble projMatrix[16]; + for (k = 0, i = 0; i < 4; i++) + for (j = 0; j < 4; j++, k++) + projMatrix[k] = ( GLdouble )myMappingMatrix[i][j]; + + GLint viewport[4]; + viewport[0] = 0; + viewport[1] = 0; + viewport[2] = w; + viewport[3] = h; + + /* + * glGetIntegerv (GL_VIEWPORT, viewport); + * glGetDoublev (GL_MODELVIEW_MATRIX, modelMatrix); + * glGetDoublev (GL_PROJECTION_MATRIX, projMatrix); + */ + + GLdouble winx, winy, winz; + if (gluProject (( GLdouble )x, ( GLdouble )y, ( GLdouble )z, modelMatrix, projMatrix, viewport, &winx, &winy, &winz)) + { + xr = ( Standard_ShortReal )winx; + yr = ( Standard_ShortReal )winy; + return Standard_True; + } + + xr = 0.F; + yr = 0.F; + return Standard_False; +} + +/*----------------------------------------------------------------------*/ +//TelUnProjectionRaster +Standard_Boolean OpenGl_View::ProjectRasterToObject (const Standard_Integer w, const Standard_Integer h, + const Standard_Integer xr, const Standard_Integer yr, + Standard_ShortReal &x, Standard_ShortReal &y, Standard_ShortReal &z) +{ + int i, j, k; + + GLdouble modelMatrix[16]; + for (k = 0, i = 0; i < 4; i++) + for (j = 0; j < 4; j++, k++) + modelMatrix[k] = ( GLdouble )myOrientationMatrix[i][j]; + + GLdouble projMatrix[16]; + for (k = 0, i = 0; i < 4; i++) + for (j = 0; j < 4; j++, k++) + projMatrix[k] = ( GLdouble )myMappingMatrix[i][j]; + + GLint viewport[4]; + viewport[0] = 0; + viewport[1] = 0; + viewport[2] = w; + viewport[3] = h; + + /* + * glGetIntegerv (GL_VIEWPORT, viewport); + * glGetDoublev (GL_MODELVIEW_MATRIX, modelMatrix); + * glGetDoublev (GL_PROJECTION_MATRIX, projMatrix); + */ + + GLdouble objx, objy, objz; + if (gluUnProject (( GLdouble )xr, ( GLdouble )yr, 0.0, modelMatrix, projMatrix, viewport, &objx, &objy, &objz)) + { + x = ( Standard_ShortReal )objx; + y = ( Standard_ShortReal )objy; + z = ( Standard_ShortReal )objz; + return Standard_True; + } + + x = 0.F; + y = 0.F; + z = 0.F; + return Standard_False; +} + +/*----------------------------------------------------------------------*/ +//TelUnProjectionRasterWithRay +Standard_Boolean OpenGl_View::ProjectRasterToObjectWithRay (const Standard_Integer w, const Standard_Integer h, + const Standard_Integer xr, const Standard_Integer yr, + Standard_ShortReal &x, Standard_ShortReal &y, Standard_ShortReal &z, + Standard_ShortReal &dx, Standard_ShortReal &dy, Standard_ShortReal &dz) +{ + int i, j, k; + + GLdouble modelMatrix[16]; + for (k = 0, i = 0; i < 4; i++) + for (j = 0; j < 4; j++, k++) + modelMatrix[k] = ( GLdouble )myOrientationMatrix[i][j]; + + GLdouble projMatrix[16]; + for (k = 0, i = 0; i < 4; i++) + for (j = 0; j < 4; j++, k++) + projMatrix[k] = ( GLdouble )myMappingMatrix[i][j]; + + GLint viewport[4]; + viewport[0] = 0; + viewport[1] = 0; + viewport[2] = w; + viewport[3] = h; + + /* + * glGetIntegerv (GL_VIEWPORT, viewport); + * glGetDoublev (GL_MODELVIEW_MATRIX, modelMatrix); + * glGetDoublev (GL_PROJECTION_MATRIX, projMatrix); + */ + + const GLdouble winx = ( GLdouble )xr; + const GLdouble winy = ( GLdouble )yr; + + GLdouble objx, objy, objz; + if (gluUnProject (winx, winy, 0.0, modelMatrix, projMatrix, viewport, &objx, &objy, &objz)) + { + GLdouble objx1, objy1, objz1; + if (gluUnProject (winx, winy, -10.0, modelMatrix, projMatrix, viewport, &objx1, &objy1, &objz1)) + { + x = ( Standard_ShortReal )objx; + y = ( Standard_ShortReal )objy; + z = ( Standard_ShortReal )objz; + dx = ( Standard_ShortReal )(objx-objx1); + dy = ( Standard_ShortReal )(objy-objy1); + dz = ( Standard_ShortReal )(objz-objz1); + return Standard_True; + } + } + + x = 0.F; + y = 0.F; + z = 0.F; + dx = 0.F; + dy = 0.F; + dz = 0.F; + return Standard_False; +} + +/*----------------------------------------------------------------------*/ + +//call_togl_inquiremat +void OpenGl_View::GetMatrices (TColStd_Array2OfReal& theMatOrient, + TColStd_Array2OfReal& theMatMapping, + const Standard_Boolean theIsCustom) const +{ + int i, j; + if (theIsCustom) + { + // OCC18942: Trying to return the current matrices instead of calculating them anew. + // This in particular allows using application-defined matrices. + for (i = 0; i < 4; ++i) + { + for (j = 0; j < 4; ++j) + { + theMatOrient (i, j) = myOrientationMatrix[j][i]; + theMatMapping (i, j) = myMappingMatrix[j][i]; + } + } + return; + } + + int anErr = 0; + Tmatrix3 aMatOri; + Tmatrix3 aMatMapping; + + view_map3 aViewMap; + memcpy (&aViewMap.win, &myExtra.map.window, sizeof(Tlimit)); + memcpy (&aViewMap.proj_vp, &myExtra.map.viewport, sizeof(Tlimit3)); + switch (myExtra.map.proj) + { + default: + case TelParallel: aViewMap.proj_type = TYPE_PARAL; break; + case TelPerspective: aViewMap.proj_type = TYPE_PERSPECT; break; + } + aViewMap.proj_ref_point.x = myExtra.map.prp[0]; + aViewMap.proj_ref_point.y = myExtra.map.prp[1]; + aViewMap.proj_ref_point.z = myExtra.map.prp[2]; + aViewMap.view_plane = myExtra.map.vpd; + aViewMap.back_plane = myExtra.map.bpd; + aViewMap.front_plane = myExtra.map.fpd; + + call_func_eval_ori_matrix3 ((const point3* )myExtra.vrp, + (const vec3* )myExtra.vpn, + (const vec3* )myExtra.vup, + &anErr, aMatOri); + if (anErr == 0) + call_func_eval_map_matrix3 (&aViewMap, &anErr, aMatMapping); + + if (anErr == 0) + { + for (i = 0; i < 4; ++i) + { + for (j = 0; j < 4; ++j) + { + theMatOrient (i, j) = aMatOri[j][i]; + theMatMapping (i, j) = aMatMapping[j][i]; + } + } + return; + } + + // return just identity matrices + for (i = 0; i < 4; ++i) + { + for (j = 0; j < 4; ++j) + { + if (i == j) { + theMatMapping (i, j) = 1.0; + theMatOrient (i, j) = 1.0; + } + else { + theMatMapping (i, j) = 0.0; + theMatOrient (i, j) = 0.0; + } + } + } +} + +/*----------------------------------------------------------------------*/ diff --git a/src/OpenGl/OpenGl_View_2.cxx b/src/OpenGl/OpenGl_View_2.cxx new file mode 100644 index 0000000000..9ee10b10ca --- /dev/null +++ b/src/OpenGl/OpenGl_View_2.cxx @@ -0,0 +1,1538 @@ +// File: OpenGl_View_2.cxx +// Created: 20 September 2011 +// Author: Sergey ZERCHANINOV +// Copyright: OPEN CASCADE 2011 + +#define G003 /* EUG 20-09-99 ; Animation management +*/ + +/*----------------------------------------------------------------------*/ +/* +* Includes +*/ + +#include +#include + +#include +#include +#include + +#include +#include +#include + +#if defined(WNT) +#include +#endif + +#include +#include +#include +#include +#include +#include +#include + +/*----------------------------------------------------------------------*/ +/* +* Constantes +*/ + +#define EPSI 0.0001 + +#ifndef M_PI +# define M_PI 3.14159265358979323846 +#endif + +static const GLfloat default_amb[4] = { 0.F, 0.F, 0.F, 1.F }; +static const GLfloat default_sptdir[3] = { 0.F, 0.F, -1.F }; +static const GLfloat default_sptexpo = 0.F; +static const GLfloat default_sptcutoff = 180.F; + +extern void InitLayerProp (const int AListId); //szvgl: defined in OpenGl_GraphicDriver_Layer.cxx + +/*----------------------------------------------------------------------*/ + +struct OPENGL_CLIP_PLANE +{ + GLboolean isEnabled; + GLdouble Equation[4]; + IMPLEMENT_MEMORY_OPERATORS +}; + +/*----------------------------------------------------------------------*/ +/* +* Fonctions privees +*/ + +/*-----------------------------------------------------------------*/ +/* +* Set des lumieres +*/ +static void bind_light(const OpenGl_Light *lptr, int *gl_lid) +{ + // Only 8 lights in OpenGL... + if (*gl_lid > GL_LIGHT7) return; + + // the light is a headlight ? + GLint cur_matrix; + if (lptr->HeadLight) + { + glGetIntegerv(GL_MATRIX_MODE, &cur_matrix); + glMatrixMode(GL_MODELVIEW); + glPushMatrix(); + glLoadIdentity(); + } + + GLfloat data_amb[4]; + GLfloat data_diffu[4]; + GLfloat data_pos[4]; + GLfloat data_sptdir[3]; + GLfloat data_sptexpo; + GLfloat data_sptcutoff; + GLfloat data_constantattenuation; + GLfloat data_linearattenuation; + + /* set la light en fonction de son type */ + switch (lptr->type) + { + case TLightAmbient: + data_amb[0] = lptr->col.rgb[0]; + data_amb[1] = lptr->col.rgb[1]; + data_amb[2] = lptr->col.rgb[2]; + data_amb[3] = 1.0; + + /*------------------------- Ambient ---------------------------*/ + /* + * The GL_AMBIENT parameter refers to RGBA intensity of the ambient + * light. + */ + glLightModelfv(GL_LIGHT_MODEL_AMBIENT, data_amb); + break; + + + case TLightDirectional: + data_diffu[0] = lptr->col.rgb[0]; + data_diffu[1] = lptr->col.rgb[1]; + data_diffu[2] = lptr->col.rgb[2]; + data_diffu[3] = 1.0; + + /*------------------------- Direction ---------------------------*/ + /* From Open GL Programming Rev 1 Guide Chapt 6 : + Lighting The Mathematics of Lighting ( p 168 ) + + Directional Light Source ( Infinite ) : + if the last parameter of GL_POSITION , w , is zero, the + corresponding light source is a Directional one. + + GL_SPOT_CUTOFF a 180 signifie que ce n'est pas un spot. + To create a realistic effect, set the GL_SPECULAR parameter + to the same value as the GL_DIFFUSE. + */ + + data_pos[0] = -lptr->dir[0]; + data_pos[1] = -lptr->dir[1]; + data_pos[2] = -lptr->dir[2]; + data_pos[3] = 0.0; + + glLightfv(*gl_lid, GL_AMBIENT, default_amb); + glLightfv(*gl_lid, GL_DIFFUSE, data_diffu); + glLightfv(*gl_lid, GL_SPECULAR, data_diffu); + + glLightfv(*gl_lid, GL_POSITION, data_pos); + glLightfv(*gl_lid, GL_SPOT_DIRECTION, default_sptdir); + glLightf(*gl_lid, GL_SPOT_EXPONENT, default_sptexpo); + glLightf(*gl_lid, GL_SPOT_CUTOFF, default_sptcutoff); + break; + + + case TLightPositional: + data_diffu[0] = lptr->col.rgb[0]; + data_diffu[1] = lptr->col.rgb[1]; + data_diffu[2] = lptr->col.rgb[2]; + data_diffu[3] = 1.0; + + /*------------------------- Position -----------------------------*/ + /* From Open GL Programming Rev 1 Guide Chapt 6 : + Lighting The Mathematics of Lighting ( p 168 ) + Positional Light Source : + if the last parameter of GL_POSITION , w , is nonzero, + the corresponding light source is a Positional one. + + GL_SPOT_CUTOFF a 180 signifie que ce n'est pas un spot. + + To create a realistic effect, set the GL_SPECULAR parameter + to the same value as the GL_DIFFUSE. + */ + + data_pos[0] = lptr->pos[0]; + data_pos[1] = lptr->pos[1]; + data_pos[2] = lptr->pos[2]; + data_pos[3] = 1.0; + + data_constantattenuation = lptr->atten[0]; + data_linearattenuation = lptr->atten[1]; + + glLightfv(*gl_lid, GL_AMBIENT, default_amb); + glLightfv(*gl_lid, GL_DIFFUSE, data_diffu); + glLightfv(*gl_lid, GL_SPECULAR, data_diffu); + + glLightfv(*gl_lid, GL_POSITION, data_pos); + glLightfv(*gl_lid, GL_SPOT_DIRECTION, default_sptdir); + glLightf(*gl_lid, GL_SPOT_EXPONENT, default_sptexpo); + glLightf(*gl_lid, GL_SPOT_CUTOFF, default_sptcutoff); + glLightf(*gl_lid, GL_CONSTANT_ATTENUATION, data_constantattenuation); + glLightf(*gl_lid, GL_LINEAR_ATTENUATION, data_linearattenuation); + glLightf(*gl_lid, GL_QUADRATIC_ATTENUATION, 0.0); + break; + + + case TLightSpot: + data_diffu[0] = lptr->col.rgb[0]; + data_diffu[1] = lptr->col.rgb[1]; + data_diffu[2] = lptr->col.rgb[2]; + data_diffu[3] = 1.0; + + data_pos[0] = lptr->pos[0]; + data_pos[1] = lptr->pos[1]; + data_pos[2] = lptr->pos[2]; + data_pos[3] = 1.0; + + data_sptdir[0] = lptr->dir[0]; + data_sptdir[1] = lptr->dir[1]; + data_sptdir[2] = lptr->dir[2]; + + data_sptexpo = ( float )lptr->shine * 128.0F; + data_sptcutoff = ( float )(lptr->angle * 180.0F)/( float )M_PI; + + data_constantattenuation = lptr->atten[0]; + data_linearattenuation = lptr->atten[1]; + + glLightfv(*gl_lid, GL_AMBIENT, default_amb); + glLightfv(*gl_lid, GL_DIFFUSE, data_diffu); + glLightfv(*gl_lid, GL_SPECULAR, data_diffu); + + glLightfv(*gl_lid, GL_POSITION, data_pos); + glLightfv(*gl_lid, GL_SPOT_DIRECTION, data_sptdir); + glLightf(*gl_lid, GL_SPOT_EXPONENT, data_sptexpo); + glLightf(*gl_lid, GL_SPOT_CUTOFF, data_sptcutoff); + glLightf(*gl_lid, GL_CONSTANT_ATTENUATION, data_constantattenuation); + glLightf(*gl_lid, GL_LINEAR_ATTENUATION, data_linearattenuation); + glLightf(*gl_lid, GL_QUADRATIC_ATTENUATION, 0.0); + break; + } + + if (lptr->type != TLightAmbient) + { + glEnable(*gl_lid); + (*gl_lid)++; + } + + /* si la light etait une headlight alors restaure la matrice precedente */ + if (lptr->HeadLight) + { + glPopMatrix(); + glMatrixMode(cur_matrix); + } +} + +/*----------------------------------------------------------------------*/ +/* +* Prototypes +*/ + +static void call_util_apply_trans2( float ix, float iy, float iz, matrix3 mat, + float *ox, float *oy, float *oz ); +static void call_util_mat_mul( matrix3 mat_a, matrix3 mat_b, matrix3 mat_c); + +/*----------------------------------------------------------------------*/ +/* +* Fonctions externes +*/ + +/* +* Evaluates orientation matrix. +*/ +/* OCC18942: obsolete in OCCT6.3, might be removed in further versions! */ +void call_func_eval_ori_matrix3 (const point3* vrp, // view reference point + const vec3* vpn, // view plane normal + const vec3* vup, // view up vector + int* err_ind, + float mout[4][4]) // OUT view orientation matrix +{ + + /* Translate to VRP then change the basis. + * The old basis is: e1 = < 1, 0, 0>, e2 = < 0, 1, 0>, e3 = < 0, 0, 1>. + * The new basis is: ("x" means cross product) + * e3' = VPN / |VPN| + * e1' = VUP x VPN / |VUP x VPN| + * e2' = e3' x e1' + * Therefore the transform from old to new is x' = TAx, where: + * + * | e1'x e2'x e3'x 0 | | 1 0 0 0 | + * A = | e1'y e2'y e3'y 0 |, T = | 0 1 0 0 | + * | e1'z e2'z e3'z 0 | | 0 0 1 0 | + * | 0 0 0 1 | | -vrp.x -vrp.y -vrp.z 1 | + * + */ + + /* + * These ei's are really ei primes. + */ + register float (*m)[4][4]; + point3 e1, e2, e3, e4; + double s, v; + + /* + * e1' = VUP x VPN / |VUP x VPN|, but do the division later. + */ + e1.x = vup->delta_y * vpn->delta_z - vup->delta_z * vpn->delta_y; + e1.y = vup->delta_z * vpn->delta_x - vup->delta_x * vpn->delta_z; + e1.z = vup->delta_x * vpn->delta_y - vup->delta_y * vpn->delta_x; + s = sqrt( e1.x * e1.x + e1.y * e1.y + e1.z * e1.z); + e3.x = vpn->delta_x; + e3.y = vpn->delta_y; + e3.z = vpn->delta_z; + v = sqrt( e3.x * e3.x + e3.y * e3.y + e3.z * e3.z); + /* + * Check for vup and vpn colinear (zero dot product). + */ + if ((s > -EPSI) && (s < EPSI)) + *err_ind = 2; + else + /* + * Check for a normal vector not null. + */ + if ((v > -EPSI) && (v < EPSI)) + *err_ind = 3; + else { + /* + * Normalize e1 + */ + e1.x /= ( float )s; + e1.y /= ( float )s; + e1.z /= ( float )s; + /* + * e3 = VPN / |VPN| + */ + e3.x /= ( float )v; + e3.y /= ( float )v; + e3.z /= ( float )v; + /* + * e2 = e3 x e1 + */ + e2.x = e3.y * e1.z - e3.z * e1.y; + e2.y = e3.z * e1.x - e3.x * e1.z; + e2.z = e3.x * e1.y - e3.y * e1.x; + /* + * Add the translation + */ + e4.x = -( e1.x * vrp->x + e1.y * vrp->y + e1.z * vrp->z); + e4.y = -( e2.x * vrp->x + e2.y * vrp->y + e2.z * vrp->z); + e4.z = -( e3.x * vrp->x + e3.y * vrp->y + e3.z * vrp->z); + /* + * Homogeneous entries + * + * | e1.x e2.x e3.x 0.0 | | 1 0 0 0 | + * | e1.y e2.y e3.y 0.0 | * | 0 1 0 0 | + * | e1.z e2.z e3.z 0.0 | | a b 1 c | + * | e4.x e4.y e4.z 1.0 | | 0 0 0 1 | + */ + + m = (float (*)[4][4])mout; + + (*m)[0][0] = e1.x; + (*m)[0][1] = e2.x; + (*m)[0][2] = e3.x; + (*m)[0][3] = ( float )0.0; + + (*m)[1][0] = e1.y; + (*m)[1][1] = e2.y; + (*m)[1][2] = e3.y; + (*m)[1][3] = ( float )0.0; + + (*m)[2][0] = e1.z; + (*m)[2][1] = e2.z; + (*m)[2][2] = e3.z; + (*m)[2][3] = ( float )0.0; + + (*m)[3][0] = e4.x; + (*m)[3][1] = e4.y; + (*m)[3][2] = e4.z; + (*m)[3][3] = ( float )1.0; + + *err_ind = 0; + } +} + +/*----------------------------------------------------------------------*/ +/* +* Evaluates mapping matrix. +*/ +/* OCC18942: obsolete in OCCT6.3, might be removed in further versions! */ +void call_func_eval_map_matrix3( + view_map3 *Map, + int *err_ind, + matrix3 mat) +{ + int i, j; + matrix3 Tpar, Spar; + matrix3 Tper, Sper; + matrix3 Shear; + matrix3 Scale; + matrix3 Tprp; + matrix3 aux_mat1, aux_mat2, aux_mat3; + point3 Prp; + + *err_ind = 0; + for (i=0; i<4; i++) + for (j=0; j<4; j++) + Spar[i][j] = Sper[i][j] = aux_mat1[i][j] = aux_mat2[i][j] = + aux_mat3[i][j] = Tper[i][j] = Tpar[i][j] = Tprp[i][j] = + Shear[i][j] = Scale[i][j] = ( float )(i == j); + + Prp.x = Map->proj_ref_point.x; + Prp.y = Map->proj_ref_point.y; + Prp.z = Map->proj_ref_point.z; + + /* + * Type Parallele + */ + if (Map->proj_type == TYPE_PARAL) + { + float umid, vmid; + point3 temp; + +#ifdef FMN + float cx, cy, gx, gy, xsf, ysf, zsf; + float fpd, bpd; + float dopx, dopy, dopz; + matrix3 tmat = { { ( float )1.0, ( float )0.0, ( float )0.0, ( float )0.0 }, + { ( float )0.0, ( float )1.0, ( float )0.0, ( float )0.0 }, + { ( float )0.0, ( float )0.0, ( float )1.0, ( float )0.0 }, + { ( float )0.0, ( float )0.0, ( float )0.0, ( float )1.0 } }; + matrix3 smat = { { ( float )1.0, ( float )0.0, ( float )0.0, ( float )0.0 }, + { ( float )0.0, ( float )1.0, ( float )0.0, ( float )0.0 }, + { ( float )0.0, ( float )0.0, ( float )1.0, ( float )0.0 }, + { ( float )0.0, ( float )0.0, ( float )0.0, ( float )1.0 } }; + matrix3 shmat = { { ( float )1.0, ( float )0.0, ( float )0.0, ( float )0.0 }, + { ( float )0.0, ( float )1.0, ( float )0.0, ( float )0.0 }, + { ( float )0.0, ( float )0.0, ( float )1.0, ( float )0.0 }, + { ( float )0.0, ( float )0.0, ( float )0.0, ( float )1.0 } }; + matrix3 tshmat = { { ( float )1.0, ( float )0.0, ( float )0.0, ( float )0.0 }, + { ( float )0.0, ( float )1.0, ( float )0.0, ( float )0.0 }, + { ( float )0.0, ( float )0.0, ( float )1.0, ( float )0.0 }, + { ( float )0.0, ( float )0.0, ( float )0.0, ( float )1.0 } }; + + /* centers */ + cx = Map->win.x_min + Map->win.x_max, cx /= ( float )2.0; + cy = Map->win.y_min + Map->win.y_max, cy /= ( float )2.0; + + gx = 2.0/ (Map->win.x_max - Map->win.x_min); + gy = 2.0/ (Map->win.y_max - Map->win.y_min); + + tmat[0][3] = -cx; + tmat[1][3] = -cy; + tmat[2][3] = (Map->front_plane + Map->back_plane)/(Map->front_plane - Map->back_plane); + + smat[0][0] = gx; + smat[1][1] = gy; + smat[2][2] = -2./(Map->front_plane - Map->back_plane); + + /* scale factors */ + dopx = cx - Prp.x; + dopy = cy - Prp.y; + dopz = - Prp.z; + + /* map matrix */ + shmat[0][2] = -(dopx/dopz); + shmat[1][2] = -(dopy/dopz); + + /* multiply to obtain mapping matrix */ + call_util_mat_mul( tmat, shmat, tshmat ); + call_util_mat_mul( smat, tshmat, mat ); + + return; +#endif + + /* CAL */ + Map->proj_vp.z_min = ( float )0.0; + Map->proj_vp.z_max = ( float )1.0; + /* CAL */ + + /* Shear matrix calculation */ + umid = ( float )(Map->win.x_min+Map->win.x_max)/( float )2.0; + vmid = ( float )(Map->win.y_min+Map->win.y_max)/( float )2.0; + if(Prp.z == Map->view_plane){ + /* Projection reference point is on the view plane */ + *err_ind = 1; + return; + } + Shear[2][0] = ( float )(-1.0) * ((Prp.x-umid)/(Prp.z-Map->view_plane)); + Shear[2][1] = ( float )(-1.0) * ((Prp.y-vmid)/(Prp.z-Map->view_plane)); + + /* + * Calculate the lower left coordinate of the view plane + * after the Shearing Transformation. + */ + call_util_apply_trans2(Map->win.x_min, Map->win.y_min, + Map->view_plane, Shear, &(temp.x), &(temp.y), &(temp.z)); + + /* Translate the back plane to the origin */ + Tpar[3][0] = ( float )(-1.0) * temp.x; + Tpar[3][1] = ( float )(-1.0) * temp.y; + Tpar[3][2] = ( float )(-1.0) * Map->back_plane; + + call_util_mat_mul(Shear, Tpar, aux_mat1); + + /* Calculation of Scaling transformation */ + Spar[0][0] = ( float )1.0 / (Map->win.x_max - Map->win.x_min); + Spar[1][1] = ( float )1.0 / (Map->win.y_max - Map->win.y_min); + Spar[2][2] = ( float )1.0 / (Map->front_plane - Map->back_plane ); + call_util_mat_mul (aux_mat1, Spar, aux_mat2); + /* Atlast we transformed view volume to NPC */ + + /* Translate and scale the view plane to projection view port */ + if(Map->proj_vp.x_min < 0.0 || Map->proj_vp.y_min < 0.0 || + Map->proj_vp.z_min < 0.0 || Map->proj_vp.x_max > 1.0 || + Map->proj_vp.y_max > 1.0 || Map->proj_vp.z_max > 1.0 || + Map->proj_vp.x_min > Map->proj_vp.x_max || + Map->proj_vp.y_min > Map->proj_vp.y_max || + Map->proj_vp.z_min > Map->proj_vp.z_max){ + *err_ind = 1; + return; + } + for(i=0; i<4; i++) + for(j=0; j<4; j++) + aux_mat1[i][j] = (float)(i==j); + aux_mat1[0][0] = Map->proj_vp.x_max-Map->proj_vp.x_min; + aux_mat1[1][1] = Map->proj_vp.y_max-Map->proj_vp.y_min; + aux_mat1[2][2] = Map->proj_vp.z_max-Map->proj_vp.z_min; + aux_mat1[3][0] = Map->proj_vp.x_min; + aux_mat1[3][1] = Map->proj_vp.y_min; + aux_mat1[3][2] = Map->proj_vp.z_min; + call_util_mat_mul (aux_mat2, aux_mat1, mat); + + return; + } + + /* + * Type Perspective + */ + else if (Map->proj_type == TYPE_PERSPECT) + { + float umid, vmid; + float B, F, V; + float Zvmin; + + /* CAL */ + Map->proj_vp.z_min = ( float )0.0; + Map->proj_vp.z_max = ( float )1.0; + /* CAL */ + + B = Map->back_plane; + F = Map->front_plane; + V = Map->view_plane; + + if(Prp.z == Map->view_plane){ + /* Centre of Projection is on the view plane */ + *err_ind = 1; + return; + } + if(Map->proj_vp.x_min < 0.0 || Map->proj_vp.y_min < 0.0 || + Map->proj_vp.z_min < 0.0 || Map->proj_vp.x_max > 1.0 || + Map->proj_vp.y_max > 1.0 || Map->proj_vp.z_max > 1.0 || + Map->proj_vp.x_min > Map->proj_vp.x_max || + Map->proj_vp.y_min > Map->proj_vp.y_max || + Map->proj_vp.z_min > Map->proj_vp.z_max || + F < B){ + *err_ind = 1; + return; + } + + /* This is the transformation to move VRC to Center Of Projection */ + Tprp[3][0] = ( float )(-1.0)*Prp.x; + Tprp[3][1] = ( float )(-1.0)*Prp.y; + Tprp[3][2] = ( float )(-1.0)*Prp.z; + + /* Calculation of Shear matrix */ + umid = ( float )(Map->win.x_min+Map->win.x_max)/( float )2.0-Prp.x; + vmid = ( float )(Map->win.y_min+Map->win.y_max)/( float )2.0-Prp.y; + Shear[2][0] = ( float )(-1.0)*umid/(Map->view_plane-Prp.z); + Shear[2][1] = ( float )(-1.0)*vmid/(Map->view_plane-Prp.z); + call_util_mat_mul(Tprp, Shear, aux_mat3); + + /* Scale the view volume to canonical view volume + * Centre of projection at origin. + * 0 <= N <= -1, -0.5 <= U <= 0.5, -0.5 <= V <= 0.5 + */ + Scale[0][0] = (( float )(-1.0)*Prp.z+V)/ + ((Map->win.x_max-Map->win.x_min)*(( float )(-1.0)*Prp.z+B)); + Scale[1][1] = (( float )(-1.0)*Prp.z+V)/ + ((Map->win.y_max-Map->win.y_min)*(( float )(-1.0)*Prp.z+B)); + Scale[2][2] = ( float )(-1.0) / (( float )(-1.0)*Prp.z+B); + + call_util_mat_mul(aux_mat3, Scale, aux_mat1); + + /* + * Transform the Perspective view volume into + * Parallel view volume. + * Lower left coordinate: (-0.5,-0.5, -1) + * Upper right coordinate: (0.5, 0.5, 1.0) + */ + Zvmin = ( float )(-1.0*(-1.0*Prp.z+F)/(-1.0*Prp.z+B)); + aux_mat2[2][2] = ( float )1.0/(( float )1.0+Zvmin); + aux_mat2[2][3] = ( float )(-1.0); + aux_mat2[3][2] = ( float )(-1.0)*Zvmin*aux_mat2[2][2]; + aux_mat2[3][3] = ( float )0.0; + call_util_mat_mul(aux_mat1, aux_mat2, Shear); + + for(i=0; i<4; i++) + for(j=0; j<4; j++) + aux_mat1[i][j] = aux_mat2[i][j] = (float)(i==j); + + /* Translate and scale the view plane to projection view port */ + aux_mat2[0][0] = (Map->proj_vp.x_max-Map->proj_vp.x_min); + aux_mat2[1][1] = (Map->proj_vp.y_max-Map->proj_vp.y_min); + aux_mat2[2][2] = (Map->proj_vp.z_max-Map->proj_vp.z_min); + aux_mat2[3][0] = aux_mat2[0][0]/( float )2.0+Map->proj_vp.x_min; + aux_mat2[3][1] = aux_mat2[1][1]/( float )2.0+Map->proj_vp.y_min; + aux_mat2[3][2] = aux_mat2[2][2]+Map->proj_vp.z_min; + call_util_mat_mul (Shear, aux_mat2, mat); + + return; + } + else + *err_ind = 1; +} + +/*----------------------------------------------------------------------*/ + +static void +call_util_apply_trans2( float ix, float iy, float iz, matrix3 mat, + float *ox, float *oy, float *oz ) +{ + float temp; + *ox = ix*mat[0][0]+iy*mat[1][0]+iz*mat[2][0]+mat[3][0]; + *oy = ix*mat[0][1]+iy*mat[1][1]+iz*mat[2][1]+mat[3][1]; + *oz = ix*mat[0][2]+iy*mat[1][2]+iz*mat[2][2]+mat[3][2]; + temp = ix * mat[0][3]+iy * mat[1][3]+iz * mat[2][3]+mat[3][3]; + *ox /= temp; + *oy /= temp; + *oz /= temp; +} + +/*----------------------------------------------------------------------*/ + +static void +call_util_mat_mul( matrix3 mat_a, matrix3 mat_b, matrix3 mat_c) +{ + int i, j, k; + + for (i=0; i<4; i++) + for (j=0; j<4; j++) + for (mat_c[i][j] = ( float )0.0,k=0; k<4; k++) + mat_c[i][j] += mat_a[i][k] * mat_b[k][j]; +} + +/*----------------------------------------------------------------------*/ + +//call_func_redraw_all_structs_proc +void OpenGl_View::Render (const Handle(OpenGl_Workspace) &AWorkspace, + const Graphic3d_CView& ACView, + const Aspect_CLayer2d& ACUnderLayer, + const Aspect_CLayer2d& ACOverLayer) +{ + // Reset FLIST status after modification of myBackfacing + if (myResetFLIST) + { + AWorkspace->NamedStatus &= ~OPENGL_NS_FLIST; + myResetFLIST = Standard_False; + } + + // Store and disable current clipping planes + GLint maxplanes; + glGetIntegerv(GL_MAX_CLIP_PLANES, &maxplanes); + const GLenum lastid = GL_CLIP_PLANE0 + maxplanes; + OPENGL_CLIP_PLANE *oldPlanes = new OPENGL_CLIP_PLANE[maxplanes]; + OPENGL_CLIP_PLANE *ptrPlane = oldPlanes; + GLenum planeid = GL_CLIP_PLANE0; + for ( ; planeid < lastid; planeid++, ptrPlane++ ) + { + glGetClipPlane( planeid, ptrPlane->Equation ); + if ( ptrPlane->isEnabled ) + { + glDisable( planeid ); + ptrPlane->isEnabled = GL_TRUE; + } + else + ptrPlane->isEnabled = GL_FALSE; + } + + ///////////////////////////////////////////////////////////////////////////// + // Step 1: Prepare for redraw + + // Render background + if ( (AWorkspace->NamedStatus & OPENGL_NS_WHITEBACK) == 0 && + ( myBgTexture.TexId != 0 || myBgGradient.type != Aspect_GFM_NONE ) ) + { + const Standard_Integer aViewWidth = AWorkspace->Width(); + const Standard_Integer aViewHeight = AWorkspace->Height(); + + glPushAttrib( GL_ENABLE_BIT | GL_TEXTURE_BIT ); + + glMatrixMode( GL_PROJECTION ); + glPushMatrix(); + glLoadIdentity(); + glMatrixMode( GL_MODELVIEW ); + glPushMatrix(); + glLoadIdentity(); + + if ( glIsEnabled( GL_DEPTH_TEST ) ) + glDisable( GL_DEPTH_TEST ); //push GL_ENABLE_BIT + + // drawing bg image if defined + if ( myBgTexture.TexId != 0 ) + { + GLfloat texX_range = 1.F; // texture coordinate + GLfloat texY_range = 1.F; // texture coordinate + + // Set up for stretching or tiling + GLfloat x_offset, y_offset; + if ( myBgTexture.Style == Aspect_FM_CENTERED ) + { + x_offset = (GLfloat)myBgTexture.Width / (GLfloat)aViewWidth; + y_offset = (GLfloat)myBgTexture.Height / (GLfloat)aViewHeight; + } + else + { + x_offset = 1.F; + y_offset = 1.F; + if ( myBgTexture.Style == Aspect_FM_TILED ) + { + texX_range = (GLfloat)aViewWidth / (GLfloat)myBgTexture.Width; + texY_range = (GLfloat)aViewHeight / (GLfloat)myBgTexture.Height; + } + } + + glEnable( GL_TEXTURE_2D ); //push GL_ENABLE_BIT + glBindTexture( GL_TEXTURE_2D, myBgTexture.TexId ); //push GL_TEXTURE_BIT + + glDisable( GL_BLEND ); //push GL_ENABLE_BIT + + glColor3fv( AWorkspace->BackgroundColor().rgb ); + glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL); //push GL_TEXTURE_BIT + + glBegin( GL_QUADS ); + glTexCoord2f(0.F, 0.F); glVertex2f( -x_offset, -y_offset ); + glTexCoord2f(texX_range, 0.F); glVertex2f( x_offset, -y_offset ); + glTexCoord2f(texX_range, texY_range); glVertex2f( x_offset, y_offset ); + glTexCoord2f(0.F, texY_range); glVertex2f( -x_offset, y_offset ); + glEnd(); + } + else //if( myBgGradient.type != Aspect_GFM_NONE ) + { + Tfloat* corner1 = 0;/* -1,-1*/ + Tfloat* corner2 = 0;/* 1,-1*/ + Tfloat* corner3 = 0;/* 1, 1*/ + Tfloat* corner4 = 0;/* -1, 1*/ + Tfloat dcorner1[3]; + Tfloat dcorner2[3]; + + switch( myBgGradient.type ) + { + case Aspect_GFM_HOR: + corner1 = myBgGradient.color2.rgb; + corner2 = myBgGradient.color2.rgb; + corner3 = myBgGradient.color1.rgb; + corner4 = myBgGradient.color1.rgb; + break; + case Aspect_GFM_VER: + corner1 = myBgGradient.color2.rgb; + corner2 = myBgGradient.color1.rgb; + corner3 = myBgGradient.color1.rgb; + corner4 = myBgGradient.color2.rgb; + break; + case Aspect_GFM_DIAG1: + corner2 = myBgGradient.color2.rgb; + corner4 = myBgGradient.color1.rgb; + dcorner1 [0] = dcorner2[0] = 0.5F * (corner2[0] + corner4[0]); + dcorner1 [1] = dcorner2[1] = 0.5F * (corner2[1] + corner4[1]); + dcorner1 [2] = dcorner2[2] = 0.5F * (corner2[2] + corner4[2]); + corner1 = dcorner1; + corner3 = dcorner2; + break; + case Aspect_GFM_DIAG2: + corner1 = myBgGradient.color2.rgb; + corner3 = myBgGradient.color1.rgb; + dcorner1 [0] = dcorner2[0] = 0.5F * (corner1[0] + corner3[0]); + dcorner1 [1] = dcorner2[1] = 0.5F * (corner1[1] + corner3[1]); + dcorner1 [2] = dcorner2[2] = 0.5F * (corner1[2] + corner3[2]); + corner2 = dcorner1; + corner4 = dcorner2; + break; + case Aspect_GFM_CORNER1: + corner1 = myBgGradient.color1.rgb; + corner2 = myBgGradient.color2.rgb; + corner3 = myBgGradient.color2.rgb; + corner4 = myBgGradient.color2.rgb; + break; + case Aspect_GFM_CORNER2: + corner1 = myBgGradient.color2.rgb; + corner2 = myBgGradient.color1.rgb; + corner3 = myBgGradient.color2.rgb; + corner4 = myBgGradient.color2.rgb; + break; + case Aspect_GFM_CORNER3: + corner1 = myBgGradient.color2.rgb; + corner2 = myBgGradient.color2.rgb; + corner3 = myBgGradient.color1.rgb; + corner4 = myBgGradient.color2.rgb; + break; + case Aspect_GFM_CORNER4: + corner1 = myBgGradient.color2.rgb; + corner2 = myBgGradient.color2.rgb; + corner3 = myBgGradient.color2.rgb; + corner4 = myBgGradient.color1.rgb; + break; + default: + //printf("gradient background type not right\n"); + break; + } + + // Save GL parameters + glDisable( GL_LIGHTING ); //push GL_ENABLE_BIT + + GLint curSM; + glGetIntegerv( GL_SHADE_MODEL, &curSM ); + if ( curSM != GL_SMOOTH ) + glShadeModel( GL_SMOOTH ); //push GL_LIGHTING_BIT + + glBegin(GL_TRIANGLE_FAN); + if( myBgGradient.type != Aspect_GFM_CORNER2 && myBgGradient.type != Aspect_GFM_CORNER4 ) + { + glColor3f(corner1[0],corner1[1],corner1[2]); glVertex2f(-1.,-1.); + glColor3f(corner2[0],corner2[1],corner2[2]); glVertex2f( 1.,-1.); + glColor3f(corner3[0],corner3[1],corner3[2]); glVertex2f( 1., 1.); + glColor3f(corner4[0],corner4[1],corner4[2]); glVertex2f(-1., 1.); + } + else //if ( myBgGradient.type == Aspect_GFM_CORNER2 || myBgGradient.type == Aspect_GFM_CORNER4 ) + { + glColor3f(corner2[0],corner2[1],corner2[2]); glVertex2f( 1.,-1.); + glColor3f(corner3[0],corner3[1],corner3[2]); glVertex2f( 1., 1.); + glColor3f(corner4[0],corner4[1],corner4[2]); glVertex2f(-1., 1.); + glColor3f(corner1[0],corner1[1],corner1[2]); glVertex2f(-1.,-1.); + } + glEnd(); + + // Restore GL parameters + if ( curSM != GL_SMOOTH ) + glShadeModel( curSM ); + } + + glPopMatrix(); + glMatrixMode( GL_PROJECTION ); + glPopMatrix(); + glMatrixMode( GL_MODELVIEW ); + + glPopAttrib(); //GL_ENABLE_BIT | GL_TEXTURE_BIT + + if ( AWorkspace->UseZBuffer() ) + glEnable( GL_DEPTH_TEST ); + + /* GL_DITHER on/off pour le trace */ + if (AWorkspace->Dither()) + glEnable (GL_DITHER); + else + glDisable (GL_DITHER); + } + + // Switch off lighting by default + glDisable(GL_LIGHTING); + + ///////////////////////////////////////////////////////////////////////////// + // Step 2: Draw underlayer + RedrawLayer2d(AWorkspace, ACView, ACUnderLayer); + + ///////////////////////////////////////////////////////////////////////////// + // Step 3: Redraw main plane + + // Setup face culling + GLboolean isCullFace = GL_FALSE; + if ( myBackfacing ) + { + isCullFace = glIsEnabled( GL_CULL_FACE ); + if ( myBackfacing < 0 ) + { + glEnable( GL_CULL_FACE ); + glCullFace( GL_BACK ); + } + else + glDisable( GL_CULL_FACE ); + } + + //TsmPushAttri(); /* save previous graphics context */ + + // if the view is scaled normal vectors are scaled to unit length for correct displaying of shaded objects + if(myExtra.scaleFactors[0] != 1.F || + myExtra.scaleFactors[1] != 1.F || + myExtra.scaleFactors[2] != 1.F) + glEnable(GL_NORMALIZE); + else if(glIsEnabled(GL_NORMALIZE)) + glDisable(GL_NORMALIZE); + + // Apply View Projection + // This routine activates the Projection matrix for a view. + + glMatrixMode( GL_PROJECTION ); + +#ifdef WNT + // add printing scale/tiling transformation + OpenGl_PrinterContext* aPrinterContext = OpenGl_PrinterContext::GetPrinterContext(AWorkspace->GetGContext()); + + if (aPrinterContext) + { + GLfloat aProjMatrix[16]; + aPrinterContext->GetProjTransformation(aProjMatrix); + glLoadMatrixf((GLfloat*) aProjMatrix); + } + else +#endif + glLoadIdentity(); + + glMultMatrixf( (const GLfloat *) myMappingMatrix ); + + // Add translation necessary for the environnement mapping + if (mySurfaceDetail != Visual3d_TOD_NONE) + { + // OCC280: FitAll work incorrect for perspective view if the SurfaceDetail mode is V3d_TEX_ENVIRONMENT or V3d_TEX_ALL + // const GLfloat dep = vptr->vrep.extra.map.fpd * 0.5F; + const GLfloat dep = (myExtra.map.fpd + myExtra.map.bpd) * 0.5F; + glTranslatef(-dep*myExtra.vpn[0],-dep*myExtra.vpn[1],-dep*myExtra.vpn[2]); + } + + // Apply matrix + AWorkspace->SetViewMatrix((const OpenGl_Matrix *)myOrientationMatrix); + +/* +While drawing after a clipplane has been defined and enabled, each vertex +is transformed to eye-coordinates, where it is dotted with the transformed +clipping plane equation. Eye-coordinate vertexes whose dot product with +the transformed clipping plane equation is positive or zero are in, and +require no clipping. Those eye-coordinate vertexes whose dot product is +negative are clipped. Because clipplane clipping is done in eye- +coordinates, changes to the projection matrix have no effect on its +operation. + +A point and a normal are converted to a plane equation in the following manner: + +point = [Px,Py,Pz] + +normal = |Nx| +|Ny| +|Nz| + +plane equation = |A| +|B| +|C| +|D| +A = Nx +B = Ny +C = Nz +D = -[Px,Py,Pz] dot |Nx| +|Ny| +|Nz| + +*/ + + glPushAttrib( GL_FOG_BIT | GL_LIGHTING_BIT ); + + // Apply Fog + if ( myFog.IsOn ) + { + const GLfloat ramp = myExtra.map.fpd - myExtra.map.bpd; + const GLfloat fog_start = myFog.Front * ramp - myExtra.map.fpd; + const GLfloat fog_end = myFog.Back * ramp - myExtra.map.fpd; + + glFogi(GL_FOG_MODE, GL_LINEAR); + glFogf(GL_FOG_START, fog_start); + glFogf(GL_FOG_END, fog_end); + glFogfv(GL_FOG_COLOR, myFog.Color.rgb); + glEnable(GL_FOG); + } + else + glDisable(GL_FOG); + + // Apply Lights + { + int i; + + // Switch off all lights + for (i = GL_LIGHT0; i <= GL_LIGHT7; i++) + glDisable(i); + glLightModelfv(GL_LIGHT_MODEL_AMBIENT, default_amb); + + /* set les lights */ + int gl_lid = GL_LIGHT0; + OpenGl_ListOfLight::Iterator itl(myLights); + for (; itl.More(); itl.Next()) + { + const OpenGl_Light &alight = itl.Value(); + bind_light(&alight, &gl_lid); + } + + if (gl_lid != GL_LIGHT0) glEnable(GL_LIGHTING); + } + + // Apply InteriorShadingMethod + glShadeModel( myIntShadingMethod == TEL_SM_FLAT ? GL_FLAT : GL_SMOOTH ); + + // Apply clipping planes + { + // Define starting plane id + planeid = GL_CLIP_PLANE0; + + GLdouble equation[4]; + + if ( myZClip.Back.IsOn || myZClip.Front.IsOn ) + { + // Apply front and back clipping planes + GLfloat mat[4][4]; + glMatrixMode( GL_MODELVIEW ); + glGetFloatv( GL_MODELVIEW_MATRIX,(GLfloat *) mat ); + glLoadIdentity(); + + const GLdouble ramp = myExtra.map.fpd - myExtra.map.bpd; + + if ( myZClip.Back.IsOn ) + { + const GLdouble back = ramp * myZClip.Back.Limit + myExtra.map.bpd; + equation[0] = 0.0; /* Nx */ + equation[1] = 0.0; /* Ny */ + equation[2] = 1.0; /* Nz */ + equation[3] = -back; /* P dot N */ + glClipPlane( planeid, equation ); + glEnable( planeid ); + planeid++; + } + + if ( myZClip.Front.IsOn ) + { + const GLdouble front = ramp * myZClip.Front.Limit + myExtra.map.bpd; + equation[0] = 0.0; /* Nx */ + equation[1] = 0.0; /* Ny */ + equation[2] = -1.0; /* Nz */ + equation[3] = front; /* P dot N */ + glClipPlane( planeid, equation ); + glEnable( planeid ); + planeid++; + } + + glLoadMatrixf( (GLfloat *) mat ); + } + + // Apply user clipping planes + NCollection_List::Iterator planeIter(myClippingPlanes); + for ( ; planeIter.More(); planeIter.Next() ) + { + glClipPlane( planeid, planeIter.Value().equation ); + glEnable( planeid ); + planeid++; + } + } + + // Apply AntiAliasing + { + if (myAntiAliasing) + AWorkspace->NamedStatus |= OPENGL_NS_ANTIALIASING; + else + AWorkspace->NamedStatus &= ~OPENGL_NS_ANTIALIASING; + } + + Standard_Boolean isAnimationListOpen = Standard_False; + + // Request for update of animation mode? + if ( (AWorkspace->NamedStatus & OPENGL_NS_UPDATEAM) != 0 ) + { + // Request to rebuild display list + myAnimationListReady = Standard_False; + // Reset request for update of animation mode + AWorkspace->NamedStatus &= ~OPENGL_NS_UPDATEAM; + } + + // Is in animation mode? + if ( AWorkspace->NamedStatus & OPENGL_NS_ANIMATION ) + { + // Is the animation list ready? + if (myAnimationListReady) + { + // Execute the animation list + glCallList(myAnimationListIndex); + } + else + { + // Update the animation list + if ( AWorkspace->NamedStatus & OPENGL_NS_FLIST ) + { + if (myAnimationListIndex == 0) + myAnimationListIndex = glGenLists(1); + + if (myAnimationListIndex != 0) + { + glNewList(myAnimationListIndex, GL_COMPILE_AND_EXECUTE); + isAnimationListOpen = Standard_True; + } + } + else + AWorkspace->NamedStatus |= OPENGL_NS_FLIST; + } + } + else + myAnimationListReady = Standard_False; + + if (!myAnimationListReady) + { + // Clear status bitfields + AWorkspace->NamedStatus &= ~(OPENGL_NS_2NDPASSNEED | OPENGL_NS_2NDPASSDO); + + // Added PCT for handling of textures + switch (mySurfaceDetail) + { + case Visual3d_TOD_NONE: + AWorkspace->NamedStatus |= OPENGL_NS_FORBIDSETTEX; + DisableTexture(); + // Render the view + RenderStructs(AWorkspace); + break; + + case Visual3d_TOD_ENVIRONMENT: + AWorkspace->NamedStatus |= OPENGL_NS_FORBIDSETTEX; + SetCurrentTexture(myTextureEnv); + EnableTexture(); + // Render the view + RenderStructs(AWorkspace); + DisableTexture(); + break; + + case Visual3d_TOD_ALL: + // First pass + AWorkspace->NamedStatus &= ~OPENGL_NS_FORBIDSETTEX; + // Render the view + RenderStructs(AWorkspace); + DisableTexture(); + + // Second pass + if (AWorkspace->NamedStatus & OPENGL_NS_2NDPASSNEED) + { + AWorkspace->NamedStatus |= OPENGL_NS_2NDPASSDO; + SetCurrentTexture(myTextureEnv); + EnableTexture(); + + /* sauvegarde de quelques parametres OpenGL */ + GLint blend_dst, blend_src; + GLint zbuff_f; + GLboolean zbuff_w; + glGetBooleanv(GL_DEPTH_WRITEMASK, &zbuff_w); + glGetIntegerv(GL_DEPTH_FUNC, &zbuff_f); + glGetIntegerv(GL_BLEND_DST, &blend_dst); + glGetIntegerv(GL_BLEND_SRC, &blend_src); + GLboolean zbuff_state = glIsEnabled(GL_DEPTH_TEST); + GLboolean blend_state = glIsEnabled(GL_BLEND); + + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + + glDepthFunc(GL_EQUAL); + glDepthMask(GL_FALSE); + glEnable(GL_DEPTH_TEST); + + AWorkspace->NamedStatus |= OPENGL_NS_FORBIDSETTEX; + + // Render the view + RenderStructs(AWorkspace); + DisableTexture(); + + /* restauration des parametres OpenGL */ + glBlendFunc(blend_src, blend_dst); + if (!blend_state) glDisable(GL_BLEND); + + glDepthFunc(zbuff_f); + glDepthMask(zbuff_w); + if (!zbuff_state) glDisable(GL_DEPTH_FUNC); + } + break; + } + + if (isAnimationListOpen) + { + glEndList(); + myAnimationListReady = Standard_True; + } + } + + /* restore previous graphics context; before update lights */ + //TsmPopAttri(); + + // Disable current clipping planes + for ( planeid = GL_CLIP_PLANE0; planeid < lastid; planeid++ ) + glDisable( planeid ); + + /* affichage de Triedre Non Zoomable de la vue s'il existe */ + if (!myTrihedron.IsNull()) + myTrihedron->Render(AWorkspace); + if (!myGraduatedTrihedron.IsNull()) + myGraduatedTrihedron->Render(AWorkspace); + + glPopAttrib(); // GL_FOG_BIT | GL_LIGHTING_BIT + + // Restore face culling + if ( myBackfacing ) + { + if ( isCullFace ) + { + glEnable ( GL_CULL_FACE ); + glCullFace ( GL_BACK ); + } + else + glDisable ( GL_CULL_FACE ); + } + + ///////////////////////////////////////////////////////////////////////////// + // Step 6: Draw overlayer + // Redrawing to bitmap or window? + const int amode = (AWorkspace->NamedStatus & OPENGL_NS_ISBITMAP)? OCC_REDRAW_BITMAP : OCC_REDRAW_WINDOW; + + AWorkspace->DisplayCallback(ACView,(amode | OCC_PRE_OVERLAY)); + + RedrawLayer2d(AWorkspace, ACView, ACOverLayer); + + AWorkspace->DisplayCallback(ACView,amode); + + // Restore clipping planes + for ( ptrPlane = oldPlanes, planeid = GL_CLIP_PLANE0; planeid < lastid; planeid++, ptrPlane++ ) + { + glClipPlane( planeid, ptrPlane->Equation ); + if ( ptrPlane->isEnabled ) + glEnable( planeid ); + else + glDisable( planeid ); + } + delete[] oldPlanes; +} + +/*----------------------------------------------------------------------*/ + +//ExecuteViewDisplay +void OpenGl_View::RenderStructs (const Handle(OpenGl_Workspace) &AWorkspace) +{ + if ( myStructures.NbStructures() <= 0 ) return; + + glPushAttrib ( GL_DEPTH_BUFFER_BIT ); + + const OpenGl_AspectLine *aspect_line = AWorkspace->AspectLine( Standard_True ); + + //TsmPushAttri(); /* save previous graphics context */ + + if ( (AWorkspace->NamedStatus & OPENGL_NS_2NDPASSNEED) == 0 ) + { + const int antiAliasingMode = AWorkspace->GetDisplay()->AntiAliasingMode(); + + if ( !myAntiAliasing ) + { + glDisable(GL_POINT_SMOOTH); + glDisable(GL_LINE_SMOOTH); + if( antiAliasingMode & 2 ) glDisable(GL_POLYGON_SMOOTH); + glBlendFunc (GL_ONE, GL_ZERO); + glDisable (GL_BLEND); + } + else + { + glEnable(GL_POINT_SMOOTH); + glEnable(GL_LINE_SMOOTH); + if( antiAliasingMode & 2 ) glEnable(GL_POLYGON_SMOOTH); + glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable (GL_BLEND); + } + } + + myStructures.Render(AWorkspace); + + //TsmPopAttri(); /* restore previous graphics context; before update lights */ + + if ( AWorkspace->DegenerateModel > 1 ) + { + glLineWidth ( aspect_line->Width() ); + if ( aspect_line->Type() != Aspect_TOL_SOLID ) glEnable ( GL_LINE_STIPPLE ); + } + + glPopAttrib (); +} + +/*----------------------------------------------------------------------*/ + +//call_togl_redraw_layer2d +void OpenGl_View::RedrawLayer2d (const Handle(OpenGl_Workspace) &AWorkspace, const Graphic3d_CView& ACView, const Aspect_CLayer2d& ACLayer) +{ + if (&ACLayer == NULL + || ACLayer.ptrLayer == NULL + || ACLayer.ptrLayer->listIndex == 0) return; + + GLsizei dispWidth, dispHeight; + if ( ACView.DefBitmap.bitmap ) { + dispWidth = ACView.DefBitmap.width; + dispHeight = ACView.DefBitmap.height; + } + else { + dispWidth = (GLsizei) ACLayer.viewport[0]; + dispHeight = (GLsizei) ACLayer.viewport[1]; + } + + const GLboolean isl = glIsEnabled(GL_LIGHTING); /*OCC6247*/ + if (isl) + glDisable(GL_LIGHTING); /*OCC6247*/ + + /* + * On positionne la projection + */ + glMatrixMode( GL_MODELVIEW ); + glPushMatrix (); + glLoadIdentity (); + + glMatrixMode (GL_PROJECTION); + glPushMatrix (); + glLoadIdentity (); + + if (!ACLayer.sizeDependent) + glViewport (0, 0, dispWidth, dispHeight); + + float left = ACLayer.ortho[0]; + float right = ACLayer.ortho[1]; + float bottom = ACLayer.ortho[2]; + float top = ACLayer.ortho[3]; + + int attach = ACLayer.attach; + + float ratio; + if (!ACLayer.sizeDependent) + ratio = (float) dispWidth/dispHeight; + else + ratio = ACView.DefWindow.dx/ACView.DefWindow.dy; + + float delta; + if (ratio >= 1.0) { /* fenetre horizontale */ + delta = (float )((top - bottom)/2.0); + switch (attach) { + case 0: /* Aspect_TOC_BOTTOM_LEFT */ + top = bottom + 2*delta/ratio; + break; + case 1: /* Aspect_TOC_BOTTOM_RIGHT */ + top = bottom + 2*delta/ratio; + break; + case 2: /* Aspect_TOC_TOP_LEFT */ + bottom = top - 2*delta/ratio; + break; + case 3: /* Aspect_TOC_TOP_RIGHT */ + bottom = top - 2*delta/ratio; + break; + } + } + else { /* fenetre verticale */ + delta = (float )((right - left)/2.0); + switch (attach) { + case 0: /* Aspect_TOC_BOTTOM_LEFT */ + right = left + 2*delta*ratio; + break; + case 1: /* Aspect_TOC_BOTTOM_RIGHT */ + left = right - 2*delta*ratio; + break; + case 2: /* Aspect_TOC_TOP_LEFT */ + right = left + 2*delta*ratio; + break; + case 3: /* Aspect_TOC_TOP_RIGHT */ + left = right - 2*delta*ratio; + break; + } + } + +#ifdef WNT + // Check printer context that exists only for print operation + OpenGl_PrinterContext* aPrinterContext = OpenGl_PrinterContext::GetPrinterContext (AWorkspace->GetGContext()); + + if (aPrinterContext) + { + // additional transformation matrix could be applied to + // render only those parts of viewport that will be + // passed to a printer as a current "frame" to provide + // tiling; scaling of graphics by matrix helps render a + // part of a view (frame) in same viewport, but with higher + // resolution + GLfloat aProjMatrix[16]; + aPrinterContext->GetProjTransformation (aProjMatrix); + glLoadMatrixf ((GLfloat*) aProjMatrix); + + // printing operation also assumes other viewport dimension + // to comply with transformation matrix or graphics scaling + // factors for tiling for layer redraw + GLsizei anViewportX = 0; + GLsizei anViewportY = 0; + aPrinterContext->GetLayerViewport (anViewportX, anViewportY); + if (anViewportX != 0 && anViewportY != 0) + glViewport (0, 0, anViewportX, anViewportY); + } +#endif + + glOrtho (left, right, bottom, top, -1.0, 1.0); + + /* + * On trace la display-list associee au layer. + */ + glPushAttrib ( + GL_LIGHTING_BIT | GL_LINE_BIT | GL_POLYGON_BIT | + GL_DEPTH_BUFFER_BIT | GL_CURRENT_BIT | GL_TEXTURE_BIT ); + glDisable (GL_DEPTH_TEST); + glCallList (ACLayer.ptrLayer->listIndex); + + //calling dynamic render of LayerItems + if ( ACLayer.ptrLayer->layerData ) + { + InitLayerProp(ACLayer.ptrLayer->listIndex); + ((Visual3d_Layer*)ACLayer.ptrLayer->layerData)->RenderLayerItems(); + InitLayerProp(0); + } + + glPopAttrib (); + + /* + * On retire la projection + */ + glMatrixMode (GL_PROJECTION); + glPopMatrix (); + + glMatrixMode( GL_MODELVIEW ); + glPopMatrix (); + + /* + * Restauration du Viewport en cas de modification + */ + if (!ACLayer.sizeDependent) + glViewport (0, 0, (GLsizei) ACView.DefWindow.dx, (GLsizei) ACView.DefWindow.dy); + + glFlush (); + + if (isl) + glEnable(GL_LIGHTING); /*OCC6247*/ +} + +/*----------------------------------------------------------------------*/ + +//call_togl_create_bg_texture +void OpenGl_View::CreateBackgroundTexture (const Standard_CString AFileName, const Aspect_FillMethod AFillStyle) +{ + // Delete existing texture + if ( myBgTexture.TexId != 0 ) + { + glDeleteTextures( 1, (GLuint*)&(myBgTexture.TexId) ); + myBgTexture.TexId = 0; + } + + Standard_Integer width, height; + Handle(Image_Image) image; + if ( AlienImage::LoadImageFile( AFileName, image, width, height ) ) + { + const int nbbytes = width * height * 3; + GLubyte *data = new GLubyte[nbbytes]; + GLubyte *pdata = data; + Standard_Integer i, j; + for ( j = height - 1; j >= 0; j-- ) + for ( i = 0; i < width; i++ ) + { + const Quantity_Color &color = image->PixelColor( i, j ); + *pdata++ = (GLubyte)( 255 * color.Red() ); + *pdata++ = (GLubyte)( 255 * color.Green() ); + *pdata++ = (GLubyte)( 255 * color.Blue() ); + } + + GLuint texture = 0; + glGenTextures( 1, &texture ); + glBindTexture( GL_TEXTURE_2D, texture ); + + /* Create MipMapped Texture */ + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT ); + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT ); + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST); + + gluBuild2DMipmaps( GL_TEXTURE_2D, 3/*4*/, width, height, GL_RGB, GL_UNSIGNED_BYTE, data ); + + delete[] data; + + myBgTexture.TexId = texture; + myBgTexture.Width = width; + myBgTexture.Height = height; + switch ( AFillStyle ) + { + case Aspect_FM_NONE : + myBgTexture.Style = Aspect_FM_CENTERED; + break; + default : + myBgTexture.Style = AFillStyle; + break; + } + } +} + +/*----------------------------------------------------------------------*/ + +//call_togl_set_bg_texture_style +void OpenGl_View::SetBackgroundTextureStyle (const Aspect_FillMethod AFillStyle) +{ + /* check if background texture is already created */ + if ( myBgTexture.TexId != 0 ) + { + switch ( AFillStyle ) + { + case Aspect_FM_NONE : + myBgTexture.Style = Aspect_FM_CENTERED; + break; + default : + myBgTexture.Style = AFillStyle; + break; + } + } +} + +/*----------------------------------------------------------------------*/ + +//call_togl_gradient_background +void OpenGl_View::SetBackgroundGradient (const Quantity_Color& AColor1, + const Quantity_Color& AColor2, + const Aspect_GradientFillMethod AType) +{ + Standard_Real R,G,B; + AColor1.Values( R, G, B, Quantity_TOC_RGB ); + myBgGradient.color1.rgb[0] = ( Tfloat )R; + myBgGradient.color1.rgb[1] = ( Tfloat )G; + myBgGradient.color1.rgb[2] = ( Tfloat )B; + myBgGradient.color1.rgb[3] = 0.F; + + AColor2.Values( R, G, B, Quantity_TOC_RGB ); + myBgGradient.color2.rgb[0] = ( Tfloat )R; + myBgGradient.color2.rgb[1] = ( Tfloat )G; + myBgGradient.color2.rgb[2] = ( Tfloat )B; + myBgGradient.color2.rgb[3] = 0.F; + + myBgGradient.type = AType; +} + +/*----------------------------------------------------------------------*/ + +//call_togl_set_gradient_type +void OpenGl_View::SetBackgroundGradientType (const Aspect_GradientFillMethod AType) +{ + // check if gradient background is already created + if ( myBgGradient.type != Aspect_GFM_NONE ) + myBgGradient.type = AType; +} + +/*----------------------------------------------------------------------*/ diff --git a/src/OpenGl/OpenGl_Window.cxx b/src/OpenGl/OpenGl_Window.cxx new file mode 100644 index 0000000000..e3ac8e01ce --- /dev/null +++ b/src/OpenGl/OpenGl_Window.cxx @@ -0,0 +1,684 @@ +// File: OpenGl_Window.cxx +// Created: 20 September 2011 +// Author: Sergey ZERCHANINOV +// Copyright: OPEN CASCADE 2011 + +#include + +#include + +#include +#include +#include +#include + +#include +#include + +IMPLEMENT_STANDARD_HANDLE(OpenGl_Window,MMgt_TShared) +IMPLEMENT_STANDARD_RTTIEXT(OpenGl_Window,MMgt_TShared) + +namespace +{ + static const TEL_COLOUR THE_DEFAULT_BG_COLOR = { { 0.F, 0.F, 0.F, 1.F } }; + + static GLCONTEXT ThePreviousCtx = 0; // to share GL resources +#if (!defined(_WIN32) && !defined(__WIN32__)) + static GLXContext TheDeadGlxCtx; // Context to be destroyed + static Display* TheDeadGlxDpy; // Display associated with TheDeadGlxCtx +#endif + +#if (defined(_WIN32) || defined(__WIN32__)) + static int find_pixel_format (HDC hDC, PIXELFORMATDESCRIPTOR* pfd, const Standard_Boolean dbuff) + { + PIXELFORMATDESCRIPTOR pfd0; + memset (&pfd0, 0, sizeof (PIXELFORMATDESCRIPTOR)); + pfd0.nSize = sizeof (PIXELFORMATDESCRIPTOR); + pfd0.nVersion = 1; + pfd0.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | (dbuff ? PFD_DOUBLEBUFFER : PFD_SUPPORT_GDI); + pfd0.iPixelType = PFD_TYPE_RGBA; + pfd0.iLayerType = PFD_MAIN_PLANE; + + int iPixelFormat = 0; + int iGood = 0; + const int cBits[] = { 32, 24 }; + const int dBits[] = { 32, 24, 16 }; + + int i, j; + for (i = 0; i < sizeof(dBits) / sizeof(int); i++) + { + pfd0.cDepthBits = dBits[i]; + iGood = 0; + for (j = 0; j < sizeof(cBits) / sizeof(int); j++) + { + pfd0.cColorBits = cBits[j]; + iPixelFormat = ChoosePixelFormat (hDC, &pfd0); + if (iPixelFormat) + { + pfd->cDepthBits = 0; + pfd->cColorBits = 0; + DescribePixelFormat (hDC, iPixelFormat, sizeof (PIXELFORMATDESCRIPTOR), pfd); + if (pfd->cColorBits >= cBits[j] && pfd->cDepthBits >= dBits[i]) + break; + if (iGood == 0) + iGood = iPixelFormat; + } + } + if (j < sizeof(cBits) / sizeof(int)) + break; + } + + if (iPixelFormat == 0) + iPixelFormat = iGood; + + return iPixelFormat; + } +#else + static Bool WaitForNotify (Display* theDisp, XEvent* theEv, char* theArg) + { + return (theEv->type == MapNotify) && (theEv->xmap.window == (Window )theArg); + } +#endif + +}; + +// ======================================================================= +// function : OpenGl_Window +// purpose : +// ======================================================================= +OpenGl_Window::OpenGl_Window (const Handle(OpenGl_Display)& theDisplay, + const CALL_DEF_WINDOW& theCWindow, + Aspect_RenderingContext theGContext) +: myDisplay (theDisplay), + myWindow (0), + myGContext ((GLCONTEXT )theGContext), + myGlContext (new OpenGl_Context()), + myOwnGContext (theGContext == 0), +#if (defined(_WIN32) || defined(__WIN32__)) + myWindowDC (0), + mySysPalInUse (FALSE), +#endif + myWidth ((Standard_Integer )theCWindow.dx), + myHeight ((Standard_Integer )theCWindow.dy), + myBgColor (THE_DEFAULT_BG_COLOR), + myDither (theDisplay->Dither()), + myBackDither (theDisplay->BackDither()) +{ + myBgColor.rgb[0] = theCWindow.Background.r; + myBgColor.rgb[1] = theCWindow.Background.g; + myBgColor.rgb[2] = theCWindow.Background.b; + + WINDOW aParent = (WINDOW )theCWindow.XWindow; + DISPLAY* aDisp = (DISPLAY* )myDisplay->GetDisplay(); + +#if (!defined(_WIN32) && !defined(__WIN32__)) + XWindowAttributes wattr; + XGetWindowAttributes (aDisp, aParent, &wattr); + const int scr = DefaultScreen (aDisp); + + XVisualInfo* aVis = NULL; + { + unsigned long aVisInfoMask = VisualIDMask | VisualScreenMask; + XVisualInfo aVisInfo; + aVisInfo.visualid = wattr.visual->visualid; + aVisInfo.screen = scr; + int aNbItems; + aVis = XGetVisualInfo (aDisp, aVisInfoMask, &aVisInfo, &aNbItems); + } + + WINDOW win; + + if (!myOwnGContext) + { + if (aVis != NULL) + { + Aspect_GraphicDeviceDefinitionError::Raise ("OpenGl_Window::CreateWindow: XGetVisualInfo failed."); + return; + } + + win = aParent; + } + else + { + GLCONTEXT ctx; + + #if defined(__linux) || defined(Linux) + if (aVis != NULL) + { + // check Visual for OpenGl context's parameters compability + int isGl = 0, isDoubleBuffer = 0, isRGBA = 0, aDepthSize = 0; + + if (glXGetConfig (aDisp, aVis, GLX_USE_GL, &isGl) != 0) + isGl = 0; + + if (glXGetConfig (aDisp, aVis, GLX_RGBA, &isRGBA) != 0) + isRGBA = 0; + + if (glXGetConfig (aDisp, aVis, GLX_DOUBLEBUFFER, &isDoubleBuffer) != 0) + isDoubleBuffer = 0; + + if (glXGetConfig (aDisp, aVis, GLX_DEPTH_SIZE, &aDepthSize) != 0) + aDepthSize = 0; + + if (!isGl || !aDepthSize || !isRGBA || (isDoubleBuffer ? 1 : 0) != (myDisplay->DBuffer()? 1 : 0)) + { + XFree (aVis); + aVis = NULL; + } + } + #endif + + if (aVis == NULL) + { + int anIter = 0; + int anAttribs[11]; + anAttribs[anIter++] = GLX_RGBA; + + anAttribs[anIter++] = GLX_DEPTH_SIZE; + anAttribs[anIter++] = 1; + + anAttribs[anIter++] = GLX_RED_SIZE; + anAttribs[anIter++] = (wattr.depth <= 8) ? 0 : 1; + + anAttribs[anIter++] = GLX_GREEN_SIZE; + anAttribs[anIter++] = (wattr.depth <= 8) ? 0 : 1; + + anAttribs[anIter++] = GLX_BLUE_SIZE; + anAttribs[anIter++] = (wattr.depth <= 8) ? 0 : 1; + + if (myDisplay->DBuffer()) + anAttribs[anIter++] = GLX_DOUBLEBUFFER; + + anAttribs[anIter++] = None; + + aVis = glXChooseVisual (aDisp, scr, anAttribs); + if (aVis == NULL) + { + Aspect_GraphicDeviceDefinitionError::Raise ("OpenGl_Window::CreateWindow: glXChooseVisual failed."); + return; + } + } + + if (TheDeadGlxCtx) + { + // recover display lists from TheDeadGlxCtx, then destroy it + ctx = glXCreateContext (aDisp, aVis, TheDeadGlxCtx, GL_TRUE); + + OpenGl_ResourceCleaner::GetInstance()->RemoveContext (TheDeadGlxCtx); + glXDestroyContext (TheDeadGlxDpy, TheDeadGlxCtx); + + TheDeadGlxCtx = 0; + } + else if (ThePreviousCtx == 0) + { + ctx = glXCreateContext (aDisp, aVis, NULL, GL_TRUE); + } + else + { + // ctx est une copie du previous + ctx = glXCreateContext (aDisp, aVis, ThePreviousCtx, GL_TRUE); + } + + if (!ctx) + { + Aspect_GraphicDeviceDefinitionError::Raise ("OpenGl_Window::CreateWindow: glXCreateContext failed."); + return; + } + + OpenGl_ResourceCleaner::GetInstance()->AppendContext (ctx, true); + + ThePreviousCtx = ctx; + + Colormap cmap = XCreateColormap (aDisp, aParent, aVis->visual, AllocNone); + + XColor color; + color.red = (unsigned short) (myBgColor.rgb[0] * 0xFFFF); + color.green = (unsigned short) (myBgColor.rgb[1] * 0xFFFF); + color.blue = (unsigned short) (myBgColor.rgb[2] * 0xFFFF); + color.flags = DoRed | DoGreen | DoBlue; + XAllocColor (aDisp, cmap, &color); + + XSetWindowAttributes cwa; + cwa.colormap = cmap; + cwa.event_mask = StructureNotifyMask; + cwa.border_pixel = color.pixel; + cwa.background_pixel = color.pixel; + + if (aVis->visualid == wattr.visual->visualid) + { + win = aParent; + } + else + { + unsigned long mask = CWBackPixel | CWColormap | CWBorderPixel | CWEventMask; + win = XCreateWindow (aDisp, aParent, 0, 0, myWidth, myHeight, 0/*bw*/, aVis->depth, InputOutput, aVis->visual, mask, &cwa); + } + + XSetWindowBackground (aDisp, win, cwa.background_pixel); + XClearWindow (aDisp, win); + + if (win != aParent) + { + XEvent anEvent; + XMapWindow (aDisp, win); + XIfEvent (aDisp, &anEvent, WaitForNotify, (char* )win); + } + + myGContext = ctx; + } + + /* + * Le BackDitherProp est utilise pour le clear du background + * Pour eviter une difference de couleurs avec la couleur choisie + * par l'application (XWindow) il faut desactiver le dithering + * au dessus de 8 plans. + * + * Pour le DitherProp: + * On cherchera a activer le Dithering que si le Visual a au moins + * 8 plans pour le GLX_RED_SIZE. Le test est plus sur car on peut + * avoir une profondeur superieure a 12 mais avoir besoin du dithering. + * (Carte Impact avec GLX_RED_SIZE a 5 par exemple) + */ + + int value; + glXGetConfig (aDisp, aVis, GLX_RED_SIZE, &value); + + if (myDither) + myDither = (value < 8); + + if (myBackDither) + myBackDither = (aVis->depth <= 8); + + XFree ((char* )aVis); + + myWindow = win; + +#else + + myWindowDC = GetDC (aParent); + + PIXELFORMATDESCRIPTOR pfd; + int iPixelFormat = find_pixel_format (myWindowDC, &pfd, myDisplay->DBuffer()); + if (iPixelFormat == 0) + { + ReleaseDC (aParent, myWindowDC); + myWindowDC = 0; + + TCollection_AsciiString msg ("OpenGl_Window::CreateWindow: ChoosePixelFormat failed. Error code: "); + msg += (int )GetLastError(); + Aspect_GraphicDeviceDefinitionError::Raise (msg.ToCString()); + return; + } + + if (pfd.dwFlags & PFD_NEED_PALETTE) + { + WINDOW_DATA* wd = (WINDOW_DATA* )GetWindowLongPtr (aParent, GWLP_USERDATA); + + mySysPalInUse = (pfd.dwFlags & PFD_NEED_SYSTEM_PALETTE) ? TRUE : FALSE; + InterfaceGraphic_RealizePalette (myWindowDC, wd->hPal, FALSE, mySysPalInUse); + } + + if (myDither) + myDither = (pfd.cColorBits <= 8); + + if (myBackDither) + myBackDither = (pfd.cColorBits <= 8); + + if (!SetPixelFormat (myWindowDC, iPixelFormat, &pfd)) + { + ReleaseDC (aParent, myWindowDC); + myWindowDC = NULL; + + TCollection_AsciiString msg("OpenGl_Window::CreateWindow: SetPixelFormat failed. Error code: "); + msg += (int)GetLastError(); + Aspect_GraphicDeviceDefinitionError::Raise (msg.ToCString()); + return; + } + + if (!myOwnGContext) + { + ThePreviousCtx = myGContext; + } + else + { + myGContext = wglCreateContext (myWindowDC); + if (myGContext == NULL) + { + ReleaseDC (aParent, myWindowDC); + myWindowDC = NULL; + + TCollection_AsciiString msg ("OpenGl_Window::CreateWindow: wglCreateContext failed. Error code: "); + msg += (int )GetLastError(); + Aspect_GraphicDeviceDefinitionError::Raise (msg.ToCString()); + return; + } + + Standard_Boolean isShared = Standard_True; + if (ThePreviousCtx == NULL) + { + ThePreviousCtx = myGContext; + } + else + { + // if we already have some shared context + GLCONTEXT shareCtx = OpenGl_ResourceCleaner::GetInstance()->GetSharedContext(); + if (shareCtx != NULL) + { + // try to share context with one from resource cleaner list + isShared = (Standard_Boolean )wglShareLists (shareCtx, myGContext); + } + else + { + isShared = (Standard_Boolean )wglShareLists (ThePreviousCtx, myGContext); + // add shared ThePreviousCtx to a control list if it's not there + if (isShared) + OpenGl_ResourceCleaner::GetInstance()->AppendContext (ThePreviousCtx, isShared); + } + } + + // add the context to OpenGl_ResourceCleaner control list + OpenGl_ResourceCleaner::GetInstance()->AppendContext (myGContext, isShared); + } + + myWindow = aParent; +#endif + + Init(); + myGlContext->Init(); +} + +// ======================================================================= +// function : ~OpenGl_Window +// purpose : +// ======================================================================= +OpenGl_Window::~OpenGl_Window() +{ + DISPLAY* aDisp = (DISPLAY* )myDisplay->GetDisplay(); + if (aDisp == NULL || !myOwnGContext) + return; + +#if (defined(_WIN32) || defined(__WIN32__)) + OpenGl_ResourceCleaner::GetInstance()->RemoveContext (myGContext); + + if (wglGetCurrentContext() != NULL) + wglDeleteContext (myGContext); + ReleaseDC (myWindow, myWindowDC); + + if (myDisplay->myMapOfWindows.Size() == 0) + ThePreviousCtx = 0; +#else + // FSXXX sync necessary if non-direct rendering + glXWaitGL(); + + if (ThePreviousCtx == myGContext) + { + ThePreviousCtx = NULL; + if (myDisplay->myMapOfWindows.Size() > 0) + { + NCollection_DataMap::Iterator it (myDisplay->myMapOfWindows); + ThePreviousCtx = it.Value()->myGContext; + } + + // if this is the last remaining context, do not destroy it yet, to avoid + // losing any shared display lists (fonts...) + if (ThePreviousCtx) + { + OpenGl_ResourceCleaner::GetInstance()->RemoveContext(myGContext); + glXDestroyContext(aDisp, myGContext); + } + else + { + TheDeadGlxCtx = myGContext; + TheDeadGlxDpy = aDisp; + } + } + else + { + OpenGl_ResourceCleaner::GetInstance()->RemoveContext (myGContext); + glXDestroyContext (aDisp, myGContext); + } +#endif +} + +// ======================================================================= +// function : Activate +// purpose : +// ======================================================================= +Standard_Boolean OpenGl_Window::Activate() +{ + DISPLAY* aDisp = (DISPLAY* )myDisplay->GetDisplay(); + if (aDisp == NULL) + return Standard_False; + +#if (defined(_WIN32) || defined(__WIN32__)) + if (!wglMakeCurrent (myWindowDC, myGContext)) + { + //GLenum errorcode = glGetError(); + //const GLubyte *errorstring = gluErrorString(errorcode); + //printf("wglMakeCurrent failed: %d %s\n", errorcode, errorstring); + return Standard_False; + } +#else + if (!glXMakeCurrent (aDisp, myWindow, myGContext)) + { + // if there is no current context it might be impossible to use glGetError correctly + //printf("glXMakeCurrent failed!\n"); + return Standard_False; + } +#endif + + return Standard_True; +} + +// ======================================================================= +// function : Resize +// purpose : call_subr_resize +// ======================================================================= +void OpenGl_Window::Resize (const CALL_DEF_WINDOW& theCWindow) +{ + DISPLAY* aDisp = (DISPLAY* )myDisplay->GetDisplay(); + if (aDisp == NULL) + return; + + // If the size is not changed - do nothing + if ((myWidth == theCWindow.dx) && (myHeight == theCWindow.dy)) + return; + + myWidth = (Standard_Integer )theCWindow.dx; + myHeight = (Standard_Integer )theCWindow.dy; + +#if (!defined(_WIN32) && !defined(__WIN32__)) + XResizeWindow (aDisp, myWindow, (unsigned int )myWidth, (unsigned int )myHeight); + XSync (aDisp, False); +#endif + + Init(); +} + +// ======================================================================= +// function : ReadDepths +// purpose : TelReadDepths +// ======================================================================= +void OpenGl_Window::ReadDepths (const Standard_Integer theX, const Standard_Integer theY, + const Standard_Integer theWidth, const Standard_Integer theHeight, + float* theDepths) +{ + if (theDepths == NULL || !Activate()) + return; + + glMatrixMode (GL_PROJECTION); + glLoadIdentity(); + gluOrtho2D (0.0, (GLdouble )myWidth, 0.0, (GLdouble )myHeight); + glMatrixMode (GL_MODELVIEW); + glLoadIdentity(); + + glRasterPos2i (theX, theY); + DisableFeatures(); + glReadPixels (theX, theY, theWidth, theHeight, GL_DEPTH_COMPONENT, GL_FLOAT, theDepths); + EnableFeatures(); +} + +// ======================================================================= +// function : SetBackgroundColor +// purpose : call_subr_set_background +// ======================================================================= +void OpenGl_Window::SetBackgroundColor (const Standard_ShortReal theR, + const Standard_ShortReal theG, + const Standard_ShortReal theB) +{ + myBgColor.rgb[0] = theR; + myBgColor.rgb[1] = theG; + myBgColor.rgb[2] = theB; +} + +// ======================================================================= +// function : Init +// purpose : +// ======================================================================= +void OpenGl_Window::Init() +{ + if (!Activate()) + return; + +#if (defined(_WIN32) || defined(__WIN32__)) + RECT cr; + GetClientRect (myWindow, &cr); + myWidth = cr.right - cr.left; + myHeight = cr.bottom - cr.top; +#else + Window aRootWin; + int aDummy; + unsigned int aDummyU; + unsigned int aNewWidth = 0; + unsigned int aNewHeight = 0; + DISPLAY* aDisp = (DISPLAY* )myDisplay->GetDisplay(); + XGetGeometry (aDisp, myWindow, &aRootWin, &aDummy, &aDummy, &aNewWidth, &aNewHeight, &aDummyU, &aDummyU); + myWidth = aNewWidth; + myHeight = aNewHeight; +#endif + + glMatrixMode (GL_MODELVIEW); + glViewport (0, 0, myWidth, myHeight); + + glDisable (GL_SCISSOR_TEST); + glDrawBuffer (GL_BACK); +} + +// ======================================================================= +// function : EnablePolygonOffset +// purpose : call_subr_enable_polygon_offset +// ======================================================================= +void OpenGl_Window::EnablePolygonOffset() const +{ + Standard_ShortReal aFactor, aUnits; + myDisplay->PolygonOffset (aFactor, aUnits); + glPolygonOffset (aFactor, aUnits); + glEnable (GL_POLYGON_OFFSET_FILL); +} + +// ======================================================================= +// function : DisablePolygonOffset +// purpose : call_subr_disable_polygon_offset +// ======================================================================= +void OpenGl_Window::DisablePolygonOffset() const +{ + glDisable (GL_POLYGON_OFFSET_FILL); +} + +// ======================================================================= +// function : EnableFeatures +// purpose : +// ======================================================================= +void OpenGl_Window::EnableFeatures() const +{ + /*glPixelTransferi (GL_MAP_COLOR, GL_TRUE);*/ + + if (myDither) + glEnable (GL_DITHER); + else + glDisable (GL_DITHER); +} + +// ======================================================================= +// function : DisableFeatures +// purpose : +// ======================================================================= +void OpenGl_Window::DisableFeatures() const +{ + glDisable (GL_DITHER); + glPixelTransferi (GL_MAP_COLOR, GL_FALSE); + + /* + * Disable stuff that's likely to slow down glDrawPixels. + * (Omit as much of this as possible, when you know in advance + * that the OpenGL state will already be set correctly.) + */ + glDisable(GL_ALPHA_TEST); + glDisable(GL_BLEND); + glDisable(GL_DEPTH_TEST); + glDisable(GL_FOG); + glDisable(GL_LIGHTING); + + glDisable(GL_LOGIC_OP); + glDisable(GL_STENCIL_TEST); + glDisable(GL_TEXTURE_1D); + glDisable(GL_TEXTURE_2D); + glPixelTransferi(GL_MAP_COLOR, GL_FALSE); + glPixelTransferi(GL_RED_SCALE, 1); + glPixelTransferi(GL_RED_BIAS, 0); + glPixelTransferi(GL_GREEN_SCALE, 1); + glPixelTransferi(GL_GREEN_BIAS, 0); + glPixelTransferi(GL_BLUE_SCALE, 1); + glPixelTransferi(GL_BLUE_BIAS, 0); + glPixelTransferi(GL_ALPHA_SCALE, 1); + glPixelTransferi(GL_ALPHA_BIAS, 0); + + /* + * Disable extensions that could slow down glDrawPixels. + * (Actually, you should check for the presence of the proper + * extension before making these calls. I've omitted that + * code for simplicity.) + */ + +#ifdef GL_EXT_convolution + glDisable(GL_CONVOLUTION_1D_EXT); + glDisable(GL_CONVOLUTION_2D_EXT); + glDisable(GL_SEPARABLE_2D_EXT); +#endif + +#ifdef GL_EXT_histogram + glDisable(GL_HISTOGRAM_EXT); + glDisable(GL_MINMAX_EXT); +#endif + +#ifdef GL_EXT_texture3D + glDisable(GL_TEXTURE_3D_EXT); +#endif +} + +// ======================================================================= +// function : MakeFrontBufCurrent +// purpose : TelMakeFrontBufCurrent +// ======================================================================= +void OpenGl_Window::MakeFrontBufCurrent() const +{ + glDrawBuffer (GL_FRONT); +} + +// ======================================================================= +// function : MakeBackBufCurrent +// purpose : TelMakeBackBufCurrent +// ======================================================================= +void OpenGl_Window::MakeBackBufCurrent() const +{ + glDrawBuffer (GL_BACK); +} + +// ======================================================================= +// function : MakeFrontAndBackBufCurrent +// purpose : TelMakeFrontAndBackBufCurrent +// ======================================================================= +void OpenGl_Window::MakeFrontAndBackBufCurrent() const +{ + glDrawBuffer (GL_FRONT_AND_BACK); +} diff --git a/src/OpenGl/OpenGl_Window.hxx b/src/OpenGl/OpenGl_Window.hxx new file mode 100644 index 0000000000..3e80d21695 --- /dev/null +++ b/src/OpenGl/OpenGl_Window.hxx @@ -0,0 +1,106 @@ +// File: OpenGl_Window.hxx +// Created: 20 September 2011 +// Author: Sergey ZERCHANINOV +// Copyright: OPEN CASCADE 2011 + +#ifndef _OpenGl_Window_Header +#define _OpenGl_Window_Header + +#include +#include + +#include +#include +#include + +#include +#include + +//! This class represents low-level wrapper over window with GL context. +//! The window itself should be provided to constructor. +class OpenGl_Window : public MMgt_TShared +{ +public: + + //! Main constructor - prepare GL context for specified window. + OpenGl_Window (const Handle(OpenGl_Display)& theDisplay, + const CALL_DEF_WINDOW& theCWindow, + Aspect_RenderingContext theGContext); + + //! Destructor + virtual ~OpenGl_Window(); + + //! Resizes the window. + void Resize (const CALL_DEF_WINDOW& theCWindow); + + //! Reads depth component for current scene into specified buffer. + void ReadDepths (const Standard_Integer theX, const Standard_Integer theY, + const Standard_Integer theWidth, const Standard_Integer theHeight, + float* theDepths); + + void SetBackgroundColor (const Standard_ShortReal theR, + const Standard_ShortReal theG, + const Standard_ShortReal theB); + + void EnablePolygonOffset() const; + void DisablePolygonOffset() const; + + Standard_Integer Width() const { return myWidth; } + Standard_Integer Height() const { return myHeight; } + const TEL_COLOUR& BackgroundColor() const { return myBgColor; } + Standard_Boolean Dither() const { return myDither; } + Standard_Boolean BackDither() const { return myBackDither; } + + const Handle(OpenGl_Display)& GetDisplay() const { return myDisplay; } + + const Handle(OpenGl_Context)& GetGlContext() const { return myGlContext; } + + WINDOW GetWindow() const { return myWindow; } + GLCONTEXT GetGContext() const { return myGContext; } + +protected: + + //! Activates GL context and setup viewport. + void Init(); + + //! Makes GL context for this window active in current thread + virtual Standard_Boolean Activate(); + + void EnableFeatures() const; + void DisableFeatures() const; + + //! Draw directly to the FRONT buffer. Can cause artifacts on the screen. + void MakeFrontBufCurrent() const; + + //! Draw to BACK buffer. Normal and default state. + void MakeBackBufCurrent() const; + + //! Draw simultaneously to BACK and FRONT buffers. Abnormal usage. + void MakeFrontAndBackBufCurrent() const; + +protected: + + Handle(OpenGl_Display) myDisplay; + WINDOW myWindow; //!< native window handle, system-specific + Handle(OpenGl_Context) myGlContext; + GLCONTEXT myGContext; //!< native GL context bound to this window, system-specific + Standard_Boolean myOwnGContext; //!< set to TRUE if GL context was not created by this class +#if (defined(_WIN32) || defined(__WIN32__)) + HDC myWindowDC; + BOOL mySysPalInUse; +#endif + + Standard_Integer myWidth; // WSWidth + Standard_Integer myHeight; // WSHeight + TEL_COLOUR myBgColor; // WSBackground + Standard_Boolean myDither; + Standard_Boolean myBackDither; + +public: + + DEFINE_STANDARD_RTTI(OpenGl_Window) // Type definition + IMPLEMENT_MEMORY_OPERATORS + +}; + +#endif //_OpenGl_Window_Header diff --git a/src/OpenGl/OpenGl_Workspace.cxx b/src/OpenGl/OpenGl_Workspace.cxx new file mode 100644 index 0000000000..15ef44e7f3 --- /dev/null +++ b/src/OpenGl/OpenGl_Workspace.cxx @@ -0,0 +1,147 @@ +// File: OpenGl_Workspace.cxx +// Created: 20 September 2011 +// Author: Sergey ZERCHANINOV +// Copyright: OPEN CASCADE 2011 + +#include + +#include + +#include +#include +#include +#include + +#include +#include + +IMPLEMENT_STANDARD_HANDLE(OpenGl_Workspace,OpenGl_Window) +IMPLEMENT_STANDARD_RTTIEXT(OpenGl_Workspace,OpenGl_Window) + +namespace +{ + static const TEL_COLOUR myDefaultHighlightColor = { { 1.F, 1.F, 1.F, 1.F } }; + + static const OpenGl_AspectLine myDefaultAspectLine; + static const OpenGl_AspectFace myDefaultAspectFace; + static const OpenGl_AspectMarker myDefaultAspectMarker; + static const OpenGl_AspectText myDefaultAspectText; + + static const OpenGl_TextParam myDefaultTextParam = + { + 16, Graphic3d_HTA_LEFT, Graphic3d_VTA_BOTTOM + }; + + static const OpenGl_Matrix myDefaultMatrix = + { + {{ 1.0F, 0.0F, 0.0F, 0.0F }, + { 0.0F, 1.0F, 0.0F, 0.0F }, + { 0.0F, 0.0F, 1.0F, 0.0F }, + { 0.0F, 0.0F, 0.0F, 1.0F }} + }; +}; + +// ======================================================================= +// function : OpenGl_Workspace +// purpose : +// ======================================================================= +OpenGl_Workspace::OpenGl_Workspace (const Handle(OpenGl_Display)& theDisplay, + const CALL_DEF_WINDOW& theCWindow, + Aspect_RenderingContext theGContext) +: OpenGl_Window (theDisplay, theCWindow, theGContext), + myIsUpdated (Standard_False), + myTransientList (0), + myIsTransientOpen (Standard_False), + myRetainMode (Standard_False), + myUseTransparency (Standard_False), + myUseZBuffer (Standard_False), + myUseDepthTest (Standard_True), + myUseGLLight (Standard_True), + myBackBufferRestored (Standard_False), + // + NamedStatus (0), + DegenerateModel (0), + SkipRatio (0.F), + HighlightColor (&myDefaultHighlightColor), + AspectLine_set (&myDefaultAspectLine), + AspectLine_applied (NULL), + AspectFace_set (&myDefaultAspectFace), + AspectFace_applied (NULL), + AspectMarker_set (&myDefaultAspectMarker), + AspectMarker_applied (NULL), + AspectText_set (&myDefaultAspectText), + AspectText_applied (NULL), + TextParam_set (&myDefaultTextParam), + TextParam_applied (NULL), + ViewMatrix_applied (&myDefaultMatrix), + StructureMatrix_applied (&myDefaultMatrix), + PolygonOffset_applied (NULL) +{ + theDisplay->InitAttributes(); + + // General initialization of the context + + // Eviter d'avoir les faces mal orientees en noir. + // Pourrait etre utiliser pour detecter les problemes d'orientation + glLightModeli ((GLenum )GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE); + + // Optimisation pour le Fog et l'antialiasing + glHint (GL_FOG_HINT, GL_FASTEST); + glHint (GL_POINT_SMOOTH_HINT, GL_FASTEST); + glHint (GL_LINE_SMOOTH_HINT, GL_FASTEST); + glHint (GL_POLYGON_SMOOTH_HINT, GL_FASTEST); + + // Polygon Offset + EnablePolygonOffset(); +} + +// ======================================================================= +// function : ~OpenGl_Workspace +// purpose : +// ======================================================================= +OpenGl_Workspace::~OpenGl_Workspace() +{ +} + +// ======================================================================= +// function : Activate +// purpose : +// ======================================================================= +Standard_Boolean OpenGl_Workspace::Activate() +{ + if (!OpenGl_Window::Activate()) + return Standard_False; + + NamedStatus = IsTextureEnabled() ? OPENGL_NS_TEXTURE : 0; + DegenerateModel = 0; + SkipRatio = 0.0f; + HighlightColor = &myDefaultHighlightColor; + AspectLine_set = &myDefaultAspectLine; + AspectLine_applied = NULL; + AspectFace_set = &myDefaultAspectFace; + AspectFace_applied = NULL; + AspectMarker_set = &myDefaultAspectMarker; + AspectMarker_applied = NULL; + AspectText_set = &myDefaultAspectText; + AspectText_applied = NULL; + TextParam_set = &myDefaultTextParam; + TextParam_applied = NULL; + ViewMatrix_applied = &myDefaultMatrix; + StructureMatrix_applied = &myDefaultMatrix; + PolygonOffset_applied = NULL; + return Standard_True; +} + +// ======================================================================= +// function : UseTransparency +// purpose : call_togl_transparency +// ======================================================================= +void OpenGl_Workspace::UseTransparency (const Standard_Boolean theFlag) +{ + if ((myUseTransparency ? 1 : 0) != (theFlag ? 1 : 0)) + { + myUseTransparency = theFlag; + EraseAnimation(); + myIsUpdated = Standard_False; + } +} diff --git a/src/OpenGl/OpenGl_Workspace.hxx b/src/OpenGl/OpenGl_Workspace.hxx new file mode 100644 index 0000000000..f346168938 --- /dev/null +++ b/src/OpenGl/OpenGl_Workspace.hxx @@ -0,0 +1,224 @@ +// File: OpenGl_Workspace.hxx +// Created: 20 September 2011 +// Author: Sergey ZERCHANINOV +// Copyright: OPEN CASCADE 2011 + +#ifndef _OpenGl_Workspace_Header +#define _OpenGl_Workspace_Header + +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + +#include +#include +#include +#include + +#include + +class OpenGl_AspectLine; +class OpenGl_AspectFace; +class OpenGl_AspectMarker; +class OpenGl_AspectText; +class OpenGl_FrameBuffer; +class OpenGl_Structure; + +//! Reprepsents window with GL context. +//! Provides methods to render primitives and maintan GL state. +class OpenGl_Workspace : public OpenGl_Window +{ +public: + + //! Main constructor - prepare GL context for specified window. + OpenGl_Workspace (const Handle(OpenGl_Display)& theDisplay, + const CALL_DEF_WINDOW& theCWindow, + Aspect_RenderingContext theGContext); + + //! Destructor + virtual ~OpenGl_Workspace(); + + void SetActiveView (const Handle(OpenGl_View)& theView) { myView = theView; } + const Handle(OpenGl_View)& ActiveView () const { return myView; } + + //! Redraw the window. + void Redraw (const Graphic3d_CView& theCView, + const Aspect_CLayer2d& theCUnderLayer, + const Aspect_CLayer2d& theCOverLayer); + + //! Redraw window only if needed. + void Update (const Graphic3d_CView& theCView, + const Aspect_CLayer2d& theCUnderLayer, + const Aspect_CLayer2d& theCOverLayer) + { + if (!myIsUpdated) + Redraw (theCView, theCUnderLayer, theCOverLayer); + } + + //! Special method to perform printing. + //! System-specific and currently only Win platform implemented. + Standard_Boolean Print (const Graphic3d_CView& theCView, + const Aspect_CLayer2d& theCUnderLayer, + const Aspect_CLayer2d& theCOverLayer, + const Aspect_Handle theHPrintDC, + const Standard_Boolean theToShowBackground, + const Standard_CString theFileName, + const Aspect_PrintAlgo thePrintAlgorithm, + const Standard_Real theScaleFactor); + + void DisplayCallback (const Graphic3d_CView& theCView, int theReason); + + // szvgl: defined in OpenGl_Workspace_1.cxx + void BeginAnimation (const Standard_Boolean theUseDegeneration, + const Standard_Boolean theUpdateAM); + void EndAnimation(); + void EraseAnimation(); + + Standard_Boolean BeginAddMode(); + void EndAddMode(); + void ClearImmediatMode (const Graphic3d_CView& theCView, + const Standard_Boolean theToFlush); + void RedrawImmediatMode(); + Standard_Boolean BeginImmediatMode (const Graphic3d_CView& theCView, + const Standard_Boolean theUseDepthTest, + const Standard_Boolean theRetainMode); + void EndImmediatMode(); + void Transform (const TColStd_Array2OfReal& theMatrix, const Graphic3d_TypeOfComposition theType); + void DrawStructure (const OpenGl_Structure* theStructure); + void BeginPolyline(); + void EndPolyline(); + void Draw (const Standard_ShortReal theX, const Standard_ShortReal theY, const Standard_ShortReal theZ); + void Move (const Standard_ShortReal theX, const Standard_ShortReal theY, const Standard_ShortReal theZ); + void SetLineColor (const Standard_ShortReal theR, const Standard_ShortReal theG, const Standard_ShortReal theB); + void SetLineType (const Standard_Integer theType); + void SetLineWidth (const Standard_ShortReal theWidth); + void SetMinMax (const Standard_ShortReal X1, const Standard_ShortReal Y1, const Standard_ShortReal Z1, + const Standard_ShortReal X2, const Standard_ShortReal Y2, const Standard_ShortReal Z2); + + Graphic3d_PtrFrameBuffer FBOCreate (const Standard_Integer theWidth, const Standard_Integer theHeight); + void FBORelease (Graphic3d_PtrFrameBuffer theFBOPtr); + Standard_Boolean BufferDump (OpenGl_FrameBuffer *theFBOPtr, Image_CRawBufferData& theBuffer); + + //! Mark this window to be redrawn on next update. + void Invalidate() { myIsUpdated = Standard_False; } + + void UseTransparency (const Standard_Boolean theFlag); + Standard_Boolean& UseZBuffer() { return myUseZBuffer; } + Standard_Boolean& UseDepthTest() { return myUseDepthTest; } + Standard_Boolean& UseGLLight() { return myUseGLLight; } + + //// RELATED TO STATUS //// + + Standard_Integer NamedStatus; + + Standard_Integer DegenerateModel; + Standard_ShortReal SkipRatio; + + const TEL_COLOUR* HighlightColor; + + const OpenGl_Matrix* SetViewMatrix (const OpenGl_Matrix* ); + const OpenGl_Matrix* SetStructureMatrix (const OpenGl_Matrix* ); + + const OpenGl_AspectLine* SetAspectLine (const OpenGl_AspectLine* theAspect); + const OpenGl_AspectFace* SetAspectFace (const OpenGl_AspectFace* theAspect); + const OpenGl_AspectMarker* SetAspectMarker (const OpenGl_AspectMarker* theAspect); + const OpenGl_AspectText* SetAspectText (const OpenGl_AspectText* theAspect); + + void SetTextParam (const OpenGl_TextParam* theParam) { TextParam_set = theParam; } + + const OpenGl_AspectLine* AspectLine (const Standard_Boolean theWithApply); + const OpenGl_AspectFace* AspectFace (const Standard_Boolean theWithApply); + const OpenGl_AspectMarker* AspectMarker (const Standard_Boolean theWithApply); + const OpenGl_AspectText* AspectText (const Standard_Boolean theWithApply); + + //// RELATED TO FONTS //// + + int FindFont (const char* theFontName, + const OSD_FontAspect theFontAspect, + const int theBestSize = -1, + const float theXScale = 1.0f, + const float theYScale = 1.0f) + { + return myDisplay->FindFont (theFontName, theFontAspect, theBestSize, theXScale, theYScale); + } + + void StringSize (const wchar_t* theText, int& theWidth, int& theAscent, int& theDescent) + { + myDisplay->StringSize (theText, theWidth, theAscent, theDescent); + } + + void RenderText (const wchar_t* theText, const int theIs2d, + const float theX, const float theY, const float theZ) + { + const OpenGl_AspectText* anAspect = AspectText (Standard_True); + myDisplay->RenderText (theText, theIs2d, theX, theY, theZ, anAspect, TextParam_applied); + } + +protected: + + void CopyBuffers (Tint vid, int FrontToBack, + Tfloat xm, Tfloat ym, Tfloat zm, + Tfloat XM, Tfloat YM, Tfloat ZM, + Tint flag); + + virtual Standard_Boolean Activate(); + + // TEMPORARY!!! + void Redraw1 (const Graphic3d_CView& theCView, + const Aspect_CLayer2d& theCUnderLayer, + const Aspect_CLayer2d& theCOverLayer, + const int theToSwap); + +protected: + + Handle(OpenGl_View) myView; // WSViews - now just one view is supported + Standard_Boolean myIsUpdated; // WSUpdateState + Tint myTransientList; // WSTransient + Standard_Boolean myIsTransientOpen; // transientOpen + Tint myRetainMode; // WSRetainMode + + Standard_Boolean myUseTransparency; + Standard_Boolean myUseZBuffer; + Standard_Boolean myUseDepthTest; + Standard_Boolean myUseGLLight; + Standard_Boolean myBackBufferRestored; + + //// RELATED TO STATUS //// + + void UpdateMaterial (const int flag); + + const OpenGl_AspectLine *AspectLine_set, *AspectLine_applied; + const OpenGl_AspectFace *AspectFace_set, *AspectFace_applied; + const OpenGl_AspectMarker *AspectMarker_set, *AspectMarker_applied; + const OpenGl_AspectText *AspectText_set, *AspectText_applied; + + const OpenGl_TextParam *TextParam_set, *TextParam_applied; + + const OpenGl_Matrix* ViewMatrix_applied; + const OpenGl_Matrix* StructureMatrix_applied; + + const TEL_POFFSET_PARAM* PolygonOffset_applied; + +public: + + DEFINE_STANDARD_RTTI(OpenGl_Workspace) // Type definition + IMPLEMENT_MEMORY_OPERATORS + +}; + +#endif //_OpenGl_Workspace_Header diff --git a/src/OpenGl/OpenGl_Workspace_1.cxx b/src/OpenGl/OpenGl_Workspace_1.cxx new file mode 100644 index 0000000000..0a523fce6b --- /dev/null +++ b/src/OpenGl/OpenGl_Workspace_1.cxx @@ -0,0 +1,55 @@ +// File: OpenGl_Workspace_1.cxx +// Created: 20 September 2011 +// Author: Sergey ZERCHANINOV +// Copyright: OPEN CASCADE 2011 + +#include + +#include +#include + +#include +#include +#include + +/*----------------------------------------------------------------------*/ + +//call_togl_begin_animation +void OpenGl_Workspace::BeginAnimation (const Standard_Boolean UseDegeneration, const Standard_Boolean UpdateAM) +{ + NamedStatus |= OPENGL_NS_ANIMATION; + if (UseDegeneration) + NamedStatus |= OPENGL_NS_DEGENERATION; + else + NamedStatus &= ~OPENGL_NS_DEGENERATION; + if (UpdateAM) + NamedStatus |= OPENGL_NS_UPDATEAM; + else + NamedStatus &= ~OPENGL_NS_UPDATEAM; + NamedStatus &= ~OPENGL_NS_FLIST; +} + +/*----------------------------------------------------------------------*/ + +//call_togl_end_animation +void OpenGl_Workspace::EndAnimation () +{ + if( (NamedStatus & OPENGL_NS_ANIMATION) == 0 ) return; + + NamedStatus &= ~(OPENGL_NS_ANIMATION | OPENGL_NS_DEGENERATION | OPENGL_NS_UPDATEAM); + myIsUpdated = Standard_False; +} + +/*----------------------------------------------------------------------*/ +/* +* Permet de terminer effectivement le mode Animation. +* Ceci est realise des qu'une structure a ete modifiee. +*/ + +//call_togl_erase_animation_mode +void OpenGl_Workspace::EraseAnimation () +{ + NamedStatus &= ~(OPENGL_NS_ANIMATION | OPENGL_NS_DEGENERATION | OPENGL_NS_UPDATEAM | OPENGL_NS_FLIST); +} + +/*----------------------------------------------------------------------*/ diff --git a/src/OpenGl/OpenGl_togl_print.cxx b/src/OpenGl/OpenGl_Workspace_2.cxx old mode 100755 new mode 100644 similarity index 74% rename from src/OpenGl/OpenGl_togl_print.cxx rename to src/OpenGl/OpenGl_Workspace_2.cxx index 7429b7f8d8..45e26e070b --- a/src/OpenGl/OpenGl_togl_print.cxx +++ b/src/OpenGl/OpenGl_Workspace_2.cxx @@ -1,27 +1,17 @@ -/* File OpenGL_togl_print.c -Created March 2000 -Author THA -e-mail t-hartl@muenchen.matra-dtv.fr */ +// File: OpenGl_Workspace_2.cxx +// Created: 20 September 2011 +// Author: Sergey ZERCHANINOV +// Copyright: OPEN CASCADE 2011 #define RIC120302 /* GG Enable to use the application display // callback at end of traversal */ #include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include -#include -#include #include #include +#include #ifdef HAVE_FREEIMAGE #include @@ -33,6 +23,14 @@ e-mail t-hartl@muenchen.matra-dtv.fr */ typedef NCollection_Handle FipHandle; #endif +#include +#include +#include +#include + +//10-05-96 : CAL ; Ajout d'un nouveau delta dans les copies de pixels (voir CALL_DEF_DELTA) +#define CALL_DEF_DELTA 10 + // --------------------------------------------------------------- // Function: getNearestPowOfTwo // Purpose: get the nearest power of two for theNumber @@ -152,49 +150,6 @@ static void initBufferTiling (Standard_Integer& theFrameWidth, theFrameHeight = theViewHeight; } -// --------------------------------------------------------------- -// Function: redrawView -// Purpose: redraw view in printing mode -// --------------------------------------------------------------- -static void redrawView (CALL_DEF_VIEW *aview, - CALL_DEF_LAYER *anunderlayer, - CALL_DEF_LAYER *anoverlayer, - const int isBackground) -{ - // prepare for redraw - call_func_redraw_all_structs_begin (aview->WsId); - call_subr_displayCB (aview, OCC_REDRAW_BITMAP | OCC_PRE_REDRAW); - call_togl_setplane (aview); - - // clear background - if (isBackground == 0) - { - glClearColor (1.0, 1.0, 1.0, 1.0); - glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - } - - // draw underlayer - if (anunderlayer->ptrLayer) - { - call_togl_redraw_layer2d (aview, anunderlayer); - } - - // redraw main plane - call_func_redraw_all_structs_proc (aview->WsId); - call_subr_displayCB (aview,OCC_REDRAW_BITMAP | OCC_PRE_OVERLAY); - // draw overlayer - if (anoverlayer->ptrLayer) - { - call_togl_redraw_layer2d (aview, anoverlayer); - } - call_subr_displayCB (aview,OCC_REDRAW_BITMAP); - - - // tell to end redrawing - call_func_redraw_all_structs_end (aview->WsId, 0); - call_togl_redraw_immediat_mode (aview); -} - // --------------------------------------------------------------- // Function: initBitmapBuffer // Purpose: init device independent bitmap to hold printing data @@ -323,39 +278,30 @@ static bool imageStretchDC(HDC theDstDC, FipHandle theImage, int theOffsetX, #endif // --------------------------------------------------------------- -// Function: call_togl_print -// Purpose: // --------------------------------------------------------------- -Standard_Boolean EXPORT -call_togl_print -( - CALL_DEF_VIEW *aview, - CALL_DEF_LAYER *anunderlayer, - CALL_DEF_LAYER *anoverlayer, - const Aspect_Drawable hPrintDC, - const int background, - const char* filename, - const int printalgo, - const float theScaleFactor - ) -{ +//call_togl_print +Standard_Boolean OpenGl_Workspace::Print + (const Graphic3d_CView& ACView, + const Aspect_CLayer2d& ACUnderLayer, + const Aspect_CLayer2d& ACOverLayer, + const Aspect_Handle hPrintDC,// const Aspect_Drawable hPrintDC, + const Standard_Boolean showBackground, + const Standard_CString filename, + const Aspect_PrintAlgo printAlgorithm, + const Standard_Real theScaleFactor) +{ #ifdef WNT - CMN_KEY_DATA data; - DOCINFO di; - bool IsTiling = (printalgo == 1); - HDC hPrnDC = (HDC) hPrintDC; - - TsmGetWSAttri (aview->WsId, WSWindow, &data); - if (TxglWinset (call_thedisplay, (WINDOW) data.ldata) != TSuccess) + if (!Activate()) { - MessageBox (NULL, "Print failed: can't setup the view for printing.", - "The operation couldn't be completed.", MB_OK); + //MessageBox (NULL, "Print failed: can't setup the view for printing.", + // "The operation couldn't be completed.", MB_OK); return Standard_False; } // printer page dimensions + HDC hPrnDC = (HDC) hPrintDC; int devWidth = GetDeviceCaps (hPrnDC, HORZRES); int devHeight = GetDeviceCaps (hPrnDC, VERTRES); @@ -378,14 +324,12 @@ call_togl_print Standard_Integer tempHeight = (Standard_Integer) devHeight; // view dimensions - RECT rect; - GetClientRect((WINDOW) data.ldata, &rect); - int viewWidth = rect.right-rect.left; - int viewHeight = rect.bottom-rect.top; + int viewWidth = myWidth; + int viewHeight = myHeight; if (viewWidth == 0 || viewHeight == 0) { - MessageBox (NULL, "Print failed: can't setup the view for printing.", - "The operation couldn't be completed.", MB_OK); + //MessageBox (NULL, "Print failed: can't setup the view for printing.", + // "The operation couldn't be completed.", MB_OK); return Standard_False; } @@ -410,10 +354,12 @@ call_togl_print // Frame buffer initialization OpenGl_FrameBuffer* aFrameBuffer = NULL; - OpenGl_FrameBuffer* aPrevBuffer = (OpenGl_FrameBuffer*) aview->ptrFBO; + OpenGl_FrameBuffer* aPrevBuffer = (OpenGl_FrameBuffer*) ACView.ptrFBO; Standard_Integer aFrameWidth (0), aFrameHeight (0), aPrevBufferX (0), aPrevBufferY (0); + bool IsTiling = (printAlgorithm == 1); + // try to use existing frame buffer if (aPrevBuffer) { @@ -504,7 +450,7 @@ call_togl_print initBufferTiling (aFrameWidth, aFrameHeight, width, height); // try to initialize framebuffer - if (aFrameBuffer->Init (aFrameWidth, aFrameHeight)) + if (aFrameBuffer->Init (GetGlContext(), aFrameWidth, aFrameHeight)) { #ifdef HAVE_FREEIMAGE // try to allocate fipImage and necessary resources @@ -522,7 +468,7 @@ call_togl_print if (!aViewBuffer) { - aFrameBuffer->Release (); + aFrameBuffer->Release (GetGlContext()); aViewBuffer = NULL; aViewImage = NULL; } @@ -573,7 +519,8 @@ call_togl_print GLint aViewPortBack[4]; GLint aReadBufferPrev = GL_BACK; GLint anAlignBack = 1; - OpenGl_PrinterContext aPrinterContext (GET_GL_CONTEXT()); + + OpenGl_PrinterContext aPrinterContext (myGContext); aPrinterContext.SetLayerViewport ((GLsizei)aFrameWidth, (GLsizei)aFrameHeight); glGetIntegerv (GL_VIEWPORT, aViewPortBack); @@ -582,6 +529,7 @@ call_togl_print // start document if the printer context is not actually a memory dc // (memory dc could be used for testing purposes) + DOCINFO di; if (GetObjectType (hPrnDC) == OBJ_DC) { // Initalize printing procedure @@ -608,7 +556,7 @@ call_togl_print } // activate the offscreen buffer - aFrameBuffer->BindBuffer (); + aFrameBuffer->BindBuffer (GetGlContext()); // calculate offset for centered printing int aDevOffx = (int)(devWidth - width) /2; @@ -616,13 +564,19 @@ call_togl_print // operation complete flag bool isDone = true; - + + // Set up status for printing + NamedStatus |= OPENGL_NS_ISBITMAP; + if (!showBackground) + NamedStatus |= OPENGL_NS_WHITEBACK; + if (!IsTiling) { aPrinterContext.SetScale ((GLfloat)aFrameWidth /viewWidth, (GLfloat)aFrameHeight/viewHeight); aFrameBuffer->SetupViewport (); - redrawView (aview, anunderlayer, anoverlayer, background); + Redraw1(ACView, ACUnderLayer, ACOverLayer, 0); + RedrawImmediatMode(); glReadPixels (0, 0, aFrameWidth, aFrameHeight, GL_BGR_EXT, GL_UNSIGNED_BYTE, (GLvoid* )aViewBuffer); @@ -728,7 +682,8 @@ call_togl_print // draw to the offscreen buffer and capture the result aFrameBuffer->SetupViewport (); - redrawView (aview, anunderlayer, anoverlayer, background); + Redraw1(ACView, ACUnderLayer, ACOverLayer, 0); + RedrawImmediatMode(); glReadPixels (0, 0, aFrameWidth, aFrameHeight, GL_BGR_EXT, GL_UNSIGNED_BYTE, (GLvoid* )aViewBuffer); #ifdef HAVE_FREEIMAGE @@ -776,7 +731,7 @@ call_togl_print // return OpenGl to the previous state aPrinterContext.Deactivate (); glPixelStorei (GL_PACK_ALIGNMENT, anAlignBack); - aFrameBuffer->UnbindBuffer(); + aFrameBuffer->UnbindBuffer (GetGlContext()); glViewport (aViewPortBack[0], aViewPortBack[1], aViewPortBack[2], aViewPortBack[3]); if (aPrevBuffer) @@ -794,6 +749,9 @@ call_togl_print DeleteDC (hMemDC); #endif + // Reset status after printing + NamedStatus &= ~(OPENGL_NS_WHITEBACK | OPENGL_NS_ISBITMAP); + return (Standard_Boolean) isDone; #else // not WNT @@ -801,3 +759,203 @@ call_togl_print #endif } +/*----------------------------------------------------------------------*/ + +//redrawView +void OpenGl_Workspace::Redraw1 (const Graphic3d_CView& ACView, + const Aspect_CLayer2d& ACUnderLayer, + const Aspect_CLayer2d& ACOverLayer, + const int aswap) +{ + if (myDisplay.IsNull() || myView.IsNull()) + return; + + myDisplay->UpdateUserMarkers(); + + // Request reset of material + NamedStatus |= OPENGL_NS_RESMAT; + + /* GL_DITHER on/off pour le background */ + if (myBackDither) + glEnable (GL_DITHER); + else + glDisable (GL_DITHER); + + GLbitfield toClear = GL_COLOR_BUFFER_BIT; + if ( myUseZBuffer ) + { + glDepthFunc(GL_LEQUAL); + glDepthMask(GL_TRUE); + + // SAV checking if depth test was deprecated somewhere outside + if ( myUseDepthTest ) + glEnable(GL_DEPTH_TEST); + else + glDisable(GL_DEPTH_TEST); + + glClearDepth(1.0); + toClear |= GL_DEPTH_BUFFER_BIT; + } + else + { + glDisable(GL_DEPTH_TEST); + } + + if ( NamedStatus & OPENGL_NS_WHITEBACK ) + { + // Set background to white + glClearColor (1.F, 1.F, 1.F, 1.F); + toClear |= GL_DEPTH_BUFFER_BIT; + } + else + { + glClearColor (myBgColor.rgb[0], myBgColor.rgb[1], myBgColor.rgb[2], 0.F); + } + glClear (toClear); + + Handle(OpenGl_Workspace) aWS(this); + myView->Render(aWS,ACView,ACUnderLayer,ACOverLayer); + + // Swap the buffers + if ( aswap ) + { +#ifndef WNT + glXSwapBuffers ((Display*)myDisplay->GetDisplay (), myWindow ); +#else + SwapBuffers ( wglGetCurrentDC () ); + glFlush(); +#endif /* WNT */ + myBackBufferRestored = Standard_False; + } + else + glFlush(); + + myIsUpdated = Standard_True; +} + +/*----------------------------------------------------------------------*/ + +//TelCopyBuffers +void OpenGl_Workspace::CopyBuffers (Tint vid, int FrontToBack, Tfloat xm, Tfloat ym, Tfloat zm, Tfloat XM, Tfloat YM, Tfloat ZM, Tint flag) +{ + if (FrontToBack) myBackBufferRestored = Standard_False; + + glMatrixMode (GL_PROJECTION); + glPushMatrix (); + glLoadIdentity (); + gluOrtho2D ((GLdouble) 0., (GLdouble) myWidth, 0., (GLdouble) myHeight); + glMatrixMode (GL_MODELVIEW); + glPushMatrix (); + glLoadIdentity (); + + DisableFeatures(); + + GLsizei width = myWidth+1, height = myHeight+1; + Tfloat xmr = 0, ymr = 0; + + if (flag) + { + if (!myView.IsNull()) //szvgl: use vid here! + { + // Calculate bounding box and store the projected rectangle + Tfloat xr[8], yr[8]; + // Project bounding box + if (myView->ProjectObjectToRaster (myWidth, myHeight, xm, ym, zm, xr[0], yr[0]) && + myView->ProjectObjectToRaster (myWidth, myHeight, xm, YM, zm, xr[1], yr[1]) && + myView->ProjectObjectToRaster (myWidth, myHeight, XM, YM, zm, xr[2], yr[2]) && + myView->ProjectObjectToRaster (myWidth, myHeight, XM, ym, zm, xr[3], yr[3]) && + myView->ProjectObjectToRaster (myWidth, myHeight, xm, ym, ZM, xr[4], yr[4]) && + myView->ProjectObjectToRaster (myWidth, myHeight, xm, YM, ZM, xr[5], yr[5]) && + myView->ProjectObjectToRaster (myWidth, myHeight, XM, YM, ZM, xr[6], yr[6]) && + myView->ProjectObjectToRaster (myWidth, myHeight, XM, ym, ZM, xr[7], yr[7])) + { + Tfloat XMR, YMR; + xmr = ymr = (float ) shortreallast (); + XMR = YMR = (float ) shortrealfirst (); + /* + * Recherche du rectangle projete + */ + Tint i; + for (i=0; i<8; i++) { + if (xmr > xr[i]) xmr = xr[i]; + if (ymr > yr[i]) ymr = yr[i]; + if (XMR < xr[i]) XMR = xr[i]; + if (YMR < yr[i]) YMR = yr[i]; + } + /* pour eviter les bavures de pixels ! */ + xmr--;ymr--; + XMR++;YMR++; + + /* + * Ajout CAL : 10/05/96 + * Si les MinMax viennent d'un ensemble de markers + * on ne tient pas compte du scale factor de ceux-ci + * dans les valeurs de MinMax. En effet, ce facteur + * est dans l'espace pixel et les MinMax dans l'espace + * du modele. Donc ajout d'un delta de pixels + * en esperant que les applis n'utilisent pas des + * markers tres gros ! + */ + xmr -= CALL_DEF_DELTA; ymr -= CALL_DEF_DELTA; + XMR += CALL_DEF_DELTA; YMR += CALL_DEF_DELTA; + + /* + * Le rectangle projete peut-etre clippe + */ + width = (GLsizei) (XMR-xmr+1); + height = (GLsizei) (YMR-ymr+1); + /* + * (xmr,ymr) coin inferieur gauche + * (XMR,YMR) coin superieur droit + */ + /* cas ou 1 coin est en dehors de la fenetre */ + if (xmr < 0) { width = (GLsizei) (XMR+1); xmr = 0; } + if (ymr < 0) { height = (GLsizei) (YMR+1); ymr = 0; } + if (XMR > myWidth) { width = (GLsizei) (myWidth-xmr+1); } + if (YMR > myHeight) { height = (GLsizei) (myHeight-ymr+1); } + + /* cas ou les 2 coins sont en dehors de la fenetre */ + if (XMR < 0) { xmr = 0; width = height = 1; } + if (YMR < 0) { ymr = 0; width = height = 1; } + if (xmr > myWidth) { xmr = 0; width = height = 1; } + if (ymr > myHeight) { ymr = 0; width = height = 1; } + } + } + } + + glDrawBuffer (FrontToBack? GL_BACK : GL_FRONT); + glReadBuffer (FrontToBack? GL_FRONT : GL_BACK); + /* copie complete */ + glRasterPos2i ((GLint) xmr, (GLint) ymr); + glCopyPixels ((GLint) xmr, (GLint) ymr, width, height, GL_COLOR); + + EnableFeatures(); + + glMatrixMode (GL_PROJECTION); + glPopMatrix (); + glMatrixMode (GL_MODELVIEW); + glPopMatrix (); + + glDrawBuffer (GL_BACK); +} + +/*----------------------------------------------------------------------*/ + +//call_subr_displayCB +void OpenGl_Workspace::DisplayCallback (const Graphic3d_CView& ACView, int reason) +{ + if( ACView.GDisplayCB ) + { + Aspect_GraphicCallbackStruct callData; + callData.reason = reason; + callData.display = (DISPLAY*)myDisplay->GetDisplay(); + callData.window = (WINDOW)myWindow; + callData.wsID = ACView.WsId; + callData.viewID = ACView.ViewId; + callData.gcontext = myGContext; + + int status = (*ACView.GDisplayCB)( ACView.DefWindow.XWindow, ACView.GClientData, &callData ); + } +} + +/*----------------------------------------------------------------------*/ diff --git a/src/OpenGl/OpenGl_Workspace_3.cxx b/src/OpenGl/OpenGl_Workspace_3.cxx new file mode 100644 index 0000000000..8e61f5b6e1 --- /dev/null +++ b/src/OpenGl/OpenGl_Workspace_3.cxx @@ -0,0 +1,490 @@ +// File: OpenGl_Workspace_3.cxx +// Created: 20 September 2011 +// Author: Sergey ZERCHANINOV +// Copyright: OPEN CASCADE 2011 + +#define BUC60863 /*GG_100401 After any view update, made identical +// the front and back buffer to avoid ghost drawing. +// Minimize flicking. +*/ + +#define IMP150501 /*GG_150501 CADPAK_V2 Enable/Disable Zbuffer +NOTE that the previous and unused "double-buffer" +arg is changed to "zbuffer" and enable/disable +to use the OpenGl zbuffer capabilities during immediat +drawing +*/ + +#define IMP260601 /*GG Enable correct backing store between 2 different views. +*/ + +/*----------------------------------------------------------------------*/ + +#define RIC120302 /* GG Enable to use the application display +// callback at end of traversal +*/ + +/* +* Includes +*/ +#include +#include + +#ifdef HAVE_GL2PS + #include +#endif + +#include +#include +#include +#include + +/*----------------------------------------------------------------------*/ +/* +* Prototypes Private functions +*/ + +static void call_util_transform_pt (float *x, float *y, float *z); +static void call_util_transpose_mat (float tmat[16], float mat[4][4]); + +/*----------------------------------------------------------------------*/ +/* +* Variables statiques +*/ + +static int openglNumberOfPoints = 0; + +static int myImmediateMatIsIdentity = 1; + +static int partial = -1; /* -1 init, 0 complete, 1 partielle */ + +static float xm, ym, zm, XM, YM, ZM; + +static float myImmediateMat[4][4] = { + {1., 0., 0., 0.}, + {0., 1., 0., 0.}, + {0., 0., 1., 0.}, + {0., 0., 0., 1.}, +}; + +/*----------------------------------------------------------------------*/ +/* Mode Ajout */ +/*----------------------------------------------------------------------*/ + +//call_togl_begin_ajout_mode +Standard_Boolean OpenGl_Workspace::BeginAddMode () +{ + if (!Activate()) + return Standard_False; + + NamedStatus |= OPENGL_NS_ADD; + + MakeFrontAndBackBufCurrent(); + + //TsmPushAttri(); + + return Standard_True; +} + +/*----------------------------------------------------------------------*/ + +//call_togl_end_ajout_mode +void OpenGl_Workspace::EndAddMode () +{ + if (NamedStatus & OPENGL_NS_ADD) + { + OpenGl_Workspace::MakeBackBufCurrent(); + + // Clear add mode flag + NamedStatus &= ~OPENGL_NS_ADD; + } + + myImmediateMatIsIdentity = 1; + + /* FMN necessaire pour l'affichage sur WNT */ + glFlush(); + + //TsmPopAttri(); +} + +/*----------------------------------------------------------------------*/ +/* Mode Transient */ +/*----------------------------------------------------------------------*/ + +//call_togl_clear_immediat_mode +void OpenGl_Workspace::ClearImmediatMode (const Graphic3d_CView& ACView, const Standard_Boolean AFlush) +{ + if ( myIsTransientOpen ) + EndImmediatMode(); + + if (!Activate()) return; + + if ( !myBackBufferRestored ) + { + EraseAnimation(); + + Redraw1(ACView,*((CALL_DEF_LAYER *)ACView.ptrUnderLayer),*((CALL_DEF_LAYER *)ACView.ptrOverLayer),AFlush); + + // After a redraw, + // Made the back identical to the front buffer. + // Always perform full copy (partial update optimization is useless on mordern hardware)! + if (myRetainMode) + CopyBuffers (ACView.ViewId, 1 /* GL_FRONT -> GL_BACK */, xm, ym, zm, XM, YM, ZM, 0); + + myBackBufferRestored = Standard_True; + } + else if ( partial >= 0 ) + { + // Restore pixels from the back buffer. + // Always perform full copy (partial update optimization is useless on mordern hardware)! + CopyBuffers (ACView.ViewId, 0 /* GL_BACK -> GL_FRONT */, xm, ym, zm, XM, YM, ZM, 0); + } + + if (myTransientList) + { + /* Clear current list contents */ + glNewList( (GLuint) myTransientList, GL_COMPILE_AND_EXECUTE); + glEndList(); + } + partial = -1; + XM = YM = ZM = (float ) shortrealfirst (); + xm = ym = zm = (float ) shortreallast (); +} + +/*----------------------------------------------------------------------*/ + +//call_togl_redraw_immediat_mode +void OpenGl_Workspace::RedrawImmediatMode () +{ + if (myRetainMode) + { + if (myTransientList) + { + MakeFrontBufCurrent(); + glDisable(GL_LIGHTING); + glCallList((GLuint) myTransientList); + /* FMN necessaire pour l'affichage sur WNT */ + glFlush(); + MakeBackBufCurrent(); + } + } +} + +/*----------------------------------------------------------------------*/ + +//call_togl_begin_immediat_mode +Standard_Boolean OpenGl_Workspace::BeginImmediatMode (const Graphic3d_CView& ACView, const Standard_Boolean UseDepthTest, const Standard_Boolean RetainMode) +{ + if (!Activate()) + return Standard_False; + + OpenGl_Workspace::ClearImmediatMode(ACView,1); + + NamedStatus |= OPENGL_NS_IMMEDIATE; + myRetainMode = RetainMode; + + MakeFrontBufCurrent(); + + //TsmPushAttri(); + + if ( myRetainMode ) + { + GLuint listid = (GLuint) myTransientList; + if (!listid) + listid = glGenLists(1); + if (!listid) return Standard_False; + + glNewList(listid, GL_COMPILE_AND_EXECUTE); + myTransientList = listid; + myIsTransientOpen = Standard_True; + } + + if ( UseDepthTest ) + glEnable(GL_DEPTH_TEST); + else + glDisable(GL_DEPTH_TEST); + + return Standard_True; +} + +/*----------------------------------------------------------------------*/ + +//call_togl_end_immediat_mode +void OpenGl_Workspace::EndImmediatMode () +{ + if (NamedStatus & OPENGL_NS_IMMEDIATE) + { + if (myIsTransientOpen) + { + glEndList(); + myIsTransientOpen = Standard_False; + } + MakeBackBufCurrent(); + + // Clear immediate mode flag + NamedStatus &= ~OPENGL_NS_IMMEDIATE; + } + + // Ajout CAL : pour voir quelque chose avant le prochain begin_immediat_mode + glFinish (); + + myImmediateMatIsIdentity = 1; + + //TsmPopAttri(); +} + +/*----------------------------------------------------------------------*/ + +//call_togl_transform +void OpenGl_Workspace::Transform (const TColStd_Array2OfReal& AMatrix, const Graphic3d_TypeOfComposition AType) +{ + //call_togl_transform in OpenGl_togl_begin_immediat_mode.cxx + const Standard_Integer lr = AMatrix.LowerRow (); + const Standard_Integer lc = AMatrix.LowerCol (); + + Standard_Integer i, j; + if ((AType == Graphic3d_TOC_REPLACE) || myImmediateMatIsIdentity) + { + for (i=0; i<4; i++) + for (j=0; j<4; j++) + myImmediateMat[i][j] = float (AMatrix (i+lr, j+lc)); + } + else + { + float theMatrix[4][4]; + for (i=0; i<4; i++) + for (j=0; j<4; j++) + theMatrix[i][j] = float (AMatrix (i+lr, j+lc)); + + TelMultiplymat3 (myImmediateMat, myImmediateMat, theMatrix); + } + + myImmediateMatIsIdentity = 1; + for (i = 0; i < 4; i++) + for (j = 0; j < 4; j++) + if (myImmediateMat[i][j] != (i == j? 1. : 0.)) + { + myImmediateMatIsIdentity = 0; + return; + } +} + +/*----------------------------------------------------------------------*/ + +//call_togl_begin_polyline +void OpenGl_Workspace::BeginPolyline () +{ + if (NamedStatus & (OPENGL_NS_ADD | OPENGL_NS_IMMEDIATE)) + { + openglNumberOfPoints = 0; + glDisable(GL_LIGHTING); + glBegin(GL_LINE_STRIP); + } +} + +/*----------------------------------------------------------------------*/ + +//call_togl_end_polyline +void OpenGl_Workspace::EndPolyline () +{ + if (NamedStatus & (OPENGL_NS_ADD | OPENGL_NS_IMMEDIATE)) + glEnd(); +} + +/*----------------------------------------------------------------------*/ + +//call_togl_draw +void OpenGl_Workspace::Draw (const Standard_ShortReal X, const Standard_ShortReal Y, const Standard_ShortReal Z) +{ + if (NamedStatus & (OPENGL_NS_ADD | OPENGL_NS_IMMEDIATE)) + { + openglNumberOfPoints++; + float x = X, y = Y, z = Z; + if (!myImmediateMatIsIdentity) + call_util_transform_pt (&x, &y, &z); + if (x > XM) XM = x; + if (y > YM) YM = y; + if (z > ZM) ZM = z; + if (x < xm) xm = x; + if (y < ym) ym = y; + if (z < zm) zm = z; + glVertex3f (x, y, z); + partial = 1; + } +} + +/*----------------------------------------------------------------------*/ + +//call_togl_move +void OpenGl_Workspace::Move (const Standard_ShortReal X, const Standard_ShortReal Y, const Standard_ShortReal Z) +{ + if (NamedStatus & (OPENGL_NS_ADD | OPENGL_NS_IMMEDIATE)) + { + if (openglNumberOfPoints != 0) + { + OpenGl_Workspace::EndPolyline(); + OpenGl_Workspace::BeginPolyline(); + } + OpenGl_Workspace::Draw(X,Y,Z); + } +} + +/*----------------------------------------------------------------------*/ + +//call_togl_set_linecolor +void OpenGl_Workspace::SetLineColor (const Standard_ShortReal R, const Standard_ShortReal G, const Standard_ShortReal B) +{ + if (NamedStatus & (OPENGL_NS_ADD | OPENGL_NS_IMMEDIATE)) + { + GLfloat color[3]; + color[0] = R; + color[1] = G; + color[2] = B; + glColor3fv(color); + } +} + +/*----------------------------------------------------------------------*/ + +//call_togl_set_linetype +void OpenGl_Workspace::SetLineType (const Standard_Integer Type) +{ + if (NamedStatus & (OPENGL_NS_ADD | OPENGL_NS_IMMEDIATE)) + { + myDisplay->SetTypeOfLine((Aspect_TypeOfLine)Type); + } +} + +/*----------------------------------------------------------------------*/ + +//call_togl_set_linewidth +void OpenGl_Workspace::SetLineWidth (const Standard_ShortReal Width) +{ + if (NamedStatus & (OPENGL_NS_ADD | OPENGL_NS_IMMEDIATE)) + { + glLineWidth( (GLfloat)Width ); +#ifdef HAVE_GL2PS + gl2psLineWidth( (GLfloat)Width ); +#endif + } +} + +/*----------------------------------------------------------------------*/ + +//call_togl_draw_structure +void OpenGl_Workspace::DrawStructure (const OpenGl_Structure *AStructure) +{ + if (NamedStatus & (OPENGL_NS_ADD | OPENGL_NS_IMMEDIATE)) + { + float mat16[16]; + GLint mode1; + + //TsmPushAttri(); + + /* mise en place de la matrice de transformation du trace transient */ + if (!myImmediateMatIsIdentity) + { + call_util_transpose_mat (mat16, myImmediateMat); + glGetIntegerv (GL_MATRIX_MODE, &mode1); + glMatrixMode (GL_MODELVIEW); + glPushMatrix (); + glScalef (1.F, 1.F, 1.F); + glMultMatrixf (mat16); + } + + // Render structure + Handle(OpenGl_Workspace) aWS(this); + AStructure->Render(aWS); + + //TsmPopAttri(); + + if (!myImmediateMatIsIdentity) + { + glPopMatrix (); + glMatrixMode (mode1); + } + } +} + +/*----------------------------------------------------------------------*/ + +//call_togl_set_minmax +void OpenGl_Workspace::SetMinMax (const Standard_ShortReal X1, const Standard_ShortReal Y1, const Standard_ShortReal Z1, const Standard_ShortReal X2, const Standard_ShortReal Y2, const Standard_ShortReal Z2) +{ + if ((X1 > shortreallast ()) || (Y1 > shortreallast ()) || (Z1 > shortreallast ()) || + (X2 > shortreallast ()) || (Y2 > shortreallast ()) || (Z2 > shortreallast ()) || + (X1 < shortrealfirst ()) || (Y1 < shortrealfirst ()) || (Z1 < shortrealfirst ()) || + (X2 < shortrealfirst ()) || (Y2 < shortrealfirst ()) || (Z2 < shortrealfirst ())) + { + XM = YM = ZM = (float ) shortreallast (); + xm = ym = zm = (float ) shortrealfirst (); + partial = 0; + } + else + { + float x1=X1,y1=Y1,z1=Z1,x2=X2,y2=Y2,z2=Z2; + if (!myImmediateMatIsIdentity) + { + call_util_transform_pt (&x1, &y1, &z1); + call_util_transform_pt (&x2, &y2, &z2); + } + if (x1 > XM) XM = x1; + if (x1 < xm) xm = x1; + if (y1 > YM) YM = y1; + if (y1 < ym) ym = y1; + if (z1 > ZM) ZM = z1; + if (z1 < zm) zm = z1; + + if (x2 > XM) XM = x2; + if (x2 < xm) xm = x2; + if (y2 > YM) YM = y2; + if (y2 < ym) ym = y2; + if (z2 > ZM) ZM = z2; + if (z2 < zm) zm = z2; + if (partial != 0) partial = 1; + } +} + +/*----------------------------------------------------------------------*/ +/* +* Private functions +*/ + +/*----------------------------------------------------------------------*/ +/* +Transform the point pt +*/ +static void call_util_transform_pt ( float *x, float *y, float *z ) +{ + float tpt[4], pt[4]; + pt[0] = *x, pt[1] = *y, pt[2] = *z, pt[3] = 1.0; + + int i, j; + for (i = 0; i < 4; i++) + { + float sum = 0.; + for (j = 0; j < 4; j++) + sum += myImmediateMat[i][j] * pt[j]; + tpt[i] = sum; + } + + *x = tpt[0], *y = tpt[1], *z = tpt[2]; +} + +/*----------------------------------------------------------------------*/ +/* +void call_util_transpose_mat (tmat, mat) +float tmat[16]; +float mat[4][4]; + +Transpose mat and returns tmat. +*/ + +static void call_util_transpose_mat (float tmat[16], float mat[4][4]) +{ + int i, j; + + for (i=0; i<4; i++) + for (j=0; j<4; j++) + tmat[j*4+i] = mat[i][j]; +} diff --git a/src/OpenGl/OpenGl_Workspace_4.cxx b/src/OpenGl/OpenGl_Workspace_4.cxx new file mode 100644 index 0000000000..16c17a344f --- /dev/null +++ b/src/OpenGl/OpenGl_Workspace_4.cxx @@ -0,0 +1,69 @@ +// File: OpenGl_Workspace_3.cxx +// Created: 20 September 2011 +// Author: Sergey ZERCHANINOV +// Copyright: OPEN CASCADE 2011 + +#if (defined(_WIN32) || defined(__WIN32__)) + #include +#else + #define CALL_DEF_STRING_LENGTH 132 +#endif +#include + +#include +#include +#include +#include + +#include + +//call_togl_redraw +void OpenGl_Workspace::Redraw (const Graphic3d_CView& theCView, + const Aspect_CLayer2d& theCUnderLayer, + const Aspect_CLayer2d& theCOverLayer) +{ + if (!Activate()) + return; + + // release pending GL resources + OpenGl_ResourceCleaner::GetInstance()->Cleanup (GetGlContext()); + + Tint toSwap = 1; // swap buffers + GLint aViewPortBack[4]; + OpenGl_FrameBuffer* aFrameBuffer = (OpenGl_FrameBuffer* )theCView.ptrFBO; + if (aFrameBuffer != NULL) + { + glGetIntegerv (GL_VIEWPORT, aViewPortBack); + aFrameBuffer->SetupViewport(); + aFrameBuffer->BindBuffer (GetGlContext()); + toSwap = 0; // no need to swap buffers + } + + Redraw1 (theCView, theCUnderLayer, theCOverLayer, toSwap); + RedrawImmediatMode(); + + if (aFrameBuffer != NULL) + { + aFrameBuffer->UnbindBuffer (GetGlContext()); + // move back original viewport + glViewport (aViewPortBack[0], aViewPortBack[1], aViewPortBack[2], aViewPortBack[3]); + } + +#if (defined(_WIN32) || defined(__WIN32__)) + if (OpenGl_AVIWriter_AllowWriting (theCView.DefWindow.XWindow)) + { + GLint params[4]; + glGetIntegerv (GL_VIEWPORT, params); + int nWidth = params[2] & ~0x7; + int nHeight = params[3] & ~0x7; + + const int nBitsPerPixel = 24; + GLubyte* aDumpData = new GLubyte[nWidth * nHeight * nBitsPerPixel / 8]; + + glPixelStorei (GL_PACK_ALIGNMENT, 1); + glReadPixels (0, 0, nWidth, nHeight, GL_BGR_EXT, GL_UNSIGNED_BYTE, aDumpData); + OpenGl_AVIWriter_AVIWriter (aDumpData, nWidth, nHeight, nBitsPerPixel); + delete[] aDumpData; + } +#endif +} diff --git a/src/OpenGl/OpenGl_Workspace_5.cxx b/src/OpenGl/OpenGl_Workspace_5.cxx new file mode 100644 index 0000000000..a8005a8104 --- /dev/null +++ b/src/OpenGl/OpenGl_Workspace_5.cxx @@ -0,0 +1,628 @@ +// File: OpenGl_Workspace_5.cxx +// Created: 5 August 2011 +// Author: Sergey ZERCHANINOV +// Copyright: OPEN CASCADE 2011 + +#include + +#include +#include +#include +#include + +/* OCC22218 NOTE: project dependency on gl2ps is specified by macro */ +#ifdef HAVE_GL2PS + #include + /* OCC22216 NOTE: linker dependency can be switched off by undefining macro. + Pragma comment for gl2ps.lib is defined only here. */ + #ifdef _MSC_VER + #pragma comment( lib, "gl2ps.lib" ) + #endif +#endif + +#include +#include + +#include + +#include + +#include + +/*----------------------------------------------------------------------*/ + +static void TelUpdatePolygonOffsets( const TEL_POFFSET_PARAM *pdata ) +{ + if ( ( pdata->mode & Aspect_POM_Fill ) == Aspect_POM_Fill ) + glEnable ( GL_POLYGON_OFFSET_FILL ); + else + glDisable ( GL_POLYGON_OFFSET_FILL ); + + if ( ( pdata->mode & Aspect_POM_Line ) == Aspect_POM_Line ) + glEnable ( GL_POLYGON_OFFSET_LINE ); + else + glDisable( GL_POLYGON_OFFSET_LINE ); + + if ( ( pdata->mode & Aspect_POM_Point ) == Aspect_POM_Point ) + glEnable ( GL_POLYGON_OFFSET_POINT ); + else + glDisable( GL_POLYGON_OFFSET_POINT ); + + glPolygonOffset( pdata->factor, pdata->units ); +} + +/*----------------------------------------------------------------------*/ + +void OpenGl_Workspace::UpdateMaterial( const int flag ) +{ + // Case of Hiddenline + if (AspectFace_set->Context().InteriorStyle == Aspect_IS_HIDDENLINE) + { + /* szvgl - IMPORTANT!!! */ + static TEL_CONTEXT_FACE hl_context_face; + static OpenGl_AspectFace hl_aspect_face; + + hl_context_face = AspectFace_set->Context(); + + hl_context_face.IntFront.matcol = BackgroundColor(); + hl_context_face.IntFront.color_mask = 0; + hl_context_face.IntBack.color_mask = 0; + + hl_aspect_face.SetContext(hl_context_face); + hl_aspect_face.SetAspectEdge(AspectFace_set->AspectEdge()); + + AspectFace_set = &hl_aspect_face; + return; + } + + const OPENGL_SURF_PROP *prop = NULL; + GLenum face = 0; + if ( flag == TEL_FRONT_MATERIAL ) + { + prop = &AspectFace_set->Context().IntFront; + face = GL_FRONT_AND_BACK; + } + else + { + prop = &AspectFace_set->Context().IntBack; + face = GL_BACK; + } + + const unsigned int rm = prop->color_mask; + + if ( !rm ) return; + + // Handling transparency + if ( (NamedStatus & OPENGL_NS_2NDPASSDO) == 0 ) + { + if ( myUseTransparency && prop->trans != 1.0F ) + { + // Render transparent + glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable (GL_BLEND); + glDepthMask (GL_FALSE); + } + else + { + // Render opaque + if ( (NamedStatus & OPENGL_NS_ANTIALIASING) == 0 ) + { + glBlendFunc (GL_ONE, GL_ZERO); + glDisable (GL_BLEND); + } + glDepthMask (GL_TRUE); + } + } + + static float mAmb[4]; + static float mDiff[4]; + static float mSpec[4]; + static float mEmsv[4]; + static float mShin; + + static const float defspeccol[4] = { 1.F, 1.F, 1.F, 1.F }; + + // Reset material + if ( NamedStatus & OPENGL_NS_RESMAT ) + { + // Ambient component + if( rm & OPENGL_AMBIENT_MASK ) + { + const float *c = prop->isphysic? prop->ambcol.rgb : prop->matcol.rgb; + + mAmb[0] = prop->amb * c[0]; + mAmb[1] = prop->amb * c[1]; + mAmb[2] = prop->amb * c[2]; + } + else + { + mAmb[0] = 0.F; + mAmb[1] = 0.F; + mAmb[2] = 0.F; + } + mAmb[3] = 1.F; + + // Diffusion component + if( rm & OPENGL_DIFFUSE_MASK ) + { + const float *c = prop->isphysic? prop->difcol.rgb : prop->matcol.rgb; + + mDiff[0] = prop->diff * c[0]; + mDiff[1] = prop->diff * c[1]; + mDiff[2] = prop->diff * c[2]; + } + else + { + mDiff[0] = 0.F; + mDiff[1] = 0.F; + mDiff[2] = 0.F; + } + mDiff[3] = 1.F; + + if (NamedStatus & OPENGL_NS_2NDPASSDO) + { + mDiff[3] = prop->env_reflexion; + } + else + { + if (myUseTransparency) mDiff[3] = prop->trans; + // If the material reflects the environment scene, the second pass is needed + if (prop->env_reflexion != 0.0) NamedStatus |= OPENGL_NS_2NDPASSNEED; + } + + // Specular component + if( rm & OPENGL_SPECULAR_MASK ) + { + const float *c = prop->isphysic? prop->speccol.rgb : defspeccol; + + mSpec[0] = prop->spec * c[0]; + mSpec[1] = prop->spec * c[1]; + mSpec[2] = prop->spec * c[2]; + } + else { + mSpec[0] = 0.F; + mSpec[1] = 0.F; + mSpec[2] = 0.F; + } + mSpec[3] = 1.F; + + // Emissive component + if( rm & OPENGL_EMISSIVE_MASK ) + { + const float *c = prop->isphysic? prop->emscol.rgb : prop->matcol.rgb; + + mEmsv[0] = prop->emsv * c[0]; + mEmsv[1] = prop->emsv * c[1]; + mEmsv[2] = prop->emsv * c[2]; + } + else { + mEmsv[0] = 0.F; + mEmsv[1] = 0.F; + mEmsv[2] = 0.F; + } + mEmsv[3] = 1.F; + + /* Coeficient de brillance */ + mShin = prop->shine; + + glMaterialfv(face, GL_AMBIENT, mAmb ); + glMaterialfv(face, GL_DIFFUSE, mDiff ); + glMaterialfv(face, GL_SPECULAR, mSpec); + glMaterialfv(face, GL_EMISSION, mEmsv); + glMaterialf(face, GL_SHININESS, mShin); + + NamedStatus &= ~OPENGL_NS_RESMAT; + } + + // Set Material Optimize + else + { + // Ambient component + if( rm & OPENGL_AMBIENT_MASK ) + { + const float *c = prop->isphysic? prop->ambcol.rgb : prop->matcol.rgb; + + if (mAmb[0] != prop->amb * c[0] || + mAmb[1] != prop->amb * c[1] || + mAmb[2] != prop->amb * c[2] ) + { + mAmb[0] = prop->amb * c[0]; + mAmb[1] = prop->amb * c[1]; + mAmb[2] = prop->amb * c[2]; + mAmb[3] = 1.F; + + glMaterialfv(face, GL_AMBIENT, mAmb); + } + } + else + { + if ( mAmb[0] != 0.F || mAmb[1] != 0.F || mAmb[2] != 0.F ) + { + mAmb[0] = 0.F; + mAmb[1] = 0.F; + mAmb[2] = 0.F; + mAmb[3] = 1.F; + + glMaterialfv(face, GL_AMBIENT, mAmb); + } + } + + // Diffusion component + if( rm & OPENGL_DIFFUSE_MASK ) + { + const float *c = prop->isphysic? prop->difcol.rgb : prop->matcol.rgb; + + if (mDiff[0] != prop->diff * c[0] || + mDiff[1] != prop->diff * c[1] || + mDiff[2] != prop->diff * c[2] || + mDiff[3] != ((NamedStatus & OPENGL_NS_2NDPASSDO)? prop->env_reflexion : (myUseTransparency? prop->trans : 1.0F))) + { + mDiff[0] = prop->diff * c[0]; + mDiff[1] = prop->diff * c[1]; + mDiff[2] = prop->diff * c[2]; + mDiff[3] = 1.F; + + if (NamedStatus & OPENGL_NS_2NDPASSDO) + { + mDiff[3] = prop->env_reflexion; + } + else + { + if (myUseTransparency) mDiff[3] = prop->trans; + // If the material reflects the environment scene, the second pass is needed + if (prop->env_reflexion != 0.0) NamedStatus |= OPENGL_NS_2NDPASSNEED; + } + + glMaterialfv(face, GL_DIFFUSE, mDiff ); + } + } + else + { + Tfloat newDiff3 = 1.F; + + if (NamedStatus & OPENGL_NS_2NDPASSDO) + { + newDiff3 = prop->env_reflexion; + } + else + { + if (myUseTransparency) newDiff3 = prop->trans; + // If the material reflects the environment scene, the second pass is needed + if (prop->env_reflexion != 0.0) NamedStatus |= OPENGL_NS_2NDPASSNEED; + } + + /* OCC19915: Even if diffuse reflectance is disabled, + still trying to update the current transparency if it + differs from the previous value */ + if ( mDiff[0] != 0.F || mDiff[1] != 0.F || mDiff[2] != 0.F || fabs(mDiff[3] - newDiff3) > 0.01F ) + { + mDiff[0] = 0.F; + mDiff[1] = 0.F; + mDiff[2] = 0.F; + mDiff[3] = newDiff3; + + glMaterialfv(face, GL_DIFFUSE, mDiff); + } + } + + // Specular component + if( rm & OPENGL_SPECULAR_MASK ) + { + const float *c = prop->isphysic? prop->speccol.rgb : defspeccol; + + if (mSpec[0] != prop->spec * c[0] || + mSpec[1] != prop->spec * c[1] || + mSpec[2] != prop->spec * c[2]) + { + mSpec[0] = prop->spec * c[0]; + mSpec[1] = prop->spec * c[1]; + mSpec[2] = prop->spec * c[2]; + mSpec[3] = 1.F; + + glMaterialfv(face, GL_SPECULAR, mSpec); + } + } + else + { + if ( mSpec[0] != 0.F || mSpec[1] != 0.F || mSpec[2] != 0.F ) + { + mSpec[0] = 0.F; + mSpec[1] = 0.F; + mSpec[2] = 0.F; + mSpec[3] = 1.F; + + glMaterialfv(face, GL_SPECULAR, mSpec); + } + } + + // Emissive component + if( rm & OPENGL_EMISSIVE_MASK ) + { + const float *c = prop->isphysic? prop->emscol.rgb : prop->matcol.rgb; + + if (mEmsv[0] != prop->emsv * c[0] || + mEmsv[1] != prop->emsv * c[1] || + mEmsv[2] != prop->emsv * c[2]) + { + mEmsv[0] = prop->emsv * c[0]; + mEmsv[1] = prop->emsv * c[1]; + mEmsv[2] = prop->emsv * c[2]; + mEmsv[3] = 1.F; + + glMaterialfv(face, GL_EMISSION, mEmsv); + } + } + else + { + if ( mEmsv[0] != 0.F || mEmsv[1] != 0.F || mEmsv[2] != 0.F ) + { + mEmsv[0] = 0.F; + mEmsv[1] = 0.F; + mEmsv[2] = 0.F; + mEmsv[3] = 1.F; + + glMaterialfv(face, GL_EMISSION, mEmsv); + } + } + + // Shining coefficient + if( mShin != prop->shine ) + { + mShin = prop->shine; + glMaterialf(face, GL_SHININESS, mShin); + } + } +} + +/*----------------------------------------------------------------------*/ + +const OpenGl_AspectLine * OpenGl_Workspace::SetAspectLine(const OpenGl_AspectLine *AnAspect) +{ + const OpenGl_AspectLine *AspectLine_old = AspectLine_set; + AspectLine_set = AnAspect; + return AspectLine_old; +} + +/*----------------------------------------------------------------------*/ + +const OpenGl_AspectFace * OpenGl_Workspace::SetAspectFace(const OpenGl_AspectFace *AnAspect) +{ + const OpenGl_AspectFace *AspectFace_old = AspectFace_set; + AspectFace_set = AnAspect; + return AspectFace_old; +} + +/*----------------------------------------------------------------------*/ + +const OpenGl_AspectMarker * OpenGl_Workspace::SetAspectMarker(const OpenGl_AspectMarker *AnAspect) +{ + const OpenGl_AspectMarker *AspectMarker_old = AspectMarker_set; + AspectMarker_set = AnAspect; + return AspectMarker_old; +} + +/*----------------------------------------------------------------------*/ + +const OpenGl_AspectText * OpenGl_Workspace::SetAspectText(const OpenGl_AspectText *AnAspect) +{ + const OpenGl_AspectText *AspectText_old = AspectText_set; + AspectText_set = AnAspect; + return AspectText_old; +} + +/*----------------------------------------------------------------------*/ + +const OpenGl_Matrix * OpenGl_Workspace::SetViewMatrix(const OpenGl_Matrix *AMatrix) +{ + const OpenGl_Matrix *ViewMatrix_old = ViewMatrix_applied; + ViewMatrix_applied = AMatrix; + + OpenGl_Matrix lmat; + OpenGl_Transposemat3( &lmat, StructureMatrix_applied ); + + glMatrixMode (GL_MODELVIEW); + + if ( (NamedStatus & OPENGL_NS_ANIMATION) == 0 ) + { + OpenGl_Matrix rmat; + OpenGl_Multiplymat3( &rmat, &lmat, ViewMatrix_applied ); + glLoadMatrixf((const GLfloat *) rmat.mat); + } + + return ViewMatrix_old; +} + +/*----------------------------------------------------------------------*/ + +const OpenGl_Matrix * OpenGl_Workspace::SetStructureMatrix(const OpenGl_Matrix *AMatrix) +{ + const OpenGl_Matrix *StructureMatrix_old = StructureMatrix_applied; + StructureMatrix_applied = AMatrix; + + OpenGl_Matrix lmat; + OpenGl_Transposemat3( &lmat, AMatrix ); + + glMatrixMode (GL_MODELVIEW); + + if ( (NamedStatus & OPENGL_NS_ANIMATION) == 0 ) + { + OpenGl_Matrix rmat; + OpenGl_Multiplymat3( &rmat, &lmat, ViewMatrix_applied ); + glLoadMatrixf((const GLfloat *) rmat.mat); + } + else + { + glMultMatrixf((const GLfloat *) lmat.mat); + } + + return StructureMatrix_old; +} + +/*----------------------------------------------------------------------*/ + +const OpenGl_AspectLine * OpenGl_Workspace::AspectLine(const Standard_Boolean WithApply) +{ + if ( WithApply && (AspectLine_set != AspectLine_applied) ) + { + glColor3fv(AspectLine_set->Color().rgb); + + if ( !AspectLine_applied || (AspectLine_set->Type() != AspectLine_applied->Type() ) ) + { + myDisplay->SetTypeOfLine(AspectLine_set->Type()); + } + + if ( !AspectLine_applied || ( AspectLine_set->Width() != AspectLine_applied->Width() ) ) + { + glLineWidth( (GLfloat)AspectLine_set->Width() ); +#ifdef HAVE_GL2PS + gl2psLineWidth( (GLfloat)AspectLine_set->Width() ); +#endif + } + + AspectLine_applied = AspectLine_set; + } + return AspectLine_set; +} + +/*----------------------------------------------------------------------*/ + +const OpenGl_AspectFace * OpenGl_Workspace::AspectFace(const Standard_Boolean WithApply) +{ + if ( WithApply && (AspectFace_set != AspectFace_applied) ) + { + const Aspect_InteriorStyle intstyle = AspectFace_set->Context().InteriorStyle; + if ( !AspectFace_applied || AspectFace_applied->Context().InteriorStyle != intstyle ) + { + switch( intstyle ) + { + case Aspect_IS_EMPTY: + case Aspect_IS_HOLLOW: + glPolygonMode(GL_FRONT_AND_BACK,GL_LINE); + break; + + case Aspect_IS_HATCH: + glPolygonMode(GL_FRONT_AND_BACK,GL_FILL); + myDisplay->SetTypeOfHatch(AspectFace_applied? AspectFace_applied->Context().Hatch : TEL_HS_SOLID); + break; + + case Aspect_IS_SOLID: + case Aspect_IS_HIDDENLINE: + glPolygonMode(GL_FRONT_AND_BACK,GL_FILL); + glDisable(GL_POLYGON_STIPPLE); + break; + + case 5: //szvgl - no corresponding enumeration item Aspect_IS_POINT + glPolygonMode(GL_FRONT_AND_BACK,GL_POINT); + break; + } + } + if( intstyle == Aspect_IS_HATCH ) + { + const Tint hatchstyle = AspectFace_set->Context().Hatch; + if( !AspectFace_applied || AspectFace_applied->Context().Hatch != hatchstyle ) + { + myDisplay->SetTypeOfHatch(hatchstyle); + } + } + if ( !ActiveView()->Backfacing() ) + { + const Tint mode = AspectFace_set->Context().CullingMode; + if( !AspectFace_applied || AspectFace_applied->Context().CullingMode != mode ) + { + switch( (TelCullMode)mode ) + { + case TelCullNone: + glDisable(GL_CULL_FACE); + break; + + case TelCullFront: + glCullFace(GL_FRONT); + glEnable(GL_CULL_FACE); + break; + + case TelCullBack: + glCullFace(GL_BACK); + glEnable(GL_CULL_FACE); + break; + } + } + } + + // Aspect_POM_None means: do not change current settings + if ( ( AspectFace_set->Context().PolygonOffset.mode & Aspect_POM_None ) != Aspect_POM_None ) + { + if ( !PolygonOffset_applied || + PolygonOffset_applied->mode != AspectFace_set->Context().PolygonOffset.mode || + PolygonOffset_applied->factor != AspectFace_set->Context().PolygonOffset.factor || + PolygonOffset_applied->units != AspectFace_set->Context().PolygonOffset.units ) + { + PolygonOffset_applied = &AspectFace_set->Context().PolygonOffset; + TelUpdatePolygonOffsets( PolygonOffset_applied ); + } + } + + UpdateMaterial( TEL_FRONT_MATERIAL ); + if (AspectFace_set->Context().DistinguishingMode == TOn) + UpdateMaterial( TEL_BACK_MATERIAL ); + + if ((NamedStatus & OPENGL_NS_FORBIDSETTEX) == 0) + { + DisableTexture(); + if (AspectFace_set->Context().doTextureMap) + { + SetCurrentTexture(AspectFace_set->Context().TexId); + EnableTexture(); + } + } + + AspectFace_applied = AspectFace_set; + } + return AspectFace_set; +} + +/*----------------------------------------------------------------------*/ + +const OpenGl_AspectMarker * OpenGl_Workspace::AspectMarker(const Standard_Boolean WithApply) +{ + if ( WithApply && (AspectMarker_set != AspectMarker_applied) ) + { + AspectMarker_applied = AspectMarker_set; + } + return AspectMarker_set; +} + +/*----------------------------------------------------------------------*/ + +const OpenGl_AspectText * OpenGl_Workspace::AspectText(const Standard_Boolean WithApply) +{ + if ( WithApply ) + { + Standard_Boolean toApply = Standard_False; + if ( AspectText_set != AspectText_applied ) + { + if ( !AspectText_applied ) + toApply = Standard_True; + else if ( strcmp( AspectText_set->Font(), AspectText_applied->Font() ) || + ( AspectText_set->FontAspect() != AspectText_applied->FontAspect() ) ) + toApply = Standard_True; + + AspectText_applied = AspectText_set; + } + if ( TextParam_set != TextParam_applied ) + { + if ( !TextParam_applied ) + toApply = Standard_True; + else if ( TextParam_set->Height != TextParam_applied->Height ) + toApply = Standard_True; + + TextParam_applied = TextParam_set; + } + if ( toApply ) + { + FindFont(AspectText_applied->Font(), AspectText_applied->FontAspect(), TextParam_applied->Height); + } + } + return AspectText_set; +} + +/*----------------------------------------------------------------------*/ diff --git a/src/OpenGl/OpenGl_addnames.cxx b/src/OpenGl/OpenGl_addnames.cxx deleted file mode 100755 index 6011383121..0000000000 --- a/src/OpenGl/OpenGl_addnames.cxx +++ /dev/null @@ -1,151 +0,0 @@ - -#include - -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -static TStatus AddNamesetDisplay( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus AddNamesetAdd( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus AddNamesetDelete( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus AddNamesetPrint( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus AddNamesetInquire( TSM_ELEM_DATA, Tint, cmn_key* ); - -static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) = -{ - AddNamesetDisplay, /* PickTraverse */ - AddNamesetDisplay, - AddNamesetAdd, - AddNamesetDelete, - AddNamesetPrint, - AddNamesetInquire -}; - -MtblPtr -TelAddNamesetInitClass( TelType* el ) -{ - *el = TelAddNameset; - return MtdTbl; -} - -static TStatus -AddNamesetAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k ) -{ - Tint i, num, *ptr; - tel_tint_data data; - - num = k[0]->id; - data = new TEL_TINT_DATA(); - if( !data ) - return TFailure; - - data->data = new int[num]; - if( !data->data ) - return TFailure; - - for( i=0, ptr=(Tint*)(k[0]->data.pdata); idata[i] = ptr[i]; - } - data->num = num; - - ((tsm_elem_data)(d.pdata))->pdata = data; - - return TSuccess; -} - - -static TStatus -AddNamesetDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - tel_tint_data d; - - d = (tel_tint_data)data.pdata; - TglNamesetAdd( d->num, d->data ); - return TSuccess; -} - -static TStatus -AddNamesetDelete( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - if (data.pdata) - delete data.pdata; - return TSuccess; -} - - - - -static TStatus -AddNamesetPrint( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - Tint i; - tel_tint_data p; - - p = (tel_tint_data)data.pdata; - - fprintf( stdout, "TelAddNameset. Number: %d\n", p->num ); - for( i = 0; i < p->num; i++ ) - { - fprintf( stdout, "\n\t\t v[%d] = %d", i, p->data[i] ); - } - fprintf( stdout, "\n" ); - - return TSuccess; -} - - -static TStatus -AddNamesetInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - Tint i; - tel_tint_data d; - Tint size_reqd = 0; - TStatus status = TSuccess; - - d = (tel_tint_data)data.pdata; - - size_reqd = d->num * sizeof( Tint ); - - for( i = 0; i < n; i++ ) - { - switch( k[i]->id ) - { - case INQ_GET_SIZE_ID: - { - k[i]->data.ldata = size_reqd; - break; - } - - case INQ_GET_CONTENT_ID: - { - TEL_INQ_CONTENT *c; - Teldata *w; - - c = (tel_inq_content)k[i]->data.pdata; - c->act_size = size_reqd; - w = c->data; - - w->name_set.number = d->num; - if( c->size >= size_reqd ) - { - w->name_set.integers = (Tint *)(c->buf); - //cmn_memcpy(w->name_set.integers, d->data, d->num); - memcpy( w->name_set.integers, d->data, d->num*sizeof(int) ); - status = TSuccess; - } - else - status = TFailure; - break; - } - } - } - return status; -} diff --git a/src/OpenGl/OpenGl_animation.hxx b/src/OpenGl/OpenGl_animation.hxx deleted file mode 100755 index 6edabc85fa..0000000000 --- a/src/OpenGl/OpenGl_animation.hxx +++ /dev/null @@ -1,62 +0,0 @@ -/*********************************************************************** - -FONCTION : ----------- -File OpenGl_animation.h : - - -REMARQUES: ----------- - - -HISTORIQUE DES MODIFICATIONS : --------------------------------- -17-03-98 : FMN ; Creation. -08-07-98 : FMN ; Changement du nom de la primitive call_togl_erase_immediat_mode() --> call_togl_erase_animation_mode. -15-07-98 : FMN ; Portage Optimizer - -************************************************************************/ - -#ifndef OPENGL_ANIMATION_H -#define OPENGL_ANIMATION_H - -/*----------------------------------------------------------------------*/ -/* -* Include -*/ - -#include - -/*----------------------------------------------------------------------*/ -/* -* Fonctions externes -*/ - -extern void call_togl_erase_animation_mode(void); - - -/*----------------------------------------------------------------------*/ -/* -* Variables externes -*/ - -/* La display-list utilisee pour le mode animation */ -extern GLuint listIndex; - -/* La vue de reference pour le mode animation */ -extern int listIndexView; - -/* Flag si la display-list a ete initialise*/ -extern GLboolean listIndexFlag; - -/* Flag mode animation en cours */ -extern GLboolean animationFlag; - -/* Flag si le mode animation est disponible -* (cf. var environnement CALL_ANIMATION) */ -extern GLboolean animationUseFlag; - -/*----------------------------------------------------------------------*/ - -#endif /* OPENGL_ANIMATION_H */ diff --git a/src/OpenGl/OpenGl_antialias.cxx b/src/OpenGl/OpenGl_antialias.cxx deleted file mode 100755 index 3055d40bd5..0000000000 --- a/src/OpenGl/OpenGl_antialias.cxx +++ /dev/null @@ -1,134 +0,0 @@ -/*********************************************************************** - -FONCTION : ----------- -File OpenGl_antialias : - - -REMARQUES: ----------- - - -HISTORIQUE DES MODIFICATIONS : --------------------------------- -xx-xx-xx : xxx ; Creation. -20-02-96 : FMN ; Suppression code inutile: -01-04-96 : CAL ; Integration MINSK portage WNT - -************************************************************************/ - -/*----------------------------------------------------------------------*/ -/* -* Includes -*/ - -#include - -#include -#include - -#include -#include -#include -#include -#include - -/*----------------------------------------------------------------------*/ - -static TStatus AntiAliasingAdd( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus AntiAliasingDisplay( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus AntiAliasingPrint( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus AntiAliasingInquire( TSM_ELEM_DATA, Tint, cmn_key* ); - -/*----------------------------------------------------------------------*/ - -static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) = -{ - 0, /* PickTraverse */ - AntiAliasingDisplay, - AntiAliasingAdd, - 0, /* Delete */ - AntiAliasingPrint, - AntiAliasingInquire -}; - -/*----------------------------------------------------------------------*/ - -MtblPtr -TelAntiAliasingInitClass( TelType *el ) -{ - *el = TelAntiAliasing; - return MtdTbl; -} - -/*----------------------------------------------------------------------*/ - -static TStatus -AntiAliasingAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k ) -{ - ((tsm_elem_data)(d.pdata))->ldata = k[0]->data.ldata; - - return TSuccess; -} - -/*----------------------------------------------------------------------*/ - -static TStatus -AntiAliasingDisplay( TSM_ELEM_DATA d, Tint n, cmn_key *k ) -{ - CMN_KEY key; - - key.id = TelAntiAliasing; - key.data.ldata = d.ldata; - TsmSetAttri( 1, &key ); - return TSuccess; -} - -/*----------------------------------------------------------------------*/ - -static TStatus -AntiAliasingPrint( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - if( data.ldata == TOn ) - fprintf( stdout, "TelAntiAliasing. Value = ON\n" ); - else - fprintf( stdout, "TelAntiAliasing. Value = OFF\n" ); - fprintf( stdout, "\n" ); - - return TSuccess; -} - -/*----------------------------------------------------------------------*/ - -static TStatus -AntiAliasingInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - Tint i; - - for( i = 0; i < n; i++ ) - { - switch( k[i]->id ) - { - case INQ_GET_SIZE_ID: - { - k[i]->data.ldata = sizeof( Tint ); - break; - } - case INQ_GET_CONTENT_ID: - { - TEL_INQ_CONTENT *c; - Teldata *w; - - c = (tel_inq_content)k[i]->data.pdata; - w = c->data; - c->act_size = 0; - w->idata = data.ldata; - break; - } - } - } - - return TSuccess; -} - -/*----------------------------------------------------------------------*/ diff --git a/src/OpenGl/OpenGl_applid.cxx b/src/OpenGl/OpenGl_applid.cxx deleted file mode 100755 index 62971a9313..0000000000 --- a/src/OpenGl/OpenGl_applid.cxx +++ /dev/null @@ -1,83 +0,0 @@ - -#include - -#include -#include - -#include -#include -#include -#include -#include - -static TStatus ApplicationDataAdd( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus ApplicationDataPrint( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus ApplicationDataInquire( TSM_ELEM_DATA, Tint, cmn_key* ); - -static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) = -{ - 0, /* PickTraverse */ - 0, /* Display */ - ApplicationDataAdd, - 0, /* Delete */ - ApplicationDataPrint, - ApplicationDataInquire -}; - - -MtblPtr -TelApplicationDataInitClass( TelType *el ) -{ - *el = TelApplicationData; - return MtdTbl; -} - -static TStatus -ApplicationDataAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k ) -{ - ((tsm_elem_data)(d.pdata))->pdata = k[0]->data.pdata; - - return TSuccess; -} - - -static TStatus -ApplicationDataPrint( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - fprintf( stdout, "TelApplicationData. Value = %lx\n",(long ) data.pdata); - fprintf( stdout, "\n" ); - - return TSuccess; -} - - -static TStatus -ApplicationDataInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - Tint i; - - for( i = 0; i < n; i++ ) - { - switch( k[i]->id ) - { - case INQ_GET_SIZE_ID: - { - k[i]->data.ldata = sizeof( Tint ); - break; - } - case INQ_GET_CONTENT_ID: - { - TEL_INQ_CONTENT *c; - Teldata *w; - - c = (tel_inq_content)k[i]->data.pdata; - w = c->data; - c->act_size = 0; - w->data = (Tchar*)data.pdata; - break; - } - } - } - - return TSuccess; -} diff --git a/src/OpenGl/OpenGl_attri.cxx b/src/OpenGl/OpenGl_attri.cxx deleted file mode 100755 index 894df1d018..0000000000 --- a/src/OpenGl/OpenGl_attri.cxx +++ /dev/null @@ -1,1993 +0,0 @@ -/*********************************************************************** - -FONCTION : ----------- -File OpenGl_attri : - - -REMARQUES: ----------- - -ATTENTION: Actuellement les materiaux ont le Front et Back identiques. -(cf PRO6327). On met temporairement de cote le mode Distinguish. - - -HISTORIQUE DES MODIFICATIONS : --------------------------------- -xx-xx-xx : xxx ; Creation. -06-03-96 : FMN ; Ajout OpenGl_tgl_tox.h pour call_thedisplay -01-04-96 : CAL ; Integration MINSK portage WNT -12-04-96 : CAL ; Travail sur les materiaux -07-05-96 : CAL ; Debug temporaire pour ROB, TelRobSetRGB () -10-06-96 : CAL ; Transparence dans TsmSetAttri -13-06-96 : CAL ; Introduction de TsmPushAttriLight et TsmPopAttriLight -28-06-96 : FMN ; Amelioration des performances sur les materiaux -01-07-96 : FMN ; Correction + performance antialiasing; -03-07-96 : FMN ; Test sur ZBuffer avant appel a TelUpdateMaterial. -17-07-96 : FMN ; Suppression de HLHSRMode. -07-10-96 : FMN ; Suppression appel TelUpdateMaterial et define TELCO. -08-11-96 : FMN ; Suppression code CAL_OPTIM -21-11-96 : FMN ; Correction PRO6181 et PRO4138 Suppression (balise FMN) -05-12-96 : FMN ; PRO6327: Pas defaut on positionne les materiaux pour -le front et le back. -15-02-97 : FMN ; Suppression OpenGl_gl_compat.h -25-02-97 : FMN ; Ajout print informations -30-06-97 : FMN ; Appel de la toolkit OpenGl_LightBox. -03-07-97 : PCT ; Modif material. -05-08-97 : PCT ; support texture mapping -21-08-97 : PCT ; ajout deuxieme passe pour les textures -08-12-97 : FMN ; Correction Flat/Gouraud -09-12-97 : FMN ; Correction Antialing + Textures + Transparence -22-12-97 : FMN ; Suppression DEBUG_TEMPO_FOR_ROB -Correction PRO10217 sur le mode Transient -23-12-97 : FMN ; Suppression TelBackInteriorStyle, TelBackInteriorStyleIndex -et TelBackInteriorShadingMethod -30-12-97 : FMN ; CTS18312: Correction back material -31-12-97 : FMN ; Optimisation gestion material -15-01-98 : FMN ; Ajout Hidden line -08-04-98 : FGU ; Ajout emission -30-06-98 : FMN ; Correction init des materiaux dans TelUpdateMateriaux. -08-07-98 : FMN ; PRO14399: Meilleure gestion de la matrice locale sur -une structure. -21-07-98 : FMN ; Correction init attri_default et du hatch -30-11-98 : FMN ; S4069 : Textes toujours visibles -05-01-99 : CAL ; Warning WNT -22-03-04 : SAN ; OCC4895 High-level interface for controlling polygon offsets - -************************************************************************/ - -#define BUC60577 /*GG_101099 Enable to compute correctly -// transparency with more than one object in the view. -*/ - -#define IMP190100 /*GG Push and Pop polyline type and width -// attributes correctly. -*/ - -#define G003 /*EUG degeneration mode management -*/ - -#define GER61394 /*GG 26/05/00 Enable AntiAliasing also on polygons.*/ - -#define BUC60742 /*GG 18/09/00 Enable to use both animation and -graphic structure transformation -*/ - -#define IMP250401 /*GG Sets always the current polyline colour -used in immediat mode context. -*/ - -/*OCC8568 changes made by GG rolled back due to regression*/ -/*#define BUC60918*/ /*GG CADPAK_V2/RINA Enable transparency using Zbuffer - */ - -/*----------------------------------------------------------------------*/ -/* -* Constantes -*/ - -#define NO_TRACE -#define NO_TRACE_UPMATERIAL -#define NO_TRACE_MATERIAL -#define NO_TRACE_LIGHT -#define NO_TRACE_MATRIX -#define NO_TRACE_TEXT - -/*----------------------------------------------------------------------*/ -/* -* Includes -*/ - -/* OCC22218 NOTE: project dependency on gl2ps is specified by macro */ -#ifdef HAVE_GL2PS - #include - /* OCC22216 NOTE: linker dependency can be switched off by undefining macro. - Pragma comment for gl2ps.lib is defined only here. */ - #ifdef _MSC_VER - #pragma comment( lib, "gl2ps.lib" ) - #endif -#endif - -#include - -#include -#include - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include - -/* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */ -#include -/* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */ - -/* ABD 29/10/04 Transform Persistence of Presentation( pan, zoom, rotate ) */ -#include -/* ABD 29/10/04 Transform Persistence of Presentation( pan, zoom, rotate ) */ - -#include - -#include -#include - - -/*----------------------------------------------------------------------*/ -/* -* Definitions type -*/ - -struct TSM_ATTRI_BLK_STRUCT { - //struct TSM_ATTRI_BLK_STRUCT *next; - /* ABD 29/10/04 Transform Persistence of Presentation( pan, zoom, rotate ) */ - /*Tint TransPersFlag;*/ - TEL_TRANSFORM_PERSISTENCE TransPers; - /* ABD 29/10/04 Transform Persistence of Presentation( pan, zoom, rotate ) */ - TEL_COLOUR PolylineColour; - Tfloat PolylineWidth; - Tint PolylineType; - TEL_COLOUR EdgeColour; - Tfloat EdgeWidth; - Tint EdgeType; - Tint AntiAliasing; - TEL_COLOUR InteriorColour; - Tint EdgeFlag; - Tint InteriorStyle; - Tint InteriorStyleIndex; - Tfloat PolymarkerSize; - TEL_COLOUR PolymarkerColour; - TEL_COLOUR BackInteriorColour; - Tint FaceDistinguishingMode; - TEL_COLOUR TextColour; - TEL_COLOUR TextColourSubTitle; - Tint TextStyle; - Tint TextDisplayType; - Tchar *TextFont; - Tfloat TextHeight; - Tfloat CharacterSpacing; - Tfloat CharacterExpansionFactor; - Tint TextZoomable; - Tfloat TextAngle; - OSD_FontAspect TextFontAspect; - /*OCC7456 abd 14.12.2004 Text alingnment attributes */ - TEL_ALIGN_DATA TextAlign; - /*OCC7456 abd 14.12.2004 Text alingnment attributes */ - Tint PolymarkerType; - Tint InteriorReflectanceEquation; - Tint BackInteriorReflectanceEquation; - TEL_SURF_PROP SurfaceAreaProperties; - TEL_SURF_PROP BackSurfaceAreaProperties; - TelCullMode FaceCullingMode; - Tint DepthCueIndex; - Tint InteriorShadingMethod; - Tint ViewIndex; - Tint HighlightIndex; - Tmatrix3 LocalTran3; - Tint DoTextureMap; - Tint TextureId; -#ifdef G003 - Tint DegenerationMode; -#endif /* G003 */ - /* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */ - TEL_POFFSET_PARAM PolygonOffsetParams; - /* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */ - - IMPLEMENT_MEMORY_OPERATORS -}; -typedef TSM_ATTRI_BLK_STRUCT TSM_ATTRI_BLK; -typedef TSM_ATTRI_BLK_STRUCT* tsm_attri_blk; - - -/*----------------------------------------------------------------------*/ -/* -* Variables statiques -*/ -typedef NCollection_Stack Attri_Stack; -static Attri_Stack attri_stk; - -/* FSXXX */ -static Tint need_reset = 0; - -/* Est-il necessaire de faire de la transparence ? */ -static Tint need_trans = 0; - -static TSM_ATTRI_BLK attri_default = -{ - {0 , 0.0F, 0.0F, 0.0F }, - /* ABD 29/10/04 Transform Persistence of Presentation( pan, zoom, rotate ) */ - {{ 1.0F, 1.0F, 1.0F }}, /* PolylineColour */ - 1.0F, /* PolylineWidth */ - TEL_LS_SOLID, /* PolylineType */ - {{ 1.0F, 1.0F, 1.0F }}, /* EdgeColour */ - 1.0F, /* EdgeWidth */ - 0, /* EdgeType */ - TOff, /* AntiAliasing */ - {{ 1.0F, 1.0F, 1.0F }}, /* InteriorColour */ - TOn, /* EdgeFlag */ - TSM_SOLID, /* InteriorStyle */ - TEL_HS_SOLID, /* InteriorStyleIndex */ - 1.0F, /* PolymarkerSize */ - {{ 1.0F, 1.0F, 1.0F }}, /* PolymarkerColour */ - {{ 1.0F, 1.0F, 1.0F }}, /* BackInteriorColour */ - TOn, /* FaceDistinguishingMode */ - {{ 1.0F, 1.0F, 1.0F }}, /* TextColour */ - {{ 1.0F, 1.0F, 1.0F }}, /* TextColourSubTitle */ - ASPECT_TOST_NORMAL, /* TextStyle */ - ASPECT_TODT_NORMAL, /* TextDisplayType */ - (Tchar*)"Courier", /* TextFont */ - 16.0F, /* TextHeight */ - 0.3F, /* CharacterSpacing */ - 1.0F, /* CharacterExpansionFactor */ - 0, /*TextZoomable*/ - 0, /*TextAngle*/ - OSD_FA_Regular, /*TextFontAspect - OSD_FA_Regular*/ - /*OCC7456 abd 14.12.2004 Text alingnment attributes */ - { 0, /*Horizontal Text Alignment*/ - 0 }, /*Vertical Text Alignment*/ - /*OCC7456 abd 14.12.2004 Text alingnment attributes */ - TEL_PM_PLUS, /* PolymarkerType */ - CALL_PHIGS_REFL_NONE, /* InteriorReflectanceEquation */ - CALL_PHIGS_REFL_NONE, /* BackInteriorReflectanceEquation */ - { 0.2F, 0.8F, 0.1F, 0.0F, /* Coef d eclairage */ - 1.0F, 10.0F, 0.0F, - 1, 1, 1, 0, 0, /* Etat des eclairage */ - {{ 1.0F, 1.0F, 1.0F }}, /* ambient color */ - {{ 1.0F, 1.0F, 1.0F }}, /* diffuse color */ - {{ 1.0F, 1.0F, 1.0F }}, /* specular color */ - {{ 1.0F, 1.0F, 1.0F }}, /* emissive color */ - {{ 1.0F, 1.0F, 1.0F }}}, /* material color */ /* SurfaceAreaProperties */ - { 0.2F, 0.8F, 0.1F, 0.0F, /* Coef d eclairage */ - 1.0F, 10.0F, 0.0F, - 1, 1, 1, 0, 0, /* Etat des eclairage */ - {{ 1.0F, 1.0F, 1.0F }}, /* ambient color */ - {{ 1.0F, 1.0F, 1.0F }}, /* diffuse color */ - {{ 1.0F, 1.0F, 1.0F }}, /* specular color */ - {{ 1.0F, 1.0F, 1.0F }}, /* emissive color */ - {{ 1.0F, 1.0F, 1.0F }}}, /* material color */ /* BackSurfaceAreaProperties */ - TelCullNone, /* FaceCullingMode */ - 0, /* DepthCueIndex */ - TEL_SM_GOURAUD, /* InteriorShadingMethod */ - 0, /* ViewIndex */ - 0, /* HighlightIndex */ - { - { 1.0F, 0.0F, 0.0F, 0.0F }, - { 0.0F, 1.0F, 0.0F, 0.0F }, - { 0.0F, 0.0F, 1.0F, 0.0F }, - { 0.0F, 0.0F, 0.0F, 1.0F } - }, /* LocalTran3 */ - TEL_SD_SHADING, - -1 -#ifdef G003 - , 0 /* DegenerationMode */ -#endif /* G003 */ - /* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */ - , { Aspect_POM_Fill, 1.0F, 0.0F } - /* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */ -}; - -#ifdef G003 -extern int g_nBackfacing; -#endif /* G003 */ - -/*----------------------------------------------------------------------*/ -/* -* Prototypes -*/ - -static void TelUpdateFog( Tint, Tint, Tint ); /* ws, vid, dcid */ -static void TelSetViewMatrix( Tmatrix3, Tint ); /* mat, vid */ -static void call_util_transpose_mat (float tmat[16], float mat[4][4]); -static void TelUpdatePolygonOffsets( tel_poffset_param ); - -/*----------------------------------------------------------------------*/ -/* -* Variables externes -*/ - -extern tsm_trsf_stack cur_trsf_stack; - -GLuint fontBase; -extern GLuint linestyleBase; -extern GLuint patternBase; - -extern Tint ForbidSetTextureMapping; /* currently defined in tsm/tsm.c */ -extern Tint SecondPassNeeded; /* currently defined in tsm/tsm.c */ -extern Tint SecondPassDo; /* currently defined in tsm/tsm.c */ - -/*----------------------------------------------------------------------*/ - - -TStatus -TsmPushAttri( void ) -{ - tsm_attri_blk node; - - node = new TSM_ATTRI_BLK(); - - if( !attri_stk.IsEmpty() ) - { - *node = *attri_stk.Top(); -#ifdef TRACE - printf("TsmPushAttri %x\n",attri_tail); -#endif - } - else - { - *node = attri_default; -#ifdef TRACE - printf("TsmPushAttri attri_default %x\n",attri_tail); -#endif - - /* Register all default attributes with gl */ - - glLineWidth( ( GLfloat )attri_default.PolylineWidth ); -#ifdef HAVE_GL2PS - gl2psLineWidth( ( GLfloat )attri_default.PolylineWidth ); -#endif - - OpenGl_TextRender* textRender=OpenGl_TextRender::instance(); - textRender->FindFont(node->TextFont, node->TextFontAspect, node->TextHeight,1,1); - -#ifdef G003 - if ( !g_nBackfacing ) -#endif /* G003 */ - switch (node->FaceCullingMode) { -case TelCullNone: - glDisable (GL_CULL_FACE); - break; - -case TelCullFront: - glCullFace (GL_FRONT); - glEnable (GL_CULL_FACE); - break; - -case TelCullBack: - glCullFace (GL_BACK); - glEnable (GL_CULL_FACE); - break; - } - /* ABD 29/10/04 Transform Persistence of Presentation( pan, zoom, rotate ) */ - transform_persistence_begin( 0, 0.0, 0.0, 0.0 ); - /* ABD 29/10/04 Transform Persistence of Presentation( pan, zoom, rotate ) */ - - } - attri_stk.Push( node ); - return TSuccess; -} - -/*----------------------------------------------------------------------*/ - -TStatus -TsmPopAttri( void ) -{ - tsm_attri_blk node; - - if ( attri_stk.IsEmpty() ) - return TFailure; /* Underflow */ - - node = attri_stk.ChangeTop(); - attri_stk.Pop(); - -#ifdef TRACE - printf("TsmPopAttri %x\n",attri_tail); -#endif - - if( !attri_stk.IsEmpty() ) - { - tsm_attri_blk attri_tail = attri_stk.Top(); - - /* Reset the attributes */ - Tint i; - Tfloat f; - - f = attri_tail->PolylineWidth; - if( node->PolylineWidth != f ) { -#ifdef TRACE - printf("TsmPopAttri.linewidth %f\n",f); -#endif - - glLineWidth( (GLfloat)f ); -#ifdef HAVE_GL2PS - gl2psLineWidth( (GLfloat)f ); -#endif - } - - i = attri_tail->InteriorStyle; - if( node->InteriorStyle != i ) - { - switch( i ) - { - case TSM_SOLID: - case TSM_HIDDENLINE: - glPolygonMode(GL_FRONT_AND_BACK, GL_FILL ); - glDisable(GL_POLYGON_STIPPLE); - break; - - case TSM_HOLLOW: - glPolygonMode(GL_FRONT_AND_BACK, GL_LINE ); - break; - - case TSM_EMPTY: - glPolygonMode(GL_FRONT_AND_BACK, GL_LINE ); - break; - - case TSM_HATCH: - glPolygonMode(GL_FRONT_AND_BACK, GL_FILL ); - if( node->InteriorStyleIndex ) { - glCallList( patternBase + node->InteriorStyleIndex ); - glEnable(GL_POLYGON_STIPPLE); - } else - glDisable(GL_POLYGON_STIPPLE); - break; - - case TSM_POINT: - glPolygonMode(GL_FRONT_AND_BACK, GL_POINT ); - break; - } - } - - i = attri_tail->PolylineType; - if( node->PolylineType != i ) { -#ifdef TRACE - printf("TsmPopAttri.linetype %d\n",i); -#endif - if (i) { - glCallList( linestyleBase+i ); - - glEnable( GL_LINE_STIPPLE ); -#ifdef HAVE_GL2PS - gl2psEnable( GL2PS_LINE_STIPPLE ); -#endif - } else { - - glDisable( GL_LINE_STIPPLE ); -#ifdef HAVE_GL2PS - gl2psDisable( GL2PS_LINE_STIPPLE ); -#endif - } - } - - if( strcmp( (char*)attri_tail->TextFont, (char*)node->TextFont ) || - ( attri_tail->TextHeight != node->TextHeight ) ) - { - - OpenGl_TextRender* textRender = OpenGl_TextRender::instance(); - textRender->FindFont(attri_tail -> TextFont, attri_tail->TextFontAspect, attri_tail -> TextHeight); - } -#ifdef G003 - if ( !g_nBackfacing ) -#endif /* G003 */ - { - if( attri_tail->FaceCullingMode != node->FaceCullingMode ) - { - switch( attri_tail->FaceCullingMode ) - { - case TelCullNone: - glDisable(GL_CULL_FACE); - break; - - case TelCullFront: - glCullFace(GL_FRONT) ; - glEnable(GL_CULL_FACE); - break; - - case TelCullBack: - glCullFace(GL_BACK); - glEnable(GL_CULL_FACE); - break; - } - } - } - - /* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */ - if( attri_tail->PolygonOffsetParams.mode != node->PolygonOffsetParams.mode || - attri_tail->PolygonOffsetParams.factor != node->PolygonOffsetParams.factor || - attri_tail->PolygonOffsetParams.units != node->PolygonOffsetParams.units ) - { - TelUpdatePolygonOffsets( &attri_tail->PolygonOffsetParams ); - } - /* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */ - - /* ABD 29/10/04 Transform Persistence of Presentation( pan, zoom, rotate ) */ - if( attri_tail->TransPers.mode != node->TransPers.mode || - attri_tail->TransPers.pointX != node->TransPers.pointX || - attri_tail->TransPers.pointY != node->TransPers.pointY || - attri_tail->TransPers.pointZ != node->TransPers.pointZ ) - - { - transform_persistence_begin( attri_tail->TransPers.mode, - attri_tail->TransPers.pointX, - attri_tail->TransPers.pointY, - attri_tail->TransPers.pointZ ); - } - /* ABD 29/10/04 Transform Persistence of Presentation( pan, zoom, rotate ) */ - - if( attri_tail->ViewIndex != node->ViewIndex ) - { - TelSetViewProjection( TglActiveWs, attri_tail->ViewIndex ); -#ifdef TRACE_MATRIX - printf("TsmPopAttri::TelSetViewMatrix::attri_tail->ViewIndex != node->ViewIndex \n"); -#endif - TelSetViewMatrix( attri_tail->LocalTran3, attri_tail->ViewIndex ); - TelUpdateFog( TglActiveWs, attri_tail->ViewIndex, attri_tail->DepthCueIndex ); - } - else - { - if( attri_tail->DepthCueIndex != node->DepthCueIndex ) - TelUpdateFog( TglActiveWs, attri_tail->ViewIndex, attri_tail->DepthCueIndex ); - if( memcmp( node->LocalTran3, attri_tail->LocalTran3, sizeof(Tmatrix3) ) ) - { -#ifdef TRACE_MATRIX - printf("TsmPopAttri::TelSetViewMatrix::memcmp( node->LocalTran3, attri_tail->LocalTran3, sizeof(Tmatrix3) ) \n"); -#endif - TelSetViewMatrix(attri_tail->LocalTran3,attri_tail->ViewIndex); - } - } - } -#ifdef IMP190100 /* Reset default attribs at the top */ - else { - Tint i; - Tfloat f; - - f = attri_default.PolylineWidth; - if( node->PolylineWidth != f ) { - - - glLineWidth( (GLfloat)f ); -#ifdef HAVE_GL2PS - gl2psLineWidth( (GLfloat)f ); -#endif - -#ifdef TRACE - printf("TsmPopAttri.defaultlinewidth %f\n",f); -#endif - } - - i = attri_default.PolylineType; - if( node->PolylineType != i ) { - if (i) { - glCallList( linestyleBase+i ); - - glEnable( GL_LINE_STIPPLE ); -#ifdef HAVE_GL2PS - gl2psEnable( GL2PS_LINE_STIPPLE ); -#endif - } else { - - glDisable( GL_LINE_STIPPLE ); -#ifdef HAVE_GL2PS - gl2psDisable( GL2PS_LINE_STIPPLE ); -#endif - } - - -#ifdef TRACE - printf("TsmPopAttri.defaultlinetype %d\n",i); -#endif - } - /* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */ - TelUpdatePolygonOffsets( &attri_default.PolygonOffsetParams ); - /* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */ - - /* ABD 29/10/04 Transform Persistence of Presentation( pan, zoom, rotate ) */ - /*transform_persistence_begin( attri_default.TransPersFlag );*/ - transform_persistence_begin( attri_default.TransPers.mode, - attri_default.TransPers.pointX, - attri_default.TransPers.pointY, - attri_default.TransPers.pointZ ); - /* ABD 29/10/04 Transform Persistence of Presentation( pan, zoom, rotate ) */ - } -#endif /*IMP190100*/ - - /* abd - cmn_stg_tbl_free( (void *) node );*/ - delete node; - - return TSuccess; -} - -/*----------------------------------------------------------------------*/ - -TStatus -TsmSetAttri( Tint n, ... ) -{ - Tint i; - -#if defined (SOLARIS) || defined (IRIXO32) - cmn_key *k; -#else - cmn_key k[TMaxArgs]; -#endif - -#ifdef GER61394 - static int antiAliasingMode = -1; - if( antiAliasingMode < 0 ) { - char string[64]; - if (call_util_osd_getenv("CALL_OPENGL_ANTIALIASING_MODE", string, 64) ) { - int v; - if( sscanf(string,"%d",&v) > 0 ) antiAliasingMode = v; - printf(".OpenGl driver.AntiAliasing mode is %d\n",antiAliasingMode); - } else { - antiAliasingMode = 3; - } - } -#endif - - if (attri_stk.IsEmpty()) - return TFailure; - - tsm_attri_blk attri_tail = attri_stk.ChangeTop(); - - CMN_GET_STACK( n, k ); - for( i = 0; i < n; i++ ) - { - switch( k[i]->id ) - { - case TelTextureId: - attri_tail->TextureId = k[i]->data.ldata; - - if (!ForbidSetTextureMapping) { - if (attri_tail->DoTextureMap) - { - DisableTexture(); - SetCurrentTexture(attri_tail->TextureId); - EnableTexture(); - } - else - DisableTexture(); - } - break; - - case TelDoTextureMap: - attri_tail->DoTextureMap = k[i]->data.ldata; - break; - - case TelTextStyle: - attri_tail->TextStyle = k[i]->data.ldata; - break; - - case TelTextDisplayType: - attri_tail->TextDisplayType = k[i]->data.ldata; - break; - - case TelPolylineColour: - attri_tail->PolylineColour = *(tel_colour)(k[i]->data.pdata); -#ifdef IMP250401 - glColor3f(attri_tail->PolylineColour.rgb[0], - attri_tail->PolylineColour.rgb[1], - attri_tail->PolylineColour.rgb[2]); -#endif - break; - - case TelPolylineWidth: - { - Tfloat w; - - w = k[i]->data.fdata; - if( attri_tail->PolylineWidth != w ) - { -#ifdef TRACE - printf("TsmSetAttri.linewidth %f\n",w); -#endif - attri_tail->PolylineWidth = w; - - glLineWidth( (GLfloat)w ); -#ifdef HAVE_GL2PS - gl2psLineWidth( (GLfloat)w ); -#endif - } - break; - } - - case TelPolylineType: - { - Tint ls; - - ls = k[i]->data.ldata; - if( attri_tail->PolylineType != ls ) - { -#ifdef TRACE - printf("TsmSetAttri.linetype %d\n",ls); -#endif - attri_tail->PolylineType = ls; - if (ls) { - glCallList(linestyleBase+ls); - - glEnable( GL_LINE_STIPPLE ); -#ifdef HAVE_GL2PS - gl2psEnable( GL2PS_LINE_STIPPLE ); -#endif - } else { - - glDisable( GL_LINE_STIPPLE ); -#ifdef HAVE_GL2PS - gl2psDisable( GL2PS_LINE_STIPPLE ); -#endif - } - } - break; - } - - case TelEdgeType: - attri_tail->EdgeType = k[i]->data.ldata; - break; - - case TelEdgeWidth: - attri_tail->EdgeWidth = k[i]->data.fdata; - break; - - case TelEdgeColour: - attri_tail->EdgeColour = *(tel_colour)(k[i]->data.pdata); - break; - - case TelAntiAliasing: - { - attri_tail->AntiAliasing = k[i]->data.ldata; - - if (!SecondPassNeeded) - { - if( attri_tail->AntiAliasing == TOff ) - { - glDisable(GL_POINT_SMOOTH); - glDisable(GL_LINE_SMOOTH); -#ifdef GER61394 - if( antiAliasingMode & 2 ) glDisable(GL_POLYGON_SMOOTH); -#endif - glBlendFunc (GL_ONE, GL_ZERO); - glDisable (GL_BLEND); - } - else /* TOn */ - { - glEnable(GL_POINT_SMOOTH); - glEnable(GL_LINE_SMOOTH); -#ifdef GER61394 - if( antiAliasingMode & 2 ) glEnable(GL_POLYGON_SMOOTH); -#endif - glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable (GL_BLEND); - } - } - break; - } - - case TelInteriorColour: - { - attri_tail->InteriorColour = *(tel_colour)(k[i]->data.pdata); - break; - } - - case TelEdgeFlag: - { - attri_tail->EdgeFlag = k[i]->data.ldata; - break; - } - - case TelInteriorStyle: - { - Tint s; - - s = k[i]->data.ldata; - if( attri_tail->InteriorStyle != s ) - { - attri_tail->InteriorStyle = s; - switch( s ) - { - case TSM_SOLID: - case TSM_HIDDENLINE: - glPolygonMode(GL_FRONT_AND_BACK, GL_FILL ); - glDisable(GL_POLYGON_STIPPLE); - break; - - case TSM_HOLLOW: - glPolygonMode(GL_FRONT_AND_BACK, GL_LINE ); - break; - - case TSM_EMPTY: - glPolygonMode(GL_FRONT_AND_BACK, GL_LINE ); - break; - - case TSM_HATCH: - glPolygonMode(GL_FRONT_AND_BACK, GL_FILL ); - if( attri_tail->InteriorStyleIndex ) { - glCallList( patternBase + attri_tail->InteriorStyleIndex ); - glEnable(GL_POLYGON_STIPPLE); - } else - glDisable(GL_POLYGON_STIPPLE); - break; - - case TSM_POINT: - glPolygonMode(GL_FRONT_AND_BACK, GL_POINT ); - break; - } - } - break; - } - - case TelInteriorStyleIndex: - { - Tint is = k[i]->data.ldata; - if( attri_tail->InteriorStyleIndex != is ) - { - attri_tail->InteriorStyleIndex = is; - if( attri_tail->InteriorStyle == TSM_HATCH ) - { - if (is) - { - glCallList( patternBase + is ); - glEnable(GL_POLYGON_STIPPLE); - } else - glDisable(GL_POLYGON_STIPPLE); - } - } - break; - } - - case TelPolymarkerColour: - attri_tail->PolymarkerColour = *(tel_colour)(k[i]->data.pdata); - break; - - case TelPolymarkerSize: - attri_tail->PolymarkerSize = k[i]->data.fdata; - break; - - case TelLocalTran3: - { - tel_matrix3_data d = ((tel_matrix3_data)(k[i]->data.pdata)); - switch(d->mode) - { - case TPreConcatenate: /* not used */ - TelMultiplymat3( attri_tail->LocalTran3, - d->mat, attri_tail->LocalTran3 ); - break; - - case TPostConcatenate: /* not used */ - TelMultiplymat3( attri_tail->LocalTran3, - attri_tail->LocalTran3, d->mat ); - break; - - case TReplace: -#ifdef BUC60742 - matcpy( attri_tail->LocalTran3, d->mat ); - TelTransposemat3( attri_tail->LocalTran3 ); -#else - /* - * On multiplie la trsf courante par la trsf - * de la structure que l'on est en train de - * parcourir. - */ - TelMultiplymat3( cur_trsf_stack->LocalTran3, - cur_trsf_stack->LocalTran3, d->mat ); - /* - * On copie de resultat dans la queue d'attributs - * pour pouvoir changer l'orientation du reste - * du trace. - */ - matcpy( attri_tail->LocalTran3, - cur_trsf_stack->LocalTran3 ); - /* - * Transformation definie dans un repere direct - * a appliquer dans un repere indirect - */ - TelTransposemat3( attri_tail->LocalTran3 ); -#endif /*BUC60742*/ - break; - } -#ifdef TRACE_MATRIX - printf("TsmSetAttri::TelSetViewMatrix::TelLocalTran3 \n"); -#endif - TelSetViewMatrix(attri_tail->LocalTran3,attri_tail->ViewIndex); - break; - } - - case TelBackInteriorColour: - { - attri_tail->BackInteriorColour = *(tel_colour)(k[i]->data.pdata); - break; - } - - case TelFaceDistinguishingMode: - { - attri_tail->FaceDistinguishingMode = (Tint) k[i]->data.ldata; - break; - } - - case TelTextColour: - attri_tail->TextColour = *(tel_colour)(k[i]->data.pdata); - break; - - case TelTextColourSubTitle: - attri_tail->TextColourSubTitle = *(tel_colour)(k[i]->data.pdata); - break; - - case TelTextFont: - { - Tchar *fn = (Tchar*)k[i]->data.pdata; -#ifdef TRACE_TEXT - printf ("TelTextFont:: %s %s \n", fn, attri_tail->TextFont); -#endif - if( strcmp( (char*)fn, (char*)attri_tail->TextFont ) ) - { - OpenGl_TextRender* textRender = OpenGl_TextRender::instance(); - textRender->FindFont ( fn, attri_tail->TextFontAspect, attri_tail -> TextHeight ); - attri_tail->TextFont = fn; - } - break; - } - - case TelTextHeight: - { - Tfloat h; - - h = k[i]->data.fdata; -#ifdef TRACE_TEXT - printf ("TelTextHeight:: %f %f \n", h, attri_tail->TextHeight); -#endif - if( h != attri_tail->TextHeight ) - { - OpenGl_TextRender* textRender = OpenGl_TextRender::instance(); - textRender->FindFont (attri_tail->TextFont, attri_tail->TextFontAspect,h ); - attri_tail->TextHeight = h; - } - break; - } - - case TelCharacterSpacing: - attri_tail->CharacterSpacing = k[i]->data.fdata; - break; - - case TelCharacterExpansionFactor: - { - attri_tail->CharacterExpansionFactor = k[i]->data.fdata; - break; - } - - case TelTextZoomable: - attri_tail->TextZoomable = k[i]->data.ldata; - break; - case TelTextAngle: - attri_tail->TextAngle = k[i]->data.ldata; - break; - case TelTextFontAspect: - attri_tail->TextFontAspect = OSD_FontAspect(k[i]->data.ldata); - break; - - /*OCC7456 abd 14.12.2004 Text alingnment attributes */ - case TelTextAlign: - attri_tail->TextAlign = *(tel_align_data)k[i]->data.pdata; - break; - /*OCC7456 abd 14.12.2004 Text alingnment attributes */ - - case TelPolymarkerType: - attri_tail->PolymarkerType = k[i]->data.ldata; - break; - - case TelInteriorReflectanceEquation: - attri_tail->InteriorReflectanceEquation = - (Tint) k[i]->data.ldata; - break; - - case TelBackInteriorReflectanceEquation: - attri_tail->BackInteriorReflectanceEquation = - (Tint) k[i]->data.ldata; - break; - - case TelSurfaceAreaProperties: - attri_tail->SurfaceAreaProperties = - *(tel_surf_prop)(k[i]->data.pdata); -#ifdef TRACE_UPMATERIAL - printf("TsmSetAttri::TelSurfaceAreaProperties:TelUpdateMaterial (TEL_FRONT_MATERIAL)\n"); -#endif - TelUpdateMaterial( TEL_FRONT_MATERIAL ); - break; - - case TelBackSurfaceAreaProperties: - attri_tail->BackSurfaceAreaProperties = - *(tel_surf_prop)(k[i]->data.pdata); -#ifdef TRACE_UPMATERIAL - printf("TsmSetAttri::TelBackSurfaceAreaProperties:TelUpdateMaterial (TEL_BACK_MATERIAL)\n"); -#endif - if (attri_tail->FaceDistinguishingMode == TOn) - TelUpdateMaterial( TEL_BACK_MATERIAL ); - break; - - case TelFaceCullingMode: -#ifdef G003 - if ( !g_nBackfacing ) -#endif /* G003 */ - { - TelCullMode mode = (TelCullMode) k[i]->data.ldata; - if( mode != attri_tail->FaceCullingMode ) - { - attri_tail->FaceCullingMode = mode; - switch( mode ) - { - case TelCullNone: - glDisable(GL_CULL_FACE); - break; - - case TelCullFront: - glCullFace(GL_FRONT); - glEnable(GL_CULL_FACE); - break; - - case TelCullBack: - glCullFace(GL_BACK); - glEnable(GL_CULL_FACE); - break; - } - } - } - break; - - case TelDepthCueIndex: - { - Tint dc; - - dc = k[i]->data.ldata; - if( dc != attri_tail->DepthCueIndex ) - { - attri_tail->DepthCueIndex = dc; - TelUpdateFog( TglActiveWs, attri_tail->ViewIndex, dc ); - } - break; - } - - case TelInteriorShadingMethod: - { - Tint a; - - a = k[i]->data.ldata; - attri_tail->InteriorShadingMethod = a; - a == TEL_SM_FLAT ? glShadeModel( GL_FLAT ) : - glShadeModel( GL_SMOOTH ); - break; - } - - case TelViewIndex: - { - Tint vid = k[i]->data.ldata; - - if( vid != attri_tail->ViewIndex ) - { - attri_tail->ViewIndex = vid; - TelUpdateFog( TglActiveWs, vid, attri_tail->DepthCueIndex ); - } - break; - } - - case TelHighlightIndex: - attri_tail->HighlightIndex = k[i]->data.ldata; - break; -#ifdef G003 - case TelDegenerationMode: - attri_tail -> DegenerationMode = k[ i ] -> data.ldata; - break; -#endif /* G003 */ - - /* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */ - case TelPolygonOffset: - { - tel_poffset_param pdata = (tel_poffset_param)(k[i]->data.pdata); - /* Aspect_POM_None means: do not change current settings */ - if ( ( pdata->mode & Aspect_POM_None ) == Aspect_POM_None ) - break; - attri_tail->PolygonOffsetParams = *pdata; - TelUpdatePolygonOffsets( pdata ); - break; - } - /* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */ - - - case TelTransformPersistence: - { - attri_tail->TransPers = *(tel_transform_persistence)(k[i]->data.pdata); - transform_persistence_begin( attri_tail->TransPers.mode, - attri_tail->TransPers.pointX, - attri_tail->TransPers.pointY, - attri_tail->TransPers.pointZ ); - - break; - } - /* ABD 29/10/04 Transform Persistence of Presentation( pan, zoom, rotate ) */ - - default: - break; - } - } - return TSuccess; -} - -/*----------------------------------------------------------------------*/ - -TStatus -TsmGetAttri( Tint n, ... ) -{ - Tint i; -#if defined (SOLARIS) || defined (IRIXO32) - cmn_key *k; -#else - cmn_key k[TMaxArgs]; -#endif - - tsm_attri_blk attri_tail = NULL; - - if (attri_stk.IsEmpty()) - { -#ifdef TRACE - printf ("TsmGetAttri with attri_tail == NULL\n"); -#endif - attri_tail = &attri_default; - } else { - attri_tail = attri_stk.Top(); - } - - CMN_GET_STACK( n, k ); - for( i = 0; i < n; i++ ) - { - switch( k[i]->id ) - { - case TelTextureId: - k[i]->data.ldata = attri_tail->TextureId; - break; - - case TelDoTextureMap: - k[i]->data.ldata = attri_tail->DoTextureMap; - break; - - case TelTextStyle: - k[i]->data.ldata = attri_tail->TextStyle; - break; - - case TelTextDisplayType: - k[i]->data.ldata = attri_tail->TextDisplayType; - break; - - case TelPolylineColour: - *(tel_colour)(k[i]->data.pdata) = attri_tail->PolylineColour; - break; - - case TelPolylineWidth: - k[i]->data.fdata = attri_tail->PolylineWidth; - break; - - case TelPolylineType: - k[i]->data.ldata = attri_tail->PolylineType; - break; - - case TelEdgeType: - k[i]->data.ldata = attri_tail->EdgeType; - break; - - case TelEdgeWidth: - k[i]->data.fdata = attri_tail->EdgeWidth; - break; - - case TelEdgeColour: - *(tel_colour)(k[i]->data.pdata) = attri_tail->EdgeColour; - break; - - case TelAntiAliasing: - k[i]->data.ldata = attri_tail->AntiAliasing; - break; - - case TelInteriorColour: - *(tel_colour)(k[i]->data.pdata) = attri_tail->InteriorColour; - break; - - case TelEdgeFlag: - k[i]->data.ldata = attri_tail->EdgeFlag; - break; - - case TelInteriorStyle: - k[i]->data.ldata = attri_tail->InteriorStyle; - break; - - case TelInteriorStyleIndex: - k[i]->data.ldata = attri_tail->InteriorStyleIndex; - break; - - case TelPolymarkerColour: - *(tel_colour)(k[i]->data.pdata) = attri_tail->PolymarkerColour; - break; - - case TelPolymarkerSize: - k[i]->data.fdata = attri_tail->PolymarkerSize; - break; - - case TelLocalTran3: - matcpy( k[i]->data.pdata, attri_tail->LocalTran3 ); - break; - - case TelBackInteriorColour: - *(tel_colour)(k[i]->data.pdata) = attri_tail->BackInteriorColour; - break; - - case TelFaceDistinguishingMode: - k[i]->data.ldata = attri_tail->FaceDistinguishingMode; - break; - - case TelTextColour: - *(tel_colour)(k[i]->data.pdata) = attri_tail->TextColour; - break; - - case TelTextColourSubTitle: - *(tel_colour)(k[i]->data.pdata) = attri_tail->TextColourSubTitle; - break; - - case TelTextFont: - k[i]->data.pdata = attri_tail->TextFont; - break; - - case TelTextHeight: - k[i]->data.fdata = attri_tail->TextHeight; - break; - - case TelCharacterSpacing: - k[i]->data.fdata = attri_tail->CharacterSpacing; - break; - - case TelCharacterExpansionFactor: - k[i]->data.fdata = attri_tail->CharacterExpansionFactor; - break; - - case TelTextZoomable: - k[i]->data.ldata = attri_tail->TextZoomable; - break; - case TelTextAngle: - k[i]->data.ldata = attri_tail->TextAngle; - break; - case TelTextFontAspect: - k[i]->data.ldata = attri_tail->TextFontAspect; - break; - /*OCC7456 abd 14.12.2004 Text alingnment attributes */ - case TelTextAlign: - *(tel_align_data)(k[i]->data.pdata) = attri_tail->TextAlign; - break; - /*OCC7456 abd 14.12.2004 Text alingnment attributes */ - case TelPolymarkerType: - k[i]->data.ldata = attri_tail->PolymarkerType; - break; - - case TelInteriorReflectanceEquation: - k[i]->data.ldata = attri_tail->InteriorReflectanceEquation; - break; - - case TelBackInteriorReflectanceEquation: - k[i]->data.ldata = attri_tail->BackInteriorReflectanceEquation; - break; - - case TelSurfaceAreaProperties: - *(tel_surf_prop)(k[i]->data.pdata) = - attri_tail->SurfaceAreaProperties; - break; - - case TelBackSurfaceAreaProperties: - *(tel_surf_prop)(k[i]->data.pdata) = - attri_tail->BackSurfaceAreaProperties; - break; - - case TelFaceCullingMode: - k[i]->data.ldata = attri_tail->FaceCullingMode; - break; - - case TelDepthCueIndex: - k[i]->data.ldata = attri_tail->DepthCueIndex; - break; - - case TelInteriorShadingMethod: - k[i]->data.ldata = attri_tail->InteriorShadingMethod; - break; - - case TelViewIndex: - k[i]->data.ldata = attri_tail->ViewIndex; - break; - - case TelHighlightIndex: - k[i]->data.ldata = attri_tail->HighlightIndex; - break; - -#ifdef G003 - case TelDegenerationMode: - k[ i ] -> data.ldata = attri_tail -> DegenerationMode; - break; -#endif /* G003 */ - - /* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */ - case TelPolygonOffset: - *(tel_poffset_param)(k[i]->data.pdata) = attri_tail->PolygonOffsetParams; - break; - /* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */ - - case TelTransformPersistence: - *(tel_transform_persistence)(k[i]->data.pdata) = attri_tail->TransPers; - break; - /* ABD 29/10/04 Transform Persistence of Presentation( pan, zoom, rotate ) */ - - default: - break; - } - } - - return TSuccess; -} - -/*----------------------------------------------------------------------*/ - -void TelUpdateMaterial( Tint flag ) -{ - GLenum face=0; - tel_colour col=NULL; - tel_surf_prop prop=NULL; - Tint rm=CALL_PHIGS_REFL_NONE; - static float mAmb[4]; - static float mDiff[4]; - static float mSpec[4]; - static float mEmsv[4]; - static float mShin; - static float r, g, b; - static int physic; - CMN_KEY_DATA key; - Tfloat *rgb; - Tfloat newDiff3; - - if (attri_stk.IsEmpty()) - return; - - tsm_attri_blk attri_tail = attri_stk.ChangeTop(); - - /* Hors Hiddenline */ - if (attri_tail->InteriorStyle != TSM_HIDDENLINE) - { - if( flag == TEL_FRONT_MATERIAL ) { - col = &attri_tail->InteriorColour; - rm = attri_tail->InteriorReflectanceEquation; - prop = &attri_tail->SurfaceAreaProperties; - face = GL_FRONT_AND_BACK; - } - if( flag == TEL_BACK_MATERIAL ) { - col = &attri_tail->BackInteriorColour; - rm = attri_tail->BackInteriorReflectanceEquation; - prop = &attri_tail->BackSurfaceAreaProperties; - face = GL_BACK; - } - } - /* Cas HiddenLine */ - else - { -#ifdef TRACE_UPMATERIAL - printf("OpenGl_attri::TelUpdateMaterial HiddenLine\n"); -#endif - TsmGetWSAttri (TglActiveWs, WSBackground, &key); - rgb = (Tfloat*)key.pdata; - - attri_tail->InteriorColour.rgb[0]=rgb[0]; - attri_tail->InteriorColour.rgb[1]=rgb[1]; - attri_tail->InteriorColour.rgb[2]=rgb[2]; - attri_tail->InteriorReflectanceEquation = CALL_PHIGS_REFL_NONE; - attri_tail->BackInteriorReflectanceEquation = CALL_PHIGS_REFL_NONE; - return; - } - - /* Type material */ - physic = prop->isphysic; - -#ifdef TRACE_UPMATERIAL - if( flag == TEL_FRONT_MATERIAL ) printf("OpenGl_attri::TelUpdateMaterial TEL_FRONT_MATERIAL\n"); - else printf("OpenGl_attri::TelUpdateMaterial TEL_BACK_MATERIAL\n"); -#endif -#ifdef TRACE_MATERIAL - printf(" InteriorReflectanceEquation: %d\n", attri_tail->InteriorReflectanceEquation); - printf(" controle mode rm == CALL_PHIGS_REFL_NONE : %d\n", rm == CALL_PHIGS_REFL_NONE); -#endif - - if( rm == CALL_PHIGS_REFL_NONE ) return; - - /* - * Gestion de la transparence - */ - - if (!SecondPassDo) { - /* Passage en transparence */ - if (need_trans && prop->trans != 1.0F) { - glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable (GL_BLEND); - glDepthMask (GL_FALSE); - } - - /* Passage en opaque */ -#ifdef BUC60577 - else -#else - if (need_trans && prop->trans == 1.0F) -#endif - { - if( attri_tail->AntiAliasing == TOff ) - { - glBlendFunc (GL_ONE, GL_ZERO); - glDisable (GL_BLEND); - } - glDepthMask (GL_TRUE); - } - } - - /* - * Reset Material - */ - if( need_reset ) - { - /* Composant ambient */ - if( rm & AMBIENT_MASK ) - { - /* Type materiau */ - if( physic ) - {r=prop->ambcol.rgb[0];g=prop->ambcol.rgb[1];b=prop->ambcol.rgb[2];} - else - {r=col->rgb[0];g=col->rgb[1];b=col->rgb[2];} - - mAmb[0] = prop->amb * r; - mAmb[1] = prop->amb * g; - mAmb[2] = prop->amb * b; - mAmb[3] = 1.0F; - } - else - { - mAmb[0] = 0.0; - mAmb[1] = 0.0; - mAmb[2] = 0.0; - mAmb[3] = 1.0F; - } - - /* Composant diffus */ - if( rm & DIFFUSE_MASK ) - { - /* Type materiau */ - if( physic ) - {r=prop->difcol.rgb[0];g=prop->difcol.rgb[1];b=prop->difcol.rgb[2];} - else - {r=col->rgb[0];g=col->rgb[1];b=col->rgb[2];} - - mDiff[0] = prop->diff * r; - mDiff[1] = prop->diff * g; - mDiff[2] = prop->diff * b; - mDiff[3] = 1.0F; - } - else - { - mDiff[0] = 0.0; - mDiff[1] = 0.0; - mDiff[2] = 0.0; - mDiff[3] = 1.0F; - } - - if (SecondPassDo) - { - mDiff[3] = prop->env_reflexion; - } - else - { - if (need_trans) mDiff[3] = prop->trans; - /* si le materiau reflechi la scene environnante, - alors il faudra faire une seconde passe */ - if (prop->env_reflexion != 0.0) SecondPassNeeded = 1; - } - - /* Composant speculaire */ - if( rm & SPECULAR_MASK ) - { - if( physic ) - {r=prop->speccol.rgb[0];g=prop->speccol.rgb[1];b=prop->speccol.rgb[2];} - else - {r=1.0;g=1.0;b=1.0;} /* cas des generiques */ - - mSpec[0] = prop->spec * r; - mSpec[1] = prop->spec * g; - mSpec[2] = prop->spec * b; - mSpec[3] = 1.0F; - } - else { - mSpec[0] = 0.0F; - mSpec[1] = 0.0F; - mSpec[2] = 0.0F; - mSpec[3] = 1.0F; - } - - - /* Composant emission */ - if( rm & EMISSIVE_MASK ) - { - if( physic ) - {r=prop->emscol.rgb[0];g=prop->emscol.rgb[1];b=prop->emscol.rgb[2];} - else - {r=col->rgb[0];g=col->rgb[1];b=col->rgb[2];} - - mEmsv[0] = prop->emsv * r; - mEmsv[1] = prop->emsv * g; - mEmsv[2] = prop->emsv * b; - mEmsv[3] = 1.0F; - } - else { - mEmsv[0] = 0.0F; - mEmsv[1] = 0.0F; - mEmsv[2] = 0.0F; - mEmsv[3] = 1.0F; - } - - /* Coeficient de brillance */ - mShin = prop -> shine; - - glMaterialfv(face, GL_AMBIENT, mAmb ); - glMaterialfv(face, GL_DIFFUSE, mDiff ); - glMaterialfv(face, GL_SPECULAR, mSpec); - glMaterialfv(face, GL_EMISSION, mEmsv); - glMaterialf(face, GL_SHININESS, mShin); - -#ifdef TRACE_MATERIAL - printf(" Material Properties are need_reset:\n") ; - printf(" Ambient color is (%f, %f, %f)\n", mAmb[0], mAmb[1], mAmb[2]); - printf(" Diffuse color is (%f, %f, %f, %f)\n", mDiff[0], mDiff[1], mDiff[2], mDiff[3]); - printf(" Specular color is (%f, %f, %f)\n", mSpec[0], mSpec[1], mSpec[2]); - printf(" Emission color is (%f, %f, %f)\n", mEmsv[0], mEmsv[1], mEmsv[2]); - printf(" Shininess: %f Transparency: %f EnvReflexion: %f \n", mShin, prop->trans, prop->env_reflexion); - printf(" Prop Specular %f Prop Emissive %f \n", prop->spec, prop->emsv); - printf(" materiel de type physic : %d\n", prop->isphysic); -#endif - - need_reset = 0; - } - - /* - * Set Material Optimize - */ - - else - { - physic = prop->isphysic; - /* Composant ambient */ - if( rm & AMBIENT_MASK ) - { - /* Type materiau */ - if( physic ) - {r=prop->ambcol.rgb[0];g=prop->ambcol.rgb[1];b=prop->ambcol.rgb[2];} - else - {r=col->rgb[0];g=col->rgb[1];b=col->rgb[2];} - - if (mAmb[0] != prop->amb * r || - mAmb[1] != prop->amb * g || - mAmb[2] != prop->amb * b ) - { - mAmb[0] = prop->amb * r; - mAmb[1] = prop->amb * g; - mAmb[2] = prop->amb * b; - mAmb[3] = 1.0F; - - glMaterialfv(face, GL_AMBIENT, mAmb ); -#ifdef TRACE_MATERIAL - printf(" Ambient color is (%f, %f, %f)\n", mAmb[0], mAmb[1], mAmb[2]); -#endif - } - } - else - { - if ( mAmb[0] != 0.0 || mAmb[1] != 0.0 || mAmb[2] != 0.0 ) - { - mAmb[0] = 0.0F; - mAmb[1] = 0.0F; - mAmb[2] = 0.0F; - mAmb[3] = 1.0F; - - glMaterialfv(face, GL_AMBIENT, mAmb); -#ifdef TRACE_MATERIAL - printf(" Ambient color is (%f, %f, %f)\n", mAmb[0], mAmb[1], mAmb[2]); -#endif - } - } - - /* Composant diffus */ - if( rm & DIFFUSE_MASK ) - { - /* Type materiau */ - if( physic ) - {r=prop->difcol.rgb[0];g=prop->difcol.rgb[1];b=prop->difcol.rgb[2];} - else - {r=col->rgb[0];g=col->rgb[1];b=col->rgb[2];} - - if (mDiff[0] != prop->diff * r || - mDiff[1] != prop->diff * g || - mDiff[2] != prop->diff * b || -#ifdef BUC60577 - mDiff[3] != (SecondPassDo ? prop->env_reflexion : - (need_trans ? prop->trans : 1.0F)) ) -#else - mDiff[3] != (SecondPassDo ? prop->env_reflexion : 1.0F) ) -#endif - { - mDiff[0] = prop->diff * r; - mDiff[1] = prop->diff * g; - mDiff[2] = prop->diff * b; - mDiff[3] = 1.0F; - - if (SecondPassDo) - { - mDiff[3] = prop->env_reflexion; - } - else - { - if (need_trans) mDiff[3] = prop->trans; - /* si le materiau reflechi la scene environnante, - alors il faudra faire une seconde passe */ - if (prop->env_reflexion != 0.0) SecondPassNeeded = 1; - } - - glMaterialfv(face, GL_DIFFUSE, mDiff ); -#ifdef TRACE_MATERIAL - printf(" Diffuse color is (%f, %f, %f, %f)\n", mDiff[0], mDiff[1], mDiff[2], mDiff[3]); -#endif - } - } - else - { - newDiff3 = 1.0F; - if (SecondPassDo) - { - newDiff3 = prop->env_reflexion; - } - else - { - if (need_trans) newDiff3 = prop->trans; - /* si le materiau reflechi la scene environnante, - alors il faudra faire une seconde passe */ - if (prop->env_reflexion != 0.0) SecondPassNeeded = 1; - } - - /* OCC19915: Even if diffuse reflectance is disabled, - still trying to update the current transparency if it - differs from the previous value */ - if ( mDiff[0] != 0.0 || mDiff[1] != 0.0 || mDiff[2] != 0.0 - || fabs(mDiff[3] - newDiff3) > 0.01 ) - { - mDiff[0] = 0.0F; - mDiff[1] = 0.0F; - mDiff[2] = 0.0F; - mDiff[3] = newDiff3; - - glMaterialfv(face, GL_DIFFUSE, mDiff); -#ifdef TRACE_MATERIAL - printf(" Diffuse color is (%f, %f, %f, %f)\n", mDiff[0], mDiff[1], mDiff[2], mDiff[3]); -#endif - } - } - - /* composant speculaire */ - if( rm & SPECULAR_MASK ) - { - /* Type materiau */ - if( physic ) - {r=prop->speccol.rgb[0];g=prop->speccol.rgb[1];b=prop->speccol.rgb[2];} - else - {r=1.0;g=1.0;b=1.0;} /* cas des generiques */ - - if (mSpec[0] != prop->spec * r || - mSpec[1] != prop->spec * g || - mSpec[2] != prop->spec * b) - { - mSpec[0] = prop->spec * r; - mSpec[1] = prop->spec * g; - mSpec[2] = prop->spec * b; - mSpec[3] = 1.0F; - glMaterialfv(face, GL_SPECULAR, mSpec); - -#ifdef TRACE_MATERIAL - printf(" Specular color is (%f, %f, %f)\n", mSpec[0], mSpec[1], mSpec[2]); -#endif - } - } - else - { - if ( mSpec[0] != 0.0 || mSpec[1] != 0.0 || mSpec[2] != 0.0 ) - { - mSpec[0] = 0.0F; - mSpec[1] = 0.0F; - mSpec[2] = 0.0F; - mSpec[3] = 1.0F; - - glMaterialfv(face, GL_SPECULAR, mSpec); -#ifdef TRACE_MATERIAL - printf(" Specular color is (%f, %f, %f)\n", mSpec[0], mSpec[1], mSpec[2]); -#endif - } - } - - /* Composant emission */ - if( rm & EMISSIVE_MASK ) - { - /* type materiau */ - if( physic ) - {r=prop->emscol.rgb[0];g=prop->emscol.rgb[1];b=prop->emscol.rgb[2];} - else - {r=col->rgb[0];g=col->rgb[1];b=col->rgb[2];} - - if ( mEmsv[0] != prop->emsv * r || - mEmsv[1] != prop->emsv * g || - mEmsv[2] != prop->emsv * b ) - { - mEmsv[0] = prop->emsv * r; - mEmsv[1] = prop->emsv * g; - mEmsv[2] = prop->emsv * b; - mEmsv[3] = 1.0F; - glMaterialfv(face, GL_EMISSION, mEmsv); -#ifdef TRACE_MATERIAL - printf(" Emissive color is (%f, %f, %f)\n", mEmsv[0], mEmsv[1], mEmsv[2]); -#endif - } - } - else - { - if ( mEmsv[0] != 0.0 || mEmsv[1] != 0.0 || mEmsv[2] != 0.0 ) - { - mEmsv[0] = 0.0F; - mEmsv[1] = 0.0F; - mEmsv[2] = 0.0F; - mEmsv[3] = 1.0F; - - glMaterialfv(face, GL_EMISSION, mEmsv); -#ifdef TRACE_MATERIAL - printf(" Emissive surface is (%f, %f, %f)\n", mEmsv[0], mEmsv[1], mEmsv[2]); -#endif - } - } - - /* coef de brillance */ - if( mShin != prop->shine ) - { - mShin = prop->shine; - glMaterialf(face, GL_SHININESS, mShin); -#ifdef TRACE_MATERIAL - printf(" Shininess factor is %f\n", mShin); -#endif - } - } /* need_reset */ -} - -/*----------------------------------------------------------------------*/ -void TelResetMaterial() /* force material definition, called by TelClearViews */ -{ - need_reset = 1; -} - -/*----------------------------------------------------------------------*/ -void TelSetTransparency( Tint tag ) -/* force transparency managment, called by redraw_all_structs */ -{ - need_trans = tag; -} - -/*----------------------------------------------------------------------*/ - -static void -TelUpdateFog( Tint ws, Tint vid, Tint dcid ) -{ - TEL_GL_DEPTHCUE dcrep; - float params[5]; - - if( TelGetGLDepthCue( ws, vid, dcid, &dcrep ) == TSuccess ) - { - if( dcrep.dcrep.mode == TelDCAllowed ) - { - params[0] = dcrep.dcrep.col.rgb[0], - params[1] = dcrep.dcrep.col.rgb[1], - params[2] = dcrep.dcrep.col.rgb[2]; - params[3] = 1.0F; - glFogi(GL_FOG_MODE, GL_LINEAR); - glFogf(GL_FOG_START, dcrep.dist[0]); - glFogf(GL_FOG_END, dcrep.dist[1]); - glFogfv(GL_FOG_COLOR, params); - glEnable(GL_FOG); -#ifdef TRACE - printf(" *** TelUpdateFog START %f END %f\n",dcrep.dist[0],dcrep.dist[1]); -#endif - return; - } - } - glDisable(GL_FOG); - return; -} - -/*----------------------------------------------------------------------*/ - -static void TelSetViewMatrix( Tmatrix3 mat, Tint vid ) -{ - TEL_VIEW_REP vrep; - Tmatrix3 rmat; - float mat16[16]; -#ifdef TRACE_MATRIX - int i, j; - GLfloat pmat[4][4]; -#endif - - if( TelGetViewRepresentation( TglActiveWs, vid, &vrep ) == TSuccess ) - { -#ifdef TRACE_MATRIX - printf ("LocalTran3 :\n"); - for (i = 0; i < 4; i++) { - printf ("\t"); - for (j = 0; j < 4; j++) - printf ("%f ", mat[i][j]); - printf ("\n"); - } -#endif - if ((!animationUseFlag) || (animationUseFlag && !animationFlag)) - { -#ifdef TRACE_MATRIX - printf ("vrep.orientation_matrix :\n"); - for (i = 0; i < 4; i++) { - printf ("\t"); - for (j = 0; j < 4; j++) - printf ("%f ", vrep.orientation_matrix[i][j]); - printf ("\n"); - } -#endif - TelMultiplymat3( rmat, mat, vrep.orientation_matrix ); -#ifdef TRACE_MATRIX - printf("OpenGl_attri.c::TelSetViewMatrix::glLoadMatrixf \n"); -#endif - glMatrixMode(GL_MODELVIEW); - glLoadMatrixf((GLfloat *) rmat); -#ifdef TRACE_MATRIX - printf ("GL_MODELVIEW_MATRIX set :\n"); - for (i = 0; i < 4; i++) { - printf ("\t"); - for (j = 0; j < 4; j++) - printf ("%f ", rmat[i][j]); - printf ("\n"); - } -#endif - } - else /* animationUseFlag */ - { - call_util_transpose_mat (mat16, mat); - glMatrixMode (GL_MODELVIEW); -#ifdef TRACE_MATRIX - glGetFloatv( GL_MODELVIEW_MATRIX,(GLfloat *) pmat ); - printf ("GL_MODELVIEW_MATRIX :\n"); - for (i = 0; i < 4; i++) { - printf ("\t"); - for (j = 0; j < 4; j++) - printf ("%f ", pmat[i][j]); - printf ("\n"); - } -#endif -#ifdef TRACE_MATRIX - printf("OpenGl_attri.c::TelSetViewMatrix::glMultMatrixf \n"); -#endif - glMultMatrixf ((GLfloat *)mat); -#ifdef TRACE_MATRIX - glGetFloatv( GL_MODELVIEW_MATRIX,(GLfloat *) pmat ); - printf ("GL_MODELVIEW_MATRIX set :\n"); - for (i = 0; i < 4; i++) { - printf ("\t"); - for (j = 0; j < 4; j++) - printf ("%f ", pmat[i][j]); - printf ("\n"); - } -#endif - } - } - return; -} - -/*----------------------------------------------------------------------*/ - -TStatus -TsmPushAttriLight( void ) -{ - tsm_attri_blk node; - - node = new TSM_ATTRI_BLK(); - - if( !attri_stk.IsEmpty() ) - *node = *attri_stk.Top(); - else - *node = attri_default; - - attri_stk.Push( node ); - return TSuccess; -} - -/*----------------------------------------------------------------------*/ - -TStatus -TsmPopAttriLight( void ) -{ - tsm_attri_blk node; - - if ( attri_stk.IsEmpty() ) - return TFailure; /* Underflow */ - - node = attri_stk.ChangeTop(); - attri_stk.Pop(); - delete node; - - return TSuccess; -} - -/*----------------------------------------------------------------------*/ - -static void call_util_transpose_mat (float tmat[16], float mat[4][4]) { - int i, j; - - for (i=0; i<4; i++) - for (j=0; j<4; j++) - tmat[j*4+i] = mat[i][j]; - -#ifdef TRACE - printf ("Transposee :\n"); - for (i = 0; i < 4; i++) { - printf ("\t"); - for (j = 0; j < 4; j++) - printf ("%f ", tmat[i*4+j]); - printf ("\n"); - } -#endif -} -/*----------------------------------------------------------------------*/ - -/* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */ -static void TelUpdatePolygonOffsets( tel_poffset_param pdata ) -{ -#ifdef TRACE - printf(" *** TelUpdatePolygonOffsets: mode = %x, factor = %f, units = %f", - pdata->mode, pdata->factor, pdata->units ); -#endif - if ( ( pdata->mode & Aspect_POM_Fill ) == Aspect_POM_Fill ) - glEnable ( GL_POLYGON_OFFSET_FILL ); - else - glDisable ( GL_POLYGON_OFFSET_FILL ); - - if ( ( pdata->mode & Aspect_POM_Line ) == Aspect_POM_Line ) - glEnable ( GL_POLYGON_OFFSET_LINE ); - else - glDisable( GL_POLYGON_OFFSET_LINE ); - - if ( ( pdata->mode & Aspect_POM_Point ) == Aspect_POM_Point ) - glEnable ( GL_POLYGON_OFFSET_POINT ); - else - glDisable( GL_POLYGON_OFFSET_POINT ); - - glPolygonOffset( pdata->factor, pdata->units ); -} -/* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */ diff --git a/src/OpenGl/OpenGl_bintcol.cxx b/src/OpenGl/OpenGl_bintcol.cxx deleted file mode 100755 index 272a284c7a..0000000000 --- a/src/OpenGl/OpenGl_bintcol.cxx +++ /dev/null @@ -1,128 +0,0 @@ - -#include - -#include -#include - -#include -#include -#include -#include -#include - -static TStatus BackInteriorColourDisplay( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus BackInteriorColourAdd( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus BackInteriorColourDelete( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus BackInteriorColourPrint( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus BackInteriorColourInquire( TSM_ELEM_DATA, Tint, cmn_key* ); - -static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) = -{ - 0, /* PickTraverse */ - BackInteriorColourDisplay, - BackInteriorColourAdd, - BackInteriorColourDelete, - BackInteriorColourPrint, - BackInteriorColourInquire -}; - - -MtblPtr -TelBackInteriorColourInitClass( TelType *el ) -{ - *el = TelBackInteriorColour; - return MtdTbl; -} - -static TStatus -BackInteriorColourAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k ) -{ - tel_colour data = new TEL_COLOUR(); - - if( !data ) - return TFailure; - - *data = *(tel_colour)(k[0]->data.pdata); - - ((tsm_elem_data)(d.pdata))->pdata = data; - - return TSuccess; -} - - -static TStatus -BackInteriorColourDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - tel_colour d; - CMN_KEY key; - - d = (tel_colour)data.pdata; - - key.id = TelBackInteriorColour; - key.data.pdata = d; - TsmSetAttri( 1, &key ); - - return TSuccess; -} - - -static TStatus -BackInteriorColourDelete( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - if (data.pdata) - delete data.pdata; - return TSuccess; -} - - - - -static TStatus -BackInteriorColourPrint( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - tel_colour p; - - p = (tel_colour)data.pdata; - - fprintf( stdout, "TelBackInteriorColour. R = %g, G = %g, B = %g\n", - p->rgb[0], p->rgb[1], p->rgb[2] ); - fprintf( stdout, "\n" ); - - return TSuccess; -} - - -static TStatus -BackInteriorColourInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - Tint i; - tel_colour col = (tel_colour)data.pdata; - - for( i = 0; i < n; i++ ) - { - switch( k[i]->id ) - { - case INQ_GET_SIZE_ID: - { - k[i]->data.ldata = sizeof( Tint ); - break; - } - case INQ_GET_CONTENT_ID: - { - TEL_INQ_CONTENT *c; - Teldata *w; - - c = (tel_inq_content)k[i]->data.pdata; - w = c->data; - c->act_size = 0; - - w->gnl_colour.rgb[0] = col->rgb[0]; - w->gnl_colour.rgb[1] = col->rgb[1]; - w->gnl_colour.rgb[2] = col->rgb[2]; - break; - } - } - } - - return TSuccess; -} diff --git a/src/OpenGl/OpenGl_bintrefl.cxx b/src/OpenGl/OpenGl_bintrefl.cxx deleted file mode 100755 index 6e5af2be0a..0000000000 --- a/src/OpenGl/OpenGl_bintrefl.cxx +++ /dev/null @@ -1,126 +0,0 @@ -/* 08-04-98 : FGU ; Ajout emission */ -/* 05-01-99 : CAL ; Warning WNT */ - -#include - -#include -#include - -#include -#include -#include -#include -#include -#include - -static TStatus BackInteriorReflectanceEquationAdd( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus BackInteriorReflectanceEquationDisplay( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus BackInteriorReflectanceEquationPrint( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus BackInteriorReflectanceEquationInquire( TSM_ELEM_DATA, Tint, cmn_key* ); - -static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) = -{ - 0, /* PickTraverse */ - BackInteriorReflectanceEquationDisplay, - BackInteriorReflectanceEquationAdd, - 0, /* Delete */ - BackInteriorReflectanceEquationPrint, - BackInteriorReflectanceEquationInquire -}; - - -MtblPtr -TelBackInteriorReflectanceEquationInitClass( TelType *el ) -{ - *el = TelBackInteriorReflectanceEquation; - return MtdTbl; -} - -static TStatus -BackInteriorReflectanceEquationAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k ) -{ - ((tsm_elem_data)(d.pdata))->ldata = k[0]->data.ldata; - - return TSuccess; -} - - -static TStatus -BackInteriorReflectanceEquationDisplay( TSM_ELEM_DATA d, Tint n, cmn_key *k ) -{ - CMN_KEY key; - - key.id = TelBackInteriorReflectanceEquation; - key.data.ldata = d.ldata; - TsmSetAttri( 1, &key ); - return TSuccess; -} - - -static TStatus -BackInteriorReflectanceEquationPrint( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - switch( data.ldata ) - { - case CALL_PHIGS_REFL_NONE: - fprintf( stdout, "TelBackInteriorReflectanceEquation. Value = \ - NONE\n" ); - break; - - default : - /* affichage du flag d etat des composants lumineux du materiel */ - fprintf( stdout, "TelBackInteriorReflectanceEquation. Value = %d\n", data.ldata ); - break; - - /*case TelLModelAmbient: - fprintf( stdout, "TelBackInteriorReflectanceEquation. Value = \ - GL_AMBIENT\n" ); - break; - - case TelLModelDiffuse: - fprintf( stdout, "TelBackInteriorReflectanceEquation. Value = \ - GL_AMBIENT_AND_DIFFUSE\n" ); - break;*/ - - /* FSXXX */ - /*case TelLModelSpecular: - fprintf( stdout, "TelBackInteriorReflectanceEquation. Value = \ - GL_SPECULAR\n" ); - break;*/ - } - fprintf( stdout, "\n" ); - - return TSuccess; -} - - -static TStatus -BackInteriorReflectanceEquationInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - Tint i; - - for( i = 0; i < n; i++ ) - { - switch( k[i]->id ) - { - case INQ_GET_SIZE_ID: - { - k[i]->data.ldata = sizeof( Tint ); - break; - } - case INQ_GET_CONTENT_ID: - { - TEL_INQ_CONTENT *c; - Teldata *w; - - c = (tel_inq_content)k[i]->data.pdata; - w = c->data; - c->act_size = 0; - w->idata = data.ldata; - break; - } - } - } - - return TSuccess; -} diff --git a/src/OpenGl/OpenGl_bsurfprop.cxx b/src/OpenGl/OpenGl_bsurfprop.cxx deleted file mode 100755 index 88a4b99557..0000000000 --- a/src/OpenGl/OpenGl_bsurfprop.cxx +++ /dev/null @@ -1,125 +0,0 @@ - -#include - -#include -#include - -#include -#include -#include -#include -#include - -static TStatus BackSurfaceAreaPropertiesDisplay( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus BackSurfaceAreaPropertiesAdd( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus BackSurfaceAreaPropertiesDelete( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus BackSurfaceAreaPropertiesPrint( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus BackSurfaceAreaPropertiesInquire( TSM_ELEM_DATA, Tint, cmn_key* ); - -static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) = -{ - 0, /* PickTraverse */ - BackSurfaceAreaPropertiesDisplay, - BackSurfaceAreaPropertiesAdd, - BackSurfaceAreaPropertiesDelete, - BackSurfaceAreaPropertiesPrint, - BackSurfaceAreaPropertiesInquire -}; - - -MtblPtr -TelBackSurfaceAreaPropertiesInitClass( TelType *el ) -{ - *el = TelBackSurfaceAreaProperties; - return MtdTbl; -} - -static TStatus -BackSurfaceAreaPropertiesAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k ) -{ - tel_surf_prop data = new TEL_SURF_PROP(); - if( !data ) - return TFailure; - - *data = *(tel_surf_prop)(k[0]->data.pdata); - - ((tsm_elem_data)(d.pdata))->pdata = data; - - return TSuccess; -} - - -static TStatus -BackSurfaceAreaPropertiesDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - CMN_KEY key; - - key.id = TelBackSurfaceAreaProperties; - key.data.pdata = data.pdata; - TsmSetAttri( 1, &key ); - - return TSuccess; -} - - -static TStatus -BackSurfaceAreaPropertiesDelete( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - if (data.pdata) - delete data.pdata; - return TSuccess; -} - - - - -static TStatus -BackSurfaceAreaPropertiesPrint( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - tel_surf_prop p = (tel_surf_prop)data.pdata; - - fprintf( stdout, "TelBackSurfaceAreaProperties\n" ); - fprintf( stdout, "\tAmbient Coeff: %f\n", p->amb ); - fprintf( stdout, "\tDiffuse Coeff: %f\n", p->diff ); - fprintf( stdout, "\tSpecular Coeff: %f\n", p->spec ); - fprintf( stdout, "\tTransparency Coeff: %f\n", p->trans ); - fprintf( stdout, "\tShininess: %f\n", p->shine ); - fprintf( stdout, "\tSpecular colour: R = %f, G = %f, B = %f\n", - p->speccol.rgb[0], p->speccol.rgb[1], p->speccol.rgb[2] ); - fprintf( stdout, "\n" ); - - return TSuccess; -} - - -static TStatus -BackSurfaceAreaPropertiesInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - Tint i; - tel_surf_prop p = (tel_surf_prop)data.pdata; - - for( i = 0; i < n; i++ ) - { - switch( k[i]->id ) - { - case INQ_GET_SIZE_ID: - { - k[i]->data.ldata = sizeof( Tint ); - break; - } - case INQ_GET_CONTENT_ID: - { - TEL_INQ_CONTENT *c; - Teldata *w; - - c = (tel_inq_content)k[i]->data.pdata; - w = c->data; - c->act_size = 0; - w->surf_prop = *p; - break; - } - } - } - - return TSuccess; -} diff --git a/src/OpenGl/OpenGl_callback.hxx b/src/OpenGl/OpenGl_callback.hxx deleted file mode 100755 index cd0ee7f3be..0000000000 --- a/src/OpenGl/OpenGl_callback.hxx +++ /dev/null @@ -1,16 +0,0 @@ -/* -// File: OpenGl_callback.h -// Created: Thu Mar 3 12:34:02 2005 -// Author: Sergey ZERTCHANINOV -// -// Copyright: Open CASCADE 2005 -*/ - -#ifndef _OpenGl_callback_HeaderFile -#define _OpenGl_callback_HeaderFile - -#include - -MtblPtr EXPORT GetCallbackTable (); - -#endif /*_OpenGl_callback_HeaderFile*/ diff --git a/src/OpenGl/OpenGl_charexpan.cxx b/src/OpenGl/OpenGl_charexpan.cxx deleted file mode 100755 index 51c2242c5d..0000000000 --- a/src/OpenGl/OpenGl_charexpan.cxx +++ /dev/null @@ -1,114 +0,0 @@ - -#include - -#include -#include - -#include -#include -#include -#include -#include - -static TStatus CharacterExpansionFactorDisplay( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus CharacterExpansionFactorAdd( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus CharacterExpansionFactorDelete( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus CharacterExpansionFactorPrint( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus CharacterExpansionFactorInquire( TSM_ELEM_DATA, Tint, cmn_key* ); - -static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) = -{ - CharacterExpansionFactorDisplay, /* PickTraverse */ - CharacterExpansionFactorDisplay, - CharacterExpansionFactorAdd, - CharacterExpansionFactorDelete, - CharacterExpansionFactorPrint, - CharacterExpansionFactorInquire -}; - - -MtblPtr -TelCharacterExpansionFactorInitClass( TelType *el ) -{ - *el = TelCharacterExpansionFactor; - return MtdTbl; -} - -static TStatus -CharacterExpansionFactorAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k ) -{ - Tfloat *data = new Tfloat(); - if( !data ) - return TFailure; - - *data = k[0]->data.fdata; - - ((tsm_elem_data)(d.pdata))->pdata = data; - - return TSuccess; -} - - -static TStatus -CharacterExpansionFactorDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - CMN_KEY key; - - key.id = TelCharacterExpansionFactor; - key.data.fdata = *(Tfloat*)(data.pdata); - TsmSetAttri( 1, &key ); - - return TSuccess; -} - - -static TStatus -CharacterExpansionFactorDelete( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - if (data.pdata) - delete data.pdata; - return TSuccess; -} - - -static TStatus -CharacterExpansionFactorPrint( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - fprintf( stdout, "TelCharacterExpansionFactor. Value = %g\n", *(Tfloat *)(data.pdata)); - fprintf( stdout, "\n" ); - - return TSuccess; -} - - -static TStatus -CharacterExpansionFactorInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - Tint i; - Tfloat *f = (Tfloat*)data.pdata; - - for( i = 0; i < n; i++ ) - { - switch( k[i]->id ) - { - case INQ_GET_SIZE_ID: - { - k[i]->data.ldata = sizeof( Tint ); - break; - } - case INQ_GET_CONTENT_ID: - { - TEL_INQ_CONTENT *c; - Teldata *w; - - c = (tel_inq_content)k[i]->data.pdata; - w = c->data; - c->act_size = 0; - w->fdata = *f; - break; - } - } - } - - return TSuccess; -} diff --git a/src/OpenGl/OpenGl_charspace.cxx b/src/OpenGl/OpenGl_charspace.cxx deleted file mode 100755 index 2b20eb08c0..0000000000 --- a/src/OpenGl/OpenGl_charspace.cxx +++ /dev/null @@ -1,113 +0,0 @@ - -#include - -#include -#include - -#include -#include -#include -#include -#include - -static TStatus CharacterSpacingDisplay( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus CharacterSpacingAdd( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus CharacterSpacingDelete( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus CharacterSpacingPrint( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus CharacterSpacingInquire( TSM_ELEM_DATA, Tint, cmn_key* ); - -static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) = -{ - CharacterSpacingDisplay, /* PickTraverse */ - CharacterSpacingDisplay, - CharacterSpacingAdd, - CharacterSpacingDelete, - CharacterSpacingPrint, - CharacterSpacingInquire -}; - - -MtblPtr -TelCharacterSpacingInitClass( TelType *el ) -{ - *el = TelCharacterSpacing; - return MtdTbl; -} - -static TStatus -CharacterSpacingAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k ) -{ - Tfloat *data = new Tfloat(); - if( !data ) - return TFailure; - - *data = k[0]->data.fdata; - - ((tsm_elem_data)(d.pdata))->pdata = data; - - return TSuccess; -} - - -static TStatus -CharacterSpacingDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - CMN_KEY key; - - key.id = TelCharacterSpacing; - key.data.fdata = *(Tfloat*)(data.pdata); - TsmSetAttri( 1, &key ); - - return TSuccess; -} - - -static TStatus -CharacterSpacingDelete( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - if (data.pdata) - delete data.pdata; - return TSuccess; -} - - -static TStatus -CharacterSpacingPrint( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - fprintf( stdout, "TelCharacterSpacing. Value = %g\n", *(Tfloat *)(data.pdata)); - fprintf( stdout, "\n" ); - return TSuccess; -} - - -static TStatus -CharacterSpacingInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - Tint i; - Tfloat *f = (Tfloat*)data.pdata; - - for( i = 0; i < n; i++ ) - { - switch( k[i]->id ) - { - case INQ_GET_SIZE_ID: - { - k[i]->data.ldata = sizeof( Tint ); - break; - } - case INQ_GET_CONTENT_ID: - { - TEL_INQ_CONTENT *c; - Teldata *w; - - c = (tel_inq_content)k[i]->data.pdata; - w = c->data; - c->act_size = 0; - w->fdata = *f; - break; - } - } - } - - return TSuccess; -} diff --git a/src/OpenGl/OpenGl_cmn_varargs.hxx b/src/OpenGl/OpenGl_cmn_varargs.hxx deleted file mode 100755 index cbaa92715c..0000000000 --- a/src/OpenGl/OpenGl_cmn_varargs.hxx +++ /dev/null @@ -1,70 +0,0 @@ -#ifndef OPENGL_CMN_VARARGS_H -#define OPENGL_CMN_VARARGS_H - -#if !defined(__STDC__) -# define __STDC__ 1 -#endif - -#include - -#if !defined(WNT) -# include -# include -#endif - -typedef union CMN_KEY_DATA_UNION -{ - Tint ldata; -#if !defined(WNT) - Pixmap pixmap; - GLXPixmap - glxpixmap; -#endif - Tfloat fdata; - void *pdata; -} CMN_KEY_DATA, *cmn_key_data; - -typedef struct -{ - int id; - CMN_KEY_DATA data; -} CMN_KEY, *cmn_key; - -#if defined (SOLARIS) || defined (IRIXO32) - -#define CMN_GET_STACK(n,k) { \ - va_list p; \ - va_start (p, n); \ - if (n>=0) { \ - k = (cmn_key *)p; \ - } \ - else { \ - n = -n; \ - k = *(cmn_key **)p; \ - } \ -} - -#else /* DECOSF1 || HPUX || IRIX avec n32 */ - -#define TMaxArgs 128 - -#define CMN_GET_STACK(n,k) { \ - int i; \ - va_list ap; \ - cmn_key * args; \ - va_start (ap,n); \ - if (n>=0) { \ - for (i=0; i - -#include -#include - -#include -#include -#include -#include -#include -#include - -static TStatus CurveDisplay( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus CurveAdd( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus CurveDelete( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus CurvePrint( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus CurveInquire( TSM_ELEM_DATA, Tint, cmn_key* ); - -static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) = -{ - CurveDisplay, - CurveDisplay, - CurveAdd, - CurveDelete, - CurvePrint, - CurveInquire -}; - -struct TEL_CURVE_DATA -{ - TelCurveType type; /* curve type : Bezier, Cardinal, BSpline */ - Tint num_points; - TEL_POINT vertices[4]; /* vertices array */ - IMPLEMENT_MEMORY_OPERATORS -}; - -typedef TEL_CURVE_DATA* tel_curve_data; - -MtblPtr -TelCurveInitClass( TelType* el ) -{ - *el = TelCurve; - return MtdTbl; -} - -static TStatus -CurveAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k ) -/* accepts the keys CURVE_TYPE_ID, -CURVE_VERTICES_ID */ -{ - Tint i, j; - tel_curve_data p; - - /* Recherche du type de la courbe. Presence obligatoire. */ - for( i = 0; i < n; i++ ) - { - if( k[i]->id == CURVE_TYPE_ID ) - break; - } - - /* Type de la courbe non fourni. */ - if( i == n ) - return TFailure; - - /* Recherche du nombre de points par courbe. Presence obligatoire. */ - for( j = 0; j < n; j++ ) - { - if( k[j]->id == CURVE_NUM_POINTS_ID ) - break; - } - - /* Nombre de points par courbe non fourni. */ - if( j == n ) - return TFailure; - - /* Nombre de points par courbe ridicule */ - if( k[j]->data.ldata < 2 ) - return TFailure; - - //cmn_memreserve( p, 1, 1 ); - p = new TEL_CURVE_DATA(); - p->type = (TelCurveType)k[i]->data.ldata; - p->num_points = (TelCurveType)k[j]->data.ldata; - - for( i = 0; i < n; i++ ) - { - switch( k[i]->id ) - { - case CURVE_VERTICES_ID: - //cmn_memcpy(p->vertices, k[i]->data.pdata, 4); - memcpy(p->vertices, k[i]->data.pdata, 4*sizeof(TEL_POINT)); - break; - } - } - - ((tsm_elem_data)(d.pdata))->pdata = p; - - return TSuccess; -} - - -static TStatus -CurveDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - tel_curve_data d; - CMN_KEY key; - TEL_COLOUR colour; - int i, j; - GLfloat reseau[4][3]; - - d = (tel_curve_data)data.pdata; - - /* Mode highlight en cours */ - if( k[0]->id == TOn ) - { /* Use highlight colours */ - TEL_HIGHLIGHT hrep; - - key.id = TelHighlightIndex; - TsmGetAttri( 1, &key ); - if( TelGetHighlightRep( TglActiveWs, key.data.ldata, &hrep ) - == TSuccess ) - colour = hrep.col; - else - { - TelGetHighlightRep( TglActiveWs, 0, &hrep ); - colour = hrep.col; - } - } - else - { - key.id = TelPolylineColour; - key.data.pdata = &colour; - TsmGetAttri( 1, &key ); - } - - /* Recopie des points du reseau : Pb prototypage en c ansi */ - for( i = 0; i < 4; i++ ) - for( j = 0; i < 3; i++ ) - reseau[i][j] = d->vertices[i].xyz[j]; - - /* Determination du type de courbe */ - switch( d->type ) - { - case TelBezierCurve: - /* OGLXXX curvebasis: see man pages - glMap1();glMap2();glMapGrid(); - */ - break; - case TelCardinalCurve: - /* OGLXXX curvebasis: see man pages - glMap1();glMap2();glMapGrid(); - */ - break; - case TelBSplineCurve: - /* OGLXXX curvebasis: see man pages - glMap1();glMap2();glMapGrid(); - */ - break; - default: - printf( "\n\tCurveDisplay : INVALID KEY" ); - break; - } - - /* Determination du type de courbe */ - /* OGLXXX curveprecision:see man pages - glMap1();glMap2();glMapGrid(); - */ - - /* Couleur */ - glColor3fv( colour.rgb ); - /* OGLXXX replace u with domain coordinate - glEvalCoord1f( u ); - */ - - return TSuccess; -} - - -static TStatus -CurveDelete( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - tel_curve_data p = (tel_curve_data)data.pdata; - //cmn_freemem( p ); - delete p; - - return TSuccess; -} - - - - -static TStatus -CurvePrint( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - Tint i; - tel_curve_data p = (tel_curve_data)data.pdata; - - fprintf( stdout, "TelCurve. \n" ); - - fprintf( stdout, "\n\t\tVertices : " ); - for( i = 0; i < 4; i++ ) - fprintf( stdout, "\n\t\t v[%d] = %g %g %g", i, p->vertices[i].xyz[0], - p->vertices[i].xyz[1], - p->vertices[i].xyz[2] ); - - fprintf( stdout, "\n" ); - - return TSuccess; -} - -static TStatus -CurveInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - Tint i; - tel_curve_data d; - Tint size_reqd=0; - TStatus status = TSuccess; - - d = (tel_curve_data)data.pdata; - - size_reqd = sizeof( TEL_CURVE_DATA ); - - for( i = 0; i < n; i++ ) - { - switch( k[i]->id ) - { - case INQ_GET_SIZE_ID: - { - k[i]->data.ldata = size_reqd; - break; - } - - case INQ_GET_CONTENT_ID: - { - TEL_INQ_CONTENT *c; - Teldata *w; - - c = (tel_inq_content)k[i]->data.pdata; - c->act_size = size_reqd; - w = c->data; - - if( c->size >= size_reqd ) - { - w->pts3 = (tel_point) c->buf; - //cmn_memcpy( w->pts3, d->vertices, 4 ); - memcpy( w->pts3, d->vertices, 4*sizeof(TEL_POINT) ); - status = TSuccess; - } - else - status = TFailure; - break; - } - } - } - return status; -} diff --git a/src/OpenGl/OpenGl_degeneration.hxx b/src/OpenGl/OpenGl_degeneration.hxx deleted file mode 100755 index 59857dbb9c..0000000000 --- a/src/OpenGl/OpenGl_degeneration.hxx +++ /dev/null @@ -1,13 +0,0 @@ -/* -File OpenGl_degeneration.c - -Created by EUG -Modified 16/06/2000 : ATS : G005 : Move declarations to InterfaceGraphic_degeneration.h -*/ - -#ifndef __OPENGL_DEGENERATION_H -# define __OPENGL_DEGENERATION_H - -#include - -#endif /* __OPENGL_DEGENERATION_H */ diff --git a/src/OpenGl/OpenGl_degmodel.cxx b/src/OpenGl/OpenGl_degmodel.cxx deleted file mode 100755 index 9d0da57150..0000000000 --- a/src/OpenGl/OpenGl_degmodel.cxx +++ /dev/null @@ -1,141 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include - -#include - -static TStatus DegenerateModelAdd ( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus DegenerateModelDelete ( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus DegenerateModelPrint ( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus DegenerateModelInquire ( TSM_ELEM_DATA, Tint, cmn_key* ); - -static TStatus ( *MtdTbl[] ) ( TSM_ELEM_DATA, Tint, cmn_key* ) = { - - NULL, /* PickTraverse */ - NULL, /* DisplayTraverse */ - DegenerateModelAdd, /* Add */ - DegenerateModelDelete, /* Delete */ - DegenerateModelPrint, /* Print */ - DegenerateModelInquire /* Inquire */ - -}; - - -MtblPtr TelDegenerateModelInitClass ( TelType* el ) { - - *el = TelDegenerationMode; - - return MtdTbl; - -} /* end TelDegenerateModelInitClass */ - -static TStatus DegenerateModelAdd ( TSM_ELEM_DATA d, Tint n, cmn_key* k ) { - - PDEGENERATION p = new DEGENERATION(); - //( PDEGENERATION )cmn_getmem ( 1, sizeof( DEGENERATION ), 1 ); - //cmn_memcpy ( p, k[ 0 ] -> data.pdata, 1 ); - memcpy( p, k[ 0 ] -> data.pdata, sizeof(DEGENERATION) ); - - ( ( tsm_elem_data )( d.pdata ) ) -> pdata = p; - - return TSuccess; - -} /* end DegenerateModelAdd */ - -static TStatus DegenerateModelDelete ( TSM_ELEM_DATA d, Tint n, cmn_key* k ) { - - //cmn_freemem ( d.pdata ); - delete d.pdata; - - return TSuccess; - -} /* end DegenerateModelDelete */ - -static TStatus DegenerateModelPrint ( TSM_ELEM_DATA data, Tint n, cmn_key* k ) { - - char* ptr; - - switch ( data.ldata ) { - - case 0: - - ptr = "TelDegenerateModel. Value = NONE\n"; - - break; - - case 1: - - ptr = "TelDegenerateModel. Value = TINY\n"; - - break; - - case 2: - - ptr = "TelDegenerateModel. Value = WIREFRAME\n"; - - break; - - case 3: - - ptr = "TelDegenerateModel. Value = MARKER\n"; - - break; - - case 4: - - ptr = "TelDegenerateModel. Value = BBOX\n"; - - break; - - case 5: - - ptr = "TelDegenerateModel. Value = AUTO\n"; - - default: - - ptr = "TelDegenerateModel. Value = \n"; - - } /* end switch */ - - fprintf ( stdout, ptr ); - - return TSuccess; - -} /* end DegenerateModelPrint */ - - -static TStatus DegenerateModelInquire ( TSM_ELEM_DATA data, Tint n, cmn_key* k ) { - - Tint i; - - for ( i = 0; i < n; ++i ) - - switch ( k[ i ] -> id ) { - - case INQ_GET_SIZE_ID: - - k[ i ] -> data.ldata = sizeof( Tint ); - - break; - - case INQ_GET_CONTENT_ID: { - - TEL_INQ_CONTENT* c; - Teldata* w; - - c = (tel_inq_content)k[i]->data.pdata; - w = c -> data; - c -> act_size = 0; - w -> idata = data.ldata; - - } break; - - } /* end switch */ - - return TSuccess; - -} /* end DegenerateModelInquire */ diff --git a/src/OpenGl/OpenGl_depthcue.cxx b/src/OpenGl/OpenGl_depthcue.cxx deleted file mode 100755 index df4e458dd2..0000000000 --- a/src/OpenGl/OpenGl_depthcue.cxx +++ /dev/null @@ -1,262 +0,0 @@ -/*********************************************************************** - -FONCTION : ----------- -File OpenGl_depthcue : - - -REMARQUES: ----------- - - -HISTORIQUE DES MODIFICATIONS : --------------------------------- -xx-xx-xx : xxx ; Creation. -11-03-96 : FMN ; Correction warning compilation -01-04-96 : CAL ; Integration MINSK portage WNT -12-02-97 : FMN ; Suppression de TelGetDepthCueRep - -************************************************************************/ - -/*----------------------------------------------------------------------*/ -/* -* Includes -*/ - - -#include - -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -/*----------------------------------------------------------------------*/ -/* -* Definition des types -*/ - -struct TEL_DEPTHCUE_DATA -{ - Tint dcid; - TEL_DEPTHCUE dc; - IMPLEMENT_MEMORY_OPERATORS -}; -typedef TEL_DEPTHCUE_DATA* tel_depthcue_data; - -struct TEL_WS_DEPTHCUES -{ - Tint num; /* number of depthcues for a workstation */ - Tint siz; /* size allocated */ - tel_depthcue_data data; /* depthcue definitions for the workstation */ -}; -typedef TEL_WS_DEPTHCUES* tel_ws_depthcues; - -#define GROW_SIZE 25 - -/*----------------------------------------------------------------------*/ - -static Tint -b_s( Tint id, tel_depthcue_data tbl, Tint low, Tint high ) -{ - register Tint mid, i; - - if( low > high ) - return -1; - - mid = low+high, mid /= 2; - i = id - tbl[mid].dcid; - - return i == 0 ? mid : i < 0 ? b_s( id, tbl, low, mid-1 ) : - b_s( id, tbl, mid+1, high ); -} - -/*----------------------------------------------------------------------*/ - -static int -lnumcomp( const void *a, const void *b ) -{ - return *( ( int* )a )- *( ( int* )b ); -} - -/*----------------------------------------------------------------------*/ - -TStatus -TelSetDepthCueRep( Tint Wsid, Tint dcid, tel_depthcue dc ) -{ - CMN_KEY_DATA key; - tel_depthcue_data dcptr; - tel_ws_depthcues ws_dcues; - register Tint i; - - TsmGetWSAttri( Wsid, WSDepthCues, &key ); - ws_dcues = (tel_ws_depthcues)key.pdata ; /* Obtain list of defined depthcues*/ - - if( !ws_dcues ) /* no depthcues defined yet */ - { /* allocate */ - //cmn_memreserve( ws_dcues, 1, 0 ); - ws_dcues = new TEL_WS_DEPTHCUES(); - if( !ws_dcues ) - return TFailure; - - ws_dcues->data = new TEL_DEPTHCUE_DATA[GROW_SIZE]; - if( !ws_dcues->data ) - return TFailure; - - ws_dcues->siz = GROW_SIZE; - ws_dcues->num = 0; - - key.pdata = ws_dcues;/* Set list for the workstation */ - TsmSetWSAttri( Wsid, WSDepthCues, &key ); - } - else if( ws_dcues->num == ws_dcues->siz ) /* insufficient memory */ - { /* realloc */ -#if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x530) - ws_dcues->data = (TEL_DEPTHCUE_DATA*)realloc( ws_dcues->data, (ws_dcues->siz - + GROW_SIZE)*sizeof(TEL_DEPTHCUE_DATA) ); -#else - ws_dcues->data = cmn_resizemem( ws_dcues->data, ws_dcues->siz - + GROW_SIZE ); -#endif - if( !ws_dcues ) - return TFailure; - - ws_dcues->siz += GROW_SIZE; - - key.pdata = ws_dcues; /* Reset list for the workstation */ - TsmSetWSAttri( Wsid, WSDepthCues, &key ); - } - dcptr = 0; /* Locate depthcue if already defined */ - i = b_s( dcid, ws_dcues->data, 0, ws_dcues->num-1 ); - if( i != -1 ) - dcptr = &ws_dcues->data[i]; /* depthcue already defined */ - - if( !dcptr ) /* new depthcue */ - { - dcptr = &ws_dcues->data[ws_dcues->num]; - dcptr->dcid = dcid; /* depthcues for the workstation */ - ws_dcues->num++; /* and sort the entries */ - qsort( ws_dcues->data, ws_dcues->num, - sizeof(TEL_DEPTHCUE_DATA), lnumcomp ); - } - - dcptr->dc = *dc; /* copy depthcue definition */ - - return TSuccess; -} - -/*----------------------------------------------------------------------*/ - -TStatus -TelGetGLDepthCue( Tint Wsid, Tint Vid, Tint dcid, tel_gl_depthcue gldc ) -{ - CMN_KEY_DATA key; - tel_depthcue_data dcptr; - tel_ws_depthcues ws_dcues; - TEL_VIEW_REP vrep; - register Tint i; - Tfloat ramp; - - TsmGetWSAttri( Wsid, WSDepthCues, &key ); - ws_dcues = (tel_ws_depthcues)key.pdata ; /* Obtain list of defined depthcues */ - - if( !ws_dcues ) - return TFailure; /* no depthcues defined */ - - dcptr = 0; /* Locate depthcue if already defined */ - i = b_s( dcid, ws_dcues->data, 0, ws_dcues->num-1 ); - if( i == -1 ) - return TFailure; /* dcid undefined */ - - if( TelGetViewRepresentation( Wsid, Vid, &vrep ) == TFailure ) - return TFailure; /* Bad View Rep */ - - dcptr = &ws_dcues->data[i]; - gldc->dcrep = dcptr->dc; - if( dcptr->dc.mode == TelDCAllowed ) - { - ramp = (dcptr->dc.planes[1] - dcptr->dc.planes[0]) / - (dcptr->dc.scales[1] - dcptr->dc.scales[0]) ; - gldc->dist[0] = dcptr->dc.planes[0] - (1-dcptr->dc.scales[0]) * ramp; - gldc->dist[1] = dcptr->dc.planes[1] + dcptr->dc.scales[1] * ramp; - ramp = vrep.extra.map.fpd - vrep.extra.map.bpd; - gldc->dist[0] = gldc->dist[0]*ramp - vrep.extra.map.fpd; - gldc->dist[1] = gldc->dist[1]*ramp - vrep.extra.map.fpd; -#ifdef TRACE - printf( "Dist: Near: %f\tFar: %f\n", gldc->dist[0], gldc->dist[1] ); - printf( "Scal: Near: %f\tFar: %f ramp %f\n",dcptr->dc.scales[0], dcptr->dc.scales[1],ramp ); - printf( "map Near: %f\tFar: %f\n",vrep.extra.map.fpd,vrep.extra.map.bpd); -#endif - } - - return TSuccess; -} - -/*----------------------------------------------------------------------*/ - -void -TelPrintDepthCueRep( Tint Wsid, Tint dcid ) -{ - CMN_KEY_DATA key; - tel_depthcue_data dcptr; - tel_ws_depthcues ws_dcues; - register Tint i; - - TsmGetWSAttri( Wsid, WSDepthCues, &key ); - ws_dcues = (tel_ws_depthcues)key.pdata ; /* Obtain list of defined depthcues */ - - if( !ws_dcues ) - return; /* no depthcues defined */ - - dcptr = 0; /* Locate depthcue if already defined */ - i = b_s( dcid, ws_dcues->data, 0, ws_dcues->num-1 ); - if( i == -1 ) - { - fprintf( stdout, "\nBad DepthCue %d\n", dcid ); - return; /* dcid undefined */ - } - - dcptr = &ws_dcues->data[i]; - fprintf( stdout, "\nDepthCue Id: %d", dcid ); - fprintf( stdout, "\nDepthCue mode: %s", dcptr->dc.mode == TelDCAllowed ? - "TelDCAllowed" : "TelDCSuppressed" ); - fprintf( stdout, "\n\tPlanes: Near %f\tFar %f", - dcptr->dc.planes[0], dcptr->dc.planes[1] ); - fprintf( stdout, "\n\tScales: Near %f\tFar %f", - dcptr->dc.scales[0], dcptr->dc.scales[1] ); - fprintf( stdout, "\n\tColour: %f %f %f", - dcptr->dc.col.rgb[0], - dcptr->dc.col.rgb[1], - dcptr->dc.col.rgb[2] ); - fprintf( stdout, "\n" ); - - return; -} - -/*----------------------------------------------------------------------*/ - -TStatus -TelDeleteDepthCuesForWS( Tint wsid ) -{ - CMN_KEY_DATA key; - tel_ws_depthcues d; - - TsmGetWSAttri( wsid, WSDepthCues, &key ); - d = (tel_ws_depthcues)key.pdata; - - if( !d ) - return TSuccess; - - //cmn_freemem( d ); - delete d; - - return TSuccess; -} - -/*----------------------------------------------------------------------*/ diff --git a/src/OpenGl/OpenGl_dind.cxx b/src/OpenGl/OpenGl_dind.cxx deleted file mode 100755 index 857fda1208..0000000000 --- a/src/OpenGl/OpenGl_dind.cxx +++ /dev/null @@ -1,96 +0,0 @@ - -#include - -#include -#include - -#include -#include -#include -#include -#include - -static TStatus DepthCueIndexAdd( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus DepthCueIndexDisplay( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus DepthCueIndexPrint( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus DepthCueIndexInquire( TSM_ELEM_DATA, Tint, cmn_key* ); - -static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) = -{ - DepthCueIndexDisplay, /* PickTraverse */ - DepthCueIndexDisplay, - DepthCueIndexAdd, - 0, /* Delete */ - DepthCueIndexPrint, - DepthCueIndexInquire -}; - - -MtblPtr -TelDepthCueIndexInitClass( TelType *el ) -{ - *el = TelDepthCueIndex; - return MtdTbl; -} - -static TStatus -DepthCueIndexAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k ) -{ - ((tsm_elem_data)(d.pdata))->ldata = k[0]->data.ldata; - - return TSuccess; -} - - -static TStatus -DepthCueIndexDisplay( TSM_ELEM_DATA d, Tint n, cmn_key *k ) -{ - CMN_KEY key; - - key.id = TelDepthCueIndex; - key.data.ldata = d.ldata; - TsmSetAttri( 1, &key ); - return TSuccess; -} - - -static TStatus -DepthCueIndexPrint( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - fprintf( stdout, "TelDepthCueIndex. Value = %d\n", data.ldata); - fprintf( stdout, "\n" ); - - return TSuccess; -} - - -static TStatus -DepthCueIndexInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - Tint i; - - for( i = 0; i < n; i++ ) - { - switch( k[i]->id ) - { - case INQ_GET_SIZE_ID: - { - k[i]->data.ldata = sizeof( Tint ); - break; - } - case INQ_GET_CONTENT_ID: - { - TEL_INQ_CONTENT *c; - Teldata *w; - - c = (tel_inq_content)k[i]->data.pdata; - w = c->data; - c->act_size = 0; - w->idata = data.ldata; - break; - } - } - } - - return TSuccess; -} diff --git a/src/OpenGl/OpenGl_dotexturemap.cxx b/src/OpenGl/OpenGl_dotexturemap.cxx deleted file mode 100755 index a6c0d671c7..0000000000 --- a/src/OpenGl/OpenGl_dotexturemap.cxx +++ /dev/null @@ -1,130 +0,0 @@ -/*********************************************************************** - -FONCTION : ----------- -File OpenGl_dotexturemap.c : - - -REMARQUES: ----------- - - -HISTORIQUE DES MODIFICATIONS : --------------------------------- -19-08-97 : FMN ; ajout texture mapping - -************************************************************************/ - -/*----------------------------------------------------------------------*/ -/* -* Includes -*/ - - -#include - -#include -#include - -#include -#include -#include -#include -#include - -/*----------------------------------------------------------------------*/ - -static TStatus DoTextureMapMethodAdd( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus DoTextureMapMethodDisplay( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus DoTextureMapMethodPrint( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus DoTextureMapMethodInquire( TSM_ELEM_DATA, Tint, cmn_key* ); - -static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) = -{ - 0, /* PickTraverse */ - DoTextureMapMethodDisplay, - DoTextureMapMethodAdd, - 0, /* Delete */ - DoTextureMapMethodPrint, - DoTextureMapMethodInquire -}; - - -MtblPtr -TelDoTextureMapInitClass( TelType *el ) -{ - *el = TelDoTextureMap; - return MtdTbl; -} - -static TStatus -DoTextureMapMethodAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k ) -{ - ((tsm_elem_data)(d.pdata))->ldata = k[0]->data.ldata; - - return TSuccess; -} - - -static TStatus -DoTextureMapMethodDisplay( TSM_ELEM_DATA d, Tint n, cmn_key *k ) -{ - CMN_KEY key; - - key.id = TelDoTextureMap; - key.data.ldata = d.ldata; - TsmSetAttri( 1, &key ); - return TSuccess; -} - - -static TStatus -DoTextureMapMethodPrint( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - switch( data.ldata ) - { - case TEL_SD_SHADING: - fprintf( stdout, "TelDoTextureMap. Value = TEL_SD_SHADING\n" ); - break; - - case TEL_SD_TEXTURE: - fprintf( stdout, "TelDoTextureMap. Value = TEL_SD_TEXTURE\n" ); - break; - } - - fprintf( stdout, "\n" ); - - return TSuccess; -} - - -static TStatus -DoTextureMapMethodInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - Tint i; - - for( i = 0; i < n; i++ ) - { - switch( k[i]->id ) - { - case INQ_GET_SIZE_ID: - { - k[i]->data.ldata = sizeof( Tint ); - break; - } - case INQ_GET_CONTENT_ID: - { - TEL_INQ_CONTENT *c; - Teldata *w; - - c = (tel_inq_content)k[i]->data.pdata; - w = c->data; - c->act_size = 0; - w->idata = data.ldata; - break; - } - } - } - - return TSuccess; -} diff --git a/src/OpenGl/OpenGl_edgecol.cxx b/src/OpenGl/OpenGl_edgecol.cxx deleted file mode 100755 index 25e91515bb..0000000000 --- a/src/OpenGl/OpenGl_edgecol.cxx +++ /dev/null @@ -1,126 +0,0 @@ - -#include - -#include -#include - -#include -#include -#include -#include -#include - -static TStatus EdgeColourDisplay( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus EdgeColourAdd( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus EdgeColourDelete( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus EdgeColourPrint( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus EdgeColourInquire( TSM_ELEM_DATA, Tint, cmn_key* ); - -static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) = -{ - 0, /* PickTraverse */ - EdgeColourDisplay, - EdgeColourAdd, - EdgeColourDelete, - EdgeColourPrint, - EdgeColourInquire -}; - - -MtblPtr -TelEdgeColourInitClass( TelType *el ) -{ - *el = TelEdgeColour; - return MtdTbl; -} - -static TStatus -EdgeColourAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k ) -{ - tel_colour data = new TEL_COLOUR(); - - //cmn_memreserve( data, 1, 0 ); - if( !data ) - return TFailure; - - *data = *(tel_colour)(k[0]->data.pdata); - - ((tsm_elem_data)(d.pdata))->pdata = data; - - return TSuccess; -} - - -static TStatus -EdgeColourDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - tel_colour d; - CMN_KEY key; - - d = (tel_colour)data.pdata; - - key.id = TelEdgeColour; - key.data.pdata = d; - TsmSetAttri( 1, &key ); - - return TSuccess; -} - - -static TStatus -EdgeColourDelete( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - if (data.pdata) - delete data.pdata; - return TSuccess; -} - - - - -static TStatus -EdgeColourPrint( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - tel_colour p; - - p = (tel_colour)data.pdata; - - fprintf( stdout, "TelEdgeColour. R = %g, G = %g, B = %g\n", - p->rgb[0], p->rgb[1], p->rgb[2] ); - fprintf( stdout, "\n" ); - - return TSuccess; -} - - -static TStatus -EdgeColourInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - Tint i; - tel_colour col = (tel_colour)data.pdata; - - for( i = 0; i < n; i++ ) - { - switch( k[i]->id ) - { - case INQ_GET_SIZE_ID: - { - k[i]->data.ldata = sizeof( Tint ); - break; - } - case INQ_GET_CONTENT_ID: - { - TEL_INQ_CONTENT *c; - Teldata *w; - - c = (tel_inq_content)k[i]->data.pdata; - w = c->data; - c->act_size = 0; - w->gnl_colour = *col; - break; - } - } - } - - return TSuccess; -} diff --git a/src/OpenGl/OpenGl_edgeflag.cxx b/src/OpenGl/OpenGl_edgeflag.cxx deleted file mode 100755 index b390ce6fcd..0000000000 --- a/src/OpenGl/OpenGl_edgeflag.cxx +++ /dev/null @@ -1,97 +0,0 @@ - -#include - -#include -#include - -#include -#include -#include -#include -#include - -static TStatus EdgeFlagAdd( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus EdgeFlagDisplay( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus EdgeFlagPrint( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus EdgeFlagInquire( TSM_ELEM_DATA, Tint, cmn_key* ); - -static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) = -{ - 0, /* PickTraverse */ - EdgeFlagDisplay, - EdgeFlagAdd, - 0, /* Delete */ - EdgeFlagPrint, - EdgeFlagInquire -}; - - -MtblPtr -TelEdgeFlagInitClass( TelType *el ) -{ - *el = TelEdgeFlag; - return MtdTbl; -} - -static TStatus -EdgeFlagAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k ) -{ - ((tsm_elem_data)(d.pdata))->ldata = k[0]->data.ldata; - - return TSuccess; -} - - -static TStatus -EdgeFlagDisplay( TSM_ELEM_DATA d, Tint n, cmn_key *k ) -{ - CMN_KEY key; - - key.id = TelEdgeFlag; - key.data.ldata = d.ldata; - TsmSetAttri( 1, &key ); - return TSuccess; -} - - -static TStatus -EdgeFlagPrint( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - data.ldata == TOn ? fprintf( stdout, "TelEdgeFlag. Value = ON\n" ) : -fprintf( stdout, "TelEdgeFlag. Value = OFF\n" ); -fprintf( stdout, "\n" ); - -return TSuccess; -} - - -static TStatus -EdgeFlagInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - Tint i; - - for( i = 0; i < n; i++ ) - { - switch( k[i]->id ) - { - case INQ_GET_SIZE_ID: - { - k[i]->data.ldata = sizeof( Tint ); - break; - } - case INQ_GET_CONTENT_ID: - { - TEL_INQ_CONTENT *c; - Teldata *w; - - c = (tel_inq_content)k[i]->data.pdata; - w = c->data; - c->act_size = 0; - w->idata = data.ldata; - break; - } - } - } - - return TSuccess; -} diff --git a/src/OpenGl/OpenGl_edgetyp.cxx b/src/OpenGl/OpenGl_edgetyp.cxx deleted file mode 100755 index 5ed237b810..0000000000 --- a/src/OpenGl/OpenGl_edgetyp.cxx +++ /dev/null @@ -1,113 +0,0 @@ - -#include - -#include -#include - -#include -#include -#include -#include -#include - -static TStatus EdgeTypeDisplay( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus EdgeTypeAdd( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus EdgeTypePrint( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus EdgeTypeInquire( TSM_ELEM_DATA, Tint, cmn_key* ); - -static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) = -{ - 0, /* PickTraverse */ - EdgeTypeDisplay, - EdgeTypeAdd, - 0, /* Delete */ - EdgeTypePrint, - EdgeTypeInquire -}; - - -MtblPtr -TelEdgeTypeInitClass( TelType *el ) -{ - *el = TelEdgeType; - return MtdTbl; -} - -static TStatus -EdgeTypeAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k ) -{ - ((tsm_elem_data)(d.pdata))->ldata = k[0]->data.ldata; - - return TSuccess; -} - - -static TStatus -EdgeTypeDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - /* Yet to be coded */ - return TSuccess; -} - - -static TStatus -EdgeTypePrint( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - switch( data.ldata ) - { - case TEL_LS_SOLID: - fprintf( stdout, "TelEdgeType. Value = SOLID\n" ); - break; - - case TEL_LS_DOT: - fprintf( stdout, "TelEdgeType. Value = DOT\n" ); - break; - - case TEL_LS_DASH_DOT: - fprintf( stdout, "TelEdgeType. Value = DASH_DOT\n" ); - break; - - case TEL_LS_DASH: - fprintf( stdout, "TelEdgeType. Value = DASH\n" ); - break; - - case TEL_LS_DOUBLE_DOT_DASH: - fprintf( stdout, "TelEdgeType. Value = DOUBLE_DOT_DASH\n" ); - break; - } - fprintf( stdout, "\n" ); - - return TSuccess; -} - - -static TStatus -EdgeTypeInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - Tint i; - - for( i = 0; i < n; i++ ) - { - switch( k[i]->id ) - { - case INQ_GET_SIZE_ID: - { - k[i]->data.ldata = sizeof( Tint ); - break; - } - case INQ_GET_CONTENT_ID: - { - TEL_INQ_CONTENT *c; - Teldata *w; - - c = (tel_inq_content)k[i]->data.pdata; - w = c->data; - c->act_size = 0; - w->idata = data.ldata; - break; - } - } - } - - return TSuccess; -} diff --git a/src/OpenGl/OpenGl_edgewid.cxx b/src/OpenGl/OpenGl_edgewid.cxx deleted file mode 100755 index f30688890a..0000000000 --- a/src/OpenGl/OpenGl_edgewid.cxx +++ /dev/null @@ -1,117 +0,0 @@ - -#include - -#include -#include - -#include -#include -#include -#include -#include - -static TStatus EdgeWidthDisplay( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus EdgeWidthAdd( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus EdgeWidthDelete( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus EdgeWidthPrint( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus EdgeWidthInquire( TSM_ELEM_DATA, Tint, cmn_key* ); - -static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) = -{ - 0, /* PickTraverse */ - EdgeWidthDisplay, - EdgeWidthAdd, - EdgeWidthDelete, - EdgeWidthPrint, - EdgeWidthInquire -}; - - -MtblPtr -TelEdgeWidthInitClass( TelType *el ) -{ - *el = TelEdgeWidth; - return MtdTbl; -} - -static TStatus -EdgeWidthAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k ) -{ - Tfloat *data = new Tfloat(); - - //cmn_memreserve( data, 1, 0 ); - if( !data ) - return TFailure; - - *data = k[0]->data.fdata; - - ((tsm_elem_data)(d.pdata))->pdata = data; - - return TSuccess; -} - - -static TStatus -EdgeWidthDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - CMN_KEY key; - - key.id = TelEdgeWidth; - key.data.fdata = *(Tfloat*)(data.pdata); - TsmSetAttri( 1, &key ); - - return TSuccess; -} - - -static TStatus -EdgeWidthDelete( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - //cmn_freemem( data.pdata ); - if (data.pdata) - delete data.pdata; - return TSuccess; -} - - -static TStatus -EdgeWidthPrint( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - fprintf( stdout, "TelEdgeWidth. Value = %g\n", *(Tfloat *)(data.pdata)); - fprintf( stdout, "\n" ); - - return TSuccess; -} - - -static TStatus -EdgeWidthInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - Tint i; - Tfloat *f = (Tfloat *)data.pdata; - - for( i = 0; i < n; i++ ) - { - switch( k[i]->id ) - { - case INQ_GET_SIZE_ID: - { - k[i]->data.ldata = sizeof( Tint ); - break; - } - case INQ_GET_CONTENT_ID: - { - TEL_INQ_CONTENT *c; - Teldata *w; - - c = (tel_inq_content)k[i]->data.pdata; - w = c->data; - c->act_size = 0; - w->fdata = *f; - break; - } - } - } - - return TSuccess; -} diff --git a/src/OpenGl/OpenGl_execstruct.cxx b/src/OpenGl/OpenGl_execstruct.cxx deleted file mode 100755 index 1110024e8e..0000000000 --- a/src/OpenGl/OpenGl_execstruct.cxx +++ /dev/null @@ -1,632 +0,0 @@ -/*********************************************************************** - -FONCTION : ----------- -File OpenGl_execstruct : - - -REMARQUES: ----------- - - -HISTORIQUE DES MODIFICATIONS : --------------------------------- -xx-xx-xx : xxx ; Creation. -11-03-96 : FMN ; Correction warning compilation -01-04-96 : CAL ; Integration MINSK portage WNT -22-04-96 : FMN ; Suppression prototype inutile. -30-06-97 : FMN ; Appel de la toolkit OpenGl_LightBox. -18-07-97 : FMN ; Meilleure gestion de la desactivation des lights -10-09-97 : FMN ; Meilleure gestion de la desactivation des lights -05-08-97 : PCT ; ajout descativation texture sur line etc... -19-08-97 : PCT ; ajout pourcentage de reflexion des objets avec textues environnante -22-12-97 : FMN ; Correction PRO10217 sur le mode Transient -13-03-98 : FMN ; Suppression variable externe TglUpdateView0 -17-03-98 : FMN ; Ajout mode animation -- deplacement TelSetViewIndex vers OpenGl_execstruct.c. -- gestion du mode animation. -16-06-2000 : ATS,GG : G005 : Some conditions for execution of PARRAY primitives - -************************************************************************/ -#ifdef DEBUG -#define TRACE -#define TRACE_EXEC -#endif - -#define G003 /* EUG 16-09-99 G003 ZBufferAuto treatment -*/ - -#define BUC60742 /* GG 18/09/00 Enable to use both animation and -graphic structure transformation -*/ - -#define G005 /* ATS,GG 11/01/00 Using arrays of primitives -*/ - -#define IMP051001 /* GG Enable/Disable polygon offset for -highlighted graphic structures -*/ - -/*----------------------------------------------------------------------*/ -/* -* Includes -*/ - -#include - -#include - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include /* for matcpy */ - -#include -#include -#include - -#include - -#ifdef G003 -# include -#endif /* G003 */ -#ifdef G005 -#include -#endif - -/*----------------------------------------------------------------------*/ -/* -* Variables externes -*/ - -extern tsm_trsf_stack cur_trsf_stack; -#ifdef G003 -#define D_MODE( d ) ( int )( ( ( PDEGENERATION )( d.data.pdata ) ) -> mode ) -#define S_RATIO( d ) ( float )( ( ( PDEGENERATION )( d.data.pdata ) ) -> skipRatio ) -extern GLboolean g_fAnimation; -extern GLboolean g_fDegeneration; -int g_nDegenerateModel; -float g_fSkipRatio; -#endif /* G003 */ - -/*----------------------------------------------------------------------*/ -/* -* Constantes -*/ - -static TEL_PACKED_NAME pn; - -#define PUSHNAME( a ) pn.i = a, glPushName( pn.s[0] ), glPushName( pn.s[1] ) -#define LOADNAME( a ) pn.i = a, glPopName(), glLoadName( pn.s[0] ), \ - glPushName( pn.s[1] ) -#define POPNAME() glPopName(), glPopName() - -#define NO_TRACE_LIGHT -#define NO_TRACE_EXEC - -/*----------------------------------------------------------------------*/ -/* -* Prototypes fonctions -*/ - -static TStatus ExecuteStructurePick( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus ExecuteStructureDisplay( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus ExecuteStructureAdd( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus ExecuteStructurePrint( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus ExecuteStructureInquire( TSM_ELEM_DATA, Tint, cmn_key* ); - -/*----------------------------------------------------------------------*/ -/* -* Variables locales -*/ - -static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) = -{ - ExecuteStructurePick, - ExecuteStructureDisplay, - ExecuteStructureAdd, - 0, /* Delete : may be provided for deleting structure - network */ - ExecuteStructurePrint, - ExecuteStructureInquire -}; - -/*----------------------------------------------------------------------*/ - -MtblPtr -TelExecuteStructureInitClass( TelType *el ) -{ - *el = TelExecuteStructure; - return MtdTbl; -} - -/*----------------------------------------------------------------------*/ - -static TStatus -ExecuteStructureAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k ) -{ - ((tsm_elem_data)(d.pdata))->ldata = k[0]->data.ldata; - - return TSuccess; -} - -/*----------------------------------------------------------------------*/ - -static TStatus -ExecuteStructurePick( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - Tint i, num; - tsm_node node; - register Tint display = 1; - register Tint pickfl = 0; - register TelType elem; - Tint vp; - Tint view = 0; - CMN_KEY key; - - if( TsmGetStructure( data.ldata, &num, &node ) == TFailure ) - return TFailure; - - if( !num ) - return TSuccess; - - PUSHNAME( data.ldata ); /* Struct id */ - PUSHNAME( -1 ); /* Pick id; dummy */ - PUSHNAME( -1 ); /* Elem no.; dummy */ - - TsmPushAttri(); /* save previous graphics context */ - TglNamesetPush(); - if( TglFilterNameset( k[0]->id, InvisFilter ) == TSuccess ) - display = 0; - if( TglFilterNameset( k[0]->id, PickFilter ) == TSuccess ) - pickfl = 1; - key.id = TelViewIndex; - TsmGetAttri( 1, &key ); - vp = key.data.ldata; - if( TglVpBeingPicked == vp ) - view = 1; - for( i = 0; i < num; i++, node = node->next ) - { - elem = node->elem.el; - switch( elem ) - { - case TelAddNameset: - case TelRemoveNameset: - { - TsmSendMessage( elem, PickTraverse, node->elem.data, 0 ); - if( TglFilterNameset( k[0]->id, InvisFilter ) == TSuccess ) - display = 0; - else - display = 1; - if( TglFilterNameset( k[0]->id, PickFilter ) == TSuccess ) - pickfl = 1; - else - pickfl = 0; - break; - } - case TelExecuteStructure: - { - LOADNAME( i+1 ); /* Elem no. */ - TsmSendMessage( elem, PickTraverse, node->elem.data, -1, k ); - break; - } - case TelPickId: - { - POPNAME(); /* Elem no. */ - LOADNAME( node->elem.data.ldata ); /* Pick id */ - PUSHNAME( -1 ); /* Elem no.; dummy */ - break; - } - case TelViewIndex: - { - vp = node->elem.data.ldata; - if( vp == TglVpBeingPicked ) - { - view = 1; - key.id = TOn; - } - else - { - view = 0; - key.id = TOff; - } - TsmSendMessage( elem, PickTraverse, node->elem.data, 1, &key ); - break; - } - case TelCurve: - case TelPolygon: - case TelPolygonSet: - case TelPolygonHoles: - case TelPolygonIndices: - case TelQuadrangle: - case TelPolyline: - case TelMarker: - case TelMarkerSet: - case TelText: - case TelTriangleMesh: -#ifdef G005 - case TelParray: - /* do not send Pick message to */ - { /* primitives if they are not pickable */ - if( pickfl && view && display ) - { - key.id = TOff; /* dummy key for highlight flag */ - LOADNAME( i+1 ); /* Elem no. */ - TsmSendMessage( elem, PickTraverse, node->elem.data, 1, &key ); - } - break; - } -#endif - - default: - { - TsmSendMessage( elem, PickTraverse, node->elem.data, 0 ); - break; - } - } - } - TglNamesetPop(); - TsmPopAttri(); /* restore previous graphics context */ - - POPNAME(); /* Elem no. */ - POPNAME(); /* Pick id */ - POPNAME(); /* Struct id */ - - return TSuccess; -} - -/*----------------------------------------------------------------------*/ - -static TStatus -ExecuteStructureDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - Tint i, num; - tsm_node node; - register Tint display = 1; - register Tint highl = TOff; - register TelType elem; - Tint vp; - CMN_KEY key; -#ifdef G003 - static GLboolean s_fWire = GL_FALSE; - static Tint s_depth = 0; - static Tint save_texture_state = 0; - static CMN_KEY s_kLineWidth; - static CMN_KEY s_kPolyType; - TStatus retVal = TSuccess; -#else - int save_texture_state; -#endif - - if( TsmGetStructure( data.ldata, &num, &node ) == TFailure ) -#ifdef G003 - { retVal = TFailure; goto ret; } -#else - return TFailure; -#endif - - if( !num ) -#ifdef G003 - goto ret; -#else - return TSuccess; -#endif - -#ifdef G003 - ++s_depth; -#ifdef TRACE - printf(" .. ExecuteStructureDisplay.s_depth = %d\n",s_depth); -#endif -#endif /*G003*/ - - TsmPushAttri(); /* save previous graphics context */ - TglNamesetPush(); - if( TglFilterNameset( k[0]->id, InvisFilter ) == TSuccess ) - display = 0; - if( TglFilterNameset( k[0]->id, HighlFilter ) == TSuccess ) - highl = TOn; - key.id = TelViewIndex; - TsmGetAttri( 1, &key ); -#ifdef G003 - if ( s_depth == 1 ) { - glPushAttrib ( GL_DEPTH_BUFFER_BIT ); - s_kLineWidth.id = TelPolylineWidth; - s_kPolyType.id = TelPolylineType; -#ifdef BUG - TsmGetAttri ( 1, &s_kLineWidth, &s_kPolyType ); -#else - TsmGetAttri ( 2, &s_kLineWidth, &s_kPolyType ); -#endif - g_nDegenerateModel = 0; - g_fSkipRatio = 0.0F; - } /* end if */ -#endif /* G003 */ - - vp = key.data.ldata; - for( i = 0; i < num; i++, node = node->next ) - { - elem = node->elem.el; -#ifdef TRACE_EXEC -#include -#endif - switch( elem ) - { -#ifdef G003 - case TelDegenerationMode: - - if ( g_fDegeneration ) - - switch ( g_nDegenerateModel = D_MODE( node->elem ) ) - { - - case 0: - - break; - - default: - - glLineWidth ( 1.0 ); - glDisable ( GL_LINE_STIPPLE ); - - case 1: - - g_fSkipRatio = S_RATIO( node->elem ); - - } /* end switch */ - - break; -#endif /* G003 */ - case TelAddNameset: - case TelRemoveNameset: - { - TsmSendMessage( elem, DisplayTraverse, node->elem.data, 0 ); - if( TglFilterNameset( k[0]->id, InvisFilter ) == TSuccess ) - display = 0; - else - display = 1; - if( TglFilterNameset( k[0]->id, HighlFilter ) == TSuccess ) - highl = TOn; - else - highl = TOff; - break; - } - case TelExecuteStructure: - { - tsm_trsf_stack new_trsf_stack = NULL; - - new_trsf_stack = (tsm_trsf_stack) malloc (sizeof (TSM_TRSF_STACK)); - cur_trsf_stack->next = new_trsf_stack; - new_trsf_stack->prev = cur_trsf_stack; - new_trsf_stack->next = NULL; - matcpy(new_trsf_stack->LocalTran3, cur_trsf_stack->LocalTran3); - cur_trsf_stack = new_trsf_stack; - -#ifdef TRACE - printf(" .. ExecuteStructureDisplay.TelExecuteStructure.s_depth = %d\n",s_depth); -#endif -#ifdef BUC60742 - glMatrixMode (GL_MODELVIEW); - glPushMatrix(); -#endif - TsmSendMessage( elem, DisplayTraverse, node->elem.data, -1, k ); -#ifdef BUC60742 - glMatrixMode (GL_MODELVIEW); - glPopMatrix(); -#endif - cur_trsf_stack = new_trsf_stack->prev; - cur_trsf_stack->next = NULL; - free (new_trsf_stack); - break; - } - case TelViewIndex: - { - break; - } - - case TelPolyline: - case TelMarker: - case TelMarkerSet: - case TelText: - { /* primitives if they are invisible */ - if( display ) - { - LightOff(); -#ifdef G003 - if ( g_fAnimation && !s_fWire && g_nDegenerateModel ) { - glDisable ( GL_DEPTH_TEST ); -#endif /* G003 */ - save_texture_state = IsTextureEnabled(); - if( save_texture_state ) DisableTexture(); -#ifdef G003 - s_fWire = GL_TRUE; - } /* end if */ -#endif /* G003 */ - - key.id = highl; - TsmSendMessage( elem, DisplayTraverse, node->elem.data, 1, &key ); - if (save_texture_state) EnableTexture(); - } - break; - } - case TelCurve: - case TelPolygon: - case TelPolygonSet: - case TelPolygonIndices: - case TelQuadrangle: - case TelTriangleMesh: - case TelPolygonHoles: /* do not send Display message to */ - { /* primitives if they are invisible */ - if( display ) - { -#ifdef G003 - if ( g_fAnimation && s_fWire && g_nDegenerateModel < 2 ) { - if ( save_texture_state ) EnableTexture (); - glEnable ( GL_DEPTH_TEST ); - s_fWire = GL_FALSE; - } /* end if */ -#endif /* G003 */ -#ifdef IMP051001 - if( highl ) - call_subr_disable_polygon_offset(); -#endif - key.id = highl; - TsmSendMessage( elem, DisplayTraverse, node->elem.data, 1, &key ); -#ifdef IMP051001 - if( highl ) - call_subr_enable_polygon_offset(); -#endif - } - break; - } -#ifdef G005 - case TelParray: - if( display ) { - CALL_DEF_PARRAY *pa = (CALL_DEF_PARRAY *)node->elem.data.pdata; - switch ( pa->type ) - { - case TelPointsArrayType: - case TelPolylinesArrayType: - case TelSegmentsArrayType: - LightOff(); -#ifdef G003 - if ( g_fAnimation && !s_fWire && g_nDegenerateModel ) { - glDisable ( GL_DEPTH_TEST ); -#endif /* G003 */ - save_texture_state = IsTextureEnabled(); - if( save_texture_state ) DisableTexture(); -#ifdef G003 - s_fWire = GL_TRUE; - } /* end if */ -#endif /* G003 */ - - key.id = highl; - TsmSendMessage( elem, DisplayTraverse, node->elem.data, 1, &key ); - if (save_texture_state) EnableTexture(); - break; - case TelPolygonsArrayType: - case TelTrianglesArrayType: - case TelQuadranglesArrayType: - case TelTriangleStripsArrayType: - case TelTriangleFansArrayType: - case TelQuadrangleStripsArrayType: -#ifdef G003 - if ( g_fAnimation && s_fWire && g_nDegenerateModel < 2 ) { - if ( save_texture_state ) EnableTexture (); - glEnable ( GL_DEPTH_TEST ); - s_fWire = GL_FALSE; - } /* end if */ -#endif /* G003 */ - key.id = highl; - TsmSendMessage( elem, DisplayTraverse, node->elem.data, 1, &key ); - break; - default: - break; - } - } - break; -#endif /*G005*/ - /* ABD 29/10/04 Transform Persistence of Presentation( pan, zoom, rotate ) */ - case TelTransformPersistence: - { - /*CALL_DEF_TRANSFORM_PERSISTENCE*/ - TEL_TRANSFORM_PERSISTENCE *tp - = (tel_transform_persistence)node->elem.data.pdata; - if( tp->mode != 0 ) - TsmSendMessage (elem, DisplayTraverse, node->elem.data, 1, &key); - break; - } - /*ABD 29/10/04 Transform Persistence of Presentation( pan, zoom, rotate ) */ - case TelUserdraw: - { - if( display ) - { - key.id = highl; - TsmSendMessage( elem, DisplayTraverse, node->elem.data, 1, &key ); - } - break; - } - default: - { - TsmSendMessage( elem, DisplayTraverse, node->elem.data, 0 ); - break; - } - } - } - TglNamesetPop(); - TsmPopAttri(); /* restore previous graphics context; before update lights */ -#ifdef G003 -ret: - if ( s_depth == 1 ) { - s_fWire = GL_FALSE; - - if ( g_nDegenerateModel > 1 ) { - glLineWidth ( s_kLineWidth.data.fdata ); - if ( s_kPolyType.data.ldata != TEL_LS_SOLID ) glEnable ( GL_LINE_STIPPLE ); - } /* end if */ - - glPopAttrib (); - } /* end if */ - - --s_depth; - return retVal; -#else - return TSuccess; -#endif -} - -/*----------------------------------------------------------------------*/ - -static TStatus -ExecuteStructurePrint( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - fprintf( stdout, "TelExecuteStructure. Value = %d\n", data.ldata); - fprintf( stdout, "\n" ); - - return TSuccess; -} - -/*----------------------------------------------------------------------*/ - -static TStatus -ExecuteStructureInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - Tint i; - - for( i = 0; i < n; i++ ) - { - switch( k[i]->id ) - { - case INQ_GET_SIZE_ID: - { - k[i]->data.ldata = sizeof( Tint ); - break; - } - case INQ_GET_CONTENT_ID: - { - TEL_INQ_CONTENT *c; - Teldata *w; - - c = (tel_inq_content)k[i]->data.pdata; - w = c->data; - c->act_size = 0; - w->idata = data.ldata; - break; - } - } - } - - return TSuccess; -} - -/*----------------------------------------------------------------------*/ diff --git a/src/OpenGl/OpenGl_facecull.cxx b/src/OpenGl/OpenGl_facecull.cxx deleted file mode 100755 index a8799c1fc6..0000000000 --- a/src/OpenGl/OpenGl_facecull.cxx +++ /dev/null @@ -1,111 +0,0 @@ - -#include - -#include -#include - -#include -#include -#include -#include -#include - -static TStatus FaceCullingModeDisplay( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus FaceCullingModeAdd( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus FaceCullingModePrint( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus FaceCullingModeInquire( TSM_ELEM_DATA, Tint, cmn_key* ); - -static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) = -{ - FaceCullingModeDisplay, /* PickTraverse */ - FaceCullingModeDisplay, - FaceCullingModeAdd, - 0, /* Delete */ - FaceCullingModePrint, - FaceCullingModeInquire -}; - - -MtblPtr -TelFaceCullingModeInitClass( TelType *el ) -{ - *el = TelFaceCullingMode; - return MtdTbl; -} - -static TStatus -FaceCullingModeAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k ) -{ - ((tsm_elem_data)(d.pdata))->ldata = k[0]->data.ldata; - - return TSuccess; -} - - -static TStatus -FaceCullingModeDisplay( TSM_ELEM_DATA d, Tint n, cmn_key *k ) -{ - CMN_KEY key; - - key.id = TelFaceCullingMode; - key.data.ldata = d.ldata; - TsmSetAttri( 1, &key ); - - return TSuccess; -} - - -static TStatus -FaceCullingModePrint( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - switch( data.ldata ) - { - case TelCullNone: - fprintf( stdout, "TelFaceCullingMode. Value = CULL_NONE\n" ); - break; - - case TelCullFront: - fprintf( stdout, "TelFaceCullingMode. Value = CULL_FRONT\n" ); - break; - - case TelCullBack: - fprintf( stdout, "TelFaceCullingMode. Value = CULL_BACK\n" ); - break; - } - fprintf( stdout, "\n" ); - - return TSuccess; -} - - -static TStatus -FaceCullingModeInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - Tint i; - - for( i = 0; i < n; i++ ) - { - switch( k[i]->id ) - { - case INQ_GET_SIZE_ID: - { - k[i]->data.ldata = sizeof( Tint ); - break; - } - case INQ_GET_CONTENT_ID: - { - TEL_INQ_CONTENT *c; - Teldata *w; - - c = (tel_inq_content)k[i]->data.pdata; - w = c->data; - c->act_size = 0; - /* w->face_processing_mode.cull = data.ldata; */ - w->idata = data.ldata; - break; - } - } - } - - return TSuccess; -} diff --git a/src/OpenGl/OpenGl_facedmode.cxx b/src/OpenGl/OpenGl_facedmode.cxx deleted file mode 100755 index a0167badb6..0000000000 --- a/src/OpenGl/OpenGl_facedmode.cxx +++ /dev/null @@ -1,99 +0,0 @@ - -#include - -#include -#include - -#include -#include -#include -#include -#include - -static TStatus FaceDistinguishingModeAdd( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus FaceDistinguishingModeDisplay( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus FaceDistinguishingModePrint( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus FaceDistinguishingModeInquire( TSM_ELEM_DATA, Tint, cmn_key* ); - -static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) = -{ - 0, /* PickTraverse */ - FaceDistinguishingModeDisplay, - FaceDistinguishingModeAdd, - 0, /* Delete */ - FaceDistinguishingModePrint, - FaceDistinguishingModeInquire, -}; - - -MtblPtr -TelFaceDistinguishingModeInitClass( TelType *el ) -{ - *el = TelFaceDistinguishingMode; - return MtdTbl; -} - -static TStatus -FaceDistinguishingModeAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k ) -{ - ((tsm_elem_data)(d.pdata))->ldata = k[0]->data.ldata; - - return TSuccess; -} - - -static TStatus -FaceDistinguishingModeDisplay( TSM_ELEM_DATA d, Tint n, cmn_key *k ) -{ - CMN_KEY key; - - key.id = TelFaceDistinguishingMode; - key.data.ldata = d.ldata; - TsmSetAttri( 1, &key ); - return TSuccess; -} - - -static TStatus -FaceDistinguishingModePrint( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - data.ldata == TOn ? - fprintf( stdout, "TelFaceDistinguishingMode. Value = ON\n" ) : - fprintf( stdout, "TelFaceDistinguishingMode. Value = OFF\n" ); - fprintf( stdout, "\n" ); - - return TSuccess; -} - - -static TStatus -FaceDistinguishingModeInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - Tint i; - - for( i = 0; i < n; i++ ) - { - switch( k[i]->id ) - { - case INQ_GET_SIZE_ID: - { - k[i]->data.ldata = sizeof( Tint ); - break; - } - case INQ_GET_CONTENT_ID: - { - TEL_INQ_CONTENT *c; - Teldata *w; - - c = (tel_inq_content)k[i]->data.pdata; - w = c->data; - c->act_size = 0; - /* w->face_processing_mode.distinguish = data.ldata; */ - w->idata = data.ldata; - break; - } - } - } - - return TSuccess; -} diff --git a/src/OpenGl/OpenGl_filters.cxx b/src/OpenGl/OpenGl_filters.cxx deleted file mode 100755 index 06f0966ac8..0000000000 --- a/src/OpenGl/OpenGl_filters.cxx +++ /dev/null @@ -1,508 +0,0 @@ -/*********************************************************************** - -FONCTION : ----------- -File OpenGl_filters : - - -REMARQUES: ----------- - - -HISTORIQUE DES MODIFICATIONS : --------------------------------- -xx-xx-xx : xxx ; Creation. -11-03-96 : FMN ; Correction warning compilation -01-04-96 : CAL ; Integration MINSK portage WNT - -************************************************************************/ - -/*----------------------------------------------------------------------*/ -/* -* Includes -*/ - -#include - -#include -#include - -#include -#include -#include -#include -#include - -/*----------------------------------------------------------------------*/ -/* -* Definition des types -*/ - -struct TGL_FILTERS -{ - Tint invis_incl_num, - invis_excl_num, - pick_incl_num, - pick_excl_num, - highl_incl_num, - highl_excl_num; - - Tint invis_incl_siz, - invis_excl_siz, - pick_incl_siz, - pick_excl_siz, - highl_incl_siz, - highl_excl_siz; - - Tint *invis_incl_lis, - *invis_excl_lis, - *pick_incl_lis, - *pick_excl_lis, - *highl_incl_lis, - *highl_excl_lis; - - IMPLEMENT_MEMORY_OPERATORS -}; -typedef TGL_FILTERS* tgl_filters; - -struct TGL_NAMESET_NODE_STRUCT -{ - Tint num, siz, *ptr; - IMPLEMENT_MEMORY_OPERATORS -}; -typedef TGL_NAMESET_NODE_STRUCT TGL_NAMESET_NODE; -typedef TGL_NAMESET_NODE_STRUCT* tgl_nameset_node; - - -/*----------------------------------------------------------------------*/ -/* -* Variables locales -*/ - -typedef NCollection_Stack NodeStack; -typedef NCollection_List FilterList; - -static NodeStack _NodeStack; -static FilterList _FilterList; - - -/*----------------------------------------------------------------------*/ -/* -* Constantes -*/ - -#define LIST_GROW_SIZE 25 -#define FIL_STBL_SIZE 23 - -/*----------------------------------------------------------------------*/ - -static int -num_comp( const void* a, const void* b ) -{ - return *( Tint* )a - *( Tint* )b; -} - -/*----------------------------------------------------------------------*/ - -static TStatus -set_filter( Tint n, Tint *ls, Tint *num, Tint *siz, Tint **list ) -{ - Tint size; - - size = n, - size %= LIST_GROW_SIZE, - size += 1, - size *= LIST_GROW_SIZE; - if( !*siz ) - { - //cmn_memreserve( *list, size, 0 ); - *list = new Tint[size]; - if( !*list ) - return TFailure; - - *siz = size; - } - else if( *siz < n ) - { -#if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x530) - *list = (Tint*)realloc( *list, size*sizeof(Tint) ); -#else - *list = cmn_resizemem( *list, size ); -#endif - if( !*list ) - return TFailure; - - *siz = size; - } - //cmn_memcpy( *list, ls, n ); - memcpy( *list, ls, n*sizeof(Tint) ); - qsort( *list, n, sizeof(Tint), num_comp ); - *num = TelRemdupnames( *list, n ); - - return TSuccess; -} - -/*----------------------------------------------------------------------*/ - -static tgl_filters -getfiltrec( Tint wsid ) -{ - tgl_filters filt; - CMN_KEY_DATA data; - - if( TsmGetWSAttri( wsid, WSFilters, &data ) == TFailure ) - return 0; - - filt = (tgl_filters)data.pdata; - if( !filt ) - { - filt = new TGL_FILTERS(); - data.pdata = filt; - TsmSetWSAttri( wsid, WSFilters, &data ); - } - - return filt; -} - -/*----------------------------------------------------------------------*/ - -TStatus -TglSetHighlFilter( Tint wsid, Tint in_num, Tint *in_lis, - Tint ex_num, Tint *ex_lis ) -{ - TStatus ret; - tgl_filters filter; - - filter = getfiltrec( wsid ); - if( !filter ) - return TFailure; - - ret = set_filter( in_num, in_lis, &filter->highl_incl_num, - &filter->highl_incl_siz, &filter->highl_incl_lis ); - if( ret == TSuccess ) - ret = set_filter( ex_num, ex_lis, &filter->highl_excl_num, - &filter->highl_excl_siz, &filter->highl_excl_lis ); - return ret; -} - -/*----------------------------------------------------------------------*/ - -TStatus -TglSetPickFilter( Tint wsid, Tint in_num, Tint *in_lis, - Tint ex_num, Tint *ex_lis ) -{ - TStatus ret; - tgl_filters filter; - - filter = getfiltrec( wsid ); - if( !filter ) - return TFailure; - - ret = set_filter( in_num, in_lis, &filter->pick_incl_num, - &filter->pick_incl_siz, &filter->pick_incl_lis ); - if( ret == TSuccess ) - ret = set_filter( ex_num, ex_lis, &filter->pick_excl_num, - &filter->pick_excl_siz, &filter->pick_excl_lis ); - return ret; -} - -/*----------------------------------------------------------------------*/ - -TStatus -TglSetInvisFilter( Tint wsid, Tint in_num, Tint *in_lis, - Tint ex_num, Tint *ex_lis ) -{ - TStatus ret; - tgl_filters filter; - - filter = getfiltrec( wsid ); - if( !filter ) - return TFailure; - - ret = set_filter( in_num, in_lis, &filter->invis_incl_num, - &filter->invis_incl_siz, &filter->invis_incl_lis ); - if( ret == TSuccess ) - ret = set_filter( ex_num, ex_lis, &filter->invis_excl_num, - &filter->invis_excl_siz, &filter->invis_excl_lis ); - return ret; -} - -/*----------------------------------------------------------------------*/ - -TStatus -TglNamesetPush( void ) -{ - tgl_nameset_node node; - - node = new TGL_NAMESET_NODE(); - if ( _NodeStack.IsEmpty() || !_NodeStack.Top() || !_NodeStack.Top()->ptr ) - /* abd - if( !name_tail || !name_tail->ptr )*/ - { - node->ptr = 0, node->num = node->siz = 0; - } - else /* copy previous stack entry to new one */ - { - Tint size = _NodeStack.Top()->siz; - - node->ptr = new Tint[size]; - if( !node->ptr ) - return TFailure; - - node->siz = size; - node->num = _NodeStack.Top()->num; - memcpy( node->ptr, _NodeStack.Top()->ptr, node->num*sizeof(Tint) ); - } - - _NodeStack.Push( node ); - - return TSuccess; -} - -/*----------------------------------------------------------------------*/ - - -TStatus -TglNamesetPop( void ) -{ - tgl_nameset_node node = - _NodeStack.ChangeTop(); - - _NodeStack.Pop(); - if( node->ptr ) - { - /* Remove entries from sorted list*/ - delete[] node->ptr; - } - delete node; - - return TSuccess; -} - -/*----------------------------------------------------------------------*/ - -TStatus -TglNamesetAdd( Tint num, Tint *set ) -{ - if (_NodeStack.IsEmpty()) - return TFailure; - - Tint size; - tgl_nameset_node name_tail = _NodeStack.ChangeTop(); - - size = num, - size %= LIST_GROW_SIZE, - size++, - size *= LIST_GROW_SIZE; - - if( !name_tail->ptr ) - { - name_tail->ptr = new Tint[size]; - if( !name_tail->ptr ) - return TFailure; - - name_tail->siz = size; - } - else if( name_tail->siz < name_tail->num + num ) - { -#if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x530) - name_tail->ptr = (Tint*)realloc( name_tail->ptr, size*sizeof(Tint) ); -#else - name_tail->ptr = cmn_resizemem( name_tail->ptr, size ); -#endif - if( !name_tail->ptr ) - return TFailure; - - name_tail->siz = size; - } - memcpy( &name_tail->ptr[name_tail->num], set, num*sizeof(Tint) ); - name_tail->num += num; - - /* sort new set */ - qsort( name_tail->ptr, name_tail->num, sizeof(Tint), num_comp ); - name_tail->num = TelRemdupnames( name_tail->ptr, name_tail->num ); - - return TSuccess; -} - -/*----------------------------------------------------------------------*/ - -TStatus -TglNamesetRemove( Tint num, Tint *set ) -{ - Tint size, *ptr, *temp; - register Tint i, j, k, *prev; - - if (_NodeStack.IsEmpty()) - return TFailure; - - tgl_nameset_node name_tail = _NodeStack.ChangeTop(); - - if( !name_tail || !name_tail->ptr || !num ) - return TFailure; - - ptr = new Tint[name_tail->siz]; - if( !ptr ) - return TFailure; - - size = num, size %= LIST_GROW_SIZE, size++, size *= LIST_GROW_SIZE; - temp = new Tint[size]; - if( !temp ) - return TFailure; - memcpy( temp, set, num*sizeof(Tint) ); - - /* sort new set */ - qsort( temp, num, sizeof(Tint), num_comp ); - num = TelRemdupnames( temp, num ); - - prev = name_tail->ptr; - i = j = k = 0; - while(1) - { - if( prev[i] < temp[j] ) - ptr[k++] = prev[i++]; - else if( prev[i] > temp[j] ) - j++; - else /* prev[i] == temp[j] */ - i++, j++; - if( i == name_tail->num ) - break; - if( j == num ) - { - while( i < name_tail->num ) - ptr[k++] = prev[i++]; - break; - } - } - //cmn_freemem( temp ); - delete[] temp; - //cmn_freemem( name_tail->ptr ); - delete[] name_tail->ptr; - - name_tail->ptr = ptr; - name_tail->num = k; - - return TSuccess; -} - -/*----------------------------------------------------------------------*/ - -static Tint -find( Tint num1, Tint *array1, Tint num2, Tint *array2 ) -{ - Tint i=0, j=0; - - while(num1 && num2) - { - if( array1[i] < array2[j] ) - i++; - else if( array1[i] > array2[j] ) - j++; - else - return 1; - - if( i == num1 || j == num2 ) - return 0; - } - return 0; -} - -/*----------------------------------------------------------------------*/ - -TStatus -TglFilterNameset( Tint wsid, TFilterSet set ) -{ - tgl_filters filter; - if (_NodeStack.IsEmpty()) - return TFailure; - - tgl_nameset_node name_tail = _NodeStack.ChangeTop(); - - filter = getfiltrec( wsid ); - if( !filter ) - return TFailure; - - switch( set ) - { - case InvisFilter: - { - if( find( filter->invis_excl_num, filter->invis_excl_lis, - name_tail->num, name_tail->ptr ) ) - return TFailure; - - if( find( filter->invis_incl_num, filter->invis_incl_lis, - name_tail->num, name_tail->ptr ) ) - return TSuccess; - - break; - } - - case HighlFilter: - { - if( find( filter->highl_excl_num, filter->highl_excl_lis, - name_tail->num, name_tail->ptr ) ) - return TFailure; - - if( find( filter->highl_incl_num, filter->highl_incl_lis, - name_tail->num, name_tail->ptr ) ) - return TSuccess; - - break; - } - - case PickFilter: - { - if( find( filter->pick_excl_num, filter->pick_excl_lis, - name_tail->num, name_tail->ptr ) ) - return TFailure; - - if( find( filter->pick_incl_num, filter->pick_incl_lis, - name_tail->num, name_tail->ptr ) ) - return TSuccess; - - break; - } - } - - return TFailure; -} - -/*----------------------------------------------------------------------*/ - -TStatus -TglDeleteFiltersForWS( Tint wsid ) -{ - CMN_KEY_DATA key; - tgl_filters f; - - TsmGetWSAttri( wsid, WSFilters, &key ); - f = (tgl_filters)key.pdata; - - if( !f ) - return TSuccess; - - if( f->invis_incl_siz ) - //cmn_freemem( f->invis_incl_lis ); - delete[] f->invis_incl_lis; - if( f->pick_incl_siz ) - //cmn_freemem( f->pick_incl_lis ); - delete[] f->pick_incl_lis; - if( f->highl_incl_siz ) - //cmn_freemem( f->highl_incl_lis ); - delete[] f->highl_incl_lis; - if( f->invis_excl_siz ) - //cmn_freemem( f->invis_excl_lis ); - delete[] f->invis_excl_lis; - if( f->pick_excl_siz ) - //cmn_freemem( f->pick_excl_lis ); - delete[] f->pick_excl_lis; - if( f->highl_excl_siz ) - //cmn_freemem( f->highl_excl_lis ); - delete[] f->highl_excl_lis; - - //cmn_stg_tbl_free( f ); - delete f; - return TSuccess; -} - -/*----------------------------------------------------------------------*/ diff --git a/src/OpenGl/OpenGl_funcs.cxx b/src/OpenGl/OpenGl_funcs.cxx deleted file mode 100755 index a49b937093..0000000000 --- a/src/OpenGl/OpenGl_funcs.cxx +++ /dev/null @@ -1,1386 +0,0 @@ -/*********************************************************************** - -FONCTION : ----------- -File OpenGl_funcs : - - -REMARQUES: ----------- - - -HISTORIQUE DES MODIFICATIONS : --------------------------------- -xx-xx-xx : xxx ; Creation. -20-02-96 : FMN ; Suppression code inutile: -11-03-96 : FMN ; Correction warning compilation -01-04-96 : CAL ; Integration MINSK portage WNT -13-06-96 : CAL ; Gestion de la transparence dans redraw_all_structs -09-07-97 : FMN ; Verification calcul matrice orientation et projection. -Je n'ai verifie que le mode parallele pas le mode perspective. -18-07-97 : FMN ; Desactivation des lights au demarrage -05-08-97 : PCT ; Support texture mapping -19-08-97 : PCT ; ajout reflexion -23-12-97 : FMN ; Suppression TelBackInteriorStyle, TelBackInteriorStyleIndex -et TelBackInteriorShadingMethod -13-01-98 : FMN ; Oublie printf -03-03-98 : FMN ; Suppression variable externe TglWhetherPerspective -13-03-98 : FMN ; Suppression variable externe TglUpdateView0 -17-03-98 : FMN ; Ajout mode animation -- deplacement TelSetViewIndex de OpenGl_execstruct.c ici. -- gestion du mode animation. -29-04-98 : FMN ; Mode animation -- ajout TsmPushAttri et TsmPopAttri necessaire pour -sauvegarder la point de vue. -- ajout init de la var TglActiveWs -08-07-98 : FMN ; Mode animation: ajout print debug -27-11-98 : CAL ; S4062. AJout des layers. -30-11-98 : FMN ; S3819 : Textes toujours visibles -14-12-98 : BGN ; (S3989, Phase "triedre") ajout du reaffichage -du triedre . -05-01-99 : CAL ; Warning WNT -22-03-04 : SAN ; OCC4895 High-level interface for controlling polygon offsets - -************************************************************************/ - -#define G003 /* EUG 20-09-99 ; Animation management -*/ - - -/*----------------------------------------------------------------------*/ -/* -* Includes -*/ - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#ifdef G003 -# include -#endif /* G003 */ - -#if defined(WNT) -#include -#endif - -#include -/*----------------------------------------------------------------------*/ -/* -* Constantes -*/ - -#define NO_PRINT -#define NO_DEBUG -#define NO_DEBUG_ANIMATION - -#define EPSI 0.0001 - -/*----------------------------------------------------------------------*/ -/* -* Variables externes -*/ - -tsm_trsf_stack trsf_stack = NULL; -tsm_trsf_stack cur_trsf_stack = NULL; - -Tint ForbidSetTextureMapping; /* valid only during traversal */ -Tint SecondPassNeeded; /* valid only during traversal */ -Tint SecondPassDo; /* valid only during traversal */ - -#ifdef G003 -extern GLboolean g_fUpdateAM; -extern GLboolean g_fList; -int g_nBackfacing; -#endif /* G003 */ - - -/*----------------------------------------------------------------------*/ -/* -* Prototypes -*/ - -static void call_util_apply_trans2( float ix, float iy, float iz, matrix3 mat, - float *ox, float *oy, float *oz ); -static void call_util_mat_mul( matrix3 mat_a, matrix3 mat_b, matrix3 mat_c); - -#ifdef DEBUG -static void pr_matrix( matrix3 mat ); -#endif - -/*----------------------------------------------------------------------*/ -/* -* Fonctions externes -*/ - -void -call_func_set_text_style(int lid) -{ - CMN_KEY key; - - key.data.ldata = lid; - TsmAddToStructure( TelTextStyle, 1, &key ); - return; -} - -/*----------------------------------------------------------------------*/ - -void -call_func_set_text_display_type(int lid) -{ - CMN_KEY key; - - key.data.ldata = lid; - TsmAddToStructure( TelTextDisplayType, 1, &key ); - return; -} - -/*----------------------------------------------------------------------*/ - - -/*----------------------------------------------------------------------*/ - -void -call_func_label(Tint lid) -{ - CMN_KEY key; - - key.data.ldata = lid; - TsmAddToStructure( TelLabel, 1, &key ); - return; -} - -/*----------------------------------------------------------------------*/ - -void -call_func_appl_data(void *ptr) -{ - CMN_KEY key; - - key.data.pdata = ptr; - TsmAddToStructure( TelApplicationData, 1, &key ); - return; -} - -/*----------------------------------------------------------------------*/ - -void -call_func_set_view_ind(Tint vid) -{ - CMN_KEY key; - - key.data.ldata = vid; - TsmAddToStructure( TelViewIndex, 1, &key ); - return; -} - -/*----------------------------------------------------------------------*/ - -void -call_func_set_local_tran3( Tmatrix3 mat, TComposeType mode ) -{ - CMN_KEY key; - - key.id = mode; - key.data.pdata = mat; - TsmAddToStructure( TelLocalTran3, 1, &key ); - return; -} - -/*----------------------------------------------------------------------*/ - -void -call_func_set_linewidth( Tfloat lw ) -{ - CMN_KEY key; - - key.data.fdata = lw; - TsmAddToStructure( TelPolylineWidth, 1, &key ); - return; -} - -/*----------------------------------------------------------------------*/ - -void -call_func_set_linetype( Tint lt ) -{ - CMN_KEY key; - - key.data.ldata = lt; - TsmAddToStructure( TelPolylineType, 1, &key ); - return; -} - -/*----------------------------------------------------------------------*/ - -void -call_func_set_edge_type( Tint lt ) -{ - CMN_KEY key; - - key.data.ldata = lt; - TsmAddToStructure( TelEdgeType, 1, &key ); - return; -} - -/*----------------------------------------------------------------------*/ - -void -call_func_set_int_style( Tint is ) -{ - CMN_KEY key; - - key.data.ldata = is; - TsmAddToStructure( TelInteriorStyle, 1, &key ); - return; -} - -/*----------------------------------------------------------------------*/ - -void -call_func_set_edge_flag( Tint st ) -{ - CMN_KEY key; - - key.data.ldata = st; - TsmAddToStructure( TelEdgeFlag, 1, &key ); - - return; -} - -/*----------------------------------------------------------------------*/ - -void -call_func_set_edgewidth( Tfloat ew ) -{ - CMN_KEY key; - - key.data.fdata = ew; - TsmAddToStructure( TelEdgeWidth, 1, &key ); - return; -} - -/*----------------------------------------------------------------------*/ - -void -call_func_set_int_style_ind( Tint ind ) -{ - CMN_KEY key; - - key.data.ldata = ind; - TsmAddToStructure( TelInteriorStyleIndex, 1, &key ); - return; -} - -/*----------------------------------------------------------------------*/ - -void -call_func_set_face_disting_mode( Tint mode ) -{ - CMN_KEY key; - - key.data.ldata = mode; - TsmAddToStructure( TelFaceDistinguishingMode, 1, &key ); - return; -} - -/*----------------------------------------------------------------------*/ - -void -call_func_set_face_cull_mode( Tint mode ) -{ - CMN_KEY key; - - key.data.ldata = mode; - TsmAddToStructure( TelFaceCullingMode, 1, &key ); - return; -} - -/*----------------------------------------------------------------------*/ - -void -call_func_set_marker_type( Tint type ) -{ - CMN_KEY key; - - key.data.ldata = type; - TsmAddToStructure( TelPolymarkerType, 1, &key ); - - return; -} - -/*----------------------------------------------------------------------*/ - -void -call_func_set_marker_size( Tfloat size ) -{ - CMN_KEY key; - - key.data.fdata = size; - TsmAddToStructure( TelPolymarkerSize, 1, &key ); - - return; -} - -/*----------------------------------------------------------------------*/ - -void -call_func_exec_struct(Tint stid) -{ - CMN_KEY key; - - key.data.ldata = stid; - TsmAddToStructure( TelExecuteStructure, 1, &key ); - return; -} - -/*----------------------------------------------------------------------*/ - -void -call_func_init_tgl() -{ - TelHookOnAllClasses(); - return; -} - -/*----------------------------------------------------------------------*/ - -void /* Ignoring priority */ -call_func_post_struct( Tint ws, Tint stid, Tfloat priority ) -{ - CMN_KEY_DATA k; - - k.ldata = stid; - TsmSetWSAttri( ws, WSViewStid, &k ); - return; -} - -/*----------------------------------------------------------------------*/ - -void -call_func_set_int_shad_meth(Tint mtd) -{ - CMN_KEY key; - - key.data.ldata = mtd; - TsmAddToStructure( TelInteriorShadingMethod, 1, &key ); - return; -} - -/*----------------------------------------------------------------------*/ - -void -call_func_set_refl_eqn( Tint eqn ) -{ - CMN_KEY key; - - key.data.ldata = eqn; - TsmAddToStructure( TelInteriorReflectanceEquation, 1, &key ); - return; -} - -/*----------------------------------------------------------------------*/ - -void -call_func_set_back_refl_eqn( Tint eqn ) -{ - CMN_KEY key; - - key.data.ldata = eqn; - TsmAddToStructure( TelBackInteriorReflectanceEquation, 1, &key ); - return; -} - -/*----------------------------------------------------------------------*/ - -void -call_func_set_text_font( Tchar *font ) -{ - CMN_KEY key; - - - key.data.pdata = font; - TsmAddToStructure( TelTextFont, 1, &key ); - return; -} - -/*----------------------------------------------------------------------*/ - -void -call_func_set_char_space( Tfloat sp ) -{ - CMN_KEY key; - - key.data.fdata = sp; - TsmAddToStructure( TelCharacterSpacing, 1, &key ); - return; -} - -/*----------------------------------------------------------------------*/ - -void -call_func_set_char_expan( Tfloat exp ) -{ - CMN_KEY key; - - key.data.fdata = exp; - TsmAddToStructure( TelCharacterExpansionFactor, 1, &key ); - return; -} - -/*----------------------------------------------------------------------*/ - - - -void -call_func_set_text_zoomable( Tint flag ) -{ - CMN_KEY key; - - key.data.ldata = flag; - TsmAddToStructure( TelTextZoomable, 1, &key ); - return; -} - -/*----------------------------------------------------------------------*/ - - -void -call_func_set_text_angle( Tfloat angl ) -{ - CMN_KEY key; - - key.data.ldata = angl; - TsmAddToStructure( TelTextAngle, 1, &key ); - return; -} - -/*----------------------------------------------------------------------*/ - - -void -call_func_set_text_fontaspect( OSD_FontAspect fontaspect ) -{ - CMN_KEY key; - - key.data.ldata = fontaspect; - TsmAddToStructure( TelTextFontAspect, 1, &key ); - return; -} - - - -/*----------------------------------------------------------------------*/ - -/* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */ -void call_func_set_polygon_offset_params( Tint mode, Tfloat factor, Tfloat units ) -{ - CMN_KEY key; - TEL_POFFSET_PARAM param; - - param.mode = mode; - param.factor = factor; - param.units = units; - - key.data.pdata = ¶m; - TsmAddToStructure( TelPolygonOffset, 1, &key ); -} -/* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */ - -/*----------------------------------------------------------------------*/ - -void -call_func_set_pick_id(Tint pid) -{ - CMN_KEY key; - - key.data.ldata = pid; - TsmAddToStructure( TelPickId, 1, &key ); - return; -} -/*----------------------------------------------------------------------*/ - -static void redraw_all_structs( Tint wsid, Tint vstid ) -{ - CMN_KEY_DATA k; - GLint blend_dst, blend_src; - GLboolean blend_state; - GLint zbuff_f; - GLboolean zbuff_state, zbuff_w; - - /* Est-il necessaire de faire de la transparence ? */ - TsmGetWSAttri( wsid, WSTransparency, &k ); - TelSetTransparency( k.ldata ); - - /* ajout PCT pour gestion des textures */ - TsmGetWSAttri(wsid, WSSurfaceDetail, &k); - switch (k.ldata) - { - /* TOD_NONE */ - case 0: - ForbidSetTextureMapping = 1; - SecondPassNeeded = 0; - SecondPassDo = 0; - DisableTexture(); - TsmDisplayStructure( vstid, wsid ); - break; - - /* TOD_ENVIRONMENT */ - case 1: - ForbidSetTextureMapping = 1; - SecondPassNeeded = 0; - SecondPassDo = 0; - TsmGetWSAttri(wsid, WSTextureEnv, &k); - SetCurrentTexture(k.ldata); - EnableTexture(); - TsmDisplayStructure( vstid, wsid ); - DisableTexture(); - break; - - /* TOD_ALL */ - case 2: - /* premiere passe */ - ForbidSetTextureMapping = 0; - SecondPassNeeded = 0; - SecondPassDo = 0; - TsmDisplayStructure( vstid, wsid ); - DisableTexture(); - - /* deuxieme passe */ - if (SecondPassNeeded) - { - SecondPassDo = 1; - TsmGetWSAttri(wsid, WSTextureEnv, &k); - SetCurrentTexture(k.ldata); - EnableTexture(); - - /* sauvegarde de quelques parametres OpenGL */ - glGetBooleanv(GL_DEPTH_WRITEMASK, &zbuff_w); - glGetIntegerv(GL_DEPTH_FUNC, &zbuff_f); - glGetIntegerv(GL_BLEND_DST, &blend_dst); - glGetIntegerv(GL_BLEND_SRC, &blend_src); - zbuff_state = glIsEnabled(GL_DEPTH_TEST); - blend_state = glIsEnabled(GL_BLEND); - - - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - - glDepthFunc(GL_EQUAL); - glDepthMask(GL_FALSE); - glEnable(GL_DEPTH_TEST); - - ForbidSetTextureMapping = 1; - TsmDisplayStructure(vstid, wsid ); - DisableTexture(); - - /* restauration des parametres OpenGL */ - glBlendFunc(blend_src, blend_dst); - if (!blend_state) glDisable(GL_BLEND); - - glDepthFunc(zbuff_f); - glDepthMask(zbuff_w); - if (!zbuff_state) glDisable(GL_DEPTH_FUNC); - } - break; - } -} - -/*----------------------------------------------------------------------*/ - -void -call_func_redraw_all_structs( Tint wsid, Tint swap ) -{ - call_func_redraw_all_structs_begin (wsid); - call_func_redraw_all_structs_proc (wsid); - call_func_redraw_all_structs_end (wsid, swap); - return; -} - -/*----------------------------------------------------------------------*/ - -void -call_func_set_anno_char_ht( Tfloat h ) -{ - CMN_KEY key; - - key.data.fdata = h; - TsmAddToStructure( TelTextHeight, 1, &key ); - return; -} - -/*----------------------------------------------------------------------*/ - -void /* unimplemented */ -call_func_set_anno_char_up_vec( Tfloat path[2] ) -{ - return; -} - -/*----------------------------------------------------------------------*/ - -void /* unimplemented */ -call_func_set_anno_path( Tint path ) -{ - return; -} - -/*----------------------------------------------------------------------*/ - - -void /* unimplemented */ -call_func_set_anno_align( Tint hor, Tint ver ) -{ - /*OCC7456 abd 14.12.2004 Text alingnment attributes */ - CMN_KEY k; - TEL_ALIGN_DATA data; - data.Hmode = hor; - data.Vmode = ver; - k.data.pdata = &data; - - TsmAddToStructure( TelTextAlign, 1, &k ); - /*OCC7456 abd 14.12.2004 Text alingnment attributes */ - - return; -} - -/*----------------------------------------------------------------------*/ - -void -call_func_anno_text_rel3( tel_point pt, Techar *str ) -{ - CMN_KEY k[2]; - - k[0].id = TEXT_ATTACH_PT_ID; - k[0].data.pdata = pt; - k[1].id = TEXT_STRING_ID; - k[1].data.pdata = str; - TsmAddToStructure( TelText, 2, &k[0], &k[1] ); - - return; -} - -/*----------------------------------------------------------------------*/ - -void -call_func_dcue_ind(Tint dcid) -{ - CMN_KEY key; - - key.data.ldata = dcid; - TsmAddToStructure( TelDepthCueIndex, 1, &key ); - return; -} - -/*----------------------------------------------------------------------*/ - -void -call_func_set_texture_id(Tint dcid) -{ - CMN_KEY key; - - key.data.ldata = dcid; - TsmAddToStructure( TelTextureId, 1, &key ); - return; -} - -/*----------------------------------------------------------------------*/ - -void -call_func_set_do_texturemap(Tint dcid) -{ - CMN_KEY key; - - key.data.ldata = dcid; - TsmAddToStructure( TelDoTextureMap, 1, &key ); - return; -} - -/*----------------------------------------------------------------------*/ - -#define EPSI 0.0001 - -#ifdef DEBUG -static void -pr_matrix( matrix3 mat ) -{ - printf( "%1.12f %1.12f %1.12f %1.12f\n", mat[0][0], mat[0][1], mat[0][2], mat[0][3] ); - printf( "%1.12f %1.12f %1.12f %1.12f\n", mat[1][0], mat[1][1], mat[1][2], mat[1][3] ); - printf( "%1.12f %1.12f %1.12f %1.12f\n", mat[2][0], mat[2][1], mat[2][2], mat[2][3] ); - printf( "%1.12f %1.12f %1.12f %1.12f\n", mat[3][0], mat[3][1], mat[3][2], mat[3][3] ); - printf( "\n" ); - return; -} -#endif - -/* -* Evaluates orientation matrix. -*/ -/* OCC18942: obsolete in OCCT6.3, might be removed in further versions! */ -void call_func_eval_ori_matrix3 ( - point3 *vrp, /* view reference point */ - vec3 *vpn, /* view plane normal */ - vec3 *vup, /* view up vector */ - int *err_ind, - float mout[4][4]) /* OUT view orientation matrix */ -{ - - /* Translate to VRP then change the basis. - * The old basis is: e1 = < 1, 0, 0>, e2 = < 0, 1, 0>, e3 = < 0, 0, 1>. - * The new basis is: ("x" means cross product) - * e3' = VPN / |VPN| - * e1' = VUP x VPN / |VUP x VPN| - * e2' = e3' x e1' - * Therefore the transform from old to new is x' = TAx, where: - * - * | e1'x e2'x e3'x 0 | | 1 0 0 0 | - * A = | e1'y e2'y e3'y 0 |, T = | 0 1 0 0 | - * | e1'z e2'z e3'z 0 | | 0 0 1 0 | - * | 0 0 0 1 | | -vrp.x -vrp.y -vrp.z 1 | - * - */ - - /* - * These ei's are really ei primes. - */ - register float (*m)[4][4]; - point3 e1, e2, e3, e4; - double s, v; - - /* - * e1' = VUP x VPN / |VUP x VPN|, but do the division later. - */ - e1.x = vup->delta_y * vpn->delta_z - vup->delta_z * vpn->delta_y; - e1.y = vup->delta_z * vpn->delta_x - vup->delta_x * vpn->delta_z; - e1.z = vup->delta_x * vpn->delta_y - vup->delta_y * vpn->delta_x; - s = sqrt( e1.x * e1.x + e1.y * e1.y + e1.z * e1.z); - e3.x = vpn->delta_x; - e3.y = vpn->delta_y; - e3.z = vpn->delta_z; - v = sqrt( e3.x * e3.x + e3.y * e3.y + e3.z * e3.z); - /* - * Check for vup and vpn colinear (zero dot product). - */ - if ((s > -EPSI) && (s < EPSI)) - *err_ind = 2; - else - /* - * Check for a normal vector not null. - */ - if ((v > -EPSI) && (v < EPSI)) - *err_ind = 3; - else { - /* - * Normalize e1 - */ - e1.x /= ( float )s; - e1.y /= ( float )s; - e1.z /= ( float )s; - /* - * e3 = VPN / |VPN| - */ - e3.x /= ( float )v; - e3.y /= ( float )v; - e3.z /= ( float )v; - /* - * e2 = e3 x e1 - */ - e2.x = e3.y * e1.z - e3.z * e1.y; - e2.y = e3.z * e1.x - e3.x * e1.z; - e2.z = e3.x * e1.y - e3.y * e1.x; - /* - * Add the translation - */ - e4.x = -( e1.x * vrp->x + e1.y * vrp->y + e1.z * vrp->z); - e4.y = -( e2.x * vrp->x + e2.y * vrp->y + e2.z * vrp->z); - e4.z = -( e3.x * vrp->x + e3.y * vrp->y + e3.z * vrp->z); - /* - * Homogeneous entries - * - * | e1.x e2.x e3.x 0.0 | | 1 0 0 0 | - * | e1.y e2.y e3.y 0.0 | * | 0 1 0 0 | - * | e1.z e2.z e3.z 0.0 | | a b 1 c | - * | e4.x e4.y e4.z 1.0 | | 0 0 0 1 | - */ - - m = (float (*)[4][4])mout; - - (*m)[0][0] = e1.x; - (*m)[0][1] = e2.x; - (*m)[0][2] = e3.x; - (*m)[0][3] = ( float )0.0; - - (*m)[1][0] = e1.y; - (*m)[1][1] = e2.y; - (*m)[1][2] = e3.y; - (*m)[1][3] = ( float )0.0; - - (*m)[2][0] = e1.z; - (*m)[2][1] = e2.z; - (*m)[2][2] = e3.z; - (*m)[2][3] = ( float )0.0; - - (*m)[3][0] = e4.x; - (*m)[3][1] = e4.y; - (*m)[3][2] = e4.z; - (*m)[3][3] = ( float )1.0; - - *err_ind = 0; - -#ifdef DEBUG - printf( "\n->call_func_eval_ori_matrix3 \n" ); - printf( "orientation_matrix :\n" ); - pr_matrix(mout); -#endif - } -} - -/*----------------------------------------------------------------------*/ -/* -* Evaluates mapping matrix. -*/ -/* OCC18942: obsolete in OCCT6.3, might be removed in further versions! */ -void call_func_eval_map_matrix3( - view_map3 *Map, - int *err_ind, - matrix3 mat) -{ - int i, j; - matrix3 Tpar, Spar; - matrix3 Tper, Sper; - matrix3 Shear; - matrix3 Scale; - matrix3 Tprp; - matrix3 aux_mat1, aux_mat2, aux_mat3; - point3 Prp; - - *err_ind = 0; - for (i=0; i<4; i++) - for (j=0; j<4; j++) - Spar[i][j] = Sper[i][j] = aux_mat1[i][j] = aux_mat2[i][j] = - aux_mat3[i][j] = Tper[i][j] = Tpar[i][j] = Tprp[i][j] = - Shear[i][j] = Scale[i][j] = ( float )(i == j); - - Prp.x = Map->proj_ref_point.x; - Prp.y = Map->proj_ref_point.y; - Prp.z = Map->proj_ref_point.z; - - /* - * Type Parallele - */ - if (Map->proj_type == TYPE_PARAL) - { - float umid, vmid; - point3 temp; - -#ifdef FMN - float cx, cy, gx, gy, xsf, ysf, zsf; - float fpd, bpd; - float dopx, dopy, dopz; - matrix3 tmat = { { ( float )1.0, ( float )0.0, ( float )0.0, ( float )0.0 }, - { ( float )0.0, ( float )1.0, ( float )0.0, ( float )0.0 }, - { ( float )0.0, ( float )0.0, ( float )1.0, ( float )0.0 }, - { ( float )0.0, ( float )0.0, ( float )0.0, ( float )1.0 } }; - matrix3 smat = { { ( float )1.0, ( float )0.0, ( float )0.0, ( float )0.0 }, - { ( float )0.0, ( float )1.0, ( float )0.0, ( float )0.0 }, - { ( float )0.0, ( float )0.0, ( float )1.0, ( float )0.0 }, - { ( float )0.0, ( float )0.0, ( float )0.0, ( float )1.0 } }; - matrix3 shmat = { { ( float )1.0, ( float )0.0, ( float )0.0, ( float )0.0 }, - { ( float )0.0, ( float )1.0, ( float )0.0, ( float )0.0 }, - { ( float )0.0, ( float )0.0, ( float )1.0, ( float )0.0 }, - { ( float )0.0, ( float )0.0, ( float )0.0, ( float )1.0 } }; - matrix3 tshmat = { { ( float )1.0, ( float )0.0, ( float )0.0, ( float )0.0 }, - { ( float )0.0, ( float )1.0, ( float )0.0, ( float )0.0 }, - { ( float )0.0, ( float )0.0, ( float )1.0, ( float )0.0 }, - { ( float )0.0, ( float )0.0, ( float )0.0, ( float )1.0 } }; - - /* centers */ - cx = Map->win.x_min + Map->win.x_max, cx /= ( float )2.0; - cy = Map->win.y_min + Map->win.y_max, cy /= ( float )2.0; - - gx = 2.0/ (Map->win.x_max - Map->win.x_min); - gy = 2.0/ (Map->win.y_max - Map->win.y_min); - - tmat[0][3] = -cx; - tmat[1][3] = -cy; - tmat[2][3] = (Map->front_plane + Map->back_plane)/(Map->front_plane - Map->back_plane); - - smat[0][0] = gx; - smat[1][1] = gy; - smat[2][2] = -2./(Map->front_plane - Map->back_plane); - - /* scale factors */ - dopx = cx - Prp.x; - dopy = cy - Prp.y; - dopz = - Prp.z; - - /* map matrix */ - shmat[0][2] = -(dopx/dopz); - shmat[1][2] = -(dopy/dopz); - - /* multiply to obtain mapping matrix */ - call_util_mat_mul( tmat, shmat, tshmat ); - call_util_mat_mul( smat, tshmat, mat ); - -#ifdef DEBUG - printf( "\n->call_func_eval_map_matrix3 FMN\n" ); - printf("prp %f %f %f \n", Prp.x, Prp.y, Prp.z); - printf("vpd fpd bpd %f %f %f \n", Map->view_plane, Map->front_plane, Map->back_plane); - printf("window limits %f %f %f %f\n", Map->win.x_min, Map->win.x_max, - Map->win.y_min, Map->win.y_max); - printf( "mapping_matrix :\n" ); - pr_matrix(mat); -#endif - return; -#endif - - /* CAL */ - Map->proj_vp.z_min = ( float )0.0; - Map->proj_vp.z_max = ( float )1.0; - /* CAL */ - - /* Shear matrix calculation */ - umid = ( float )(Map->win.x_min+Map->win.x_max)/( float )2.0; - vmid = ( float )(Map->win.y_min+Map->win.y_max)/( float )2.0; - if(Prp.z == Map->view_plane){ - /* Projection reference point is on the view plane */ - *err_ind = 1; - return; - } - Shear[2][0] = ( float )(-1.0) * ((Prp.x-umid)/(Prp.z-Map->view_plane)); - Shear[2][1] = ( float )(-1.0) * ((Prp.y-vmid)/(Prp.z-Map->view_plane)); - - /* - * Calculate the lower left coordinate of the view plane - * after the Shearing Transformation. - */ - call_util_apply_trans2(Map->win.x_min, Map->win.y_min, - Map->view_plane, Shear, &(temp.x), &(temp.y), &(temp.z)); - - /* Translate the back plane to the origin */ - Tpar[3][0] = ( float )(-1.0) * temp.x; - Tpar[3][1] = ( float )(-1.0) * temp.y; - Tpar[3][2] = ( float )(-1.0) * Map->back_plane; - - call_util_mat_mul(Shear, Tpar, aux_mat1); - - /* Calculation of Scaling transformation */ - Spar[0][0] = ( float )1.0 / (Map->win.x_max - Map->win.x_min); - Spar[1][1] = ( float )1.0 / (Map->win.y_max - Map->win.y_min); - Spar[2][2] = ( float )1.0 / (Map->front_plane - Map->back_plane ); - call_util_mat_mul (aux_mat1, Spar, aux_mat2); - /* Atlast we transformed view volume to NPC */ - - /* Translate and scale the view plane to projection view port */ - if(Map->proj_vp.x_min < 0.0 || Map->proj_vp.y_min < 0.0 || - Map->proj_vp.z_min < 0.0 || Map->proj_vp.x_max > 1.0 || - Map->proj_vp.y_max > 1.0 || Map->proj_vp.z_max > 1.0 || - Map->proj_vp.x_min > Map->proj_vp.x_max || - Map->proj_vp.y_min > Map->proj_vp.y_max || - Map->proj_vp.z_min > Map->proj_vp.z_max){ - *err_ind = 1; - return; - } - for(i=0; i<4; i++) - for(j=0; j<4; j++) - aux_mat1[i][j] = (float)(i==j); - aux_mat1[0][0] = Map->proj_vp.x_max-Map->proj_vp.x_min; - aux_mat1[1][1] = Map->proj_vp.y_max-Map->proj_vp.y_min; - aux_mat1[2][2] = Map->proj_vp.z_max-Map->proj_vp.z_min; - aux_mat1[3][0] = Map->proj_vp.x_min; - aux_mat1[3][1] = Map->proj_vp.y_min; - aux_mat1[3][2] = Map->proj_vp.z_min; - call_util_mat_mul (aux_mat2, aux_mat1, mat); - -#ifdef DEBUG - printf( "\n->call_func_eval_map_matrix3 - ORTHOGRAPHIC projection\n" ); - printf("prp %f %f %f \n", Prp.x, Prp.y, Prp.z); - printf("vpd fpd bpd %f %f %f \n", Map->view_plane, Map->front_plane, Map->back_plane); - printf("window limits %f %f %f %f\n", Map->win.x_min, Map->win.x_max, - Map->win.y_min, Map->win.y_max); - printf( "mapping_matrix :\n" ); - pr_matrix(mat); -#endif - - return; - } - - /* - * Type Perspective - */ - else if (Map->proj_type == TYPE_PERSPECT) - { - float umid, vmid; - float B, F, V; - float Zvmin; - - /* CAL */ - Map->proj_vp.z_min = ( float )0.0; - Map->proj_vp.z_max = ( float )1.0; - /* CAL */ - - B = Map->back_plane; - F = Map->front_plane; - V = Map->view_plane; - - if(Prp.z == Map->view_plane){ - /* Centre of Projection is on the view plane */ - *err_ind = 1; - return; - } - if(Map->proj_vp.x_min < 0.0 || Map->proj_vp.y_min < 0.0 || - Map->proj_vp.z_min < 0.0 || Map->proj_vp.x_max > 1.0 || - Map->proj_vp.y_max > 1.0 || Map->proj_vp.z_max > 1.0 || - Map->proj_vp.x_min > Map->proj_vp.x_max || - Map->proj_vp.y_min > Map->proj_vp.y_max || - Map->proj_vp.z_min > Map->proj_vp.z_max || - F < B){ - *err_ind = 1; - return; - } - - /* This is the transformation to move VRC to Center Of Projection */ - Tprp[3][0] = ( float )(-1.0)*Prp.x; - Tprp[3][1] = ( float )(-1.0)*Prp.y; - Tprp[3][2] = ( float )(-1.0)*Prp.z; - - /* Calculation of Shear matrix */ - umid = ( float )(Map->win.x_min+Map->win.x_max)/( float )2.0-Prp.x; - vmid = ( float )(Map->win.y_min+Map->win.y_max)/( float )2.0-Prp.y; - Shear[2][0] = ( float )(-1.0)*umid/(Map->view_plane-Prp.z); - Shear[2][1] = ( float )(-1.0)*vmid/(Map->view_plane-Prp.z); - call_util_mat_mul(Tprp, Shear, aux_mat3); - - /* Scale the view volume to canonical view volume - * Centre of projection at origin. - * 0 <= N <= -1, -0.5 <= U <= 0.5, -0.5 <= V <= 0.5 - */ - Scale[0][0] = (( float )(-1.0)*Prp.z+V)/ - ((Map->win.x_max-Map->win.x_min)*(( float )(-1.0)*Prp.z+B)); - Scale[1][1] = (( float )(-1.0)*Prp.z+V)/ - ((Map->win.y_max-Map->win.y_min)*(( float )(-1.0)*Prp.z+B)); - Scale[2][2] = ( float )(-1.0) / (( float )(-1.0)*Prp.z+B); - - call_util_mat_mul(aux_mat3, Scale, aux_mat1); - - /* - * Transform the Perspective view volume into - * Parallel view volume. - * Lower left coordinate: (-0.5,-0.5, -1) - * Upper right coordinate: (0.5, 0.5, 1.0) - */ - Zvmin = ( float )(-1.0*(-1.0*Prp.z+F)/(-1.0*Prp.z+B)); - aux_mat2[2][2] = ( float )1.0/(( float )1.0+Zvmin); - aux_mat2[2][3] = ( float )(-1.0); - aux_mat2[3][2] = ( float )(-1.0)*Zvmin*aux_mat2[2][2]; - aux_mat2[3][3] = ( float )0.0; - call_util_mat_mul(aux_mat1, aux_mat2, Shear); - - for(i=0; i<4; i++) - for(j=0; j<4; j++) - aux_mat1[i][j] = aux_mat2[i][j] = (float)(i==j); - - /* Translate and scale the view plane to projection view port */ - aux_mat2[0][0] = (Map->proj_vp.x_max-Map->proj_vp.x_min); - aux_mat2[1][1] = (Map->proj_vp.y_max-Map->proj_vp.y_min); - aux_mat2[2][2] = (Map->proj_vp.z_max-Map->proj_vp.z_min); - aux_mat2[3][0] = aux_mat2[0][0]/( float )2.0+Map->proj_vp.x_min; - aux_mat2[3][1] = aux_mat2[1][1]/( float )2.0+Map->proj_vp.y_min; - aux_mat2[3][2] = aux_mat2[2][2]+Map->proj_vp.z_min; - call_util_mat_mul (Shear, aux_mat2, mat); - -#ifdef DEBUG - printf( "\n->call_func_eval_map_matrix3 - PERSPECTIVE projection\n" ); - printf("prp %f %f %f \n", Prp.x, Prp.y, Prp.z); - printf("vpd fpd bpd %f %f %f \n", Map->view_plane, Map->front_plane, Map->back_plane); - printf("window limits %f %f %f %f\n", Map->win.x_min, Map->win.x_max, - Map->win.y_min, Map->win.y_max); - printf("viewport limits %f %f %f %f %f %f\n", Map->proj_vp.x_min, Map->proj_vp.x_max, - Map->proj_vp.y_min, Map->proj_vp.y_max, - Map->proj_vp.z_min, Map->proj_vp.z_max); - printf( "mapping_matrix :\n" ); - pr_matrix(mat); -#endif - - return; - } - else - *err_ind = 1; -} - -/*----------------------------------------------------------------------*/ - -static void -call_util_apply_trans2( float ix, float iy, float iz, matrix3 mat, - float *ox, float *oy, float *oz ) -{ - float temp; - *ox = ix*mat[0][0]+iy*mat[1][0]+iz*mat[2][0]+mat[3][0]; - *oy = ix*mat[0][1]+iy*mat[1][1]+iz*mat[2][1]+mat[3][1]; - *oz = ix*mat[0][2]+iy*mat[1][2]+iz*mat[2][2]+mat[3][2]; - temp = ix * mat[0][3]+iy * mat[1][3]+iz * mat[2][3]+mat[3][3]; - *ox /= temp; - *oy /= temp; - *oz /= temp; -} - -/*----------------------------------------------------------------------*/ - -static void -call_util_mat_mul( matrix3 mat_a, matrix3 mat_b, matrix3 mat_c) -{ - int i, j, k; - - for (i=0; i<4; i++) - for (j=0; j<4; j++) - for (mat_c[i][j] = ( float )0.0,k=0; k<4; k++) - mat_c[i][j] += mat_a[i][k] * mat_b[k][j]; -} - -/*----------------------------------------------------------------------*/ - -void -call_func_redraw_all_structs_begin( Tint wsid ) -{ - - static Tmatrix3 identity = { - {( float )1.0, ( float )0.0, ( float )0.0, ( float )0.0}, - {( float )0.0, ( float )1.0, ( float )0.0, ( float )0.0}, - {( float )0.0, ( float )0.0, ( float )1.0, ( float )0.0}, - {( float )0.0, ( float )0.0, ( float )0.0, ( float )1.0} - }; - - /* - * Gestion de la pile des transformations pour les structures - * connectees dans la vue - */ - if (trsf_stack == NULL) { - trsf_stack = (tsm_trsf_stack) malloc (sizeof (TSM_TRSF_STACK)); - trsf_stack->next = NULL; - trsf_stack->prev = NULL; - matcpy (trsf_stack->LocalTran3, identity); - cur_trsf_stack = trsf_stack; - } - - TelClearViews(wsid); - - /* Par defaut on desactive les lumieres */ - LightOff(); - - return; -} - -/*----------------------------------------------------------------------*/ - -void -call_func_redraw_all_structs_proc( Tint wsid ) -{ - - CMN_KEY kk; - CMN_KEY_DATA k; -#ifdef G003 - CMN_KEY_DATA kbf; -#endif /* G003 */ - Tint vstid; - - TsmGetWSAttri( wsid, WSViewStid, &k ); -#ifdef G003 - TsmGetWSAttri ( wsid, WSBackfacing, &kbf ); - g_nBackfacing = kbf.ldata; - - if ( g_nBackfacing > 0 ) - - glDisable ( GL_CULL_FACE ); - - else if ( g_nBackfacing < 0 ) { - - glEnable ( GL_CULL_FACE ); - glCullFace ( GL_BACK ); - - } /* end if */ -#endif /* G003 */ - vstid = k.ldata; - if( vstid != -1 ) - { - -#ifdef PRINT - printf("OpenGl_funcs::call_func_redraw_all_structs:TsmPushAttri \n"); -#endif - TsmPushAttri(); /* save previous graphics context */ - - TglActiveWs = wsid; /* Indispensable precedemment dans TsmDisplayStructure */ - /* Avec le mode Ajout cette init n'etait plus faite */ - - /* mise en place des matrices de projection et de mapping */ - kk.id = TelViewIndex; - kk.data.ldata = vstid; - TsmSetAttri( 1, &kk ); - TelSetViewIndex (wsid, vstid); -#ifdef G003 - if ( g_fUpdateAM ) goto forceRedraw; -#endif /* G003 */ - /* Mode animation */ - if (animationFlag) - { - if ((listIndexFlag) && (listIndexView == vstid)) - { -#ifdef DEBUG_ANIMATION - printf("call_func_redraw_all_structs::glCallList1 \n"); -#endif - glCallList(listIndex); - } - else - { -#ifdef G003 - if ( !g_fList ) { - - g_fList = GL_TRUE; - goto forceRedraw; - - } /* end if */ -#endif /* G003 */ - -#ifdef DEBUG_ANIMATION - printf("call_func_redraw_all_structs::glNewList \n"); -#endif - glNewList(listIndex, GL_COMPILE_AND_EXECUTE); - redraw_all_structs( wsid, vstid ); -#ifdef DEBUG_ANIMATION - printf("call_func_redraw_all_structs::glEndList \n"); -#endif - glEndList(); - listIndexFlag = GL_TRUE; - listIndexView = vstid; - } - } - /* Mode normal */ - else - { - /* Optimisation si displaylist est toujours valable */ - if ((listIndexFlag) && (listIndexView == vstid)) - { -#ifdef DEBUG_ANIMATION - printf("call_func_redraw_all_structs::glCallList2 \n"); -#endif - glCallList(listIndex); - } - else - { -#ifdef DEBUG_ANIMATION - printf("call_func_redraw_all_structs::redraw_all_structs \n"); -#endif - -#ifdef G003 -forceRedraw: -#endif /* G003 */ - redraw_all_structs( wsid, vstid ); - } - } /* Mode Animation */ - -#ifdef PRINT - printf("OpenGl_funcs::call_func_redraw_all_structs:TsmPopAttri \n"); -#endif - /* restore previous graphics context; before update lights */ - TsmPopAttri(); - - - - /* affichage de Triedre Non Zoomable de la vue s'il existe */ -#ifdef PRINT - printf("call_func_redraw_all_structS => CALL_TRIEDRON... \n"); -#endif - call_triedron_redraw_from_wsid (wsid); - call_graduatedtrihedron_redraw(wsid); - - - } /* Test vue valide */ - - return; -} - -/*----------------------------------------------------------------------*/ - -void -call_func_redraw_all_structs_end( Tint wsid, Tint swap ) -{ - - /* CMN_KEY kk;*/ - CMN_KEY_DATA k; - Tint vstid; - - TsmGetWSAttri( wsid, WSViewStid, &k ); - vstid = k.ldata; - if( vstid != -1 ) - { - - /* On swap les buffers */ - TsmGetWSAttri( wsid, WSDbuff, &k ); - if( (k.ldata == TOn) && (swap) ) - TelSwapBuffers( wsid ); - else - TelFlush(0); - - } /* Test vue valide */ - - /* - * Mise a jour de l'update_state - */ - k.ldata = TDone; - TsmSetWSAttri( wsid, WSUpdateState, &k ); - - return; -} - -#ifdef G003 -void call_func_set_degenerate_model ( Tint model, Tfloat skipRatio ) { - - CMN_KEY key; - DEGENERATION deg; - - deg.mode = model; - deg.skipRatio = skipRatio; - - key.data.pdata = ° - TsmAddToStructure ( TelDegenerationMode, 1, &key ); - -} /* end call_func_set_degenerate_model */ -#endif /* G003 */ - - -void -call_func_set_transform_persistence( Tint mode, Tfloat x, Tfloat y, Tfloat z ) -{ - CMN_KEY key; - TEL_TRANSFORM_PERSISTENCE pers; - - pers.mode = mode; - - pers.pointX = x; - pers.pointY = y; - pers.pointZ = z; - - key.data.pdata = &pers; - TsmAddToStructure( TelTransformPersistence, 1, &key ); - return; -} -/* ABD 29/10/04 Transform Persistence of Presentation( pan, zoom, rotate ) */ diff --git a/src/OpenGl/OpenGl_graduatedtrihedron.hxx b/src/OpenGl/OpenGl_graduatedtrihedron.hxx deleted file mode 100644 index dda77d2f2a..0000000000 --- a/src/OpenGl/OpenGl_graduatedtrihedron.hxx +++ /dev/null @@ -1,29 +0,0 @@ -// File: OpenGl_graduatedtrihedron.hxx -// Created: 6 March 2011 -// Author: Sergey ZERCHANINOV -// Copyright: OPEN CASCADE SA 2011 - -#ifndef __OPENGL_GRADUATEDTRIHEDRON_H_ -#define __OPENGL_GRADUATEDTRIHEDRON_H_ - -#include -#include -#include - -#include -#include -#include - -#include - -extern TStatus call_graduatedtrihedron_display(int WsId, const Graphic3d_CGraduatedTrihedron &data); -extern TStatus call_graduatedtrihedron_redraw(int WsId); -extern TStatus call_graduatedtrihedron_erase(int WsId); -extern TStatus call_graduatedtrihedron_minmaxvalues(const float xMin, - const float yMin, - const float zMin, - const float xMax, - const float yMax, - const float zMax); - -#endif /* __OPENGL_GRADUATEDTRIHEDRON_H_ */ diff --git a/src/OpenGl/OpenGl_highlight.cxx b/src/OpenGl/OpenGl_highlight.cxx deleted file mode 100755 index 89cbcb8c57..0000000000 --- a/src/OpenGl/OpenGl_highlight.cxx +++ /dev/null @@ -1,245 +0,0 @@ -/*********************************************************************** - -FONCTION : ----------- -File OpenGl_highlight : - - -REMARQUES: ----------- - - -HISTORIQUE DES MODIFICATIONS : --------------------------------- -xx-xx-xx : xxx ; Creation. -11-03-96 : FMN ; Correction warning compilation -01-04-96 : CAL ; Integration MINSK portage WNT - -************************************************************************/ - -/*----------------------------------------------------------------------*/ -/* -* Includes -*/ - -#include - -#include -#include -#include - -#include -#include -#include -#include -#include - -struct TEL_HIGHLIGHT_DATA -{ - Tint hid; - TEL_HIGHLIGHT highl; - IMPLEMENT_MEMORY_OPERATORS -}; -typedef TEL_HIGHLIGHT_DATA* tel_highlight_data; - -struct TEL_WS_HIGHLIGHTS -{ - Tint num; /* number of highlights for a workstation */ - Tint siz; /* size allocated */ - TEL_HIGHLIGHT_DATA* data; /* highlight definitions for the workstation */ - IMPLEMENT_MEMORY_OPERATORS -}; -typedef TEL_WS_HIGHLIGHTS* tel_ws_highlights; - -#define GROW_SIZE 25 - -static tel_ws_highlights ws_hlights; - -static Tint -b_s( Tint id, tel_highlight_data tbl, Tint low, Tint high ) -{ - register Tint mid, i; - - if( low > high ) - return -1; - - mid = low+high, mid /= 2; - i = id - tbl[mid].hid; - - return i == 0 ? mid : i < 0 ? b_s( id, tbl, low, mid-1 ) : - b_s( id, tbl, mid+1, high ); -} - - -static int -lnumcomp( const void* a, const void* b ) -{ - return *( Tint* )a - *( Tint* )b; -} - - -TStatus -TelSetHighlightRep( Tint Wsid, Tint hid, tel_highlight highl ) -{ -#if 0 - CMN_KEY_DATA key; -#endif - tel_highlight_data hptr; - register Tint i; -#if 0 - TsmGetWSAttri( Wsid, WSHighlights, &key ); - ws_hlights = key.pdata ; /* Obtain list of defined highlights */ -#endif - if( !ws_hlights ) /* no highlights defined yet */ - { /* allocate */ - //cmn_memreserve( ws_hlights, 1, 0 ); - ws_hlights = new TEL_WS_HIGHLIGHTS(); - if( !ws_hlights ) - return TFailure; - //cmn_memreserve( ws_hlights->data, GROW_SIZE, 0 ); - ws_hlights->data = new TEL_HIGHLIGHT_DATA[GROW_SIZE]; - if( !ws_hlights ) - return TFailure; - - ws_hlights->siz = GROW_SIZE; - ws_hlights->num = 0; -#if 0 - key.pdata = ws_hlights;/* Set list for the workstation */ - TsmSetWSAttri( Wsid, WSHighlights, &key ); -#endif - } - else if( ws_hlights->num == ws_hlights->siz ) /* insufficient memory */ - { /* realloc */ -#if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x530) - ws_hlights->data = (TEL_HIGHLIGHT_DATA*)realloc( ws_hlights->data, (ws_hlights->siz - + GROW_SIZE)*sizeof(TEL_HIGHLIGHT_DATA) ); -#else - ws_hlights->data = cmn_resizemem( ws_hlights->data, ws_hlights->siz - + GROW_SIZE ); -#endif - if( !ws_hlights ) - return TFailure; - - ws_hlights->siz += GROW_SIZE; -#if 0 - key.pdata = ws_hlights; /* Reset list for the workstation */ - TsmSetWSAttri( Wsid, WSHighlights, &key ); -#endif - } - hptr = 0; /* Locate highlight if already defined */ - i = b_s( hid, ws_hlights->data, 0, ws_hlights->num-1 ); - if( i != -1 ) - { - hptr = &ws_hlights->data[i]; /* highlight already defined */ - hptr->highl = *highl; /* copy highlight definition */ - } - - if( !hptr ) /* new highlight */ - { - hptr = &ws_hlights->data[ws_hlights->num]; - hptr->highl = *highl; /* copy highlight definition */ - hptr->hid = hid; /* highlights for the workstation */ - ws_hlights->num++; /* and sort the entries */ - qsort( ws_hlights->data, ws_hlights->num, - sizeof(TEL_HIGHLIGHT_DATA), lnumcomp ); - } - - - return TSuccess; -} - - -TStatus -TelGetHighlightRep( Tint Wsid, Tint hid, tel_highlight highl ) -{ -#if 0 - CMN_KEY_DATA key; -#endif - tel_highlight_data hptr; - register Tint i; -#if 0 - TsmGetWSAttri( Wsid, WSHighlights, &key ); - ws_hlights = key.pdata ; /* Obtain list of defined highlights */ -#endif - if( !ws_hlights ) - return TFailure; /* no highlights defined */ - - hptr = 0; /* Locate highlight if already defined */ - i = b_s( hid, ws_hlights->data, 0, ws_hlights->num-1 ); - if( i == -1 ) - return TFailure; /* hid undefined */ - - hptr = &ws_hlights->data[i]; - *highl = hptr->highl; - - return TSuccess; -} - - -void -TelPrintHighlightRep( Tint Wsid, Tint hid ) -{ -#if 0 - CMN_KEY_DATA key; -#endif - tel_highlight_data hptr; - register Tint i; - -#if 0 - TsmGetWSAttri( Wsid, WSHighlights, &key ); - ws_hlights = key.pdata ; /* Obtain list of defined highlights */ -#endif - if( !ws_hlights ) - return; /* no highlights defined */ - - hptr = 0; /* Locate highlight if already defined */ - i = b_s( hid, ws_hlights->data, 0, ws_hlights->num-1 ); - if( i == -1 ) - { - fprintf( stdout, "\nBad Highlight %d\n", hid ); - return; /* hid undefined */ - } - - hptr = &ws_hlights->data[i]; - fprintf( stdout, "\nHighlight Id: %d", hid ); - switch( hptr->highl.type ) - { - case TelHLColour: - fprintf( stdout, "\nHighlight type: TelHLColour" ); - fprintf( stdout, "\n\tColour: %f %f %f", - hptr->highl.col.rgb[0], - hptr->highl.col.rgb[1], - hptr->highl.col.rgb[2] ); - break; - - case TelHLForcedColour: - fprintf( stdout, "\nHighlight type: TelHLForcedColour" ); - fprintf( stdout, "\n\tColour: %f %f %f", - hptr->highl.col.rgb[0], - hptr->highl.col.rgb[1], - hptr->highl.col.rgb[2] ); - break; - } - fprintf( stdout, "\n" ); - - return; -} - -TStatus -TelDeleteHighlightsForWS( Tint wsid ) -{ - CMN_KEY_DATA key; - tel_ws_highlights h; - - TsmGetWSAttri( wsid, WSHighlights, &key ); - h = (tel_ws_highlights)key.pdata; - - if( !h ) - return TSuccess; - - //cmn_freemem( h ); - if ( h->data ) - delete[] h->data; - delete h; - return TSuccess; -} diff --git a/src/OpenGl/OpenGl_hlind.cxx b/src/OpenGl/OpenGl_hlind.cxx deleted file mode 100755 index 347db9b16e..0000000000 --- a/src/OpenGl/OpenGl_hlind.cxx +++ /dev/null @@ -1,95 +0,0 @@ - -#include - -#include -#include - -#include -#include -#include -#include -#include - -static TStatus HighlightIndexDisplay( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus HighlightIndexAdd( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus HighlightIndexPrint( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus HighlightIndexInquire( TSM_ELEM_DATA, Tint, cmn_key* ); - -static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) = -{ - 0, /* PickTraverse */ - HighlightIndexDisplay, - HighlightIndexAdd, - 0, /* Delete */ - HighlightIndexPrint, - HighlightIndexInquire -}; - - -MtblPtr -TelHighlightIndexInitClass( TelType *el ) -{ - *el = TelHighlightIndex; - return MtdTbl; -} - -static TStatus -HighlightIndexAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k ) -{ - ((tsm_elem_data)(d.pdata))->ldata = k[0]->data.ldata; - - return TSuccess; -} - - -static TStatus -HighlightIndexDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - CMN_KEY kk; - - kk.id = TelHighlightIndex; - kk.data.ldata = data.ldata; - TsmSetAttri( 1, &kk ); - return TSuccess; -} - - -static TStatus -HighlightIndexPrint( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - fprintf( stdout, "TelHighlightIndex. Value = %d\n", data.ldata); - fprintf( stdout, "\n" ); - - return TSuccess; -} - -static TStatus -HighlightIndexInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - Tint i; - - for( i = 0; i < n; i++ ) - { - switch( k[i]->id ) - { - case INQ_GET_SIZE_ID: - { - k[i]->data.ldata = sizeof( Tint ); - break; - } - case INQ_GET_CONTENT_ID: - { - TEL_INQ_CONTENT *c; - Teldata *w; - - c =(tel_inq_content)k[i]->data.pdata; - w = c->data; - c->act_size = 0; - w->idata = data.ldata; - break; - } - } - } - - return TSuccess; -} diff --git a/src/OpenGl/OpenGl_indexpolygons.cxx b/src/OpenGl/OpenGl_indexpolygons.cxx deleted file mode 100755 index 05ca301ac2..0000000000 --- a/src/OpenGl/OpenGl_indexpolygons.cxx +++ /dev/null @@ -1,1616 +0,0 @@ -/*********************************************************************** - -FONCTION : ----------- -File OpenGl_indexpolygons : - - -REMARQUES: ----------- - -Le culling et le backfacing ne marchent pas. - - -HISTORIQUE DES MODIFICATIONS : --------------------------------- -xx-xx-xx : xxx ; Creation. -11-03-96 : FMN ; Correction warning compilation -01-04-96 : CAL ; Integration MINSK portage WNT -09-08-96 : FMN ; Suppression appel glMatrixMode() avant glGetFloatv() -21-10-96 : FMN ; Suppression LMC_COLOR fait dans OpenGl_execstruct.c -30-06-97 : FMN ; Suppression OpenGl_telem_light.h -18-07-97 : FMN ; Ajout desactivation des lights suivant front_lighting_model -21-07-97 : FMN ; Amelioration des performances OPTIMISATION_FMN -- suppression calcul inutile sur les front faces -- utilisation de GL_TRIANGLES et GL_QUADS -27-08-97 : FMN ; Correction affichage des edges -On n'affiche que les edges dans le mode IS_EMPTY -27-08-97 : FMN ; Correction affichage des edges visibility [PRO9859] -10-09-97 : FMN ; Amelioration des perfs liees aux lights. -15-09-97 : PCT ; Ajout coordonnees textures -24-09-97 : FMN ; Suppression OPTIMISATION_FMN. -08-12-97 : FMN ; Suppression appel TsmGetAttri inutile. -31-12-97 : FMN ; Simplification pour le highlight -15-01-98 : FMN ; Ajout Hidden line -08-03-01 : GG ; BUC60823 Avoid crash in the normal computation method -on confuse point. - -************************************************************************/ - -#define xPRINT - -#define G003 /* EUG 07-10-99 Degeneration mode support -*/ - -#define G004 /* VKH 25-01-00 View dump management -Disable animation during dump -*/ - -#define BUC60876 /* GG 5/4/2001 Disable local display list -// when animation is not required -*/ - -#define OCC749 /* SAV 19/09/02 added processing of colored vertices */ -#define OCC7824 /* ASL 26/01/05 transparency of polygon with colors assigned to vertices */ - -/*----------------------------------------------------------------------*/ -/* -* Includes -*/ - -#include - -#include -#include -#include -#include -#include - -#include -//#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef G003 -# include -# define DEF_DS_INTERNAL -# include -# ifdef G004 -extern GLboolean g_fBitmap; -# endif /* G004 */ -#endif /* G003 */ - -static long s_Rand = 1L; -# define OPENGL_RAND() ( ( unsigned )( s_Rand = s_Rand * 214013L + 2531011L )) - -/*----------------------------------------------------------------------*/ -/* -* Constantes -*/ - -/*----------------------------------------------------------------------*/ -/* -* Prototypes -*/ - -static TStatus PolygonIndicesDisplay( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus PolygonIndicesAdd( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus PolygonIndicesDelete( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus PolygonIndicesPrint( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus PolygonIndicesInquire( TSM_ELEM_DATA, Tint, cmn_key* ); - -/*static GLboolean lighting_mode;*/ - -struct TEL_INDEXPOLY_DATA -{ - Tint num_vertices; /* Number of vertices */ - Tint num_bounds; /* Number of bounds */ - Tint facet_flag; /* TEL_FA_NONE or TEL_FA_NORMAL */ - Tint vertex_flag; /* TEL_VT_NONE or TEL_VT_NORMAL */ - Tint shape_flag; /* TEL_SHAPE_UNKNOWN or TEL_SHAPE_COMPLEX or - TEL_SHAPE_CONVEX or TEL_SHAPE_CONCAVE */ - Tint *edge_vis; /* Edge visibility indicators for each edge */ - Tint *bounds; /* Bounds array */ - Tint *indices; /* Connectivity array */ - tel_point fnormals; /* Facet normals */ - tel_colour fcolours; /* Facet colour values */ - tel_point vertices; /* Vertices */ - tel_colour vcolours; /* Vertex colour values */ - tel_point vnormals; /* Vertex normals */ - tel_texture_coord vtexturecoord; /* Texture Coordinates */ - Tint edge_count; /* Internal field */ -#ifdef G003 - DS_INTERNAL d; -#endif /* G003 */ - IMPLEMENT_MEMORY_OPERATORS -}; -typedef TEL_INDEXPOLY_DATA* tel_indexpoly_data; - -static TEL_INDEXPOLY_DATA indexpoly_defaults = -{ - 0, /* num_vertices */ - 0, /* num_bounds */ - TEL_FA_NONE, /* facet_flag */ - TEL_VT_NONE, /* vertex_flag */ - TEL_SHAPE_UNKNOWN, /* shape_flag */ - 0, /* edge_vis */ - 0, /* bounds */ - 0, /* indices */ - 0, /* fnormal */ - 0, /* fcolour */ - 0, /* vertices */ - 0, /* vcolours */ - 0, /* vnormals */ - 0, /* vtexturecoord */ - 0 /* edge_count */ -#ifdef G003 - , { 0, 0, 0, -1, 0.0F, NULL } -#endif /* G003 */ -}; - -static void draw_indexpoly( - tel_indexpoly_data, - Tint, /* highlight_flag */ - Tint, /* front_lighting_model, */ - Tint, /* interior_style, */ - tel_colour /* edge_colour, */ -#ifdef OCC749 - , tel_surf_prop -#endif - ); - -#ifdef G003 -static void draw_edges ( tel_indexpoly_data, tel_colour, Tint, Tint ); -static void draw_degenerates_as_points ( tel_indexpoly_data ); -static void draw_degenerates_as_bboxs ( tel_indexpoly_data ); -void set_drawable_items ( GLboolean*, int ); -#else -static void draw_edges( tel_indexpoly_data,tel_colour, Tint); -#endif - -static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) = -{ - PolygonIndicesDisplay, /* PickTraverse */ - PolygonIndicesDisplay, - PolygonIndicesAdd, - PolygonIndicesDelete, - PolygonIndicesPrint, - PolygonIndicesInquire -}; - -/*----------------------------------------------------------------------*/ -/* -* Variables externes -*/ - -extern Tint ForbidSetTextureMapping; /* currently defined in tsm/tsm.c */ -extern int g_nDegenerateModel; - -#ifdef G003 -extern float g_fSkipRatio; -extern GLboolean g_fAnimation; -#endif /* G003 */ - -/*----------------------------------------------------------------------*/ - -MtblPtr -TelPolygonIndicesInitClass( TelType* el ) -{ - *el = TelPolygonIndices; - return MtdTbl; -} - -/*----------------------------------------------------------------------*/ - -static TStatus -PolygonIndicesAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k ) -{ - Tint i, j, a, b, edge_count=0; - tel_indexpoly_data data; - - for( i = 0; i < n; i++ ) - { - if( k[i]->id == NUM_VERTICES_ID ) - break; - } - if( i == n ) - return TFailure; - - if( !(k[i]->data.ldata) ) - return TFailure; - - for( j = 0; j < n; j++ ) - { - if( k[j]->id == VERTICES_ID ) - break; - } - if( j == n ) - return TFailure; - - for( a = 0; a < n; a++ ) - { - if( k[a]->id == NUM_FACETS_ID ) - break; - } - if( a == n ) - return TFailure; - - //cmn_memreserve( data, 1, 1 ); - data = new TEL_INDEXPOLY_DATA(); - if( !data ) - return TFailure; - - /* load defaults */ - //cmn_memcpy( data, &indexpoly_defaults, 1 ); - memcpy( data, &indexpoly_defaults, sizeof(TEL_INDEXPOLY_DATA) ); - - data->num_vertices = k[i]->data.ldata; - //cmn_memreserve( data->vertices, data->num_vertices, 0 ); - data->vertices = new TEL_POINT[data->num_vertices]; - //cmn_memcpy( data->vertices, k[j]->data.pdata, data->num_vertices ); - memcpy( data->vertices, k[j]->data.pdata, data->num_vertices*sizeof(TEL_POINT) ); - data->num_bounds = k[a]->data.ldata; - - for( b = 0; b < n; b++ ) - { - if( k[b]->id == BOUNDS_DATA_ID ) - break; - } - if( b == n ) - { - //cmn_freemem( data->vertices ); - delete[] data->vertices; - return TFailure; - } - //cmn_memreserve( data->bounds, data->num_bounds, 0 ); - data->bounds = new Tint[data->num_bounds]; - //cmn_memcpy( data->bounds, k[b]->data.pdata, data->num_bounds ); - memcpy( data->bounds, k[b]->data.pdata, data->num_bounds*sizeof(Tint) ); - - for( b = 0; b < data->num_bounds; b++ ) - edge_count += data->bounds[b]; - - data->edge_count = edge_count; - - for( i = 0; i < n; i++ ) - { - switch( k[i]->id ) - { - case EDGE_DATA_ID: - data->edge_vis = new Tint[edge_count]; - memcpy( data->edge_vis, k[i]->data.pdata, edge_count*sizeof(Tint) ); - break; - - case CONNECTIVITY_ID: - data->indices = new Tint[edge_count]; - memcpy( data->indices, k[i]->data.pdata, edge_count*sizeof(Tint) ); - break; - - case FNORMALS_ID: - data->facet_flag = TEL_FA_NORMAL; - data->fnormals = new TEL_POINT[data->num_bounds]; - memcpy( data->fnormals, k[i]->data.pdata, data->num_bounds*sizeof(TEL_POINT) ); - for( a = 0; a < data->num_bounds; a++ ) - vecnrm( data->fnormals[a].xyz ); - break; - - case FACET_COLOUR_VALS_ID: - data->fcolours = new TEL_COLOUR[data->num_bounds]; - memcpy( data->fcolours, k[i]->data.pdata, data->num_bounds*sizeof(TEL_COLOUR) ); - break; - - case VERTEX_COLOUR_VALS_ID: - data->vcolours = new TEL_COLOUR[data->num_vertices]; - memcpy( data->vcolours, k[i]->data.pdata, data->num_vertices*sizeof(TEL_COLOUR) ); - break; - - case VNORMALS_ID: - data->vertex_flag = TEL_VT_NORMAL; - data->vnormals = new TEL_POINT[data->num_vertices]; - memcpy( data->vnormals, k[i]->data.pdata, data->num_vertices*sizeof(TEL_POINT) ); - for( j = 0; j < data->num_vertices; j++ ) - vecnrm( data->vnormals[j].xyz ); - break; - - case SHAPE_FLAG_ID: - data->shape_flag = k[i]->data.ldata; - break; - - case VTEXTURECOORD_ID: - data->vtexturecoord = new TEL_TEXTURE_COORD[data->num_vertices]; - memcpy( data->vtexturecoord, k[i]->data.pdata, data->num_vertices*sizeof(TEL_TEXTURE_COORD) ); - break; - } - } - - if( data->facet_flag != TEL_FA_NORMAL ) - { - data->fnormals = new TEL_POINT[data->num_bounds]; - for( i = 0, a = 0; i < data->num_bounds; i++ ) { -#ifdef BUC60823 - TelGetPolygonNormal( data->vertices, &data->indices[a], - data->bounds[i], data->fnormals[i].xyz ); -#else - TelGetNormal( data->vertices[data->indices[a]].xyz, - data->vertices[data->indices[a+1]].xyz, - data->vertices[data->indices[a+j]].xyz, - data->fnormals[i].xyz ); - vecnrm(data->fnormals[i].xyz); -#endif - a += data->bounds[i]; - } - } -#ifdef G003 - data->d.bDraw = new unsigned char[data->num_bounds]; -#endif /* G003 */ - ((tsm_elem_data)(d.pdata))->pdata = data; - - return TSuccess; -} - -/*----------------------------------------------------------------------*/ - -static TStatus -PolygonIndicesDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - CMN_KEY k11, k12, k17, k111, k114; -#ifdef OCC749 - CMN_KEY k117; -#endif - - Tint front_lighting_model; - Tint interior_style; - TEL_COLOUR interior_colour; - TEL_COLOUR edge_colour; -#ifdef OCC749 - TEL_SURF_PROP prop; -#endif - - tel_indexpoly_data d; - - k12.id = TelInteriorReflectanceEquation; - k17.id = TelInteriorStyle; - k111.id = TelInteriorColour; - k111.data.pdata = &interior_colour; - k114.id = TelEdgeColour; - k114.data.pdata = &edge_colour; -#ifdef OCC749 - k117.id = TelSurfaceAreaProperties; - k117.data.pdata = ∝ -#endif - -#ifdef OCC749 - TsmGetAttri( 5, &k12, &k17, &k111, &k114, &k117); -#else - TsmGetAttri( 4, &k12, &k17, &k111, &k114); -#endif - - front_lighting_model = k12.data.ldata; - interior_style = k17.data.ldata; - -#ifdef PRINT - printf("PolygonIndicesDisplay \n"); -#endif - - /* - * Use highlight colours - */ - - if( k[0]->id == TOn ) - { - TEL_HIGHLIGHT hrep; - - k11.id = TelHighlightIndex; - TsmGetAttri( 1, &k11 ); - if( TelGetHighlightRep( TglActiveWs, k11.data.ldata, &hrep ) == TSuccess ) - { - if( hrep.type == TelHLForcedColour ) - { - edge_colour = interior_colour = hrep.col; - front_lighting_model = CALL_PHIGS_REFL_NONE; - } - else if( hrep.type == TelHLColour ) - { - edge_colour = hrep.col; - k[0]->id = TOff; - } - } - else - { - TelGetHighlightRep( TglActiveWs, 0, &hrep ); - if( hrep.type == TelHLForcedColour ) - { - edge_colour = interior_colour = hrep.col; - front_lighting_model = CALL_PHIGS_REFL_NONE; - } - else if( hrep.type == TelHLColour ) - { - edge_colour = hrep.col; - k[0]->id = TOff; - } - } - } - - d = (tel_indexpoly_data)data.pdata; - - glColor3fv( interior_colour.rgb ); -#ifdef PRINT - printf("PolygonIndicesDisplay.interior_colour %f,%f,%f \n", - interior_colour.rgb[0],interior_colour.rgb[1],interior_colour.rgb[2]); -#endif - - draw_indexpoly( d, k[0]->id, - front_lighting_model, - interior_style, - &edge_colour -#ifdef OCC749 - , &prop -#endif - ); - - return TSuccess; - -} - -/*----------------------------------------------------------------------*/ - -static void -draw_indexpoly( tel_indexpoly_data p, Tint hflag, - Tint front_lighting_model, - Tint interior_style, - tel_colour edge_colour -#ifdef OCC749 - , tel_surf_prop prop -#endif - ) -{ - Tint i, j, k, a, newList = 0; - Tint lighting_model; - - /* Following pointers have been provided for performance improvement */ - Tint *ind; - tel_point pfn, pvn, pv; - tel_colour pvc, pfc; - tel_texture_coord pvt; - - ind = p->indices; - pfn = p->fnormals; - pvn = p->vnormals; - pvc = p->vcolours; - pfc = p->fcolours; - pv = p->vertices; - pvt = p->vtexturecoord; -#ifdef G003 - if ( g_nDegenerateModel < 2 && interior_style != TSM_EMPTY ) -#else - if ( interior_style != TSM_EMPTY ) -#endif /* G003 */ - { - if( hflag == TOn ) - { - pvc = 0; - pfc = 0; - } - - if ( interior_style == TSM_HIDDENLINE) - { - pvc = 0; - pfc = 0; - } - - if (front_lighting_model == CALL_PHIGS_REFL_NONE) - LightOff(); - else LightOn(); - - lighting_model = front_lighting_model; - -#ifdef G003 -#ifdef BUC60876 - if ( !g_fAnimation ) - goto doDraw; /* Disable object display list out of animation */ -#endif -#ifdef G004 - if ( g_fBitmap ) - goto doDraw; /* dipsplay lists are NOT shared between */ - /* window's context and bitmap's one */ -#endif /* G004 */ - - if ( p -> d.model != lighting_model || !p -> d.list || - p -> d.model == -1 ||( g_nDegenerateModel && p -> d.skipRatio != g_fSkipRatio )) { - - p -> d.skipRatio = g_fSkipRatio; - p -> d.model = lighting_model; - p -> d.degMode = g_nDegenerateModel; -#endif /* G003 */ -#ifdef G003 - if ( g_fSkipRatio == 0.0 ) { - if ( !p -> d.list ) p -> d.list = glGenLists ( 1 ); - - glNewList ( p -> d.list, GL_COMPILE_AND_EXECUTE ); - newList = 1; -doDraw: -#endif /* G003 */ - - if ( lighting_model == CALL_PHIGS_REFL_NONE ) { - if ( p -> bounds[ 0 ] == 3 ) - glBegin ( GL_TRIANGLES ); - else if ( p -> bounds[ 0 ] == 4 ) - glBegin ( GL_QUADS ); - else glBegin ( GL_POLYGON ); - - if ( pvc ) { - for ( i = 0, j = 0, a = 0; i < p -> num_bounds; ++i ) { - a = j + p -> bounds[ i ]; - for ( ; j < a; ++j ) { - glColor3fv ( pvc[ ind[ j ] ].rgb ); - glVertex3fv ( pv[ ind[ j ] ].xyz ); - } /* end for ( j . . . ) */ - } /* end for ( i . . . ) */ - } else if ( pfc ) { - for ( i = 0, j = 0, a = 0; i < p -> num_bounds; ++i ) { - a = j + p -> bounds[ i ]; - glColor3fv ( pfc[ i ].rgb ); - for ( ; j < a; ++j ) glVertex3fv ( pv[ ind[ j ] ].xyz ); - } /* end for */ - } else { - for ( i = 0, j = 0, a = 0; i < p -> num_bounds; ++i ) { - a = j + p -> bounds[ i ]; - for ( ; j < a; ++j ) glVertex3fv ( pv[ ind[ j ] ].xyz ); - } /* end for */ - } /* end else */ - glEnd (); - } else { /* lighting_model != TelLModelNone */ - if ( p -> bounds[ 0 ] == 3 ) - glBegin ( GL_TRIANGLES ); - else if ( p -> bounds[ 0 ] == 4 ) - glBegin ( GL_QUADS ); - else glBegin ( GL_POLYGON ); - -#ifdef OCC749 - for ( i = a = 0; i < p -> num_bounds; ++i ) { - j = a; a += p -> bounds[ i ]; - if( pfn ) glNormal3fv ( pfn[ i ].xyz ); - if( pfc && !prop->isphysic ) { - GLfloat diff[4], ambi[4], emsv[4], r, g, b; - -#ifdef OCC7824 - ambi[3] = diff[3] = emsv[3] = prop->trans; -#else - ambi[3] = 1.0f; diff[3] = 1.0f; emsv[3] = 1.0f; -#endif - - r = pfc[ i ].rgb[0]; g = pfc[ i ].rgb[1]; b = pfc[ i ].rgb[2]; - - if( prop->isamb ) { - ambi[0] = prop->amb * r; - ambi[1] = prop->amb * g; - ambi[2] = prop->amb * b; - glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, ambi); - } - if( prop->isdiff ) { - diff[0] = prop->diff * r; - diff[1] = prop->diff * g; - diff[2] = prop->diff * b; - glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, diff); - } - if( prop->isemsv ) { - emsv[0] = prop->emsv * r; - emsv[1] = prop->emsv * g; - emsv[2] = prop->emsv * b; - glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, emsv); - } - } - for ( ; j < a; ++j ) { - k = ind[ j ]; - if( pvn ) glNormal3fv ( pvn[ k ].xyz ); - if( pvc && !prop->isphysic ) { - GLfloat diff[4], ambi[4], emsv[4], r, g, b; - -#ifdef OCC7824 - ambi[3] = diff[3] = emsv[3] = prop->trans; -#else - ambi[3] = 1.0f; diff[3] = 1.0f; emsv[3] = 1.0f; -#endif - - r = pvc[ k ].rgb[0]; g = pvc[ k ].rgb[1]; b = pvc[ k ].rgb[2]; - - if( prop->isamb ) { - ambi[0] = prop->amb * r; - ambi[1] = prop->amb * g; - ambi[2] = prop->amb * b; - glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, ambi); - } - if( prop->isdiff ) { - diff[0] = prop->diff * r; - diff[1] = prop->diff * g; - diff[2] = prop->diff * b; - glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, diff); - } - if( prop->isemsv ) { - emsv[0] = prop->emsv * r; - emsv[1] = prop->emsv * g; - emsv[2] = prop->emsv * b; - glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, emsv); - } - } - if( pvt && !ForbidSetTextureMapping ) glTexCoord2fv ( pvt[ k ].xy ); - glVertex3fv ( pv[ k ].xyz ); - } /* end for ( j . . . ) */ - } /* end for ( i . . . ) */ - glEnd (); -#else - if ( pvn ) { - if ( pvt && !ForbidSetTextureMapping ) - for ( i = 0, j = 0, a = 0; i < p -> num_bounds; ++i ) { - a = j + p -> bounds[ i ]; - for ( ; j < a; ++j ) { - glNormal3fv ( pvn[ ind[ j ] ].xyz ); - glTexCoord2fv ( pvt[ ind[ j ] ].xy ); - glVertex3fv ( pv[ ind[ j ] ].xyz ); - } /* end for ( j . . . ) */ - } /* end for ( i . . . ) */ - else - for ( i = 0, j = 0, a = 0; i < p -> num_bounds; ++i ) { - a = j + p -> bounds[ i ]; - for ( ; j < a; ++j ) { - glNormal3fv ( pvn[ ind[ j ] ].xyz ); - glVertex3fv ( pv[ ind[ j ] ].xyz ); - } /* end for ( j . . . ) */ - } /* end for ( i . . . ) */ - } else { /* !pvn */ - for ( i = 0, j = 0, a = 0; i < p -> num_bounds; ++i ) { - a = j + p -> bounds[ i ]; - glNormal3fv ( pfn[ i ].xyz ); - for ( ; j < a; ++j ) glVertex3fv ( pv[ ind[ j ] ].xyz ); - } /* end for */ - } /* end else */ - glEnd (); -#endif /* OCC749 */ - - } /* end else */ -#ifdef G003 - } else if ( g_fSkipRatio != 1.0 ) { - if ( !p -> d.dlist ) p -> d.dlist = glGenLists ( 1 ); - glNewList ( p -> d.dlist, GL_COMPILE_AND_EXECUTE ); - newList = 1; - set_drawable_items ( p -> d.bDraw, p -> num_bounds ); - if ( lighting_model == CALL_PHIGS_REFL_NONE ) { - if ( p -> bounds[ 0 ] == 3 ) - glBegin ( GL_TRIANGLES ); - else if ( p -> bounds[ 0 ] == 4 ) - glBegin ( GL_QUADS ); - else glBegin ( GL_POLYGON ); - - if ( pvc ) { - for ( i = 0, j = 0, a = 0; i < p -> num_bounds; ++i ) { - a = j + p -> bounds[ i ]; - if ( p -> d.bDraw[ i ] ) - for ( ; j < a; ++j ) { - glColor3fv ( pvc[ ind[ j ] ].rgb ); - glVertex3fv ( pv[ ind[ j ] ].xyz ); - } /* end for ( j . . . ) */ - else j = a; - } /* end for ( i . . . ) */ - } else if ( pfc ) { - for ( i = 0, j = 0, a = 0; i < p -> num_bounds; ++i ) { - a = j + p -> bounds[ i ]; - if ( p -> d.bDraw[ i ] ) { - glColor3fv ( pfc[ i ].rgb ); - for ( ; j < a; ++j ) glVertex3fv ( pv[ ind[ j ] ].xyz ); - } else j = a; - } /* end for */ - } else { - for ( i = 0, j = 0, a = 0; i < p -> num_bounds; ++i ) { - a = j + p -> bounds[ i ]; - if ( p -> d.bDraw[ i ] ) - for ( ; j < a; ++j ) glVertex3fv ( pv[ ind[ j ] ].xyz ); - else j = a; - } /* end for */ - } /* end else */ - glEnd (); - } else { /* lighting_model != TelLModelNone */ - if ( p -> bounds[ 0 ] == 3 ) - glBegin ( GL_TRIANGLES ); - else if ( p -> bounds[ 0 ] == 4 ) - glBegin ( GL_QUADS ); - else glBegin ( GL_POLYGON ); - - if ( pvn ) { - if ( pvt && !ForbidSetTextureMapping ) - for ( i = 0, j = 0, a = 0; i < p -> num_bounds; ++i ) { - a = j + p->bounds[ i ]; - if ( p -> d.bDraw[ i ] ) - for ( ; j < a; ++j ) { - glNormal3fv ( pvn[ ind[ j ] ].xyz ); - glTexCoord2fv ( pvt[ ind[ j ] ].xy ); - glVertex3fv ( pv[ ind[ j ] ].xyz ); - } /* end for ( j . . . ) */ - else j = a; - } /* end for ( i . . . ) */ - else - for ( i = 0, j = 0, a = 0; i < p -> num_bounds; ++i ) { - a = j + p -> bounds[ i ]; - if ( p -> d.bDraw[ i ] ) - for ( ; j < a; ++j ) { - glNormal3fv ( pvn[ ind[ j ] ].xyz ); - glVertex3fv ( pv[ ind[ j ] ].xyz ); - } /* end for ( j . . . ) */ - else j = a; - } /* end for ( i . . . ) */ - } else { /* !pvn */ - for ( i = 0, j = 0, a = 0; i < p -> num_bounds; ++i ) { - a = j + p -> bounds[ i ]; - if ( p -> d.bDraw[ i ] ) { - glNormal3fv ( pfn[ i ].xyz ); - for ( ; j < a; ++j ) glVertex3fv ( pv[ ind[ j ] ].xyz ); - } else j = a; - } /* end for */ - } /* end else */ - glEnd (); - } /* end else */ - } else { - if ( !p -> d.dlist ) p -> d.dlist = glGenLists ( 1 ); - glNewList ( p -> d.dlist, GL_COMPILE_AND_EXECUTE ); - newList = 1; - } /* end else */ -#endif /* G003 */ -#ifdef G003 - if ( newList ) glEndList (); - if ( g_nDegenerateModel ) return; - } else { - glCallList ( g_fSkipRatio == 0.0 ? p -> d.list : p -> d.dlist ); - if ( g_nDegenerateModel ) return; - } /* end else */ -#endif /* G003 */ - } -#ifdef G003 - i = 0; - - switch ( g_nDegenerateModel ) { - -default: - break; - -case 2: /* XXX_TDM_WIREFRAME */ - i = 1; - break; - -case 3: /* XXX_TDM_MARKER */ - draw_degenerates_as_points ( p ); - return; - -case 4: /* XXX_TDM_BBOX */ - draw_degenerates_as_bboxs ( p ); - return; - - } /* end switch */ - - draw_edges ( p, edge_colour, interior_style, i ); -#else - draw_edges( p, edge_colour, interior_style ); -#endif -} - -/*----------------------------------------------------------------------*/ - -static TStatus -PolygonIndicesDelete( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - tel_indexpoly_data p; - - p = (tel_indexpoly_data)data.pdata; - if( p->edge_vis ) - //cmn_freemem( p->edge_vis ); - delete[] p->edge_vis; - if( p->bounds ) - //cmn_freemem( p->bounds ); - delete[] p->bounds; - if( p->indices ) - //cmn_freemem( p->indices ); - delete[] p->indices; - if( p->fcolours ) - //cmn_freemem( p->fcolours ); - delete[] p->fcolours; - if( p->fnormals ) - //cmn_freemem( p->fnormals ); - delete[] p->fnormals; - if( p->vertices ) - //cmn_freemem( p->vertices ); - delete[] p->vertices; - if( p->vcolours ) - //cmn_freemem( p->vcolours ); - delete[] p->vcolours; - if( p->vnormals ) - //cmn_freemem( p->vnormals ); - delete[] p->vnormals; - if (p->vtexturecoord) - //cmn_freemem( p->vtexturecoord ); - delete[] p->vtexturecoord; -#ifdef G003 - if ( GET_GL_CONTEXT() != NULL ) { - - if ( p -> d.list ) glDeleteLists ( p -> d.list, 1 ); - if ( p -> d.dlist ) glDeleteLists ( p -> d.dlist, 1 ); - - } /* end if */ - - if ( p -> d.bDraw ) - //cmn_freemem ( p -> d.bDraw ); - delete[] p -> d.bDraw; -#endif /* G003 */ - - //cmn_freemem( data.pdata ); - if (data.pdata) - delete data.pdata; - return TSuccess; -} - -/*----------------------------------------------------------------------*/ - -static TStatus -PolygonIndicesPrint( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - Tint i; - tel_indexpoly_data p; - - p = (tel_indexpoly_data)data.pdata; - - fprintf( stdout, "TelPolygonIndices. Number of Vertices: %d\n", p->num_vertices ); - switch( p->shape_flag ) - { - case TEL_SHAPE_UNKNOWN: - fprintf( stdout, "\t\tShape Flag : UNKNOWN\n" ); - break; - - case TEL_SHAPE_COMPLEX: - fprintf( stdout, "\t\tShape Flag : COMPLEX\n" ); - break; - - case TEL_SHAPE_CONCAVE: - fprintf( stdout, "\t\tShape Flag : CONCAVE\n" ); - break; - - case TEL_SHAPE_CONVEX: - fprintf( stdout, "\t\tShape Flag : CONVEX\n" ); - break; - - } - switch( p->facet_flag ) - { - case TEL_FA_NONE: - if( p->fcolours ) - fprintf( stdout, "\t\tFacet Flag : COLOUR\n" ); - else - fprintf( stdout, "\t\tFacet Flag : NONE\n" ); - break; - - case TEL_FA_NORMAL: - if( p->fcolours ) - fprintf( stdout, "\t\tFacet Flag : COLOURNORMAL\n" ); - else - fprintf( stdout, "\t\tFacet Flag : NORMAL\n" ); - break; - } - switch( p->vertex_flag ) - { - case TEL_VT_NONE: - if( p->vcolours ) - fprintf( stdout, "\t\tVertex Flag : COLOUR\n" ); - else - fprintf( stdout, "\t\tVertex Flag : NONE\n" ); - break; - - case TEL_VT_NORMAL: - if( p->vcolours ) - fprintf( stdout, "\t\tVertex Flag : COLOURNORMAL\n" ); - else - fprintf( stdout, "\t\tVertex Flag : NORMAL\n" ); - break; - } - if( p->edge_vis ) - { - fprintf( stdout, "\t\tEdge Visibility Data :\n" ); - for( i = 0; i < p->edge_count; i++ ) - fprintf( stdout, "\t\t%d ", p->edge_vis[i] ); - fprintf( stdout, "\n" ); - } - if( p->bounds ) - { - fprintf( stdout, "\t\tBounds array :\n" ); - for( i = 0; i < p->num_bounds; i++ ) - fprintf( stdout, "\t\tb[%d] %d \n", i, p->bounds[i] ); - } - if( p->indices ) - { - fprintf( stdout, "\t\tConnectivity array :\n" ); - for( i = 0; i < p->edge_count; i++ ) - fprintf( stdout, "\t\tI[%d] %d \n", i, p->indices[i] ); - } - if( p->fnormals ) - { - fprintf( stdout, "\n\t\tFacet Normals : " ); - for( i = 0; i < p->num_bounds; i++ ) - fprintf( stdout, "\n\t\t v[%d] = %g %g %g", i, - p->fnormals[i].xyz[0], - p->fnormals[i].xyz[1], - p->fnormals[i].xyz[2] ); - fprintf( stdout, "\n" ); - } - else - fprintf( stdout, "\n\t\tFacet Normals not specified\n" ); - - if( p->fcolours ) - { - fprintf( stdout, "\n\t\tFacet Colours : " ); - for( i = 0; i < p->num_bounds; i++ ) - fprintf( stdout, "\n\t\t v[%d] = %g %g %g", i, - p->fcolours[i].rgb[0], - p->fcolours[i].rgb[1], - p->fcolours[i].rgb[2] ); } - else - fprintf( stdout, "\n\t\tFacet Colours not specified\n" ); - - if( p->vertices ) - { - fprintf( stdout, "\n\t\tVertices : " ); - for( i = 0; i < p->num_vertices; i++ ) - fprintf( stdout, "\n\t\t v[%d] = %g %g %g", i, - p->vertices[i].xyz[0], - p->vertices[i].xyz[1], - p->vertices[i].xyz[2] ); - } - - fprintf( stdout, "\n" ); - if( p->vcolours ) - { - fprintf( stdout, "\n\t\tVertex Colours : " ); - for( i = 0; i < p->num_vertices; i++ ) - fprintf( stdout, "\n\t\t v[%d] = %g %g %g", i, - p->vcolours[i].rgb[0], - p->vcolours[i].rgb[1], - p->vcolours[i].rgb[2] ); - } - else - fprintf( stdout, "\n\t\tVertex Colours not specified\n" ); - - if( p->vnormals ) - { - fprintf( stdout, "\n\t\tVertex Normals : " ); - for( i = 0; i < p->num_vertices; i++ ) - fprintf( stdout, "\n\t\t v[%d] = %g %g %g", i, - p->vnormals[i].xyz[0], - p->vnormals[i].xyz[1], - p->vnormals[i].xyz[2] ); - } - else - fprintf( stdout, "\n\t\tVertex Normals not specified\n" ); - - if (p->vtexturecoord) - { - fprintf(stdout, "\n\t\tTexture Coordinates : "); - for (i=0; inum_vertices; i++) - fprintf(stdout, "\n\t\t v[%d] = %g %g", i, - p->vtexturecoord[i].xy[0], - p->vtexturecoord[i].xy[1]); - } - else - fprintf( stdout, "\n\t\tTexture Coordinates not specified\n"); - - fprintf( stdout, "\n" ); - - return TSuccess; -} - -/*----------------------------------------------------------------------*/ - -static TStatus -PolygonIndicesInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - Tint i, j; - tel_indexpoly_data d; - Tint size_reqd=0; - TStatus status = TSuccess; - Tchar *cur_ptr = 0; - - d = (tel_indexpoly_data)data.pdata; - - if( d->edge_vis ) - size_reqd += ( d->edge_count * sizeof( Tint ) ); - - size_reqd += ( d->num_bounds * sizeof( Tint ) ); /* bounds */ - size_reqd += ( d->edge_count * sizeof( Tint ) ); /* connectivity */ - - if( d->fcolours ) - size_reqd += ( d->num_bounds * sizeof( TEL_COLOUR ) ); - - if( d->facet_flag == TEL_FA_NORMAL ) - size_reqd += ( d->num_bounds * sizeof( TEL_POINT ) ); - - size_reqd += ( d->num_vertices * sizeof( TEL_POINT ) ); - - if( d->vcolours ) - size_reqd += ( d->num_vertices * sizeof( TEL_COLOUR ) ); - - if( d->vertex_flag == TEL_VT_NORMAL ) - size_reqd += ( d->num_vertices * sizeof( TEL_POINT ) ); - - for( i = 0; i < n; i++ ) - { - switch( k[i]->id ) - { - case INQ_GET_SIZE_ID: - { - k[i]->data.ldata = size_reqd; - break; - } - - case INQ_GET_CONTENT_ID: - { - TEL_INQ_CONTENT *c; - Teldata *w; - - c = (tel_inq_content)k[i]->data.pdata; - c->act_size = size_reqd; - w = c->data; - - cur_ptr = c->buf; - w->indexedpolygons3data.shpflag = d->shape_flag; - w->indexedpolygons3data.num_bounds = d->num_bounds; - w->indexedpolygons3data.num_vertices = d->num_vertices; - if( d->edge_vis ) - w->indexedpolygons3data.edgflag = TOn; - else - w->indexedpolygons3data.edgflag = TOff; - - if( c->size >= size_reqd ) - { - if( d->facet_flag == TEL_FA_NORMAL ) - { - if( d->fcolours ) - { - w->indexedpolygons3data.fctflag = TEL_FAFLAG_COLOURNORMAL; - w->indexedpolygons3data.gnormals = (tel_point)(c->buf); - for( j = 0; j < d->num_bounds; j++ ) - { - w->indexedpolygons3data.gnormals[j] = d->fnormals[j]; - } - cur_ptr += ( d->num_bounds * sizeof( TEL_POINT ) ); - - w->indexedpolygons3data.facet_colour_vals = - (tel_colour)(cur_ptr); - for( j = 0; j < d->num_bounds; j++ ) - { - w->indexedpolygons3data.facet_colour_vals[j] = - d->fcolours[j]; - } - cur_ptr += ( d->num_bounds * sizeof( TEL_COLOUR ) ); - } - else - { - w->indexedpolygons3data.fctflag = TEL_FAFLAG_NORMAL; - w->indexedpolygons3data.facet_colour_vals = 0; - w->indexedpolygons3data.gnormals = (tel_point)(c->buf); - for( j = 0; j < d->num_bounds; j++ ) - { - w->indexedpolygons3data.gnormals[j] = d->fnormals[j]; - } - cur_ptr += ( d->num_bounds * sizeof( TEL_POINT ) ); - } - } - else - { - w->indexedpolygons3data.gnormals = 0; - if( d->fcolours ) - { - w->indexedpolygons3data.fctflag = TEL_FAFLAG_COLOUR; - w->indexedpolygons3data.facet_colour_vals = - (tel_colour)(c->buf ); - for( j = 0; j < d->num_bounds; j++ ) - { - w->indexedpolygons3data.facet_colour_vals[j] = - d->fcolours[j]; - } - cur_ptr += ( d->num_bounds * sizeof( TEL_COLOUR ) ); - } - else - { - w->indexedpolygons3data.fctflag = TEL_FAFLAG_NONE; - w->indexedpolygons3data.facet_colour_vals = 0; - } - } - - if( d->edge_vis ) - { - w->indexedpolygons3data.edgvis = (Tint *)(cur_ptr); - // cmn_memcpy( w->indexedpolygons3data.edgvis, - // d->edge_vis, - // d->edge_count ); - memcpy( w->indexedpolygons3data.edgvis, d->edge_vis, d->edge_count*sizeof(Tint) ); - cur_ptr += (d->edge_count * sizeof( Tint ) ); - } - - w->indexedpolygons3data.points = (tel_point)cur_ptr; - for( j = 0; j < d->num_vertices; j++ ) - { - w->indexedpolygons3data.points[j] = d->vertices[j]; - } - cur_ptr += ( d->num_vertices * sizeof( TEL_POINT ) ); - - w->indexedpolygons3data.bounds = (Tint *)cur_ptr; - // cmn_memcpy( w->indexedpolygons3data.bounds, - // d->bounds, - // d->num_bounds ); - memcpy( w->indexedpolygons3data.bounds, d->bounds, d->num_bounds*sizeof(Tint) ); - cur_ptr += ( d->num_bounds * sizeof( Tint ) ); - - w->indexedpolygons3data.indices = (Tint *)cur_ptr; - // cmn_memcpy( w->indexedpolygons3data.indices, - // d->indices, - // d->edge_count ); - memcpy( w->indexedpolygons3data.indices, d->indices, d->edge_count*sizeof(Tint) ); - cur_ptr += ( d->edge_count * sizeof( Tint ) ); - - if( d->vertex_flag == TEL_VT_NORMAL ) - { - if( d->vcolours ) - { - w->indexedpolygons3data.vrtflag = TEL_VTFLAG_COLOURNORMAL; - w->indexedpolygons3data.vnormals = (tel_point)(cur_ptr); - for( j = 0; j < d->num_vertices; j++ ) - { - w->indexedpolygons3data.vnormals[j] = d->vnormals[i]; - } - cur_ptr += ( d->num_vertices * sizeof( TEL_POINT ) ); - - w->indexedpolygons3data.colours = (tel_colour)(cur_ptr); - - for( j = 0; j < d->num_vertices; j++ ) - { - w->indexedpolygons3data.colours[j] = d->vcolours[i]; - } - } - else - { - w->indexedpolygons3data.vrtflag = TEL_VTFLAG_NORMAL; - w->indexedpolygons3data.colours = 0; - w->indexedpolygons3data.vnormals = (tel_point)(cur_ptr); - - for( j = 0; j < d->num_vertices; j++ ) - { - w->indexedpolygons3data.vnormals[j] = d->vnormals[i]; - } - } - } - else - { - w->indexedpolygons3data.vnormals = 0; - if( d->vcolours ) - { - w->indexedpolygons3data.vrtflag = TEL_VTFLAG_COLOUR; - w->indexedpolygons3data.colours = (tel_colour)(cur_ptr); - for( j = 0; j < d->num_vertices; j++ ) - { - w->indexedpolygons3data.colours[j] = d->vcolours[i]; - } - } - else - { - w->indexedpolygons3data.vrtflag = TEL_VTFLAG_NONE; - w->indexedpolygons3data.colours = 0; - } - } - - status = TSuccess; - } - else - status = TFailure; - break; - } - } - } - return status; -} - -/*----------------------------------------------------------------------*/ - -static void -#ifdef G003 -draw_edges ( tel_indexpoly_data p, tel_colour edge_colour, - Tint interior_style, Tint forceDraw ) -#else -draw_edges( tel_indexpoly_data p, tel_colour edge_colour, Tint interior_style ) -#endif -{ - CMN_KEY k, k1, k2, k3, k4; - Tint *ind, *vis; - Tint i, j, a, newList = 0; - Tint edge_type, line_type_preserve; - Tfloat edge_width, line_width_preserve; - GLboolean texture_on; - - tel_point pv; - -#ifdef G003 - if ( interior_style != TSM_HIDDENLINE && !forceDraw ) -#else - if (interior_style != TSM_HIDDENLINE) -#endif - { - k.id = TelEdgeFlag; - TsmGetAttri( 1, &k ); - if( k.data.ldata == TOff )return; - } - - pv = p->vertices; - ind = p->indices; - vis = p->edge_vis; - - LightOff(); - texture_on = IsTextureEnabled(); - if (texture_on) DisableTexture(); - - k1.id = TelPolylineWidth; - k2.id = TelPolylineType; - k3.id = TelEdgeType; - k4.id = TelEdgeWidth; - - TsmGetAttri( 4, &k1, &k2, &k3, &k4 ); - - line_width_preserve = k1.data.fdata; - line_type_preserve = k2.data.ldata; - edge_type = k3.data.ldata; - edge_width = k4.data.fdata; - - if( line_width_preserve != edge_width ) - { - k.id = TelPolylineWidth; - k.data.fdata = edge_width; - TsmSetAttri( 1, &k ); - } - if( line_type_preserve != edge_type ) - { - k.id = TelPolylineType; - k.data.ldata = edge_type; - TsmSetAttri( 1, &k ); - } - -#ifdef G003 - if ( !forceDraw ) { - - glColor3fv ( edge_colour -> rgb ); - glPushAttrib ( GL_POLYGON_BIT ); - glPolygonMode ( GL_FRONT_AND_BACK, GL_LINE ); - - for ( i = 0, j = 0, a = 0; i < p -> num_bounds; ++i ) { - - a = j + p -> bounds[ i ]; - - glBegin ( GL_POLYGON ); - - for ( ; j < a; ++j ) { - - glEdgeFlag ( ( GLboolean )( vis[ j ] == 1 ? GL_TRUE : GL_FALSE ) ); - glVertex3fv ( pv[ ind[ j ] ].xyz ); - - } /* end for */ - - glEnd(); - - glEdgeFlag ( GL_TRUE ); - - } /* end for */ - - glPopAttrib (); - - } else { - -#ifdef BUC60876 - if ( !g_fAnimation ) - goto doDraw; /* Disable object display list out of animation */ -#endif -#ifdef G004 - if ( g_fBitmap ) - goto doDraw; -#endif /* G004 */ - - if ( p -> d.degMode != 2 || p -> d.skipRatio != g_fSkipRatio || !p -> d.dlist ) { - - if ( !p -> d.dlist ) p -> d.dlist = glGenLists ( 1 ); - - p -> d.degMode = 2; - p -> d.skipRatio = g_fSkipRatio; - glNewList ( p -> d.dlist, GL_COMPILE_AND_EXECUTE ); - newList = 1; - -doDraw: - glPushAttrib ( GL_POLYGON_BIT | GL_DEPTH_BUFFER_BIT ); - - glEdgeFlag ( GL_TRUE ); - glDisable ( GL_DEPTH_TEST ); - glPolygonMode ( GL_FRONT_AND_BACK, GL_LINE ); - - if ( g_fSkipRatio == 0.0F ) - - for ( i = 0, j = 0, a = 0; i < p -> num_bounds; ++i ) { - - a = j + p -> bounds[ i ]; - - glBegin ( GL_POLYGON ); - - for ( ; j < a; ++j ) glVertex3fv ( pv[ ind[ j ] ].xyz ); - - glEnd(); - - } /* end for */ - - else if ( g_fSkipRatio != 1.0F ) { - - set_drawable_items ( p -> d.bDraw, p -> num_bounds ); - - for ( i = 0, j = 0, a = 0; i < p -> num_bounds; ++i ) { - - a = j + p -> bounds[ i ]; - - if ( p -> d.bDraw[ i ] ) { - - glBegin ( GL_POLYGON ); - - for ( ; j < a; ++j ) glVertex3fv ( pv[ ind[ j ] ].xyz ); - - glEnd(); - - } else j = a; - - } /* end for */ - - } /* end if */ - - glPopAttrib (); - if ( newList ) glEndList (); - - } else glCallList ( p -> d.dlist ); - - } /* end else */ -#else - glColor3fv( edge_colour->rgb ); - glPushAttrib(GL_POLYGON_BIT); - glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); - for( i = 0, j = 0, a = 0; i < p->num_bounds; i++ ) - { - a = j + p->bounds[i]; - glBegin(GL_POLYGON); - for( ; j < a; j++ ) - { - if( vis[j] == 1) glEdgeFlag( GL_TRUE ); - else glEdgeFlag( GL_FALSE ); - glVertex3fv( pv[ ind[j] ].xyz ); - } - glEnd(); - glEdgeFlag(GL_TRUE); - } - - glPopAttrib(); -#endif /* G003 */ - - if( line_width_preserve != edge_width ) - { - k.id = TelPolylineWidth; - k.data.fdata = line_width_preserve; - TsmSetAttri( 1, &k ); - } - if( line_type_preserve != edge_type ) - { - k.id = TelPolylineType; - k.data.ldata = line_type_preserve; - TsmSetAttri( 1, &k ); - } - if (texture_on) EnableTexture(); -} -/*----------------------------------------------------------------------*/ -#ifdef G003 -static void draw_degenerates_as_points ( tel_indexpoly_data p ) { - - Tint* ind, *vis; - Tint i, j, n, a, newList = 0; - GLfloat pt[ 3 ]; - tel_point pv; - - pv = p -> vertices; - ind = p -> indices; - vis = p -> edge_vis; - - LightOff (); - -#ifdef G004 - if ( g_fBitmap ) goto doDraw; -#endif /* G004 */ - - if ( p -> d.degMode != 3 || p -> d.skipRatio != g_fSkipRatio || !p -> d.dlist ) { - - if ( !p -> d.dlist ) p -> d.dlist = glGenLists ( 1 ); - - p -> d.degMode = 3; - p -> d.skipRatio = g_fSkipRatio; - glNewList ( p -> d.dlist, GL_COMPILE_AND_EXECUTE ); - newList = 1; -doDraw: - if ( g_fSkipRatio == 0.0F ) { - - glBegin ( GL_POINTS ); - - for ( i = 0, j = 0, a = 0; i < p -> num_bounds; ++i ) { - - n = p -> bounds[ i ]; - a = j + n; - - for ( pt [ 0 ] = pt[ 1 ] = pt[ 2 ] = 0.; j < a; ++j ) { - - pt[ 0 ] += pv[ ind[ j ] ].xyz[ 0 ]; - pt[ 1 ] += pv[ ind[ j ] ].xyz[ 1 ]; - pt[ 2 ] += pv[ ind[ j ] ].xyz[ 2 ]; - - } /* end for ( j ) */ - - pt[ 0 ] /= n; - pt[ 1 ] /= n; - pt[ 2 ] /= n; - - glVertex3fv ( pt ); - - } /* end for ( i ) */ - - glEnd (); - - } else if ( g_fSkipRatio != 1.0 ) { - - set_drawable_items ( p -> d.bDraw, p -> num_bounds ); - - glBegin ( GL_POINTS ); - - for ( i = 0, j = 0, a = 0; i < p -> num_bounds; ++i ) { - - n = p -> bounds[ i ]; - a = j + n; - - if ( p -> d.bDraw[ i ] ) { - - for ( pt [ 0 ] = pt[ 1 ] = pt[ 2 ] = 0.; j < a; ++j ) { - - pt[ 0 ] += pv[ ind[ j ] ].xyz[ 0 ]; - pt[ 1 ] += pv[ ind[ j ] ].xyz[ 1 ]; - pt[ 2 ] += pv[ ind[ j ] ].xyz[ 2 ]; - - } /* end for ( j ) */ - - pt[ 0 ] /= n; - pt[ 1 ] /= n; - pt[ 2 ] /= n; - - glVertex3fv ( pt ); - - } else j = a; - - } /* end for ( i ) */ - - glEnd (); - - } /* end if */ - -#ifdef G004 - if ( !g_fBitmap ) -#endif /* G004 */ - glEndList (); - - } else glCallList ( p -> d.dlist ); - -} /* end draw_degenerates_as_points */ - -static void draw_degenerates_as_bboxs ( tel_indexpoly_data p ) { - - Tint* ind, *vis; - Tint i, j, n, a, newList = 0; - GLfloat minp[ 3 ] = { FLT_MAX, FLT_MAX, FLT_MAX }; - GLfloat maxp[ 3 ] = { FLT_MIN, FLT_MIN, FLT_MIN }; - tel_point pv; - - pv = p -> vertices; - ind = p -> indices; - vis = p -> edge_vis; - - LightOff (); - -#ifdef G004 - if ( g_fBitmap ) goto doDraw; -#endif /* G004 */ - - if ( p -> d.degMode != 4 || !p -> d.dlist ) { - - if ( !p -> d.dlist ) p -> d.dlist = glGenLists ( 1 ); - - p -> d.degMode = 4; - - glNewList ( p -> d.dlist, GL_COMPILE_AND_EXECUTE ); - newList = 1; -doDraw: - for ( i = 0, j = 0, a = 0; i < p -> num_bounds; ++i ) { - - n = p -> bounds[ i ]; - a = j + n; - - for ( ; j < a; ++j ) { - - if ( pv[ ind[ j ] ].xyz[ 0 ] < minp[ 0 ] ) - minp[ 0 ] = pv[ ind[ j ] ].xyz[ 0 ] ; - if ( pv[ ind[ j ] ].xyz[ 1 ] < minp[ 1 ] ) - minp[ 1 ] = pv[ ind[ j ] ].xyz[ 1 ] ; - if ( pv[ ind[ j ] ].xyz[ 2 ] < minp[ 2 ] ) - minp[ 2 ] = pv[ ind[ j ] ].xyz[ 2 ] ; - - if ( pv[ ind[ j ] ].xyz[ 0 ] > maxp[ 0 ] ) - maxp[ 0 ] = pv[ ind[ j ] ].xyz[ 0 ] ; - if ( pv[ ind[ j ] ].xyz[ 1 ] > maxp[ 1 ] ) - maxp[ 1 ] = pv[ ind[ j ] ].xyz[ 1 ] ; - if ( pv[ ind[ j ] ].xyz[ 2 ] > maxp[ 2 ] ) - maxp[ 2 ] = pv[ ind[ j ] ].xyz[ 2 ] ; - - } /* end for ( j ) */ - - } /* end for ( i ) */ - - /* OCC11904 -- Temporarily disable environment mapping */ - glPushAttrib(GL_ENABLE_BIT); - glDisable(GL_TEXTURE_1D); - glDisable(GL_TEXTURE_2D); - - glBegin ( GL_LINE_STRIP ); - - glVertex3fv ( minp ); - glVertex3f ( minp[ 0 ], maxp[ 1 ], minp[ 2 ] ); - glVertex3f ( minp[ 0 ], maxp[ 1 ], maxp[ 2 ] ); - glVertex3f ( minp[ 0 ], minp[ 1 ], maxp[ 2 ] ); - glVertex3f ( minp[ 0 ], minp[ 1 ], minp[ 2 ] ); - - glVertex3f ( maxp[ 0 ], minp[ 1 ], minp[ 2 ] ); - glVertex3f ( maxp[ 0 ], maxp[ 1 ], minp[ 2 ] ); - glVertex3f ( maxp[ 0 ], maxp[ 1 ], maxp[ 2 ] ); - glVertex3f ( maxp[ 0 ], minp[ 1 ], maxp[ 2 ] ); - glVertex3f ( maxp[ 0 ], minp[ 1 ], minp[ 2 ] ); - - glVertex3f ( maxp[ 0 ], minp[ 1 ], maxp[ 2 ] ); - glVertex3f ( minp[ 0 ], minp[ 1 ], maxp[ 2 ] ); - glVertex3f ( minp[ 0 ], maxp[ 1 ], maxp[ 2 ] ); - glVertex3fv ( maxp ); - glVertex3f ( maxp[ 0 ], maxp[ 1 ], minp[ 2 ] ); - glVertex3f ( minp[ 0 ], maxp[ 1 ], minp[ 2 ] ); - - glEnd(); - glPopAttrib(); -#ifdef G004 - if ( !g_fBitmap ) -#endif /* G004 */ - glEndList (); - - } else glCallList ( p -> d.dlist ); - -} /* end draw_degenerates_as_bboxs */ -#endif /* G003 */ - -void set_drawable_items ( GLboolean* pbDraw, int n ) { - - int i; - - memset ( pbDraw, 0, sizeof ( GLboolean ) * n ); - - i = ( int )( ( 1.0F - g_fSkipRatio ) * n ); - - while ( i-- ) pbDraw[ OPENGL_RAND() % n ] = 1; - -} /* end set_drawable_items */ diff --git a/src/OpenGl/OpenGl_initelem.cxx b/src/OpenGl/OpenGl_initelem.cxx deleted file mode 100755 index 1242b55666..0000000000 --- a/src/OpenGl/OpenGl_initelem.cxx +++ /dev/null @@ -1,2204 +0,0 @@ -/*********************************************************************** - -FONCTION : ----------- -File OpenGl_initelem : - - -REMARQUES: ----------- - - -HISTORIQUE DES MODIFICATIONS : --------------------------------- -xx-xx-xx : xxx ; Creation. -20-02-96 : FMN ; Suppression code inutile: -01-04-96 : CAL ; Integration MINSK portage WNT -25-06-96 : FMN ; Suppression utilisation de glScissor. -03-07-96 : FMN ; Suppression definition des materiaux (InitMaterial). -08-07-96 : BGN ; (PRO4768)les dessins des markers echelle 1 sont -grossis (on reprend les bitmaps de l'echelle 2) -=> creation des markers des echelles 6.5 et 7; -creation des bitmaps du marker point par cercles -pleins (=> meilleur affichage et suppression du -cas particulier). -17-07-96 : FMN ; Suppression utilisation de HLHSRMode. -InitMaterial, InitLM sont inutilisees -05-12-96 : FMN ; PRO6327: Pas defaut on met la lumiere -GL_LIGHT_MODEL_TWO_SIDE a True. -13-02-97 : FMN ; Suppression variables inutiles -15-02-97 : FMN ; Suppression OpenGl_gl_compat.h -15-02-97 : FMN ; Ajout glHint pour le fog et l'antialiasing -11-04-97 : FMN ; Ajout glPolygonOffsetEXT -30-06-97 : FMN ; Les init generales par contexte sont faites dans OpenGl_subrvis. -05-08-07 : PCT ; ajout support texture mapping -23-12-97 : FMN ; Suppression TelBackInteriorStyle, TelBackInteriorStyleIndex -et TelBackInteriorShadingMethod -30-11-98 : FMN ; S3819 : Textes toujours visibles -26-10-99 : VTN ; BUC60599 : Enable to have contiguous horizontal or -vertical hatching. -16-06-2000 : ATS : G005 : Init functions for PARRAY and DARRAY primitives -22-03-04 : SAN ; OCC4895 High-level interface for controlling polygon offsets - -************************************************************************/ - -#define G003 /* EUG 06-10-99 Degeneration mode support -*/ - -#define G005 - - -/*----------------------------------------------------------------------*/ -/* -* Includes -*/ - -#include - -#include -#include - -#include -#include - -//#include - -/*----------------------------------------------------------------------*/ -/* -* Constantes -*/ - -#define DOT_LS 0xCCCC -#define DASH_DOT_LS 0xFF18 -#define DASH_LS 0xFFC0 -#define DASH_DDOT_LS 0xFF24 - -/*----------------------------------------------------------------------*/ -/* -* Prototypes -*/ - -static void InitPMFont(void); - -/*----------------------------------------------------------------------*/ -/* -* Variables externes -*/ - -GLuint linestyleBase; -GLuint patternBase; -GLuint markerBase; - -/*----------------------------------------------------------------------*/ -/* -* Prototypes des fonctions appele par TsmSendMessage() -*/ - -extern MtblPtr TelLabelInitClass( TelType* ); -extern MtblPtr TelPolylineInitClass( TelType* ); -extern MtblPtr TelPolylineColourInitClass( TelType* ); -extern MtblPtr TelPolylineWidthInitClass( TelType* ); -extern MtblPtr TelExecuteStructureInitClass( TelType* ); -extern MtblPtr TelPickIdInitClass( TelType* ); -extern MtblPtr TelPolylineTypeInitClass( TelType* ); -extern MtblPtr TelEdgeColourInitClass( TelType* ); -extern MtblPtr TelEdgeTypeInitClass( TelType* ); -extern MtblPtr TelEdgeWidthInitClass( TelType* ); -extern MtblPtr TelAntiAliasingInitClass( TelType* ); -extern MtblPtr TelPolygonInitClass( TelType* ); -extern MtblPtr TelInteriorColourInitClass( TelType* ); -extern MtblPtr TelInteriorStyleInitClass( TelType* ); -extern MtblPtr TelEdgeFlagInitClass( TelType* ); -extern MtblPtr TelPolymarkerColourInitClass( TelType* ); -extern MtblPtr TelPolymarkerSizeInitClass( TelType* ); -extern MtblPtr TelMarkerInitClass( TelType* ); -extern MtblPtr TelMarkerSetInitClass( TelType* ); -extern MtblPtr TelLocalTran3InitClass( TelType* ); -extern MtblPtr TelAddNamesetInitClass( TelType* ); -extern MtblPtr TelRemoveNamesetInitClass( TelType* ); -extern MtblPtr TelBackInteriorColourInitClass( TelType* ); -extern MtblPtr TelInteriorStyleIndexInitClass( TelType* ); -extern MtblPtr TelFaceDistinguishingModeInitClass( TelType* ); -extern MtblPtr TelTextColourInitClass( TelType* ); -extern MtblPtr TelTextInitClass( TelType* ); -extern MtblPtr TelTextColourSubTitleInitClass( TelType* ); -extern MtblPtr TelTextStyleInitClass( TelType* ); -extern MtblPtr TelTextDisplayTypeInitClass( TelType* ); -extern MtblPtr TelTextFontInitClass( TelType* ); -extern MtblPtr TelTextHeightInitClass( TelType* ); -/*OCC7456 abd 14.12.2004 Text alingnment attributes */ -extern MtblPtr TelTextAlignInitClass( TelType* ); -/*OCC7456 abd 14.12.2004 Text alingnment attributes */ -extern MtblPtr TelCharacterSpacingInitClass( TelType* ); -extern MtblPtr TelCharacterExpansionFactorInitClass( TelType* ); -extern MtblPtr TelPolymarkerTypeInitClass( TelType* ); -extern MtblPtr TelLightSrcStateInitClass( TelType* ); -extern MtblPtr TelInteriorReflectanceEquationInitClass( TelType* ); -extern MtblPtr TelBackInteriorReflectanceEquationInitClass( TelType* ); -extern MtblPtr TelSurfaceAreaPropertiesInitClass( TelType* ); -extern MtblPtr TelBackSurfaceAreaPropertiesInitClass( TelType* ); -extern MtblPtr TelFaceCullingModeInitClass( TelType* ); -extern MtblPtr TelDepthCueIndexInitClass( TelType* ); -extern MtblPtr TelInteriorShadingMethodInitClass( TelType* ); -extern MtblPtr TelViewIndexInitClass( TelType* ); -extern MtblPtr TelTriangleMeshInitClass( TelType* ); -extern MtblPtr TelApplicationDataInitClass( TelType* ); -extern MtblPtr TelQuadrangleInitClass( TelType* ); -extern MtblPtr TelPolygonIndicesInitClass( TelType* ); -extern MtblPtr TelHighlightIndexInitClass( TelType* ); -extern MtblPtr TelPolygonHolesInitClass( TelType* ); -extern MtblPtr TelCurveInitClass( TelType* ); -extern MtblPtr TelTextureIdInitClass( TelType* ); -extern MtblPtr TelDoTextureMapInitClass( TelType* ); -/* -extern MtblPtr TelNilInitClass( TelType* ); -extern MtblPtr TelBlinkInitClass( TelType* ); -extern MtblPtr TelPolygonSetInitClass( TelType* ); -extern MtblPtr TelClippingPlaneInitClass( TelType* ); -*/ -#ifdef G003 -extern MtblPtr TelDegenerateModelInitClass( TelType* ); -#endif /* G003 */ -extern MtblPtr TelTextZoomableInitClass( TelType* ); - -extern MtblPtr TelTextAngleInitClass( TelType* ); - -extern MtblPtr TelTextFontAspectInitClass( TelType* ); -/* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */ -extern MtblPtr TelPolygonOffsetInitClass( TelType* ); -/* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */ -/* ABD 29/10/04 Transform Persistence of Presentation( pan, zoom, rotate ) */ -extern MtblPtr TelTransformPersistentInitClass( TelType* ); -/* ABD 29/10/04 Transform Persistence of Presentation( pan, zoom, rotate ) */ - -extern MtblPtr TelParrayInitClass( TelType* ); -/* OCC???? SZV 11/08/05 Implementation of callbacks */ -extern MtblPtr TelUserdrawInitClass( TelType* ); -/* OCC???? SZV 11/08/05 Implementation of callbacks */ - -static MtblPtr (*TsmInitClassTable[])(TelType*) = -{ - TelLabelInitClass, - TelExecuteStructureInitClass, - /* ABD 29/10/04 Transform Persistence of Presentation( pan, zoom, rotate ) */ - TelTransformPersistentInitClass, - /* ABD 29/10/04 Transform Persistence of Presentation( pan, zoom, rotate ) */ - TelPolylineColourInitClass, - TelPolylineWidthInitClass, - TelPolylineInitClass, - TelPickIdInitClass, - TelPolylineTypeInitClass, - TelEdgeColourInitClass, - TelEdgeTypeInitClass, - TelEdgeWidthInitClass, - TelAntiAliasingInitClass, - TelPolygonInitClass, - TelInteriorColourInitClass, - TelInteriorStyleInitClass, - TelEdgeFlagInitClass, - TelPolymarkerColourInitClass, - TelPolymarkerSizeInitClass, - TelMarkerInitClass, - TelMarkerSetInitClass, - TelLocalTran3InitClass, - TelAddNamesetInitClass, - TelRemoveNamesetInitClass, - TelBackInteriorColourInitClass, - TelInteriorStyleIndexInitClass, - TelFaceDistinguishingModeInitClass, - TelTextColourInitClass, - TelTextInitClass, - TelTextFontInitClass, - TelTextHeightInitClass, - /*OCC7456 abd 14.12.2004 Text alingnment attributes */ - TelTextAlignInitClass, - /*OCC7456 abd 14.12.2004 Text alingnment attributes */ - TelCharacterSpacingInitClass, - TelCharacterExpansionFactorInitClass, - TelPolymarkerTypeInitClass, - TelInteriorReflectanceEquationInitClass, - TelBackInteriorReflectanceEquationInitClass, - TelLightSrcStateInitClass, - TelSurfaceAreaPropertiesInitClass, - TelBackSurfaceAreaPropertiesInitClass, - TelFaceCullingModeInitClass, - TelDepthCueIndexInitClass, - TelInteriorShadingMethodInitClass, - TelViewIndexInitClass, - TelTriangleMeshInitClass, - TelApplicationDataInitClass, - TelQuadrangleInitClass, - TelPolygonIndicesInitClass, - TelHighlightIndexInitClass, - TelPolygonHolesInitClass, - TelCurveInitClass, - TelTextureIdInitClass, - TelDoTextureMapInitClass, - TelTextColourSubTitleInitClass, - TelTextStyleInitClass, - TelTextDisplayTypeInitClass -#ifdef G003 - , TelDegenerateModelInitClass -#endif /* G003 */ -#ifdef G005 - , TelParrayInitClass -#endif /* G005 */ - , TelTextZoomableInitClass - , TelTextAngleInitClass - , TelTextFontAspectInitClass - /* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */ - , TelPolygonOffsetInitClass - /* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */ - /* OCC???? SZV 11/08/05 Implementation of callbacks */ - , TelUserdrawInitClass - /* OCC???? SZV 11/08/05 Implementation of callbacks */ -}; - -#define ClassTableSize sizeof(TsmInitClassTable)/sizeof(TStatus (*)()) - - -/*----------------------------------------------------------------------*/ - -void -TelHookOnAllClasses(void) -{ - TsmInitAllClasses( TsmInitClassTable, ClassTableSize ); - return; -} - -/*----------------------------------------------------------------------*/ - -void -TsmInitAttributes() -{ - unsigned int interiors[TEL_HS_USER_DEF_START][32]; - Tint i; - /* static int nombre;*/ - - linestyleBase = glGenLists(5); - - /* Line */ - - glNewList( linestyleBase+TEL_LS_DOT, GL_COMPILE); - glLineStipple(1, DOT_LS ); - glEndList(); - - glNewList( linestyleBase+TEL_LS_DASH_DOT, GL_COMPILE); - glLineStipple(1, DASH_DOT_LS ); - glEndList(); - - glNewList( linestyleBase+TEL_LS_DASH, GL_COMPILE); - glLineStipple(1, DASH_LS ); - glEndList(); - - glNewList( linestyleBase+TEL_LS_DOUBLE_DOT_DASH, GL_COMPILE); - glLineStipple(1, DASH_DDOT_LS ); - glEndList(); - - /* FSXXX - * GL_POLYGON_STIPPLE - * need 32x32 stipple patterns - */ - memset( interiors, 0xFF, sizeof(interiors) ); - - - /* modified by NIZHNY-VTN Tue Oct 26 09:54:20 1999 ___BEGIN___ */ - interiors[TEL_HS_CROSS][1] = 0xBBBBBBBB, - interiors[TEL_HS_CROSS][2] = 0xEEEEEEEE, - interiors[TEL_HS_CROSS][3] = 0xBBBBBBBB, - interiors[TEL_HS_CROSS][4] = 0xEEEEEEEE, - interiors[TEL_HS_CROSS][5] = 0xBBBBBBBB, - interiors[TEL_HS_CROSS][6] = 0xEEEEEEEE, - interiors[TEL_HS_CROSS][7] = 0xBBBBBBBB, - interiors[TEL_HS_CROSS][8] = 0xEEEEEEEE, - interiors[TEL_HS_CROSS][9] = 0xBBBBBBBB, - interiors[TEL_HS_CROSS][10] = 0xEEEEEEEE, - interiors[TEL_HS_CROSS][11] = 0xBBBBBBBB, - interiors[TEL_HS_CROSS][12] = 0xEEEEEEEE, - interiors[TEL_HS_CROSS][13] = 0xBBBBBBBB, - interiors[TEL_HS_CROSS][14] = 0xEEEEEEEE, - interiors[TEL_HS_CROSS][15] = 0xBBBBBBBB, - interiors[TEL_HS_CROSS][16] = 0xEEEEEEEE, - interiors[TEL_HS_CROSS][17] = 0xBBBBBBBB, - interiors[TEL_HS_CROSS][18] = 0xEEEEEEEE, - interiors[TEL_HS_CROSS][19] = 0xBBBBBBBB, - interiors[TEL_HS_CROSS][20] = 0xEEEEEEEE, - interiors[TEL_HS_CROSS][21] = 0xBBBBBBBB, - interiors[TEL_HS_CROSS][22] = 0xEEEEEEEE, - interiors[TEL_HS_CROSS][23] = 0xBBBBBBBB, - interiors[TEL_HS_CROSS][24] = 0xEEEEEEEE, - interiors[TEL_HS_CROSS][25] = 0xBBBBBBBB, - interiors[TEL_HS_CROSS][26] = 0xEEEEEEEE, - interiors[TEL_HS_CROSS][27] = 0xBBBBBBBB, - interiors[TEL_HS_CROSS][28] = 0xEEEEEEEE, - interiors[TEL_HS_CROSS][29] = 0xBBBBBBBB, - interiors[TEL_HS_CROSS][30] = 0xEEEEEEEE, - interiors[TEL_HS_CROSS][31] = 0xBBBBBBBB; - - interiors[TEL_HS_CROSS_SPARSE][0] = 0x81818181, - interiors[TEL_HS_CROSS_SPARSE][1] = 0x24242424, - interiors[TEL_HS_CROSS_SPARSE][2] = 0x18181818, - interiors[TEL_HS_CROSS_SPARSE][3] = 0x42424242, - interiors[TEL_HS_CROSS_SPARSE][4] = 0x81818181, - interiors[TEL_HS_CROSS_SPARSE][5] = 0x24242424, - interiors[TEL_HS_CROSS_SPARSE][6] = 0x18181818, - interiors[TEL_HS_CROSS_SPARSE][7] = 0x42424242, - interiors[TEL_HS_CROSS_SPARSE][8] = 0x81818181, - interiors[TEL_HS_CROSS_SPARSE][9] = 0x24242424, - interiors[TEL_HS_CROSS_SPARSE][10] = 0x18181818, - interiors[TEL_HS_CROSS_SPARSE][11] = 0x42424242, - interiors[TEL_HS_CROSS_SPARSE][12] = 0x81818181, - interiors[TEL_HS_CROSS_SPARSE][13] = 0x24242424, - interiors[TEL_HS_CROSS_SPARSE][14] = 0x18181818, - interiors[TEL_HS_CROSS_SPARSE][15] = 0x42424242, - interiors[TEL_HS_CROSS_SPARSE][16] = 0x81818181, - interiors[TEL_HS_CROSS_SPARSE][17] = 0x24242424, - interiors[TEL_HS_CROSS_SPARSE][18] = 0x18181818, - interiors[TEL_HS_CROSS_SPARSE][19] = 0x42424242, - interiors[TEL_HS_CROSS_SPARSE][20] = 0x81818181, - interiors[TEL_HS_CROSS_SPARSE][21] = 0x24242424, - interiors[TEL_HS_CROSS_SPARSE][22] = 0x18181818, - interiors[TEL_HS_CROSS_SPARSE][23] = 0x42424242, - interiors[TEL_HS_CROSS_SPARSE][24] = 0x81818181, - interiors[TEL_HS_CROSS_SPARSE][25] = 0x24242424, - interiors[TEL_HS_CROSS_SPARSE][26] = 0x18181818, - interiors[TEL_HS_CROSS_SPARSE][27] = 0x42424242, - interiors[TEL_HS_CROSS_SPARSE][28] = 0x81818181, - interiors[TEL_HS_CROSS_SPARSE][29] = 0x24242424, - interiors[TEL_HS_CROSS_SPARSE][30] = 0x18181818, - interiors[TEL_HS_CROSS_SPARSE][31] = 0x42424242; - - - interiors[TEL_HS_GRID][0] = 0xFFFFFFFF, - interiors[TEL_HS_GRID][1] = 0x88888888, - interiors[TEL_HS_GRID][2] = 0xFFFFFFFF, - interiors[TEL_HS_GRID][3] = 0x88888888, - interiors[TEL_HS_GRID][4] = 0xFFFFFFFF, - interiors[TEL_HS_GRID][5] = 0x88888888, - interiors[TEL_HS_GRID][6] = 0xFFFFFFFF, - interiors[TEL_HS_GRID][7] = 0x88888888, - interiors[TEL_HS_GRID][8] = 0xFFFFFFFF, - interiors[TEL_HS_GRID][9] = 0x88888888, - interiors[TEL_HS_GRID][10] = 0xFFFFFFFF, - interiors[TEL_HS_GRID][11] = 0x88888888, - interiors[TEL_HS_GRID][12] = 0xFFFFFFFF, - interiors[TEL_HS_GRID][13] = 0x88888888, - interiors[TEL_HS_GRID][14] = 0xFFFFFFFF, - interiors[TEL_HS_GRID][15] = 0x88888888, - interiors[TEL_HS_GRID][16] = 0xFFFFFFFF, - interiors[TEL_HS_GRID][17] = 0x88888888, - interiors[TEL_HS_GRID][18] = 0xFFFFFFFF, - interiors[TEL_HS_GRID][19] = 0x88888888, - interiors[TEL_HS_GRID][20] = 0xFFFFFFFF, - interiors[TEL_HS_GRID][21] = 0x88888888, - interiors[TEL_HS_GRID][22] = 0xFFFFFFFF, - interiors[TEL_HS_GRID][23] = 0x88888888, - interiors[TEL_HS_GRID][24] = 0xFFFFFFFF, - interiors[TEL_HS_GRID][25] = 0x88888888, - interiors[TEL_HS_GRID][26] = 0xFFFFFFFF, - interiors[TEL_HS_GRID][27] = 0x88888888, - interiors[TEL_HS_GRID][28] = 0xFFFFFFFF, - interiors[TEL_HS_GRID][29] = 0x88888888, - interiors[TEL_HS_GRID][30] = 0xFFFFFFFF, - interiors[TEL_HS_GRID][31] = 0x88888888; - - interiors[TEL_HS_GRID_SPARSE][0] = 0xFFFFFFFF, - interiors[TEL_HS_GRID_SPARSE][1] = 0x80808080, - interiors[TEL_HS_GRID_SPARSE][2] = 0x80808080, - interiors[TEL_HS_GRID_SPARSE][3] = 0x80808080, - interiors[TEL_HS_GRID_SPARSE][4] = 0xFFFFFFFF, - interiors[TEL_HS_GRID_SPARSE][5] = 0x80808080, - interiors[TEL_HS_GRID_SPARSE][6] = 0x80808080, - interiors[TEL_HS_GRID_SPARSE][7] = 0x80808080, - interiors[TEL_HS_GRID_SPARSE][8] = 0xFFFFFFFF, - interiors[TEL_HS_GRID_SPARSE][9] = 0x80808080, - interiors[TEL_HS_GRID_SPARSE][10] = 0x80808080, - interiors[TEL_HS_GRID_SPARSE][11] = 0x80808080, - interiors[TEL_HS_GRID_SPARSE][12] = 0xFFFFFFFF, - interiors[TEL_HS_GRID_SPARSE][13] = 0x80808080, - interiors[TEL_HS_GRID_SPARSE][14] = 0x80808080, - interiors[TEL_HS_GRID_SPARSE][15] = 0x80808080, - interiors[TEL_HS_GRID_SPARSE][16] = 0xFFFFFFFF, - interiors[TEL_HS_GRID_SPARSE][17] = 0x80808080, - interiors[TEL_HS_GRID_SPARSE][18] = 0x80808080, - interiors[TEL_HS_GRID_SPARSE][19] = 0x80808080, - interiors[TEL_HS_GRID_SPARSE][20] = 0xFFFFFFFF, - interiors[TEL_HS_GRID_SPARSE][21] = 0x80808080, - interiors[TEL_HS_GRID_SPARSE][22] = 0x80808080, - interiors[TEL_HS_GRID_SPARSE][23] = 0x80808080, - interiors[TEL_HS_GRID_SPARSE][24] = 0xFFFFFFFF, - interiors[TEL_HS_GRID_SPARSE][25] = 0x80808080, - interiors[TEL_HS_GRID_SPARSE][26] = 0x80808080, - interiors[TEL_HS_GRID_SPARSE][27] = 0x80808080, - interiors[TEL_HS_GRID_SPARSE][28] = 0xFFFFFFFF, - interiors[TEL_HS_GRID_SPARSE][29] = 0x80808080, - interiors[TEL_HS_GRID_SPARSE][30] = 0x80808080, - interiors[TEL_HS_GRID_SPARSE][31] = 0x80808080; - - interiors[TEL_HS_DIAG_45][0] = 0x88888888, - interiors[TEL_HS_DIAG_45][1] = 0x22222222, - interiors[TEL_HS_DIAG_45][2] = 0x88888888, - interiors[TEL_HS_DIAG_45][3] = 0x22222222, - interiors[TEL_HS_DIAG_45][4] = 0x88888888, - interiors[TEL_HS_DIAG_45][5] = 0x22222222, - interiors[TEL_HS_DIAG_45][6] = 0x88888888, - interiors[TEL_HS_DIAG_45][7] = 0x22222222, - interiors[TEL_HS_DIAG_45][8] = 0x88888888, - interiors[TEL_HS_DIAG_45][9] = 0x22222222, - interiors[TEL_HS_DIAG_45][10] = 0x88888888, - interiors[TEL_HS_DIAG_45][11] = 0x22222222, - interiors[TEL_HS_DIAG_45][12] = 0x88888888, - interiors[TEL_HS_DIAG_45][13] = 0x22222222, - interiors[TEL_HS_DIAG_45][14] = 0x88888888, - interiors[TEL_HS_DIAG_45][15] = 0x22222222, - interiors[TEL_HS_DIAG_45][16] = 0x88888888, - interiors[TEL_HS_DIAG_45][17] = 0x22222222, - interiors[TEL_HS_DIAG_45][18] = 0x88888888, - interiors[TEL_HS_DIAG_45][19] = 0x22222222, - interiors[TEL_HS_DIAG_45][20] = 0x88888888, - interiors[TEL_HS_DIAG_45][21] = 0x22222222, - interiors[TEL_HS_DIAG_45][22] = 0x88888888, - interiors[TEL_HS_DIAG_45][23] = 0x22222222, - interiors[TEL_HS_DIAG_45][24] = 0x88888888, - interiors[TEL_HS_DIAG_45][25] = 0x22222222, - interiors[TEL_HS_DIAG_45][26] = 0x88888888, - interiors[TEL_HS_DIAG_45][27] = 0x22222222, - interiors[TEL_HS_DIAG_45][28] = 0x88888888, - interiors[TEL_HS_DIAG_45][29] = 0x22222222, - interiors[TEL_HS_DIAG_45][30] = 0x88888888, - interiors[TEL_HS_DIAG_45][31] = 0x22222222; - - interiors[TEL_HS_DIAG_135][0] = 0x11111111, - interiors[TEL_HS_DIAG_135][1] = 0x44444444, - interiors[TEL_HS_DIAG_135][2] = 0x11111111, - interiors[TEL_HS_DIAG_135][3] = 0x44444444, - interiors[TEL_HS_DIAG_135][4] = 0x11111111, - interiors[TEL_HS_DIAG_135][5] = 0x44444444, - interiors[TEL_HS_DIAG_135][6] = 0x11111111, - interiors[TEL_HS_DIAG_135][7] = 0x44444444, - interiors[TEL_HS_DIAG_135][8] = 0x11111111, - interiors[TEL_HS_DIAG_135][9] = 0x44444444, - interiors[TEL_HS_DIAG_135][10] = 0x11111111, - interiors[TEL_HS_DIAG_135][11] = 0x44444444, - interiors[TEL_HS_DIAG_135][12] = 0x11111111, - interiors[TEL_HS_DIAG_135][13] = 0x44444444, - interiors[TEL_HS_DIAG_135][14] = 0x11111111, - interiors[TEL_HS_DIAG_135][15] = 0x44444444, - interiors[TEL_HS_DIAG_135][16] = 0x11111111, - interiors[TEL_HS_DIAG_135][17] = 0x44444444, - interiors[TEL_HS_DIAG_135][18] = 0x11111111, - interiors[TEL_HS_DIAG_135][19] = 0x44444444, - interiors[TEL_HS_DIAG_135][20] = 0x11111111, - interiors[TEL_HS_DIAG_135][21] = 0x44444444, - interiors[TEL_HS_DIAG_135][22] = 0x11111111, - interiors[TEL_HS_DIAG_135][23] = 0x44444444, - interiors[TEL_HS_DIAG_135][24] = 0x11111111, - interiors[TEL_HS_DIAG_135][25] = 0x44444444, - interiors[TEL_HS_DIAG_135][26] = 0x11111111, - interiors[TEL_HS_DIAG_135][27] = 0x44444444, - interiors[TEL_HS_DIAG_135][28] = 0x11111111, - interiors[TEL_HS_DIAG_135][29] = 0x44444444, - interiors[TEL_HS_DIAG_135][30] = 0x11111111, - interiors[TEL_HS_DIAG_135][31] = 0x44444444; - - interiors[TEL_HS_HORIZONTAL][0] = 0xFFFFFFFF, - interiors[TEL_HS_HORIZONTAL][1] = 0x00000000, - interiors[TEL_HS_HORIZONTAL][2] = 0xFFFFFFFF, - interiors[TEL_HS_HORIZONTAL][3] = 0x00000000, - interiors[TEL_HS_HORIZONTAL][4] = 0xFFFFFFFF, - interiors[TEL_HS_HORIZONTAL][5] = 0x00000000, - interiors[TEL_HS_HORIZONTAL][6] = 0xFFFFFFFF, - interiors[TEL_HS_HORIZONTAL][7] = 0x00000000, - interiors[TEL_HS_HORIZONTAL][8] = 0xFFFFFFFF, - interiors[TEL_HS_HORIZONTAL][9] = 0x00000000, - interiors[TEL_HS_HORIZONTAL][10] = 0xFFFFFFFF, - interiors[TEL_HS_HORIZONTAL][11] = 0x00000000, - interiors[TEL_HS_HORIZONTAL][12] = 0xFFFFFFFF, - interiors[TEL_HS_HORIZONTAL][13] = 0x00000000, - interiors[TEL_HS_HORIZONTAL][14] = 0xFFFFFFFF, - interiors[TEL_HS_HORIZONTAL][15] = 0x00000000, - interiors[TEL_HS_HORIZONTAL][16] = 0xFFFFFFFF, - interiors[TEL_HS_HORIZONTAL][17] = 0x00000000, - interiors[TEL_HS_HORIZONTAL][18] = 0xFFFFFFFF, - interiors[TEL_HS_HORIZONTAL][19] = 0x00000000, - interiors[TEL_HS_HORIZONTAL][20] = 0xFFFFFFFF, - interiors[TEL_HS_HORIZONTAL][21] = 0x00000000, - interiors[TEL_HS_HORIZONTAL][22] = 0xFFFFFFFF, - interiors[TEL_HS_HORIZONTAL][23] = 0x00000000, - interiors[TEL_HS_HORIZONTAL][24] = 0xFFFFFFFF, - interiors[TEL_HS_HORIZONTAL][25] = 0x00000000, - interiors[TEL_HS_HORIZONTAL][26] = 0xFFFFFFFF, - interiors[TEL_HS_HORIZONTAL][27] = 0x00000000, - interiors[TEL_HS_HORIZONTAL][28] = 0xFFFFFFFF, - interiors[TEL_HS_HORIZONTAL][29] = 0x00000000, - interiors[TEL_HS_HORIZONTAL][30] = 0xFFFFFFFF, - interiors[TEL_HS_HORIZONTAL][31] = 0x00000000; - - interiors[TEL_HS_VERTICAL][0] = 0x11111111, - interiors[TEL_HS_VERTICAL][1] = 0x11111111, - interiors[TEL_HS_VERTICAL][2] = 0x11111111, - interiors[TEL_HS_VERTICAL][3] = 0x11111111, - interiors[TEL_HS_VERTICAL][4] = 0x11111111, - interiors[TEL_HS_VERTICAL][5] = 0x11111111, - interiors[TEL_HS_VERTICAL][6] = 0x11111111, - interiors[TEL_HS_VERTICAL][7] = 0x11111111, - interiors[TEL_HS_VERTICAL][8] = 0x11111111, - interiors[TEL_HS_VERTICAL][9] = 0x11111111, - interiors[TEL_HS_VERTICAL][10] = 0x11111111, - interiors[TEL_HS_VERTICAL][11] = 0x11111111, - interiors[TEL_HS_VERTICAL][12] = 0x11111111, - interiors[TEL_HS_VERTICAL][13] = 0x11111111, - interiors[TEL_HS_VERTICAL][14] = 0x11111111, - interiors[TEL_HS_VERTICAL][15] = 0x11111111, - interiors[TEL_HS_VERTICAL][16] = 0x11111111, - interiors[TEL_HS_VERTICAL][17] = 0x11111111, - interiors[TEL_HS_VERTICAL][18] = 0x11111111, - interiors[TEL_HS_VERTICAL][19] = 0x11111111, - interiors[TEL_HS_VERTICAL][20] = 0x11111111, - interiors[TEL_HS_VERTICAL][21] = 0x11111111, - interiors[TEL_HS_VERTICAL][22] = 0x11111111, - interiors[TEL_HS_VERTICAL][23] = 0x11111111, - interiors[TEL_HS_VERTICAL][24] = 0x11111111, - interiors[TEL_HS_VERTICAL][25] = 0x11111111, - interiors[TEL_HS_VERTICAL][26] = 0x11111111, - interiors[TEL_HS_VERTICAL][27] = 0x11111111, - interiors[TEL_HS_VERTICAL][28] = 0x11111111, - interiors[TEL_HS_VERTICAL][29] = 0x11111111, - interiors[TEL_HS_VERTICAL][30] = 0x11111111, - interiors[TEL_HS_VERTICAL][31] = 0x11111111; - - interiors[TEL_HS_DIAG_45_SPARSE][0] = 0x80808080, - interiors[TEL_HS_DIAG_45_SPARSE][1] = 0x20202020, - interiors[TEL_HS_DIAG_45_SPARSE][2] = 0x08080808, - interiors[TEL_HS_DIAG_45_SPARSE][3] = 0x02020202, - interiors[TEL_HS_DIAG_45_SPARSE][4] = 0x80808080, - interiors[TEL_HS_DIAG_45_SPARSE][5] = 0x20202020, - interiors[TEL_HS_DIAG_45_SPARSE][6] = 0x08080808, - interiors[TEL_HS_DIAG_45_SPARSE][7] = 0x02020202, - interiors[TEL_HS_DIAG_45_SPARSE][8] = 0x80808080, - interiors[TEL_HS_DIAG_45_SPARSE][9] = 0x20202020, - interiors[TEL_HS_DIAG_45_SPARSE][10] = 0x08080808, - interiors[TEL_HS_DIAG_45_SPARSE][11] = 0x02020202, - interiors[TEL_HS_DIAG_45_SPARSE][12] = 0x80808080, - interiors[TEL_HS_DIAG_45_SPARSE][13] = 0x20202020, - interiors[TEL_HS_DIAG_45_SPARSE][14] = 0x08080808, - interiors[TEL_HS_DIAG_45_SPARSE][15] = 0x02020202, - interiors[TEL_HS_DIAG_45_SPARSE][16] = 0x80808080, - interiors[TEL_HS_DIAG_45_SPARSE][17] = 0x20202020, - interiors[TEL_HS_DIAG_45_SPARSE][18] = 0x08080808, - interiors[TEL_HS_DIAG_45_SPARSE][19] = 0x02020202, - interiors[TEL_HS_DIAG_45_SPARSE][20] = 0x80808080, - interiors[TEL_HS_DIAG_45_SPARSE][21] = 0x20202020, - interiors[TEL_HS_DIAG_45_SPARSE][22] = 0x08080808, - interiors[TEL_HS_DIAG_45_SPARSE][23] = 0x02020202, - interiors[TEL_HS_DIAG_45_SPARSE][24] = 0x80808080, - interiors[TEL_HS_DIAG_45_SPARSE][25] = 0x20202020, - interiors[TEL_HS_DIAG_45_SPARSE][26] = 0x08080808, - interiors[TEL_HS_DIAG_45_SPARSE][27] = 0x02020202, - interiors[TEL_HS_DIAG_45_SPARSE][28] = 0x80808080, - interiors[TEL_HS_DIAG_45_SPARSE][29] = 0x20202020, - interiors[TEL_HS_DIAG_45_SPARSE][30] = 0x08080808, - interiors[TEL_HS_DIAG_45_SPARSE][31] = 0x02020202; - - interiors[TEL_HS_DIAG_135_SPARSE][0] = 0x01010101, - interiors[TEL_HS_DIAG_135_SPARSE][1] = 0x04040404, - interiors[TEL_HS_DIAG_135_SPARSE][2] = 0x10101010, - interiors[TEL_HS_DIAG_135_SPARSE][3] = 0x40404040, - interiors[TEL_HS_DIAG_135_SPARSE][4] = 0x01010101, - interiors[TEL_HS_DIAG_135_SPARSE][5] = 0x04040404, - interiors[TEL_HS_DIAG_135_SPARSE][6] = 0x10101010, - interiors[TEL_HS_DIAG_135_SPARSE][7] = 0x40404040, - interiors[TEL_HS_DIAG_135_SPARSE][8] = 0x01010101, - interiors[TEL_HS_DIAG_135_SPARSE][9] = 0x04040404, - interiors[TEL_HS_DIAG_135_SPARSE][10] = 0x10101010, - interiors[TEL_HS_DIAG_135_SPARSE][11] = 0x40404040, - interiors[TEL_HS_DIAG_135_SPARSE][12] = 0x01010101, - interiors[TEL_HS_DIAG_135_SPARSE][13] = 0x04040404, - interiors[TEL_HS_DIAG_135_SPARSE][14] = 0x10101010, - interiors[TEL_HS_DIAG_135_SPARSE][15] = 0x40404040, - interiors[TEL_HS_DIAG_135_SPARSE][16] = 0x01010101, - interiors[TEL_HS_DIAG_135_SPARSE][17] = 0x04040404, - interiors[TEL_HS_DIAG_135_SPARSE][18] = 0x10101010, - interiors[TEL_HS_DIAG_135_SPARSE][19] = 0x40404040, - interiors[TEL_HS_DIAG_135_SPARSE][20] = 0x01010101, - interiors[TEL_HS_DIAG_135_SPARSE][21] = 0x04040404, - interiors[TEL_HS_DIAG_135_SPARSE][22] = 0x10101010, - interiors[TEL_HS_DIAG_135_SPARSE][23] = 0x40404040, - interiors[TEL_HS_DIAG_135_SPARSE][24] = 0x01010101, - interiors[TEL_HS_DIAG_135_SPARSE][25] = 0x04040404, - interiors[TEL_HS_DIAG_135_SPARSE][26] = 0x10101010, - interiors[TEL_HS_DIAG_135_SPARSE][27] = 0x40404040, - interiors[TEL_HS_DIAG_135_SPARSE][28] = 0x01010101, - interiors[TEL_HS_DIAG_135_SPARSE][29] = 0x04040404, - interiors[TEL_HS_DIAG_135_SPARSE][30] = 0x10101010, - interiors[TEL_HS_DIAG_135_SPARSE][31] = 0x40404040; - - interiors[TEL_HS_HORIZONTAL_SPARSE][0] = 0xFFFFFFFF, - interiors[TEL_HS_HORIZONTAL_SPARSE][1] = 0x00000000, - interiors[TEL_HS_HORIZONTAL_SPARSE][2] = 0x00000000, - interiors[TEL_HS_HORIZONTAL_SPARSE][3] = 0x00000000, - interiors[TEL_HS_HORIZONTAL_SPARSE][4] = 0xFFFFFFFF, - interiors[TEL_HS_HORIZONTAL_SPARSE][5] = 0x00000000, - interiors[TEL_HS_HORIZONTAL_SPARSE][6] = 0x00000000, - interiors[TEL_HS_HORIZONTAL_SPARSE][7] = 0x00000000, - interiors[TEL_HS_HORIZONTAL_SPARSE][8] = 0xFFFFFFFF, - interiors[TEL_HS_HORIZONTAL_SPARSE][9] = 0x00000000, - interiors[TEL_HS_HORIZONTAL_SPARSE][10] = 0x00000000, - interiors[TEL_HS_HORIZONTAL_SPARSE][11] = 0x00000000, - interiors[TEL_HS_HORIZONTAL_SPARSE][12] = 0xFFFFFFFF, - interiors[TEL_HS_HORIZONTAL_SPARSE][13] = 0x00000000, - interiors[TEL_HS_HORIZONTAL_SPARSE][14] = 0x00000000, - interiors[TEL_HS_HORIZONTAL_SPARSE][15] = 0x00000000, - interiors[TEL_HS_HORIZONTAL_SPARSE][16] = 0xFFFFFFFF, - interiors[TEL_HS_HORIZONTAL_SPARSE][17] = 0x00000000, - interiors[TEL_HS_HORIZONTAL_SPARSE][18] = 0x00000000, - interiors[TEL_HS_HORIZONTAL_SPARSE][19] = 0x00000000, - interiors[TEL_HS_HORIZONTAL_SPARSE][20] = 0xFFFFFFFF, - interiors[TEL_HS_HORIZONTAL_SPARSE][21] = 0x00000000, - interiors[TEL_HS_HORIZONTAL_SPARSE][22] = 0x00000000, - interiors[TEL_HS_HORIZONTAL_SPARSE][23] = 0x00000000, - interiors[TEL_HS_HORIZONTAL_SPARSE][24] = 0xFFFFFFFF, - interiors[TEL_HS_HORIZONTAL_SPARSE][25] = 0x00000000, - interiors[TEL_HS_HORIZONTAL_SPARSE][26] = 0x00000000, - interiors[TEL_HS_HORIZONTAL_SPARSE][27] = 0x00000000, - interiors[TEL_HS_HORIZONTAL_SPARSE][28] = 0xFFFFFFFF, - interiors[TEL_HS_HORIZONTAL_SPARSE][29] = 0x00000000, - interiors[TEL_HS_HORIZONTAL_SPARSE][30] = 0x00000000, - interiors[TEL_HS_HORIZONTAL_SPARSE][31] = 0x00000000; - /* modified by NIZHNY-VTN Tue Oct 26 09:55:42 1999 ___END___ */ - - interiors[TEL_HS_VERTICAL_SPARSE][0] = 0x10101010, - interiors[TEL_HS_VERTICAL_SPARSE][1] = 0x10101010, - interiors[TEL_HS_VERTICAL_SPARSE][2] = 0x10101010, - interiors[TEL_HS_VERTICAL_SPARSE][3] = 0x10101010, - interiors[TEL_HS_VERTICAL_SPARSE][4] = 0x10101010, - interiors[TEL_HS_VERTICAL_SPARSE][5] = 0x10101010, - interiors[TEL_HS_VERTICAL_SPARSE][6] = 0x10101010, - interiors[TEL_HS_VERTICAL_SPARSE][7] = 0x10101010, - interiors[TEL_HS_VERTICAL_SPARSE][8] = 0x10101010, - interiors[TEL_HS_VERTICAL_SPARSE][9] = 0x10101010, - interiors[TEL_HS_VERTICAL_SPARSE][10] = 0x10101010, - interiors[TEL_HS_VERTICAL_SPARSE][11] = 0x10101010, - interiors[TEL_HS_VERTICAL_SPARSE][12] = 0x10101010, - interiors[TEL_HS_VERTICAL_SPARSE][13] = 0x10101010, - interiors[TEL_HS_VERTICAL_SPARSE][14] = 0x10101010, - interiors[TEL_HS_VERTICAL_SPARSE][15] = 0x10101010, - interiors[TEL_HS_VERTICAL_SPARSE][16] = 0x10101010, - interiors[TEL_HS_VERTICAL_SPARSE][17] = 0x10101010, - interiors[TEL_HS_VERTICAL_SPARSE][18] = 0x10101010, - interiors[TEL_HS_VERTICAL_SPARSE][19] = 0x10101010, - interiors[TEL_HS_VERTICAL_SPARSE][20] = 0x10101010, - interiors[TEL_HS_VERTICAL_SPARSE][21] = 0x10101010, - interiors[TEL_HS_VERTICAL_SPARSE][22] = 0x10101010, - interiors[TEL_HS_VERTICAL_SPARSE][23] = 0x10101010, - interiors[TEL_HS_VERTICAL_SPARSE][24] = 0x10101010, - interiors[TEL_HS_VERTICAL_SPARSE][25] = 0x10101010, - interiors[TEL_HS_VERTICAL_SPARSE][26] = 0x10101010, - interiors[TEL_HS_VERTICAL_SPARSE][27] = 0x10101010, - interiors[TEL_HS_VERTICAL_SPARSE][28] = 0x10101010, - interiors[TEL_HS_VERTICAL_SPARSE][29] = 0x10101010, - interiors[TEL_HS_VERTICAL_SPARSE][30] = 0x10101010, - interiors[TEL_HS_VERTICAL_SPARSE][31] = 0x10101010; - - patternBase = glGenLists(TEL_HS_USER_DEF_START); - for( i = 1; i < TEL_HS_USER_DEF_START; i++ ) - { - glNewList( patternBase+i, GL_COMPILE); - glPolygonStipple((const GLubyte *) (interiors[i])); - glEndList(); - } - - /* Init des fontes */ - (void) InitPMFont(); - - return; -} - -/* Following Section relates to POLYMARKER */ - -#define TEL_NO_OF_SIZES (long)13 -#define TEL_NB_OF_MARKERS (int)5 - -struct PM_FONT_INFO -{ - Tchar *str; - Tfloat width, height; /* FSXXX Tint -> Tfloat */ - Tint offset; -}; -typedef PM_FONT_INFO* pm_font_info; - -#define PM_PLUS_10_NUM 9*2 -#define PM_PLUS_15_NUM 11*2 -#define PM_PLUS_20_NUM 13*2 -#define PM_PLUS_25_NUM 15*2 -#define PM_PLUS_30_NUM 17*3 -#define PM_PLUS_35_NUM 19*3 -#define PM_PLUS_40_NUM 21*3 -#define PM_PLUS_45_NUM 23*3 -#define PM_PLUS_50_NUM 25*4 -#define PM_PLUS_55_NUM 27*4 -#define PM_PLUS_60_NUM 29*4 -#define PM_PLUS_65_NUM 31*4 -#define PM_PLUS_70_NUM 32*4 - -#define PM_STAR_10_NUM 9 -#define PM_STAR_15_NUM 11*2 -#define PM_STAR_20_NUM 13*2 -#define PM_STAR_25_NUM 15*2 -#define PM_STAR_30_NUM 17*2 -#define PM_STAR_35_NUM 19*2 -#define PM_STAR_40_NUM 21*3 -#define PM_STAR_45_NUM 23*3 -#define PM_STAR_50_NUM 25*3 -#define PM_STAR_55_NUM 27*3 -#define PM_STAR_60_NUM 29*4 -#define PM_STAR_65_NUM 32*4 -#define PM_STAR_70_NUM 32*4 - -#define PM_CROSS_10_NUM 7 -#define PM_CROSS_15_NUM 9*2 -#define PM_CROSS_20_NUM 11*2 -#define PM_CROSS_25_NUM 13*2 -#define PM_CROSS_30_NUM 15*2 -#define PM_CROSS_35_NUM 17*3 -#define PM_CROSS_40_NUM 19*3 -#define PM_CROSS_45_NUM 21*3 -#define PM_CROSS_50_NUM 23*3 -#define PM_CROSS_55_NUM 25*4 -#define PM_CROSS_60_NUM 27*4 -#define PM_CROSS_65_NUM 32*4 -#define PM_CROSS_70_NUM 32*4 - -#define PM_CIRC_10_NUM 7 -#define PM_CIRC_15_NUM 9*2 -#define PM_CIRC_20_NUM 9*2 -#define PM_CIRC_25_NUM 11*2 -#define PM_CIRC_30_NUM 13*2 -#define PM_CIRC_35_NUM 15*2 -#define PM_CIRC_40_NUM 17*3 -#define PM_CIRC_45_NUM 19*3 -#define PM_CIRC_50_NUM 21*3 -#define PM_CIRC_55_NUM 23*3 -#define PM_CIRC_60_NUM 25*4 -#define PM_CIRC_65_NUM 27*4 -#define PM_CIRC_70_NUM 29*4 - -#define PM_DOT_10_NUM 5 -#define PM_DOT_15_NUM 5 -#define PM_DOT_20_NUM 7 -#define PM_DOT_25_NUM 7 -#define PM_DOT_30_NUM 9*2 -#define PM_DOT_35_NUM 9*2 -#define PM_DOT_40_NUM 9*2 -#define PM_DOT_45_NUM 9*2 -#define PM_DOT_50_NUM 9*2 -#define PM_DOT_55_NUM 9*2 -#define PM_DOT_60_NUM 11*2 -#define PM_DOT_65_NUM 11*2 -#define PM_DOT_70_NUM 11*2 - -#define PM_PLUS_10_OFT 0 -#define PM_PLUS_15_OFT PM_PLUS_10_OFT + PM_PLUS_10_NUM -#define PM_PLUS_20_OFT PM_PLUS_15_OFT + PM_PLUS_15_NUM -#define PM_PLUS_25_OFT PM_PLUS_20_OFT + PM_PLUS_20_NUM -#define PM_PLUS_30_OFT PM_PLUS_25_OFT + PM_PLUS_25_NUM -#define PM_PLUS_35_OFT PM_PLUS_30_OFT + PM_PLUS_30_NUM -#define PM_PLUS_40_OFT PM_PLUS_35_OFT + PM_PLUS_35_NUM -#define PM_PLUS_45_OFT PM_PLUS_40_OFT + PM_PLUS_40_NUM -#define PM_PLUS_50_OFT PM_PLUS_45_OFT + PM_PLUS_45_NUM -#define PM_PLUS_55_OFT PM_PLUS_50_OFT + PM_PLUS_50_NUM -#define PM_PLUS_60_OFT PM_PLUS_55_OFT + PM_PLUS_55_NUM -#define PM_PLUS_65_OFT PM_PLUS_60_OFT + PM_PLUS_60_NUM -#define PM_PLUS_70_OFT PM_PLUS_65_OFT + PM_PLUS_65_NUM - -#define PM_STAR_10_OFT PM_PLUS_70_OFT + PM_PLUS_70_NUM -#define PM_STAR_15_OFT PM_STAR_10_OFT + PM_STAR_10_NUM -#define PM_STAR_20_OFT PM_STAR_15_OFT + PM_STAR_15_NUM -#define PM_STAR_25_OFT PM_STAR_20_OFT + PM_STAR_20_NUM -#define PM_STAR_30_OFT PM_STAR_25_OFT + PM_STAR_25_NUM -#define PM_STAR_35_OFT PM_STAR_30_OFT + PM_STAR_30_NUM -#define PM_STAR_40_OFT PM_STAR_35_OFT + PM_STAR_35_NUM -#define PM_STAR_45_OFT PM_STAR_40_OFT + PM_STAR_40_NUM -#define PM_STAR_50_OFT PM_STAR_45_OFT + PM_STAR_45_NUM -#define PM_STAR_55_OFT PM_STAR_50_OFT + PM_STAR_50_NUM -#define PM_STAR_60_OFT PM_STAR_55_OFT + PM_STAR_55_NUM -#define PM_STAR_65_OFT PM_STAR_60_OFT + PM_STAR_60_NUM -#define PM_STAR_70_OFT PM_STAR_65_OFT + PM_STAR_65_NUM - -#define PM_CROSS_10_OFT PM_STAR_70_OFT + PM_STAR_70_NUM -#define PM_CROSS_15_OFT PM_CROSS_10_OFT + PM_CROSS_10_NUM -#define PM_CROSS_20_OFT PM_CROSS_15_OFT + PM_CROSS_15_NUM -#define PM_CROSS_25_OFT PM_CROSS_20_OFT + PM_CROSS_20_NUM -#define PM_CROSS_30_OFT PM_CROSS_25_OFT + PM_CROSS_25_NUM -#define PM_CROSS_35_OFT PM_CROSS_30_OFT + PM_CROSS_30_NUM -#define PM_CROSS_40_OFT PM_CROSS_35_OFT + PM_CROSS_35_NUM -#define PM_CROSS_45_OFT PM_CROSS_40_OFT + PM_CROSS_40_NUM -#define PM_CROSS_50_OFT PM_CROSS_45_OFT + PM_CROSS_45_NUM -#define PM_CROSS_55_OFT PM_CROSS_50_OFT + PM_CROSS_50_NUM -#define PM_CROSS_60_OFT PM_CROSS_55_OFT + PM_CROSS_55_NUM -#define PM_CROSS_65_OFT PM_CROSS_60_OFT + PM_CROSS_60_NUM -#define PM_CROSS_70_OFT PM_CROSS_65_OFT + PM_CROSS_65_NUM - -#define PM_CIRC_10_OFT PM_CROSS_70_OFT + PM_CROSS_70_NUM -#define PM_CIRC_15_OFT PM_CIRC_10_OFT + PM_CIRC_10_NUM -#define PM_CIRC_20_OFT PM_CIRC_15_OFT + PM_CIRC_15_NUM -#define PM_CIRC_25_OFT PM_CIRC_20_OFT + PM_CIRC_20_NUM -#define PM_CIRC_30_OFT PM_CIRC_25_OFT + PM_CIRC_25_NUM -#define PM_CIRC_35_OFT PM_CIRC_30_OFT + PM_CIRC_30_NUM -#define PM_CIRC_40_OFT PM_CIRC_35_OFT + PM_CIRC_35_NUM -#define PM_CIRC_45_OFT PM_CIRC_40_OFT + PM_CIRC_40_NUM -#define PM_CIRC_50_OFT PM_CIRC_45_OFT + PM_CIRC_45_NUM -#define PM_CIRC_55_OFT PM_CIRC_50_OFT + PM_CIRC_50_NUM -#define PM_CIRC_60_OFT PM_CIRC_55_OFT + PM_CIRC_55_NUM -#define PM_CIRC_65_OFT PM_CIRC_60_OFT + PM_CIRC_60_NUM -#define PM_CIRC_70_OFT PM_CIRC_65_OFT + PM_CIRC_65_NUM - -#define PM_DOT_10_OFT PM_CIRC_70_OFT + PM_CIRC_70_NUM -#define PM_DOT_15_OFT PM_DOT_10_OFT + PM_DOT_10_NUM -#define PM_DOT_20_OFT PM_DOT_15_OFT + PM_DOT_15_NUM -#define PM_DOT_25_OFT PM_DOT_20_OFT + PM_DOT_20_NUM -#define PM_DOT_30_OFT PM_DOT_25_OFT + PM_DOT_25_NUM -#define PM_DOT_35_OFT PM_DOT_30_OFT + PM_DOT_30_NUM -#define PM_DOT_40_OFT PM_DOT_35_OFT + PM_DOT_35_NUM -#define PM_DOT_45_OFT PM_DOT_40_OFT + PM_DOT_40_NUM -#define PM_DOT_50_OFT PM_DOT_45_OFT + PM_DOT_45_NUM -#define PM_DOT_55_OFT PM_DOT_50_OFT + PM_DOT_50_NUM -#define PM_DOT_60_OFT PM_DOT_55_OFT + PM_DOT_55_NUM -#define PM_DOT_65_OFT PM_DOT_60_OFT + PM_DOT_60_NUM -#define PM_DOT_70_OFT PM_DOT_65_OFT + PM_DOT_65_NUM - -static PM_FONT_INFO array[TEL_NB_OF_MARKERS][TEL_NO_OF_SIZES] = -{ - { {(Tchar*)"\101", ( float )9, ( float )9, PM_PLUS_10_OFT}, - {(Tchar*)"\102", ( float )11, ( float )11, PM_PLUS_15_OFT}, - {(Tchar*)"\103", ( float )13, ( float )13, PM_PLUS_20_OFT}, - {(Tchar*)"\003", ( float )15, ( float )15, PM_PLUS_25_OFT}, - {(Tchar*)"\004", ( float )17, ( float )17, PM_PLUS_30_OFT}, - {(Tchar*)"\005", ( float )19, ( float )19, PM_PLUS_35_OFT}, - {(Tchar*)"\006", ( float )21, ( float )21, PM_PLUS_40_OFT}, - {(Tchar*)"\007", ( float )23, ( float )23, PM_PLUS_45_OFT}, - {(Tchar*)"\010", ( float )25, ( float )25, PM_PLUS_50_OFT}, - {(Tchar*)"\011", ( float )27, ( float )27, PM_PLUS_55_OFT}, - {(Tchar*)"\012", ( float )29, ( float )29, PM_PLUS_60_OFT}, - {(Tchar*)"\013", ( float )31, ( float )31, PM_PLUS_65_OFT}, - {(Tchar*)"\014", ( float )32, ( float )32, PM_PLUS_70_OFT} }, - - { {(Tchar*)"\015", ( float )7, ( float )9, PM_STAR_10_OFT}, - {(Tchar*)"\016", ( float )9, ( float )11, PM_STAR_15_OFT}, - {(Tchar*)"\017", ( float )11, ( float )13, PM_STAR_20_OFT}, - {(Tchar*)"\020", ( float )13, ( float )15, PM_STAR_25_OFT}, - {(Tchar*)"\021", ( float )13, ( float )17, PM_STAR_30_OFT}, - {(Tchar*)"\022", ( float )15, ( float )19, PM_STAR_35_OFT}, - {(Tchar*)"\023", ( float )17, ( float )21, PM_STAR_40_OFT}, - {(Tchar*)"\024", ( float )19, ( float )23, PM_STAR_45_OFT}, - {(Tchar*)"\025", ( float )21, ( float )25, PM_STAR_50_OFT}, - {(Tchar*)"\026", ( float )23, ( float )27, PM_STAR_55_OFT}, - {(Tchar*)"\027", ( float )25, ( float )29, PM_STAR_60_OFT}, - {(Tchar*)"\030", ( float )32, ( float )32, PM_STAR_65_OFT}, - {(Tchar*)"\031", ( float )32, ( float )32, PM_STAR_70_OFT} }, - - { {(Tchar*)"\032", ( float )7, ( float )7, PM_CROSS_10_OFT}, - {(Tchar*)"\033", ( float )9, ( float )9, PM_CROSS_15_OFT}, - {(Tchar*)"\034", ( float )11, ( float )11, PM_CROSS_20_OFT}, - {(Tchar*)"\035", ( float )13, ( float )13, PM_CROSS_25_OFT}, - {(Tchar*)"\036", ( float )15, ( float )15, PM_CROSS_30_OFT}, - {(Tchar*)"\037", ( float )17, ( float )17, PM_CROSS_35_OFT}, - {(Tchar*)"\040", ( float )19, ( float )19, PM_CROSS_40_OFT}, - {(Tchar*)"\041", ( float )21, ( float )21, PM_CROSS_45_OFT}, - {(Tchar*)"\042", ( float )23, ( float )23, PM_CROSS_50_OFT}, - {(Tchar*)"\043", ( float )25, ( float )25, PM_CROSS_55_OFT}, - {(Tchar*)"\044", ( float )27, ( float )27, PM_CROSS_60_OFT}, - {(Tchar*)"\045", ( float )32, ( float )32, PM_CROSS_65_OFT}, - {(Tchar*)"\046", ( float )32, ( float )32, PM_CROSS_70_OFT} }, - - { {(Tchar*)"\047", ( float )7, ( float )7, PM_CIRC_10_OFT}, - {(Tchar*)"\050", ( float )9, ( float )9, PM_CIRC_15_OFT}, - {(Tchar*)"\051", ( float )9, ( float )9, PM_CIRC_20_OFT}, - {(Tchar*)"\052", ( float )11, ( float )11, PM_CIRC_25_OFT}, - {(Tchar*)"\053", ( float )13, ( float )13, PM_CIRC_30_OFT}, - {(Tchar*)"\054", ( float )15, ( float )15, PM_CIRC_35_OFT}, - {(Tchar*)"\055", ( float )17, ( float )17, PM_CIRC_40_OFT}, - {(Tchar*)"\056", ( float )19, ( float )19, PM_CIRC_45_OFT}, - {(Tchar*)"\057", ( float )21, ( float )21, PM_CIRC_50_OFT}, - {(Tchar*)"\060", ( float )23, ( float )23, PM_CIRC_55_OFT}, - {(Tchar*)"\061", ( float )25, ( float )25, PM_CIRC_60_OFT}, - {(Tchar*)"\062", ( float )27, ( float )27, PM_CIRC_65_OFT}, - {(Tchar*)"\063", ( float )29, ( float )29, PM_CIRC_70_OFT} }, - - { {(Tchar*)"\064", ( float )5, ( float )5, PM_DOT_10_OFT}, - {(Tchar*)"\065", ( float )5, ( float )5, PM_DOT_15_OFT}, - {(Tchar*)"\066", ( float )7, ( float )7, PM_DOT_20_OFT}, - {(Tchar*)"\067", ( float )7, ( float )7, PM_DOT_25_OFT}, - {(Tchar*)"\070", ( float )9, ( float )9, PM_DOT_30_OFT}, - {(Tchar*)"\071", ( float )9, ( float )9, PM_DOT_35_OFT}, - {(Tchar*)"\072", ( float )9, ( float )9, PM_DOT_40_OFT}, - {(Tchar*)"\073", ( float )9, ( float )9, PM_DOT_45_OFT}, - {(Tchar*)"\074", ( float )9, ( float )9, PM_DOT_50_OFT}, - {(Tchar*)"\075", ( float )9, ( float )9, PM_DOT_55_OFT}, - {(Tchar*)"\076", ( float )11, ( float )11, PM_DOT_60_OFT}, - {(Tchar*)"\077", ( float )11, ( float )11, PM_DOT_65_OFT}, - {(Tchar*)"\100", ( float )11, ( float )11, PM_DOT_70_OFT} } -}; - -#define TEL_PM_START_SIZE 1.0 -#define TEL_PM_END_SIZE 7.0 - -#define TEL_PM_SIZE_STEP 0.5 - -/*----------------------------------------------------------------------*/ - -static void -InitPMFont(void) -{ - Tint i, k1, k2, offset; - unsigned char raster[] = { - - 0x08,0x00, - 0x08,0x00, - 0x08,0x00, - 0x08,0x00, - 0xff,0x80, - 0x08,0x00, - 0x08,0x00, - 0x08,0x00, - 0x08,0x00, /* PLUS 9x9 = 1.0 */ - - 0x04,0x00, - 0x04,0x00, - 0x04,0x00, - 0x04,0x00, - 0x04,0x00, - 0xff,0xe0, - 0x04,0x00, - 0x04,0x00, - 0x04,0x00, - 0x04,0x00, - 0x04,0x00, /* PLUS 11x11 = 1.5 */ - - 0x02,0x00, - 0x02,0x00, - 0x02,0x00, - 0x02,0x00, - 0x02,0x00, - 0x02,0x00, - 0xff,0xf8, - 0x02,0x00, - 0x02,0x00, - 0x02,0x00, - 0x02,0x00, - 0x02,0x00, - 0x02,0x00,/* PLUS 13x13 = 2.0 */ - - 0x01,0x00, - 0x01,0x00, - 0x01,0x00, - 0x01,0x00, - 0x01,0x00, - 0x01,0x00, - 0x01,0x00, - 0xff,0xfe, - 0x01,0x00, - 0x01,0x00, - 0x01,0x00, - 0x01,0x00, - 0x01,0x00, - 0x01,0x00, - 0x01,0x00,/* PLUS 15x15 = 2.5 */ - - 0x00,0x80, 0x00, - 0x00,0x80, 0x00, - 0x00,0x80, 0x00, - 0x00,0x80, 0x00, - 0x00,0x80, 0x00, - 0x00,0x80, 0x00, - 0x00,0x80, 0x00, - 0x00,0x80, 0x00, - 0xff,0xff, 0x80, - 0x00,0x80, 0x00, - 0x00,0x80, 0x00, - 0x00,0x80, 0x00, - 0x00,0x80, 0x00, - 0x00,0x80, 0x00, - 0x00,0x80, 0x00, - 0x00,0x80, 0x00, - 0x00,0x80, 0x00,/* PLUS 17x17 = 3.0 */ - - - 0x00,0x40, 0x00, - 0x00,0x40, 0x00, - 0x00,0x40, 0x00, - 0x00,0x40, 0x00, - 0x00,0x40, 0x00, - 0x00,0x40, 0x00, - 0x00,0x40, 0x00, - 0x00,0x40, 0x00, - 0x00,0x40, 0x00, - 0xff,0xff, 0xe0, - 0x00,0x40, 0x00, - 0x00,0x40, 0x00, - 0x00,0x40, 0x00, - 0x00,0x40, 0x00, - 0x00,0x40, 0x00, - 0x00,0x40, 0x00, - 0x00,0x40, 0x00, - 0x00,0x40, 0x00, - 0x00,0x40, 0x00,/* PLUS 19x19 = 3.5 */ - - 0x00,0x20, 0x00, - 0x00,0x20, 0x00, - 0x00,0x20, 0x00, - 0x00,0x20, 0x00, - 0x00,0x20, 0x00, - 0x00,0x20, 0x00, - 0x00,0x20, 0x00, - 0x00,0x20, 0x00, - 0x00,0x20, 0x00, - 0x00,0x20, 0x00, - 0xff,0xff, 0xf8, - 0x00,0x20, 0x00, - 0x00,0x20, 0x00, - 0x00,0x20, 0x00, - 0x00,0x20, 0x00, - 0x00,0x20, 0x00, - 0x00,0x20, 0x00, - 0x00,0x20, 0x00, - 0x00,0x20, 0x00, - 0x00,0x20, 0x00, - 0x00,0x20, 0x00,/* PLUS 21x21 = 4.0 */ - - 0x00,0x10, 0x00, - 0x00,0x10, 0x00, - 0x00,0x10, 0x00, - 0x00,0x10, 0x00, - 0x00,0x10, 0x00, - 0x00,0x10, 0x00, - 0x00,0x10, 0x00, - 0x00,0x10, 0x00, - 0x00,0x10, 0x00, - 0x00,0x10, 0x00, - 0x00,0x10, 0x00, - 0xff,0xff, 0xfe, - 0x00,0x10, 0x00, - 0x00,0x10, 0x00, - 0x00,0x10, 0x00, - 0x00,0x10, 0x00, - 0x00,0x10, 0x00, - 0x00,0x10, 0x00, - 0x00,0x10, 0x00, - 0x00,0x10, 0x00, - 0x00,0x10, 0x00, - 0x00,0x10, 0x00, - 0x00,0x10, 0x00,/* PLUS 23x23 = 4.5 */ - - 0x00,0x08, 0x00,0x00, - 0x00,0x08, 0x00,0x00, - 0x00,0x08, 0x00,0x00, - 0x00,0x08, 0x00,0x00, - 0x00,0x08, 0x00,0x00, - 0x00,0x08, 0x00,0x00, - 0x00,0x08, 0x00,0x00, - 0x00,0x08, 0x00,0x00, - 0x00,0x08, 0x00,0x00, - 0x00,0x08, 0x00,0x00, - 0x00,0x08, 0x00,0x00, - 0x00,0x08, 0x00,0x00, - 0xff,0xff, 0xff,0x80, - 0x00,0x08, 0x00,0x00, - 0x00,0x08, 0x00,0x00, - 0x00,0x08, 0x00,0x00, - 0x00,0x08, 0x00,0x00, - 0x00,0x08, 0x00,0x00, - 0x00,0x08, 0x00,0x00, - 0x00,0x08, 0x00,0x00, - 0x00,0x08, 0x00,0x00, - 0x00,0x08, 0x00,0x00, - 0x00,0x08, 0x00,0x00, - 0x00,0x08, 0x00,0x00, - 0x00,0x08, 0x00,0x00,/* PLUS 25x25 = 5.0 */ - - 0x00,0x04, 0x00,0x00, - 0x00,0x04, 0x00,0x00, - 0x00,0x04, 0x00,0x00, - 0x00,0x04, 0x00,0x00, - 0x00,0x04, 0x00,0x00, - 0x00,0x04, 0x00,0x00, - 0x00,0x04, 0x00,0x00, - 0x00,0x04, 0x00,0x00, - 0x00,0x04, 0x00,0x00, - 0x00,0x04, 0x00,0x00, - 0x00,0x04, 0x00,0x00, - 0x00,0x04, 0x00,0x00, - 0x00,0x04, 0x00,0x00, - 0xff,0xff, 0xff,0xe0, - 0x00,0x04, 0x00,0x00, - 0x00,0x04, 0x00,0x00, - 0x00,0x04, 0x00,0x00, - 0x00,0x04, 0x00,0x00, - 0x00,0x04, 0x00,0x00, - 0x00,0x04, 0x00,0x00, - 0x00,0x04, 0x00,0x00, - 0x00,0x04, 0x00,0x00, - 0x00,0x04, 0x00,0x00, - 0x00,0x04, 0x00,0x00, - 0x00,0x04, 0x00,0x00, - 0x00,0x04, 0x00,0x00, - 0x00,0x04, 0x00,0x00,/* PLUS 27x27 = 5.5 */ - - 0x00,0x02, 0x00,0x00, - 0x00,0x02, 0x00,0x00, - 0x00,0x02, 0x00,0x00, - 0x00,0x02, 0x00,0x00, - 0x00,0x02, 0x00,0x00, - 0x00,0x02, 0x00,0x00, - 0x00,0x02, 0x00,0x00, - 0x00,0x02, 0x00,0x00, - 0x00,0x02, 0x00,0x00, - 0x00,0x02, 0x00,0x00, - 0x00,0x02, 0x00,0x00, - 0x00,0x02, 0x00,0x00, - 0x00,0x02, 0x00,0x00, - 0x00,0x02, 0x00,0x00, - 0xff,0xff, 0xff,0xf8, - 0x00,0x02, 0x00,0x00, - 0x00,0x02, 0x00,0x00, - 0x00,0x02, 0x00,0x00, - 0x00,0x02, 0x00,0x00, - 0x00,0x02, 0x00,0x00, - 0x00,0x02, 0x00,0x00, - 0x00,0x02, 0x00,0x00, - 0x00,0x02, 0x00,0x00, - 0x00,0x02, 0x00,0x00, - 0x00,0x02, 0x00,0x00, - 0x00,0x02, 0x00,0x00, - 0x00,0x02, 0x00,0x00, - 0x00,0x02, 0x00,0x00, - 0x00,0x02, 0x00,0x00,/* PLUS 29x29 = 6.0 */ - - 0x00,0x01, 0x00,0x00, - 0x00,0x01, 0x00,0x00, - 0x00,0x01, 0x00,0x00, - 0x00,0x01, 0x00,0x00, - 0x00,0x01, 0x00,0x00, - 0x00,0x01, 0x00,0x00, - 0x00,0x01, 0x00,0x00, - 0x00,0x01, 0x00,0x00, - 0x00,0x01, 0x00,0x00, - 0x00,0x01, 0x00,0x00, - 0x00,0x01, 0x00,0x00, - 0x00,0x01, 0x00,0x00, - 0x00,0x01, 0x00,0x00, - 0x00,0x01, 0x00,0x00, - 0x00,0x01, 0x00,0x00, - 0xff,0xff, 0xff,0xfd, - 0x00,0x01, 0x00,0x00, - 0x00,0x01, 0x00,0x00, - 0x00,0x01, 0x00,0x00, - 0x00,0x01, 0x00,0x00, - 0x00,0x01, 0x00,0x00, - 0x00,0x01, 0x00,0x00, - 0x00,0x01, 0x00,0x00, - 0x00,0x01, 0x00,0x00, - 0x00,0x01, 0x00,0x00, - 0x00,0x01, 0x00,0x00, - 0x00,0x01, 0x00,0x00, - 0x00,0x01, 0x00,0x00, - 0x00,0x01, 0x00,0x00, - 0x00,0x01, 0x00,0x00, - 0x00,0x01, 0x00,0x00,/* PLUS 31x31 = 6.5 */ - - 0x00,0x00, 0x80,0x00, - 0x00,0x00, 0x80,0x00, - 0x00,0x00, 0x80,0x00, - 0x00,0x00, 0x80,0x00, - 0x00,0x00, 0x80,0x00, - 0x00,0x00, 0x80,0x00, - 0x00,0x00, 0x80,0x00, - 0x00,0x00, 0x80,0x00, - 0x00,0x00, 0x80,0x00, - 0x00,0x00, 0x80,0x00, - 0x00,0x00, 0x80,0x00, - 0x00,0x00, 0x80,0x00, - 0x00,0x00, 0x80,0x00, - 0x00,0x00, 0x80,0x00, - 0x00,0x00, 0x80,0x00, - 0x00,0x00, 0x80,0x00, - 0xff,0xff, 0xff,0xff, - 0x00,0x00, 0x80,0x00, - 0x00,0x00, 0x80,0x00, - 0x00,0x00, 0x80,0x00, - 0x00,0x00, 0x80,0x00, - 0x00,0x00, 0x80,0x00, - 0x00,0x00, 0x80,0x00, - 0x00,0x00, 0x80,0x00, - 0x00,0x00, 0x80,0x00, - 0x00,0x00, 0x80,0x00, - 0x00,0x00, 0x80,0x00, - 0x00,0x00, 0x80,0x00, - 0x00,0x00, 0x80,0x00, - 0x00,0x00, 0x80,0x00, - 0x00,0x00, 0x80,0x00, - 0x00,0x00, 0x80,0x00,/* PLUS 32x32 = 7.0 */ - - 0x10, - 0x10, - 0xd6, - 0x38, - 0x10, - 0x38, - 0xd6, - 0x10, - 0x10,/* STAR 7x9 = 1.0 */ - - 0x08,0x00, - 0x08,0x00, - 0x08,0x00, - 0xc9,0x80, - 0x3e,0x00, - 0x08,0x00, - 0x3e,0x00, - 0xc9,0x80, - 0x08,0x00, - 0x08,0x00, - 0x08,0x00,/* STAR 9x11 = 1.5 */ - - 0x04,0x00, - 0x04,0x00, - 0x04,0x00, - 0x84,0x20, - 0x64,0xc0, - 0x1f,0x00, - 0x04,0x00, - 0x1f,0x00, - 0x64,0xc0, - 0x84,0x20, - 0x04,0x00, - 0x04,0x00, - 0x04,0x00,/* STAR 11x13 = 2.0 */ - - - 0x02,0x00, - 0x02,0x00, - 0x02,0x00, - 0x02,0x00, - 0x82,0x18, - 0x62,0x60, - 0x1b,0x80, - 0x06,0x00, - 0x1b,0x80, - 0x62,0x60, - 0x82,0x18, - 0x02,0x00, - 0x02,0x00, - 0x02,0x00, - 0x02,0x00,/* STAR 13x15 = 2.5 */ - - 0x02,0x00, - 0x02,0x00, - 0x02,0x00, - 0x02,0x00, - 0x82,0x08, - 0x62,0x30, - 0x12,0x40, - 0x0f,0x80, - 0x02,0x00, - 0x0f,0x80, - 0x12,0x40, - 0x62,0x30, - 0x82,0x08, - 0x02,0x00, - 0x02,0x00, - 0x02,0x00, - 0x02,0x00,/* STAR 13x17 = 3.0 */ - - 0x01,0x00, - 0x01,0x00, - 0x01,0x00, - 0x01,0x00, - 0x01,0x00, - 0xc1,0x06, - 0x21,0x18, - 0x19,0x20, - 0x07,0xc0, - 0x01,0x00, - 0x07,0xc0, - 0x19,0x20, - 0x21,0x18, - 0xc1,0x06, - 0x01,0x00, - 0x01,0x00, - 0x01,0x00, - 0x01,0x00, - 0x01,0x00,/* STAR 15x19 = 3.5 */ - - 0x00,0x80, 0x00, - 0x00,0x80, 0x00, - 0x00,0x80, 0x00, - 0x00,0x80, 0x00, - 0x00,0x80, 0x00, - 0x80,0x80, 0x80, - 0x60,0x83, 0x00, - 0x10,0x8c, 0x00, - 0x0c,0x90, 0x00, - 0x03,0xe0, 0x00, - 0x00,0x80, 0x00, - 0x03,0xe0, 0x00, - 0x0c,0x90, 0x00, - 0x10,0x8c, 0x00, - 0x60,0x83, 0x00, - 0x80,0x80, 0x80, - 0x00,0x80, 0x00, - 0x00,0x80, 0x00, - 0x00,0x80, 0x00, - 0x00,0x80, 0x00, - 0x00,0x80, 0x00,/* STAR 17x21 = 4.0 */ - - 0x00,0x40, 0x00, - 0x00,0x40, 0x00, - 0x00,0x40, 0x00, - 0x00,0x40, 0x00, - 0x00,0x40, 0x00, - 0x00,0x40, 0x00, - 0xc0,0x40, 0x60, - 0x30,0x41, 0x80, - 0x08,0x42, 0x00, - 0x06,0x4c, 0x00, - 0x01,0xf0, 0x00, - 0x00,0x40, 0x00, - 0x01,0xf0, 0x00, - 0x06,0x4c, 0x00, - 0x08,0x42, 0x00, - 0x30,0x41, 0x80, - 0xc0,0x40, 0x60, - 0x00,0x40, 0x00, - 0x00,0x40, 0x00, - 0x00,0x40, 0x00, - 0x00,0x40, 0x00, - 0x00,0x40, 0x00, - 0x00,0x40, 0x00,/* STAR 19x23 = 4.5 */ - - 0x00,0x20, 0x00, - 0x00,0x20, 0x00, - 0x00,0x20, 0x00, - 0x00,0x20, 0x00, - 0x00,0x20, 0x00, - 0x00,0x20, 0x00, - 0x80,0x20, 0x08, - 0x60,0x20, 0x30, - 0x18,0x20, 0xc0, - 0x04,0x21, 0x00, - 0x03,0x26, 0x00, - 0x00,0xf8, 0x00, - 0x00,0x20, 0x00, - 0x00,0xf8, 0x00, - 0x03,0x26, 0x00, - 0x04,0x21, 0x00, - 0x18,0x20, 0xc0, - 0x60,0x20, 0x30, - 0x80,0x20, 0x08, - 0x00,0x20, 0x00, - 0x00,0x20, 0x00, - 0x00,0x20, 0x00, - 0x00,0x20, 0x00, - 0x00,0x20, 0x00, - 0x00,0x20, 0x00,/* STAR 21x25 = 5.0 */ - - 0x00,0x10, 0x00, - 0x00,0x10, 0x00, - 0x00,0x10, 0x00, - 0x00,0x10, 0x00, - 0x00,0x10, 0x00, - 0x00,0x10, 0x00, - 0x00,0x10, 0x00, - 0xc0,0x10, 0x06, - 0x30,0x10, 0x18, - 0x08,0x10, 0x60, - 0x06,0x10, 0x80, - 0x01,0x93, 0x00, - 0x00,0x7c, 0x00, - 0x00,0x10, 0x00, - 0x00,0x7c, 0x00, - 0x01,0x93, 0x00, - 0x06,0x10, 0x80, - 0x08,0x10, 0x60, - 0x30,0x10, 0x18, - 0xc0,0x10, 0x06, - 0x00,0x10, 0x00, - 0x00,0x10, 0x00, - 0x00,0x10, 0x00, - 0x00,0x10, 0x00, - 0x00,0x10, 0x00, - 0x00,0x10, 0x00, - 0x00,0x10, 0x00,/* STAR 23x27 = 5.5 */ - - 0x00,0x08, 0x00,0x00, - 0x00,0x08, 0x00,0x00, - 0x00,0x08, 0x00,0x00, - 0x00,0x08, 0x00,0x00, - 0x00,0x08, 0x00,0x00, - 0x00,0x08, 0x00,0x00, - 0x00,0x08, 0x00,0x00, - 0x80,0x08, 0x00,0x80, - 0x60,0x08, 0x03,0x00, - 0x18,0x08, 0x0c,0x00, - 0x04,0x08, 0x30,0x00, - 0x03,0x08, 0x40,0x00, - 0x00,0xc9, 0x80,0x00, - 0x00,0x3e, 0x00,0x00, - 0x00,0x08, 0x00,0x00, - 0x00,0x3e, 0x00,0x00, - 0x00,0xc9, 0x80,0x00, - 0x03,0x08, 0x40,0x00, - 0x04,0x08, 0x30,0x00, - 0x18,0x08, 0x0c,0x00, - 0x60,0x08, 0x03,0x00, - 0x80,0x08, 0x00,0x80, - 0x00,0x08, 0x00,0x00, - 0x00,0x08, 0x00,0x00, - 0x00,0x08, 0x00,0x00, - 0x00,0x08, 0x00,0x00, - 0x00,0x08, 0x00,0x00, - 0x00,0x08, 0x00,0x00, - 0x00,0x08, 0x00,0x00,/* STAR 25x29 = 6.0 */ - - 0x00,0x00, 0x80,0x00, - 0x00,0x00, 0x80,0x00, - 0x00,0x00, 0x80,0x00, - 0x00,0x00, 0x80,0x00, - 0x00,0x00, 0x80,0x00, - 0x00,0x00, 0x80,0x00, - 0x00,0x00, 0x80,0x00, - 0x00,0x00, 0x80,0x00, - 0x00,0x00, 0x80,0x00, - 0x30,0x00, 0x80,0x06, - 0x0c,0x00, 0x80,0x18, - 0x03,0x00, 0x80,0x60, - 0x00,0xc0, 0x81,0x80, - 0x00,0x30, 0x86,0x00, - 0x00,0x0c, 0x98,0x00, - 0x00,0x03, 0xe0,0x00, - 0x00,0x03, 0xe0,0x00, - 0x00,0x0c, 0x98,0x00, - 0x00,0x30, 0x86,0x00, - 0x00,0xc0, 0x81,0x80, - 0x03,0x00, 0x80,0x60, - 0x0c,0x00, 0x80,0x18, - 0x30,0x00, 0x80,0x06, - 0x00,0x00, 0x80,0x00, - 0x00,0x00, 0x80,0x00, - 0x00,0x00, 0x80,0x00, - 0x00,0x00, 0x80,0x00, - 0x00,0x00, 0x80,0x00, - 0x00,0x00, 0x80,0x00, - 0x00,0x00, 0x80,0x00, - 0x00,0x00, 0x00,0x00, - 0x00,0x00, 0x00,0x00,/* STAR 32x32 = 6.5 */ - - 0x00, 0x00, 0x80, 0x00, - 0x00, 0x00, 0x80, 0x00, - 0x00, 0x00, 0x80, 0x00, - 0x00, 0x00, 0x80, 0x00, - 0x00, 0x00, 0x80, 0x00, - 0x00, 0x00, 0x80, 0x00, - 0x00, 0x00, 0x80, 0x00, - 0x00, 0x00, 0x80, 0x00, - 0x10, 0x00, 0x80, 0x04, - 0x0c, 0x00, 0x80, 0x18, - 0x02, 0x00, 0x80, 0x20, - 0x01, 0x80, 0x80, 0xc0, - 0x00, 0x40, 0x81, 0x00, - 0x00, 0x30, 0x86, 0x00, - 0x00, 0x08, 0x88, 0x00, - 0x00, 0x06, 0xb0, 0x00, - 0x00, 0x01, 0xc0, 0x00, - 0x00, 0x06, 0xb0, 0x00, - 0x00, 0x08, 0x88, 0x00, - 0x00, 0x30, 0x86, 0x00, - 0x00, 0x40, 0x81, 0x00, - 0x01, 0x80, 0x80, 0xc0, - 0x02, 0x00, 0x80, 0x20, - 0x0c, 0x00, 0x80, 0x18, - 0x10, 0x00, 0x80, 0x04, - 0x00, 0x00, 0x80, 0x00, - 0x00, 0x00, 0x80, 0x00, - 0x00, 0x00, 0x80, 0x00, - 0x00, 0x00, 0x80, 0x00, - 0x00, 0x00, 0x80, 0x00, - 0x00, 0x00, 0x80, 0x00, - 0x00, 0x00, 0x80, 0x00,/* STAR 32x32 = 7.0 */ - - - 0x82, - 0x44, - 0x28, - 0x10, - 0x28, - 0x44, - 0x82,/* CROSS 7x7 = 1.0 */ - - 0x80,0x80, - 0x41,0x00, - 0x22,0x00, - 0x14,0x00, - 0x08,0x00, - 0x14,0x00, - 0x22,0x00, - 0x41,0x00, - 0x80,0x80,/* CROSS 9x9 = 1.5 */ - - 0x80,0x20, - 0x40,0x40, - 0x20,0x80, - 0x11,0x00, - 0x0a,0x00, - 0x04,0x00, - 0x0a,0x00, - 0x11,0x00, - 0x20,0x80, - 0x40,0x40, - 0x80,0x20,/* CROSS 11x11 = 2.0 */ - - 0x80,0x08, - 0x40,0x10, - 0x20,0x20, - 0x10,0x40, - 0x08,0x80, - 0x05,0x00, - 0x02,0x00, - 0x05,0x00, - 0x08,0x80, - 0x10,0x40, - 0x20,0x20, - 0x40,0x10, - 0x80,0x08,/* CROSS 13x13 = 2.5 */ - - 0x80,0x02, - 0x40,0x04, - 0x20,0x08, - 0x10,0x10, - 0x08,0x20, - 0x04,0x40, - 0x02,0x80, - 0x01,0x00, - 0x02,0x80, - 0x04,0x40, - 0x08,0x20, - 0x10,0x10, - 0x20,0x08, - 0x40,0x04, - 0x80,0x02,/* CROSS 15x15 = 3.0 */ - - 0x80,0x00, 0x80, - 0x40,0x01, 0x00, - 0x20,0x02, 0x00, - 0x10,0x04, 0x00, - 0x08,0x08, 0x00, - 0x04,0x10, 0x00, - 0x02,0x20, 0x00, - 0x01,0x40, 0x00, - 0x00,0x80, 0x00, - 0x01,0x40, 0x00, - 0x02,0x20, 0x00, - 0x04,0x10, 0x00, - 0x08,0x08, 0x00, - 0x10,0x04, 0x00, - 0x20,0x02, 0x00, - 0x40,0x01, 0x00, - 0x80,0x00, 0x80,/* CROSS 17x17 = 3.5 */ - - 0x80,0x00, 0x20, - 0x40,0x00, 0x40, - 0x20,0x00, 0x80, - 0x10,0x01, 0x00, - 0x08,0x02, 0x00, - 0x04,0x04, 0x00, - 0x02,0x08, 0x00, - 0x01,0x10, 0x00, - 0x00,0xa0, 0x00, - 0x00,0x40, 0x00, - 0x00,0xa0, 0x00, - 0x01,0x10, 0x00, - 0x02,0x08, 0x00, - 0x04,0x04, 0x00, - 0x08,0x02, 0x00, - 0x10,0x01, 0x00, - 0x20,0x00, 0x80, - 0x40,0x00, 0x40, - 0x80,0x00, 0x20,/* CROSS 19x19 = 4.0 */ - - 0x80,0x00, 0x08, - 0x40,0x00, 0x10, - 0x20,0x00, 0x20, - 0x10,0x00, 0x40, - 0x08,0x00, 0x80, - 0x04,0x01, 0x00, - 0x02,0x02, 0x00, - 0x01,0x04, 0x00, - 0x00,0x88, 0x00, - 0x00,0x50, 0x00, - 0x00,0x20, 0x00, - 0x00,0x50, 0x00, - 0x00,0x88, 0x00, - 0x01,0x04, 0x00, - 0x02,0x02, 0x00, - 0x04,0x01, 0x00, - 0x08,0x00, 0x80, - 0x10,0x00, 0x40, - 0x20,0x00, 0x20, - 0x40,0x00, 0x10, - 0x80,0x00, 0x08,/* CROSS 21x21 = 4.5 */ - - 0x80,0x00, 0x02, - 0x40,0x00, 0x04, - 0x20,0x00, 0x08, - 0x10,0x00, 0x10, - 0x08,0x00, 0x20, - 0x04,0x00, 0x40, - 0x02,0x00, 0x80, - 0x01,0x01, 0x00, - 0x00,0x82, 0x00, - 0x00,0x44, 0x00, - 0x00,0x28, 0x00, - 0x00,0x10, 0x00, - 0x00,0x28, 0x00, - 0x00,0x44, 0x00, - 0x00,0x82, 0x00, - 0x01,0x01, 0x00, - 0x02,0x00, 0x80, - 0x04,0x00, 0x40, - 0x08,0x00, 0x20, - 0x10,0x00, 0x10, - 0x20,0x00, 0x08, - 0x40,0x00, 0x04, - 0x80,0x00, 0x02,/* CROSS 23x23 = 5.0 */ - - 0x80,0x00, 0x00,0x80, - 0x40,0x00, 0x01,0x00, - 0x20,0x00, 0x02,0x00, - 0x10,0x00, 0x04,0x00, - 0x08,0x00, 0x08,0x00, - 0x04,0x00, 0x10,0x00, - 0x02,0x00, 0x20,0x00, - 0x01,0x00, 0x40,0x00, - 0x00,0x80, 0x80,0x00, - 0x00,0x41, 0x00,0x00, - 0x00,0x22, 0x00,0x00, - 0x00,0x14, 0x00,0x00, - 0x00,0x08, 0x00,0x00, - 0x00,0x14, 0x00,0x00, - 0x00,0x22, 0x00,0x00, - 0x00,0x41, 0x00,0x00, - 0x00,0x80, 0x80,0x00, - 0x01,0x00, 0x40,0x00, - 0x02,0x00, 0x20,0x00, - 0x04,0x00, 0x10,0x00, - 0x08,0x00, 0x08,0x00, - 0x10,0x00, 0x04,0x00, - 0x20,0x00, 0x02,0x00, - 0x40,0x00, 0x01,0x00, - 0x80,0x00, 0x00,0x80,/* CROSS 25x25 = 5.5 */ - - 0x80,0x00, 0x00,0x20, - 0x40,0x00, 0x00,0x40, - 0x20,0x00, 0x00,0x80, - 0x10,0x00, 0x01,0x00, - 0x08,0x00, 0x02,0x00, - 0x04,0x00, 0x04,0x00, - 0x02,0x00, 0x08,0x00, - 0x01,0x00, 0x10,0x00, - 0x00,0x80, 0x20,0x00, - 0x00,0x40, 0x40,0x00, - 0x00,0x20, 0x80,0x00, - 0x00,0x11, 0x00,0x00, - 0x00,0x0a, 0x00,0x00, - 0x00,0x04, 0x00,0x00, - 0x00,0x0a, 0x00,0x00, - 0x00,0x11, 0x00,0x00, - 0x00,0x20, 0x80,0x00, - 0x00,0x40, 0x40,0x00, - 0x00,0x80, 0x20,0x00, - 0x01,0x00, 0x10,0x00, - 0x02,0x00, 0x08,0x00, - 0x04,0x00, 0x04,0x00, - 0x08,0x00, 0x02,0x00, - 0x10,0x00, 0x01,0x00, - 0x20,0x00, 0x00,0x80, - 0x40,0x00, 0x00,0x40, - 0x80,0x00, 0x00,0x20,/* CROSS 27x27 = 6.0 */ - - 0x00,0x00, 0x00,0x00, - 0x00,0x00, 0x00,0x00, - 0x20,0x00, 0x00,0x04, - 0x10,0x00, 0x00,0x08, - 0x08,0x00, 0x00,0x10, - 0x04,0x00, 0x00,0x20, - 0x02,0x00, 0x00,0x40, - 0x01,0x00, 0x00,0x80, - 0x00,0x80, 0x01,0x00, - 0x00,0x40, 0x02,0x00, - 0x00,0x20, 0x04,0x00, - 0x00,0x10, 0x08,0x00, - 0x00,0x08, 0x10,0x00, - 0x00,0x04, 0x20,0x00, - 0x00,0x02, 0x40,0x00, - 0x00,0x01, 0x80,0x00, - 0x00,0x01, 0x80,0x00, - 0x00,0x02, 0x40,0x00, - 0x00,0x04, 0x20,0x00, - 0x00,0x08, 0x10,0x00, - 0x00,0x10, 0x08,0x00, - 0x00,0x20, 0x04,0x00, - 0x00,0x40, 0x02,0x00, - 0x00,0x80, 0x01,0x00, - 0x01,0x00, 0x00, 0x80, - 0x02,0x00, 0x00,0x40, - 0x04,0x00, 0x00,0x20, - 0x08,0x00, 0x00,0x10, - 0x10,0x00, 0x00,0x08, - 0x20,0x00, 0x00,0x04, - 0x00,0x00, 0x00,0x00, - 0x00,0x00, 0x00,0x00,/* CROSS 32x32 = 6.5 */ - - 0x00,0x00, 0x00,0x00, - 0x40,0x00, 0x00,0x02, - 0x20,0x00, 0x00,0x04, - 0x10,0x00, 0x00,0x08, - 0x08,0x00, 0x00,0x10, - 0x04,0x00, 0x00,0x20, - 0x02,0x00, 0x00,0x40, - 0x01,0x00, 0x00,0x80, - 0x00,0x80, 0x01,0x00, - 0x00,0x40, 0x02,0x00, - 0x00,0x20, 0x04,0x00, - 0x00,0x10, 0x08,0x00, - 0x00,0x08, 0x10,0x00, - 0x00,0x04, 0x20,0x00, - 0x00,0x02, 0x40,0x00, - 0x00,0x01, 0x80,0x00, - 0x00,0x01, 0x80,0x00, - 0x00,0x02, 0x40,0x00, - 0x00,0x04, 0x20,0x00, - 0x00,0x08, 0x10,0x00, - 0x00,0x10, 0x08,0x00, - 0x00,0x20, 0x04,0x00, - 0x00,0x40, 0x02,0x00, - 0x00,0x80, 0x01,0x00, - 0x01,0x00, 0x00,0x80, - 0x02,0x00, 0x00,0x40, - 0x04,0x00, 0x00,0x20, - 0x08,0x00, 0x00,0x10, - 0x10,0x00, 0x00,0x08, - 0x20,0x00, 0x00,0x04, - 0x40,0x00, 0x00,0x02, - 0x00,0x00, 0x00,0x00,/* CROSS 32x32 = 7.0 */ - - 0x38, - 0x44, - 0x82, - 0x82, - 0x82, - 0x44, - 0x38,/* CIRC 7x7 = 1.0 */ - - 0x3c,0x00, - 0x42,0x00, - 0x81,0x00, - 0x81,0x00, - 0x81,0x00, - 0x81,0x00, - 0x42,0x00, - 0x3c,0x00, - 0x00,0x00,/*CIRC 9x9 = 1.5 */ - - 0x3e, 0x00, - 0x41, 0x00, - 0x81, 0x80, - 0x80,0x80, - 0x80,0x80, - 0x80,0x80, - 0x81, 0x80, - 0x41, 0x00, - 0x3e,0x00,/* CIRC 9x9 = 2.0 */ - - 0x1f,0x00, - 0x20,0x80, - 0x40,0x40, - 0x80,0x20, - 0x80,0x20, - 0x80,0x20, - 0x80,0x20, - 0x80,0x20, - 0x40,0x40, - 0x20,0x80, - 0x1f,0x00,/* CIRC 11x11 = 2.5 */ - - 0x0f,0x80, - 0x10,0x40, - 0x20,0x20, - 0x40,0x10, - 0x80,0x08, - 0x80,0x08, - 0x80,0x08, - 0x80,0x08, - 0x80,0x08, - 0x40,0x10, - 0x20,0x20, - 0x10,0x40, - 0x0f,0x80,/* CIRC 13x13 = 3.0 */ - - 0x07,0xc0, - 0x18,0x30, - 0x20,0x08, - 0x40,0x04, - 0x40,0x04, - 0x80,0x02, - 0x80,0x02, - 0x80,0x02, - 0x80,0x02, - 0x80,0x02, - 0x40,0x04, - 0x40,0x04, - 0x20,0x08, - 0x18,0x30, - 0x07,0xc0,/* CIRC 15x15 = 3.5 */ - - 0x03,0xe0, 0x00, - 0x0c,0x18, 0x00, - 0x10,0x04, 0x00, - 0x20,0x02, 0x00, - 0x40,0x01, 0x00, - 0x40,0x01, 0x00, - 0x80,0x00, 0x80, - 0x80,0x00, 0x80, - 0x80,0x00, 0x80, - 0x80,0x00, 0x80, - 0x80,0x00, 0x80, - 0x40,0x01, 0x00, - 0x40,0x01, 0x00, - 0x20,0x02, 0x00, - 0x10,0x04, 0x00, - 0x0c,0x18, 0x00, - 0x03,0xe0, 0x00,/* CIRC 17x17 = 4.0 */ - - 0x03,0xf8, 0x00, - 0x0e,0x0e, 0x00, - 0x18,0x03, 0x00, - 0x20,0x00, 0x80, - 0x60,0x00, 0xc0, - 0x40,0x00, 0x40, - 0xc0,0x00, 0x60, - 0x80,0x00, 0x20, - 0x80,0x00, 0x20, - 0x80,0x00, 0x20, - 0x80,0x00, 0x20, - 0x80,0x00, 0x20, - 0xc0,0x00, 0x60, - 0x40,0x00, 0x40, - 0x60,0x00, 0xc0, - 0x20,0x00, 0x80, - 0x18,0x03, 0x00, - 0x0e,0x0e, 0x00, - 0x03,0xf8, 0x00,/* CIRC 19x19 = 4.5 */ - - - 0x01,0xfc, 0x00, - 0x06,0x03, 0x00, - 0x08,0x00, 0x80, - 0x10,0x00, 0x40, - 0x20,0x00, 0x20, - 0x40,0x00, 0x10, - 0x40,0x00, 0x10, - 0x80,0x00, 0x08, - 0x80,0x00, 0x08, - 0x80,0x00, 0x08, - 0x80,0x00, 0x08, - 0x80,0x00, 0x08, - 0x80,0x00, 0x08, - 0x80,0x00, 0x08, - 0x40,0x00, 0x10, - 0x40,0x00, 0x10, - 0x20,0x00, 0x20, - 0x10,0x00, 0x40, - 0x08,0x00, 0x80, - 0x06,0x03, 0x00, - 0x01,0xfc, 0x00,/* CIRC 21x21 = 5.0 */ - - 0x00,0xfe, 0x00, - 0x03,0x01, 0x80, - 0x0c,0x00, 0x60, - 0x18,0x00, 0x30, - 0x30,0x00, 0x18, - 0x20,0x00, 0x08, - 0x40,0x00, 0x04, - 0x40,0x00, 0x04, - 0x80,0x00, 0x02, - 0x80,0x00, 0x02, - 0x80,0x00, 0x02, - 0x80,0x00, 0x02, - 0x80,0x00, 0x02, - 0x80,0x00, 0x02, - 0x80,0x00, 0x02, - 0x40,0x00, 0x04, - 0x40,0x00, 0x04, - 0x20,0x00, 0x08, - 0x30,0x00, 0x18, - 0x18,0x00, 0x30, - 0x0c,0x00, 0x60, - 0x03,0x01, 0x80, - 0x00,0xfe, 0x00,/* CIRC 23x23 = 5.5 */ - - 0x00,0x7f, 0x00,0x00, - 0x01,0x80, 0xc0,0x00, - 0x06,0x00, 0x30,0x00, - 0x08,0x00, 0x08,0x00, - 0x10,0x00, 0x04,0x00, - 0x20,0x00, 0x02,0x00, - 0x20,0x00, 0x02,0x00, - 0x40,0x00, 0x01,0x00, - 0x40,0x00, 0x01,0x00, - 0x80,0x00, 0x00,0x80, - 0x80,0x00, 0x00,0x80, - 0x80,0x00, 0x00,0x80, - 0x80,0x00, 0x00,0x80, - 0x80,0x00, 0x00,0x80, - 0x80,0x00, 0x00,0x80, - 0x80,0x00, 0x00,0x80, - 0x40,0x00, 0x01,0x00, - 0x40,0x00, 0x01,0x00, - 0x20,0x00, 0x02,0x00, - 0x20,0x00, 0x02,0x00, - 0x10,0x00, 0x04,0x00, - 0x08,0x00, 0x08,0x00, - 0x06,0x00, 0x30,0x00, - 0x01,0x80, 0xc0,0x00, - 0x00,0x7f, 0x00,0x00,/* CIRC 25x25 = 6.0 */ - - 0x00,0x3f, 0x80,0x00, - 0x01,0xc0, 0x70,0x00, - 0x03,0x00, 0x18,0x00, - 0x0c,0x00, 0x06,0x00, - 0x18,0x00, 0x03,0x00, - 0x10,0x00, 0x01,0x00, - 0x20,0x00, 0x00,0x80, - 0x60,0x00, 0x00,0xc0, - 0x40,0x00, 0x00,0x40, - 0x40,0x00, 0x00,0x40, - 0x80,0x00, 0x00,0x20, - 0x80,0x00, 0x00,0x20, - 0x80,0x00, 0x00,0x20, - 0x80,0x00, 0x00,0x20, - 0x80,0x00, 0x00,0x20, - 0x80,0x00, 0x00,0x20, - 0x80,0x00, 0x00,0x20, - 0x40,0x00, 0x00,0x40, - 0x40,0x00, 0x00,0x40, - 0x60,0x00, 0x00,0xc0, - 0x20,0x00, 0x00,0x80, - 0x10,0x00, 0x01,0x00, - 0x18,0x00, 0x03,0x00, - 0x0c,0x00, 0x06,0x00, - 0x03,0x00, 0x18,0x00, - 0x01,0xc0, 0x70,0x00, - 0x00,0x3f, 0x80,0x00,/* CIRC 27x27 = 6.5 */ - - 0x00,0x1f, 0xc0,0x00, - 0x00,0xe0, 0x38,0x00, - 0x01,0x00, 0x04,0x00, - 0x06,0x00, 0x03,0x00, - 0x08,0x00, 0x00,0x80, - 0x10,0x00, 0x00,0x40, - 0x10,0x00, 0x00,0x40, - 0x20,0x00, 0x00,0x20, - 0x40,0x00, 0x00,0x10, - 0x40,0x00, 0x00,0x10, - 0x40,0x00, 0x00,0x10, - 0x80,0x00, 0x00,0x08, - 0x80,0x00, 0x00,0x08, - 0x80,0x00, 0x00,0x08, - 0x80,0x00, 0x00,0x08, - 0x80,0x00, 0x00,0x08, - 0x80,0x00, 0x00,0x08, - 0x80,0x00, 0x00,0x08, - 0x40,0x00, 0x00,0x10, - 0x40,0x00, 0x00,0x10, - 0x40,0x00, 0x00,0x10, - 0x20,0x00, 0x00,0x20, - 0x10,0x00, 0x00,0x40, - 0x10,0x00, 0x00,0x40, - 0x08,0x00, 0x00,0x80, - 0x06,0x00, 0x03,0x00, - 0x01,0x00, 0x04,0x00, - 0x00,0xe0, 0x38,0x00, - 0x00,0x1f, 0xc0,0x00, /* CIRC 29x29 = 7.0 */ - - 0x00, - 0x18, - 0x18, - 0x00, - 0x00,/* DOT 5x5 = 1.0 */ - - 0x70, - 0xf8, - 0xf8, - 0xf8, - 0x70,/* DOT 5x5 = 1.5 = 1.0 */ - - 0x38, - 0x7c, - 0xfe, - 0xfe, - 0xfe, - 0x7c, - 0x38,/* DOT 7x7 = 2.0 */ - - 0x38, - 0x7c, - 0xfe, - 0xfe, - 0xfe, - 0x7c, - 0x38,/* DOT 7x7 = 2.5 = 2.0 */ - - 0x00,0x00, - 0x3c,0x00, - 0x7e,0x00, - 0xff,0x00, - 0xff,0x00, - 0xff,0x00, - 0x7e,0x00, - 0x3c,0x00, - 0x00,0x00,/* DOT 9x9 = 3.0 */ - - 0x00,0x00, - 0x3c,0x00, - 0x7e,0x00, - 0xff,0x00, - 0xff,0x00, - 0xff,0x00, - 0x7e,0x00, - 0x3c,0x00, - 0x00,0x00,/* DOT 9x9 = 3.5 = 3.0 */ - - 0x1c,0x00, - 0x7f,0x00, - 0x7f,0x00, - 0xff,0x80, - 0xff,0x80, - 0xff,0x80, - 0x7f,0x00, - 0x7f,0x00, - 0x1c,0x00,/* DOT 9x9 = 4.0 */ - - 0x1c,0x00, - 0x7f,0x00, - 0x7f,0x00, - 0xff,0x80, - 0xff,0x80, - 0xff,0x80, - 0x7f,0x00, - 0x7f,0x00, - 0x1c,0x00,/* DOT 9x9 = 4.5 = 4.0 */ - - 0x3e,0x00, - 0x7f,0x00, - 0xff,0x80, - 0xff,0x80, - 0xff,0x80, - 0xff,0x80, - 0xff,0x80, - 0x7f,0x00, - 0x3e,0x00,/* DOT 9x9 = 5.0 */ - - 0x3e,0x00, - 0x7f,0x00, - 0xff,0x80, - 0xff,0x80, - 0xff,0x80, - 0xff,0x80, - 0xff,0x80, - 0x7f,0x00, - 0x3e,0x00,/* DOT 9x9 = 5.5 = 5.0 */ - - 0x1e, 0x00, - 0x3f, 0x80, - 0xff, 0xc0, - 0xff, 0xe1, - 0xff, 0xe1, - 0xff, 0xf1, - 0xff, 0xe1, - 0xff, 0xe1, - 0xff, 0xc0, - 0x3f, 0x80, - 0x1e, 0x00,/* DOT 11x11 = 6.0 */ - - 0x1e, 0x00, - 0x3f, 0x80, - 0xff, 0xc0, - 0xff, 0xe1, - 0xff, 0xe1, - 0xff, 0xf1, - 0xff, 0xe1, - 0xff, 0xe1, - 0xff, 0xc0, - 0x3f, 0x80, - 0x1e, 0x00,/* DOT 11x11 = 6.5 = 6.0 */ - - 0x1e, 0x00, - 0x3f, 0x80, - 0xff, 0xc0, - 0xff, 0xe1, - 0xff, 0xe1, - 0xff, 0xf1, - 0xff, 0xe1, - 0xff, 0xe1, - 0xff, 0xc0, - 0x3f, 0x80, - 0x1e, 0x00 /* DOT 11x11 = 7.0 = 6.0 */ - }; - - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - - markerBase = glGenLists (80); - - for( i = 0; i < TEL_NO_OF_SIZES*TEL_NB_OF_MARKERS; i++ ) - { - GLsizei w, h, size, j; - - k1 = i / TEL_NO_OF_SIZES; - k2 = i % TEL_NO_OF_SIZES; - offset = array[k1][k2].offset; - - w = ( GLsizei ) array[k1][k2].width; - h = ( GLsizei ) array[k1][k2].height; - - glNewList( (GLuint) array[k1][k2].str[0]+markerBase, GL_COMPILE); - - glBitmap( w, h, (float)(array[k1][k2].width) / ( float )2.0, - (float)(array[k1][k2].height) / ( float )2.0, - ( float )30.0, ( float )30.0, (const GLubyte *) &raster[offset]); - - glEndList(); - - } - -} - -/*----------------------------------------------------------------------*/ - -Tchar * -TelGetStringForPM( Tint mrkr_type, Tfloat val ) -{ - Tint id; - Tfloat index; - - if( val < TEL_PM_START_SIZE ) - val = ( float )1.0; - if( val > TEL_PM_END_SIZE ) - val = ( float )7.0; - - index = ( float )(TEL_NO_OF_SIZES-1) * (val - ( float )TEL_PM_START_SIZE ) - / ( float )(TEL_PM_END_SIZE - TEL_PM_START_SIZE); - id = (Tint)(index + 0.5 ); - - return array[mrkr_type][id].str; -} -/*----------------------------------------------------------------------*/ diff --git a/src/OpenGl/OpenGl_inquire.cxx b/src/OpenGl/OpenGl_inquire.cxx deleted file mode 100755 index 290c89b1dc..0000000000 --- a/src/OpenGl/OpenGl_inquire.cxx +++ /dev/null @@ -1,48 +0,0 @@ - -#include -#include -#include -#include -#include - -TStatus -TelInqCurElemTypeSize( TelType *element, Tint *size ) -{ - CMN_KEY key; - TSM_ELEM elem; - TStatus status; - - if( TsmGetCurElem( &elem ) == TFailure ) - return TFailure; - - *element = elem.el; - key.id = INQ_GET_SIZE_ID; - status = TsmSendMessage( elem.el, Inquire, elem.data, 1, &key ); - *size = key.data.ldata; - - return status; -} - -TStatus -TelInqCurElemContent( Tint size, Tchar *buf, Tint *act_size, Teldata *data ) -{ - CMN_KEY key; - TSM_ELEM elem; - TStatus status; - TEL_INQ_CONTENT content; - - if( TsmGetCurElem( &elem ) == TFailure ) - return TFailure; - - content.size = size; - content.buf = buf; - content.data = data; - - key.data.pdata = &content; - - key.id = INQ_GET_CONTENT_ID; - status = TsmSendMessage( elem.el, Inquire, elem.data, 1, &key ); - *act_size = content.act_size; - - return status; -} diff --git a/src/OpenGl/OpenGl_inquire.hxx b/src/OpenGl/OpenGl_inquire.hxx deleted file mode 100755 index a9fa1a6761..0000000000 --- a/src/OpenGl/OpenGl_inquire.hxx +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef OPENGL_INQUIRE_H -#define OPENGL_INQUIRE_H - -typedef struct { - int AntiAliasing; - int DepthCueing; - int DoubleBuffer; - int ZBuffer; - int MaxLights; - int MaxPlanes; - int MaxViews; -} CALL_DEF_INQUIRE; - -extern CALL_DEF_INQUIRE call_facilities_list; /* defined in tgl/tgl1 */ - -#endif diff --git a/src/OpenGl/OpenGl_intcol.cxx b/src/OpenGl/OpenGl_intcol.cxx deleted file mode 100755 index 2bedcbc2b1..0000000000 --- a/src/OpenGl/OpenGl_intcol.cxx +++ /dev/null @@ -1,131 +0,0 @@ - -#include - -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -static TStatus InteriorColourDisplay( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus InteriorColourAdd( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus InteriorColourDelete( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus InteriorColourPrint( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus InteriorColourInquire( TSM_ELEM_DATA, Tint, cmn_key* ); - -static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) = -{ - 0, /* PickTraverse */ - InteriorColourDisplay, - InteriorColourAdd, - InteriorColourDelete, - InteriorColourPrint, - InteriorColourInquire -}; - - -MtblPtr -TelInteriorColourInitClass( TelType *el ) -{ - *el = TelInteriorColour; - return MtdTbl; -} - -static TStatus -InteriorColourAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k ) -{ - tel_colour data = new TEL_COLOUR(); - - //cmn_memreserve( data, 1, 0 ); - if( !data ) - return TFailure; - - *data = *(tel_colour)(k[0]->data.pdata); - - ((tsm_elem_data)(d.pdata))->pdata = data; - - return TSuccess; -} - - -static TStatus -InteriorColourDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - tel_colour d; - CMN_KEY key; - - d = (tel_colour)data.pdata; - - key.id = TelInteriorColour; - key.data.pdata = d; - TsmSetAttri( 1, &key ); - - return TSuccess; -} - - -static TStatus -InteriorColourDelete( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - //cmn_freemem( data.pdata ); - if (data.pdata) - delete data.pdata; - return TSuccess; -} - - - - -static TStatus -InteriorColourPrint( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - tel_colour p; - - p = (tel_colour)data.pdata; - - fprintf( stdout, "TelInteriorColour. R = %g, G = %g, B = %g\n", - p->rgb[0], p->rgb[1], p->rgb[2] ); - fprintf( stdout, "\n" ); - - return TSuccess; -} - - -static TStatus -InteriorColourInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - Tint i; - tel_colour col; - - col = (tel_colour)data.pdata; - - for( i = 0; i < n; i++ ) - { - switch( k[i]->id ) - { - case INQ_GET_SIZE_ID: - { - k[i]->data.ldata = sizeof( Tint ); - break; - } - case INQ_GET_CONTENT_ID: - { - TEL_INQ_CONTENT *c; - Teldata *w; - - c = (tel_inq_content)k[i]->data.pdata; - w = c->data; - c->act_size = 0; - w->gnl_colour = *col; - break; - } - } - } - - return TSuccess; -} diff --git a/src/OpenGl/OpenGl_intrefl.cxx b/src/OpenGl/OpenGl_intrefl.cxx deleted file mode 100755 index 4e8e5670d4..0000000000 --- a/src/OpenGl/OpenGl_intrefl.cxx +++ /dev/null @@ -1,125 +0,0 @@ -/* 08-04-98 : FGU ; Ajout emission */ - -#include - -#include -#include -#include -#include - -#include - -#include -#include -#include -#include -#include - -static TStatus InteriorReflectanceEquationAdd( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus InteriorReflectanceEquationDisplay( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus InteriorReflectanceEquationPrint( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus InteriorReflectanceEquationInquire( TSM_ELEM_DATA, Tint, cmn_key* ); - -static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) = -{ - 0, /* PickTraverse */ - InteriorReflectanceEquationDisplay, - InteriorReflectanceEquationAdd, - 0, /* Delete */ - InteriorReflectanceEquationPrint, - InteriorReflectanceEquationInquire -}; - - -MtblPtr -TelInteriorReflectanceEquationInitClass( TelType *el ) -{ - *el = TelInteriorReflectanceEquation; - return MtdTbl; -} - -static TStatus -InteriorReflectanceEquationAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k ) -{ - ((tsm_elem_data)(d.pdata))->ldata = k[0]->data.ldata; - - return TSuccess; -} - - -static TStatus -InteriorReflectanceEquationDisplay( TSM_ELEM_DATA d, Tint n, cmn_key *k ) -{ - CMN_KEY key; - - key.id = TelInteriorReflectanceEquation; - key.data.ldata = d.ldata; - TsmSetAttri( 1, &key ); - return TSuccess; -} - - -static TStatus -InteriorReflectanceEquationPrint( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - switch( data.ldata ) - { - case CALL_PHIGS_REFL_NONE: - fprintf( stdout, "TelInteriorReflectanceEquation. Value = NONE\n" ); - break; - default : - fprintf( stdout, "TelInteriorReflectanceEquation. Value = %d\n", data.ldata ); - break; - - /* case TelLModelAmbient: - fprintf( stdout, "TelInteriorReflectanceEquation. Value = \ - GL_AMBIENT\n" ); - break; - - case TelLModelDiffuse: - fprintf( stdout, "TelInteriorReflectanceEquation. Value = \ - GL_AMBIENT_AND_DIFFUSE\n" ); - break; - - case TelLModelSpecular: - fprintf( stdout, "TelInteriorReflectanceEquation. Value = \ - GL_SPECULAR\n" ); - break;*/ - } - - fprintf( stdout, "\n" ); - - return TSuccess; -} - - -static TStatus -InteriorReflectanceEquationInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - Tint i; - - for( i = 0; i < n; i++ ) - { - switch( k[i]->id ) - { - case INQ_GET_SIZE_ID: - { - k[i]->data.ldata = sizeof( Tint ); - break; - } - case INQ_GET_CONTENT_ID: - { - TEL_INQ_CONTENT *c; - Teldata *w; - - c = (tel_inq_content)k[i]->data.pdata; - w = c->data; - c->act_size = 0; - w->idata = data.ldata; - break; - } - } - } - - return TSuccess; -} diff --git a/src/OpenGl/OpenGl_intshademtd.cxx b/src/OpenGl/OpenGl_intshademtd.cxx deleted file mode 100755 index 16b259eb7c..0000000000 --- a/src/OpenGl/OpenGl_intshademtd.cxx +++ /dev/null @@ -1,108 +0,0 @@ - -#include - -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -static TStatus InteriorShadingMethodAdd( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus InteriorShadingMethodDisplay( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus InteriorShadingMethodPrint( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus InteriorShadingMethodInquire( TSM_ELEM_DATA, Tint, cmn_key* ); - -static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) = -{ - 0, /* PickTraverse */ - InteriorShadingMethodDisplay, - InteriorShadingMethodAdd, - 0, /* Delete */ - InteriorShadingMethodPrint, - InteriorShadingMethodInquire -}; - - -MtblPtr -TelInteriorShadingMethodInitClass( TelType *el ) -{ - *el = TelInteriorShadingMethod; - return MtdTbl; -} - -static TStatus -InteriorShadingMethodAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k ) -{ - ((tsm_elem_data)(d.pdata))->ldata = k[0]->data.ldata; - - return TSuccess; -} - - -static TStatus -InteriorShadingMethodDisplay( TSM_ELEM_DATA d, Tint n, cmn_key *k ) -{ - CMN_KEY key; - - key.id = TelInteriorShadingMethod; - key.data.ldata = d.ldata; - TsmSetAttri( 1, &key ); - return TSuccess; -} - - -static TStatus -InteriorShadingMethodPrint( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - switch( data.ldata ) - { - case TEL_SM_FLAT: - fprintf( stdout, "TelInteriorShadingMethod. Value = GL_FLAT\n" ); - break; - - case TEL_SM_GOURAUD: - fprintf( stdout, "TelInteriorShadingMethod. Value = GL_SMOOTH\n" ); - break; - } - - fprintf( stdout, "\n" ); - - return TSuccess; -} - - -static TStatus -InteriorShadingMethodInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - Tint i; - - for( i = 0; i < n; i++ ) - { - switch( k[i]->id ) - { - case INQ_GET_SIZE_ID: - { - k[i]->data.ldata = sizeof( Tint ); - break; - } - case INQ_GET_CONTENT_ID: - { - TEL_INQ_CONTENT *c; - Teldata *w; - - c = (tel_inq_content)k[i]->data.pdata; - w = c->data; - c->act_size = 0; - w->idata = data.ldata; - break; - } - } - } - - return TSuccess; -} diff --git a/src/OpenGl/OpenGl_intstyle.cxx b/src/OpenGl/OpenGl_intstyle.cxx deleted file mode 100755 index 2a44c2e65b..0000000000 --- a/src/OpenGl/OpenGl_intstyle.cxx +++ /dev/null @@ -1,150 +0,0 @@ -/*********************************************************************** - -FONCTION : ----------- -Fichier OpenGl_intstyle.c - - -REMARQUES: ----------- - - -HISTORIQUE DES MODIFICATIONS : --------------------------------- -??-??-?? : PCT ; creation -15-01-98 : FMN ; Ajout Hidden line - -************************************************************************/ - -/*----------------------------------------------------------------------*/ -/* -* Includes -*/ - -#include - -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -/*----------------------------------------------------------------------*/ - -static TStatus InteriorStyleDisplay( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus InteriorStyleAdd( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus InteriorStylePrint( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus InteriorStyleInquire( TSM_ELEM_DATA, Tint, cmn_key* ); - -static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) = -{ - 0, /* PickTraverse */ - InteriorStyleDisplay, - InteriorStyleAdd, - 0, /* Delete */ - InteriorStylePrint, - InteriorStyleInquire -}; - - -MtblPtr -TelInteriorStyleInitClass( TelType *el ) -{ - *el = TelInteriorStyle; - return MtdTbl; -} - -static TStatus -InteriorStyleAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k ) -{ - ((tsm_elem_data)(d.pdata))->ldata = k[0]->data.ldata; - - return TSuccess; -} - - -static TStatus -InteriorStyleDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - CMN_KEY key; - - key.id = TelInteriorStyle; - key.data.ldata = data.ldata; - TsmSetAttri( 1, &key ); - - return TSuccess; -} - - -static TStatus -InteriorStylePrint( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - switch( data.ldata ) - { - case TSM_SOLID: - fprintf( stdout, "TelInteriorStyle. Value = SOLID\n" ); - break; - - case TSM_HOLLOW: - fprintf( stdout, "TelInteriorStyle. Value = HOLLOW\n" ); - break; - - case TSM_EMPTY: - fprintf( stdout, "TelInteriorStyle. Value = EMPTY\n" ); - break; - - case TSM_HATCH: - fprintf( stdout, "TelInteriorStyle. Value = HATCH\n" ); - break; - - case TSM_POINT: - fprintf( stdout, "TelInteriorStyle. Value = POINT\n" ); - break; - - case TSM_HIDDENLINE: - fprintf( stdout, "TelInteriorStyle. Value = HIDDENLINE\n" ); - break; - - - } - fprintf( stdout, "\n" ); - - return TSuccess; -} - - -static TStatus -InteriorStyleInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - Tint i; - - for( i = 0; i < n; i++ ) - { - switch( k[i]->id ) - { - case INQ_GET_SIZE_ID: - { - k[i]->data.ldata = sizeof( Tint ); - break; - } - case INQ_GET_CONTENT_ID: - { - TEL_INQ_CONTENT *c; - Teldata *w; - - c = (tel_inq_content)k[i]->data.pdata; - w = c->data; - c->act_size = 0; - w->idata = data.ldata; - break; - } - } - } - - return TSuccess; -} diff --git a/src/OpenGl/OpenGl_intstyleind.cxx b/src/OpenGl/OpenGl_intstyleind.cxx deleted file mode 100755 index 8d895b4e92..0000000000 --- a/src/OpenGl/OpenGl_intstyleind.cxx +++ /dev/null @@ -1,153 +0,0 @@ - -#include - -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -static TStatus InteriorStyleIndexDisplay( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus InteriorStyleIndexAdd( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus InteriorStyleIndexPrint( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus InteriorStyleIndexInquire( TSM_ELEM_DATA, Tint, cmn_key* ); - -static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) = -{ - 0, /* PickTraverse */ - InteriorStyleIndexDisplay, - InteriorStyleIndexAdd, - 0, /* Delete */ - InteriorStyleIndexPrint, - InteriorStyleIndexInquire -}; - - -MtblPtr -TelInteriorStyleIndexInitClass( TelType *el ) -{ - *el = TelInteriorStyleIndex; - return MtdTbl; -} - -static TStatus -InteriorStyleIndexAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k ) -{ - ((tsm_elem_data)(d.pdata))->ldata = k[0]->data.ldata; - - return TSuccess; -} - - -static TStatus -InteriorStyleIndexDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - CMN_KEY key; - - key.id = TelInteriorStyleIndex; - key.data.ldata = data.ldata; - TsmSetAttri( 1, &key ); - - return TSuccess; -} - - -static TStatus -InteriorStyleIndexPrint( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - switch( data.ldata ) - { - case TEL_HS_SOLID: - fprintf( stdout, "TelInteriorStyleIndex. Value = SOLID\n" ); - break; - - case TEL_HS_CROSS: - fprintf( stdout, "TelInteriorStyleIndex. Value = CROSS\n" ); - break; - - case TEL_HS_CROSS_SPARSE: - fprintf( stdout, "TelInteriorStyleIndex. Value = CROSS_SPARSE\n"); - break; - - case TEL_HS_GRID: - fprintf( stdout, "TelInteriorStyleIndex. Value = GRID\n" ); - break; - - case TEL_HS_GRID_SPARSE: - fprintf( stdout, "TelInteriorStyleIndex. Value = GRID_SPARSE\n" ); - break; - - case TEL_HS_DIAG_45: - fprintf( stdout, "TelInteriorStyleIndex. Value = DIAG_45\n" ); - break; - - case TEL_HS_DIAG_135: - fprintf( stdout, "TelInteriorStyleIndex. Value = DIAG_135\n" ); - break; - - case TEL_HS_HORIZONTAL: - fprintf( stdout, "TelInteriorStyleIndex. Value = HORIZONTAL\n" ); - break; - - case TEL_HS_VERTICAL: - fprintf( stdout, "TelInteriorStyleIndex. Value = VERTICAL\n" ); - break; - - case TEL_HS_DIAG_45_SPARSE: - fprintf(stdout,"TelInteriorStyleIndex. Value = DIAG_45_SPARSE\n"); - break; - - case TEL_HS_DIAG_135_SPARSE: - fprintf( stdout, "TelInteriorStyleIndex. Value = DIAG_135_SPARSE\n" ); - break; - - case TEL_HS_HORIZONTAL_SPARSE: - fprintf( stdout,"TelInteriorStyleIndex. Value = HORIZONTAL_SPARSE\n"); - break; - - case TEL_HS_VERTICAL_SPARSE: - fprintf( stdout, "TelInteriorStyleIndex. Value = VERTICAL_SPARSE\n" ); - break; - - } - fprintf( stdout, "\n" ); - - return TSuccess; -} - - -static TStatus -InteriorStyleIndexInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - Tint i; - - for( i = 0; i < n; i++ ) - { - switch( k[i]->id ) - { - case INQ_GET_SIZE_ID: - { - k[i]->data.ldata = sizeof( Tint ); - break; - } - case INQ_GET_CONTENT_ID: - { - TEL_INQ_CONTENT *c; - Teldata *w; - - c = (tel_inq_content)k[i]->data.pdata; - w = c->data; - c->act_size = 0; - w->idata = data.ldata; - break; - } - } - } - - return TSuccess; -} diff --git a/src/OpenGl/OpenGl_label.cxx b/src/OpenGl/OpenGl_label.cxx deleted file mode 100755 index 58cebefcd7..0000000000 --- a/src/OpenGl/OpenGl_label.cxx +++ /dev/null @@ -1,82 +0,0 @@ - -#include - -#include -#include - -#include -#include -#include -#include -#include - -static TStatus LabelAdd( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus LabelPrint( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus LabelInquire( TSM_ELEM_DATA, Tint, cmn_key* ); - -static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) = -{ - 0, /* PickTraverse */ - 0, /* Display */ - LabelAdd, - 0, /* Delete */ - LabelPrint, - LabelInquire -}; - - -MtblPtr -TelLabelInitClass( TelType *el ) -{ - *el = TelLabel; - return MtdTbl; -} - -static TStatus -LabelAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k ) -{ - ((tsm_elem_data)(d.pdata))->ldata = k[0]->data.ldata; - - return TSuccess; -} - - -static TStatus -LabelPrint( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - fprintf( stdout, "TelLabel. Value = %d\n", data.ldata); - fprintf( stdout, "\n" ); - - return TSuccess; -} - -static TStatus -LabelInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - Tint i; - - for( i = 0; i < n; i++ ) - { - switch( k[i]->id ) - { - case INQ_GET_SIZE_ID: - { - k[i]->data.ldata = sizeof( Tint ); - break; - } - case INQ_GET_CONTENT_ID: - { - TEL_INQ_CONTENT *c; - Teldata *w; - - c = (tel_inq_content)k[i]->data.pdata; - w = c->data; - c->act_size = 0; - w->idata = data.ldata; - break; - } - } - } - - return TSuccess; -} diff --git a/src/OpenGl/OpenGl_lightstate.cxx b/src/OpenGl/OpenGl_lightstate.cxx deleted file mode 100755 index fb819a8cf0..0000000000 --- a/src/OpenGl/OpenGl_lightstate.cxx +++ /dev/null @@ -1,177 +0,0 @@ -/*********************************************************************** - -FONCTION : ----------- -File OpenGl_qstrip : - - -REMARQUES: ----------- - - -HISTORIQUE DES MODIFICATIONS : --------------------------------- -xx-xx-xx : xxx ; Creation. -30-06-97 : FMN ; Appel de la toolkit OpenGl_LightBox. - -************************************************************************/ - -/*----------------------------------------------------------------------*/ -/* -* Includes -*/ - - -#include - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -static TStatus LightSrcStateDisplay( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus LightSrcStateAdd( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus LightSrcStateDelete( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus LightSrcStatePrint( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus LightSrcStateInquire( TSM_ELEM_DATA, Tint, cmn_key* ); - -static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) = -{ - 0, /* PickTraverse */ - LightSrcStateDisplay, - LightSrcStateAdd, - LightSrcStateDelete, - LightSrcStatePrint, - LightSrcStateInquire -}; - -#define NO_TRACE_LIGHT - -MtblPtr -TelLightSrcStateInitClass( TelType* el ) -{ - *el = TelLightSrcState; - return MtdTbl; -} - -static TStatus -LightSrcStateAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k ) -{ - Tint i, num, *ptr; - tel_tint_data data; - - num = k[0]->id; - data = new TEL_TINT_DATA(); - if( !data ) - return TFailure; - data->data = new int[num]; - if( !data->data ) - return TFailure; - - for( i=0, ptr=(Tint*)(k[0]->data.pdata); idata[i] = ptr[i]; - } - data->num = num; - - ((tsm_elem_data)(d.pdata))->pdata = data; - - return TSuccess; -} - - -static TStatus -LightSrcStateDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - tel_tint_data d = (tel_tint_data)data.pdata; - -#ifdef TRACE_LIGHT - printf("OpenGl_lightstate::LightSrcStateDisplay:UpdateLight(%d)\n", TglActiveWs); -#endif - UpdateLight( TglActiveWs); - return TSuccess; -} - -static TStatus -LightSrcStateDelete( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - delete [] data.pdata; - return TSuccess; -} - - - - -static TStatus -LightSrcStatePrint( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - Tint i; - tel_tint_data p; - - p = (tel_tint_data)data.pdata; - - fprintf( stdout, "TelLightSrcState. Number: %d\n", p->num ); - for( i = 0; i < p->num; i++ ) - { - fprintf( stdout, "\n\t\t v[%d] = %d", i, p->data[i] ); - } - fprintf( stdout, "\n" ); - - return TSuccess; -} - - -static TStatus -LightSrcStateInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - Tint i; - tel_tint_data d; - Tint size_reqd=0; - TStatus status = TSuccess; - - d = (tel_tint_data)data.pdata; - - size_reqd = d->num * sizeof( Tint ); - - for( i = 0; i < n; i++ ) - { - switch( k[i]->id ) - { - case INQ_GET_SIZE_ID: - { - k[i]->data.ldata = size_reqd; - break; - } - - case INQ_GET_CONTENT_ID: - { - TEL_INQ_CONTENT *c; - Teldata *w; - - c = (tel_inq_content)k[i]->data.pdata; - c->act_size = size_reqd; - w = c->data; - - if( c->size >= size_reqd ) - { - w->light_source_state.on.number = d->num; - w->light_source_state.off.number = 0; - w->light_source_state.on.integers = (Tint *)(c->buf); - w->light_source_state.off.integers = 0; - - memcpy( w->light_source_state.on.integers, d->data, d->num*sizeof(Tint) ); - } - - break; - } - } - } - return status; -} diff --git a/src/OpenGl/OpenGl_localtran3.cxx b/src/OpenGl/OpenGl_localtran3.cxx deleted file mode 100755 index 0705026ab9..0000000000 --- a/src/OpenGl/OpenGl_localtran3.cxx +++ /dev/null @@ -1,139 +0,0 @@ - -#include - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -static TStatus LocalTran3Display( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus LocalTran3Add( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus LocalTran3Delete( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus LocalTran3Print( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus LocalTran3Inquire( TSM_ELEM_DATA, Tint, cmn_key* ); - -static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) = -{ - LocalTran3Display, /* PickTraverse */ - LocalTran3Display, - LocalTran3Add, - LocalTran3Delete, - LocalTran3Print, - LocalTran3Inquire -}; - - -MtblPtr -TelLocalTran3InitClass( TelType *el ) -{ - *el = TelLocalTran3; - return MtdTbl; -} - -static TStatus -LocalTran3Add( TSM_ELEM_DATA d, Tint n, cmn_key *k ) -{ - tel_matrix3_data data = new TEL_MATRIX3_DATA(); - - //cmn_memreserve( data, 1, 0 ); - - if( !data ) - return TFailure; - - data->mode = (TComposeType)(k[0]->id); - matcpy( data->mat, k[0]->data.pdata ); - - ((tsm_elem_data)(d.pdata))->pdata = data; - - return TSuccess; -} - - -static TStatus -LocalTran3Display( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - tel_matrix3_data d; - CMN_KEY key; - - d = (tel_matrix3_data)data.pdata; - - key.id = TelLocalTran3; - key.data.pdata = d; - TsmSetAttri( 1, &key ); - - return TSuccess; -} - - -static TStatus -LocalTran3Delete( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - //cmn_freemem( data.pdata ); - if (data.pdata) - delete data.pdata; - return TSuccess; -} - - - - -static TStatus -LocalTran3Print( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - tel_matrix3_data d; - Tint i; - - d = (tel_matrix3_data)data.pdata; - - fprintf( stdout, "TelLocalTran3. \n" ); - for( i=0; i<4; i++ ) - fprintf( stdout, "\t\t%12.7f %12.7f %12.7f %12.7f\n", d->mat[i][0], - d->mat[i][1], d->mat[i][2], d->mat[i][3] ); - fprintf( stdout, "\n" ); - - return TSuccess; -} - - -static TStatus -LocalTran3Inquire( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - Tint i; - tel_matrix3_data d; - - d = (tel_matrix3_data)data.pdata; - - for( i = 0; i < n; i++ ) - { - switch( k[i]->id ) - { - case INQ_GET_SIZE_ID: - { - k[i]->data.ldata = 0; - break; - } - - case INQ_GET_CONTENT_ID: - { - TEL_INQ_CONTENT *c; - Teldata *w; - - c = (tel_inq_content)k[i]->data.pdata; - c->act_size = 0; - w = c->data; - - w->local_xform_3.compose_type = d->mode; - //cmn_memcpy( w->local_xform_3.mat3, d->mat, sizeof( Tmatrix3), 1 ); - memcpy( w->local_xform_3.mat3, d->mat, sizeof( Tmatrix3) ); - } - } - } - return TSuccess; -} diff --git a/src/OpenGl/OpenGl_mrkr.cxx b/src/OpenGl/OpenGl_mrkr.cxx deleted file mode 100755 index f6edf4ddd2..0000000000 --- a/src/OpenGl/OpenGl_mrkr.cxx +++ /dev/null @@ -1,235 +0,0 @@ -/*********************************************************************** - -FONCTION : ----------- -File OpenGl_mrkr : - - -REMARQUES: ----------- - - -HISTORIQUE DES MODIFICATIONS : --------------------------------- -xx-xx-xx : xxx ; Creation. -11-03-96 : FMN ; Correction warning compilation -01-04-96 : CAL ; Integration MINSK portage WNT -08-07-96 : BGN ; (PRO4768) suppression du cas particulier TEL_PM_DOT. -21-10-96 : FMN ; Suppression LMC_COLOR fait dans OpenGl_execstruct.c -19-10-96 : CAL ; Restauration du cas particulier TEL_PM_DOT mais -avec la correction sur la mise a jour du pointSize. - -************************************************************************/ - -/*----------------------------------------------------------------------*/ -/* -* Includes -*/ - - -#include - -#include -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include - -extern GLuint GetListIndex(int); - - -static TStatus MarkerDisplay( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus MarkerAdd( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus MarkerDelete( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus MarkerPrint( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus MarkerInquire( TSM_ELEM_DATA, Tint, cmn_key* ); - -/*static GLboolean lighting_mode;*/ - -static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) = -{ - MarkerDisplay, /* PickTraverse */ - MarkerDisplay, - MarkerAdd, - MarkerDelete, - MarkerPrint, - MarkerInquire -}; - - -MtblPtr -TelMarkerInitClass( TelType *el ) -{ - *el = TelMarker; - return MtdTbl; -} - -static TStatus -MarkerAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k ) -{ - tel_point data = new TEL_POINT; - - if( !data ) - return TFailure; - - *data = *(tel_point)(k[0]->data.pdata); - - ((tsm_elem_data)(d.pdata))->pdata = data; - - return TSuccess; -} - -extern GLuint markerBase; -static TStatus -MarkerDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - tel_point p; - CMN_KEY key1, key2, key3; - TEL_COLOUR colour; - Tchar *str; - - key1.id = TelPolymarkerColour; - key1.data.pdata = &colour; - - key2.id = TelPolymarkerType; - key3.id = TelPolymarkerSize; - - TsmGetAttri( 3, &key1, &key2, &key3 ); - - if( k[0]->id == TOn ) - { /* Use highlight colours */ - TEL_HIGHLIGHT hrep; - - key1.id = TelHighlightIndex; - TsmGetAttri( 1, &key1 ); - if( TelGetHighlightRep( TglActiveWs, key1.data.ldata, &hrep ) - == TSuccess ) - colour = hrep.col; - else - { - TelGetHighlightRep( TglActiveWs, 0, &hrep ); - colour = hrep.col; - } - } - - glColor3fv( colour.rgb ); - p = (tel_point)data.pdata; - if( key2.data.ldata == TEL_PM_DOT ) - { - glPointSize( key3.data.fdata ); - glBegin( GL_POINTS ); - glVertex3fv( p->xyz ); - glEnd(); - } - else - { - GLint mode; - glGetIntegerv( GL_RENDER_MODE, &mode ); - if( key2.data.ldata == TEL_PM_USERDEFINED ) - { - glRasterPos3f( (GLfloat)(p->xyz[0]), - (GLfloat)(p->xyz[1]), - (GLfloat)(p->xyz[2]) ); - glCallList( GetListIndex( (int)key3.data.fdata ) ); - } - else - { - str = TelGetStringForPM( key2.data.ldata, key3.data.fdata ); - glRasterPos3f( (GLfloat)(p->xyz[0]), (GLfloat)(p->xyz[1]), - (GLfloat)(p->xyz[2]) ); - glListBase(markerBase); - glCallLists(strlen( (char*)str ), GL_UNSIGNED_BYTE, (GLubyte *) str ); - } - - if( mode==GL_FEEDBACK ) - { - glBegin( GL_POINTS ); - glVertex3f( p->xyz[0], p->xyz[1], p->xyz[2] ); - glEnd(); - /* it is necessary to indicate end of marker information*/ - } - } - - return TSuccess; -} - - -static TStatus -MarkerDelete( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - if (data.pdata) - delete data.pdata; - return TSuccess; -} - - - - -static TStatus -MarkerPrint( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - tel_point p; - - p = (tel_point)data.pdata; - - fprintf( stdout, "TelMarker. Value = %g, %g, %g\n", - p->xyz[0], p->xyz[1], p->xyz[2] ); - fprintf( stdout, "\n" ); - - return TSuccess; -} - - -static TStatus -MarkerInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - Tint i; - tel_point d; - Tint size_reqd=0; - TStatus status = TSuccess; - - d = (tel_point)data.pdata; - - size_reqd = sizeof( TEL_POINT ); - - for( i = 0; i < n; i++ ) - { - switch( k[i]->id ) - { - case INQ_GET_SIZE_ID: - { - k[i]->data.ldata = size_reqd; - break; - } - - case INQ_GET_CONTENT_ID: - { - TEL_INQ_CONTENT *c; - Teldata *w; - - c = (tel_inq_content)k[i]->data.pdata; - c->act_size = size_reqd; - w = c->data; - - if( c->size >= size_reqd ) - { - w->pts3 = (tel_point)(c->buf); - *(w->pts3) = *d; - status = TSuccess; - } - else - status = TFailure; - break; - } - } - } - return status; -} diff --git a/src/OpenGl/OpenGl_mrkrcol.cxx b/src/OpenGl/OpenGl_mrkrcol.cxx deleted file mode 100755 index cc53f8fc1a..0000000000 --- a/src/OpenGl/OpenGl_mrkrcol.cxx +++ /dev/null @@ -1,134 +0,0 @@ - -#include - -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -static TStatus PolymarkerColourDisplay( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus PolymarkerColourAdd( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus PolymarkerColourDelete( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus PolymarkerColourPrint( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus PolymarkerColourInquire( TSM_ELEM_DATA, Tint, cmn_key* ); - -static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) = -{ - 0, /* PickTraverse */ - PolymarkerColourDisplay, - PolymarkerColourAdd, - PolymarkerColourDelete, - PolymarkerColourPrint, - PolymarkerColourInquire -}; - - -MtblPtr -TelPolymarkerColourInitClass( TelType *el ) -{ - *el = TelPolymarkerColour; - return MtdTbl; -} - -static TStatus -PolymarkerColourAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k ) -{ - tel_colour data = new TEL_COLOUR(); - - //cmn_memreserve( data, 1, 0 ); - if( !data ) - return TFailure; - - *data = *(tel_colour)(k[0]->data.pdata); - - ((tsm_elem_data)(d.pdata))->pdata = data; - - return TSuccess; -} - - -static TStatus -PolymarkerColourDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - tel_colour d; - CMN_KEY key; - - d = (tel_colour)data.pdata; - - key.id = TelPolymarkerColour; - key.data.pdata = d; - TsmSetAttri( 1, &key ); - - return TSuccess; -} - - -static TStatus -PolymarkerColourDelete( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - //cmn_freemem( data.pdata ); - if (data.pdata) - delete data.pdata; - return TSuccess; -} - - - - -static TStatus -PolymarkerColourPrint( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - tel_colour p; - - p = (tel_colour)data.pdata; - - fprintf( stdout, "TelPolymarkerColour. R = %g, G = %g, B = %g\n", - p->rgb[0], p->rgb[1], p->rgb[2] ); - fprintf( stdout, "\n" ); - - return TSuccess; -} - - -static TStatus -PolymarkerColourInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - Tint i; - tel_colour col; - - col = (tel_colour)data.pdata; - - for( i = 0; i < n; i++ ) - { - switch( k[i]->id ) - { - case INQ_GET_SIZE_ID: - { - k[i]->data.ldata = sizeof( Tint ); - break; - } - case INQ_GET_CONTENT_ID: - { - TEL_INQ_CONTENT *c; - Teldata *w; - - c = (tel_inq_content)k[i]->data.pdata; - w = c->data; - c->act_size = 0; - - w->gnl_colour.rgb[0] = col->rgb[0]; - w->gnl_colour.rgb[1] = col->rgb[1]; - w->gnl_colour.rgb[2] = col->rgb[2]; - break; - } - } - } - - return TSuccess; -} diff --git a/src/OpenGl/OpenGl_mrkrset.cxx b/src/OpenGl/OpenGl_mrkrset.cxx deleted file mode 100755 index 485bb5cc69..0000000000 --- a/src/OpenGl/OpenGl_mrkrset.cxx +++ /dev/null @@ -1,268 +0,0 @@ -/*********************************************************************** - -FONCTION : ----------- -File OpenGl_mrkrset : - - -REMARQUES: ----------- - - -HISTORIQUE DES MODIFICATIONS : --------------------------------- -xx-xx-xx : xxx ; Creation. -11-03-96 : FMN ; Correction warning compilation -01-04-96 : CAL ; Integration MINSK portage WNT -08-07-96 : BGN ; (PRO4768) suppression du cas particulier TEL_PM_DOT. -21-10-96 : FMN ; Suppression LMC_COLOR fait dans OpenGl_execstruct.c -19-10-96 : CAL ; Restauration du cas particulier TEL_PM_DOT mais -avec la correction sur la mise a jour du pointSize. - -************************************************************************/ - -/*----------------------------------------------------------------------*/ -/* -* Includes -*/ - - -#include - -#include -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include - -static TStatus MarkerSetDisplay( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus MarkerSetAdd( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus MarkerSetDelete( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus MarkerSetPrint( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus MarkerSetInquire( TSM_ELEM_DATA, Tint, cmn_key* ); - - -extern GLuint GetListIndex(int); - -static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) = -{ - MarkerSetDisplay, /* PickTraverse */ - MarkerSetDisplay, - MarkerSetAdd, - MarkerSetDelete, - MarkerSetPrint, - MarkerSetInquire -}; - - -MtblPtr -TelMarkerSetInitClass( TelType* el ) -{ - *el = TelMarkerSet; - return MtdTbl; -} - -extern GLuint markerBase; -static TStatus -MarkerSetAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k ) -{ - Tint i, num; - tel_point_data data; - tel_point ptr; - - num = k[0]->id; - data = new TEL_POINT_DATA(); - if( !data ) - return TFailure; - - data->data = new TEL_POINT[num]; - if( !data->data ) - return TFailure; - - for( i=0, ptr=(tel_point)(k[0]->data.pdata); idata[i] = ptr[i]; - } - data->num = num; - - ((tsm_elem_data)(d.pdata))->pdata = data; - - return TSuccess; -} - - -static TStatus -MarkerSetDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - tel_point_data d; - tel_point ptr; - Tint i; - CMN_KEY key1, key2, key3; - TEL_COLOUR colour; - Tchar *str; - - key1.id = TelPolymarkerColour; - key1.data.pdata = &colour; - - key2.id = TelPolymarkerType; - key3.id = TelPolymarkerSize; - TsmGetAttri( 3, &key1, &key2, &key3 ); - - if( k[0]->id == TOn ) - { /* Use highlight colours */ - TEL_HIGHLIGHT hrep; - - key1.id = TelHighlightIndex; - TsmGetAttri( 1, &key1 ); - if( TelGetHighlightRep( TglActiveWs, key1.data.ldata, &hrep ) - == TSuccess ) - colour = hrep.col; - else - { - TelGetHighlightRep( TglActiveWs, 0, &hrep ); - colour = hrep.col; - } - } - - glColor3fv( colour.rgb ); - d = (tel_point_data)data.pdata; - ptr = d->data; - - if( key2.data.ldata == TEL_PM_DOT ) - { - glPointSize( key3.data.fdata ); - glBegin( GL_POINTS ); - for( i=0; inum; i++, ptr++ ) - glVertex3f( ptr->xyz[0], ptr->xyz[1], ptr->xyz[2] ); - glEnd(); - } - else - { - GLint mode; - glGetIntegerv( GL_RENDER_MODE, &mode ); - - if( key2.data.ldata == TEL_PM_USERDEFINED ) - { - for( i=0; inum; i++, ptr++ ) - { - glRasterPos3f( ptr->xyz[0], ptr->xyz[1], ptr->xyz[2] ); - glCallList( GetListIndex( (int)key3.data.fdata ) ); - if( mode==GL_FEEDBACK ) - { - glBegin( GL_POINTS ); - glVertex3f( ptr->xyz[0], ptr->xyz[1], ptr->xyz[2] ); - glEnd(); - /* it is necessary to indicate end of marker information */ - } - } - } - else - { - str = TelGetStringForPM( key2.data.ldata, key3.data.fdata ); - glListBase(markerBase); - for( i=0; inum; i++, ptr++ ) - { - glRasterPos3f( ptr->xyz[0], ptr->xyz[1], ptr->xyz[2] ); - glCallLists(strlen( (char*)str ), GL_UNSIGNED_BYTE, (GLubyte *) str ); - - if( mode==GL_FEEDBACK ) - { - glBegin( GL_POINTS ); - glVertex3f( ptr->xyz[0], ptr->xyz[1], ptr->xyz[2] ); - glEnd(); - } - } - } - } - - return TSuccess; -} - - -static TStatus -MarkerSetDelete( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - if (data.pdata) - delete data.pdata; - return TSuccess; -} - - - - -static TStatus -MarkerSetPrint( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - Tint i; - tel_point_data p; - - p = (tel_point_data)data.pdata; - - fprintf( stdout, "TelMarkerSet. Number of points: %d\n", p->num ); - for( i = 0; i < p->num; i++ ) - { - fprintf( stdout, "\n\t\t v[%d] = %g %g %g", i, p->data[i].xyz[0], - p->data[i].xyz[1], p->data[i].xyz[2] ); - } - fprintf( stdout, "\n" ); - - return TSuccess; -} - - -static TStatus -MarkerSetInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - Tint i, j; - tel_point_data d; - Tint size_reqd=0; - TStatus status = TSuccess; - - d = (tel_point_data)data.pdata; - - size_reqd = d->num * sizeof( TEL_POINT ); - - for( i = 0; i < n; i++ ) - { - switch( k[i]->id ) - { - case INQ_GET_SIZE_ID: - { - k[i]->data.ldata = size_reqd; - break; - } - - case INQ_GET_CONTENT_ID: - { - TEL_INQ_CONTENT *c; - Teldata *w; - - c = (tel_inq_content)k[i]->data.pdata; - c->act_size = size_reqd; - w = c->data; - - if( c->size >= size_reqd ) - { - w->pts3 = (tel_point)(c->buf); - - for( j = 0; j < d->num; j++ ) - w->pts3[j] = d->data[j]; - - status = TSuccess; - } - else - status = TFailure; - break; - } - } - } - return status; -} diff --git a/src/OpenGl/OpenGl_mrkrsize.cxx b/src/OpenGl/OpenGl_mrkrsize.cxx deleted file mode 100755 index ec3b9313bf..0000000000 --- a/src/OpenGl/OpenGl_mrkrsize.cxx +++ /dev/null @@ -1,116 +0,0 @@ - -#include - -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -static TStatus PolymarkerSizeDisplay( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus PolymarkerSizeAdd( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus PolymarkerSizeDelete( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus PolymarkerSizePrint( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus PolymarkerSizeInquire( TSM_ELEM_DATA, Tint, cmn_key* ); - -static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) = -{ - 0, /* PickTraverse */ - PolymarkerSizeDisplay, - PolymarkerSizeAdd, - PolymarkerSizeDelete, - PolymarkerSizePrint, - PolymarkerSizeInquire -}; - - -MtblPtr -TelPolymarkerSizeInitClass( TelType *el ) -{ - *el = TelPolymarkerSize; - return MtdTbl; -} - -static TStatus -PolymarkerSizeAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k ) -{ - Tfloat *data = new Tfloat(); - if( !data ) - return TFailure; - - *data = k[0]->data.fdata; - - ((tsm_elem_data)(d.pdata))->pdata = data; - - return TSuccess; -} - - -static TStatus -PolymarkerSizeDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - CMN_KEY key; - - key.id = TelPolymarkerSize; - key.data.fdata = *(Tfloat*)(data.pdata); - TsmSetAttri( 1, &key ); - - return TSuccess; -} - - -static TStatus -PolymarkerSizeDelete( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - if (data.pdata) - delete data.pdata; - return TSuccess; -} - - -static TStatus -PolymarkerSizePrint( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - fprintf( stdout, "TelPolymarkerSize. Value = %g\n", *(Tfloat *)(data.pdata)); - fprintf( stdout, "\n" ); - - return TSuccess; -} - - -static TStatus -PolymarkerSizeInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - Tint i; - Tfloat *f = (Tfloat *)data.pdata; - - for( i = 0; i < n; i++ ) - { - switch( k[i]->id ) - { - case INQ_GET_SIZE_ID: - { - k[i]->data.ldata = sizeof( Tint ); - break; - } - case INQ_GET_CONTENT_ID: - { - TEL_INQ_CONTENT *c; - Teldata *w; - - c = (tel_inq_content)k[i]->data.pdata; - w = c->data; - c->act_size = 0; - w->fdata = *f; - break; - } - } - } - - return TSuccess; -} diff --git a/src/OpenGl/OpenGl_mrkrtype.cxx b/src/OpenGl/OpenGl_mrkrtype.cxx deleted file mode 100755 index 62a9581a5d..0000000000 --- a/src/OpenGl/OpenGl_mrkrtype.cxx +++ /dev/null @@ -1,127 +0,0 @@ - -#include - -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -static TStatus PolymarkerTypeDisplay( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus PolymarkerTypeAdd( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus PolymarkerTypePrint( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus PolymarkerTypeInquire( TSM_ELEM_DATA, Tint, cmn_key* ); - -static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) = -{ - PolymarkerTypeDisplay, /* PickTraverse */ - PolymarkerTypeDisplay, - PolymarkerTypeAdd, - 0, /* Delete */ - PolymarkerTypePrint, - PolymarkerTypeInquire -}; - - -MtblPtr -TelPolymarkerTypeInitClass( TelType *el ) -{ - *el = TelPolymarkerType; - return MtdTbl; -} - -static TStatus -PolymarkerTypeAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k ) -{ - ((tsm_elem_data)(d.pdata))->ldata = k[0]->data.ldata; - - return TSuccess; -} - - -static TStatus -PolymarkerTypeDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - CMN_KEY key; - - key.id = TelPolymarkerType; - key.data.ldata = data.ldata; - TsmSetAttri( 1, &key ); - - return TSuccess; -} - - -static TStatus -PolymarkerTypePrint( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - switch( data.ldata ) - { - case TEL_PM_PLUS: - fprintf( stdout, "TelPolymarkerType. Value = PLUS\n" ); - break; - - case TEL_PM_STAR: - fprintf( stdout, "TelPolymarkerType. Value = STAR\n" ); - break; - - case TEL_PM_CROSS: - fprintf( stdout, "TelPolymarkerType. Value = CROSS\n" ); - break; - - case TEL_PM_CIRC: - fprintf( stdout, "TelPolymarkerType. Value = CIRC\n" ); - break; - - case TEL_PM_DOT: - fprintf( stdout, "TelPolymarkerType. Value = DOT\n" ); - break; - - case TEL_PM_USERDEFINED: - fprintf( stdout, "TelPolymarkerType. Value = USERDEFINED\n" ); - break; - - default: - fprintf( stdout, "TelPolymarkerType. Value = %d (UNKNOWN)", - data.ldata ); - } - fprintf( stdout, "\n" ); - - return TSuccess; -} - -static TStatus -PolymarkerTypeInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - Tint i; - - for( i = 0; i < n; i++ ) - { - switch( k[i]->id ) - { - case INQ_GET_SIZE_ID: - { - k[i]->data.ldata = sizeof( Tint ); - break; - } - case INQ_GET_CONTENT_ID: - { - TEL_INQ_CONTENT *c; - Teldata *w; - - c = (tel_inq_content)k[i]->data.pdata; - w = c->data; - c->act_size = 0; - w->idata = data.ldata; - break; - } - } - } - - return TSuccess; -} diff --git a/src/OpenGl/OpenGl_pick.cxx b/src/OpenGl/OpenGl_pick.cxx deleted file mode 100755 index f1ee3c34f2..0000000000 --- a/src/OpenGl/OpenGl_pick.cxx +++ /dev/null @@ -1,227 +0,0 @@ -/*********************************************************************** - -FONCTION : ----------- -File OpenGl_pick : - - -REMARQUES: ----------- - -HISTORIQUE DES MODIFICATIONS : --------------------------------- -xx-xx-xx : xxx ; Creation. -25-06-96 : FMN ; Suppression utilisation de glScissor. -03-07-96 : FMN ; Suppression TelGetViewportAtLocation. - -************************************************************************/ - -/*----------------------------------------------------------------------*/ -/* -* Includes -*/ - -#include - -#include - -#include - -#include -#include -#include -#include -#include - - -/*----------------------------------------------------------------------*/ -/* -* Constantes -*/ - -#define ARRAY_GROW_SIZE 10 - - -/*----------------------------------------------------------------------*/ -/* -* Variables statiques -*/ - -static GLuint *tgl_pick_buffer; /* buffer to be given to GL */ -static Tint tgl_pick_bufsize; - - -/*----------------------------------------------------------------------*/ - -static TStatus -allocate( Tint *cur_size, Tint size_reqd, void **arr, Tint elem_size ) -{ - size_reqd = ( ( size_reqd / ARRAY_GROW_SIZE ) + 1 ) * ARRAY_GROW_SIZE; - - if( !( *cur_size ) ) { - *arr = malloc( size_reqd * elem_size ); - memset( *arr, 0, size_reqd * elem_size ); - } - else -#if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x530) - *arr = realloc( *arr, size_reqd * elem_size ); -#else - *arr = (void*)cmn_resizemem( (char*)*arr, size_reqd * elem_size ); -#endif - - if( !(*arr) ) - return TFailure; - - *cur_size = size_reqd; - return TSuccess; -} - -static TStatus -Initialize( Tint wsid, Tint *view_stid ) -{ - Tint depth; - CMN_KEY_DATA key; - Tint buf_siz_reqd = 0; - - TsmGetWSAttri( wsid, WSViewStid, &key ); - if( key.ldata == -1 ) - return TFailure; - - *view_stid = key.ldata; - TsmGetStructureDepth( *view_stid, &depth ); - - buf_siz_reqd = depth*6 + 2; - - if( tgl_pick_bufsize < buf_siz_reqd ) - { - if( allocate( &tgl_pick_bufsize, buf_siz_reqd, (void **)&tgl_pick_buffer, - sizeof( int ) ) == TFailure ) - return TFailure; - } - - return TSuccess; -} -/*----------------------------------------------------------------------*/ - -static void -fill_pick_report( tel_pick_report rep, TPickOrder order, Tint depth ) -{ - Tint i, j; - TEL_PACKED_NAME pn; - - rep->depth = tgl_pick_buffer[0]/6; - - if( order == TTopFirst ) - { - for( i = 0, j = 3; i < ( Tint )(tgl_pick_buffer[0]/6) && i < depth; i++ ) - { /* skip hit numb. zmin, zmax -> j = 3 */ - pn.s[0] = tgl_pick_buffer[j++]; - pn.s[1] = tgl_pick_buffer[j++]; - rep->pick_path[i].struct_id = pn.i; - pn.s[0] = tgl_pick_buffer[j++]; - pn.s[1] = tgl_pick_buffer[j++]; - rep->pick_path[i].pick_id = pn.i; - pn.s[0] = tgl_pick_buffer[j++]; - pn.s[1] = tgl_pick_buffer[j++]; - rep->pick_path[i].el_num = pn.i; - } - } - else - { - Tint is, js; - - is = rep->depth < depth ? rep->depth : depth; - js = 3 + ( rep->depth - is )*6; /* skip hit numb. zmin, zmax -> j = 3 */ - is--; - - for( i = is, j = js; i >= 0; i-- ) - { - pn.s[0] = tgl_pick_buffer[j++]; - pn.s[1] = tgl_pick_buffer[j++]; - rep->pick_path[i].struct_id = pn.i; - pn.s[0] = tgl_pick_buffer[j++]; - pn.s[1] = tgl_pick_buffer[j++]; - rep->pick_path[i].pick_id = pn.i; - pn.s[0] = tgl_pick_buffer[j++]; - pn.s[1] = tgl_pick_buffer[j++]; - rep->pick_path[i].el_num = pn.i; - } - } - - return; -} -/*----------------------------------------------------------------------*/ - -Tint TglVpBeingPicked = -1; - -TStatus -TPick( Tint Wsid, Tint x, Tint y, Tfloat apw, Tfloat aph, - TPickOrder order, Tint depth, tel_pick_report rep ) -{ - Tint vid; - TSM_ELEM_DATA data; - CMN_KEY key; - CMN_KEY_DATA key1; - TEL_VIEW_REP ovrep, vrep; - - if( Initialize( Wsid, &(data.ldata) ) == TFailure ) - return TFailure; - - TglActiveWs = Wsid; - key.id = Wsid; - - { - /* TStatus stat; */ - Tfloat xsf, ysf, x1, x2, y1, y2, W, H, xm, xp, ym, yp, cx, cy; - Tint err; - TEL_VIEW_MAPPING map; - - vid = Wsid; - TglVpBeingPicked = vid; - TelGetViewRepresentation( Wsid, vid, &vrep ); - ovrep = vrep; - - TsmGetWSAttri( Wsid, WSWidth, &key1 ); - W = ( float )key1.ldata; - TsmGetWSAttri( Wsid, WSHeight, &key1 ); - H = ( float )key1.ldata; - - xm = vrep.extra.map.window.xmax, xp = vrep.extra.map.window.xmin; - ym = vrep.extra.map.window.ymax, yp = vrep.extra.map.window.ymin; - cx = xm + xp, cx /= 2; - cy = ym + yp, cy /= 2; - x1 = x - apw/2, x2 = x1 + apw, y1 = y - aph/2, y2 = y1 + aph; - xsf = xm - xp, xsf /= W; - ysf = ym - yp, ysf /= H; - x1 = xsf * x1 + xp; - y1 = ysf * y1 + yp; - x2 = xsf * x2 + xp; - y2 = ysf * y2 + yp; - - map = vrep.extra.map; - map.window.xmin = x1, map.window.xmax = x2; - map.window.ymin = y1, map.window.ymax = y2; - TelEvalViewMappingMatrixPick( &map, &err, vrep.mapping_matrix, cx, cy ); - if( err ) - printf( "Error in Mapping pick\n" ); - - if( TelSetViewRepresentation( Wsid, vid, &vrep ) == TFailure ) - printf( "Error in Set vrep for pick\n" ); - } - - glMatrixMode(GL_MODELVIEW); - tgl_pick_buffer[0] = 0; - glSelectBuffer( tgl_pick_bufsize , tgl_pick_buffer); - glRenderMode(GL_SELECT); - glLoadName(55); - TsmSendMessage( TelExecuteStructure, PickTraverse, data, 1, &key ); - glRenderMode(GL_RENDER); - TglVpBeingPicked = -1; - - /* print( ); */ - fill_pick_report( rep, order, depth ); - TelSetViewRepresentation( Wsid, vid, &ovrep ); - - return TSuccess; -} -/*----------------------------------------------------------------------*/ diff --git a/src/OpenGl/OpenGl_pickid.cxx b/src/OpenGl/OpenGl_pickid.cxx deleted file mode 100755 index aea77128ec..0000000000 --- a/src/OpenGl/OpenGl_pickid.cxx +++ /dev/null @@ -1,86 +0,0 @@ - -#include - -#include -#include -#include -#include - -#include - -#include -#include -#include -#include - -static TStatus PickIdAdd( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus PickIdPrint( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus PickIdInquire( TSM_ELEM_DATA, Tint, cmn_key* ); - -static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) = -{ - 0, /* PickTraverse */ - 0, /* Display */ - PickIdAdd, - 0, /* Delete */ - PickIdPrint, - PickIdInquire -}; - - -MtblPtr -TelPickIdInitClass( TelType *el ) -{ - *el = TelPickId; - return MtdTbl; -} - - -static TStatus -PickIdAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k ) -{ - ((tsm_elem_data)(d.pdata))->ldata = k[0]->data.ldata; - - return TSuccess; -} - - -static TStatus -PickIdPrint( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - fprintf( stdout, "TelPickId. Value = %d\n", data.ldata); - fprintf( stdout, "\n" ); - - return TSuccess; -} - -static TStatus -PickIdInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - Tint i; - - for( i = 0; i < n; i++ ) - { - switch( k[i]->id ) - { - case INQ_GET_SIZE_ID: - { - k[i]->data.ldata = sizeof( Tint ); - break; - } - case INQ_GET_CONTENT_ID: - { - TEL_INQ_CONTENT *c; - Teldata *w; - - c = (tel_inq_content)k[i]->data.pdata; - w = c->data; - c->act_size = 0; - w->idata = data.ldata; - break; - } - } - } - - return TSuccess; -} diff --git a/src/OpenGl/OpenGl_polygon.cxx b/src/OpenGl/OpenGl_polygon.cxx deleted file mode 100755 index 31164e600d..0000000000 --- a/src/OpenGl/OpenGl_polygon.cxx +++ /dev/null @@ -1,1351 +0,0 @@ -/*********************************************************************** - -FONCTION : ----------- -File OpenGl_polygon : - - -REMARQUES: ----------- - -Le culling et le backfacing ne marchent pas. - -HISTORIQUE DES MODIFICATIONS : --------------------------------- -xx-xx-xx : xxx ; Creation. -11-03-96 : FMN ; Correction warning compilation -01-04-96 : CAL ; Integration MINSK portage WNT -28-06-96 : GG ; Auto checking of the polygon facet normal with -the order of the points (OPTIM) -09-08-96 : FMN ; Suppression appel glMatrixMode() avant glGetFloatv() -28-02-97 : FMN ; Suppression OpenGl_telem_light.h -18-07-97 : FMN ; Ajout desactivation des lights suivant front_lighting_model -21-07-97 : FMN ; Amelioration des performances OPTIMISATION_FMN -- suppression calcul inutile sur les front faces -27-08-97 : FMN ; Correction affichage des edges -On n'affiche que les edges dans le mode IS_EMPTY -10-09-97 : FMN ; Amelioration des perfs liees aux lights. -15-09-97 : PCT ; Ajout coordonnees textures -24-09-97 : FMN ; Suppression OPTIMISATION_FMN. -08-12-97 : FMN ; Suppression appel TsmGetAttri inutile. -31-12-97 : FMN ; Simplification pour le highlight -15-01-98 : FMN ; Ajout Hidden line -18-06-98 : CAL ; Correction PRO14340. Patch K4198 et K4199 -08-03-01 : GG ; BUC60823 Avoid crash in the normal computation method -on confuse point. - -************************************************************************/ - -#define G003 /* EUG 22-09-99 Degeneration management -*/ - -/*----------------------------------------------------------------------*/ -/* -* Includes -*/ - -#include - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - - -/*----------------------------------------------------------------------*/ -/* -* Constantes -*/ - -#ifndef WNT -# define CALLBACK -#if !defined(APIENTRY) -# define APIENTRY -#endif // APIENTRY -# define STATIC static -#else -# include -#define STATIC -typedef double GLUcoord; -#endif /* WNT */ - -#ifdef G003 -extern int g_nDegenerateModel; -#endif /* G003 */ - -/*----------------------------------------------------------------------*/ -/* -* Fonctions statiques -*/ - -static TStatus PolygonDisplay( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus PolygonAdd( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus PolygonDelete( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus PolygonPrint( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus PolygonInquire( TSM_ELEM_DATA, Tint, cmn_key* ); - -/*----------------------------------------------------------------------*/ -/* -* Variables externes -*/ - -extern Tint ForbidSetTextureMapping; /* currently defined in tsm/tsm.c */ - -/*----------------------------------------------------------------------*/ -/* -* Definition de types -*/ - -struct EXTRA_VERTEX -{ - GLfloat vert[3]; - int ind; - IMPLEMENT_MEMORY_OPERATORS -}; -typedef EXTRA_VERTEX* extra_vertex; - -struct SEQ_ -{ - Tint ts_num, ts_alloc; - void **tmesh_sequence; - GLenum triangle_type; /* FSXXX OPTI */ - IMPLEMENT_MEMORY_OPERATORS -}; - -struct DISPLAY_ -{ - Tint num_of_seq; - Tint num_alloc; - SEQ_ *seq; - IMPLEMENT_MEMORY_OPERATORS -}; - -struct TEL_POLYGON_DATA -{ - Tint num_vertices; /* Number of vertices */ - Tint facet_flag; /* TEL_FA_NONE or TEL_FA_NORMAL */ - Tint vertex_flag; /* TEL_VT_NONE or TEL_VT_NORMAL */ - Tint shape_flag; /* TEL_SHAPE_UNKNOWN or TEL_SHAPE_COMPLEX or - TEL_SHAPE_CONVEX or TEL_SHAPE_CONCAVE */ - GLboolean reverse_order; /* GL_TRUE if polygon vertex must be display in reverse order */ - TEL_POINT fnormal; /* Facet normal */ - tel_colour fcolour; /* Facet colour */ - tel_point vertices; /* Vertices */ - tel_colour vcolours; /* Vertex colour values */ - tel_point vnormals; /* Vertex normals */ - tel_texture_coord vtexturecoord; /* Texture Coordinates */ - DISPLAY_ *display; /* FSXXX OPTI */ - GLuint triangle_dl1; /* triangle display list 1 */ - GLuint triangle_dl2; /* triangle display list 2 */ - GLuint triangle_dl3; /* triangle display list 3 */ - IMPLEMENT_MEMORY_OPERATORS -}; -typedef TEL_POLYGON_DATA *tel_polygon_data; - -static TEL_POLYGON_DATA polygon_defaults = -{ - 0, /* num_vertices */ - TEL_FA_NONE, /* facet_flag */ - TEL_VT_NONE, /* vertex_flag */ - TEL_SHAPE_UNKNOWN, /* shape_flag */ - GL_FALSE, /* reverse_order */ - {{ ( float )0.0, ( float )0.0, ( float )0.0 }}, /* fnormal */ - 0, /* fcolour */ - 0, /* vertices */ - 0, /* vcolours */ - 0, /* vnormals */ - 0, /* vtexturecoord */ - 0, /* display */ - 0, /* triangle_dl1 */ - 0, /* triangle_dl2 */ - 0 /* triangle_dl3 */ -}; - - -static void bgntriangulate( tel_polygon_data, void (APIENTRY*)() ); -static void endtriangulate(void); -static void draw_tmesh( tel_polygon_data, Tint ); -static void draw_polygon( tel_polygon_data, Tint, Tint ); -static void draw_polygon_concav( tel_polygon_data, Tint, Tint ); - -#if !defined(GLU_VERSION_1_2) -#define GLUtesselator GLUtriangulatorObj -void gluTessBeginContour(); -void gluTessBeginPolygon(); -void gluTessEndPolygon(); -void gluTessEndContour(); -#endif - -static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) = -{ - PolygonDisplay, /* PickTraverse */ - PolygonDisplay, - PolygonAdd, - PolygonDelete, - PolygonPrint, - PolygonInquire -}; - -static void draw_edges( tel_polygon_data, tel_colour, Tint); - -/*----------------------------------------------------------------------*/ - -MtblPtr -TelPolygonInitClass( TelType* el ) -{ - *el = TelPolygon; - return MtdTbl; -} -/*----------------------------------------------------------------------*/ - -static TStatus -PolygonAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k ) -{ - Tint i, j; - tel_polygon_data data; - - for( i = 0; i < n; i++ ) - { - if( k[i]->id == NUM_VERTICES_ID ) - break; - } - if( i == n ) - return TFailure; - - if( !(k[i]->data.ldata) ) - return TFailure; - - for( j = 0; j < n; j++ ) - { - if( k[j]->id == VERTICES_ID ) - break; - } - if( j == n ) - return TFailure; - - data = new TEL_POLYGON_DATA(); - if( !data ) - return TFailure; - - /* load defaults */ - memcpy( data, &polygon_defaults, sizeof(TEL_POLYGON_DATA) ); - - data->num_vertices = k[i]->data.ldata; - data->vertices = new TEL_POINT[data->num_vertices]; - memcpy( data->vertices, k[j]->data.pdata, data->num_vertices*sizeof(TEL_POINT) ); - - for( i = 0; i < n; i++ ) - { - switch( k[i]->id ) - { - case FNORMALS_ID: - data->facet_flag = TEL_FA_NORMAL; - memcpy( &data->fnormal, k[i]->data.pdata, sizeof(TEL_POINT) ); - vecnrm( data->fnormal.xyz ); - break; - - case FACET_COLOUR_VALS_ID: - data->fcolour = new TEL_COLOUR(); - memcpy( data->fcolour, k[i]->data.pdata, sizeof(TEL_COLOUR) ); - break; - - case VERTEX_COLOUR_VALS_ID: - data->vcolours = new TEL_COLOUR[data->num_vertices]; - memcpy( data->vcolours, k[i]->data.pdata, data->num_vertices*sizeof(TEL_COLOUR) ); - break; - - case VNORMALS_ID: - data->vertex_flag = TEL_VT_NORMAL; - data->vnormals = new TEL_POINT[data->num_vertices]; - memcpy( data->vnormals, k[i]->data.pdata, data->num_vertices*sizeof(TEL_POINT) ); - for( j = 0; j < data->num_vertices; j++ ) - vecnrm( data->vnormals[j].xyz ); - break; - - case SHAPE_FLAG_ID: - data->shape_flag = k[i]->data.ldata; - break; - - case VTEXTURECOORD_ID: - data->vtexturecoord = new TEL_TEXTURE_COORD[data->num_vertices]; - memcpy( data->vtexturecoord, k[i]->data.pdata, data->num_vertices*sizeof(TEL_TEXTURE_COORD) ); - break; - } - } - - if( data->facet_flag != TEL_FA_NORMAL ) { -#ifdef BUC60823 - TelGetPolygonNormal( data->vertices, NULL, - data->num_vertices, data->fnormal.xyz ); -#else - TelGetNormal( data->vertices[0].xyz, data->vertices[1].xyz, - data->vertices[2].xyz, data->fnormal.xyz ); - vecnrm( data->fnormal.xyz ); -#endif - } - else - { - TEL_POINT fnormal; /* Facet normal */ - Tfloat sens; -#ifdef BUC60823 - TelGetPolygonNormal( data->vertices, NULL, - data->num_vertices, fnormal.xyz ); -#else - TelGetNormal( data->vertices[0].xyz, data->vertices[1].xyz, - data->vertices[2].xyz, fnormal.xyz ); -#endif - sens = fnormal.xyz[0]*data->fnormal.xyz[0] + - fnormal.xyz[1]*data->fnormal.xyz[1] + - fnormal.xyz[2]*data->fnormal.xyz[2]; - if( sens < 0. ) data->reverse_order = GL_TRUE; - } - ((tsm_elem_data)(d.pdata))->pdata = data; - - /* s'il n'est pas convexe, le polygone est triangule de la meme maniere - que les polygones a trous */ - /* Pourrait etre place en tete de routine pour optimisation si je - savais recuperer le shape_flag a partir de d sans reconstruire data (!) */ - - /* FSXXX - if( data->shape_flag != TEL_SHAPE_CONVEX ) - return(PolygonHolesAdd( d, n, k )); - */ - - return TSuccess; -} -/*----------------------------------------------------------------------*/ - -static TStatus -PolygonDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - /* Tint front_face = 1;*/ - CMN_KEY k11, k12, k17, k111, k114; - - Tint front_lighting_model; - Tint interior_style; - TEL_COLOUR interior_colour; - TEL_COLOUR edge_colour; - - tel_polygon_data d; - - k12.id = TelInteriorReflectanceEquation; - k17.id = TelInteriorStyle; - k111.id = TelInteriorColour; - k111.data.pdata = &interior_colour; - k114.id = TelEdgeColour; - k114.data.pdata = &edge_colour; - - TsmGetAttri( 4, &k12, &k17, &k111, &k114); - - front_lighting_model = k12.data.ldata; - interior_style = k17.data.ldata; - -#ifdef PRINT - printf("PolygonDisplay \n"); -#endif - - /* - * Use highlight colours - */ - - if( k[0]->id == TOn ) - { - TEL_HIGHLIGHT hrep; - - k11.id = TelHighlightIndex; - TsmGetAttri( 1, &k11 ); - if( TelGetHighlightRep( TglActiveWs, k11.data.ldata, &hrep ) == TSuccess ) - { - if( hrep.type == TelHLForcedColour ) - { - interior_colour = hrep.col; - edge_colour = hrep.col; - front_lighting_model = CALL_PHIGS_REFL_NONE; - } - else - k[0]->id = TOff; - } - else - { - TelGetHighlightRep( TglActiveWs, 0, &hrep ); - if( hrep.type == TelHLForcedColour ) - { - interior_colour = hrep.col; - edge_colour = hrep.col; - front_lighting_model = CALL_PHIGS_REFL_NONE; - } - else - k[0]->id = TOff; - } - } - - d = (tel_polygon_data)data.pdata; -#ifdef G003 - - if( interior_style != TSM_EMPTY && g_nDegenerateModel < 2 ) -#else - if( interior_style != TSM_EMPTY ) -#endif /*G003*/ - { - if (front_lighting_model == CALL_PHIGS_REFL_NONE) - LightOff(); - else LightOn(); - - glColor3fv( interior_colour.rgb ); - - if( d->shape_flag != TEL_SHAPE_CONVEX ) - draw_polygon_concav( d, front_lighting_model, k[0]->id ); - else - draw_polygon( d, front_lighting_model, k[0]->id ); - } - -#ifdef G003 - /* OCC11904 -- Temporarily disable environment mapping */ - glPushAttrib(GL_ENABLE_BIT); - glDisable(GL_TEXTURE_1D); - glDisable(GL_TEXTURE_2D); - - switch ( g_nDegenerateModel ) { - -default: -case 0: /* no degeneration */ - draw_edges ( d, &edge_colour, interior_style ); - break; -case 2: /* wireframe degeneration */ - -#ifdef xG003 /* GG260100 use interior color instead edge color */ - draw_edges ( d, &interior_colour, interior_style ); -#else - draw_edges ( d, &edge_colour, interior_style ); -#endif - break; - -case 3: /* marker degeneration */ - - break; - - } /* end switch */ - - glPopAttrib(); /* skt: GL_ENABLE_BIT*/ -#else - draw_edges( d, &edge_colour, interior_style ); - /*skt: It is not correct to pop attributes here*/ - /*glPopAttrib();*/ -#endif /*G003*/ - return TSuccess; - -} -/*----------------------------------------------------------------------*/ - -static void -draw_polygon( tel_polygon_data d, Tint front_lighting_model, Tint hflag ) -{ - Tint i; - - tel_point ptr; - tel_point pvn; - tel_colour pfc, pvc; - tel_texture_coord pvt; - - pfc = d->fcolour; - pvc = d->vcolours; - pvn = d->vnormals; - pvt = d->vtexturecoord; - - if( hflag ) pvc = pfc = NULL; - - ptr = d->vertices; - if( pfc ) - glColor3fv( pfc->rgb ); - if( front_lighting_model != CALL_PHIGS_REFL_NONE ) - glNormal3fv( d->fnormal.xyz ); - - if( d->reverse_order ) glFrontFace( GL_CW ); - - if (d->num_vertices == 3) glBegin(GL_TRIANGLES); - else if(d->num_vertices == 4) glBegin(GL_QUADS); - else glBegin(GL_POLYGON); - if( front_lighting_model == CALL_PHIGS_REFL_NONE ) - { - if( pvc ) - { - for( i=0; inum_vertices; i++, ptr++ ) - { - glColor3fv( pvc[i].rgb ); - glVertex3fv( ptr->xyz ); - } - } - else - { - for( i=0; inum_vertices; i++, ptr++ ) - { - glVertex3fv( ptr->xyz ); - } - } - } - else - { - if( pvn ) - { - if (pvt && !ForbidSetTextureMapping) - for( i=0; inum_vertices; i++, ptr++ ) - { - glNormal3fv( pvn[i].xyz ); - glTexCoord2fv( pvt[i].xy ); - glVertex3fv( ptr->xyz ); - } - else - for( i=0; inum_vertices; i++, ptr++ ) - { - glNormal3fv( pvn[i].xyz ); - glVertex3fv( ptr->xyz ); - } - } - else - { - for( i=0; inum_vertices; i++, ptr++ ) - { - glVertex3fv( ptr->xyz ); - } - } - } - glEnd(); - if( d->reverse_order ) glFrontFace( GL_CCW ); - -} - -/*----------------------------------------------------------------------*/ - -/* JWR - allow varying the size */ - -#define INCREMENT 8 - -static int seq_increment = INCREMENT; - -tel_polygon_data DaTa; -static GLUtesselator *tripak = 0; - -STATIC void APIENTRY -out_bgntmesh( GLenum triangle_type ) -{ - DISPLAY_ *dis; - dis = DaTa->display; - - dis->num_of_seq++; - if( dis->num_alloc < dis->num_of_seq ) - { - dis->num_alloc += seq_increment; - - if( dis->seq == 0 ) - { - dis->seq = new SEQ_[dis->num_alloc]; - } - else - { -#if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x530) - dis->seq = (SEQ_*)realloc( dis->seq, dis->num_alloc*sizeof(SEQ_) ); -#else - dis->seq = cmn_resizemem( dis->seq, dis->num_alloc ); -#endif - } - } - dis->seq[ dis->num_of_seq - 1 ].ts_num = 0; - dis->seq[ dis->num_of_seq - 1 ].ts_alloc = 0; - dis->seq[ dis->num_of_seq - 1 ].tmesh_sequence = 0; - -#ifdef JWR_DEC_TRIFAN_BUG - dis->seq[ dis->num_of_seq - 1 ].triangle_type = GL_POLYGON; - glBegin(GL_POLYGON); -#else - dis->seq[ dis->num_of_seq - 1 ].triangle_type = triangle_type; - glBegin(triangle_type); -#endif -} - -/*----------------------------------------------------------------------*/ - -STATIC void APIENTRY -out_vert1( void *data ) -{ - SEQ_ *s; - - s = &( DaTa->display->seq[ DaTa->display->num_of_seq - 1 ] ); - - s->ts_num++; - if( s->ts_alloc < s->ts_num ) - { - s->ts_alloc += seq_increment; - - if( s->tmesh_sequence == 0 ) - { - s->tmesh_sequence = new void*[s->ts_alloc]; - } - else - { -#if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x530) - s->tmesh_sequence = (void**)realloc( s->tmesh_sequence, s->ts_alloc*sizeof(void*)); -#else - s->tmesh_sequence = cmn_resizemem( s->tmesh_sequence, s->ts_alloc); -#endif - } - } - s->tmesh_sequence[ s->ts_num - 1 ] = data; - - - if ( data < (void *)0xffff ) { - long a = (long)data; - - glVertex3fv( DaTa->vertices[a].xyz ); - } - else { - extra_vertex b = (extra_vertex) data; - -#ifdef TRACE - printf("combine1 %e %e %e %d\n", - b->vert[0], b->vert[1], b->vert[2], (b->ind)); -#endif - glVertex3fv( b->vert ); - } - -} - -/*----------------------------------------------------------------------*/ - -STATIC void APIENTRY -out_vert2( void *data ) -{ - SEQ_ *s; - - s = &( DaTa->display->seq[ DaTa->display->num_of_seq - 1 ] ); - - s->ts_num++; - if( s->ts_alloc < s->ts_num ) - { - s->ts_alloc += seq_increment; - - if( s->tmesh_sequence == 0 ) - { - s->tmesh_sequence = new void*[s->ts_alloc]; - } - else - { -#if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x530) - s->tmesh_sequence = (void**)( s->tmesh_sequence, - s->ts_alloc*sizeof(void*) ); -#else - s->tmesh_sequence = cmn_resizemem( s->tmesh_sequence, - s->ts_alloc ); -#endif - } - } - s->tmesh_sequence[ s->ts_num - 1 ] = data; - - if ( data < (void *)0xffff ) { - long a = (long)data; - - glColor3fv( DaTa->vcolours[a].rgb ); - glVertex3fv( DaTa->vertices[a].xyz ); - } - else { - extra_vertex b = (extra_vertex) data; - - printf("combine2 %e %e %e %d\n",b->vert[0], b->vert[1], b->vert[2], (b->ind)); - glColor3fv( DaTa->vcolours[(b->ind)].rgb ); - glVertex3fv( b->vert ); - } - -} - -/*----------------------------------------------------------------------*/ - -STATIC void APIENTRY -out_vert3( void *data ) -{ - SEQ_ *s; - - s = &( DaTa->display->seq[ DaTa->display->num_of_seq - 1 ] ); - - s->ts_num++; - if( s->ts_alloc < s->ts_num ) - { - s->ts_alloc += seq_increment; - - if( s->tmesh_sequence == 0 ) - { - s->tmesh_sequence = new void*[s->ts_alloc]; - } - else - { -#if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x530) - s->tmesh_sequence = (void**)realloc( s->tmesh_sequence, - s->ts_alloc*sizeof(void*) ); -#else - s->tmesh_sequence = cmn_resizemem( s->tmesh_sequence, - s->ts_alloc ); -#endif - } - } - s->tmesh_sequence[ s->ts_num - 1 ] = data; - - if ( data <= (void *)0xffff ) { - long a = (long)data; - - glNormal3fv( DaTa->vnormals[a].xyz ); - glVertex3fv( DaTa->vertices[a].xyz); - } - else { - extra_vertex b = (extra_vertex) data; - - printf("combine3 %e %e %e %d\n", b->vert[0], b->vert[1], b->vert[2], (b->ind)); - glNormal3fv( DaTa->vnormals[(b->ind)].xyz ); - glVertex3fv( b->vert ); - } - -} - -/*----------------------------------------------------------------------*/ - -STATIC void APIENTRY -mycombine( GLdouble coords[3], int *data, GLfloat w[4], void **dataout) -{ - extra_vertex new_vertex; - - new_vertex = (extra_vertex) malloc(sizeof(EXTRA_VERTEX)); - - new_vertex->vert[0] = ( float )coords[0]; - new_vertex->vert[1] = ( float )coords[1]; - new_vertex->vert[2] = ( float )coords[2]; - new_vertex->ind = *data; - *dataout = new_vertex; -#ifdef TRACE - printf("mycombine3 %e %e %e\n", - new_vertex->vert[0], - new_vertex->vert[1], - new_vertex->vert[2], - new_vertex->ind); - printf("weights: %f %f %f %f\n", - w[0], w[1], w[2], w[3]); -#endif -} - -/*----------------------------------------------------------------------*/ - -STATIC void APIENTRY -out_endtmesh( void ) -{ - glEnd(); -} - -/*----------------------------------------------------------------------*/ - -STATIC void APIENTRY -out_error( GLenum error ) -{ - printf( "POLYGON : %s\n", (char *) gluErrorString(error) ); -} - -/*----------------------------------------------------------------------*/ - -static void -bgntriangulate(tel_polygon_data d, void ( APIENTRY * out_ver)() ) -{ - DaTa = d; - if( !DaTa->display ) - DaTa->display = new DISPLAY_(); - - tripak = gluNewTess(); - -#if defined(linux) && !defined(NOGLUfuncptr) - gluTessCallback( tripak, GLU_TESS_BEGIN, (_GLUfuncptr)(out_bgntmesh) ); - gluTessCallback( tripak, GLU_TESS_VERTEX, out_ver ); - gluTessCallback( tripak, GLU_TESS_END, out_endtmesh ); - gluTessCallback( tripak, GLU_TESS_ERROR, (_GLUfuncptr)(out_error) ); - gluTessCallback( tripak, GLU_TESS_COMBINE, (_GLUfuncptr)(mycombine) ); -#else - gluTessCallback( tripak, GLU_TESS_BEGIN, (void (APIENTRY*)())out_bgntmesh ); - gluTessCallback( tripak, GLU_TESS_VERTEX, (void (APIENTRY*)())out_ver ); - gluTessCallback( tripak, GLU_TESS_END, (void (APIENTRY*)())out_endtmesh ); - gluTessCallback( tripak, GLU_TESS_ERROR, (void (APIENTRY*)())out_error ); - gluTessCallback( tripak, GLU_TESS_COMBINE, (void (APIENTRY*)())mycombine ); -#endif -} - -/*----------------------------------------------------------------------*/ - -static void -endtriangulate() -{ - DaTa = 0; - gluDeleteTess(tripak); -} - -/*----------------------------------------------------------------------*/ - -static void -draw_polygon_concav( tel_polygon_data d, Tint front_lighting_model, Tint hflag ) -{ - long i; - - tel_point pvn; - tel_point ptr; - tel_colour pfc, pvc; - GLdouble xyz[3]; - - pfc = d->fcolour; - pvc = d->vcolours; - pvn = d->vnormals; - - if( hflag ) - { - pvc = pfc = NULL; - } - - ptr = d->vertices; - DaTa = d; - - if( pfc ) - glColor3fv( pfc->rgb ); - if( front_lighting_model != CALL_PHIGS_REFL_NONE ) - glNormal3fv( d->fnormal.xyz ); - - if( d->reverse_order ) glFrontFace( GL_CW ); - - if( d->display == 0 ) - { - - if( front_lighting_model == CALL_PHIGS_REFL_NONE ) - { - if( pvc ) - { - bgntriangulate(d, (void (APIENTRY*)())out_vert2); - } - else - { - bgntriangulate(d, (void (APIENTRY*)())out_vert1); - } - } - else - { - if( pvn ) - { - bgntriangulate(d, (void (APIENTRY*)())out_vert3); - } - else - { - bgntriangulate(d, (void (APIENTRY*)())out_vert1); - } - } - gluTessBeginPolygon( tripak, NULL ); - gluTessBeginContour( tripak); - - for( i=0; inum_vertices; i++, ptr++ ) - { - xyz[0] = ptr->xyz[0]; - xyz[1] = ptr->xyz[1]; - xyz[2] = ptr->xyz[2]; -#ifndef WNT - gluTessVertex( tripak, xyz,(void * ) i ); -#else - { - double v[ 3 ] = {ptr -> xyz[ 0 ], ptr -> xyz[ 1 ], ptr -> xyz[ 2 ]}; - gluTessVertex ( tripak, v, ( void* )i ); - } -#endif /* WNT */ - } - gluTessEndContour( tripak); - gluTessEndPolygon( tripak ); - endtriangulate(); - } - else - { - if( front_lighting_model == CALL_PHIGS_REFL_NONE ) - { - if( pvc ) draw_tmesh( d, 2 ); - else draw_tmesh( d, 1 ); - } - else - { - if( pvn ) draw_tmesh( d, 3 ); - else draw_tmesh( d, 1 ); - } - } - - if( d->reverse_order ) glFrontFace( GL_CCW ); -} - -/*----------------------------------------------------------------------*/ - -static void -draw_tmesh( tel_polygon_data d, Tint v ) -{ - Tint i, j, k; - DISPLAY_ *dis; - SEQ_ *s; - extra_vertex b; - - dis = d->display; - for( i = 0; i < dis->num_of_seq; i++ ) - { - s = &(dis->seq[i]); - - glBegin(s->triangle_type); - switch( v ) - { - case 1: - { - for( j = 0, k = 0; j < s->ts_num; j++ ) - { - if ( s->tmesh_sequence[j] < (void *)0xffff ) - glVertex3fv( d->vertices[ (long)s->tmesh_sequence[ j ] ].xyz ); - else { - extra_vertex b = (extra_vertex)s->tmesh_sequence[j]; - glVertex3fv( b->vert ); - } - - } - break; - } - case 2: - { - for( j = 0, k = 0; j < s->ts_num; j++ ) - { - if ( s->tmesh_sequence[j] < (void *)0xffff ) { - glColor3fv( d->vcolours[ (long) s->tmesh_sequence[ j ] ].rgb ); - glVertex3fv( d->vertices[ (long) s->tmesh_sequence[ j ] ].xyz ); - } else { - b = (extra_vertex) s->tmesh_sequence[j]; - glColor3fv( d->vcolours[(b->ind)].rgb); - glVertex3fv( b->vert ); - } - } - break; - } - case 3: - { - for( j = 0, k = 0; j < s->ts_num; j++ ) - { - if ( s->tmesh_sequence[j] < (void *)0xffff ) { - glNormal3fv( d->vnormals[ (long) s->tmesh_sequence[ j ] ].xyz); - glVertex3fv( d->vertices[ (long) s->tmesh_sequence[ j ] ].xyz); - } else { - b = (extra_vertex) s->tmesh_sequence[j]; - glNormal3fv( d->vnormals[(b->ind)].xyz); - glVertex3fv( b->vert ); - } - } - break; - } - } - glEnd(); - } -} - -/*----------------------------------------------------------------------*/ - -static TStatus -PolygonDelete( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - tel_polygon_data p = (tel_polygon_data)data.pdata; - if( p->fcolour ) //cmn_freemem( p->fcolour ); - delete p->fcolour; - if( p->vertices )// cmn_freemem( p->vertices ); - delete[] p->vertices; - if( p->vcolours ) //cmn_freemem( p->vcolours ); - delete[] p->vcolours; - if( p->vnormals ) //cmn_freemem( p->vnormals ); - delete[] p->vnormals; - if (p->vtexturecoord) //cmn_freemem( p->vtexturecoord); - delete p->vtexturecoord; - - if(p->display) - { - Tint i, j; - - for( i = 0; i < p->display->num_of_seq; i++ ) - { - if(p->display->seq[i].tmesh_sequence) { - for ( j = 0; j < p->display->seq[i].ts_num ; j++ ) { - if ( p->display->seq[i].tmesh_sequence[j] >= (void *)0xffff ) - free(p->display->seq[i].tmesh_sequence[j]); - } - } - delete[] p->display->seq[i].tmesh_sequence; - } - delete[] p->display->seq; - delete p->display; - } - if (data.pdata) - delete data.pdata; - return TSuccess; -} - -/*----------------------------------------------------------------------*/ - -static TStatus -PolygonPrint( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - Tint i; - tel_polygon_data p = (tel_polygon_data)data.pdata; - - fprintf( stdout, "TelPolygon. Number of points: %d\n", p->num_vertices ); - switch( p->shape_flag ) - { - case TEL_SHAPE_UNKNOWN: - fprintf( stdout, "\t\tShape Flag : UNKNOWN\n" ); - break; - - case TEL_SHAPE_COMPLEX: - fprintf( stdout, "\t\tShape Flag : COMPLEX\n" ); - break; - - case TEL_SHAPE_CONCAVE: - fprintf( stdout, "\t\tShape Flag : CONCAVE\n" ); - break; - - case TEL_SHAPE_CONVEX: - fprintf( stdout, "\t\tShape Flag : CONVEX\n" ); - break; - - } - switch( p->facet_flag ) - { - case TEL_FA_NONE: - if( p->fcolour ) - fprintf( stdout, "\t\tFacet Flag : COLOUR\n" ); - else - fprintf( stdout, "\t\tFacet Flag : NONE\n" ); - break; - - case TEL_FA_NORMAL: - if( p->fcolour ) - fprintf( stdout, "\t\tFacet Flag : COLOURNORMAL\n" ); - else - fprintf( stdout, "\t\tFacet Flag : NORMAL\n" ); - break; - } - switch( p->vertex_flag ) - { - case TEL_VT_NONE: - if( p->vcolours ) - fprintf( stdout, "\t\tVertex Flag : COLOUR\n" ); - else - fprintf( stdout, "\t\tVertex Flag : NONE\n" ); - break; - - case TEL_VT_NORMAL: - if( p->vcolours ) - fprintf( stdout, "\t\tVertex Flag : COLOURNORMAL\n" ); - else - fprintf( stdout, "\t\tVertex Flag : NORMAL\n" ); - break; - } - fprintf( stdout, "\t\tFacet Normal : %g %g %g\n", p->fnormal.xyz[0], - p->fnormal.xyz[1], - p->fnormal.xyz[2] ); - fprintf( stdout, "\t\tReverse order : %d\n", p->reverse_order); - - if( p->fcolour ) - fprintf( stdout, "\t\tFacet Colour : %g %g %g\n", p->fcolour->rgb[0], - p->fcolour->rgb[1], - p->fcolour->rgb[2] ); - else - fprintf( stdout, "\n\t\tFacet Colour not specified\n" ); - - if( p->vertices ) - { - fprintf( stdout, "\n\t\tVertices : " ); - for( i = 0; i < p->num_vertices; i++ ) - fprintf( stdout, "\n\t\t v[%d] = %g %g %g", i, - p->vertices[i].xyz[0], - p->vertices[i].xyz[1], - p->vertices[i].xyz[2] ); - } - - fprintf( stdout, "\n" ); - if( p->vcolours ) - { - fprintf( stdout, "\n\t\tVertex Colours : " ); - for( i = 0; i < p->num_vertices; i++ ) - fprintf( stdout, "\n\t\t v[%d] = %g %g %g", i, - p->vcolours[i].rgb[0], - p->vcolours[i].rgb[1], - p->vcolours[i].rgb[2] ); - } - else - fprintf( stdout, "\n\t\tVertex Colours not specified\n" ); - - if( p->vnormals ) - { - fprintf( stdout, "\n\t\tVertex Normals : " ); - for( i = 0; i < p->num_vertices; i++ ) - fprintf( stdout, "\n\t\t v[%d] = %g %g %g", i, - p->vnormals[i].xyz[0], - p->vnormals[i].xyz[1], - p->vnormals[i].xyz[2] ); - } - else - fprintf( stdout, "\n\t\tVertex Normals not specified\n" ); - - if (p->vtexturecoord) - { - fprintf(stdout, "\n\t\tTexture Coordinates : "); - for (i=0; inum_vertices; i++) - fprintf(stdout, "\n\t\t v[%d] = %g %g", i, - p->vtexturecoord[i].xy[0], - p->vtexturecoord[i].xy[1]); - } - else - fprintf( stdout, "\n\t\tTexture Coordinates not specified\n"); - - fprintf( stdout, "\n" ); - - return TSuccess; -} - -/*----------------------------------------------------------------------*/ - -static TStatus -PolygonInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - Tint i, j; - tel_polygon_data d; - Tint size_reqd=0; - TStatus status = TSuccess; - Tchar *cur_ptr = 0; - - d = (tel_polygon_data)data.pdata; - - if( d->fcolour ) - size_reqd += sizeof( TEL_COLOUR ); - - if( d->facet_flag == TEL_FA_NORMAL ) - size_reqd += sizeof( TEL_POINT ); - - size_reqd += ( d->num_vertices * sizeof( TEL_POINT ) ); - - if( d->vcolours ) - size_reqd += ( d->num_vertices * sizeof( TEL_COLOUR ) ); - - if( d->vertex_flag == TEL_VT_NORMAL ) - size_reqd += ( d->num_vertices * sizeof( TEL_POINT ) ); - - for( i = 0; i < n; i++ ) - { - switch( k[i]->id ) - { - case INQ_GET_SIZE_ID: - { - k[i]->data.ldata = size_reqd; - break; - } - - case INQ_GET_CONTENT_ID: - { - TEL_INQ_CONTENT *c; - Teldata *w; - - c = (tel_inq_content)k[i]->data.pdata; - c->act_size = size_reqd; - w = c->data; - - cur_ptr = c->buf; - w->fillarea3data.num_points = d->num_vertices; - w->fillarea3data.shpflag = d->shape_flag; - - if( c->size >= size_reqd ) - { - if( d->facet_flag == TEL_FA_NORMAL ) - { - if( d->fcolour ) - { - w->fillarea3data.faflag = TEL_FAFLAG_COLOURNORMAL; - w->fillarea3data.gnormal = (tel_point)(c->buf); - *(w->fillarea3data.gnormal) = d->fnormal; - w->fillarea3data.facet_colour_val = - (tel_colour)(c->buf + sizeof( TEL_POINT ) ); - *(w->fillarea3data.facet_colour_val) = *(d->fcolour); - cur_ptr = c->buf + sizeof( TEL_POINT ) + - sizeof( TEL_COLOUR ); - } - else - { - w->fillarea3data.faflag = TEL_FAFLAG_NORMAL; - w->fillarea3data.facet_colour_val = 0; - w->fillarea3data.gnormal = (tel_point)(c->buf); - *(w->fillarea3data.gnormal) = d->fnormal; - cur_ptr = c->buf + sizeof( TEL_POINT ); - } - } - else - { - w->fillarea3data.gnormal = 0; - if( d->fcolour ) - { - w->fillarea3data.faflag = TEL_FAFLAG_COLOUR; - w->fillarea3data.facet_colour_val = (tel_colour)(c->buf ); - *(w->fillarea3data.facet_colour_val) = *(d->fcolour); - cur_ptr = c->buf + sizeof( TEL_COLOUR ); - } - else - { - w->fillarea3data.faflag = TEL_FAFLAG_NONE; - w->fillarea3data.facet_colour_val = 0; - } - } - - w->fillarea3data.points = (tel_point)cur_ptr; - for( j = 0; j < d->num_vertices; j++ ) - { - w->fillarea3data.points[j] = d->vertices[j]; - } - cur_ptr += ( d->num_vertices * sizeof( TEL_POINT ) ); - - if( d->vertex_flag == TEL_VT_NORMAL ) - { - if( d->vcolours ) - { - w->fillarea3data.vrtflag = TEL_VTFLAG_COLOURNORMAL; - w->fillarea3data.vnormals = (tel_point)(cur_ptr); - for( j = 0; j < d->num_vertices; j++ ) - { - w->fillarea3data.vnormals[j] = d->vnormals[i]; - } - cur_ptr += ( d->num_vertices * sizeof( TEL_POINT ) ); - - w->fillarea3data.colours = (tel_colour)(cur_ptr); - - for( j = 0; j < d->num_vertices; j++ ) - { - w->fillarea3data.colours[j] = d->vcolours[i]; - } - } - else - { - w->fillarea3data.vrtflag = TEL_VTFLAG_NORMAL; - w->fillarea3data.colours = 0; - w->fillarea3data.vnormals = (tel_point)(cur_ptr); - - for( j = 0; j < d->num_vertices; j++ ) - { - w->fillarea3data.vnormals[j] = d->vnormals[i]; - } - } - } - else - { - w->fillarea3data.vnormals = 0; - if( d->vcolours ) - { - w->fillarea3data.vrtflag = TEL_VTFLAG_COLOUR; - w->fillarea3data.colours = (tel_colour)(cur_ptr); - for( j = 0; j < d->num_vertices; j++ ) - { - w->fillarea3data.colours[j] = d->vcolours[i]; - } - } - else - { - w->fillarea3data.vrtflag = TEL_VTFLAG_NONE; - w->fillarea3data.colours = 0; - } - } - - status = TSuccess; - } - else - status = TFailure; - break; - } - } - } - return status; -} -/*----------------------------------------------------------------------*/ - -static void -draw_edges( tel_polygon_data p, tel_colour edge_colour, Tint interior_style ) -{ - CMN_KEY k, k1, k2, k3, k4; - tel_point ptr; - Tint i; - Tint edge_type, line_type_preserve; - Tfloat edge_width, line_width_preserve; - GLboolean texture_on; - - if (interior_style != TSM_HIDDENLINE) - { - k.id = TelEdgeFlag; - TsmGetAttri( 1, &k ); - if( k.data.ldata == TOff )return; - } - - ptr = p->vertices; - - LightOff(); - texture_on = IsTextureEnabled(); - if (texture_on) DisableTexture(); - - k1.id = TelPolylineWidth; - k2.id = TelPolylineType; - k3.id = TelEdgeType; - k4.id = TelEdgeWidth; - - TsmGetAttri( 4, &k1, &k2, &k3, &k4 ); - - line_width_preserve = k1.data.fdata; - line_type_preserve = k2.data.ldata; - edge_type = k3.data.ldata; - edge_width = k4.data.fdata; - - if( line_width_preserve != edge_width ) - { - k.id = TelPolylineWidth; - k.data.fdata = edge_width; - TsmSetAttri( 1, &k ); - } - if( line_type_preserve != edge_type ) - { - k.id = TelPolylineType; - k.data.ldata = edge_type; - TsmSetAttri( 1, &k ); - } - - glColor3fv( edge_colour->rgb ); - - glBegin(GL_LINE_LOOP); - for( i=0; inum_vertices; i++, ptr++ ) - { - glVertex3fv( ptr->xyz ); - } - glEnd(); - - if( line_width_preserve != edge_width ) - { - k.id = TelPolylineWidth; - k.data.fdata = line_width_preserve; - TsmSetAttri( 1, &k ); - } - if( line_type_preserve != edge_type ) - { - k.id = TelPolylineType; - k.data.ldata = line_type_preserve; - TsmSetAttri( 1, &k ); - } - - if (texture_on) EnableTexture(); -} -/*----------------------------------------------------------------------*/ diff --git a/src/OpenGl/OpenGl_polygonholes.cxx b/src/OpenGl/OpenGl_polygonholes.cxx deleted file mode 100755 index 71d29e930f..0000000000 --- a/src/OpenGl/OpenGl_polygonholes.cxx +++ /dev/null @@ -1,1702 +0,0 @@ -/*********************************************************************** - -FONCTION : ----------- -File OpenGl_polygonholes : - - -REMARQUES: ----------- - - -HISTORIQUE DES MODIFICATIONS : --------------------------------- -xx-xx-xx : xxx ; Creation. -11-03-96 : FMN ; Correction warning compilation -01-04-96 : CAL ; Integration MINSK portage WNT -09-08-96 : FMN ; Suppression appel glMatrixMode() avant glGetFloatv() -21-10-96 : FMN ; Suppression LMC_COLOR fait dans OpenGl_execstruct.c -23-12-97 : FMN ; Suppression TelSetFrontFaceAttri et TelSetBackFaceAttri -Suppression TelBackInteriorStyle, TelBackInteriorStyleIndex -et TelBackInteriorShadingMethod -03-03-98 : FMN ; Suppression variable externe TglWhetherPerspective -08-03-01 : GG ; BUC60823 Avoid crash in the normal computation method -on confuse point. - -************************************************************************/ - -/*----------------------------------------------------------------------*/ -/* -* Includes -*/ - - -#include - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifndef WNT -#if !defined(APIENTRY) -# define APIENTRY -#endif // APIENTRY -# define STATIC static -#else -# include -# define STATIC -typedef double GLUcoord; -#endif /* WNT */ - - -/*----------------------------------------------------------------------*/ -/* -* Variables statiques -*/ - -static TStatus PolygonHolesDisplay( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus PolygonHolesAdd( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus PolygonHolesDelete( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus PolygonHolesPrint( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus PolygonHolesInquire( TSM_ELEM_DATA, Tint, cmn_key* ); - -#if !defined(GLU_VERSION_1_2) -#define GLUtesselator GLUtriangulatorObj -void gluTessBeginContour(); -void gluTessBeginPolygon(); -void gluTessEndPolygon(); -void gluTessEndContour(); -#endif - - -/*----------------------------------------------------------------------*/ -/* -* Typedef -*/ - -struct EXTRA_VERTEX -{ - GLfloat vert[3]; - int ind; - IMPLEMENT_MEMORY_OPERATORS -}; -typedef EXTRA_VERTEX* extra_vertex; - -struct SEQ_ -{ - Tint ts_num, ts_alloc; - void **tmesh_sequence; - GLenum triangle_type; /* FSXXX OPTI */ - IMPLEMENT_MEMORY_OPERATORS -}; - -struct DISPLAY_ -{ - Tint num_of_seq; - Tint num_alloc; - SEQ_ *seq; - IMPLEMENT_MEMORY_OPERATORS -}; - -struct TEL_POLYGON_HOLES_DATA -{ - Tint num_vertices; /* Number of vertices */ - Tint facet_flag; /* TEL_FA_NONE or TEL_FA_NORMAL */ - Tint vertex_flag; /* TEL_VT_NONE or TEL_VT_NORMAL */ - Tint shape_flag; /* TEL_SHAPE_UNKNOWN or TEL_SHAPE_COMPLEX or - TEL_SHAPE_CONVEX or TEL_SHAPE_CONCAVE */ - TEL_POINT fnormal; /* Facet normal */ - Tint *edgevis; /* edge visibility flags */ - tel_colour fcolour; /* Facet colour */ - Tint num_bounds; /* number of bounds */ - Tint *bounds; /* Array of length num_bounds */ - tel_point vertices; /* Vertices */ - tel_colour vcolours; /* Vertex colour values */ - tel_point vnormals; /* Vertex normals */ - DISPLAY_ *display; /* FSXXX plus utilise ? */ - GLuint triangle_dl1; /* triangle display list 1 */ - GLuint triangle_dl2; /* triangle display list 2 */ - GLuint triangle_dl3; /* triangle display list 3 */ -}; -typedef TEL_POLYGON_HOLES_DATA* tel_polygon_holes_data; - -static TEL_POLYGON_HOLES_DATA polygon_holes_defaults = -{ - 0, /* num_vertices */ - TEL_FA_NONE, /* facet_flag */ - TEL_VT_NONE, /* vertex_flag */ - TEL_SHAPE_UNKNOWN, /* shape_flag */ - {{ ( float )0.0, ( float )0.0, ( float )0.0 }}, /* fnormal */ - 0, /* edgevis */ - 0, /* fcolour */ - 0, /* num_bounds */ - 0, /* bounds */ - 0, /* vertices */ - 0, /* vcolours */ - 0, /* vnormals */ - 0, /* display */ - 0, /* triangle_dl1 */ - 0, /* triangle_dl2 */ - 0 /* triangle_dl3 */ -}; - -static void bgntriangulate( tel_polygon_holes_data, void (APIENTRY*)() ); -static void endtriangulate(void); -STATIC void APIENTRY out_vertex1( void* ); -STATIC void APIENTRY out_vertex2( void* ); -STATIC void APIENTRY out_vertex3( void* ); -static void draw_tmesh( tel_polygon_holes_data, Tint ); -static void draw_polygon_holes( tel_polygon_holes_data, Tint, - Tint, Tint ); -static void draw_edges( tel_polygon_holes_data, Tmatrix3, tel_colour, Tint, - TelCullMode, Tint, Tint ); - -static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) = -{ - PolygonHolesDisplay, /* PickTraverse */ - PolygonHolesDisplay, - PolygonHolesAdd, - PolygonHolesDelete, - PolygonHolesPrint, - PolygonHolesInquire -}; - - -MtblPtr -TelPolygonHolesInitClass( TelType* el ) -{ - *el = TelPolygonHoles; - return MtdTbl; -} - -static TStatus -PolygonHolesAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k ) -{ - Tint i, j, m; - tel_polygon_holes_data data; - - for( i = 0; i < n; i++ ) - { - if( k[i]->id == NUM_FACETS_ID ) - break; - } - if( i == n ) - return TFailure; - - if( !(k[i]->data.ldata) ) - return TFailure; - - for( j = 0; j < n; j++ ) - { - if( k[j]->id == BOUNDS_DATA_ID ) - break; - } - if( j == n ) - return TFailure; - - data = new TEL_POLYGON_HOLES_DATA(); - if( !data ) - return TFailure; - - /* load defaults */ - memcpy( data, &polygon_holes_defaults, sizeof(TEL_POLYGON_HOLES_DATA) ); - - data->num_bounds = k[i]->data.ldata; - data->bounds = new Tint[data->num_bounds]; - memcpy( data->bounds, k[j]->data.pdata, data->num_bounds*sizeof(Tint) ); - - for( m = 0, data->num_vertices = 0; m < data->num_bounds; m++ ) - data->num_vertices += data->bounds[m]; - - for( i = 0; i < n; i++ ) - { - if( k[i]->id == VERTICES_ID ) - break; - } - if( i == n ) - return TFailure; - - if( !(k[i]->data.ldata) ) - return TFailure; - - data->vertices = new TEL_POINT[data->num_vertices]; - memcpy( data->vertices, k[i]->data.pdata, data->num_vertices*sizeof(TEL_POINT) ); - - for( i = 0; i < n; i++ ) - { - switch( k[i]->id ) - { - case FNORMALS_ID: - data->facet_flag = TEL_FA_NORMAL; - memcpy( &data->fnormal, k[i]->data.pdata, sizeof(TEL_POINT) ); - vecnrm( data->fnormal.xyz ); - break; - - case FACET_COLOUR_VALS_ID: - data->fcolour = new TEL_COLOUR(); - memcpy( data->fcolour, k[i]->data.pdata, sizeof(TEL_COLOUR) ); - break; - - case EDGE_DATA_ID: - data->edgevis = new Tint[data->num_vertices]; - memcpy( data->edgevis, k[i]->data.pdata, sizeof(Tint) ); - break; - - case VERTEX_COLOUR_VALS_ID: - data->vcolours = new TEL_COLOUR[data->num_vertices]; - memcpy( data->vcolours, k[i]->data.pdata, data->num_vertices*sizeof(TEL_COLOUR) ); - break; - - case VNORMALS_ID: - data->vertex_flag = TEL_VT_NORMAL; - data->vnormals = new TEL_POINT[data->num_vertices]; - memcpy( data->vnormals, k[i]->data.pdata, data->num_vertices*sizeof(TEL_POINT) ); - for( j = 0; j < data->num_vertices; j++ ) - vecnrm( data->vnormals[j].xyz ); - break; - - case SHAPE_FLAG_ID: - data->shape_flag = k[i]->data.ldata; - break; - } - } - - if( data->facet_flag != TEL_FA_NORMAL ) - { -#ifdef BUC60823 - TelGetPolygonNormal( data->vertices, NULL, - data->num_vertices, data->fnormal.xyz ); -#else - TelGetNormal( data->vertices[0].xyz, data->vertices[1].xyz, - data->vertices[2].xyz, data->fnormal.xyz ); - vecnrm( data->fnormal.xyz ); -#endif - } - ((tsm_elem_data)(d.pdata))->pdata = data; - - return TSuccess; -} - - - -static TStatus -PolygonHolesDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - Tint front_face = 1; - Tmatrix3 mat; - CMN_KEY k11, k12, k13, k14, k16, k17, k19, k111, - k112, k113, k117; - - Tint fl=0; - Tint front_lighting_model, back_lighting_model; - Tint front_lighting_model_preserve, back_lighting_model_preserve; - Tint front_shading_method; - Tint interior_style; - Tint interior_index; - TEL_COLOUR interior_colour, back_interior_colour; - TEL_COLOUR point_colour, edge_colour; - TelCullMode face_culling_mode; - Tint face_distinguishing_mode; - - tel_polygon_holes_data d; - - k11.id = TelFaceDistinguishingMode; - k12.id = TelInteriorReflectanceEquation; - k13.id = TelInteriorShadingMethod; - k14.id = TelBackInteriorReflectanceEquation; - k16.id = TelFaceCullingMode; - k17.id = TelInteriorStyle; - k19.id = TelInteriorStyleIndex; - k111.id = TelInteriorColour; - k111.data.pdata = &interior_colour; - k112.id = TelBackInteriorColour; - k112.data.pdata = &back_interior_colour; - k113.id = TelPolymarkerColour; - k113.data.pdata = &point_colour; - k117.id = TelEdgeColour; - k117.data.pdata = &edge_colour; - - TsmGetAttri( 11, &k11, &k12, &k13, &k14, &k16, &k17, - &k19, &k111, &k112, &k113, &k117 ); - - face_distinguishing_mode = k11.data.ldata; - front_lighting_model = k12.data.ldata; - front_lighting_model_preserve = k12.data.ldata; - front_shading_method = k13.data.ldata; - back_lighting_model = k14.data.ldata; - back_lighting_model_preserve = k14.data.ldata; - face_culling_mode = (TelCullMode)k16.data.ldata; - interior_style = k17.data.ldata; - interior_index = k19.data.ldata; - - if( k[0]->id == TOn ) - { /* Use highlight colours */ - TEL_HIGHLIGHT hrep; - CMN_KEY kkk, kkl; - - k11.id = TelHighlightIndex; - TsmGetAttri( 1, &k11 ); - if( TelGetHighlightRep( TglActiveWs, k11.data.ldata, &hrep ) - == TSuccess ) - { - if( hrep.type == TelHLForcedColour ) - { - edge_colour = back_interior_colour = interior_colour = hrep.col; - front_lighting_model = back_lighting_model = CALL_PHIGS_REFL_NONE; - kkk.id = TelInteriorReflectanceEquation; - kkk.data.ldata = CALL_PHIGS_REFL_NONE; - kkl.id = TelBackInteriorReflectanceEquation; - kkl.data.ldata = CALL_PHIGS_REFL_NONE; - TsmSetAttri( 2, &kkk, &kkl ); - fl = 0; - } - else - { - edge_colour = hrep.col; - k[0]->id = TOff; - } - } - else - { - TelGetHighlightRep( TglActiveWs, 0, &hrep ); - if( hrep.type == TelHLForcedColour ) - { - back_interior_colour = interior_colour = hrep.col; - front_lighting_model = back_lighting_model = CALL_PHIGS_REFL_NONE; - kkk.id = TelInteriorReflectanceEquation; - kkk.data.ldata = CALL_PHIGS_REFL_NONE; - kkl.id = TelBackInteriorReflectanceEquation; - kkl.data.ldata = CALL_PHIGS_REFL_NONE; - TsmSetAttri( 2, &kkk, &kkl ); - fl = 0; - } - else - k[0]->id = TOff; - } - } - - d = (tel_polygon_holes_data)data.pdata; - - glGetFloatv(GL_MODELVIEW_MATRIX, (GLfloat *) mat); - - if( face_distinguishing_mode == TOn ) - { - if( ( face_culling_mode == TelCullBack && front_face ) || - ( face_culling_mode == TelCullNone && front_face ) ) - { - glColor3fv( interior_colour.rgb ); - - draw_polygon_holes(d, interior_style, front_lighting_model, k[0]->id); - } - else if( ( face_culling_mode == TelCullFront && !front_face ) || - ( face_culling_mode == TelCullNone && !front_face ) ) - { - /* CMN_KEY k; */ - glColor3fv( back_interior_colour.rgb ); - - draw_polygon_holes( d, interior_style, - back_lighting_model, k[0]->id); - } - } - else - { - if( ( face_culling_mode == TelCullBack && front_face ) || - ( face_culling_mode == TelCullFront && !front_face ) || - ( face_culling_mode == TelCullNone ) ) - { - glColor3fv( interior_colour.rgb ); - - draw_polygon_holes(d, interior_style, front_lighting_model, k[0]->id); - } - } - - - /*A remplacer par le call-back GLU_EDGE_FLAG , A TESTER */ - draw_edges( d, mat, &edge_colour, face_distinguishing_mode, - face_culling_mode, interior_style, interior_style ); - - if( fl ) - { - CMN_KEY kkk, kkl; - - kkk.id = TelInteriorReflectanceEquation; - kkk.data.ldata = front_lighting_model_preserve; - kkl.id = TelBackInteriorReflectanceEquation; - kkl.data.ldata = back_lighting_model_preserve; - TsmSetAttri( 2, &kkk, &kkl ); - } - - return TSuccess; - -} - -static GLUtesselator *tripak; - -static void -draw_polygon_holes( tel_polygon_holes_data d, - Tint style, Tint u, Tint hflag ) -{ - long i, j, m; - - GLdouble xyz[3]; - - tel_point pvn; - tel_colour pfc, pvc; - - pfc = d->fcolour; - pvc = d->vcolours; - pvn = d->vnormals; - - if( hflag ) - { - pvc = pfc = 0; - } - - if( pfc ) - glColor3fv( pfc->rgb ); - if( u != CALL_PHIGS_REFL_NONE ) - glNormal3fv( d->fnormal.xyz ); - - if( d->display == 0 ) - { - - if( u == CALL_PHIGS_REFL_NONE ) - { - if( pvc ) - { - bgntriangulate( d, (void (APIENTRY*)())out_vertex2 ); - } - else - { - bgntriangulate( d, (void (APIENTRY*)())out_vertex1 ); - } - } - else - { - if( pvn ) - { - bgntriangulate( d, (void (APIENTRY*)())out_vertex3 ); - } - else - { - bgntriangulate( d, (void (APIENTRY*)())out_vertex1 ); - } - } - gluTessBeginPolygon( tripak, NULL ); - for( i = 0, m = 0; i < d->num_bounds; i++ ) - { - gluTessBeginContour( tripak ); - for( j = 0; j < d->bounds[i]; j++ ) - { - xyz[0] = d->vertices[m].xyz[0]; - xyz[1] = d->vertices[m].xyz[1]; - xyz[2] = d->vertices[m].xyz[2]; -#ifndef WNT - gluTessVertex( tripak, xyz, (void *)m ); -#else - { - GLdouble v[ 3 ]; - v[ 0 ] = d -> vertices[ m ].xyz[ 0 ]; - v[ 1 ] = d -> vertices[ m ].xyz[ 1 ]; - v[ 2 ] = d -> vertices[ m ].xyz[ 2 ]; - - gluTessVertex ( tripak, v, ( void* )m ); - } -#endif /* WNT */ - m++; - } - gluTessEndContour( tripak ); - } - gluTessEndPolygon( tripak ); - endtriangulate(); - } - else - { - if( u == CALL_PHIGS_REFL_NONE ) - { - if( pvc ) - draw_tmesh( d, 2 ); - else - draw_tmesh( d, 1 ); - } - else - { - if( pvn ) - draw_tmesh( d, 3 ); - else - draw_tmesh( d, 1 ); - } - } - - -} - -static void -draw_tmesh( tel_polygon_holes_data d, Tint v ) -{ - Tint i, j, k; - DISPLAY_ *dis; - SEQ_ *s; - - dis = d->display; - for( i = 0; i < dis->num_of_seq; i++ ) - { - s = &(dis->seq[i]); - - glBegin(s->triangle_type); - switch( v ) - { - case 1: - { - for( j = 0, k = 0; j < s->ts_num; j++ ) - { - if ( s->tmesh_sequence[j] < (void *)0xffff ) { - glVertex3fv( d->vertices[ (long)s->tmesh_sequence[ j ] ].xyz ); - } - else { - extra_vertex b = (extra_vertex)s->tmesh_sequence[j]; - glVertex3fv( b->vert ); - } - } - break; - } - case 2: - { - for( j = 0, k = 0; j < s->ts_num; j++ ) - { - if ( s->tmesh_sequence[j] < (void *)0xffff ) { - glColor3fv( d->vcolours[ (long) s->tmesh_sequence[ j ] ].rgb ); - glVertex3fv( d->vertices[ (long) s->tmesh_sequence[ j ] ].xyz ); - } else { - extra_vertex b = (extra_vertex)s->tmesh_sequence[j]; - glColor3fv( d->vcolours[(b->ind)].rgb); - glVertex3fv( b->vert ); - } - } - break; - } - case 3: - { - for( j = 0, k = 0; j < s->ts_num; j++ ) - { - if ( s->tmesh_sequence[j] < (void *)0xffff) { - glNormal3fv( d->vnormals[ (long) s->tmesh_sequence[ j ] ].xyz ); - glVertex3fv( d->vertices[ (long) s->tmesh_sequence[ j ] ].xyz ); - } else { - extra_vertex b = (extra_vertex)s->tmesh_sequence[j]; - glNormal3fv( d->vnormals[(b->ind)].xyz); - glVertex3fv( b->vert ); - } - } - break; - } - } - glEnd(); - } -} - - -static TStatus -PolygonHolesDelete( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - tel_polygon_holes_data p = (tel_polygon_holes_data)data.pdata; - if( p->fcolour ) - //cmn_freemem( p->fcolour ); - delete p->fcolour; - if( p->vertices ) - //cmn_freemem( p->vertices ); - delete[] p->vertices; - if( p->vcolours ) - //cmn_freemem( p->vcolours ); - delete[] p->vcolours; - if( p->vnormals ) - //cmn_freemem( p->vnormals ); - delete[] p->vnormals; - if( p->bounds ) - //cmn_freemem( p->bounds ); - delete[] p->bounds; - if( p->edgevis ) - //cmn_freemem( p->edgevis ); - delete[] p->edgevis; - if( p->display ) - { - Tint i, j; - - for( i = 0; i < p->display->num_of_seq; i++ ) - { - if( p->display->seq[i].tmesh_sequence ) { - for ( j = 0; j < p->display->seq[i].ts_num ; j++ ) { - if ( p->display->seq[i].tmesh_sequence[j] >= (void *)0xffff ) - free(p->display->seq[i].tmesh_sequence[j]); - } - } - delete[] p->display->seq[i].tmesh_sequence; - } - delete[] p->display->seq; - delete p->display; - } - - - if (data.pdata) - delete data.pdata; - return TSuccess; -} - - -static TStatus -PolygonHolesPrint( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - Tint i; - tel_polygon_holes_data p = (tel_polygon_holes_data)data.pdata; - - fprintf( stdout, "TelPolygonHoles. Number of bounds: %d\n", p->num_bounds ); - switch( p->shape_flag ) - { - case TEL_SHAPE_UNKNOWN: - fprintf( stdout, "\t\tShape Flag : UNKNOWN\n" ); - break; - - case TEL_SHAPE_COMPLEX: - fprintf( stdout, "\t\tShape Flag : COMPLEX\n" ); - break; - - case TEL_SHAPE_CONCAVE: - fprintf( stdout, "\t\tShape Flag : CONCAVE\n" ); - break; - - case TEL_SHAPE_CONVEX: - fprintf( stdout, "\t\tShape Flag : CONVEX\n" ); - break; - - } - switch( p->facet_flag ) - { - case TEL_FA_NONE: - if( p->fcolour ) - fprintf( stdout, "\t\tFacet Flag : COLOUR\n" ); - else - fprintf( stdout, "\t\tFacet Flag : NONE\n" ); - break; - - case TEL_FA_NORMAL: - if( p->fcolour ) - fprintf( stdout, "\t\tFacet Flag : COLOURNORMAL\n" ); - else - fprintf( stdout, "\t\tFacet Flag : NORMAL\n" ); - break; - } - switch( p->vertex_flag ) - { - case TEL_VT_NONE: - if( p->vcolours ) - fprintf( stdout, "\t\tVertex Flag : COLOUR\n" ); - else - fprintf( stdout, "\t\tVertex Flag : NONE\n" ); - break; - - case TEL_VT_NORMAL: - if( p->vcolours ) - fprintf( stdout, "\t\tVertex Flag : COLOURNORMAL\n" ); - else - fprintf( stdout, "\t\tVertex Flag : NORMAL\n" ); - break; - } - fprintf( stdout, "\t\tFacet Normal : %g %g %g\n", p->fnormal.xyz[0], - p->fnormal.xyz[1], - p->fnormal.xyz[2] ); - if( p->fcolour ) - fprintf( stdout, "\t\tFacet Colour : %g %g %g\n", p->fcolour->rgb[0], - p->fcolour->rgb[1], - p->fcolour->rgb[2] ); - else - fprintf( stdout, "\n\t\tFacet Colour not specified\n" ); - - if( p->edgevis ) - { - fprintf( stdout, "\t\tEdge Visibility Data :\n" ); - for( i = 0; i < p->num_vertices; i++ ) - fprintf( stdout, "\t\t%d ", p->edgevis[i] ); - fprintf( stdout, "\n" ); - } - - if( p->bounds ) - { - fprintf( stdout, "\t\tBounds array :\n" ); - for( i = 0; i < p->num_bounds; i++ ) - fprintf( stdout, "\t\tb[%d] %d \n", i, p->bounds[i] ); - } - - if( p->vertices ) - { - fprintf( stdout, "\n\t\tVertices : " ); - for( i = 0; i < p->num_vertices; i++ ) - fprintf( stdout, "\n\t\t v[%d] = %g %g %g", i, - p->vertices[i].xyz[0], - p->vertices[i].xyz[1], - p->vertices[i].xyz[2] ); - } - - fprintf( stdout, "\n" ); - if( p->vcolours ) - { - fprintf( stdout, "\n\t\tVertex Colours : " ); - for( i = 0; i < p->num_vertices; i++ ) - fprintf( stdout, "\n\t\t v[%d] = %g %g %g", i, - p->vcolours[i].rgb[0], - p->vcolours[i].rgb[1], - p->vcolours[i].rgb[2] ); - } - else - fprintf( stdout, "\n\t\tVertex Colours not specified\n" ); - - if( p->vnormals ) - { - fprintf( stdout, "\n\t\tVertex Normals : " ); - for( i = 0; i < p->num_vertices; i++ ) - fprintf( stdout, "\n\t\t v[%d] = %g %g %g", i, - p->vnormals[i].xyz[0], - p->vnormals[i].xyz[1], - p->vnormals[i].xyz[2] ); - } - else - fprintf( stdout, "\n\t\tVertex Normals not specified\n" ); - fprintf( stdout, "\n" ); - return TSuccess; -} - - -static TStatus -PolygonHolesInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - Tint i, j; - Tint size_reqd=0; - TStatus status = TSuccess; - Tchar *cur_ptr = 0; - tel_polygon_holes_data d = (tel_polygon_holes_data)data.pdata; - - if( d->fcolour ) - size_reqd += sizeof( TEL_COLOUR ); - - if( d->facet_flag == TEL_FA_NORMAL ) - size_reqd += sizeof( TEL_POINT ); - - if( d->edgevis ) - size_reqd += ( d->num_vertices * sizeof( Tint ) ); - - size_reqd += ( d->num_bounds * sizeof( Tint ) ); - - size_reqd += ( d->num_vertices * sizeof( TEL_POINT ) ); - - if( d->vcolours ) - size_reqd += ( d->num_vertices * sizeof( TEL_COLOUR ) ); - - if( d->vertex_flag == TEL_VT_NORMAL ) - size_reqd += ( d->num_vertices * sizeof( TEL_POINT ) ); - - for( i = 0; i < n; i++ ) - { - switch( k[i]->id ) - { - case INQ_GET_SIZE_ID: - { - k[i]->data.ldata = size_reqd; - break; - } - - case INQ_GET_CONTENT_ID: - { - TEL_INQ_CONTENT *c; - Teldata *w; - - c = (tel_inq_content)k[i]->data.pdata; - c->act_size = size_reqd; - w = c->data; - - cur_ptr = c->buf; - w->fillareaset3data.num_bounds = d->num_bounds; - w->fillareaset3data.shpflag = d->shape_flag; - - if( d->edgevis ) - w->fillareaset3data.edgflag = TOn; - else - w->fillareaset3data.edgflag = TOff; - - if( c->size >= size_reqd ) - { - if( d->facet_flag == TEL_FA_NORMAL ) - { - if( d->fcolour ) - { - w->fillareaset3data.faflag = TEL_FAFLAG_COLOURNORMAL; - w->fillareaset3data.gnormal = (tel_point)(c->buf); - *(w->fillareaset3data.gnormal) = d->fnormal; - w->fillareaset3data.facet_colour_val = - (tel_colour)(c->buf + sizeof( TEL_POINT ) ); - *(w->fillareaset3data.facet_colour_val) = *(d->fcolour); - cur_ptr = c->buf + sizeof( TEL_POINT ) + - sizeof( TEL_COLOUR ); - } - else - { - w->fillareaset3data.faflag = TEL_FAFLAG_NORMAL; - w->fillareaset3data.facet_colour_val = 0; - w->fillareaset3data.gnormal = (tel_point)(c->buf); - *(w->fillareaset3data.gnormal) = d->fnormal; - cur_ptr = c->buf + sizeof( TEL_POINT ); - } - } - else - { - w->fillareaset3data.gnormal = 0; - if( d->fcolour ) - { - w->fillareaset3data.faflag = TEL_FAFLAG_COLOUR; - w->fillareaset3data.facet_colour_val = (tel_colour)(c->buf ); - *(w->fillareaset3data.facet_colour_val) = *(d->fcolour); - cur_ptr = c->buf + sizeof( TEL_COLOUR ); - } - else - { - w->fillareaset3data.faflag = TEL_FAFLAG_NONE; - w->fillareaset3data.facet_colour_val = 0; - } - } - - w->fillareaset3data.points = (tel_point)cur_ptr; - for( j = 0; j < d->num_vertices; j++ ) - { - w->fillareaset3data.points[j] = d->vertices[j]; - } - cur_ptr += ( d->num_vertices * sizeof( TEL_POINT ) ); - - if( d->edgevis ) - { - w->fillareaset3data.edgvis = (Tint *)(cur_ptr); - memcpy( w->fillareaset3data.edgvis, d->edgevis, - d->num_vertices*sizeof(Tint) ); - cur_ptr += (d->num_vertices * sizeof( Tint ) ); - } - - w->fillareaset3data.bounds = (Tint *)cur_ptr; - memcpy( w->fillareaset3data.bounds, d->bounds, - d->num_bounds*sizeof(Tint) ); - cur_ptr += ( d->num_bounds * sizeof( Tint ) ); - - if( d->vertex_flag == TEL_VT_NORMAL ) - { - if( d->vcolours ) - { - w->fillareaset3data.vrtflag = TEL_VTFLAG_COLOURNORMAL; - w->fillareaset3data.vnormals = (tel_point)(cur_ptr); - for( j = 0; j < d->num_vertices; j++ ) - { - w->fillareaset3data.vnormals[j] = d->vnormals[i]; - } - cur_ptr += ( d->num_vertices * sizeof( TEL_POINT ) ); - - w->fillareaset3data.colours = (tel_colour)(cur_ptr); - - for( j = 0; j < d->num_vertices; j++ ) - { - w->fillareaset3data.colours[j] = d->vcolours[i]; - } - } - else - { - w->fillareaset3data.vrtflag = TEL_VTFLAG_NORMAL; - w->fillareaset3data.colours = 0; - w->fillareaset3data.vnormals = (tel_point)(cur_ptr); - - for( j = 0; j < d->num_vertices; j++ ) - { - w->fillareaset3data.vnormals[j] = d->vnormals[i]; - } - } - } - else - { - w->fillareaset3data.vnormals = 0; - if( d->vcolours ) - { - w->fillareaset3data.vrtflag = TEL_VTFLAG_COLOUR; - w->fillareaset3data.colours = (tel_colour)(cur_ptr); - for( j = 0; j < d->num_vertices; j++ ) - { - w->fillareaset3data.colours[j] = d->vcolours[i]; - } - } - else - { - w->fillareaset3data.vrtflag = TEL_VTFLAG_NONE; - w->fillareaset3data.colours = 0; - } - } - - status = TSuccess; - } - else - status = TFailure; - break; - } - } - } - return status; -} - - - -#define INCREMENT 64 -static tel_polygon_holes_data DaTa; - -STATIC void APIENTRY -out_bgntmesh_1 ( GLenum triangle_type ) -{ - - DISPLAY_ *dis; - dis = DaTa->display; - - dis->num_of_seq++; - if( dis->num_alloc < dis->num_of_seq ) - { - dis->num_alloc += INCREMENT; - - if( dis->seq == 0 ) - { - dis->seq = new SEQ_[dis->num_alloc]; - } - else - { -#if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x530) - dis->seq = (SEQ_*)realloc( dis->seq, dis->num_alloc*sizeof(SEQ_) ); -#else - dis->seq = cmn_resizemem( dis->seq, dis->num_alloc ); -#endif - } - } - dis->seq[ dis->num_of_seq - 1 ].ts_num = 0; - dis->seq[ dis->num_of_seq - 1 ].ts_alloc = 0; - dis->seq[ dis->num_of_seq - 1 ].tmesh_sequence = 0; - dis->seq[ dis->num_of_seq - 1 ].triangle_type = triangle_type; - glBegin(triangle_type); -} - - -STATIC void APIENTRY -out_vertex1( void *data ) -{ - SEQ_ *s; - - s = &( DaTa->display->seq[ DaTa->display->num_of_seq - 1 ] ); - - s->ts_num++; - if( s->ts_alloc < s->ts_num ) - { - s->ts_alloc += INCREMENT; - - if( s->tmesh_sequence == 0 ) - { - s->tmesh_sequence = new void*[s->ts_alloc]; - } - else - { -#if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x530) - s->tmesh_sequence = (void**)realloc( s->tmesh_sequence, - s->ts_alloc*sizeof(void*)); -#else - s->tmesh_sequence = cmn_resizemem( s->tmesh_sequence, - s->ts_alloc); -#endif - } - } - s->tmesh_sequence[ s->ts_num - 1 ] = data; - - if ( data < (void *)0xffff ) { - long int a = (long int)data; - - glVertex3fv( DaTa->vertices[a].xyz ); - } - else { - extra_vertex b = (extra_vertex)data; - - glVertex3fv(b->vert); - } -} - -STATIC void APIENTRY -out_vertex2( void *data ) -{ - SEQ_ *s; - - s = &( DaTa->display->seq[ DaTa->display->num_of_seq - 1 ] ); - - s->ts_num++; - if( s->ts_alloc < s->ts_num ) - { - s->ts_alloc += INCREMENT; - - if( s->tmesh_sequence == 0 ) - { - s->tmesh_sequence = new void*[s->ts_alloc]; - } - else - { -#if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x530) - s->tmesh_sequence = (void**)realloc( s->tmesh_sequence, - s->ts_alloc*sizeof(void*) ); -#else - s->tmesh_sequence = cmn_resizemem( s->tmesh_sequence, - s->ts_alloc ); -#endif - } - } - s->tmesh_sequence[ s->ts_num - 1 ] = data; - - if ( data < (void *)0xffff ){ - long int a = (long int)data; - - glColor3fv( DaTa->vcolours[a].rgb ); - glVertex3fv( DaTa->vertices[a].xyz ); - } - else { - extra_vertex b = (extra_vertex)data; - - glColor3fv(DaTa->vcolours[b->ind].rgb ); - glVertex3fv(b->vert); - } -} - -STATIC void APIENTRY -out_vertex3( void *data ) -{ - SEQ_ *s; - - s = &( DaTa->display->seq[ DaTa->display->num_of_seq - 1 ] ); - - s->ts_num++; - if( s->ts_alloc < s->ts_num ) - { - s->ts_alloc += INCREMENT; - - if( s->tmesh_sequence == 0 ) - { - s->tmesh_sequence = new void*[s->ts_alloc]; - } - else - { -#if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x530) - s->tmesh_sequence = (void**)realloc( s->tmesh_sequence, - s->ts_alloc*sizeof(void*) ); -#else - s->tmesh_sequence = cmn_resizemem( s->tmesh_sequence, - s->ts_alloc ); -#endif - } - } - s->tmesh_sequence[ s->ts_num - 1 ] = data; - - if ( data < (void *)0xffff ) { - long int a = (long int)data; - - glNormal3fv( DaTa->vnormals[a].xyz ); - glVertex3fv( DaTa->vertices[a].xyz ); - } - else { - extra_vertex b = (extra_vertex) data; - - glNormal3fv( DaTa->vnormals[b->ind].xyz ); - glVertex3fv(b->vert); - } - -} - -STATIC void APIENTRY -out_combine( GLdouble coords[3], int *data, - GLfloat w[4], void **dataout ) -{ - extra_vertex new_vertex; - - new_vertex = (extra_vertex) malloc(sizeof(EXTRA_VERTEX)); - - new_vertex->vert[0] = ( float )coords[0]; - new_vertex->vert[1] = ( float )coords[1]; - new_vertex->vert[2] = ( float )coords[2]; - new_vertex->ind = *data; - *dataout = new_vertex; - -#ifdef TRACE - printf("mycombine3 %e %e %e\n", - new_vertex->vert[0], - new_vertex->vert[1], - new_vertex->vert[2], - new_vertex->ind); -#endif - - -} - - - -STATIC void APIENTRY -out_endtmesh_1( void ) -{ - glEnd(); -} - -STATIC void APIENTRY -out_error_1( GLenum error ) -{ - printf( "%s\n", (char *) gluErrorString(error) ); -} - -static void -bgntriangulate( tel_polygon_holes_data d, void (APIENTRY*out_ver)() ) -{ - DaTa = d; - if( !DaTa->display ) - DaTa->display = new DISPLAY_(); - - tripak = gluNewTess(); -#if defined(linux) && !defined(NOGLUfuncptr) - gluTessCallback(tripak, GLU_TESS_BEGIN, (_GLUfuncptr)(out_bgntmesh_1)); - gluTessCallback(tripak, GLU_TESS_VERTEX, out_ver); - gluTessCallback(tripak, GLU_TESS_END, out_endtmesh_1); - gluTessCallback(tripak, GLU_TESS_ERROR, (_GLUfuncptr)(out_error_1)); - gluTessCallback(tripak, GLU_TESS_COMBINE, (_GLUfuncptr)(out_combine)); -#else - gluTessCallback(tripak, GLU_TESS_BEGIN, (void (APIENTRY*)())out_bgntmesh_1); - gluTessCallback(tripak, GLU_TESS_VERTEX, (void (APIENTRY*)())out_ver); - gluTessCallback(tripak, GLU_TESS_END, (void (APIENTRY*)())out_endtmesh_1); - gluTessCallback(tripak, GLU_TESS_ERROR, (void (APIENTRY*)())out_error_1); - gluTessCallback(tripak, GLU_TESS_COMBINE, (void (APIENTRY*)())out_combine); -#endif - -} - -static void -endtriangulate(void) -{ - DaTa = 0; - gluDeleteTess(tripak); -} - -static void -draw_edges( tel_polygon_holes_data p, Tmatrix3 mat, tel_colour edge_colour, - Tint face_distinguishing_mode, TelCullMode face_culling_mode, - Tint interior_style, Tint back_interior_style ) -{ - CMN_KEY k, k1, k2, k3, k4; - Tint i, j, a, clos; - Tint edge_type, line_type_preserve; - Tfloat edge_width, line_width_preserve; - /* Following pointers have been provided for performance improvement */ - Tint *bounds; - tel_point pv; - - /* OCC11904 -- Temporarily disable environment mapping */ - glPushAttrib(GL_ENABLE_BIT); - glDisable(GL_TEXTURE_1D); - glDisable(GL_TEXTURE_2D); - - - bounds = p->bounds; - pv = p->vertices; - - k.id = TelEdgeFlag; - TsmGetAttri( 1, &k ); - - if( !p->edgevis ) - if( k.data.ldata == TOff ) - { - glPopAttrib(); - return; - } - - k1.id = TelPolylineWidth; - k2.id = TelPolylineType; - k3.id = TelEdgeType; - k4.id = TelEdgeWidth; - - TsmGetAttri( 4, &k1, &k2, &k3, &k4 ); - - line_width_preserve = k1.data.fdata; - line_type_preserve = k2.data.ldata; - edge_type = k3.data.ldata; - edge_width = k4.data.fdata; - - if( p->edgevis == 0 ) - { - if( face_distinguishing_mode == TOff ) - { - if( interior_style == TSM_SOLID || interior_style == TSM_HATCH ) - { - if( line_width_preserve != edge_width ) - { - k.id = TelPolylineWidth; - k.data.fdata = edge_width; - TsmSetAttri( 1, &k ); - } - if( line_type_preserve != edge_type ) - { - k.id = TelPolylineType; - k.data.ldata = edge_type; - TsmSetAttri( 1, &k ); - } - - glColor3fv( edge_colour->rgb ); - if( face_culling_mode == TelCullBack ) - { - for( i = 0, a = 0; i < p->num_bounds; i++ ) - { - glBegin(GL_LINE_STRIP); - for( clos=a, j = 0; j < bounds[i]; j++ ) - { - glVertex3fv( pv[ a++ ].xyz ); - } - glVertex3fv( pv[ clos ].xyz ); - glEnd(); - } - } - else if( face_culling_mode == TelCullFront ) - { - for( i = 0, a = 0; i < p->num_bounds; i++ ) - { - glBegin(GL_LINE_STRIP); - for( clos=a, j = 0; j < bounds[i]; j++ ) - { - glVertex3fv( pv[ a++ ].xyz ); - } - glVertex3fv( pv[ clos ].xyz ); - glEnd(); - } - } - else - { - for( i = 0, a = 0; i < p->num_bounds; i++ ) - { - glBegin(GL_LINE_STRIP); - for( clos=a, j = 0; j < bounds[i]; j++ ) - { - glVertex3fv( pv[ a++ ].xyz ); - } - glVertex3fv( pv[ clos ].xyz ); - glEnd(); - } - } - if( line_width_preserve != edge_width ) - { - k.id = TelPolylineWidth; - k.data.fdata = line_width_preserve; - TsmSetAttri( 1, &k ); - } - if( line_type_preserve != edge_type ) - { - k.id = TelPolylineType; - k.data.ldata = line_type_preserve; - TsmSetAttri( 1, &k ); - } - } - } - else - { - if( ( interior_style == TSM_SOLID || - interior_style == TSM_HATCH ) || - ( back_interior_style == TSM_SOLID || - back_interior_style == TSM_HATCH ) ) - { - if( face_culling_mode == TelCullBack ) - { - if( interior_style == TSM_SOLID || interior_style == TSM_HATCH ) - { - if( line_width_preserve != edge_width ) - { - k.id = TelPolylineWidth; - k.data.fdata = edge_width; - TsmSetAttri( 1, &k ); - } - if( line_type_preserve != edge_type ) - { - k.id = TelPolylineType; - k.data.ldata = edge_type; - TsmSetAttri( 1, &k ); - } - glColor3fv( edge_colour->rgb ); - for( i = 0, a = 0; i < p->num_bounds; i++ ) - { - glBegin(GL_LINE_STRIP); - for( clos=a, j = 0; j < bounds[i]; j++ ) - { - glVertex3fv( pv[ a++ ].xyz ); - } - glVertex3fv( pv[ clos ].xyz ); - glEnd(); - } - if( line_width_preserve != edge_width ) - { - k.id = TelPolylineWidth; - k.data.fdata = line_width_preserve; - TsmSetAttri( 1, &k ); - } - if( line_type_preserve != edge_type ) - { - k.id = TelPolylineType; - k.data.ldata = line_type_preserve; - TsmSetAttri( 1, &k ); - } - } - } - else if( face_culling_mode == TelCullFront ) - { - if( back_interior_style == TSM_SOLID || - back_interior_style == TSM_HATCH ) - { - if( line_width_preserve != edge_width ) - { - k.id = TelPolylineWidth; - k.data.fdata = edge_width; - TsmSetAttri( 1, &k ); - } - if( line_type_preserve != edge_type ) - { - k.id = TelPolylineType; - k.data.ldata = edge_type; - TsmSetAttri( 1, &k ); - } - glColor3fv( edge_colour->rgb ); - for( i = 0, a = 0; i < p->num_bounds; i++ ) - { - glBegin(GL_LINE_STRIP); - for( clos=a, j = 0; j < bounds[i]; j++ ) - { - glVertex3fv( pv[ a++ ].xyz ); - } - glVertex3fv( pv[ clos ].xyz ); - glEnd(); - } - if( line_width_preserve != edge_width ) - { - k.id = TelPolylineWidth; - k.data.fdata = line_width_preserve; - TsmSetAttri( 1, &k ); - } - if( line_type_preserve != edge_type ) - { - k.id = TelPolylineType; - k.data.ldata = line_type_preserve; - TsmSetAttri( 1, &k ); - } - } - } - else - { - if( line_width_preserve != edge_width ) - { - k.id = TelPolylineWidth; - k.data.fdata = edge_width; - TsmSetAttri( 1, &k ); - } - if( line_type_preserve != edge_type ) - { - k.id = TelPolylineType; - k.data.ldata = edge_type; - TsmSetAttri( 1, &k ); - } - glColor3fv( edge_colour->rgb ); - for( i = 0, a = 0; i < p->num_bounds; i++ ) - { - glBegin(GL_LINE_STRIP); - for( clos=a, j = 0; j < bounds[i]; j++ ) - { - glVertex3fv( pv[ a++ ].xyz ); - } - glVertex3fv( pv[ clos ].xyz ); - glEnd(); - } - if( line_width_preserve != edge_width ) - { - k.id = TelPolylineWidth; - k.data.fdata = line_width_preserve; - TsmSetAttri( 1, &k ); - } - if( line_type_preserve != edge_type ) - { - k.id = TelPolylineType; - k.data.ldata = line_type_preserve; - TsmSetAttri( 1, &k ); - } - } - } - } - } - else - { - if( face_distinguishing_mode == TOff ) - { - if( interior_style == TSM_SOLID || interior_style == TSM_HATCH ) - { - if( line_width_preserve != edge_width ) - { - k.id = TelPolylineWidth; - k.data.fdata = edge_width; - TsmSetAttri( 1, &k ); - } - if( line_type_preserve != edge_type ) - { - k.id = TelPolylineType; - k.data.ldata = edge_type; - TsmSetAttri( 1, &k ); - } - - glColor3fv( edge_colour->rgb ); - if( face_culling_mode == TelCullBack ) - { - glBegin(GL_LINES); - for( i = 0, j = 0; i < p->num_bounds; i++ ) - { - for( a = 0; a < bounds[i]-1; a++ ) - { - if( p->edgevis[j+a] ) - { - glVertex3fv( pv[j+a].xyz ); - glVertex3fv( pv[j+a+1].xyz ); - } - } - if( p->edgevis[j+a] ) - { - glVertex3fv( pv[j+a].xyz ); - glVertex3fv( pv[j].xyz ); - } - j += p->bounds[i]; - } - glEnd(); - } - else if( face_culling_mode == TelCullFront ) - { - glBegin(GL_LINES); - for( i = 0, j = 0; i < p->num_bounds; i++ ) - { - for( a = 0; a < bounds[i]-1; a++ ) - { - if( p->edgevis[j+a] ) - { - glVertex3fv( pv[j+a].xyz ); - glVertex3fv( pv[j+a+1].xyz ); - } - } - if( p->edgevis[j+a] ) - { - glVertex3fv( pv[j+a].xyz ); - glVertex3fv( pv[j].xyz ); - } - j += p->bounds[i]; - } - glEnd(); - } - else - { - glBegin(GL_LINES); - for( i = 0, j = 0; i < p->num_bounds; i++ ) - { - for( a = 0; a < bounds[i]-1; a++ ) - { - if( p->edgevis[j+a] ) - { - glVertex3fv( pv[j+a].xyz ); - glVertex3fv( pv[j+a+1].xyz ); - } - } - if( p->edgevis[j+a] ) - { - glVertex3fv( pv[j+a].xyz ); - glVertex3fv( pv[j].xyz ); - } - j += p->bounds[i]; - } - glEnd(); - } - if( line_width_preserve != edge_width ) - { - k.id = TelPolylineWidth; - k.data.fdata = line_width_preserve; - TsmSetAttri( 1, &k ); - } - if( line_type_preserve != edge_type ) - { - k.id = TelPolylineType; - k.data.ldata = line_type_preserve; - TsmSetAttri( 1, &k ); - } - } - } - else - { - if( ( interior_style == TSM_SOLID || - interior_style == TSM_HATCH ) || - ( back_interior_style == TSM_SOLID || - back_interior_style == TSM_HATCH ) ) - { - if( face_culling_mode == TelCullBack ) - { - if( interior_style == TSM_SOLID || interior_style == TSM_HATCH ) - { - if( line_width_preserve != edge_width ) - { - k.id = TelPolylineWidth; - k.data.fdata = edge_width; - TsmSetAttri( 1, &k ); - } - if( line_type_preserve != edge_type ) - { - k.id = TelPolylineType; - k.data.ldata = edge_type; - TsmSetAttri( 1, &k ); - } - glColor3fv( edge_colour->rgb ); - glBegin(GL_LINES); - for( i = 0, j = 0; i < p->num_bounds; i++ ) - { - for( a = 0; a < bounds[i]-1; a++ ) - { - if( p->edgevis[j+a] ) - { - glVertex3fv( pv[j+a].xyz ); - glVertex3fv( pv[j+a+1].xyz ); - } - } - if( p->edgevis[j+a] ) - { - glVertex3fv( pv[j+a].xyz ); - glVertex3fv( pv[j].xyz ); - } - j += p->bounds[i]; - } - glEnd(); - if( line_width_preserve != edge_width ) - { - k.id = TelPolylineWidth; - k.data.fdata = line_width_preserve; - TsmSetAttri( 1, &k ); - } - if( line_type_preserve != edge_type ) - { - k.id = TelPolylineType; - k.data.ldata = line_type_preserve; - TsmSetAttri( 1, &k ); - } - } - } - else if( face_culling_mode == TelCullFront ) - { - if( back_interior_style == TSM_SOLID || - back_interior_style == TSM_HATCH ) - { - if( line_width_preserve != edge_width ) - { - k.id = TelPolylineWidth; - k.data.fdata = edge_width; - TsmSetAttri( 1, &k ); - } - if( line_type_preserve != edge_type ) - { - k.id = TelPolylineType; - k.data.ldata = edge_type; - TsmSetAttri( 1, &k ); - } - glColor3fv( edge_colour->rgb ); - glBegin(GL_LINES); - for( i = 0, j = 0; i < p->num_bounds; i++ ) - { - for( a = 0; a < bounds[i]-1; a++ ) - { - if( p->edgevis[j+a] ) - { - glVertex3fv( pv[j+a].xyz ); - glVertex3fv( pv[j+a+1].xyz ); - } - } - if( p->edgevis[j+a] ) - { - glVertex3fv( pv[j+a].xyz ); - glVertex3fv( pv[j].xyz ); - } - j += p->bounds[i]; - } - glEnd(); - if( line_width_preserve != edge_width ) - { - k.id = TelPolylineWidth; - k.data.fdata = line_width_preserve; - TsmSetAttri( 1, &k ); - } - if( line_type_preserve != edge_type ) - { - k.id = TelPolylineType; - k.data.ldata = line_type_preserve; - TsmSetAttri( 1, &k ); - } - } - } - else - { - if( line_width_preserve != edge_width ) - { - k.id = TelPolylineWidth; - k.data.fdata = edge_width; - TsmSetAttri( 1, &k ); - } - if( line_type_preserve != edge_type ) - { - k.id = TelPolylineType; - k.data.ldata = edge_type; - TsmSetAttri( 1, &k ); - } - glColor3fv( edge_colour->rgb ); - for( i = 0, j = 0; i < p->num_bounds; i++ ) - { - glBegin(GL_LINES); - for( a = 0; a < bounds[i]-1; a++ ) - { - if( p->edgevis[j+a] ) - { - glVertex3fv( pv[j+a].xyz ); - glVertex3fv( pv[j+a+1].xyz ); - } - } - if( p->edgevis[j+a] ) - { - glVertex3fv( pv[j+a].xyz ); - glVertex3fv( pv[j].xyz ); - } - glEnd(); - j += p->bounds[i]; - } - - if( line_width_preserve != edge_width ) - { - k.id = TelPolylineWidth; - k.data.fdata = line_width_preserve; - TsmSetAttri( 1, &k ); - } - if( line_type_preserve != edge_type ) - { - k.id = TelPolylineType; - k.data.ldata = line_type_preserve; - TsmSetAttri( 1, &k ); - } - } - } - } - } - glPopAttrib(); -} diff --git a/src/OpenGl/OpenGl_polygonoffset.cxx b/src/OpenGl/OpenGl_polygonoffset.cxx deleted file mode 100755 index 26e21f2137..0000000000 --- a/src/OpenGl/OpenGl_polygonoffset.cxx +++ /dev/null @@ -1,94 +0,0 @@ -/* -Created : 22-03-04 : SAN : OCC4895 High-level interface for controlling polygon offsets -*/ - -#include - -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -static TStatus PolygonOffsetDisplay( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus PolygonOffsetAdd( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus PolygonOffsetDelete( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus PolygonOffsetPrint( TSM_ELEM_DATA, Tint, cmn_key* ); - -static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) = -{ - 0, /* PickTraverse */ - PolygonOffsetDisplay, - PolygonOffsetAdd, - PolygonOffsetDelete, - PolygonOffsetPrint, - 0 /* Inquire */ -}; - - -MtblPtr -TelPolygonOffsetInitClass( TelType *el ) -{ - *el = TelPolygonOffset; - return MtdTbl; -} - -static TStatus -PolygonOffsetAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k ) -{ - tel_poffset_param data = new TEL_POFFSET_PARAM(); - - if( !data ) - return TFailure; - - *data = *(tel_poffset_param)(k[0]->data.pdata); - - ((tsm_elem_data)(d.pdata))->pdata = data; - - return TSuccess; -} - - -static TStatus -PolygonOffsetDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - tel_poffset_param d; - CMN_KEY key; - - d = (tel_poffset_param)data.pdata; - - key.id = TelPolygonOffset; - key.data.pdata = d; - TsmSetAttri( 1, &key ); - - return TSuccess; -} - - -static TStatus -PolygonOffsetDelete( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - if (data.pdata) - delete data.pdata; - return TSuccess; -} - - -static TStatus -PolygonOffsetPrint( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - tel_poffset_param p; - p = (tel_poffset_param)data.pdata; - - fprintf( stdout, "TelPolygonOffset. Mode = %x, Factor = %f, Units = %f\n", - p->mode, p->factor, p->units); - fprintf( stdout, "\n" ); - - return TSuccess; -} - diff --git a/src/OpenGl/OpenGl_polyl.cxx b/src/OpenGl/OpenGl_polyl.cxx deleted file mode 100755 index 5787ae7b1d..0000000000 --- a/src/OpenGl/OpenGl_polyl.cxx +++ /dev/null @@ -1,364 +0,0 @@ -/*********************************************************************** - -FONCTION : ----------- -File OpenGl_polyl : - - -REMARQUES: ----------- - - -HISTORIQUE DES MODIFICATIONS : --------------------------------- -xx-xx-xx : xxx ; Creation. -21-10-96 : FMN ; Suppression LMC_COLOR fait dans OpenGl_execstruct.c - -************************************************************************/ - -#define G003 /* EUG 07-10-99 Degeneration mode support -*/ - -#define IMP190602 /* GG Avoid memory leaks after creating a polyline -// with vertex colors primitive. -// Thanks to Ivan Fontaine (SAMTECH) for this improvment -*/ - -/*----------------------------------------------------------------------*/ -/* -* Includes -*/ - -#include - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#ifdef G003 -extern int g_nDegenerateModel; -#endif /* G003 */ - -static TStatus PolylineDisplay( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus PolylineAdd( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus PolylineDelete( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus PolylinePrint( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus PolylineInquire( TSM_ELEM_DATA, Tint, cmn_key* ); - -/*static GLboolean lighting_mode;*/ - -static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) = -{ - PolylineDisplay, - PolylineDisplay, - PolylineAdd, - PolylineDelete, - PolylinePrint, - PolylineInquire -}; - -struct TEL_LINE_DATA -{ - Tint num_lines; /* Number of polylines */ - Tint num_vertices; /* Number of vertices in vertices array */ - Tint *bounds; /* Array of number of points in each polyline */ - tel_colour vcolours; /* vertex colour values for each vertex */ - tel_point vertices; /* vertices array of length num_vertices */ - IMPLEMENT_MEMORY_OPERATORS -}; -typedef TEL_LINE_DATA* tel_line_data; - -MtblPtr -TelPolylineInitClass( TelType* el ) -{ - *el = TelPolyline; - return MtdTbl; -} - -static TStatus -PolylineAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k ) - -{ - Tint i, j; - tel_line_data p; - - for( i = 0; i < n; i++ ) - { - if( k[i]->id == NUM_LINES_ID ) - break; - } - - if( i == n ) - return TFailure; - - if( !(k[i]->data.ldata) ) - return TFailure; - - for( j = 0; j < n; j++ ) - { - if( k[j]->id == BOUNDS_DATA_ID ) - break; - } - - if( j == n ) - return TFailure; - - p = new TEL_LINE_DATA(); - p->num_lines = k[i]->data.ldata; - p->bounds = new Tint[p->num_lines]; - memcpy( p->bounds, k[j]->data.pdata, p->num_lines*sizeof(Tint) ); - - p->num_vertices = 0; - for( i = 0; i < p->num_lines; i++ ) - { - p->num_vertices += p->bounds[i]; - } - - for( i = 0; i < n; i++ ) - { - switch( k[i]->id ) - { - case VERTEX_COLOUR_VALS_ID: - p->vcolours = new TEL_COLOUR[p->num_vertices]; - memcpy( p->vcolours, k[i]->data.pdata, p->num_vertices*sizeof(TEL_COLOUR) ); - break; - - case VERTICES_ID: - p->vertices = new TEL_POINT[p->num_vertices]; - memcpy( p->vertices, k[i]->data.pdata, p->num_vertices*sizeof(TEL_POINT) ); - break; - } - } - - ((tsm_elem_data)(d.pdata))->pdata = p; - - return TSuccess; -} - - -static TStatus -PolylineDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - tel_line_data d; - Tint i, j, a; - CMN_KEY key; - TEL_COLOUR colour; - - d = (tel_line_data)data.pdata; - - /* OCC11904 -- Temporarily disable environment mapping */ - glPushAttrib(GL_ENABLE_BIT); - glDisable(GL_TEXTURE_1D); - glDisable(GL_TEXTURE_2D); - - if( k[0]->id == TOn ) - { /* Use highlight colours */ - TEL_HIGHLIGHT hrep; - - key.id = TelHighlightIndex; - TsmGetAttri( 1, &key ); - if( TelGetHighlightRep( TglActiveWs, key.data.ldata, &hrep ) - == TSuccess ) - colour = hrep.col; - else - { - TelGetHighlightRep( TglActiveWs, 0, &hrep ); - colour = hrep.col; - } - } - else - { - key.id = TelPolylineColour; - key.data.pdata = &colour; - TsmGetAttri( 1, &key ); - } - - if( !d->vcolours ) - { - glColor3fv( colour.rgb ); - for( i = 0, j = 0, a = 0; i < d->num_lines; i++ ) - { - a = j + d->bounds[i]; -#ifdef G003 - glBegin ( g_nDegenerateModel != 3 ? GL_LINE_STRIP : GL_POINTS ); -#else - glBegin(GL_LINE_STRIP); -#endif /* G003 */ - for( ; j < a; j++ ) - glVertex3fv( d->vertices[j].xyz ); - glEnd(); - } - } - else - { - for( i = 0, j = 0, a = 0; i < d->num_lines; i++ ) - { - a = j + d->bounds[i]; -#ifdef G003 - glBegin ( g_nDegenerateModel != 3 ? GL_LINE_STRIP : GL_POINTS ); -#else - glBegin(GL_LINE_STRIP); -#endif /* G003 */ - for( ; j < a; j++ ) - { - glColor3fv( d->vcolours[j].rgb ); - glVertex3fv( d->vertices[j].xyz ); - } - glEnd(); - } - - } - - glPopAttrib(); - return TSuccess; -} - - -static TStatus -PolylineDelete( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - tel_line_data p = (tel_line_data)data.pdata; - if( p->bounds ) - delete[] p->bounds; - if( p->vertices ) - delete[] p->vertices; -#ifdef IMP190602 - if( p->vcolours ) - delete[] p->vcolours; -#endif - if (data.pdata) - delete data.pdata; - - return TSuccess; -} - - - - -static TStatus -PolylinePrint( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - Tint i; - tel_line_data p = (tel_line_data)data.pdata; - - fprintf( stdout, "TelPolyline. Number of Lines: %d\n", p->num_lines ); - - if( p->vcolours ) - fprintf( stdout, "\t\tVertex Flag : COLOUR\n" ); - else - fprintf( stdout, "\t\tVertex Flag : NONE\n" ); - - if( p->bounds ) - { - fprintf( stdout, "\t\tLengths array :\n" ); - for( i = 0; i < p->num_lines; i++ ) - fprintf( stdout, "\t\tL[%d] %d \n", i, p->bounds[i] ); - } - - if( p->vertices ) - { - fprintf( stdout, "\n\t\tVertices : " ); - for( i = 0; i < p->num_vertices; i++ ) - fprintf( stdout, "\n\t\t v[%d] = %g %g %g", i, - p->vertices[i].xyz[0], - p->vertices[i].xyz[1], - p->vertices[i].xyz[2] ); } - - fprintf( stdout, "\n" ); - - if( p->vcolours ) - { - fprintf( stdout, "\n\t\tVertex Colours : " ); - for( i = 0; i < p->num_vertices; i++ ) - fprintf( stdout, "\n\t\t v[%d] = %g %g %g", i, - p->vcolours[i].rgb[0], - p->vcolours[i].rgb[1], - p->vcolours[i].rgb[2] ); } - else - fprintf( stdout, "\n\t\tVertex Colours not specified\n" ); - - fprintf( stdout, "\n" ); - - return TSuccess; -} - -static TStatus -PolylineInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - Tint i; - tel_line_data d; - Tint size_reqd=0; - TStatus status = TSuccess; - - d = (tel_line_data)data.pdata; - - size_reqd = d->num_lines * sizeof( Tint ); - size_reqd += ( d->num_vertices * sizeof( TEL_POINT ) ); - if( d->vcolours ) - { - size_reqd += ( d->num_vertices * sizeof( TEL_COLOUR ) ); - } - - for( i = 0; i < n; i++ ) - { - switch( k[i]->id ) - { - case INQ_GET_SIZE_ID: - { - k[i]->data.ldata = size_reqd; - break; - } - - case INQ_GET_CONTENT_ID: - { - TEL_INQ_CONTENT *c; - Teldata *w; - - c = (tel_inq_content)k[i]->data.pdata; - c->act_size = size_reqd; - w = c->data; - w->lineset3data.num_bounds = d->num_lines; - - if( d->vcolours ) - w->lineset3data.vrtflag = TEL_VTFLAG_COLOUR; - else - w->lineset3data.vrtflag = TEL_VTFLAG_NONE; - - if( c->size >= size_reqd ) - { - w->lineset3data.bounds = (Tint *)(c->buf); - memcpy( w->lineset3data.bounds, d->bounds, d->num_lines*sizeof(Tint) ); - - w->lineset3data.points = - (tel_point)(c->buf + d->num_lines * sizeof( Tint ) ); - - memcpy( w->lineset3data.points, d->vertices, d->num_vertices*sizeof(TEL_POINT) ); - if( d->vcolours ) - { - w->lineset3data.colours = (tel_colour)( c->buf + - d->num_lines * sizeof( Tint ) + - d->num_vertices * sizeof( TEL_POINT )); - memcpy( w->lineset3data.colours, d->vcolours, d->num_vertices*sizeof(TEL_COLOUR) ); - } - else - w->lineset3data.colours = 0; - - status = TSuccess; - } - else - status = TFailure; - break; - } - } - } - return status; -} diff --git a/src/OpenGl/OpenGl_polylcol.cxx b/src/OpenGl/OpenGl_polylcol.cxx deleted file mode 100755 index 5606fd0a75..0000000000 --- a/src/OpenGl/OpenGl_polylcol.cxx +++ /dev/null @@ -1,129 +0,0 @@ - -#include - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -static TStatus PolylineColourDisplay( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus PolylineColourAdd( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus PolylineColourDelete( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus PolylineColourPrint( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus PolylineColourInquire( TSM_ELEM_DATA, Tint, cmn_key* ); - -static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) = -{ - 0, /* PickTraverse */ - PolylineColourDisplay, - PolylineColourAdd, - PolylineColourDelete, - PolylineColourPrint, - PolylineColourInquire -}; - - -MtblPtr -TelPolylineColourInitClass( TelType *el ) -{ - *el = TelPolylineColour; - return MtdTbl; -} - -static TStatus -PolylineColourAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k ) -{ - tel_colour data = new TEL_COLOUR(); - if( !data ) - return TFailure; - - *data = *(tel_colour)(k[0]->data.pdata); - - ((tsm_elem_data)(d.pdata))->pdata = data; - - return TSuccess; -} - - -static TStatus -PolylineColourDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - tel_colour d; - CMN_KEY key; - - d = (tel_colour)data.pdata; - - key.id = TelPolylineColour; - key.data.pdata = d; - TsmSetAttri( 1, &key ); - - return TSuccess; -} - - -static TStatus -PolylineColourDelete( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - if (data.pdata) - delete data.pdata; - return TSuccess; -} - - - - -static TStatus -PolylineColourPrint( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - tel_colour p; - - p = (tel_colour)data.pdata; - - fprintf( stdout, "TelPolylineColour. R = %g, G = %g, B = %g\n", - p->rgb[0], p->rgb[1], p->rgb[2] ); - fprintf( stdout, "\n" ); - - return TSuccess; -} - - -static TStatus -PolylineColourInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - Tint i; - tel_colour col; - - col = (tel_colour)data.pdata; - - for( i = 0; i < n; i++ ) - { - switch( k[i]->id ) - { - case INQ_GET_SIZE_ID: - { - k[i]->data.ldata = sizeof( Tint ); - break; - } - case INQ_GET_CONTENT_ID: - { - TEL_INQ_CONTENT *c; - Teldata *w; - - c = (tel_inq_content)k[i]->data.pdata; - w = c->data; - c->act_size = 0; - w->gnl_colour = *col; - break; - } - } - } - - return TSuccess; -} diff --git a/src/OpenGl/OpenGl_polyltyp.cxx b/src/OpenGl/OpenGl_polyltyp.cxx deleted file mode 100755 index 576907ce58..0000000000 --- a/src/OpenGl/OpenGl_polyltyp.cxx +++ /dev/null @@ -1,121 +0,0 @@ - -#include - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -static TStatus PolylineTypeDisplay( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus PolylineTypeAdd( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus PolylineTypePrint( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus PolylineTypeInquire( TSM_ELEM_DATA, Tint, cmn_key* ); - -static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) = -{ - 0, /* PickTraverse */ - PolylineTypeDisplay, - PolylineTypeAdd, - 0, /* Delete */ - PolylineTypePrint, - PolylineTypeInquire -}; - - -MtblPtr -TelPolylineTypeInitClass( TelType *el ) -{ - *el = TelPolylineType; - return MtdTbl; -} - -static TStatus -PolylineTypeAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k ) -{ - ((tsm_elem_data)(d.pdata))->ldata = k[0]->data.ldata; - - return TSuccess; -} - - -static TStatus -PolylineTypeDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - CMN_KEY key; - - key.id = TelPolylineType; - key.data.ldata = data.ldata; - TsmSetAttri( 1, &key ); - - return TSuccess; -} - - -static TStatus -PolylineTypePrint( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - switch( data.ldata ) - { - case TEL_LS_SOLID: - fprintf( stdout, "TelPolylineType. Value = SOLID\n" ); - break; - - case TEL_LS_DOT: - fprintf( stdout, "TelPolylineType. Value = DOT\n" ); - break; - - case TEL_LS_DASH_DOT: - fprintf( stdout, "TelPolylineType. Value = DASH_DOT\n" ); - break; - - case TEL_LS_DASH: - fprintf( stdout, "TelPolylineType. Value = DASH\n" ); - break; - - case TEL_LS_DOUBLE_DOT_DASH: - fprintf( stdout, "TelPolylineType. Value = DOUBLE_DOT_DASH\n" ); - break; - } - fprintf( stdout, "\n" ); - - return TSuccess; -} - - -static TStatus -PolylineTypeInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - Tint i; - - for( i = 0; i < n; i++ ) - { - switch( k[i]->id ) - { - case INQ_GET_SIZE_ID: - { - k[i]->data.ldata = sizeof( Tint ); - break; - } - case INQ_GET_CONTENT_ID: - { - TEL_INQ_CONTENT *c; - Teldata *w; - - c = (tel_inq_content)k[i]->data.pdata; - w = c->data; - c->act_size = 0; - w->idata = data.ldata; - break; - } - } - } - - return TSuccess; -} diff --git a/src/OpenGl/OpenGl_polylwid.cxx b/src/OpenGl/OpenGl_polylwid.cxx deleted file mode 100755 index eb278ead7d..0000000000 --- a/src/OpenGl/OpenGl_polylwid.cxx +++ /dev/null @@ -1,118 +0,0 @@ - -#include - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -static TStatus PolylineWidthDisplay( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus PolylineWidthAdd( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus PolylineWidthDelete( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus PolylineWidthPrint( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus PolylineWidthInquire( TSM_ELEM_DATA, Tint, cmn_key* ); - -static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) = -{ - 0, /* PickTraverse */ - PolylineWidthDisplay, - PolylineWidthAdd, - PolylineWidthDelete, - PolylineWidthPrint, - PolylineWidthInquire -}; - - -MtblPtr -TelPolylineWidthInitClass( TelType *el ) -{ - *el = TelPolylineWidth; - return MtdTbl; -} - -static TStatus -PolylineWidthAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k ) -{ - Tfloat *data = new Tfloat(); - - if( !data ) - return TFailure; - - *data = k[0]->data.fdata; - - ((tsm_elem_data)(d.pdata))->pdata = data; - - return TSuccess; -} - - -static TStatus -PolylineWidthDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - CMN_KEY key; - - key.id = TelPolylineWidth; - key.data.fdata = *(Tfloat*)(data.pdata); - TsmSetAttri( 1, &key ); - - return TSuccess; -} - - -static TStatus -PolylineWidthDelete( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - if (data.pdata) - delete data.pdata; - return TSuccess; -} - - -static TStatus -PolylineWidthPrint( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - fprintf( stdout, "TelPolylineWidth. Value = %g\n", *(Tfloat *)(data.pdata)); - fprintf( stdout, "\n" ); - - return TSuccess; -} - - -static TStatus -PolylineWidthInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - Tint i; - Tfloat *f = (Tfloat *)data.pdata; - - for( i = 0; i < n; i++ ) - { - switch( k[i]->id ) - { - case INQ_GET_SIZE_ID: - { - k[i]->data.ldata = sizeof( Tint ); - break; - } - case INQ_GET_CONTENT_ID: - { - TEL_INQ_CONTENT *c; - Teldata *w; - - c = (tel_inq_content)k[i]->data.pdata; - w = c->data; - c->act_size = 0; - w->fdata = *f; - break; - } - } - } - - return TSuccess; -} diff --git a/src/OpenGl/OpenGl_qstrip.cxx b/src/OpenGl/OpenGl_qstrip.cxx deleted file mode 100755 index b2ac5f5018..0000000000 --- a/src/OpenGl/OpenGl_qstrip.cxx +++ /dev/null @@ -1,1426 +0,0 @@ -#define G003 -#define G004 -/*********************************************************************** - -FONCTION : ----------- -File OpenGl_qstrip : - - -REMARQUES: ----------- - - -HISTORIQUE DES MODIFICATIONS : --------------------------------- -xx-xx-xx : xxx ; Creation. -11-03-96 : FMN ; Correction warning compilation -01-04-96 : CAL ; Integration MINSK portage WNT -22-04-96 : FMN ; Suppression prototype inutile. -09-08-96 : FMN ; Suppression appel glMatrixMode() avant glGetFloatv() -21-10-96 : FMN ; Suppression LMC_COLOR fait dans OpenGl_execstruct.c -30-06-97 : FMN ; Suppression OpenGl_telem_light.h -18-07-97 : FMN ; Ajout desactivation des lights suivant front_lighting_model -21-07-97 : FMN ; Amelioration des performances OPTIMISATION_FMN -- suppression calcul inutile sur les front faces -27-08-97 : FMN ; Correction affichage des edges -On n'affiche que les edges dans le mode IS_EMPTY -10-09-97 : FMN ; Amelioration des perfs liees aux lights. -15-09-97 : PCT ; Ajout coordonnees textures -24-09-97 : FMN ; Suppression OPTIMISATION_FMN. -08-12-97 : FMN ; Suppression appel TsmGetAttri inutile. -31-12-97 : FMN ; Simplification pour le highlight -15-01-98 : FMN ; Ajout Hidden line -17-02-00 : EUG ; Degeneration support -17-02-00 : EUG ; Bitmap drawing support -08-03-01 : GG ; BUC60823 Avoid crash in the normal computation method -on confuse point. - -************************************************************************/ - -#define BUC60876 /* GG 5/4/2001 Disable local display list -// when animation is not required -*/ - -/*----------------------------------------------------------------------*/ -/* -* Includes -*/ - - -#include - -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/*----------------------------------------------------------------------*/ -/* -* Constantes -*/ - -/*----------------------------------------------------------------------*/ -/* -* Variables externes -*/ - -extern Tint ForbidSetTextureMapping; /* currently defined in tsm/tsm.c */ - -#ifdef G003 -# include -# define DEF_DS_INTERNAL -# include - -# ifdef G004 -extern GLboolean g_fBitmap; -# endif /* G004 */ - -# define OPENGL_RAND() ( ( unsigned )( s_Rand = s_Rand * 214013L + 2531011L )) - -extern int g_nDegenerateModel; -extern float g_fSkipRatio; -extern GLboolean g_fAnimation; - -#endif /* G003 */ - -/*----------------------------------------------------------------------*/ - -struct TEL_QSTRIP_DATA -{ - Tint shape_flag; /* TEL_SHAPE_UNKNOWN or TEL_SHAPE_COMPLEX or - TEL_SHAPE_CONVEX or TEL_SHAPE_CONCAVE */ - Tint facet_flag; /* TEL_FA_NONE or TEL_FA_NORMAL */ - Tint vertex_flag; /* TEL_VT_NONE or TEL_VT_NORMAL */ - Tint num_rows, - num_columns; /* Number of rows and columns */ - tel_point fnormals; /* Facet normals */ - tel_colour fcolours; /* Facet colours */ - tel_point vertices; /* Vertices */ - tel_colour vcolours; /* Vertex colour values */ - tel_point vnormals; /* Vertex normals */ - tel_texture_coord vtexturecoord; /* Texture coordinates */ -#ifdef G003 - DS_INTERNAL d; -#endif /* G003 */ - IMPLEMENT_MEMORY_OPERATORS -}; -typedef TEL_QSTRIP_DATA* tel_qstrip_data; - -static TStatus QuadrangleDisplay( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus QuadrangleAdd( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus QuadrangleDelete( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus QuadranglePrint( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus QuadrangleInquire( TSM_ELEM_DATA, Tint, cmn_key* ); - -static void -draw_qstrip( tel_qstrip_data, - Tint, /* highlight flag */ - Tint, /* front_lighting_model, */ - Tint, /* interior_style, */ - tel_colour /* edge_colour, */ - ); - -#ifdef G003 -static void draw_edges ( tel_qstrip_data, tel_colour, Tint, Tint ); -extern void draw_degenerates_as_points ( PDS_INTERNAL, tel_point, Tint ); -extern void draw_degenerates_as_bboxs ( PDS_INTERNAL, tel_point, Tint ); -extern void set_drawable_items ( GLboolean*, int ); -#else -static void draw_edges ( tel_qstrip_data, tel_colour, Tint ); -#endif /* G003 */ - -static void draw_line_strip ( tel_qstrip_data, tel_colour, Tint, Tint ); - -static TEL_QSTRIP_DATA qstrip_defaults = { - - TEL_SHAPE_UNKNOWN, /* shape_flag */ - TEL_FA_NONE, /* facet_flag */ - TEL_VT_NONE /* vertex_flag */ - -}; - -static TStatus ( *MtdTbl[] ) ( TSM_ELEM_DATA, Tint, cmn_key* ) = { - - QuadrangleDisplay, /* PickTraverse */ - QuadrangleDisplay, - QuadrangleAdd, - QuadrangleDelete, - QuadranglePrint, - QuadrangleInquire - -}; - -/*----------------------------------------------------------------------*/ - -MtblPtr TelQuadrangleInitClass ( TelType* el ) { - - *el = TelQuadrangle; - - return MtdTbl; - -} /* end TelQuadrangleInitClass */ - -static TStatus -QuadrangleAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k ) - -{ - Tint i, j; - Tint nf, nv; - tel_qstrip_data data; - - for( i = 0; i < n; i++ ) - { - if( k[i]->id == NUM_ROWS_ID ) - break; - } - if( i == n ) - return TFailure; - - if( !(k[i]->data.ldata) ) - return TFailure; - - for( j = 0; j < n; j++ ) - { - if( k[j]->id == NUM_COLUMNS_ID ) - break; - } - if( j == n ) - return TFailure; - - if( !(k[j]->data.ldata) ) - return TFailure; - - data = new TEL_QSTRIP_DATA(); - if( !data ) - return TFailure; - - /* load defaults */ - *data = qstrip_defaults; - - data->num_rows = k[i]->data.ldata; - data->num_columns = k[j]->data.ldata; - nf = data->num_rows * data->num_columns; - nv = ( data->num_rows+1 ) * ( data->num_columns+1 ); - - data->vtexturecoord = 0; - - for( i = 0; i < n; i++ ) - { - switch( k[i]->id ) - { - case SHAPE_FLAG_ID: - { - data->shape_flag = k[i]->data.ldata; - break; - } - case FNORMALS_ID: - { - data->facet_flag = TEL_FA_NORMAL; - data->fnormals = new TEL_POINT[nf]; - memcpy( data->fnormals, k[i]->data.pdata, nf*sizeof(TEL_POINT) ); - for( j = 0; j < nf; j++ ) - vecnrm( data->fnormals[j].xyz ); - break; - } - case FACET_COLOUR_VALS_ID: - { - data->fcolours = new TEL_COLOUR[nf]; - memcpy( data->fcolours, k[i]->data.pdata, nf*sizeof(TEL_COLOUR) ); - break; - } - case VERTICES_ID: - { - data->vertices = new TEL_POINT[nv]; - memcpy( data->vertices, k[i]->data.pdata, nv*sizeof(TEL_POINT) ); - break; - } - case VERTEX_COLOUR_VALS_ID: - { - data->vcolours = new TEL_COLOUR[nv]; - memcpy( data->vcolours, k[i]->data.pdata, nv*sizeof(TEL_COLOUR) ); - break; - } - case VNORMALS_ID: - { - data->vertex_flag = TEL_VT_NORMAL; - data->vnormals = new TEL_POINT[nv]; - memcpy( data->vnormals, k[i]->data.pdata, nv*sizeof(TEL_POINT) ); - for( j = 0; j < nv; j++ ) - vecnrm( data->vnormals[j].xyz ); - break; - } - case VTEXTURECOORD_ID: - { - data->vtexturecoord = new TEL_TEXTURE_COORD[nv]; - memcpy( data->vtexturecoord, k[i]->data.pdata, nv*sizeof(TEL_TEXTURE_COORD) ); - break; - } - default: - { - break; - } - } - } - - if( data->facet_flag != TEL_FA_NORMAL ) - { - /* calculate the normals and store */ - data->fnormals = new TEL_POINT[nf]; - for( i = 0; i < nf; i++ ) - { - TEL_POINT p1, p2, p3, p4; - Tint r, c, id; - - r = i/data->num_columns; - c = i%data->num_columns; - - id = r*(data->num_columns+1) + c; - p1 = data->vertices[id]; - p2 = data->vertices[id+data->num_columns+1]; - p3 = data->vertices[id+data->num_columns+2]; - p4 = data->vertices[id+1]; - - p4.xyz[0] -= p2.xyz[0]; - p4.xyz[1] -= p2.xyz[1]; - p4.xyz[2] -= p2.xyz[2]; - - p4.xyz[0] += p1.xyz[0]; - p4.xyz[1] += p1.xyz[1]; - p4.xyz[2] += p1.xyz[2]; - - TelGetNormal( p4.xyz, p1.xyz, p3.xyz, data->fnormals[i].xyz ); - } -#ifndef BUC60823 - for( j = 0; j < nf; j++ ) - vecnrm( data->fnormals[j].xyz ); -#endif - } - if( data->vertex_flag != TEL_VT_NORMAL ) - { - Tint r, c, id; - /* calculate the vertex normals */ - data->vnormals = new TEL_POINT[nv]; - for( i = 0; i < nv; i++ ) - { - if( i == 0 ) - data->vnormals[i] = data->fnormals[i]; - else if( i == (nv-1) ) - data->vnormals[i] = data->fnormals[nf-1]; - else if( i == (nv-data->num_columns-1) ) - data->vnormals[i] = data->fnormals[nf-data->num_columns]; - else if( i == data->num_columns ) - data->vnormals[i] = data->fnormals[i-1]; - else if( i%(data->num_columns+1) == 0 ) - { - r = i/(data->num_columns+1); - data->vnormals[i].xyz[0] = - ( data->fnormals[(r-1)*data->num_columns].xyz[0] + - data->fnormals[r*data->num_columns].xyz[0] ) / ( float )2.0; - data->vnormals[i].xyz[1] = - ( data->fnormals[(r-1)*data->num_columns].xyz[1] + - data->fnormals[r*data->num_columns].xyz[1] ) / ( float )2.0; - data->vnormals[i].xyz[2] = - ( data->fnormals[(r-1)*data->num_columns].xyz[2] + - data->fnormals[r*data->num_columns].xyz[2] ) / ( float )2.0; - } - else if( i <= data->num_columns ) - { - data->vnormals[i].xyz[0] = ( data->fnormals[i-1].xyz[0] + - data->fnormals[i].xyz[0] ) / ( float )2.0; - data->vnormals[i].xyz[1] = ( data->fnormals[i-1].xyz[1] + - data->fnormals[i].xyz[1] ) / ( float )2.0; - data->vnormals[i].xyz[2] = ( data->fnormals[i-1].xyz[2] + - data->fnormals[i].xyz[2] ) / ( float )2.0; - } - else if( i >= (nv-data->num_columns-1 ) ) - { - c = i%(data->num_columns+1); - id = nf-data->num_columns+c; - - data->vnormals[i].xyz[0] = ( data->fnormals[id-1].xyz[0] + - data->fnormals[id].xyz[0] ) / ( float )2.0; - data->vnormals[i].xyz[1] = ( data->fnormals[id-1].xyz[1] + - data->fnormals[id].xyz[1] ) / ( float )2.0; - data->vnormals[i].xyz[2] = ( data->fnormals[id-1].xyz[2] + - data->fnormals[id].xyz[2] ) / ( float )2.0; - } - else if( (i+1)%(data->num_columns+1) == 0 ) - { - r = (i+1)/(data->num_columns+1); - data->vnormals[i].xyz[0] = - ( data->fnormals[(r-1)*data->num_columns-1].xyz[0] + - data->fnormals[r*data->num_columns-1].xyz[0] ) / ( float )2.0; - data->vnormals[i].xyz[1] = - ( data->fnormals[(r-1)*data->num_columns-1].xyz[1] + - data->fnormals[r*data->num_columns-1].xyz[1] ) / ( float )2.0; - data->vnormals[i].xyz[2] = - ( data->fnormals[(r-1)*data->num_columns-1].xyz[2] + - data->fnormals[r*data->num_columns-1].xyz[2] ) / ( float )2.0; - } - else - { - r = i/(data->num_columns+1); - c = i%(data->num_columns+1); - - id = r*data->num_columns+c; - - data->vnormals[i].xyz[0] = - ( data->fnormals[id].xyz[0] + - data->fnormals[id-data->num_columns].xyz[0] + - data->fnormals[id-1].xyz[0] + - data->fnormals[id-data->num_columns-1].xyz[0] ) / ( float )4.0; - data->vnormals[i].xyz[1] = - ( data->fnormals[id].xyz[1] + - data->fnormals[id-data->num_columns].xyz[1] + - data->fnormals[id-1].xyz[1] + - data->fnormals[id-data->num_columns-1].xyz[1] ) / ( float )4.0; - data->vnormals[i].xyz[2] = - ( data->fnormals[id].xyz[2] + - data->fnormals[id-data->num_columns].xyz[2] + - data->fnormals[id-1].xyz[2] + - data->fnormals[id-data->num_columns-1].xyz[2] ) / ( float )4.0; - } - } - } -#ifdef G003 - data -> d.list = 0; - data -> d.dlist = 0; - data -> d.degMode = 0; - data -> d.model = -1; - data -> d.skipRatio = 0.0F; - data->d.bDraw = new unsigned char[nv]; -#endif /* G003 */ - ((tsm_elem_data)(d.pdata))->pdata = data; - - return TSuccess; -} -/*----------------------------------------------------------------------*/ - -static TStatus -QuadrangleDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - CMN_KEY k11, k12, k17, k111, k114; - - Tint front_lighting_model; - Tint interior_style; - TEL_COLOUR interior_colour; - TEL_COLOUR edge_colour; - - tel_qstrip_data d; - - k12.id = TelInteriorReflectanceEquation; - k17.id = TelInteriorStyle; - k111.id = TelInteriorColour; - k111.data.pdata = &interior_colour; - k114.id = TelEdgeColour; - k114.data.pdata = &edge_colour; - - TsmGetAttri( 4, &k12, &k17, &k111, &k114); - - front_lighting_model = k12.data.ldata; - interior_style = k17.data.ldata; - -#ifdef PRINT - printf("QuadrangleDisplay \n"); -#endif - - /* - * Use highlight colours - */ - - if( k[0]->id == TOn ) - { - TEL_HIGHLIGHT hrep; - - k11.id = TelHighlightIndex; - TsmGetAttri( 1, &k11 ); - if( TelGetHighlightRep( TglActiveWs, k11.data.ldata, &hrep ) - == TSuccess ) - { - if( hrep.type == TelHLForcedColour ) - { - edge_colour = interior_colour = hrep.col; - front_lighting_model = CALL_PHIGS_REFL_NONE; - } - else if( hrep.type == TelHLColour ) - { - edge_colour = hrep.col; - k[0]->id = TOff; - } - } - else - { - TelGetHighlightRep( TglActiveWs, 0, &hrep ); - if( hrep.type == TelHLForcedColour ) - { - edge_colour = interior_colour = hrep.col; - front_lighting_model = CALL_PHIGS_REFL_NONE; - } - else if( hrep.type == TelHLColour ) - { - edge_colour = hrep.col; - k[0]->id = TOff; - } - } - } - - d = (tel_qstrip_data)data.pdata; - - glColor3fv( interior_colour.rgb ); - - draw_qstrip( d, - k[0]->id, - front_lighting_model, - interior_style, - &edge_colour ); - - return TSuccess; -} - -/*----------------------------------------------------------------------*/ - -static void draw_qstrip ( - tel_qstrip_data p, - Tint hflag, - Tint front_lighting_model, - Tint interior_style, - tel_colour edge_colour - ) -{ - - Tint i, m, newList = 0; - Tint nf, nv, nr, nc; - Tint lighting_model; - tel_point pv, pfn, pvn; - tel_colour pfc, pvc; - tel_texture_coord pvt; - - pfn = p -> fnormals; - pfc = p -> fcolours; - pv = p -> vertices; - pvc = p -> vcolours; - pvn = p -> vnormals; - pvt = p -> vtexturecoord; - - if ( hflag == TOn ) { - - pvc = 0; - pfc = 0; - - } /* end if */ - -#ifdef G003 - if ( g_nDegenerateModel < 2 && interior_style != TSM_EMPTY ) { -#else - if ( interior_style != TSM_EMPTY ) { -#endif /* G003 */ - if ( front_lighting_model == CALL_PHIGS_REFL_NONE ) - - LightOff (); - - else LightOn (); - - lighting_model = front_lighting_model; - nr = p -> num_rows; - nc = p -> num_columns; - nf = nr * nc; - nv = ( nr + 1 ) * ( nc + 1 ); -#ifdef G003 -#ifdef BUC60876 - if ( !g_fAnimation ) - goto doDraw; /* Disable object display list out of animation */ -#endif -# ifdef G004 - if ( g_fBitmap ) - goto doDraw; /* display lists are NOT shared between */ - /* window's context and bitmap's one */ -# endif /* G004 */ - if ( p -> d.model != front_lighting_model || !p -> d.list || - p -> d.model == -1 || - ( g_nDegenerateModel && p -> d.skipRatio != g_fSkipRatio ) - ) { - - p -> d.skipRatio = g_fSkipRatio; - p -> d.model = front_lighting_model; - p -> d.degMode = g_nDegenerateModel; - - if ( g_fSkipRatio == 0.0 ) { - - if ( !p -> d.list ) p -> d.list = glGenLists ( 1 ); - - glNewList ( p -> d.list, GL_COMPILE_AND_EXECUTE ); - newList = 1; -#endif /* G003 */ -#ifdef G004 -doDraw: -#endif /* G004 */ - if ( lighting_model == CALL_PHIGS_REFL_NONE ) { - - if ( pvc ) { - - for ( m = 0; m < nr; ++m ) { - - glBegin ( GL_QUAD_STRIP ); - glColor3fv ( pvc[ m * ( nc + 1 ) ].rgb ); - glVertex3fv ( pv[ m * ( nc + 1 ) ].xyz ); - glColor3fv ( pvc[ ( m + 1 ) * ( nc + 1 ) ].rgb ); - glVertex3fv ( pv[ ( m + 1 ) * ( nc + 1 ) ].xyz ); - - for ( i = 1; i < nc + 1; ++i ) { - - glColor3fv ( pvc[ i + m * ( nc + 1 ) ].rgb ); - glVertex3fv ( pv[ i + m * ( nc + 1 ) ].xyz ); - glColor3fv ( pvc[ i + ( m + 1 ) * ( nc + 1 ) ].rgb ); - glVertex3fv ( pv[ i + ( m + 1 ) * ( nc + 1 ) ].xyz ); - - } /* end for */ - - glEnd (); - - } /* end for */ - - } else if ( pfc ) { - - glColor3fv ( pfc[ 0 ].rgb ); - - for ( m = 0; m < nr; ++m ) { - - glBegin ( GL_QUAD_STRIP ); - glColor3fv ( pfc[ m * nc ].rgb ); - glVertex3fv ( pv[ m * ( nc + 1 ) ].xyz ); - glVertex3fv ( pv[ ( m + 1 ) * ( nc + 1 ) ].xyz ); - - for ( i = 1; i < nc + 1; ++i ) { - - glVertex3fv ( pv[ i + m * ( nc + 1 ) ].xyz ); - glColor3fv ( pfc[ i - 1 + m * nc ].rgb ); - glVertex3fv ( pv[ i + ( m + 1 ) * ( nc + 1 ) ].xyz ); - - } /* end for */ - - glEnd (); - - } /* end for */ - - } else { - - for ( m = 0; m < nr; ++m ) { - - glBegin ( GL_QUAD_STRIP ); - glVertex3fv ( pv[ m * ( nc + 1 ) ].xyz ); - glVertex3fv ( pv[ ( m + 1 ) * ( nc + 1 ) ].xyz ); - - for ( i = 1; i < nc + 1; ++i ) { - - glVertex3fv( pv[ i + m * ( nc + 1 ) ].xyz ); - glVertex3fv( pv[ i + ( m + 1 ) * ( nc + 1 ) ].xyz ); - - } /* end for */ - - glEnd (); - - } /* end for */ - - } /* end else */ - - } else { /* lighting_model != TelLModelNone */ - - if ( pvt && !ForbidSetTextureMapping ) - - for ( m = 0; m < nr; ++m ) { - - glBegin ( GL_QUAD_STRIP ); - glNormal3fv ( pvn[ m * ( nc + 1 ) ].xyz ); - glTexCoord2fv ( pvt[ m * ( nc + 1 ) ].xy ); - glVertex3fv ( pv[ m * ( nc + 1 ) ].xyz ); - glNormal3fv ( pvn[ ( m + 1 ) * ( nc + 1 ) ].xyz ); - glTexCoord2fv ( pvt[ ( m + 1 ) * ( nc + 1 ) ].xy ); - glVertex3fv ( pv[ ( m + 1 ) * ( nc + 1 ) ].xyz ); - - for ( i = 1; i < nc + 1; ++i ) { - - glNormal3fv ( pvn[ i + m * ( nc + 1 ) ].xyz ); - glTexCoord2fv ( pvt[ i + m * ( nc + 1 ) ].xy ); - glVertex3fv ( pv[ i + m * ( nc + 1 ) ].xyz ); - glNormal3fv ( pvn[ i + ( m + 1 ) * ( nc + 1 ) ].xyz ); - glTexCoord2fv ( pvt[ i + ( m + 1 ) * ( nc + 1 ) ].xy ); - glVertex3fv ( pv[ i + ( m + 1 ) * ( nc + 1 ) ].xyz ); - - } /* end for */ - - glEnd (); - - } /* end for */ - - else - - for ( m = 0; m < nr; ++m ) { - - glBegin ( GL_QUAD_STRIP ); - glNormal3fv ( pvn[ m * ( nc + 1 ) ].xyz ); - glVertex3fv ( pv[ m * ( nc + 1 ) ].xyz ); - glNormal3fv ( pvn[ ( m + 1 ) * ( nc + 1 ) ].xyz ); - glVertex3fv ( pv[ ( m + 1 ) * ( nc + 1 ) ].xyz ); - - for ( i = 1; i < nc + 1; ++i ) { - - glNormal3fv ( pvn[ i + m * ( nc + 1 ) ].xyz ); - glVertex3fv ( pv[ i + m * ( nc + 1 ) ].xyz ); - glNormal3fv ( pvn[ i + ( m + 1 ) * ( nc + 1 ) ].xyz ); - glVertex3fv ( pv[ i + ( m + 1 ) * ( nc + 1 ) ].xyz ); - - } /* end for */ - - glEnd (); - - } /* end for */ - - } /* end else */ -#ifdef G003 - } else if ( g_fSkipRatio != 1.0 ) { - - set_drawable_items ( p -> d.bDraw, nr ); - - if ( !p -> d.dlist ) p -> d.dlist = glGenLists ( 1 ); - - glNewList ( p -> d.dlist, GL_COMPILE_AND_EXECUTE ); - newList = 1; - - if ( lighting_model == CALL_PHIGS_REFL_NONE ) { - - if ( pvc ) { - - for ( m = 0; m < nr; ++m ) - - if ( p -> d.bDraw[ m ] ) { - - glBegin ( GL_QUAD_STRIP ); - glColor3fv ( pvc[ m * ( nc + 1 ) ].rgb ); - glVertex3fv ( pv[ m * ( nc + 1 ) ].xyz ); - glColor3fv ( pvc[ ( m + 1 ) * ( nc + 1 ) ].rgb ); - glVertex3fv ( pv[ ( m + 1 ) * ( nc + 1 ) ].xyz ); - - for ( i = 1; i < nc + 1; ++i ) { - - glColor3fv ( pvc[ i + ( m + 1 ) * ( nc + 1 ) ].rgb ); - glVertex3fv ( pv[ i + ( m + 1 ) * ( nc + 1 ) ].xyz ); - glColor3fv ( pvc[ i + m * ( nc + 1 ) ].rgb ); - glVertex3fv ( pv[ i + m * ( nc + 1 ) ].xyz ); - - } /* end for */ - - glEnd (); - - } /* end if */ - - } else if ( pfc ) { - - glColor3fv ( pfc[ 0 ].rgb ); - - for ( m = 0; m < nr; ++m ) - - if ( p -> d.bDraw[ m ] ) { - - glBegin ( GL_QUADS ); - glColor3fv ( pfc[ m * nc ].rgb ); - glVertex3fv ( pv[ m * ( nc + 1 ) ].xyz ); - glVertex3fv ( pv[ ( m + 1 ) * ( nc + 1 ) ].xyz ); - - for ( i = 1; i < nc + 1; ++i ) { - - glColor3fv ( pfc[ i - 1 + m * nc ].rgb ); - glVertex3fv ( pv[ i + ( m + 1 ) * ( nc + 1 ) ].xyz ); - glVertex3fv ( pv[ i + m * ( nc + 1 ) ].xyz ); - - } /* end for */ - - glEnd (); - - } /* end if */ - - } else { - - for ( m = 0; m < nr; ++m ) - - if ( p -> d.bDraw[ m ] ) { - - glBegin ( GL_QUADS ); - glVertex3fv ( pv[ m * ( nc + 1 ) ].xyz ); - glVertex3fv ( pv[ ( m + 1 ) * ( nc + 1 ) ].xyz ); - - for ( i = 1; i < nc + 1; ++i ) { - - glVertex3fv( pv[ i + ( m + 1 ) * ( nc + 1 ) ].xyz ); - glVertex3fv( pv[ i + m * ( nc + 1 ) ].xyz ); - - } /* end for */ - - glEnd (); - - } /* end if */ - - } /* end else */ - - } else { /* lighting_model != TelLModelNone */ - - if ( pvt && !ForbidSetTextureMapping ) { - - for ( m = 0; m < nr; ++m ) - - if ( p -> d.bDraw[ m ] ) { - - glBegin ( GL_QUADS ); - glNormal3fv ( pvn[ m * ( nc + 1 ) ].xyz ); - glTexCoord2fv ( pvt[ m * ( nc + 1 ) ].xy ); - glVertex3fv ( pv[ m * ( nc + 1 ) ].xyz ); - glNormal3fv ( pvn[ ( m + 1 ) * ( nc + 1 ) ].xyz ); - glTexCoord2fv ( pvt[ ( m + 1 ) * ( nc + 1 ) ].xy ); - glVertex3fv ( pv[ ( m + 1 ) * ( nc + 1 ) ].xyz ); - - for ( i = 1; i < nc + 1; ++i ) { - - glNormal3fv ( pvn[ i + ( m + 1 ) * ( nc + 1 ) ].xyz ); - glTexCoord2fv ( pvt[ i + ( m + 1 ) * ( nc + 1 ) ].xy ); - glVertex3fv ( pv[ i + ( m + 1 ) * ( nc + 1 ) ].xyz ); - glNormal3fv ( pvn[ i + m * ( nc + 1 ) ].xyz ); - glTexCoord2fv ( pvt[ i + m * ( nc + 1 ) ].xy ); - glVertex3fv ( pv[ i + m * ( nc + 1 ) ].xyz ); - - } /* end for */ - - glEnd (); - - } /* end if */ - - } else - - for ( m = 0; m < nr; ++m ) - - if ( p -> d.bDraw[ m ] ) { - - glBegin ( GL_QUADS ); - glNormal3fv ( pvn[ m * ( nc + 1 ) ].xyz ); - glVertex3fv ( pv[ m * ( nc + 1 ) ].xyz ); - glNormal3fv ( pvn[ ( m + 1 ) * ( nc + 1 ) ].xyz ); - glVertex3fv ( pv[ ( m + 1 ) * ( nc + 1 ) ].xyz ); - - for ( i = 1; i < nc + 1; ++i ) { - - glNormal3fv ( pvn[ i + ( m + 1 ) * ( nc + 1 ) ].xyz ); - glVertex3fv ( pv[ i + ( m + 1 ) * ( nc + 1 ) ].xyz ); - glNormal3fv ( pvn[ i + m * ( nc + 1 ) ].xyz ); - glVertex3fv ( pv[ i + m * ( nc + 1 ) ].xyz ); - - } /* end for */ - - glEnd (); - - } /* end if */ - - } /* end else */ - - } else { - - if ( !p -> d.dlist ) p -> d.dlist = glGenLists ( 1 ); - - glNewList ( p -> d.dlist, GL_COMPILE_AND_EXECUTE ); - newList = 1; - - } /* end else */ - if ( newList ) glEndList (); - - if ( g_nDegenerateModel ) return; - - } else { - - glCallList ( g_fSkipRatio == 0.0 ? p -> d.list : p -> d.dlist ); - - if ( g_nDegenerateModel ) return; - - } /* end else */ -#endif /* G003 */ - } /* end if ( interior_style != TSM_EMPTY ) */ -#ifdef G003 - i = 0; - - /* OCC11904 -- Temporarily disable environment mapping */ - glPushAttrib(GL_ENABLE_BIT); - glDisable(GL_TEXTURE_1D); - glDisable(GL_TEXTURE_2D); - - switch ( g_nDegenerateModel ) { - -default: - break; - -case 2: /* XXX_TDM_WIREFRAME */ - i = 1; - break; - -case 3: /* XXX_TDM_MARKER */ - draw_degenerates_as_points ( - &p -> d, p -> vertices, ( p -> num_rows + 1 ) * ( p -> num_columns + 1 ) - ); - - glPopAttrib(); - - return; - -case 4: /* XXX_TDM_BBOX */ - draw_degenerates_as_bboxs ( - &p -> d, p -> vertices, ( p -> num_rows + 1 ) * ( p -> num_columns + 1 ) - ); - - glPopAttrib(); - - return; - - } /* end switch */ - - draw_edges ( p, edge_colour, interior_style, i ); -#else - draw_edges ( p, edge_colour, interior_style ); -#endif /* G003 */ - - glPopAttrib(); -} /* end draw_qstrip */ -/*----------------------------------------------------------------------*/ -static TStatus -QuadrangleDelete( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - tel_qstrip_data p; - - p = (tel_qstrip_data)data.pdata; - if( p->fnormals ) //cmn_freemem( p->fnormals ); - delete[] p->fnormals; - if( p->fcolours ) //cmn_freemem( p->fcolours ); - delete[] p->fcolours; - if( p->vertices ) //cmn_freemem( p->vertices ); - delete[] p->vertices; - if( p->vcolours ) //cmn_freemem( p->vcolours ); - delete[] p->vcolours; - if( p->vnormals ) //cmn_freemem( p->vnormals ); - delete[] p->vnormals; - if (p->vtexturecoord) //cmn_freemem(p->vtexturecoord); - delete[] p->vtexturecoord; - - if (data.pdata) - delete data.pdata; - - return TSuccess; -} - -/*----------------------------------------------------------------------*/ -static TStatus -QuadranglePrint( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - Tint i; - tel_qstrip_data p = (tel_qstrip_data)data.pdata; - - fprintf(stdout, "TelQuadrangle. "); - fprintf(stdout, "\n\tNumber of Rows : %d\n", p->num_rows); - fprintf(stdout, "\n\tNumber of Columns : %d\n", p->num_columns); - switch( p->shape_flag ) - { - case TEL_SHAPE_UNKNOWN: - fprintf( stdout, "\t\tShape Flag : UNKNOWN\n" ); - break; - - case TEL_SHAPE_COMPLEX: - fprintf( stdout, "\t\tShape Flag : COMPLEX\n" ); - break; - - case TEL_SHAPE_CONCAVE: - fprintf( stdout, "\t\tShape Flag : CONCAVE\n" ); - break; - - case TEL_SHAPE_CONVEX: - fprintf( stdout, "\t\tShape Flag : CONVEX\n" ); - break; - - } - switch( p->facet_flag ) - { - case TEL_FA_NONE: - if( p->fcolours ) - fprintf( stdout, "\t\tFacet Flag : COLOUR\n" ); - else - fprintf( stdout, "\t\tFacet Flag : NONE\n" ); - break; - - case TEL_FA_NORMAL: - if( p->fcolours ) - fprintf( stdout, "\t\tFacet Flag : COLOURNORMAL\n" ); - else - fprintf( stdout, "\t\tFacet Flag : NORMAL\n" ); - break; - } - - switch( p->vertex_flag ) - { - case TEL_VT_NONE: - if( p->vcolours ) - fprintf( stdout, "\t\tVertex Flag : COLOUR\n" ); - else - fprintf( stdout, "\t\tVertex Flag : NONE\n" ); - break; - - case TEL_VT_NORMAL: - if( p->vcolours ) - fprintf( stdout, "\t\tVertex Flag : COLOURNORMAL\n" ); - else - fprintf( stdout, "\t\tVertex Flag : NORMAL\n" ); - break; - } - if( p->fnormals ) - { - fprintf( stdout, "\n\t\tFacet Normals : " ); - for( i = 0; i < (p->num_rows * p->num_columns); i++ ) - fprintf( stdout, "\n\t\t v[%d] = %g %g %g", i, - p->fnormals[i].xyz[0], - p->fnormals[i].xyz[1], - p->fnormals[i].xyz[2] ); - } - else - fprintf( stdout, "\n\t\tFacet Normals not specified\n" ); - - if( p->fcolours ) - { - fprintf( stdout, "\n\t\tFacet Colours : " ); - for( i = 0; i < (p->num_rows * p->num_columns+1); i++ ) - fprintf( stdout, "\n\t\t v[%d] = %g %g %g", i, - p->fcolours[i].rgb[0], - p->fcolours[i].rgb[1], - p->fcolours[i].rgb[2] ); } - else - fprintf( stdout, "\n\t\tFacet Colours not specified\n" ); - if( p->vertices ) - { - fprintf( stdout, "\n\t\tVertices : " ); - for( i = 0; i < (p->num_rows+1)*(p->num_columns+1); i++ ) - fprintf( stdout, "\n\t\t v[%d] = %g %g %g", i, - p->vertices[i].xyz[0], - p->vertices[i].xyz[1], - p->vertices[i].xyz[2] ); } - - fprintf( stdout, "\n" ); - if( p->vcolours ) - { - fprintf( stdout, "\n\t\tVertex Colours : " ); - for( i = 0; i < (p->num_rows+1)*(p->num_columns+1); i++ ) - fprintf( stdout, "\n\t\t v[%d] = %g %g %g", i, - p->vcolours[i].rgb[0], - p->vcolours[i].rgb[1], - p->vcolours[i].rgb[2] ); } - else - fprintf( stdout, "\n\t\tVertex Colours not specified\n" ); - - if( p->vnormals ) - { - fprintf( stdout, "\n\t\tVertex Normals : " ); - for( i = 0; i < (p->num_rows+1)*(p->num_columns+1); i++ ) - fprintf( stdout, "\n\t\t v[%d] = %g %g %g", i, - p->vnormals[i].xyz[0], - p->vnormals[i].xyz[1], - p->vnormals[i].xyz[2] ); } - else - fprintf( stdout, "\n\t\tVertex Normals not specified\n" ); - - if (p->vtexturecoord) - { - fprintf(stdout, "\n\t\tTexture Coordinates : "); - for (i=0; i<(p->num_rows+1)*(p->num_columns+1); i++) - fprintf(stdout, "\n\t\t v[%d] = %g %g", i, - p->vtexturecoord[i].xy[0], - p->vtexturecoord[i].xy[1]); - } - else - fprintf( stdout, "\n\t\tTexture Coordinates not specified\n"); - - fprintf( stdout, "\n" ); - - return TSuccess; -} - -/*----------------------------------------------------------------------*/ -#ifdef G003 -static void draw_edges ( - tel_qstrip_data p, - tel_colour edge_colour, - Tint interior_style, - Tint forceDraw - ) -{ -#else -static void draw_edges ( - tel_qstrip_data p, - tel_colour edge_colour, - Tint interior_style - ) -{ -#endif /* G003 */ - CMN_KEY k, k1, k2, k3, k4; - Tint nf, nc, newList = 0; - Tint edge_type, line_type_preserve; - Tfloat edge_width, line_width_preserve; - GLboolean texture_on; - tel_point pv; -#ifdef G003 - if ( interior_style != TSM_HIDDENLINE && !forceDraw ) - { -#else - if ( interior_style != TSM_HIDDENLINE ) - { -#endif /* G003 */ - k.id = TelEdgeFlag; - TsmGetAttri ( 1, &k ); - - if ( k.data.ldata == TOff ) return; - - } /* end if */ - - pv = p -> vertices; - - LightOff (); - texture_on = IsTextureEnabled (); - - if ( texture_on ) DisableTexture (); - - k1.id = TelPolylineWidth; - k2.id = TelPolylineType; - k3.id = TelEdgeType; - k4.id = TelEdgeWidth; - TsmGetAttri ( 4, &k1, &k2, &k3, &k4 ); - - line_width_preserve = k1.data.fdata; - line_type_preserve = k2.data.ldata; - edge_type = k3.data.ldata; - edge_width = k4.data.fdata; - - nc = p -> num_columns; - nf = p -> num_rows * p->num_columns; - - if ( line_width_preserve != edge_width ) { - - k.id = TelPolylineWidth; - k.data.fdata = edge_width; - TsmSetAttri ( 1, &k ); - - } /* end if */ - - if ( line_type_preserve != edge_type ) { - - k.id = TelPolylineType; - k.data.ldata = edge_type; - TsmSetAttri ( 1, &k ); - - } /* end if */ -#ifdef G003 - if ( !forceDraw ) -#endif /* G003 */ - draw_line_strip ( p, edge_colour, nf, nc ); -#ifdef G003 - else { -#ifdef BUC60876 - if ( !g_fAnimation ) - goto doDraw; /* Disable object display list out of animation */ -#endif -# ifdef G004 - if ( g_fBitmap ) - goto doDraw; -# endif /* G004 */ - if ( p -> d.degMode != 2 || p -> d.skipRatio != g_fSkipRatio || !p -> d.dlist ) { - - if ( !p -> d.dlist ) p -> d.dlist = glGenLists ( 1 ); - - p -> d.degMode = 2; - p -> d.skipRatio = g_fSkipRatio; - glNewList ( p -> d.dlist, GL_COMPILE_AND_EXECUTE ); - newList = 1; -doDraw: - glPushAttrib ( GL_DEPTH_BUFFER_BIT ); - glDisable ( GL_DEPTH_TEST ); - - if ( g_fSkipRatio == 0.0 ) - - draw_line_strip ( p, edge_colour, nf, nc ); - - else if ( g_fSkipRatio != 1.0 ) { - - int i, m1, m2, n1, n2, n3, n4; - - set_drawable_items ( p -> d.bDraw, nf ); - - glColor3fv ( edge_colour -> rgb ); - - for ( i = 0; i < nf; ++i ) - - if ( p -> d.bDraw[ i ] ) { - - glBegin ( GL_LINE_STRIP ); - m1 = i / nc; - m2 = i % nc; - n1 = m1 * ( nc + 1 ) + m2; - n2 = n1 + nc + 1; - n3 = n2 + 1; - n4 = n1 + 1; - - glVertex3fv ( p -> vertices[ n1 ].xyz ); - glVertex3fv ( p -> vertices[ n2 ].xyz ); - glVertex3fv ( p -> vertices[ n3 ].xyz ); - glVertex3fv ( p -> vertices[ n4 ].xyz ); - glVertex3fv ( p -> vertices[ n1 ].xyz ); - glEnd(); - - } /* end if */ - - } /* end if */ - - glPopAttrib (); - if ( newList ) glEndList (); - - } else glCallList ( p -> d.dlist ); - - } /* end else */ -#endif /* G003 */ - if ( line_width_preserve != edge_width ) { - - k.id = TelPolylineWidth; - k.data.fdata = line_width_preserve; - TsmSetAttri ( 1, &k ); - - } /* end if */ - - if ( line_type_preserve != edge_type ) { - - k.id = TelPolylineType; - k.data.ldata = line_type_preserve; - TsmSetAttri ( 1, &k ); - - } /* end if */ - - if ( texture_on ) EnableTexture (); - -} /* end draw_edges */ - -static void draw_line_strip ( tel_qstrip_data p, tel_colour c, Tint nf, Tint nc ) { - - int i, m1, m2, n1, n2, n3, n4; - - glColor3fv ( c -> rgb ); - - for ( i = 0; i < nf; ++i ) { - - glBegin ( GL_LINE_STRIP ); - m1 = i / nc; - m2 = i % nc; - n1 = m1 * ( nc + 1 ) + m2; - n2 = n1 + nc + 1; - n3 = n2 + 1; - n4 = n1 + 1; - - glVertex3fv ( p -> vertices[ n1 ].xyz ); - glVertex3fv ( p -> vertices[ n2 ].xyz ); - glVertex3fv ( p -> vertices[ n3 ].xyz ); - glVertex3fv ( p -> vertices[ n4 ].xyz ); - glVertex3fv ( p -> vertices[ n1 ].xyz ); - glEnd(); - - } /* end for */ - -} /* end draw_line_strip */ -/*----------------------------------------------------------------------*/ - -static TStatus -QuadrangleInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - Tint i, j; - tel_qstrip_data d; - Tint size_reqd=0; - TStatus status = TSuccess; - Tchar *cur_ptr = 0; - Tint nf, nv; - - d = (tel_qstrip_data)data.pdata; - nf = d->num_rows * d->num_columns; - nv = ( d->num_rows + 1 ) * ( d->num_columns + 1 ); - - if( d->fcolours ) - size_reqd += ( nf * sizeof( TEL_COLOUR ) ); - - if( d->facet_flag == TEL_FA_NORMAL ) - size_reqd += ( nf * sizeof( TEL_POINT ) ); - - size_reqd += ( nv * sizeof( TEL_POINT ) ); - - if( d->vcolours ) - size_reqd += ( nv * sizeof( TEL_COLOUR ) ); - - if( d->vertex_flag == TEL_VT_NORMAL ) - size_reqd += ( nv * sizeof( TEL_POINT ) ); - - for( i = 0; i < n; i++ ) - { - switch( k[i]->id ) - { - case INQ_GET_SIZE_ID: - { - k[i]->data.ldata = size_reqd; - break; - } - - case INQ_GET_CONTENT_ID: - { - TEL_INQ_CONTENT *c; - Teldata *w; - - c = (tel_inq_content)k[i]->data.pdata; - c->act_size = size_reqd; - w = c->data; - - cur_ptr = c->buf; - w->quadmesh3data.shpflag = d->shape_flag; - w->quadmesh3data.dim.x_dim = d->num_rows; - w->quadmesh3data.dim.y_dim = d->num_columns; - - if( c->size >= size_reqd ) - { - if( d->facet_flag == TEL_FA_NORMAL ) - { - if( d->fcolours ) - { - w->quadmesh3data.fctflag = TEL_FAFLAG_COLOURNORMAL; - w->quadmesh3data.gnormals = (tel_point)(c->buf); - for( j = 0; j < nf; j++ ) - { - w->quadmesh3data.gnormals[j] = d->fnormals[j]; - } - cur_ptr += ( nf * sizeof( TEL_POINT ) ); - - w->quadmesh3data.facet_colour_vals = - (tel_colour)(cur_ptr); - for( j = 0; j < nf; j++ ) - { - w->quadmesh3data.facet_colour_vals[j] = - d->fcolours[j]; - } - cur_ptr += ( nf * sizeof( TEL_COLOUR ) ); - } - else - { - w->quadmesh3data.fctflag = TEL_FAFLAG_NORMAL; - w->quadmesh3data.facet_colour_vals = 0; - w->quadmesh3data.gnormals = (tel_point)(c->buf); - for( j = 0; j < nf; j++ ) - { - w->quadmesh3data.gnormals[j] = d->fnormals[j]; - } - cur_ptr += ( nf * sizeof( TEL_POINT ) ); - } - } - else - { - w->quadmesh3data.gnormals = 0; - if( d->fcolours ) - { - w->quadmesh3data.fctflag = TEL_FAFLAG_COLOUR; - w->quadmesh3data.facet_colour_vals = - (tel_colour)(c->buf ); - for( j = 0; j < nf; j++ ) - { - w->quadmesh3data.facet_colour_vals[j] = - d->fcolours[j]; - } - cur_ptr += ( nf * sizeof( TEL_COLOUR ) ); - } - else - { - w->quadmesh3data.fctflag = TEL_FAFLAG_NONE; - w->quadmesh3data.facet_colour_vals = 0; - } - } - - w->quadmesh3data.points = (tel_point)cur_ptr; - for( j = 0; j < nv; j++ ) - { - w->quadmesh3data.points[j] = d->vertices[j]; - } - cur_ptr += ( nv * sizeof( TEL_POINT ) ); - - if( d->vertex_flag == TEL_VT_NORMAL ) - { - if( d->vcolours ) - { - w->quadmesh3data.vrtflag = TEL_VTFLAG_COLOURNORMAL; - w->quadmesh3data.vnormals = (tel_point)(cur_ptr); - for( j = 0; j < nv; j++ ) - { - w->quadmesh3data.vnormals[j] = d->vnormals[i]; - } - cur_ptr += ( nv * sizeof( TEL_POINT ) ); - - w->quadmesh3data.colours = (tel_colour)(cur_ptr); - - for( j = 0; j < nv; j++ ) - { - w->quadmesh3data.colours[j] = d->vcolours[i]; - } - } - else - { - w->quadmesh3data.vrtflag = TEL_VTFLAG_NORMAL; - w->quadmesh3data.colours = 0; - w->quadmesh3data.vnormals = (tel_point)(cur_ptr); - - for( j = 0; j < nv; j++ ) - { - w->quadmesh3data.vnormals[j] = d->vnormals[i]; - } - } - } - else - { - w->quadmesh3data.vnormals = 0; - if( d->vcolours ) - { - w->quadmesh3data.vrtflag = TEL_VTFLAG_COLOUR; - w->quadmesh3data.colours = (tel_colour)(cur_ptr); - for( j = 0; j < nv; j++ ) - { - w->quadmesh3data.colours[j] = d->vcolours[i]; - } - } - else - { - w->quadmesh3data.vrtflag = TEL_VTFLAG_NONE; - w->quadmesh3data.colours = 0; - } - } - - status = TSuccess; - } - else - status = TFailure; - break; - } - } - } - return status; -} - -/*----------------------------------------------------------------------*/ diff --git a/src/OpenGl/OpenGl_remnames.cxx b/src/OpenGl/OpenGl_remnames.cxx deleted file mode 100755 index 088f3e7eb1..0000000000 --- a/src/OpenGl/OpenGl_remnames.cxx +++ /dev/null @@ -1,150 +0,0 @@ - -#include - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -static TStatus RemoveNamesetDisplay( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus RemoveNamesetAdd( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus RemoveNamesetDelete( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus RemoveNamesetPrint( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus RemoveNamesetInquire( TSM_ELEM_DATA, Tint, cmn_key* ); - -static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) = -{ - RemoveNamesetDisplay, /* PickTraverse */ - RemoveNamesetDisplay, - RemoveNamesetAdd, - RemoveNamesetDelete, - RemoveNamesetPrint, - RemoveNamesetInquire -}; - - -MtblPtr -TelRemoveNamesetInitClass( TelType* el ) -{ - *el = TelRemoveNameset; - return MtdTbl; -} - -static TStatus -RemoveNamesetAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k ) -{ - Tint i, num, *ptr; - tel_tint_data data; - - num = k[0]->id; - data = new TEL_TINT_DATA(); - if( !data ) - return TFailure; - data->data = new Tint[num]; - if( !data->data ) - return TFailure; - - for( i=0, ptr=(Tint*)(k[0]->data.pdata); idata[i] = ptr[i]; - } - data->num = num; - - ((tsm_elem_data)(d.pdata))->pdata = data; - - return TSuccess; -} - - -static TStatus -RemoveNamesetDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - tel_tint_data d = (tel_tint_data)data.pdata; - TglNamesetRemove( d->num, d->data ); - - return TSuccess; -} - -static TStatus -RemoveNamesetDelete( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - if (data.pdata) - delete data.pdata; - return TSuccess; -} - - - - -static TStatus -RemoveNamesetPrint( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - Tint i; - tel_tint_data p; - - p = (tel_tint_data)data.pdata; - - fprintf( stdout, "TelRemoveNameset. Number: %d\n", p->num ); - for( i = 0; i < p->num; i++ ) - { - fprintf( stdout, "\n\t\t v[%d] = %d", i, p->data[i] ); - } - fprintf( stdout, "\n" ); - - return TSuccess; -} - -static TStatus -RemoveNamesetInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - Tint i; - tel_tint_data d; - Tint size_reqd=0; - TStatus status = TSuccess; - - d = (tel_tint_data)data.pdata; - - size_reqd = d->num * sizeof( Tint ); - - for( i = 0; i < n; i++ ) - { - switch( k[i]->id ) - { - case INQ_GET_SIZE_ID: - { - k[i]->data.ldata = size_reqd; - break; - } - - case INQ_GET_CONTENT_ID: - { - TEL_INQ_CONTENT *c; - Teldata *w; - - c = (tel_inq_content)k[i]->data.pdata; - c->act_size = size_reqd; - w = c->data; - - w->name_set.number = d->num; - if( c->size >= size_reqd ) - { - w->name_set.integers = (Tint *)(c->buf); - memcpy(w->name_set.integers, d->data, d->num*sizeof(Tint)); - status = TSuccess; - } - else - status = TFailure; - break; - } - } - } - return status; -} diff --git a/src/OpenGl/OpenGl_subrs.cxx b/src/OpenGl/OpenGl_subrs.cxx deleted file mode 100755 index ff724c8c1e..0000000000 --- a/src/OpenGl/OpenGl_subrs.cxx +++ /dev/null @@ -1,2995 +0,0 @@ -/*********************************************************************** - -FONCTION : ----------- -File OpenGl_subrs : - - -REMARQUES: ----------- - - -HISTORIQUE DES MODIFICATIONS : --------------------------------- -xx-xx-xx : xxx ; Creation. -11-03-96 : FMN ; Correction warning compilation -01-04-96 : CAL ; Integration MINSK portage WNT -26-04-96 : FMN ; Correction warning compilation -10-06-96 : CAL ; Transparence dans call_subr_set_refl_props -17-07-96 : CAL ; Suppression de CALL_PHIGS_ELEM_HLHSR_ID -07-10-96 : FMN ; Suppression code inutile -21-08-97 : PCT ; ajout deuxieme passe pour les textures -23-12-97 : FMN ; Suppression TelBackInteriorStyle, TelBackInteriorStyleIndex -29-12-97 : FMN ; Ajout cas 4 pour call_subr_polygon_indices() -30-12-97 : FMN ; CTS18312: Correction back material -08-04-98 : FGU ; Ajout emission -30-11-98 : FMN ; S3819 : Textes toujours visibles -16-06-2000 : ATS,GG : G005 : Group of functions: call_subr_parray - -************************************************************************/ - -#define IMP190602 /* GG Avoid memory leaks after creating a polyline -// with vertex colors primitive. -// Thanks to Ivan Fontaine (SAMTECH) for this improvment -*/ - -/*----------------------------------------------------------------------*/ -/* -* Includes -*/ - - -#include - -#include -#include -#include - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -void -call_subr_set_line_colr( Tfloat r, Tfloat g, Tfloat b ) -{ - CMN_KEY key; - TEL_COLOUR col; - - col.rgb[0] = r, - col.rgb[1] = g, - col.rgb[2] = b; - key.data.pdata = &col; - TsmAddToStructure( TelPolylineColour, 1, &key ); - - return; -} - - -void -call_subr_polyline( CALL_DEF_LISTPOINTS * alpoints ) -{ - CMN_KEY key[4]; - cmn_key kp[4]; - - kp[0] = &key[0], kp[1] = &key[1], kp[2] = &key[2], kp[3] = &key[3]; - key[0].id = NUM_LINES_ID; - key[0].data.ldata = 1; - key[1].id = VERTICES_ID; - key[1].data.pdata = alpoints->UPoints.Points; - key[2].id = BOUNDS_DATA_ID; - key[2].data.pdata = &alpoints->NbPoints; - key[3].id = NUM_VERTICES_ID; - key[3].data.ldata = alpoints->NbPoints; - TsmAddToStructure( TelPolyline, -4, kp ); - - return; -} - - -void -call_subr_polyline_data( CALL_DEF_LISTPOINTS * alpoints ) -{ - CMN_KEY key[5]; - cmn_key kp[5]; - tel_point points; - tel_colour col; - register Tint i; - - if( alpoints->TypePoints != 3 ) - return; /* Coordinates and Vertex Colour not Specified */ - - points = new TEL_POINT[alpoints->NbPoints]; - if( !points ) - return; - - col = new TEL_COLOUR[alpoints->NbPoints]; - if( !col ) - { - delete[] points; - return; - } - - for( i = 0; i < alpoints->NbPoints; i++ ) - { - points[i].xyz[0] = alpoints->UPoints.PointsC[i].Point.x; - points[i].xyz[1] = alpoints->UPoints.PointsC[i].Point.y; - points[i].xyz[2] = alpoints->UPoints.PointsC[i].Point.z; - col[i].rgb[0] = alpoints->UPoints.PointsC[i].Color.r; - col[i].rgb[1] = alpoints->UPoints.PointsC[i].Color.g; - col[i].rgb[2] = alpoints->UPoints.PointsC[i].Color.b; - } - - key[0].id = NUM_LINES_ID; - key[0].data.ldata = 1; - key[1].id = VERTEX_COLOUR_VALS_ID; - key[1].data.pdata = col; - key[2].id = VERTICES_ID; - key[2].data.pdata = points; - key[3].id = BOUNDS_DATA_ID; - key[3].data.pdata = &alpoints->NbPoints; - key[4].id = NUM_VERTICES_ID; - key[4].data.ldata = alpoints->NbPoints; - - for( i = 0; i < 5; i++ ) - kp[i] = &key[i]; - - TsmAddToStructure( TelPolyline, -5, kp ); - -#ifdef IMP190602 - delete[] points; - delete col; -#endif - - return; -} - - - -void -call_subr_remnameset( Tint num, Tint *ns ) -{ - CMN_KEY key; - - key.id = num; - key.data.pdata = ns; - TsmAddToStructure( TelRemoveNameset, 1, &key ); - - return; -} - - -void -call_subr_addnameset( Tint num, Tint *ns ) -{ - CMN_KEY key; - - key.id = num; - key.data.pdata = ns; - TsmAddToStructure( TelAddNameset, 1, &key ); - - return; -} - -void -call_subr_set_back_int_colr( Tfloat r, Tfloat g, Tfloat b, Tfloat a ) -{ - CMN_KEY key; - TEL_COLOUR col; - - col.rgb[0] = r, - col.rgb[1] = g, - col.rgb[2] = b; - key.data.pdata = &col; - TsmAddToStructure( TelBackInteriorColour, 1, &key ); - - return; -} - - - -void -call_subr_set_int_colr( Tfloat r, Tfloat g, Tfloat b, Tfloat a ) -{ - CMN_KEY key; - TEL_COLOUR col; - - col.rgb[0] = r, - col.rgb[1] = g, - col.rgb[2] = b; - key.data.pdata = &col; - TsmAddToStructure( TelInteriorColour, 1, &key ); - - return; -} - -void -call_subr_set_edge_colr( Tfloat r, Tfloat g, Tfloat b ) -{ - CMN_KEY key; - TEL_COLOUR col; - - col.rgb[0] = r, - col.rgb[1] = g, - col.rgb[2] = b; - key.data.pdata = &col; - TsmAddToStructure( TelEdgeColour, 1, &key ); - - return; -} - - -void -call_subr_set_refl_props( CALL_DEF_MATERIAL * material, Tint tag ) -{ - CMN_KEY key; - TEL_SURF_PROP surface; - - /* Par defaut tout a 0 */ - surface.amb = ( float )0.0; - surface.diff = ( float )0.0; - surface.spec = ( float )0.0; - surface.emsv = ( float )0.0; - surface.isamb = (int)0; - surface.isdiff = (int)0; - surface.isspec = (int)0; - surface.isemsv = (int)0; - surface.isphysic = (int)0; - - /* Cas par cas pour l evaluation */ - if( material->IsAmbient ) - { - surface.amb = material->Ambient; - surface.isamb = 1; - } - if( material->IsDiffuse ) - { - surface.diff = material->Diffuse; - surface.isdiff = 1; - } - if( material->IsSpecular ) - { - surface.spec = material->Specular; - surface.isspec = 1; - } - if( material->IsEmission ) - { - surface.emsv = material->Emission; - surface.isemsv = 1; - } - - /* type de materiel */ - if( material->IsPhysic ) - surface.isphysic = 1; - - /* Couleur du materiel */ - - /* Couleur eclairage ambient */ - surface.ambcol.rgb[0] = material->ColorAmb.r; - surface.ambcol.rgb[1] = material->ColorAmb.g; - surface.ambcol.rgb[2] = material->ColorAmb.b; - - /* Couleur eclairage diffus */ - surface.difcol.rgb[0] = material->ColorDif.r; - surface.difcol.rgb[1] = material->ColorDif.g; - surface.difcol.rgb[2] = material->ColorDif.b; - - /* Couleur eclairage speculaire */ - surface.speccol.rgb[0] = material->ColorSpec.r; - surface.speccol.rgb[1] = material->ColorSpec.g; - surface.speccol.rgb[2] = material->ColorSpec.b; - - /* Couleur d emission */ - surface.emscol.rgb[0] = material->ColorEms.r; - surface.emscol.rgb[1] = material->ColorEms.g; - surface.emscol.rgb[2] = material->ColorEms.b; - - surface.shine = ( float )128 * material->Shininess; - surface.env_reflexion = material->EnvReflexion; - - /* Dans la couche C++ : - * prop->trans = 0. => opaque - * prop->trans = 1. => transparent - * en OpenGl c'est le contraire. - */ - surface.trans = 1.0F - material->Transparency; - - key.data.pdata = &surface; - TsmAddToStructure( tag ? TelBackSurfaceAreaProperties : - TelSurfaceAreaProperties, 1, &key ); - return; -} - -void -call_subr_set_marker_colr( Tfloat r, Tfloat g, Tfloat b ) -{ - CMN_KEY key; - TEL_COLOUR col; - - col.rgb[0] = r, - col.rgb[1] = g, - col.rgb[2] = b; - key.data.pdata = &col; - TsmAddToStructure( TelPolymarkerColour, 1, &key ); - - return; -} - - -TStatus -call_subr_get_exec_struct( Tint afather, Tint ason, Tint *ind ) -{ - tsm_node node; - Tint i, num; - - if( TsmGetStructure( afather, &num, &node ) == TSuccess ) - { - for( i = 0; i < num; i++, node = node->next ) - { - if( node->elem.el == TelExecuteStructure ) - if( node->elem.data.ldata == ason ) - { - *ind = (i+1); - return TSuccess; - } - } - } - return TFailure; -} - - -void -call_subr_marker( CALL_DEF_MARKER * amarker ) -{ - CMN_KEY key; - TEL_POINT pt; - - key.id = 1; - pt.xyz[0] = amarker->x, - pt.xyz[1] = amarker->y, - pt.xyz[2] = amarker->z; - key.data.pdata = &pt; - TsmAddToStructure( TelMarkerSet, 1, &key ); - - return; -} - - -void -call_subr_marker_set( CALL_DEF_LISTMARKERS * almarkers ) -{ - CMN_KEY key; - - key.id = almarkers->NbMarkers; - key.data.pdata = almarkers->Markers; - TsmAddToStructure( TelMarkerSet, 1, &key ); - - return; -} - - -void -call_subr_polygon( CALL_DEF_FACET * afacet ) -{ - CMN_KEY k[3]; - - k[0].id = NUM_VERTICES_ID; - k[0].data.ldata = afacet->NbPoints; - - k[1].id = SHAPE_FLAG_ID; - k[1].data.ldata = TEL_SHAPE_UNKNOWN; - - switch (afacet->TypeFacet) { - case 0 : /* TOP_UNKNOWN */ - k[1].data.ldata = TEL_SHAPE_UNKNOWN; - break; - case 1 : /* TOP_COMPLEX */ - k[1].data.ldata = TEL_SHAPE_COMPLEX; - break; - case 2 : /* TOP_CONCAVE */ - k[1].data.ldata = TEL_SHAPE_CONCAVE; - break; - case 3 : /* TOP_CONVEX */ - k[1].data.ldata = TEL_SHAPE_CONVEX; - break; - } - -#if defined(__sgi) || defined(IRIX) - /* Pb avec le tesselator sgi */ - k[1].data.ldata = TEL_SHAPE_CONVEX; -#endif - - k[2].id = VERTICES_ID; - k[2].data.pdata = afacet->UPoints.Points; - - TsmAddToStructure( TelPolygon, 3, &k[0], &k[1], &k[2] ); - - return; -} - - -void -call_subr_polygon_data( CALL_DEF_FACET * afacet ) -{ - CMN_KEY k[10]; - cmn_key kp[10]; - Tint nk = 0, i; - TEL_COLOUR col; - void *npt; - TEL_POINT *pts=0, *ptn=0; - TEL_TEXTURE_COORD *ptt=0; - - k[nk].id = NUM_VERTICES_ID; - k[nk].data.ldata = afacet->NbPoints; - nk++; - - if( afacet->ColorIsDefined ) - { - col.rgb[0] = afacet->Color.r; - col.rgb[1] = afacet->Color.g; - col.rgb[2] = afacet->Color.b; - - k[nk].id = FACET_COLOUR_VALS_ID; - k[nk].data.pdata = &col; - nk++; - } - - if( afacet->NormalIsDefined ) - { - npt = &afacet->Normal; - k[nk].id = FNORMALS_ID; - k[nk].data.pdata = npt; - nk++; - } - - switch (afacet->TypePoints) - { - case 1: - { - k[nk].id = SHAPE_FLAG_ID; - k[nk].data.ldata = TEL_SHAPE_UNKNOWN; - switch (afacet->TypeFacet) { - case 0 : /* TOP_UNKNOWN */ - k[nk].data.ldata = TEL_SHAPE_UNKNOWN; - break; - case 1 : /* TOP_COMPLEX */ - k[nk].data.ldata = TEL_SHAPE_COMPLEX; - break; - case 2 : /* TOP_CONCAVE */ - k[nk].data.ldata = TEL_SHAPE_CONCAVE; - break; - case 3 : /* TOP_CONVEX */ - k[nk].data.ldata = TEL_SHAPE_CONVEX; - break; - } -#if defined(__sgi) || defined(IRIX) - /* Pb avec le tesselator sgi */ - k[nk].data.ldata = TEL_SHAPE_CONVEX; -#endif - nk++; - k[nk].id = VERTICES_ID; - k[nk].data.pdata = afacet->UPoints.Points; - nk++; - break; - } - case 2: - { - Tint i; - - k[nk].id = SHAPE_FLAG_ID; - k[nk].data.ldata = TEL_SHAPE_UNKNOWN; - switch (afacet->TypeFacet) { - case 0 : /* TOP_UNKNOWN */ - k[nk].data.ldata = TEL_SHAPE_UNKNOWN; - break; - case 1 : /* TOP_COMPLEX */ - k[nk].data.ldata = TEL_SHAPE_COMPLEX; - break; - case 2 : /* TOP_CONCAVE */ - k[nk].data.ldata = TEL_SHAPE_CONCAVE; - break; - case 3 : /* TOP_CONVEX */ - k[nk].data.ldata = TEL_SHAPE_CONVEX; - break; - } -#if defined(__sgi) || defined(IRIX) - /* Pb avec le tesselator sgi */ - k[nk].data.ldata = TEL_SHAPE_CONVEX; -#endif - nk++; - //cmn_memreserve( pts, afacet->NbPoints, 0 ); - pts = new TEL_POINT[afacet->NbPoints]; - k[nk].id = VERTICES_ID; - k[nk].data.pdata = pts; - nk++; - //cmn_memreserve( ptn, afacet->NbPoints, 0 ); - ptn = new TEL_POINT[afacet->NbPoints]; - k[nk].id = VNORMALS_ID; - k[nk].data.pdata = ptn; - nk++; - for( i = 0; i < afacet->NbPoints; i++ ) - { - pts[i].xyz[0] = afacet->UPoints.PointsN[i].Point.x; - pts[i].xyz[1] = afacet->UPoints.PointsN[i].Point.y; - pts[i].xyz[2] = afacet->UPoints.PointsN[i].Point.z; - - ptn[i].xyz[0] = afacet->UPoints.PointsN[i].Normal.dx; - ptn[i].xyz[1] = afacet->UPoints.PointsN[i].Normal.dy; - ptn[i].xyz[2] = afacet->UPoints.PointsN[i].Normal.dz; - } - break; - } - case 5: - { - Tint i; - - k[nk].id = SHAPE_FLAG_ID; - k[nk].data.ldata = TEL_SHAPE_UNKNOWN; - switch (afacet->TypeFacet) { - case 0 : /* TOP_UNKNOWN */ - k[nk].data.ldata = TEL_SHAPE_UNKNOWN; - break; - case 1 : /* TOP_COMPLEX */ - k[nk].data.ldata = TEL_SHAPE_COMPLEX; - break; - case 2 : /* TOP_CONCAVE */ - k[nk].data.ldata = TEL_SHAPE_CONCAVE; - break; - case 3 : /* TOP_CONVEX */ - k[nk].data.ldata = TEL_SHAPE_CONVEX; - break; - } -#if defined(__sgi) || defined(IRIX) - /* Pb avec le tesselator sgi */ - k[nk].data.ldata = TEL_SHAPE_CONVEX; -#endif - nk++; - //cmn_memreserve( pts, afacet->NbPoints, 0 ); - pts = new TEL_POINT[afacet->NbPoints]; - k[nk].id = VERTICES_ID; - k[nk].data.pdata = pts; - nk++; - //cmn_memreserve( ptn, afacet->NbPoints, 0 ); - ptn = new TEL_POINT[afacet->NbPoints]; - k[nk].id = VNORMALS_ID; - k[nk].data.pdata = ptn; - nk++; - //cmn_memreserve( ptt, afacet->NbPoints, 0 ); - ptt = new TEL_TEXTURE_COORD[afacet->NbPoints]; - k[nk].id = VTEXTURECOORD_ID; - k[nk].data.pdata = ptt; - nk++; - for( i = 0; i < afacet->NbPoints; i++ ) - { - pts[i].xyz[0] = afacet->UPoints.PointsNT[i].Point.x; - pts[i].xyz[1] = afacet->UPoints.PointsNT[i].Point.y; - pts[i].xyz[2] = afacet->UPoints.PointsNT[i].Point.z; - - ptn[i].xyz[0] = afacet->UPoints.PointsNT[i].Normal.dx; - ptn[i].xyz[1] = afacet->UPoints.PointsNT[i].Normal.dy; - ptn[i].xyz[2] = afacet->UPoints.PointsNT[i].Normal.dz; - - ptt[i].xy[0] = afacet->UPoints.PointsNT[i].TextureCoord.tx; - ptt[i].xy[1] = afacet->UPoints.PointsNT[i].TextureCoord.ty; - } - break; - } - } - - for( i = 0; i < nk; i++ ) - kp[i] = &k[i]; - - TsmAddToStructure( TelPolygon, -nk, kp ); - - if( pts ) - { - //cmn_freemem( pts ); - delete[] pts; - //cmn_freemem( ptn ); - delete[] ptn; - //cmn_freemem( ptt ); - delete[] ptt; - } - - return; -} - - -void -call_subr_polygon_indices( CALL_DEF_LISTPOINTS * alpoints, - CALL_DEF_LISTEDGES * aledges, - CALL_DEF_LISTINTEGERS * albounds ) -{ - CMN_KEY k[10]; - cmn_key kp[10]; - Tint nk = 0, i; - tel_point varr=0; - tel_point narr=0; - tel_colour carr=0; - tel_texture_coord tarr=0; - Tint *edgvis=NULL, *bounds, *indices; - Tint num_indices; - - k[nk].id = NUM_VERTICES_ID; - k[nk].data.ldata = alpoints->NbPoints; - nk++; - - k[nk].id = NUM_FACETS_ID; - k[nk].data.ldata = albounds->NbIntegers; - nk++; - - k[nk].id = SHAPE_FLAG_ID; - k[nk].data.ldata = TEL_SHAPE_UNKNOWN; - nk++; - - if( aledges->NbEdges ) - { - //cmn_memreserve( edgvis, aledges->NbEdges, 0 ); - edgvis = new Tint[aledges->NbEdges]; - if( !edgvis ) - return; - for( i = 0; i < aledges->NbEdges; i++ ) - edgvis[i] = aledges->Edges[i].Type ? CALL_PHIGS_EDGE_OFF : - CALL_PHIGS_EDGE_ON; - k[nk].id = EDGE_DATA_ID; - k[nk].data.pdata = edgvis; - nk++; - } - - bounds = new Tint[albounds->NbIntegers]; - if( !bounds ) - { - delete[] edgvis; - return; - } - for( i = 0, num_indices = 0; i < albounds->NbIntegers; i++ ) - { - bounds[i] = albounds->Integers[i]; - num_indices += bounds[i]; - } - k[nk].id = BOUNDS_DATA_ID; - k[nk].data.pdata = bounds; - nk++; - - indices = new Tint[num_indices]; - if( !indices ) - { - delete[] edgvis; - delete[] bounds; - return; - } - for( i = 0; i < num_indices; i++ ) - indices[i] = aledges->Edges[i].Index1; - k[nk].id = CONNECTIVITY_ID; - k[nk].data.pdata = indices; - nk++; - - switch( alpoints->TypePoints ) - { - case 1 : /* Vertex Coordinates Specified */ - varr = new TEL_POINT[alpoints->NbPoints]; - if( !varr ) - { - delete[] edgvis; - delete[] bounds; - delete[] indices; - return; - } - for( i = 0; i < alpoints->NbPoints; i++ ) - varr[i].xyz[0] = alpoints->UPoints.Points[i].x, - varr[i].xyz[1] = alpoints->UPoints.Points[i].y, - varr[i].xyz[2] = alpoints->UPoints.Points[i].z; - k[nk].id = VERTICES_ID; - k[nk].data.pdata = varr; - nk++; - break; - - case 2 : /* Coordinates and Vertex Normal Specified */ - varr = new TEL_POINT[alpoints->NbPoints]; - if( !varr ) - { - delete[] edgvis; - delete[] bounds; - delete[] indices; - return; - } - narr = new TEL_POINT[alpoints->NbPoints]; - if( !narr ) - { - delete[] edgvis; - delete[] bounds; - delete[] indices; - delete[] varr; - return; - } - for( i = 0; i < alpoints->NbPoints; i++ ) - { - varr[i].xyz[0] = alpoints->UPoints.PointsN[i].Point.x, - varr[i].xyz[1] = alpoints->UPoints.PointsN[i].Point.y, - varr[i].xyz[2] = alpoints->UPoints.PointsN[i].Point.z; - - narr[i].xyz[0] = alpoints->UPoints.PointsN[i].Normal.dx, - narr[i].xyz[1] = alpoints->UPoints.PointsN[i].Normal.dy, - narr[i].xyz[2] = alpoints->UPoints.PointsN[i].Normal.dz; - } - k[nk].id = VERTICES_ID; - k[nk].data.pdata = varr; - nk++; - k[nk].id = VNORMALS_ID; - k[nk].data.pdata = narr; - nk++; - break; - - case 3 : /* Coordinates and Vertex Colour Specified */ - varr = new TEL_POINT[alpoints->NbPoints]; - if( !varr ) - { - delete[] edgvis; - delete[] bounds; - delete[] indices; - return; - } - carr = new TEL_COLOUR[alpoints->NbPoints]; - if( !carr ) - { - delete[] edgvis; - delete[] bounds; - delete[] indices; - delete[] varr; - return; - } - for( i = 0; i < alpoints->NbPoints; i++ ) - { - varr[i].xyz[0] = alpoints->UPoints.PointsC[i].Point.x, - varr[i].xyz[1] = alpoints->UPoints.PointsC[i].Point.y, - varr[i].xyz[2] = alpoints->UPoints.PointsC[i].Point.z; - - carr[i].rgb[0] = alpoints->UPoints.PointsC[i].Color.r, - carr[i].rgb[1] = alpoints->UPoints.PointsC[i].Color.g, - carr[i].rgb[2] = alpoints->UPoints.PointsC[i].Color.b; - } - k[nk].id = VERTICES_ID; - k[nk].data.pdata = varr; - nk++; - k[nk].id = VERTEX_COLOUR_VALS_ID; - k[nk].data.pdata = carr; - nk++; - break; - - case 4 : /* Coordinates and Vertex Colour and Vertex Normal Specified */ - varr = new TEL_POINT[alpoints->NbPoints]; - if( !varr ) - { - delete[] edgvis; - delete[] bounds; - delete[] indices; - return; - } - carr = new TEL_COLOUR[alpoints->NbPoints]; - if( !carr ) - { - delete[] edgvis; - delete[] bounds; - delete[] indices; - delete[] varr; - return; - } - narr = new TEL_POINT[alpoints->NbPoints]; - if( !narr ) - { - delete[] edgvis; - delete[] bounds; - delete[] indices; - delete[] varr; - delete[] carr; - return; - } - for( i = 0; i < alpoints->NbPoints; i++ ) - { - varr[i].xyz[0] = alpoints->UPoints.PointsNC[i].Point.x, - varr[i].xyz[1] = alpoints->UPoints.PointsNC[i].Point.y, - varr[i].xyz[2] = alpoints->UPoints.PointsNC[i].Point.z; - - carr[i].rgb[0] = alpoints->UPoints.PointsNC[i].Color.r, - carr[i].rgb[1] = alpoints->UPoints.PointsNC[i].Color.g, - carr[i].rgb[2] = alpoints->UPoints.PointsNC[i].Color.b; - - narr[i].xyz[0] = alpoints->UPoints.PointsNC[i].Normal.dx, - narr[i].xyz[1] = alpoints->UPoints.PointsNC[i].Normal.dy, - narr[i].xyz[2] = alpoints->UPoints.PointsNC[i].Normal.dz; - } - k[nk].id = VERTICES_ID; - k[nk].data.pdata = varr; - nk++; - k[nk].id = VERTEX_COLOUR_VALS_ID; - k[nk].data.pdata = carr; - nk++; - k[nk].id = VNORMALS_ID; - k[nk].data.pdata = narr; - nk++; - break; - - case 5 : /* Coordinates and Vertex Normal and Texture Coordinates specified */ - varr = new TEL_POINT[alpoints->NbPoints]; - if( !varr ) - { - delete[] edgvis; - delete[] bounds; - delete[] indices; - return; - } - narr = new TEL_POINT[alpoints->NbPoints]; - if( !narr ) - { - delete[] edgvis; - delete[] bounds; - delete[] indices; - delete[] varr; - return; - } - tarr = new TEL_TEXTURE_COORD[alpoints->NbPoints]; - - if( !tarr ) - { - delete[] edgvis; - delete[] bounds; - delete[] indices; - delete[] varr; - delete[] narr; - return; - } - for( i = 0; i < alpoints->NbPoints; i++ ) - { - varr[i].xyz[0] = alpoints->UPoints.PointsNT[i].Point.x, - varr[i].xyz[1] = alpoints->UPoints.PointsNT[i].Point.y, - varr[i].xyz[2] = alpoints->UPoints.PointsNT[i].Point.z; - - narr[i].xyz[0] = alpoints->UPoints.PointsNT[i].Normal.dx, - narr[i].xyz[1] = alpoints->UPoints.PointsNT[i].Normal.dy, - narr[i].xyz[2] = alpoints->UPoints.PointsNT[i].Normal.dz; - - tarr[i].xy[0] = alpoints->UPoints.PointsNT[i].TextureCoord.tx, - tarr[i].xy[1] = alpoints->UPoints.PointsNT[i].TextureCoord.ty; - } - k[nk].id = VERTICES_ID; - k[nk].data.pdata = varr; - nk++; - k[nk].id = VNORMALS_ID; - k[nk].data.pdata = narr; - nk++; - k[nk].id = VTEXTURECOORD_ID; - k[nk].data.pdata = tarr; - nk++; - break; - } - - for( i = 0; i < nk; i++ ) - kp[i] = &k[i]; - - - TsmAddToStructure( TelPolygonIndices, -nk, kp ); - - delete[] edgvis; - delete[] bounds; - delete[] indices; - delete[] varr; - if( tarr ) - delete[] tarr; - if( narr ) - delete[] narr; - if( carr ) - delete[] carr; - - return; -} - - -void -call_subr_polygon_set( CALL_DEF_LISTFACETS * alfacets ) -{ - CMN_KEY key[3]; - register Tint i, j, k; - - Tint num_bounds, *bounds; - tel_point points; - - num_bounds = alfacets->NbFacets; - bounds = new Tint[num_bounds]; - if( !bounds ) - return; - - for( i = 0, j = 0; i < num_bounds; i++ ) - j += alfacets->LFacets[i].NbPoints; - - points = new TEL_POINT[j]; - if( !points ) - { - delete[] bounds; - return; - } - - for( i = 0, k = 0; i < num_bounds; i++ ) - for( j = 0; j < alfacets->LFacets[i].NbPoints; j++ ) - { - points[k].xyz[0] = alfacets->LFacets[i].UPoints.Points[j].x; - points[k].xyz[1] = alfacets->LFacets[i].UPoints.Points[j].y; - points[k].xyz[2] = alfacets->LFacets[i].UPoints.Points[j].z; - k++; - } - - key[0].id = NUM_FACETS_ID; - key[0].data.ldata = num_bounds; - key[1].id = BOUNDS_DATA_ID; - key[1].data.pdata = bounds; - key[2].id = VERTICES_ID; - key[2].data.pdata = points; - TsmAddToStructure( TelPolygonSet, 3, &key[0], &key[1], &key[2] ); - - delete[] bounds; - delete[] points; - - return; -} - - -void -call_subr_quadrangle( CALL_DEF_QUAD * aquad ) -{ - CMN_KEY key[15]; - cmn_key kp[15]; - Tint nk = 0, i; - tel_point vertices, vnormals=0; - tel_texture_coord vtexturecoord=0; - - /* key[nk].id = NUM_ROWS_ID; */ - key[nk].id = NUM_COLUMNS_ID; - key[nk].data.ldata = aquad->SizeRow - 1; - nk++; - /* key[nk].id = NUM_COLUMNS_ID; */ - key[nk].id = NUM_ROWS_ID; - key[nk].data.ldata = aquad->SizeCol - 1; - nk++; - - //cmn_memreserve( vertices, aquad->NbPoints, 0 ); - vertices = new TEL_POINT[aquad->NbPoints]; - if( !vertices ) - return; - - switch( aquad->TypePoints ) - { - case 1: /* Vertex Coordinates Specified */ - for( i = 0; i < aquad->NbPoints; i++ ) - { - vertices[i].xyz[0] = aquad->UPoints.Points[i].x; - vertices[i].xyz[1] = aquad->UPoints.Points[i].y; - vertices[i].xyz[2] = aquad->UPoints.Points[i].z; - } - break; - - case 2: /* Coordinates and Vertex Normal Specified */ - //cmn_memreserve( vnormals, aquad->NbPoints, 0 ); - vnormals = new TEL_POINT[aquad->NbPoints]; - if( !vnormals ) - { - //cmn_freemem( vertices ); - delete[] vertices; - return; - } - for( i = 0; i < aquad->NbPoints; i++ ) - { - vertices[i].xyz[0] = aquad->UPoints.PointsN[i].Point.x; - vertices[i].xyz[1] = aquad->UPoints.PointsN[i].Point.y; - vertices[i].xyz[2] = aquad->UPoints.PointsN[i].Point.z; - vnormals[i].xyz[0] = aquad->UPoints.PointsN[i].Normal.dx; - vnormals[i].xyz[1] = aquad->UPoints.PointsN[i].Normal.dy; - vnormals[i].xyz[2] = aquad->UPoints.PointsN[i].Normal.dz; - } - key[nk].id = VNORMALS_ID; - key[nk].data.pdata = vnormals; - nk++; - break; - - case 5: /* Coordinates and Vertex Normal and Texture Coordinate Specified */ - vnormals = new TEL_POINT[aquad->NbPoints]; - if( !vnormals ) - { - delete[] vertices; - return; - } - vtexturecoord = new TEL_TEXTURE_COORD[aquad->NbPoints]; - if (!vtexturecoord) - { - delete[] vnormals; - delete[] vertices; - } - for( i = 0; i < aquad->NbPoints; i++ ) - { - vertices[i].xyz[0] = aquad->UPoints.PointsNT[i].Point.x; - vertices[i].xyz[1] = aquad->UPoints.PointsNT[i].Point.y; - vertices[i].xyz[2] = aquad->UPoints.PointsNT[i].Point.z; - vnormals[i].xyz[0] = aquad->UPoints.PointsNT[i].Normal.dx; - vnormals[i].xyz[1] = aquad->UPoints.PointsNT[i].Normal.dy; - vnormals[i].xyz[2] = aquad->UPoints.PointsNT[i].Normal.dz; - vtexturecoord[i].xy[0] = aquad->UPoints.PointsNT[i].TextureCoord.tx; - vtexturecoord[i].xy[1] = aquad->UPoints.PointsNT[i].TextureCoord.ty; - } - key[nk].id = VNORMALS_ID; - key[nk].data.pdata = vnormals; - nk++; - key[nk].id = VTEXTURECOORD_ID; - key[nk].data.pdata = vtexturecoord; - nk++; - break; - } - - key[nk].id = VERTICES_ID; - key[nk].data.pdata = vertices; - nk++; - - for( i = 0; i < nk; i++ ) - kp[i] = &key[i]; - - TsmAddToStructure( TelQuadrangle, -nk, kp ); - - delete[] vertices; - if (vtexturecoord) - delete[] vtexturecoord; - if( vnormals ) - delete[] vnormals; - - return; -} - -void -call_subr_set_text_colr( Tfloat r, Tfloat g, Tfloat b ) -{ - CMN_KEY key; - TEL_COLOUR col; - - col.rgb[0] = r, - col.rgb[1] = g, - col.rgb[2] = b; - key.data.pdata = &col; - TsmAddToStructure( TelTextColour, 1, &key ); - - return; -} - -void -call_subr_set_text_colr_subtitle( Tfloat r, Tfloat g, Tfloat b ) -{ - CMN_KEY key; - TEL_COLOUR col; - - col.rgb[0] = r, - col.rgb[1] = g, - col.rgb[2] = b; - key.data.pdata = &col; - TsmAddToStructure( TelTextColourSubTitle, 1, &key ); - - return; -} - - -void -call_subr_triangle( CALL_DEF_TRIKE * atrike ) -{ - Tint i; - tel_point vertices, vnormals=0; - tel_texture_coord vtexturecoord=0; - CMN_KEY key[15]; - cmn_key kp[15]; - Tint nk = 0; - - vertices = new TEL_POINT[atrike->NbPoints]; - if( !vertices ) - return; - - switch( atrike->TypePoints ) - { - case 1: /* Vertex Coordinates Specified */ - for( i = 0; i < atrike->NbPoints; i++ ) - { - vertices[i].xyz[0] = atrike->UPoints.Points[i].x; - vertices[i].xyz[1] = atrike->UPoints.Points[i].y; - vertices[i].xyz[2] = atrike->UPoints.Points[i].z; - } - break; - - case 2: /* Coordinates and Vertex Normal Specified */ - vnormals = new TEL_POINT[atrike->NbPoints]; - if( !vnormals ) - { - delete[] vertices; - return; - } - for( i = 0; i < atrike->NbPoints; i++ ) - { - vertices[i].xyz[0] = atrike->UPoints.PointsN[i].Point.x; - vertices[i].xyz[1] = atrike->UPoints.PointsN[i].Point.y; - vertices[i].xyz[2] = atrike->UPoints.PointsN[i].Point.z; - vnormals[i].xyz[0] = atrike->UPoints.PointsN[i].Normal.dx; - vnormals[i].xyz[1] = atrike->UPoints.PointsN[i].Normal.dy; - vnormals[i].xyz[2] = atrike->UPoints.PointsN[i].Normal.dz; - } - key[nk].id = VNORMALS_ID; - key[nk].data.pdata = vnormals; - nk++; - break; - case 5: /* Coordinates and Vertex Normal and Texture Coordinates Specified */ - vnormals = new TEL_POINT[atrike->NbPoints]; - if( !vnormals ) - { - delete[] vertices; - return; - } - vtexturecoord = new TEL_TEXTURE_COORD[atrike->NbPoints]; - if (!vtexturecoord) - { - delete[] vnormals; - delete[] vertices; - } - for( i = 0; i < atrike->NbPoints; i++ ) - { - vertices[i].xyz[0] = atrike->UPoints.PointsNT[i].Point.x; - vertices[i].xyz[1] = atrike->UPoints.PointsNT[i].Point.y; - vertices[i].xyz[2] = atrike->UPoints.PointsNT[i].Point.z; - vnormals[i].xyz[0] = atrike->UPoints.PointsNT[i].Normal.dx; - vnormals[i].xyz[1] = atrike->UPoints.PointsNT[i].Normal.dy; - vnormals[i].xyz[2] = atrike->UPoints.PointsNT[i].Normal.dz; - vtexturecoord[i].xy[0] = atrike->UPoints.PointsNT[i].TextureCoord.tx; - vtexturecoord[i].xy[1] = atrike->UPoints.PointsNT[i].TextureCoord.ty; - } - key[nk].id = VNORMALS_ID; - key[nk].data.pdata = vnormals; - nk++; - key[nk].id = VTEXTURECOORD_ID; - key[nk].data.pdata = vtexturecoord; - nk++; - break; - } - - key[nk].id = NUM_FACETS_ID; - key[nk].data.ldata = atrike->NbPoints-2; - nk++; - - key[nk].id = VERTICES_ID; - key[nk].data.pdata = vertices; - nk++; - - for( i = 0; i < nk; i++ ) - kp[i] = &key[i]; - - TsmAddToStructure( TelTriangleMesh, -nk, kp ); - - delete[] vertices; - if( vnormals ) - delete[] vnormals; - - return; -} - - -void -call_subr_set_highl_rep( Tint ind ) -{ - CMN_KEY key; - - key.data.ldata = ind; - TsmAddToStructure( TelHighlightIndex, 1, &key ); - - return; -} - - -#define CALL_ 128 - -void -call_subr_structure_exploration( Tint Id, - Tint LabelBegin, - Tint LabelEnd, - Tint elem_num, - Tint *elem_type, - CALL_DEF_POINT *pt, - CALL_DEF_NORMAL *npt, - CALL_DEF_COLOR *cpt, - CALL_DEF_NORMAL *nfa ) -{ -#define CALL_MAX_ELEMS_PRINT 1000000 - Tfloat r=0, g=0, b=0; - Tfloat x=0, y=0, z=0; - Tfloat nx=0, ny=0, nz=0; - Tfloat dx=0, dy=0, dz=0; - - static Tint Initialisation = 1; - - Tchar *buffer=NULL; - Tint actual_size; /* OUT content size */ - Tint err=0; /* OUT error indicator */ - TelType type; /* OUT element type */ - Tint size; /* OUT element size */ - Tint ws; /* OUT workstation */ - - Tint index; /* element pointer value */ - Tint cur_index; /* OUT element pointer value */ - Teldata data; /* OUT data record */ - - register int i, j; - Tint MAXPOINTS; - Tint MAXAREAS; - - static Tint idata, jdata, kdata; - - Tint printall; /* print all structure elements or not */ - Tint dump; /* print or not */ - - static Tint IdCur; /* current structure id - (for exploration step by step) */ - static Tint ElCur; /* current structure element number - (for exploration step by step) */ - static Tint IndCur; /* current index point in the structure element - (for exploration step by step) */ - static Tint JndCur; /* current index element in the structure element - (for exploration step by step) */ - static Tint EndExplo;/* flag when the exploration of the current - element is done. - (for exploration step by step) */ - - if( Initialisation ) - { - Initialisation = 0; - IdCur = -1; - ElCur = -1; - IndCur = -1; - JndCur = 0; - } - - dump = 0; - printall = 1; - MAXPOINTS = CALL_MAX_ELEMS_PRINT; - MAXAREAS = CALL_MAX_ELEMS_PRINT; - - if( (LabelBegin == 0) && (LabelEnd == 0) ) - { - dump = 1; - printall = 0; - } - - if( elem_num ) - { - index = elem_num; - dump = 1; - printall = 1; - - npt->dx = npt->dy = npt->dz = nx = ny = nz = ( float )0.0; - nfa->dx = nfa->dy = nfa->dz = dx = dy = dz = ( float )0.0; - pt->x = pt->y = pt->z = x = y = z = ( float )0.0; - cpt->r = cpt->g = cpt->b = r = g = b = ( float )0.0; - - if ( (Id != IdCur) || (ElCur != elem_num) || EndExplo ) - { - IdCur = Id; - ElCur = elem_num; - IndCur = -1; - JndCur = 0; - } - else - { - IndCur ++; - } - } - else - { - index = 1; - IdCur = -1; - ElCur = -1; - IndCur = -1; - JndCur = 0; - } - - call_func_open_struct (Id); - - while( index ) - { - call_func_set_elem_ptr( index ); - if( call_func_inq_elem_ptr( &cur_index ) == TFailure ) - err = 1; - else - err = 0; - - /* it's the end */ - if( ( index != cur_index ) || err ) - { - index = 0; - break; - } - if( TelInqCurElemTypeSize( &type, &size ) == TFailure ) - err = 1; - else - err = 0; - - if( err || (type == CALL_PHIGS_ELEM_NIL) ) - { - index = 0; - break; - } - - if( elem_num ) - { - EndExplo = 0; - *elem_type = type; - } - - if( type == CALL_PHIGS_ELEM_LABEL ) - { - buffer = (Tchar *)malloc( CALL_ ); - TelInqCurElemContent( CALL_, buffer, &actual_size, &data ); - - if( data.idata == LabelBegin ) - dump = 1; - if( ( LabelBegin == 0 ) && ( LabelEnd == 0 ) ) - dump = 1; - if( dump ) - { - if( elem_num ) - { - if( IndCur >= 1 ) - { - EndExplo = 1; - } - else - { - x = ( float )data.idata; - y = ( float )0.0; - z = ( float )0.0; - } - } - else - { - printf( "\tELEM_LABEL\n" ); - printf( "\t\tLABEL %d\n", data.idata ); - } - } - - if( data.idata == LabelEnd ) - dump = 0; - - free( buffer ); - } - - if( dump ) - { - switch (type) - { - case CALL_PHIGS_ELEM_NIL : - { - if( elem_num ) - { - if (IndCur >= 0) - { - EndExplo = 1; - } - else - { - x = y = z = ( float )0.0; - } - } - else - { - printf("\tELEM_NIL\n"); - printf("\t\tNo data involved\n"); - } - break; - } - case CALL_PHIGS_ELEM_POLYMARKER3 : - { - i = size; - buffer = new Tchar[i]; - TelInqCurElemContent( i, buffer, &actual_size, &data ); - idata = size/sizeof( TEL_POINT ); - if( elem_num ) - { - if( (IndCur > -1) && (IndCur < idata) ) - { - i = IndCur; - x = data.pts3[i].xyz[0]; - y = data.pts3[i].xyz[1]; - z = data.pts3[i].xyz[2]; - } - if (IndCur >= idata) - EndExplo = 1; - } - else - { - printf("\tELEM_POLYMARKER3\n"); - printf("\t\tPOLYMARKER 3 nb pts %d\n", idata); - if (printall) - { - for (i=0; i= jdata) - EndExplo = 1; - else - { - if (IndCur == 0) - { - idata = data.fillareaset3data.bounds[JndCur]; - } - else - { - if ((IndCur > -1) && (IndCur < idata)) - { - x = - data.fillareaset3data.points[kdata+IndCur].xyz[0]; - y = - data.fillareaset3data.points[kdata+IndCur].xyz[1]; - z = - data.fillareaset3data.points[kdata+IndCur].xyz[2]; - - if(data.fillareaset3data.vrtflag == - CALL_PHIGS_VERT_COORD_NORMAL) - { - nx = data.fillareaset3data.vnormals[IndCur].xyz[0]; - ny = data.fillareaset3data.vnormals[IndCur].xyz[1]; - nz = data.fillareaset3data.vnormals[IndCur].xyz[2]; - } - if(data.fillareaset3data.vrtflag == - CALL_PHIGS_VERT_COORD_COLOUR) - { - r = - data.fillareaset3data.colours[kdata+IndCur].rgb[0]; - g = - data.fillareaset3data.colours[kdata+IndCur].rgb[1]; - b = - data.fillareaset3data.colours[kdata+IndCur].rgb[2]; - } - if (data.fillareaset3data.vrtflag == - CALL_PHIGS_VERT_COORD_COLOUR_NORMAL) - { - nx = data.fillareaset3data.vnormals[IndCur].xyz[0]; - ny = data.fillareaset3data.vnormals[IndCur].xyz[1]; - nz = data.fillareaset3data.vnormals[IndCur].xyz[2]; - r = - data.fillareaset3data.colours[kdata+IndCur].rgb[0]; - g = - data.fillareaset3data.colours[kdata+IndCur].rgb[1]; - b = - data.fillareaset3data.colours[kdata+IndCur].rgb[2]; - } - } - } - if (IndCur >= idata) - { - kdata += data.fillareaset3data.bounds[JndCur]; - JndCur ++; - IndCur = 0; - } - } - } - else - { - printf("\tELEM_FILL_AREA_SET3_DATA\n"); - printf("\t\tSET OF FILL AREA SET 3 WITH DATA\n"); - kdata = 0; - printf("\t\tnb of faces %d\n", jdata); - printf("\t\tfflag %d eflag %d vflag %d colr model RGB\n", - data.fillareaset3data.faflag, - data.fillareaset3data.edgflag, - data.fillareaset3data.vrtflag ); - kdata = 0; - for (j=0; j -1) && (IndCur < idata) ) - { - i = IndCur; - x = data.fillarea3data.points[i].xyz[0]; - y = data.fillarea3data.points[i].xyz[1]; - z = data.fillarea3data.points[i].xyz[2]; - } - if( IndCur >= idata ) - EndExplo = 1; - } - else - { - printf( "\tELEM_FILL_AREA3\n" ); - printf( "\t\tFILL AREA 3 nb pts %d\n", idata ); - if( printall ) - { - for( i=0; i= 2 ) - EndExplo = 1; - } - else - { - printf( "\tELEM_ANNO_TEXT_REL3\n" ); - printf( "\t\tANNOTATION TEXT RELATIVE 3 %S\n", - data.atext3.string ); - printf( "\t\treference point %f %f %f\n", - data.atext3.ref_pt.xyz[0], - data.atext3.ref_pt.xyz[1], - data.atext3.ref_pt.xyz[2] ); - printf( "\t\toffset %f %f %f\n", - data.atext3.anno.xyz[0], - data.atext3.anno.xyz[1], - data.atext3.anno.xyz[2] ); - } - delete[] buffer; - break; - } - case CALL_PHIGS_ELEM_LINETYPE : - { - TelInqCurElemContent( 0, buffer, &actual_size, &data ); - if( elem_num ) - { - if (IndCur >= 1) - EndExplo = 1; - else - { - x = ( float )data.idata; - y = ( float )0.0; - z = ( float )0.0; - } - } - else { - printf("\tELEM_LINETYPE\n"); - printf("\t\tLINETYPE %d\n", data.idata); - } - break; - } - case CALL_PHIGS_ELEM_LINEWIDTH : - { - TelInqCurElemContent( 0, buffer, &actual_size, &data ); - if( elem_num ) - { - if (IndCur >= 1) - EndExplo = 1; - else - { - x = data.fdata; - y = ( float )0.0; - z = ( float )0.0; - } - } - else - { - printf( "\tELEM_LINEWIDTH\n" ); - printf( "\t\tLINEWIDTH SCALE FACTOR %f\n", data.fdata); - } - break; - } - case CALL_PHIGS_ELEM_MARKER_TYPE : - { - TelInqCurElemContent( 0, buffer, &actual_size, &data ); - if( elem_num ) - { - if( IndCur >= 1 ) - EndExplo = 1; - else - { - x = ( float )data.idata; - y = ( float )0.0; - z = ( float )0.0; - } - } - else - { - printf("\tELEM_MARKER_TYPE\n"); - printf("\t\tMARKER TYPE %d\n", data.idata); - } - break; - } - case CALL_PHIGS_ELEM_MARKER_SIZE : - { - TelInqCurElemContent( 0, buffer, &actual_size, &data ); - if( elem_num ) - { - if (IndCur >= 1) - EndExplo = 1; - else - { - x = data.fdata; - y = ( float )0.0; - z = ( float )0.0; - } - } - else - { - printf("\tELEM_MARKER_SIZE\n"); - printf("\t\tMARKER SIZE SCALE FACTOR %f\n", data.fdata); - } - break; - } -#if 0 - case CALL_PHIGS_ELEM_TEXT_FONT : /* DECPHIGS */ - buffer = new Tchar[CALL_]; - TelInqCurElemContent (CALL_, buffer, &actual_size, &data); - if( elem_num ) - if (IndCur >= 1) - EndExplo = 1; - else { - x = data.idata; - y = 0.0; - z = 0.0; - } - else { - printf("\tELEM_TEXT_FONT\n"); - printf("\t\tTEXT FONT %d\n", data.idata); - } - delete[] buffer; - break; -#endif - case CALL_PHIGS_ELEM_CHAR_EXPAN : - { - TelInqCurElemContent( 0, buffer, &actual_size, &data ); - if( elem_num ) - { - if (IndCur >= 1) - EndExplo = 1; - else - { - x = data.fdata; - y = ( float )0.0; - z = ( float )0.0; - } - } - else - { - printf("\tELEM_CHAR_EXPAN\n"); - printf("\t\tCHARACTER EXPANSION FACTOR %f\n",data.fdata); - } - break; - } - case CALL_PHIGS_ELEM_CHAR_SPACE : - { - TelInqCurElemContent( 0, buffer, &actual_size, &data ); - if( elem_num ) - { - if (IndCur >= 1) - EndExplo = 1; - else - { - x = data.fdata; - y = ( float )0.0; - z = ( float )0.0; - } - } - else - { - printf("\tELEM_CHAR_SPACE\n"); - printf("\t\tCHARACTER SPACING %f\n", data.fdata); - } - break; - } - case CALL_PHIGS_ELEM_ANNO_CHAR_HT : - { - TelInqCurElemContent( 0, buffer, &actual_size, &data ); - if( elem_num ) - { - if (IndCur >= 1) - EndExplo = 1; - else - { - x = data.fdata; - y = ( float )0.0; - z = ( float )0.0; - } - } - else - { - printf("\tELEM_ANNO_CHAR_HT\n"); - printf("\t\tANNOTATION TEXT CHARACTER HEIGHT %f\n", - data.fdata); - } - break; - } - case CALL_PHIGS_ELEM_INT_STYLE : - { - TelInqCurElemContent( 0, buffer, &actual_size, &data ); - if( elem_num ) - { - if (IndCur >= 1) - EndExplo = 1; - else - { - x = ( float )data.interior_style; - y = ( float )0.0; - z = ( float )0.0; - } - } - else - { - printf("\tELEM_INT_STYLE\n"); - printf("\t\tINTERIOR STYLE %d\n", data.interior_style); - } - break; - } - case CALL_PHIGS_ELEM_INT_STYLE_IND : - { - TelInqCurElemContent( 0, buffer, &actual_size, &data ); - if( elem_num ) - { - if (IndCur >= 1) - EndExplo = 1; - else - { - x = ( float )data.idata; - y = ( float )0.0; - z = ( float )0.0; - } - } - else - { - printf("\tELEM_INT_STYLE_IND\n"); - printf("\t\tINTERIOR STYLE INDEX %d\n", data.idata); - } - break; - } - case CALL_PHIGS_ELEM_EDGE_FLAG : - { - TelInqCurElemContent( 0, buffer, &actual_size, &data ); - if( elem_num ) - { - if (IndCur >= 1) - EndExplo = 1; - else - { - x = ( float )data.edge_flag; - y = ( float )0.0; - z = ( float )0.0; - } - } - else - { - printf("\tELEM_EDGE_FLAG\n"); - printf("\t\tEDGE FLAG %d\n", data.edge_flag); - } - break; - } - case CALL_PHIGS_ELEM_EDGETYPE : - { - TelInqCurElemContent( 0, buffer, &actual_size, &data ); - if( elem_num ) - { - if (IndCur >= 1) - EndExplo = 1; - else - { - x = ( float )data.idata; - y = ( float )0.0; - z = ( float )0.0; - } - } - else - { - printf("\tELEM_EDGETYPE\n"); - printf("\t\tEDGETYPE %d\n", data.idata); - } - break; - } - case CALL_PHIGS_ELEM_EDGEWIDTH : - { - TelInqCurElemContent( 0, buffer, &actual_size, &data ); - if( elem_num ) - { - if (IndCur >= 1) - EndExplo = 1; - else - { - x = data.fdata; - y = ( float )0.0; - z = ( float )0.0; - } - } - else - { - printf("\tELEM_EDGEWIDTH\n"); - printf("\t\tEDGEWIDTH SCALE FACTOR %f\n", data.fdata); - } - break; - } - case CALL_PHIGS_ELEM_ADD_NAMES_SET : - { - buffer = new Tchar[size]; - TelInqCurElemContent( size, buffer, &actual_size, &data ); - idata = data.name_set.number; - if( elem_num ) - { - if( (IndCur > -1) && (IndCur < idata) ) - { - i = IndCur; - x = ( float )data.name_set.integers[i]; - y = ( float )0.0; - z = ( float )0.0; - } - if( IndCur >= idata ) - EndExplo = 1; - } - else - { - printf("\tELEM_ADD_NAMES_SET\n"); - printf("\t\tADD NAMES TO SET\n"); - for( i=0; i -1) && (IndCur < idata) ) - { - i = IndCur; - x = ( float )data.name_set.integers[i]; - y = ( float )0.0; - z = ( float )0.0; - } - if (IndCur >= idata) - EndExplo = 1; - } - else - { - printf("\tELEM_REMOVE_NAMES_SET\n"); - printf("\t\tREMOVE NAMES FROM SET\n"); - for( i=0; i= 0) - EndExplo = 1; - else - { - x = y = z = ( float )0.0; - } - } - else - { - printf("\tELEM_LOCAL_MODEL_TRAN3\n"); - printf("\t\tLOCAL MODELLING TRANSFORMATION 3 comp %d\n", - data.local_xform_3.compose_type); - for( i=0; i<4; i++ ) - { - printf("\t\t\t"); - for( j=0; j<4; j++ ) - printf(" %f", data.local_xform_3.mat3[i][j]); - printf("\n"); - } - } - break; - } - case CALL_PHIGS_ELEM_VIEW_IND : - { - TelInqCurElemContent( 0, buffer, &actual_size, &data ); - if( elem_num ) - { - if (IndCur >= 1) - EndExplo = 1; - else - { - x = ( float )data.idata; - y = ( float )0.0; - z = ( float )0.0; - } - } - else - { - printf("\tELEM_VIEW_IND\n"); - printf("\t\tVIEW INDEX %d\n", data.idata); - - if(! call_subr_inquirews (Id, &ws)) - printf("\t\tERROR : no view definition\n"); - else - { - printf("\t\tview structure in %d workstation\n", ws); - printf("\t\t**********************\n"); - printf("\t\tdefinition in the ws %d\n", ws); - printf("\t\t**********************\n"); - TelPrintViewRepresentation( ws, Id ); - } - } - break; - } - case CALL_PHIGS_ELEM_EXEC_STRUCT : - { - TelInqCurElemContent( 0, buffer, &actual_size, &data ); - if( elem_num ) - { - if (IndCur >= 1) - EndExplo = 1; - else - { - x = ( float )data.idata; - y = ( float )0.0; - z = ( float )0.0; - } - } - else - { - printf("\tELEM_EXEC_STRUCT\n"); - printf("\t\tEXECUTE STRUCTURE %d\n", data.idata); - } - break; - } - case CALL_PHIGS_ELEM_APPL_DATA : - { - TelInqCurElemContent( 0, buffer, &actual_size, &data ); - if( elem_num ) - { - if (IndCur >= 0) - EndExplo = 1; - else - { - x = y = z = ( float )0.0; - } - } - else - { - printf("\tELEM_APPL_DATA\n"); - printf("\t\tcontent not exploited\n"); - } - break; - } - case CALL_PHIGS_ELEM_PICK_ID : - { - TelInqCurElemContent( 0, buffer, &actual_size, &data ); - if( elem_num ) - { - if (IndCur >= 1) - EndExplo = 1; - else - { - x = ( float )data.idata; - y = ( float )0.0; - z = ( float )0.0; - } - } - else - { - printf("\tELEM_PICK_ID\n"); - printf("\t\tPICK ID %d\n", data.idata); - } - break; - } - case CALL_PHIGS_ELEM_POLYLINE_SET3_DATA : /* DECPHIGS */ - { - buffer = new Tchar[size]; - TelInqCurElemContent( size, buffer, &actual_size, &data); - jdata = data.lineset3data.num_bounds; - - if( elem_num ) - { - if( ( IndCur == -1 ) && ( JndCur == 0 ) ) - kdata = 0; - - if( JndCur >= jdata ) - EndExplo = 1; - else - { - if (IndCur == 0) - { - idata = data.lineset3data.bounds[JndCur]; - } - else - { - if ( ( IndCur > -1 ) && ( IndCur < idata ) ) - { - x = data.lineset3data.points[kdata+IndCur].xyz[0]; - y = data.lineset3data.points[kdata+IndCur].xyz[1]; - z = data.lineset3data.points[kdata+IndCur].xyz[2]; - - if( data.lineset3data.colours ) - { - r = - data.lineset3data.colours[kdata+IndCur].rgb[0]; - g = - data.lineset3data.colours[kdata+IndCur].rgb[1]; - b = - data.lineset3data.colours[kdata+IndCur].rgb[2]; - } - } - - if( IndCur >= idata ) - { - kdata += data.lineset3data.bounds[JndCur]; - JndCur ++; - IndCur = 0; - } - } - } - } - else - { - printf( "\tELEM_POLYLINE_SET3_DATA\n" ); - kdata = 0; - printf( "\t\tPOLYLINE SET 3 WITH DATA\n" ); - printf( "\t\tnb of lines %d\n", jdata ); - printf( "\t\tvflag %d colr model RGB\n", - data.lineset3data.vrtflag ); - for( j = 0; j < jdata && j < MAXAREAS; j++ ) - { - idata = data.lineset3data.bounds[j]; - printf( "\t\tface %d : %d vertices\n", j, idata ); - if( printall ) - { - for( i = 0; i < idata && i < MAXPOINTS; i++ ) - printf( "\t\t\tvertex %d : %f %f %f\n", i, - data.lineset3data.points[kdata+i].xyz[0], - data.lineset3data.points[kdata+i].xyz[1], - data.lineset3data.points[kdata+i].xyz[2] ); - } - else - { - i = 0; - printf( "\t\tfirst vertex %d : %f %f %f\n", i, - data.lineset3data.points[kdata+i].xyz[0], - data.lineset3data.points[kdata+i].xyz[1], - data.lineset3data.points[kdata+i].xyz[2] ); - - i = idata - 1; - printf( "\t\tlast vertex %d : %f %f %f\n", i, - data.lineset3data.points[kdata+i].xyz[0], - data.lineset3data.points[kdata+i].xyz[1], - data.lineset3data.points[kdata+i].xyz[2] ); - } - kdata += data.lineset3data.bounds[j]; - } - } - delete[] buffer; - break; - } - case CALL_PHIGS_ELEM_TRI_STRIP3_DATA : - { - buffer = new Tchar[size]; - TelInqCurElemContent( size, buffer, &actual_size, &data ); - idata = data.trianglestrip3data.num_facets + 2; - - if( elem_num ) - { - if (IndCur >= idata) - EndExplo = 1; - else - { - x = data.trianglestrip3data.points[IndCur].xyz[0]; - y = data.trianglestrip3data.points[IndCur].xyz[1]; - z = data.trianglestrip3data.points[IndCur].xyz[2]; - - if( data.trianglestrip3data.vrtflag == - CALL_PHIGS_VERT_COORD_COLOUR ) - { - r = data.trianglestrip3data.colours[IndCur].rgb[0]; - g = data.trianglestrip3data.colours[IndCur].rgb[1]; - b = data.trianglestrip3data.colours[IndCur].rgb[2]; - } - else if( data.trianglestrip3data.vrtflag == - CALL_PHIGS_VERT_COORD_NORMAL ) - { - nx = - data.trianglestrip3data.vnormals[IndCur].xyz[0]; - ny = - data.trianglestrip3data.vnormals[IndCur].xyz[1]; - nz = - data.trianglestrip3data.vnormals[IndCur].xyz[2]; - } - else if( data.trianglestrip3data.vrtflag == - CALL_PHIGS_VERT_COORD_COLOUR_NORMAL ) - { - nx = - data.trianglestrip3data.vnormals[IndCur].xyz[0]; - ny = - data.trianglestrip3data.vnormals[IndCur].xyz[1]; - nz = - data.trianglestrip3data.vnormals[IndCur].xyz[2]; - r = data.trianglestrip3data.colours[IndCur].rgb[0]; - g = data.trianglestrip3data.colours[IndCur].rgb[1]; - b = data.trianglestrip3data.colours[IndCur].rgb[2]; - } - } - } - else - { - printf("\tELEM_TRI_STRIP3_DATA\n"); - printf("\t\tTRIANGLE STRIP 3 WITH DATA\n"); - printf("\t\tnb of vertices %d\n", idata); - printf("\t\tfflag %d vflag %d colr model RGB\n", - data.trianglestrip3data.fctflag, - data.trianglestrip3data.vrtflag); - if( printall ) - for( i=0; i= idata) - EndExplo = 1; - else - { - x = data.quadmesh3data.points[IndCur].xyz[0]; - y = data.quadmesh3data.points[IndCur].xyz[1]; - z = data.quadmesh3data.points[IndCur].xyz[2]; - - if( data.quadmesh3data.vrtflag == - CALL_PHIGS_VERT_COORD_COLOUR ) - { - r = data.quadmesh3data.colours[IndCur].rgb[0]; - g = data.quadmesh3data.colours[IndCur].rgb[1]; - b = data.quadmesh3data.colours[IndCur].rgb[2]; - } - else if( data.quadmesh3data.vrtflag == - CALL_PHIGS_VERT_COORD_NORMAL ) - { - nx = data.quadmesh3data.vnormals[IndCur].xyz[0]; - ny = data.quadmesh3data.vnormals[IndCur].xyz[1]; - nz = data.quadmesh3data.vnormals[IndCur].xyz[2]; - } - else if( data.quadmesh3data.vrtflag == - CALL_PHIGS_VERT_COORD_COLOUR_NORMAL ) - { - nx = data.quadmesh3data.vnormals[IndCur].xyz[0]; - ny = data.quadmesh3data.vnormals[IndCur].xyz[1]; - nz = data.quadmesh3data.vnormals[IndCur].xyz[2]; - r = data.quadmesh3data.colours[IndCur].rgb[0]; - g = data.quadmesh3data.colours[IndCur].rgb[1]; - b = data.quadmesh3data.colours[IndCur].rgb[2]; - } - } - } - else - { - printf("\tELEM_QUAD_MESH3_DATA\n"); - printf("\t\tQUADRILATERAL MESH 3 WITH DATA\n"); - printf("\t\tdimensions %d %d\n", - data.quadmesh3data.dim.x_dim, - data.quadmesh3data.dim.y_dim); - printf("\t\tnb of vertices %d\n", idata); - printf("\t\tfflag %d vflag %d colr model RGB\n", - data.quadmesh3data.fctflag, - data.quadmesh3data.vrtflag); - if( printall ) - { - for( i=0; i= 1) - EndExplo = 1; - else - { - x = data.gnl_colour.rgb[0]; - y = data.gnl_colour.rgb[1]; - z = data.gnl_colour.rgb[2]; - } - } - else - { - printf("\tELEM_TEXT_COLR\n"); - printf("\t\tTEXT COLOUR r %f g %f b %f\n", - data.gnl_colour.rgb[0], - data.gnl_colour.rgb[1], - data.gnl_colour.rgb[2] ); - } - break; - } - case CALL_PHIGS_ELEM_MARKER_COLR : - { - TelInqCurElemContent( 0, buffer, &actual_size, &data ); - if( elem_num ) - { - if (IndCur >= 1) - EndExplo = 1; - else - { - x = data.gnl_colour.rgb[0]; - y = data.gnl_colour.rgb[1]; - z = data.gnl_colour.rgb[2]; - } - } - else - { - printf("\tELEM_MARKER_COLR\n"); - printf("\t\tPOLYMARKER COLOUR r %f g %f b %f\n", - data.gnl_colour.rgb[0], - data.gnl_colour.rgb[1], - data.gnl_colour.rgb[2] ); - } - break; - } - case CALL_PHIGS_ELEM_EDGE_COLR : - { - TelInqCurElemContent( 0, buffer, &actual_size, &data ); - if( elem_num ) - { - if (IndCur >= 1) - EndExplo = 1; - else - { - x = data.gnl_colour.rgb[0]; - y = data.gnl_colour.rgb[1]; - z = data.gnl_colour.rgb[2]; - } - } - else - { - printf("\tELEM_EDGE_COLR\n"); - printf("\t\tEDGE COLOUR r %f g %f b %f\n", - data.gnl_colour.rgb[0], - data.gnl_colour.rgb[1], - data.gnl_colour.rgb[2]); - } - break; - } - case CALL_PHIGS_ELEM_LINE_COLR : - { - TelInqCurElemContent( 0, buffer, &actual_size, &data ); - if( elem_num ) - { - if (IndCur >= 1) - EndExplo = 1; - else - { - x = data.gnl_colour.rgb[0]; - y = data.gnl_colour.rgb[1]; - z = data.gnl_colour.rgb[2]; - } - } - else - { - printf("\tELEM_LINE_COLR\n"); - printf("\t\tPOLYLINE COLOUR r %f g %f b %f\n", - data.gnl_colour.rgb[0], - data.gnl_colour.rgb[1], - data.gnl_colour.rgb[2]); - } - break; - } - case CALL_PHIGS_ELEM_INT_COLR : - { - TelInqCurElemContent( 0, buffer, &actual_size, &data ); - if( elem_num ) - { - if (IndCur >= 1) - EndExplo = 1; - else - { - x = data.gnl_colour.rgb[0]; - y = data.gnl_colour.rgb[1]; - z = data.gnl_colour.rgb[2]; - } - } - else - { - printf("\tELEM_INT_COLR\n"); - printf("\t\tINTERIOR COLOUR r %f g %f b %f\n", - data.gnl_colour.rgb[0], - data.gnl_colour.rgb[1], - data.gnl_colour.rgb[2]); - } - break; - } - case CALL_PHIGS_ELEM_BACK_INT_COLR : - { - TelInqCurElemContent( 0, buffer, &actual_size, &data ); - if( elem_num ) - { - if (IndCur >= 1) - EndExplo = 1; - else - { - x = data.gnl_colour.rgb[0]; - y = data.gnl_colour.rgb[1]; - z = data.gnl_colour.rgb[2]; - } - } - else - { - printf("\tELEM_BACK_INT_COLR\n"); - printf("\t\tBACK INTERIOR COLOUR r %f g %f b %f\n", - data.gnl_colour.rgb[0], - data.gnl_colour.rgb[1], - data.gnl_colour.rgb[2]); - } - break; - } - case CALL_PHIGS_ELEM_REFL_PROPS : - { - TelInqCurElemContent( 0, buffer, &actual_size, &data ); - if( elem_num ) - { - if (IndCur == 0) - { - x = data.surf_prop.amb; - y = data.surf_prop.diff; - z = data.surf_prop.trans; - } - if (IndCur == 1) - { - x = data.surf_prop.speccol.rgb[0]; - y = data.surf_prop.speccol.rgb[1]; - z = data.surf_prop.speccol.rgb[2]; - } - if (IndCur == 2) - { - x = data.surf_prop.spec; - y = data.surf_prop.shine; - z = ( float )0.0; - } - if (IndCur >= 3) - EndExplo = 1; - } - else - { - printf("\tELEM_REFL_PROPS\n"); - printf("\t\tREFLECTANCE PROPERTIES\n"); - printf("\t\tamb coef %f diff coef %f trans coef %f\n", - data.surf_prop.amb, - data.surf_prop.diff, - data.surf_prop.trans); - printf("\t\tspecular color r %f g %f b %f\n", - data.surf_prop.speccol.rgb[0], - data.surf_prop.speccol.rgb[1], - data.surf_prop.speccol.rgb[2]); - printf("\t\tspecular coef %f exp %f\n", - data.surf_prop.spec, - data.surf_prop.shine); - } - break; - } - case CALL_PHIGS_ELEM_BACK_REFL_PROPS : - { - TelInqCurElemContent( 0, buffer, &actual_size, &data ); - if( elem_num ) - { - if (IndCur == 0) { - x = data.surf_prop.amb; - y = data.surf_prop.diff; - z = data.surf_prop.trans; - } - if (IndCur == 1) { - x = data.surf_prop.speccol.rgb[0]; - y = data.surf_prop.speccol.rgb[1]; - z = data.surf_prop.speccol.rgb[2]; - } - if (IndCur == 2) { - x = data.surf_prop.spec; - y = data.surf_prop.shine; - z = ( float )0.0; - } - if (IndCur >= 3) - EndExplo = 1; - } - else - { - printf("\tELEM_BACK_REFL_PROPS\n"); - printf("\t\tBACK REFLECTANCE PROPERTIES\n"); - printf("\t\tamb coef %f diff coef %f trans coef %f\n", - data.surf_prop.amb, - data.surf_prop.diff, - data.surf_prop.trans); - printf("\t\tspecular color r %f g %f b %f\n", - data.surf_prop.speccol.rgb[0], - data.surf_prop.speccol.rgb[1], - data.surf_prop.speccol.rgb[2]); - printf("\t\tspecular coef %f exp %f\n", - data.surf_prop.spec, - data.surf_prop.shine); - } - break; - } - case CALL_PHIGS_ELEM_INT_SHAD_METH : - { - TelInqCurElemContent( 0, buffer, &actual_size, &data ); - if( elem_num ) - { - if (IndCur >= 1) - EndExplo = 1; - else - { - x = ( float )data.idata; - y = ( float )0.0; - z = ( float )0.0; - } - } - else - { - printf("\tELEM_INT_SHAD_METH\n"); - printf("\t\tINTERIOR SHADING METHOD %d\n", data.idata); - } - break; - } - case CALL_PHIGS_ELEM_INT_REFL_EQN : - { - TelInqCurElemContent( 0, buffer, &actual_size, &data ); - if( elem_num ) - { - if (IndCur >= 1) - EndExplo = 1; - else - { - x = ( float )data.idata; - y = ( float )0.0; - z = ( float )0.0; - } - } - else - { - printf("\tELEM_INT_REFL_EQN\n"); - printf("\t\tREFLECTANCE EQUATION %d\n", data.idata); - } - break; - } - case CALL_PHIGS_ELEM_BACK_INT_REFL_EQN : - { - TelInqCurElemContent( 0, buffer, &actual_size, &data ); - if( elem_num ) - { - if (IndCur >= 1) - EndExplo = 1; - else - { - x = ( float )data.idata; - y = ( float )0.0; - z = ( float )0.0; - } - } - else - { - printf("\tELEM_BACK_INT_REFL_EQN\n"); - printf("\t\tBACK INTERIOR REFLECTANCE EQUATION %d\n", - data.idata); - } - break; - } - case CALL_PHIGS_ELEM_FACE_DISTING_MODE : - { - TelInqCurElemContent( 0, buffer, &actual_size, &data ); - if( elem_num ) - { - if (IndCur >= 1) - EndExplo = 1; - else - { - x = ( float )data.idata; - y = ( float )0.0; - z = ( float )0.0; - } - } - else - { - printf("\tELEM_FACE_DISTING_MODE\n"); - printf("\t\tFACE DISTINGUISHING MODE %d\n", data.idata); - } - break; - } - case CALL_PHIGS_ELEM_FACE_CULL_MODE : - { - TelInqCurElemContent( 0, buffer, &actual_size, &data ); - if( elem_num ) - { - if (IndCur >= 1) - EndExplo = 1; - else - { - x = ( float )data.idata; - y = ( float )0.0; - z = ( float )0.0; - } - } - else - { - printf("\tELEM_FACE_CULL_MODE\n"); - printf("\t\tFACE CULLING MODE %d\n", data.idata); - } - break; - } - case CALL_PHIGS_ELEM_LIGHT_SRC_STATE : - { - buffer = new Tchar[size]; - TelInqCurElemContent( size, buffer, &actual_size, &data ); - idata = data.light_source_state.on.number; - jdata = data.light_source_state.off.number; - if( elem_num ) - { - if ( (IndCur >= idata) && (IndCur >= jdata) ) - EndExplo = 1; - else - { - if (IndCur < idata) - x = ( float )data.light_source_state.on.integers[IndCur]; - if (IndCur < jdata) - nx = ( float )data.light_source_state.off.integers[IndCur]; - } - } - else - { - printf("\tELEM_LIGHT_SRC_STATE\n"); - for (i=0; i= 1) - EndExplo = 1; - else - { - x = ( float )data.idata; - y = ( float )0.0; - z = ( float )0.0; - } - } - else - { - printf("\tELEM_DCUE_IND\n"); - printf("\t\tDEPTH CUE INDEX %d\n", data.idata); - } - break; - } - default: - break; - } - } - - if( elem_num ) - { - index = 0; - pt->x = x; - pt->y = y; - pt->z = z; - npt->dx = nx; - npt->dy = ny; - npt->dz = nz; - cpt->r = r; - cpt->g = g; - cpt->b = b; - nfa->dx = dx; - nfa->dy = dy; - nfa->dz = dz; - - if( EndExplo ) - *elem_type = 0; - } - else - index ++; - } /* while (index) */ - - call_func_close_struct (); -} - -Tint -call_subr_inquirews( Tint struct_id, Tint *ws_id ) -{ - Tint act_size; - - TsmGetWSPosted( struct_id, 1, ws_id, &act_size ); - - if( act_size ) - return 1; - else - return 0; -} - - -void -call_subr_polygon_holes( CALL_DEF_LISTFACETS * alfacets ) -{ - register int i, j, k; - int go; - CMN_KEY k1, k2, k3; - - Tint *bounds; - TEL_POINT *points; - - bounds = new Tint[alfacets->NbFacets]; - - j = 0; - for( i=0; iNbFacets; i++ ) - j += alfacets->LFacets[i].NbPoints; - - points = new TEL_POINT[j]; - - for( i = 0; i < alfacets->NbFacets; i++ ) - bounds[i] = alfacets->LFacets[i].NbPoints; - - k = 0; - for (i=0; iNbFacets; i++) - { - for (j=0; jLFacets[i].NbPoints; j++) - { - points[k].xyz[0] = alfacets->LFacets[i].UPoints.Points[j].x; - points[k].xyz[1] = alfacets->LFacets[i].UPoints.Points[j].y; - points[k].xyz[2] = alfacets->LFacets[i].UPoints.Points[j].z; - k++; - } - } - - go = 1; - if( bounds == 0 ) - go = 0; - if( points == 0 ) - go = 0; - - if( go ) - { - k1.id = NUM_FACETS_ID; - k1.data.ldata = alfacets->NbFacets; - k2.id = BOUNDS_DATA_ID; - k2.data.pdata = bounds; - k3.id = VERTICES_ID; - k3.data.pdata = points; - - TsmAddToStructure( TelPolygonHoles, 3, &k1, &k2, &k3 ); - } - - if( bounds != 0 ) - delete[] bounds; - if( points != 0 ) - delete[] points; -} - -void -call_subr_polygon_holes_data( CALL_DEF_LISTFACETS * alfacets ) -{ - register Tint i, j, k, count=0; - CMN_KEY key[10]; - cmn_key kk[10]; - int go; - Tint num_vertices; - Tint num_bounds, *bounds = 0; - TEL_POINT *vertices = 0; - TEL_POINT *vnormals = 0; - - for( i = 0; i < 10; i++ ) - kk[i] = &key[i]; - - key[count].id = SHAPE_FLAG_ID; - key[count].data.ldata = TEL_SHAPE_UNKNOWN; - count++; - - key[count].id = NUM_FACETS_ID; - key[count].data.ldata = alfacets->NbFacets; - count++; - - num_bounds = alfacets->NbFacets; - bounds = new Tint[num_bounds]; - - key[count].id = BOUNDS_DATA_ID; - key[count].data.pdata = bounds; - count++; - - num_vertices = 0; - for( i=0; iLFacets[i].NbPoints; - - k = 0; - for( i=0; iLFacets[i].NbPoints; - - switch( alfacets->LFacets[i].TypePoints ) - { - case 1 : /* Coordinates Specified */ - { - if( vertices == 0 ) - { - vertices = new TEL_POINT[num_vertices]; - - key[count].id = VERTICES_ID; - key[count].data.pdata = vertices; - count++; - } - - for( j=0; jLFacets[i].NbPoints; j++ ) - { - vertices[k].xyz[0] = alfacets->LFacets[i].UPoints.Points[j].x; - vertices[k].xyz[1] = alfacets->LFacets[i].UPoints.Points[j].y; - vertices[k].xyz[2] = alfacets->LFacets[i].UPoints.Points[j].z; - k++; - } - - break; - } - - case 2 : /* Coordinates and Vertex Normal Specified */ - { - if( vertices == 0 ) - { - vertices = new TEL_POINT[num_vertices]; - - key[count].id = VERTICES_ID; - key[count].data.pdata = vertices; - count++; - - vnormals = new TEL_POINT[num_vertices]; - key[count].id = VNORMALS_ID; - key[count].data.pdata = vnormals; - count++; - } - - for( j=0; jLFacets[i].NbPoints; j++ ) - { - vertices[k].xyz[0] = - alfacets->LFacets[i].UPoints.PointsN[j].Point.x; - vertices[k].xyz[1] = - alfacets->LFacets[i].UPoints.PointsN[j].Point.y; - vertices[k].xyz[2] = - alfacets->LFacets[i].UPoints.PointsN[j].Point.z; - vnormals[k].xyz[0] = - alfacets->LFacets[i].UPoints.PointsN[j].Normal.dx; - vnormals[k].xyz[1] = - alfacets->LFacets[i].UPoints.PointsN[j].Normal.dy; - vnormals[k].xyz[2] = - alfacets->LFacets[i].UPoints.PointsN[j].Normal.dz; - k++; - } - - break; - } - } - } - - go = 1; - if(bounds == 0) - go = 0; - if(vertices == 0) - go = 0; - if(vnormals == 0) - go = 0; - - if(go) - { - TsmAddToStructure( TelPolygonHoles, -count, kk ); - } - - if(bounds) - delete[] bounds; - if(vertices) - delete[] vertices; - if(vnormals) - delete[] vnormals; -} - - -void -call_subr_curve( CALL_DEF_LISTPOINTS * alpoints ) -{ - CMN_KEY key[3]; - cmn_key kp[3]; - - kp[0] = &key[0], kp[1] = &key[1], kp[2] = &key[2]; - - key[0].id = CURVE_TYPE_ID; - key[0].data.ldata = TelBezierCurve; - - key[1].id = CURVE_NUM_POINTS_ID; - key[1].data.ldata = 20; - - key[2].id = CURVE_VERTICES_ID; - key[2].data.pdata = alpoints->UPoints.Points; - - TsmAddToStructure( TelCurve, -3, kp ); - - return; -} - -/* *** PARRAY functions *** */ - -void call_subr_parray( CALL_DEF_PARRAY *parray ) -{ - CMN_KEY key; - key.id = PARRAY_ID; - key.data.pdata = (void *) parray; - - TsmAddToStructure( TelParray, 1, &key ); -} - -void call_subr_userdraw( CALL_DEF_USERDRAW *anobject ) -{ - CMN_KEY key; - - key.id = 1; - key.data.pdata = anobject; - - TsmAddToStructure( TelUserdraw, 1, &key ); -} diff --git a/src/OpenGl/OpenGl_subrvis.cxx b/src/OpenGl/OpenGl_subrvis.cxx deleted file mode 100755 index 8b3f96c979..0000000000 --- a/src/OpenGl/OpenGl_subrvis.cxx +++ /dev/null @@ -1,863 +0,0 @@ -/*********************************************************************** - -FONCTION : ----------- -File OpenGl_subrvis : - -TEST : ------- - -Le main TestOfDesktop.c permet de tester cette classe. - - -REMARQUES: ----------- - - -HISTORIQUE DES MODIFICATIONS : --------------------------------- -xx-xx-xx : xxx ; Creation. -07-02-96 : FMN ; Suppression code inutile: -- TxglLink() et TxglUnlink() -19-03-96 : CAL ; Ajout de la fonction subr_resize. -appele par togl_ratio_window -21-03-96 : CAL ; Dans subr_doublebuffer et subr_open_ws -retrait des lignes qui donnaient un background -noir a la fenetre. -01-04-96 : CAL ; Integration MINSK portage WNT -02-07-96 : FMN ; Suppression WSWSHeight, WSWSWidth et WSType -17-07-96 : FMN ; Modification de call_subr_hlhsr(). -18-07-96 : FMN ; Ajout appel TxglWinset() pour le Resize. -01-08-96 : FMN ; Ajout appel reaffichage dans le resize. -25-11-96 : FMN ; PRO6577: Ajout WSUpdateState pour call_subr_set_background. -29-01-97 : FMN ; Suppression de call_subr_doublebuffer(). -05-02-97 : FMN ; Suppression variables inutiles. -12-02-97 : FMN ; Suppression de call_facilities_list.DepthCueing -14-02-97 : FMN ; Ajout WSUpdateState pour call_subr_transparency. -30-06-97 : FMN ; Appel de la toolkit OpenGl_LightBox. -02-07-97 : FMN ; Ajout init generale par contexte. -(GL_POLYGON_OFFSET_EXT, glLightModelf, glHint). -03-07-97 : FMN ; Test Headlight. -08-09-97 : CAL ; subr_open_ws retourne 0 si pb. (gere par togl_view) -07-10-97 : FMN ; Simplification WNT -03-10-97 : FMN ; Meilleure gestion des EXT, ajout QueryExtension -17-11-97 : FMN ; Suppression redraw sur le resize. -05-12-97 : FMN ; Double gestion du glPolygonOffsetEXT -17-12-97 : FMN ; Probleme compilation SGI -03-03-98 : FMN ; Simplification gestion du glPolygonOffsetEXT -15-03-98 : FMN ; Suppression variable WSNeedsClear -17-03-98 : FMN ; Ajout mode animation -08-07-98 : FMN ; Changement du nom de la primitive call_togl_erase_immediat_mode() --> call_togl_erase_animation_mode. -22-10-98 : FMN ; Amelioration des perfs: glHint utilise GL_FASTEST. -14-12-98 : BGN; Developpement (S3989, Phase "triedre") -29-03-01 : GG; glPolygonOffsetEXT is no more available -since OGL 1.2 -20-08-01 : GG ; Add functions call_subr_enable_polygon_offset () -and call_subr_disable_polygon_offset () - -************************************************************************/ - -#ifdef WNT -#define BUC60579 /*GG_240999 Under WNT,resets the ws attributes for each -// created view-manager and not only for the first -*/ -#endif - -#define IMP190100 /*GG Reverse the front & back depth cueing planes -// position. -*/ - -#define RIC120302 /*GG Use TxglSetWindow instead TxglCreateWindow -// when a GLXContext is given -// Add call_subr_displayCB function -*/ - -#define BUC61044 /* 25/10/01 SAV ; added functionality to control gl depth testing -from higher API */ -#define BUC61045 /* 25/10/01 SAV ; added functionality to control gl lighting -from higher API */ - -#define OCC1188 /*SAV added control of the background image*/ - -/*----------------------------------------------------------------------*/ -/* -* Includes -*/ - -#include - -#include - - -#include -#include -#include -#include - -#include - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/*----------------------------------------------------------------------*/ -/* -* Constantes -*/ - -static Tint attri_init = 0; - -/*----------------------------------------------------------------------*/ - -#ifndef WNT -static Bool WaitForNotify(Display *d, XEvent *e, char *arg) { - return (e->type == MapNotify) && (e->xmap.window == (Window)arg); -} -#endif - -/*----------------------------------------------------------------------*/ - -static int offsetStatus=0; -#ifdef GL_EXT_polygon_offset -static GLfloat offsetFactor=1.0,offsetUnits=0.0; -#elif GL_POLYGON_OFFSET_EXT -static GLfloat offsetFactor=0.5,offsetUnits=0.0005; -#endif -void call_subr_enable_polygon_offset( ) -{ - if( offsetStatus < 0 ) return; - -#ifdef GL_EXT_polygon_offset - if( offsetStatus == 0 ) { - if (QueryExtension("GL_EXT_polygon_offset")) { - char svalue[64]; - if( call_util_osd_getenv ("CALL_OPENGL_POLYGON_OFFSET", - svalue,sizeof(svalue)) ) { - float v1,v2; - int n = sscanf(svalue,"%f %f",&v1,&v2); - if( n > 0 ) offsetFactor = v1; - if( n > 1 ) offsetUnits = v2; - printf(" $$$ CALL_OPENGL_POLYGON_OFFSET %f %f\n", - offsetFactor,offsetUnits); - } - offsetStatus = 1; - } else { - offsetStatus = -1; - } - } - - if( offsetStatus > 0 ) { -#ifdef GL_POLYGON_OFFSET_FILL - glPolygonOffset(offsetFactor,offsetUnits); - glEnable(GL_POLYGON_OFFSET_FILL); -#elif GL_POLYGON_OFFSET_EXT - glPolygonOffsetEXT(offsetFactor,offsetUnits); - glEnable(GL_POLYGON_OFFSET_EXT); -#endif - } -#else - offsetStatus = -1; -#endif /* GL_EXT_polygon_offset */ -} - -void -call_subr_disable_polygon_offset( ) -{ - if( offsetStatus > 0 ) { -#ifdef GL_POLYGON_OFFSET_FILL - glDisable(GL_POLYGON_OFFSET_FILL); -#elif GL_POLYGON_OFFSET_EXT - glDisable(GL_POLYGON_OFFSET_EXT); -#endif - } -} - -/*----------------------------------------------------------------------*/ - -int -call_subr_open_ws( CALL_DEF_VIEW * aview ) -{ - CMN_KEY_DATA data; - WINDOW win; - TEL_HIGHLIGHT hrep = { TelHLForcedColour, {{ ( float )1.0, ( float )1.0, ( float )1.0 }} }; - TEL_DEPTHCUE dcrep = { TelDCSuppressed, {( float )0.0, ( float )1.0}, {( float )1.0, ( float )0.0}, {{( float )0.0, ( float )0.0, ( float )0.0}} }; - Tint width, height; - Tfloat bgcolr, bgcolg, bgcolb; /* background color */ -#ifdef OCC1188 - TSM_BG_TEXTURE bgTexture; -#endif - -#ifndef WNT - XEvent event; - Window root; - int newx, newy; - unsigned int newwidth, newheight, newbw, newdepth; -#else - RECT cr; -#endif /* WNT */ - - width = ( Tint )aview->DefWindow.dx; - height = ( Tint )aview->DefWindow.dy; - - /* background color */ - bgcolr = aview->DefWindow.Background.r, - bgcolg = aview->DefWindow.Background.g, - bgcolb = aview->DefWindow.Background.b; - -#ifdef RIC120302 - if( aview->GContext ) - win = TxglSetWindow( call_thedisplay, /*(HWND)*/(WINDOW)aview->DefWindow.XWindow, - /*(HGLRC)*/(GLCONTEXT)aview->GContext ); - else -#endif /*RIC120302*/ - win = TxglCreateWindow( call_thedisplay, /*(HWND)*/(WINDOW)aview->DefWindow.XWindow, - 0, 0, width, height, 0, bgcolr, bgcolg, bgcolb ); -#ifndef WNT - if( win != aview->DefWindow.XWindow ) { - XMapWindow( call_thedisplay, win ); - XIfEvent(call_thedisplay, &event, WaitForNotify, (char *) win); - } -#endif /* WNT */ - - if( TxglWinset( call_thedisplay, (WINDOW) win ) == TFailure ) - return 0; - else { - TsmRegisterWsid( aview->WsId ); - data.ldata = (Tint) win; - TsmSetWSAttri( aview->WsId, WSWindow, &data ); -#ifndef WNT - XGetGeometry ( - call_thedisplay, win, &root, - &newx, &newy,&newwidth, &newheight, &newbw, &newdepth - ); - width = newwidth; - height = newheight; -#else - GetClientRect ( win, &cr ); - width = cr.right; - height = cr.bottom; -#endif /* WNT */ -#ifdef OCC1188 - bgTexture.texId = 0; - data.pdata = &bgTexture; - TsmSetWSAttri( aview->WsId, WSBgTexture, &data ); -#endif - data.ldata = width; - TsmSetWSAttri( aview->WsId, WSWidth, &data ); - data.ldata = height; - TsmSetWSAttri( aview->WsId, WSHeight, &data ); - data.ldata = -1; - TsmSetWSAttri( aview->WsId, WSViewStid, &data ); - data.ldata = TOn; - TsmSetWSAttri( aview->WsId, WSDbuff, &data ); - data.ldata = TNotDone; - TsmSetWSAttri( aview->WsId, WSUpdateState, &data ); - data.ldata = TOff; - TsmSetWSAttri( aview->WsId, WSTransparency, &data ); - TelSetHighlightRep( aview->WsId, 0, &hrep ); - TelSetDepthCueRep( aview->WsId, 0, &dcrep ); - TelInitWS( aview->WsId, width, height, bgcolr, bgcolg, bgcolb ); - -#ifdef BUC61044 - /* 24/10/01 : SAV ; setting OGL depth testing enabled by default */ - data.ldata = TOn; - TsmSetWSAttri( aview->WsId, WSDepthTest, &data ); -#endif -#ifdef BUC61045 - /* 24/10/01 : SAV ; setting flag to control GL_LIGHTING (used in triedron) */ - data.ldata = TOn; - TsmSetWSAttri( aview->WsId, WSGLLight, &data ); -#endif - -#ifdef BUC60579 - TsmInitAttributes(); -#else - if( !attri_init ) { - TsmInitAttributes(); - attri_init = 1; - } -#endif - - /* - * Init generale du contexte - */ - - /* Eviter d'avoir les faces mal orientees en noir. */ - /* Pourrait etre utiliser pour detecter les problemes d'orientation */ - glLightModeli((GLenum)GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE); - - /* Optimisation pour le Fog et l'antialiasing */ - glHint( GL_FOG_HINT, GL_FASTEST ); - glHint( GL_POINT_SMOOTH_HINT, GL_FASTEST ); - glHint( GL_LINE_SMOOTH_HINT, GL_FASTEST ); - glHint( GL_POLYGON_SMOOTH_HINT, GL_FASTEST ); - - /* Polygon Offset */ - call_subr_enable_polygon_offset(); - - return 1; - - } /* TxglWinset */ -} - -/*----------------------------------------------------------------------*/ - -void -call_subr_resize (CALL_DEF_VIEW * aview) -{ - CMN_KEY_DATA data; - WINDOW win; - Tint width, height; - Tfloat bgcolr, bgcolg, bgcolb; - Tint wswidth, wsheight; - Tint wsviewstid; - /* Tint swap = 1;*/ /* swap buffers ? yes */ - -#ifndef WNT - /* XEvent event;*/ - Window root; - int newx, newy; - unsigned int newwidth, newheight, newbw, newdepth; -#else - RECT cr; -#endif /* WNT */ - -#ifdef TRACE - printf("call_subr_resize \n"); -#endif - /* Recuperation de la definition precedente de la ws */ - TsmGetWSAttri (aview->WsId, WSWidth, &data); - wswidth = data.ldata; - TsmGetWSAttri (aview->WsId, WSHeight, &data); - wsheight = data.ldata; - TsmGetWSAttri (aview->WsId, WSViewStid, &data); - wsviewstid = data.ldata; - - /* S'il s'agit du togl_ratio_window initial alors on ne fait rien */ - if (wsviewstid == -1) return; - - /* - * Si l'on resize une fenetre qui a la meme taille que la taille - * precedente alors on ne fait rien - */ - if ((wswidth == (Tint) aview->DefWindow.dx) && - (wsheight == (Tint) aview->DefWindow.dy)) return; - -#ifndef WNT - TsmGetWSAttri (aview->WsId, WSWindow, &data); - win = data.ldata; - - XResizeWindow (call_thedisplay, win, - (unsigned int) aview->DefWindow.dx, - (unsigned int) aview->DefWindow.dy); - - XSync (call_thedisplay, False); - - /* Mettre a jour ses attributs */ - XGetGeometry (call_thedisplay, win, &root, - &newx, &newy,&newwidth, &newheight, &newbw, &newdepth); - width = newwidth; - height = newheight; - - /* background color */ - bgcolr = aview->DefWindow.Background.r, - bgcolg = aview->DefWindow.Background.g, - bgcolb = aview->DefWindow.Background.b; - - /* Rendre courant le Drawable et le Context */ - if (TxglWinset (call_thedisplay, (Window) win) == TSuccess) { - - data.ldata = width; - TsmSetWSAttri (aview->WsId, WSWidth, &data); - data.ldata = height; - TsmSetWSAttri (aview->WsId, WSHeight, &data); - TelInitWS (aview->WsId, width, height, bgcolr, bgcolg, bgcolb); - } - -#else - - /* On detruit l'ancienne sous-fenetre de la window graphique */ - TsmGetWSAttri (aview->WsId, WSWindow, &data); - win = (WINDOW) data.ldata; - /* - * On recree une nouvelle sous-fenetre de la window graphique - * avec la nouvelle dimension - */ - /* background color */ - bgcolr = aview->DefWindow.Background.r, - bgcolg = aview->DefWindow.Background.g, - bgcolb = aview->DefWindow.Background.b; - /* Rendre courant le Drawable et le Context */ - if (TxglWinset (call_thedisplay, win) == TSuccess) { - //if (TxglWinset (call_thedisplay, GET_GL_CONTEXT()) == TSuccess) { - /* Mettre a jour la sous-fenetre associee */ - /* Mettre a jour ses attributs */ - GetClientRect ( win, &cr ); - width = cr.right; - height = cr.bottom; - data.ldata = width; - TsmSetWSAttri (aview->WsId, WSWidth, &data); - data.ldata = height; - TsmSetWSAttri (aview->WsId, WSHeight, &data); - TelInitWS (aview->WsId, width, height, bgcolr, bgcolg, bgcolb); - } -#endif /* WNT */ - - return; -} - -/*----------------------------------------------------------------------*/ - -void -call_subr_antialiasing( CALL_DEF_VIEW * aview, Tint tag ) -{ - CMN_KEY k; - Tint fl = tag ? TOn : TOff; - - call_func_set_edit_mode( TEditReplace ); - call_func_open_struct( aview->ViewId ); - call_func_set_elem_ptr(0); - call_func_set_elem_ptr_label(View_LABAliasing); - call_func_offset_elem_ptr(1); - k.data.ldata = fl; - TsmAddToStructure( TelAntiAliasing, 1, &k ); - call_func_close_struct(); - return; -} - -/*----------------------------------------------------------------------*/ - -void -call_subr_hlhsr( CALL_DEF_VIEW * aview, int tag ) -{ - CMN_KEY_DATA data; - - data.ldata = (tag ? TOn : TOff); - TsmSetWSAttri( aview->WsId, WSZbuffer, &data ); - return; -} - - -/*----------------------------------------------------------------------*/ - -void -call_subr_depthcueing( CALL_DEF_VIEW * aview, Tint tag ) -{ - TEL_DEPTHCUE rep; -# define CALL_DEF_DEPTH_CUEING_INDEX 1 - - if( !tag ) - { - call_func_set_edit_mode(CALL_PHIGS_EDIT_REPLACE); - call_func_open_struct(aview->ViewId); - call_func_set_elem_ptr(0); - call_func_set_elem_ptr_label(View_LABDepthCueing); - call_func_offset_elem_ptr(1); - call_func_appl_data(0); - call_func_close_struct(); - } - else - { - rep.mode = CALL_PHIGS_ALLOWED; - rep.planes[0] = aview->Context.DepthBackPlane; - rep.planes[1] = aview->Context.DepthFrontPlane; -#ifdef TRACE - printf(" $$$ DepthFrontPlane %f DepthBackPlane %f FrontPlaneDistance %f BackPlaneDistance %f\n",aview->Context.DepthFrontPlane,aview->Context.DepthBackPlane,aview->Mapping.FrontPlaneDistance,aview->Mapping.BackPlaneDistance); -#endif - rep.planes[0] = -#ifdef IMP190100 - (aview->Context.DepthFrontPlane - - aview->Mapping.BackPlaneDistance) / -#else - (aview->Mapping.FrontPlaneDistance - - aview->Context.DepthFrontPlane) / -#endif - (aview->Mapping.FrontPlaneDistance - - aview->Mapping.BackPlaneDistance); - - rep.planes[1] = -#ifdef IMP190100 - (aview->Context.DepthBackPlane - - aview->Mapping.BackPlaneDistance) / -#else - (aview->Mapping.FrontPlaneDistance - - aview->Context.DepthBackPlane) / -#endif - (aview->Mapping.FrontPlaneDistance - - aview->Mapping.BackPlaneDistance); - - if(rep.planes[0] < 0.) - rep.planes[0] = ( float )0.0; - else if(rep.planes[0] > 1.) - rep.planes[0] = ( float )1.0; - if(rep.planes[1] < 0.) - rep.planes[1] = ( float )0.0; - else if(rep.planes[1] > 1.) - rep.planes[1] = ( float )1.0; -#ifdef IMP190100 - if(rep.planes[1] > rep.planes[0]) - { - rep.planes[1] = ( float )0.0; - rep.planes[0] = ( float )1.0; - } -#else - if(rep.planes[0] > rep.planes[1]) - { - rep.planes[0] = ( float )0.0; - rep.planes[1] = ( float )1.0; - } -#endif - -#ifdef TRACE - printf(" plane[0] %f plane[1] %f\n",rep.planes[0],rep.planes[1]); -#endif - rep.scales[0] = ( float )1.; - rep.scales[1] = ( float )0.; - rep.col.rgb[0] = aview->DefWindow.Background.r; - rep.col.rgb[1] = aview->DefWindow.Background.g; - rep.col.rgb[2] = aview->DefWindow.Background.b; - TelSetDepthCueRep(aview->WsId, CALL_DEF_DEPTH_CUEING_INDEX, &rep); - - call_func_set_edit_mode(CALL_PHIGS_EDIT_REPLACE); - call_func_open_struct(aview->ViewId); - call_func_set_elem_ptr(0); - call_func_set_elem_ptr_label(View_LABDepthCueing); - call_func_offset_elem_ptr(1); - call_func_dcue_ind(CALL_DEF_DEPTH_CUEING_INDEX); - call_func_close_struct(); - } - return; -} - -/*----------------------------------------------------------------------*/ - -TStatus -call_subr_get_view_index( Tint stid, Tint *ind ) -{ - tsm_node node; - Tint i, num; - - if( TsmGetStructure( stid, &num, &node ) == TSuccess ) - { - for( i = 0; i < num; i++ ) - { - if( node->elem.el == TelViewIndex ) - { - *ind = node->elem.data.ldata; - return TSuccess; - } - } - } - return TFailure; -} - -/*----------------------------------------------------------------------*/ - -void -call_subr_pick( CALL_DEF_PICK *apick ) -{ - Tint depth; - TPickOrder order; - TStatus stat; - - static int *listid, *listelem, *listpickid; - - TEL_PICK_PATH path_list[CALL_MAX_DEPTH_LENGTH]; - TEL_PICK_REPORT rep; - - Tint i; - - if( listid ) - { - //cmn_freemem( listid ); - delete[] listid; - //cmn_freemem( listelem ); - delete[] listelem; - //cmn_freemem( listpickid ); - delete[] listpickid; - listid = listelem = listpickid = 0; - } - - order = apick->Context.order == 0 ? PTOP_FIRST : PBOTTOM_FIRST; - - depth = apick->Context.depth < CALL_MAX_DEPTH_LENGTH ? - apick->Context.depth : CALL_MAX_DEPTH_LENGTH ; - - rep.pick_path = path_list; - - stat = TPick( apick->WsId, apick->x, apick->y, apick->Context.aperture, - apick->Context.aperture, order, depth, &rep ); - - if( stat == TSuccess ) - { - apick->Pick.depth = rep.depth; - -#ifdef TRACE - printf( "\n\n\tPICK REPORT FOLLOWS" ); - printf( "\n\t*******************\n" ); - printf( "\ndepth = %d\torder = %s\n", rep.depth, - order == PTOP_FIRST ? "TopFirst" : "BottomFirst" ); -#endif - - //cmn_memreserve( listid, rep.depth, 0 ); - listid = new int[rep.depth]; - //cmn_memreserve( listelem, rep.depth, 0 ); - listelem = new int[rep.depth]; - //cmn_memreserve( listpickid, rep.depth, 0 ); - listpickid = new int[rep.depth]; - if( !listid || !listelem || !listpickid ) - return; - apick->Pick.listid = listid; - apick->Pick.listelem = listelem; - apick->Pick.listpickid = listpickid; - - for( i = 0; i < rep.depth; i++ ) - { - listelem[i] = path_list[i].el_num; - listpickid[i] = path_list[i].pick_id; - listid[i] = path_list[i].struct_id; -#ifdef TRACE - printf( "\n\tSTRUCTURE ID [%d] = %ld", i, listid[i] ); - printf( "\n\tPICK ID [%d] = %ld", i, listpickid[i] ); - printf( "\n\tELEMENT ID [%d] = %ld", i, listelem[i] ); -#endif - } -#ifdef TRACE - printf("\n"); -#endif - } - - return; -} - - -/*----------------------------------------------------------------------*/ - -void -call_subr_set_light_src_rep( CALL_DEF_LIGHT * alight ) -{ - TEL_LIGHT rep; - - switch( alight->LightType ) - { - case 0 : /* TOLS_AMBIENT */ - rep.type = CALL_PHIGS_LIGHT_AMBIENT; - rep.col.rgb[0] = alight->Color.r; - rep.col.rgb[1] = alight->Color.g; - rep.col.rgb[2] = alight->Color.b; - break; - - case 1 : /* TOLS_DIRECTIONAL */ - rep.type = CALL_PHIGS_LIGHT_DIRECTIONAL; - rep.col.rgb[0] = alight->Color.r; - rep.col.rgb[1] = alight->Color.g; - rep.col.rgb[2] = alight->Color.b; - rep.dir[0] = alight->Direction.x; - rep.dir[1] = alight->Direction.y; - rep.dir[2] = alight->Direction.z; - break; - - case 2 : /* TOLS_POSITIONAL */ - rep.type = CALL_PHIGS_LIGHT_POSITIONAL; - rep.col.rgb[0] = alight->Color.r; - rep.col.rgb[1] = alight->Color.g; - rep.col.rgb[2] = alight->Color.b; - rep.pos[0] = alight->Position.x; - rep.pos[1] = alight->Position.y; - rep.pos[2] = alight->Position.z; - rep.atten[0] = alight->Attenuation[0]; - rep.atten[1] = alight->Attenuation[1]; - break; - - case 3 : /* TOLS_SPOT */ - rep.type = CALL_PHIGS_LIGHT_SPOT; - rep.col.rgb[0] = alight->Color.r; - rep.col.rgb[1] = alight->Color.g; - rep.col.rgb[2] = alight->Color.b; - rep.pos[0] = alight->Position.x; - rep.pos[1] = alight->Position.y; - rep.pos[2] = alight->Position.z; - rep.dir[0] = alight->Direction.x; - rep.dir[1] = alight->Direction.y; - rep.dir[2] = alight->Direction.z; - rep.shine = alight->Concentration; - rep.atten[0] = alight->Attenuation[0]; - rep.atten[1] = alight->Attenuation[1]; - rep.angle = alight->Angle; - break; - } - - rep.HeadLight = alight->Headlight; - AddLight( alight->WsId, alight->LightId, &rep ); - - return; -} - -/*----------------------------------------------------------------------*/ - -void -call_subr_set_background( Tint ws, tel_colour rgb ) -{ - CMN_KEY_DATA data; - CMN_KEY_DATA key; - - /* Mise a jour de l'update_mode */ - key.ldata = TNotDone; - TsmSetWSAttri( ws, WSUpdateState, &key ); - - data.pdata = rgb->rgb; - TsmSetWSAttri( ws, WSBackground, &data ); - return; -} - -/*----------------------------------------------------------------------*/ - -void -call_subr_set_gradient_background( Tint ws, Tint type, tel_colour color1, tel_colour color2 ) -{ - CMN_KEY_DATA data; - CMN_KEY_DATA key; - TSM_BG_GRADIENT bgGradient; - - /* Mise a jour de l'update_mode */ - key.ldata = TNotDone; - TsmSetWSAttri( ws, WSUpdateState, &key ); - - bgGradient.type = (TSM_GradientType)type; - bgGradient.color1 = *color1; - bgGradient.color2 = *color2; - data.pdata = &bgGradient; - TsmSetWSAttri( ws, WSBgGradient, &data ); - return; -} - - -/*----------------------------------------------------------------------*/ - -void -call_subr_close_ws( CALL_DEF_VIEW * aview ) -{ - CMN_KEY_DATA key; - CMN_KEY_DATA textureKey; - - TsmGetWSAttri( aview->WsId, WSWindow, &key ); - -#ifdef OCC1188 - tsm_bg_texture texture; - WINDOW aWnd = (WINDOW) key.ldata; - - TsmGetWSAttri( aview->WsId, WSBgTexture, &textureKey ); - texture = (tsm_bg_texture)textureKey.pdata; - - if ( texture != 0 && texture->texId != 0 ) - { - OpenGl_ResourceCleaner* anCleaner = OpenGl_ResourceCleaner::GetInstance(); - - // Delete the texture with ResourceCleaner; if it is not possible - // do this directly with proper context selected - if ( !anCleaner->AddResource( TxglGetContext(aWnd), - new OpenGl_ResourceTexture(texture->texId) ) ) - { - GLCONTEXT cur_context = GET_GL_CONTEXT(); - GLDRAWABLE cur_drawable = GET_GLDEV_CONTEXT(); - - if ( TxglWinset( call_thedisplay, aWnd ) == TSuccess ) - glDeleteTextures( 1,(GLuint *)&(texture->texId) ); - - // activate the previous context for this thread - GL_MAKE_CURRENT( call_thedisplay, cur_drawable, cur_context ); - } - } - -#endif - -#ifdef RIC120302 - if( !aview->GContext ) -#endif - TxglDestroyWindow( call_thedisplay, (WINDOW) key.ldata ); - - TglDeleteFiltersForWS( aview->WsId ); - RemoveWksLight( aview->WsId ); - call_triedron_erase (aview); /* BGN 09-12-98 */ - call_graduatedtrihedron_erase( aview->WsId ); - TelDeleteViewsForWS( aview->WsId ); - TelDeleteHighlightsForWS( aview->WsId ); - TelDeleteDepthCuesForWS( aview->WsId ); - - TsmUnregisterWsid( aview->WsId ); - return; -} - -/*----------------------------------------------------------------------*/ - -void -call_subr_transparency (int wsid, int viewid, int tag) -{ - CMN_KEY_DATA data; - CMN_KEY_DATA key; - - /* Est-il necessaire de faire de la transparence ? */ - TsmGetWSAttri( wsid, WSTransparency, &data ); - if (data.ldata != tag) - { - data.ldata = (tag ? TOn : TOff); - TsmSetWSAttri( wsid, WSTransparency, &data ); - - /* Mise a jour de l'update_mode */ - key.ldata = TNotDone; - TsmSetWSAttri( wsid, WSUpdateState, &key ); - (void) call_togl_erase_animation_mode(); - } -} - -#ifdef RIC120302 -/*----------------------------------------------------------------------*/ -int -call_subr_displayCB( CALL_DEF_VIEW * aview, int reason ) -{ - int status = 0; - if( aview->GDisplayCB ) { - Aspect_GraphicCallbackStruct callData; - CMN_KEY_DATA data; - WINDOW win; - - TsmGetWSAttri (aview->WsId, WSWindow, &data); - win = (WINDOW) data.ldata; - - callData.reason = reason; - callData.display = call_thedisplay; - callData.window = win; - callData.wsID = aview->WsId; - callData.viewID = aview->ViewId; - callData.gcontext = TxglGetContext(win); - - status = (*aview->GDisplayCB) - ( aview->DefWindow.XWindow, aview->GClientData, &callData ); - } - - return status; -} -#endif diff --git a/src/OpenGl/OpenGl_surfprop.cxx b/src/OpenGl/OpenGl_surfprop.cxx deleted file mode 100755 index a520bda72c..0000000000 --- a/src/OpenGl/OpenGl_surfprop.cxx +++ /dev/null @@ -1,135 +0,0 @@ - -#include - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -static TStatus SurfaceAreaPropertiesDisplay( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus SurfaceAreaPropertiesAdd( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus SurfaceAreaPropertiesDelete( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus SurfaceAreaPropertiesPrint( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus SurfaceAreaPropertiesInquire( TSM_ELEM_DATA, Tint, cmn_key* ); - -static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) = -{ - 0, /* PickTraverse */ - SurfaceAreaPropertiesDisplay, - SurfaceAreaPropertiesAdd, - SurfaceAreaPropertiesDelete, - SurfaceAreaPropertiesPrint, - SurfaceAreaPropertiesInquire -}; - - -MtblPtr -TelSurfaceAreaPropertiesInitClass( TelType *el ) -{ - *el = TelSurfaceAreaProperties; - return MtdTbl; -} - -static TStatus -SurfaceAreaPropertiesAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k ) -{ - tel_surf_prop data = new TEL_SURF_PROP();; - - //cmn_memreserve( data, 1, 0 ); - if( !data ) - return TFailure; - - *data = *(tel_surf_prop)(k[0]->data.pdata); - - ((tsm_elem_data)(d.pdata))->pdata = data; - - return TSuccess; -} - - -static TStatus -SurfaceAreaPropertiesDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - CMN_KEY key; - - key.id = TelSurfaceAreaProperties; - key.data.pdata = data.pdata; - TsmSetAttri( 1, &key ); - - return TSuccess; -} - - -static TStatus -SurfaceAreaPropertiesDelete( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - //cmn_freemem( data.pdata ); - if (data.pdata) - delete data.pdata; - return TSuccess; -} - - - - -static TStatus -SurfaceAreaPropertiesPrint( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - tel_surf_prop p; - - p = (tel_surf_prop)data.pdata; - - fprintf( stdout, "TelSurfaceAreaProperties\n" ); - fprintf( stdout, "\tAmbient Coeff: %f\n", p->amb ); - fprintf( stdout, "\tDiffuse Coeff: %f\n", p->diff ); - fprintf( stdout, "\tSpecular Coeff: %f\n", p->spec ); - fprintf( stdout, "\tTransparency Coeff: %f\n", p->trans ); - fprintf( stdout, "\tShininess: %f\n", p->shine ); - fprintf( stdout, "\tSpecular colour: R = %f, G = %f, B = %f\n", - p->speccol.rgb[0], p->speccol.rgb[1], p->speccol.rgb[2] ); - fprintf( stdout, "\n" ); - - return TSuccess; -} - - -static TStatus -SurfaceAreaPropertiesInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - Tint i; - tel_surf_prop p; - - p = (tel_surf_prop)data.pdata; - - for( i = 0; i < n; i++ ) - { - switch( k[i]->id ) - { - case INQ_GET_SIZE_ID: - { - k[i]->data.ldata = sizeof( Tint ); - break; - } - case INQ_GET_CONTENT_ID: - { - TEL_INQ_CONTENT *c; - Teldata *w; - - c = (tel_inq_content)k[i]->data.pdata; - w = c->data; - c->act_size = 0; - w->surf_prop = *p; - break; - } - } - } - - return TSuccess; -} diff --git a/src/OpenGl/OpenGl_telem.hxx b/src/OpenGl/OpenGl_telem.hxx deleted file mode 100755 index 6b5a700a9c..0000000000 --- a/src/OpenGl/OpenGl_telem.hxx +++ /dev/null @@ -1,46 +0,0 @@ -/*********************************************************************** - -FONCTION : ----------- -Include OpenGl_telem : - - -REMARQUES: ----------- - - -HISTORIQUE DES MODIFICATIONS : --------------------------------- -xx-xx-xx : xxx ; Creation. -07-02-96 : FMN ; Ajout prototype de TsmInitAttributes() -11-03-96 : FMN ; Ajout prototype de TelResetMaterial() -13-06-96 : CAL ; Ajout prototype de TelSetTransparency() -05-08-97 : PCT ; support texture mapping -21-08-97 : PCT ; ajout deuxieme passe pour les textures -28-08-97 : PCT ; ajot coordonnee textures -15-01-98 : FMN ; Ajout Hidden line -08-04-98 : FGU ; Ajout champs pour emission -24-06-98 : FMN ; Correction indice pour les type de trait. -La reference se trouve dans Aspect.cdl -16-06-2000 : ATS : G005 : Move type declarations to InterfaceGraphic_telem.h - - -************************************************************************/ - -#ifndef OPENGL_TELEM_H -#define OPENGL_TELEM_H - -#include - -extern void TelHookOnAllClasses(void); -extern Tchar*TelGetStringForPM( Tint, Tfloat ); /* marker type, marker size */ -extern void TelUpdateMaterial( Tint ); /* TEL_FRONT_MATERIAL or - TEL_BACK_MATERIAL */ -/* FSXXX NEW */ -extern void TelForceMaterial( Tint ); -extern void TsmInitAttributes( void ); -extern void TelResetMaterial( void ); - -extern void TelSetTransparency( Tint ); - -#endif /* OPENGL_TELEM_H */ diff --git a/src/OpenGl/OpenGl_telem_attri.hxx b/src/OpenGl/OpenGl_telem_attri.hxx deleted file mode 100755 index 826b4c5b06..0000000000 --- a/src/OpenGl/OpenGl_telem_attri.hxx +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef OPENGL_TSM_ATTRI_H -#define OPENGL_TSM_ATTRI_H - -extern TStatus TsmPushAttri( void ); -extern TStatus TsmPopAttri( void ); -extern TStatus TsmSetAttri( Tint, ... ); -extern TStatus TsmGetAttri( Tint, ... ); -extern TStatus TsmPushAttriLight( void ); -extern TStatus TsmPopAttriLight( void ); - -#endif diff --git a/src/OpenGl/OpenGl_telem_depthcue.hxx b/src/OpenGl/OpenGl_telem_depthcue.hxx deleted file mode 100755 index 0455fca2e1..0000000000 --- a/src/OpenGl/OpenGl_telem_depthcue.hxx +++ /dev/null @@ -1,51 +0,0 @@ -/*********************************************************************** - -FONCTION : ----------- -File OpenGl_telem_depthcue.h : - - -REMARQUES: ----------- - - -HISTORIQUE DES MODIFICATIONS : --------------------------------- -xx-xx-xx : xxx ; Creation. -12-02-97 : FMN ; Suppression de TelGetDepthCueRep - -************************************************************************/ - -#ifndef OPENGL_TELEM_DEPTHCUE_H -#define OPENGL_TELEM_DEPTHCUE_H - -#include - -struct TEL_DEPTHCUE -{ - TDepthCueType mode; - Tfloat planes[2]; /* in the range 0.0 & 1.0 */ - Tfloat scales[2]; /* in the range 0.0 & 1.0. This is fraction - of object colour to be visible */ - TEL_COLOUR col; - IMPLEMENT_MEMORY_OPERATORS -}; -typedef TEL_DEPTHCUE* tel_depthcue; - -struct TEL_GL_DEPTHCUE -{ - TEL_DEPTHCUE dcrep; - Tfloat dist[2]; -}; -typedef TEL_GL_DEPTHCUE* tel_gl_depthcue; - -/* ws, dcid, dcrep */ -extern TStatus TelSetDepthCueRep( Tint, Tint, tel_depthcue ); -/* ws, dcid, dcrep */ - -extern void TelPrintDepthCueRep( Tint, Tint ); /* ws, hid */ -/* ws, viewid, dcid, data */ -extern TStatus TelGetGLDepthCue( Tint, Tint, Tint, tel_gl_depthcue ); -extern TStatus TelDeleteDepthCuesForWS( Tint wsid ); - -#endif diff --git a/src/OpenGl/OpenGl_telem_filters.hxx b/src/OpenGl/OpenGl_telem_filters.hxx deleted file mode 100755 index aa70f5ad49..0000000000 --- a/src/OpenGl/OpenGl_telem_filters.hxx +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef OPENGL_TELEM_FILTERS_S -#define OPENGL_TELEM_FILTERS_S - -typedef enum -{ - InvisFilter, HighlFilter, PickFilter -} TFilterSet; - -/* Filter functions */ /* Wsid, Inclusion num, list, Exclusion num, list */ -extern TStatus TglSetHighlFilter( Tint, Tint, Tint*, Tint, Tint* ); -extern TStatus TglSetPickFilter( Tint, Tint, Tint*, Tint, Tint* ); -extern TStatus TglSetInvisFilter( Tint, Tint, Tint*, Tint, Tint* ); - -/* Nameset functions */ -extern TStatus TglNamesetPush( void ); -extern TStatus TglNamesetPop( void ); -extern TStatus TglNamesetAdd( Tint, Tint* ); -extern TStatus TglNamesetRemove( Tint, Tint* ); -extern TStatus TglDeleteFiltersForWS( Tint wsid ); - -/* Compare Nameset with filters */ /* Failure if not found in inclusion set */ -extern TStatus TglFilterNameset( Tint, TFilterSet ); /* Wsid, enum */ - -#endif diff --git a/src/OpenGl/OpenGl_telem_highlight.hxx b/src/OpenGl/OpenGl_telem_highlight.hxx deleted file mode 100755 index f93f256dfd..0000000000 --- a/src/OpenGl/OpenGl_telem_highlight.hxx +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef OPENGL_TELEM_HIGHLIGHT_H -#define OPENGL_TELEM_HIGHLIGHT_H - -#include - -typedef struct -{ - THighlightType type; - TEL_COLOUR col; -} TEL_HIGHLIGHT, *tel_highlight; - -/* currently, the routines ignore wsid */ - -/* ws, hid, highlighrep */ -extern TStatus TelSetHighlightRep( Tint, Tint, tel_highlight ); -/* ws, hid, highlighrep */ -extern TStatus TelGetHighlightRep( Tint, Tint, tel_highlight ); - -extern void TelPrintHighlightRep( Tint, Tint ); /* ws, hid */ -extern TStatus TelDeleteHighlightsForWS( Tint wsid ); - -#endif diff --git a/src/OpenGl/OpenGl_telem_inquire.hxx b/src/OpenGl/OpenGl_telem_inquire.hxx deleted file mode 100755 index 5f40c63626..0000000000 --- a/src/OpenGl/OpenGl_telem_inquire.hxx +++ /dev/null @@ -1,161 +0,0 @@ -#ifndef OPENGL_TELEM_INQUIRE_H -#define OPENGL_TELEM_INQUIRE_H - -typedef struct { - Tint number; /* number of Tints in list */ - Tint *integers; /* list of integers */ -} Tintlst; - -typedef struct { - Tint x_dim; /* dimension (number of divisions) along X */ - Tint y_dim; /* dimension (number of divisions) along Y */ -} Tdim; - -typedef union -{ - Tint idata; /* integer valued data */ - Tfloat fdata; /* float valued data */ - Tchar *data; /* %%TEMP - use for application data for now */ - TEL_POINT *pts3; /* list of 3d points */ - - struct - { - TEL_POINT ref_pt; /* reference text point */ - TEL_POINT anno; /* annotation pt/offset */ - Techar *string; /* text string */ - } atext3; - - Tint size; - Tint interior_style; /* interior style */ - Tint edge_flag; /* edge flag */ - Tintlst name_set; /* name sets */ - Tmatrix3 mat3; /* 3d transformation matrix */ - - struct - { - Tmatrix3 mat3; /* 3d transformation matrix */ - TComposeType compose_type; /* composition type */ - } local_xform_3; - - struct - { - Tint vrtflag; /* per vertex data flag */ - Tint num_bounds; /* number of lines in the set */ - Tint *bounds; /* list of number of points in each bound */ - TEL_POINT *points; /* array of points */ - TEL_COLOUR *colours; /* array of vertex colour values */ - } lineset3data; - - struct - { - Tint shpflag; /* primitive shape flag */ - Tint faflag; /* per fill area data flag */ - Tint vrtflag; /* per vertex data flag */ - TEL_POINT *gnormal; /* geometric normal */ - Tint num_points; /* number of vertices in fill area */ - tel_colour facet_colour_val; /* facet colour value */ - TEL_POINT *points; /* array of points */ - TEL_COLOUR *colours; /* array of vertex colour values */ - TEL_POINT *vnormals; /* array of vertex normals */ - } fillarea3data; - - struct - { - Tint shpflag; /* primitive shape flag */ - Tint faflag; /* per fill area data flag */ - Tint vrtflag; /* per vertex data flag */ - Tint edgflag; /* edge flag */ - TEL_POINT *gnormal; /* geometric normal */ - Tint *edgvis; /* edge visibility per edge */ - Tint num_bounds; /* number of bounds in fill area set */ - tel_colour facet_colour_val; /* facet colour value */ - Tint *bounds; /* bounds */ - TEL_POINT *points; /* array of points */ - TEL_COLOUR *colours; /* array of vertex colour values */ - TEL_POINT *vnormals; /* array of vertex normals */ - } fillareaset3data; - - struct - { - Tint fctflag; /* per facet data flag */ - Tint vrtflag; /* per vertex data flag */ - Tint num_facets; /* number of facets, (num_points-2) */ - TEL_POINT *gnormals; /* geometric normals */ - TEL_COLOUR *facet_colour_vals; /* facet colour value */ - TEL_POINT *points; /* array of points for all bounds */ - TEL_COLOUR *colours; /* array of vertex colour values */ - TEL_POINT *vnormals; /* array of vertex normals for all bounds */ - } trianglestrip3data; - - struct - { - Tint shpflag; /* primitive shape flag */ - Tint fctflag; /* per facet data flag */ - Tint vrtflag; /* per vertex data flag */ - Tdim dim; /* number of cols by rows */ - TEL_POINT *gnormals; /* geometric normals */ - TEL_COLOUR *facet_colour_vals; /* facet colour value */ - TEL_POINT *points; /* array of points for all bounds */ - TEL_COLOUR *colours; /* array of vertex colour values */ - TEL_POINT *vnormals; /* array of vertex normals for all bounds */ - } quadmesh3data; - - struct - { - Tint shpflag; /* primitive shape flag */ - Tint fctflag; /* per facet data flag */ - Tint vrtflag; /* per vertex data flag */ - Tint edgflag; /* per edge data flag */ - TEL_POINT *gnormals; /* geometric normals */ - Tint *edgvis; /* array of edge visibility flags for all edges */ - Tint num_vertices;/*number of fill areas in the set */ - TEL_COLOUR *facet_colour_vals; /* facet colour values */ - TEL_POINT *points; /* array of vertices */ - TEL_COLOUR *colours; /* array of vertex colour values */ - TEL_POINT *vnormals; /* array of vertex normals for all vertices */ - Tint num_bounds; /* number of bounds */ - Tint *bounds; /* list of number of points in each bound */ - Tint *indices; /* list of vertex indices for all bounds */ - } indexedpolygons3data; - - /* depth cue index */ /* -- idata -- */ - /* surface properties */ - /* back surface properties */ - TEL_SURF_PROP surf_prop; /* Front or back surface properties */ - /* interior shading method */ /* -- idata -- */ - /* interior lighting method */ /* -- idata -- */ - - struct - { - Tintlst on; /* list of activated lights */ - Tintlst off; /* list of deactivated lights */ - } light_source_state; - - struct { - Tint distinguish; /* distinguish */ - TelCullMode cull; /* culling mode */ - } face_processing_mode; - - /* polyline, polymarker, text, interior, back interior, edge colour */ - TEL_COLOUR gnl_colour; -} Teldata; - -typedef struct -{ - Tint size; - Tint act_size; - Tchar *buf; - Teldata *data; -} TEL_INQ_CONTENT, *tel_inq_content; - -/* keys to be used for inquiry */ -#define INQ_GET_SIZE_ID 1 /* key.data.ldata will contain size */ -#define INQ_GET_CONTENT_ID 2 /* key.data.pdata is pointer to Teldata */ - -/* element, size */ -extern TStatus TelInqCurElemTypeSize( TelType *, Tint * ); - -/* size of buffer, buffer, actual_size, data */ -extern TStatus TelInqCurElemContent( Tint, Tchar *, Tint *, Teldata * ); - -#endif diff --git a/src/OpenGl/OpenGl_telem_pick.hxx b/src/OpenGl/OpenGl_telem_pick.hxx deleted file mode 100755 index 4a6318f112..0000000000 --- a/src/OpenGl/OpenGl_telem_pick.hxx +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef OPENGL_TELEM_PICK_H -#define OPENGL_TELEM_PICK_H - -typedef union -{ - unsigned int s[2]; - Tint i; -} TEL_PACKED_NAME, *tel_packed_name; - -typedef enum -{ - TTopFirst, TBottomFirst -} TPickOrder; - -typedef struct -{ - Tint el_num; - Tint pick_id; - Tint struct_id; -} TEL_PICK_PATH, *tel_pick_path; - -typedef struct -{ - Tint depth; - tel_pick_path pick_path; -} TEL_PICK_REPORT, *tel_pick_report; - -extern Tint TglVpBeingPicked; /* defined in telem/pick */ - -extern TStatus TPick( Tint, Tint, Tint, Tfloat, Tfloat, /*wsid, x, y, apw, aph*/ - TPickOrder, Tint, tel_pick_report );/*order, depth, rep*/ - -#endif diff --git a/src/OpenGl/OpenGl_telem_util.cxx b/src/OpenGl/OpenGl_telem_util.cxx index 92bcbb2c5b..25962e3b63 100755 --- a/src/OpenGl/OpenGl_telem_util.cxx +++ b/src/OpenGl/OpenGl_telem_util.cxx @@ -76,183 +76,11 @@ when a face has confused or aligned points. #include #endif /* WNT */ -#include -#include - #include -#include -#include -#include -#include #include -#include -#include -#include -#include -#include -#include - -/*----------------------------------------------------------------------*/ -/* -* Constantes -*/ - -#define NO_TRACE -#define CALL_DEF_DELTA 10 -#define NO_COPYBUFFER - -/*----------------------------------------------------------------------*/ -/* -* Variables statiques -*/ - -static Tint call_back_buffer_restored = TOff; - -#ifndef WNT - -/* -* Wrappers and utilities used to select between pixmap and gl double buffering -*/ - -/* Cache some pixmap info for pixmap double buffering */ - -static Display *window_display; /* the display in use */ -static Window window_id; /* the window to copy the pixmap to */ -static Pixmap pixmap_id; /* the pixmap id */ -static GLXPixmap glx_pixmap; /* the glx pixmap */ -static int -window_width, /* window width and height for XCopyArea */ -window_height, -window_depth; - -static GC window_gc; /* GC for XCopyArea */ - -static GLXContext glx_context; /* GL Context */ - -static int usePixmapDB = 0; /* True if doing pixmap double buffering */ - -/*----------------------------------------------------------------------*/ - -void TelSetPixmapDBParams(Display *dpy, - Window window, - int width, int height, int depth, GC gc, - Pixmap pixmap, - GLXPixmap glxpixmap, - GLXContext ctx) - -{ - window_display = dpy; - window_id = window; - window_width = width; - window_height = height; - window_depth = depth; - window_gc = gc; - - pixmap_id = pixmap; - - glx_pixmap = glxpixmap; - - glx_context = ctx; -} - -GLXPixmap TelGetGLXPixmap() -{ - return glx_pixmap; -} - -void TelSetPixmapDB(int flag) -{ - usePixmapDB = flag; -} - -int TelTestPixmapDB() -{ - return usePixmapDB; -} - -void TelDrawBuffer(GLenum buf) -{ - if (usePixmapDB) - glDrawBuffer(GL_FRONT); - else - glDrawBuffer(buf); -} - -#endif /* WNT */ - -/*----------------------------------------------------------------------*/ - -void TelMakeFrontBufCurrent(Tint WsId) -{ -#ifndef WNT - if (usePixmapDB) - { - glXMakeCurrent(window_display,window_id, glx_context); - glDrawBuffer(GL_FRONT); - } - else -#endif /* WNT */ - { - glDrawBuffer(GL_FRONT); - } -} - -void TelMakeBackBufCurrent(Tint WsId) -{ -#ifndef WNT - if (usePixmapDB) - { - glXMakeCurrent(window_display,glx_pixmap, glx_context); - glDrawBuffer(GL_BACK); - } - else -#endif /* WNT */ - { - glDrawBuffer(GL_BACK); - } -} - -#ifdef IMP190100 -void TelMakeFrontAndBackBufCurrent(Tint WsId) -{ -#ifndef WNT - if (usePixmapDB) - { - glXMakeCurrent(window_display,window_id, glx_context); - glDrawBuffer(GL_FRONT_AND_BACK); - } - else -#endif /* WNT */ - { - glDrawBuffer(GL_FRONT_AND_BACK); - } -} -#endif - -/*----------------------------------------------------------------------*/ -Tint -TelRemdupnames(Tint *ls, Tint num ) -{ - register Tint *ap, *bp, n; - - if( num < 2 ) - return num; - - ap = bp = ls+1; - n = num-1; - while( n-- ) - { - if( ap[-1] != *bp ) - *ap++ = *bp++; - else - bp++; - } - - return ap-ls; -} +#include +#include -/*----------------------------------------------------------------------*/ -#ifdef BUC60823 #define GPRECIS 0.000001 Tint TelGetPolygonNormal(tel_point pnts, Tint* indexs, Tint npnt, Tfloat *norm ) { Tint status=0; @@ -311,53 +139,8 @@ Tint TelGetNormal(Tfloat *data1, Tfloat *data2, Tfloat *data3, Tfloat *norm ) { return status; } -#else -void -TelGetNormal(Tfloat *data1, Tfloat *data2, Tfloat *data3, Tfloat *norm ) { - Tfloat a[3], b[3]; - vecsub( a, data2, data1 ); - vecsub( b, data3, data2 ); - veccrs( norm, a, b ); -} -#endif - -/*----------------------------------------------------------------------*/ -Tint -TelIsBackFace(Tmatrix3 n, Tfloat *nrm ) -{ - Tfloat r[4], m[4]; - - veccpy(m,nrm); - m[3] = ( float )1.0; - - TelTranpt3( r, m, n ); - - return r[2] < 0.0; -} - -/*----------------------------------------------------------------------*/ -void -TelTransposemat3 (Tmatrix3 a) -{ - Tint row, col; - Tmatrix3 res; - Tint dim = 4; - - /* transposition de la sous-matrice dim x dim */ - for (row = 0; row < dim; row++) - for (col = 0; col < dim; col++) - res[row][col] = a[col][row]; - - /* copie du resultat */ - matcpy (a, res); - - return; -} - -/*----------------------------------------------------------------------*/ -void -TelMultiplymat3 (Tmatrix3 c, Tmatrix3 a, Tmatrix3 b) +void TelMultiplymat3 (Tmatrix3 c, Tmatrix3 a, Tmatrix3 b) { Tint row, col, i; Tmatrix3 res; @@ -378,750 +161,3 @@ TelMultiplymat3 (Tmatrix3 c, Tmatrix3 a, Tmatrix3 b) return; } - -/*----------------------------------------------------------------------*/ -void -TelTranpt3(Tfloat tpt[4], Tfloat pt[4], Tmatrix3 mat ) -{ - register long i, j; - Tfloat sum; - - for( i = 0; i < 4; i++ ) - { - for( j = 0, sum = ( float )0.0; j < 4; j++ ) - { - sum += pt[j] * mat[j][i]; - } - tpt[i] = sum; - } - return; -} - -/*----------------------------------------------------------------------*/ -void -TelInitWS(Tint ws, Tint w, Tint h, Tfloat bgcolr, Tfloat bgcolg, Tfloat bgcolb ) -{ - CMN_KEY_DATA data; - - TsmGetWSAttri( ws, WSDbuff, &data ); - - glMatrixMode(GL_MODELVIEW); - glViewport( 0, 0, w, h); - - /* - * CAL mai 1998 - * Contournement bug SGI sur Octane (PRO12899) - * Bavures de pixels lors de la copie de vue 3d - */ - glDisable (GL_SCISSOR_TEST); - -#ifdef TRACE - printf("OPENGL: TelInitWS: glClearColor %d \n", ws); -#endif - if( data.ldata == TOn ) - { -#ifndef WNT - if (TelTestPixmapDB()) - { - glDrawBuffer(GL_FRONT); - glClearColor(bgcolr, bgcolg, bgcolb, 1.0); - glClear(GL_COLOR_BUFFER_BIT); - } - else - { - /* QTOCC_PATCH by PCD: the frame buffer should not be cleared here - to avoid flicker. It is cleared properly in TelClearViews() - called by call_func_redraw_all_structs_begin() */ - glDrawBuffer(GL_BACK); - } -#else - /* QTOCC_PATCH by PCD: the frame buffer should not be cleared here - to avoid flicker. It is cleared properly in TelClearViews() - called by call_func_redraw_all_structs_begin() */ - glDrawBuffer(GL_BACK); -#endif /* WNT */ - } - else - { - glClearColor(bgcolr, bgcolg, bgcolb, ( float )1.0); - glClear(GL_COLOR_BUFFER_BIT); - } - return; - -} - - -/*----------------------------------------------------------------------*/ -void TelSwapBuffers ( Tint ws ) { - -#ifndef WNT - - CMN_KEY_DATA data; - - if (TelTestPixmapDB()) - { - glFlush(); - XCopyArea(call_thedisplay, pixmap_id, window_id, - window_gc, 0, 0, - window_width, window_height, 0, 0); - } - else - { - TsmGetWSAttri( ws, WSWindow, &data ); - glXSwapBuffers ( call_thedisplay, data.ldata ); - } - -#else - - SwapBuffers ( wglGetCurrentDC () ); - TelFlush(0); - -#endif /* WNT */ - - TelSetBackBufferRestored (TOff); - -#ifdef TRACE - printf("OPENGL: TelSwapBuffers: glXSwapBuffers %d \n", ws); -#endif - - return; - -} /* end TelSwapBuffers */ - -/*----------------------------------------------------------------------*/ -Tint -TelBackBufferRestored () -{ - return call_back_buffer_restored; -} - -/*----------------------------------------------------------------------*/ -void -TelSetBackBufferRestored (Tint flag) -{ -#ifdef TRACE - printf("OPENGL: TelSetBackBufferRestored(%d): \n",flag); -#endif - call_back_buffer_restored = flag; -} - -/*----------------------------------------------------------------------*/ -void -TelCopyBuffers(Tint ws, GLenum from, GLenum to, - Tfloat xm, Tfloat ym, Tfloat zm, Tfloat XM, Tfloat YM, Tfloat ZM, Tint flag) -{ - CMN_KEY_DATA key; - Tint w, h; - -#ifdef TRACE - printf("OPENGL: TelCopyBuffers: \n"); -#endif - - if (to == GL_BACK) TelSetBackBufferRestored (TOff); - -#ifndef WNT - if (TelTestPixmapDB()) - { -#ifdef TRACE - printf("OPENGL: TelSwapBuffers: glFlush \n"); -#endif - glFlush(); - XCopyArea(window_display, pixmap_id, window_id, - window_gc, 0, 0, - window_width, window_height, 0, 0); - return; - } -#endif /* WNT */ - - TsmGetWSAttri (ws, WSWidth, &key); - w = key.ldata; - TsmGetWSAttri (ws, WSHeight, &key); - h = key.ldata; - - glMatrixMode (GL_PROJECTION); - glPushMatrix (); - glLoadIdentity (); - gluOrtho2D ((GLdouble) 0., (GLdouble) w, 0., (GLdouble) h); - glMatrixMode (GL_MODELVIEW); - glPushMatrix (); - glLoadIdentity (); - - TelDisable (ws); - if (flag) - { - /* - * calcul de la projection de la boite - * et copie du rectangle projete - */ - Tint i; - GLsizei width, height; - Tfloat xmr, ymr, XMR, YMR; - Tfloat xr[8], yr[8]; - /* - * Projection de la boite englobante - */ - if ((TelProjectionRaster (ws, xm, ym, zm, &xr[0], &yr[0]) == TSuccess) - && (TelProjectionRaster (ws, xm, YM, zm, &xr[1], &yr[1]) == TSuccess) - && (TelProjectionRaster (ws, XM, YM, zm, &xr[2], &yr[2]) == TSuccess) - && (TelProjectionRaster (ws, XM, ym, zm, &xr[3], &yr[3]) == TSuccess) - && (TelProjectionRaster (ws, xm, ym, ZM, &xr[4], &yr[4]) == TSuccess) - && (TelProjectionRaster (ws, xm, YM, ZM, &xr[5], &yr[5]) == TSuccess) - && (TelProjectionRaster (ws, XM, YM, ZM, &xr[6], &yr[6]) == TSuccess) - && (TelProjectionRaster (ws, XM, ym, ZM, &xr[7], &yr[7]) == TSuccess)) - { - xmr = ymr = (float ) shortreallast (); - XMR = YMR = (float ) shortrealfirst (); - /* - * Recherche du rectangle projete - */ - for (i=0; i<8; i++) { - if (xmr > xr[i]) xmr = xr[i]; - if (ymr > yr[i]) ymr = yr[i]; - if (XMR < xr[i]) XMR = xr[i]; - if (YMR < yr[i]) YMR = yr[i]; - } - /* pour eviter les bavures de pixels ! */ - xmr--;ymr--; - XMR++;YMR++; - - /* - * Ajout CAL : 10/05/96 - * Si les MinMax viennent d'un ensemble de markers - * on ne tient pas compte du scale factor de ceux-ci - * dans les valeurs de MinMax. En effet, ce facteur - * est dans l'espace pixel et les MinMax dans l'espace - * du modele. Donc ajout d'un delta de pixels - * en esperant que les applis n'utilisent pas des - * markers tres gros ! - */ - xmr -= CALL_DEF_DELTA; ymr -= CALL_DEF_DELTA; - XMR += CALL_DEF_DELTA; YMR += CALL_DEF_DELTA; - - /* - * Le rectangle projete peut-etre clippe - */ - width = (GLsizei) (XMR-xmr+1); - height = (GLsizei) (YMR-ymr+1); -#ifdef COPYBUFFER - printf ("avant clipping\n"); - printf ("xm, ym, zm : %f, %f, %f\n", xm, ym, zm); - printf ("XM, YM, ZM : %f, %f, %f\n", XM, YM, ZM); - printf ("taille fenetre : %d, %d\n", w, h); - printf ("xmr, ymr by GLU : %f, %f\n", xmr, ymr); - printf ("YMR, YMR by GLU : %f, %f\n", XMR, YMR); - printf ("copie x, y, dx, dy : %d, %d, %d, %d\n\n", - (int) xmr, (int) ymr, (int) width, (int) height); -#endif - /* - * (xmr,ymr) coin inferieur gauche - * (XMR,YMR) coin superieur droit - */ - /* cas ou 1 coin est en dehors de la fenetre */ - if (xmr < 0) { width = (GLsizei) (XMR+1); xmr = 0; } - if (ymr < 0) { height = (GLsizei) (YMR+1); ymr = 0; } - if (XMR > w) { width = (GLsizei) (w-xmr+1); } - if (YMR > h) { height = (GLsizei) (h-ymr+1); } - - /* cas ou les 2 coins sont en dehors de la fenetre */ - if (XMR < 0) { xmr = 0; width = height = 1; } - if (YMR < 0) { ymr = 0; width = height = 1; } - if (xmr > w) { xmr = 0; width = height = 1; } - if (ymr > h) { ymr = 0; width = height = 1; } -#ifdef COPYBUFFER - printf ("apres clipping\n"); - printf ("xmr, ymr by GLU : %f, %f\n", xmr, ymr); - printf ("YMR, YMR by GLU : %f, %f\n", XMR, YMR); - printf ("copie x, y, dx, dy : %d, %d, %d, %d\n\n", - (int) xmr, (int) ymr, (int) width, (int) height); -#endif - glDrawBuffer (to); - glReadBuffer (from); - /* copie partielle */ - glRasterPos2i ((GLint) xmr, (GLint) ymr); - glCopyPixels ((GLint) xmr, (GLint) ymr, width, height, GL_COLOR); - /* TelFlush (1); */ - } - else - { - glDrawBuffer (to); - /* TelClearViews (ws); */ - glReadBuffer (from); - /* copie complete */ - glRasterPos2i (0, 0); - glCopyPixels (0, 0, w+1, h+1, GL_COLOR); - /* TelFlush (1); */ - } - } - else - { - glDrawBuffer (to); - /* TelClearViews (ws); */ - glReadBuffer (from); - /* copie complete */ - glRasterPos2i (0, 0); - glCopyPixels (0, 0, w+1, h+1, GL_COLOR); - /* TelFlush (1); */ - } - TelEnable (ws); - - glMatrixMode (GL_PROJECTION); - glPopMatrix (); - glMatrixMode (GL_MODELVIEW); - glPopMatrix (); - - glDrawBuffer (GL_BACK); - return; -} - -/*----------------------------------------------------------------------*/ -void -TelReadImage(Tint ws, GLenum from, Tint posx, Tint posy, Tint width, Tint height, unsigned int *image) -{ - CMN_KEY_DATA key; - Tint w, h; - -#ifdef TRACE - printf("OPENGL: TelReadImage: %d %d %d %d \n", posx, posy, width, height); -#endif - - if (image !=NULL) - { - TsmGetWSAttri (ws, WSWidth, &key); - w = key.ldata; - TsmGetWSAttri (ws, WSHeight, &key); - h = key.ldata; - - glMatrixMode (GL_PROJECTION); - glLoadIdentity (); - gluOrtho2D ((GLdouble) 0., (GLdouble) w, 0., (GLdouble) h); - glMatrixMode (GL_MODELVIEW); - glLoadIdentity (); - - glReadBuffer(from); - - glRasterPos2i (posx, posy); - TelDisable (ws); - glReadPixels (posx, posy, width, height, GL_RGBA, GL_UNSIGNED_BYTE, image); - TelEnable (ws); - - glReadBuffer(GL_BACK); - } - - return; -} - -/*----------------------------------------------------------------------*/ -void -TelDrawImage(Tint ws, GLenum to, Tint posx, Tint posy, Tint width, Tint height, unsigned int *image) -{ - CMN_KEY_DATA key; - Tint w, h; - -#ifdef TRACE - printf("OPENGL: TelDrawImage: %d %d %d %d \n", posx, posy, width, height); -#endif - - if (image !=NULL) - { - TsmGetWSAttri (ws, WSWidth, &key); - w = key.ldata; - TsmGetWSAttri (ws, WSHeight, &key); - h = key.ldata; - - glMatrixMode (GL_PROJECTION); - glLoadIdentity (); - gluOrtho2D ((GLdouble) 0., (GLdouble) w, 0., (GLdouble) h); - glMatrixMode (GL_MODELVIEW); - glLoadIdentity (); - - glDrawBuffer(to); - - glRasterPos2i (posx, posy); - TelDisable (ws); - glDrawPixels (width, height, GL_RGBA, GL_UNSIGNED_BYTE, image); - TelEnable (ws); - - glDrawBuffer(GL_BACK); - } - return; -} - -/*----------------------------------------------------------------------*/ -void -TelReadDepths(Tint ws, Tint posx, Tint posy, Tint width, Tint height, float *depths) -{ - CMN_KEY_DATA key; - Tint w, h; - -#ifdef TRACE - printf("OPENGL: TelReadDepths: %d %d %d %d \n", posx, posy, width, height); -#endif - - if ( TsmGetWSAttri (ws, WSWindow, &key) != TSuccess ) return; - - if (depths != NULL && TxglWinset (call_thedisplay, (WINDOW) key.ldata) == TSuccess) - { - TsmGetWSAttri (ws, WSWidth, &key); - w = key.ldata; - TsmGetWSAttri (ws, WSHeight, &key); - h = key.ldata; - - glMatrixMode (GL_PROJECTION); - glLoadIdentity (); - gluOrtho2D ((GLdouble) 0., (GLdouble) w, 0., (GLdouble) h); - glMatrixMode (GL_MODELVIEW); - glLoadIdentity (); - - glRasterPos2i (posx, posy); - TelDisable (ws); - glReadPixels (posx, posy, width, height, GL_DEPTH_COMPONENT, GL_FLOAT, depths); - TelEnable (ws); - } - - return; -} - -/*----------------------------------------------------------------------*/ -void -TelEnable (Tint ws) -{ - /*glPixelTransferi (GL_MAP_COLOR, GL_TRUE);*/ - - /* GL_DITHER on/off pour le trace */ - if (TxglGetDither()) - glEnable (GL_DITHER); - else - glDisable (GL_DITHER); - - return; -} - -/*----------------------------------------------------------------------*/ -void -TelDisable (Tint ws) -{ - glDisable (GL_DITHER); - glPixelTransferi (GL_MAP_COLOR, GL_FALSE); - - /* - * Disable stuff that's likely to slow down glDrawPixels. - * (Omit as much of this as possible, when you know in advance - * that the OpenGL state will already be set correctly.) - */ - glDisable(GL_ALPHA_TEST); - glDisable(GL_BLEND); - glDisable(GL_DEPTH_TEST); - glDisable(GL_FOG); - LightOff(); - - glDisable(GL_LOGIC_OP); - glDisable(GL_STENCIL_TEST); - glDisable(GL_TEXTURE_1D); - glDisable(GL_TEXTURE_2D); - glPixelTransferi(GL_MAP_COLOR, GL_FALSE); - glPixelTransferi(GL_RED_SCALE, 1); - glPixelTransferi(GL_RED_BIAS, 0); - glPixelTransferi(GL_GREEN_SCALE, 1); - glPixelTransferi(GL_GREEN_BIAS, 0); - glPixelTransferi(GL_BLUE_SCALE, 1); - glPixelTransferi(GL_BLUE_BIAS, 0); - glPixelTransferi(GL_ALPHA_SCALE, 1); - glPixelTransferi(GL_ALPHA_BIAS, 0); - - /* - * Disable extensions that could slow down glDrawPixels. - * (Actually, you should check for the presence of the proper - * extension before making these calls. I've omitted that - * code for simplicity.) - */ - -#ifdef GL_EXT_convolution - glDisable(GL_CONVOLUTION_1D_EXT); - glDisable(GL_CONVOLUTION_2D_EXT); - glDisable(GL_SEPARABLE_2D_EXT); -#endif - -#ifdef GL_EXT_histogram - glDisable(GL_HISTOGRAM_EXT); - glDisable(GL_MINMAX_EXT); -#endif - -#ifdef GL_EXT_texture3D - glDisable(GL_TEXTURE_3D_EXT); -#endif - - return; -} - -/*----------------------------------------------------------------------*/ -TStatus -TelProjectionRaster(Tint ws, Tfloat x, Tfloat y, Tfloat z, Tfloat *xr, Tfloat *yr) -{ - Tint w, h; - CMN_KEY_DATA key; - Tint vid; /* View index */ - TEL_VIEW_REP vrep; /* View definition */ - - GLint status; - - int i, j, k; - GLdouble objx, objy, objz; - GLdouble modelMatrix[16], projMatrix[16]; - GLint viewport[4]; - GLdouble winx, winy, winz; - - vid = ws; - - if (TelGetViewRepresentation (ws, vid, &vrep) != TSuccess) - return TFailure; - - TsmGetWSAttri (ws, WSWidth, &key); - w = key.ldata; - TsmGetWSAttri (ws, WSHeight, &key); - h = key.ldata; - - objx = ( GLdouble )x; objy = ( GLdouble )y; objz = ( GLdouble )z; - - for (k = 0, i = 0; i < 4; i++) - for (j = 0; j < 4; j++, k++) - modelMatrix[k] = ( GLdouble )vrep.orientation_matrix[i][j]; - - for (k = 0, i = 0; i < 4; i++) - for (j = 0; j < 4; j++, k++) - projMatrix[k] = ( GLdouble )vrep.mapping_matrix[i][j]; - - viewport[0] = 0; - viewport[1] = 0; - viewport[2] = w; - viewport[3] = h; - - /* - * glGetIntegerv (GL_VIEWPORT, viewport); - * glGetDoublev (GL_MODELVIEW_MATRIX, modelMatrix); - * glGetDoublev (GL_PROJECTION_MATRIX, projMatrix); - */ - - status = gluProject (objx, objy, objz, - modelMatrix, projMatrix, viewport, - &winx, &winy, &winz); - - if (status == GL_TRUE) { - *xr = ( Tfloat )winx; - *yr = ( Tfloat )winy; - return TSuccess; - } - else - { - *xr = 0.0F; - *yr = 0.0F; - return TFailure; - } -} - -/*----------------------------------------------------------------------*/ -TStatus -TelUnProjectionRaster(Tint ws, Tint xr, Tint yr, Tfloat *x, Tfloat *y, Tfloat *z) -{ - Tint w, h; - CMN_KEY_DATA key; - Tint vid; /* View index */ - TEL_VIEW_REP vrep; /* View definition */ - - int i, j, k; - GLdouble objx, objy, objz; - GLdouble modelMatrix[16], projMatrix[16]; - GLint viewport[4]; - GLdouble winx, winy, winz; - GLint status; - - vid = ws; - - if (TelGetViewRepresentation (ws, vid, &vrep) != TSuccess) - return TFailure; - - TsmGetWSAttri (ws, WSWidth, &key); - w = key.ldata; - TsmGetWSAttri (ws, WSHeight, &key); - h = key.ldata; - - winx = ( GLdouble )xr; winy = ( GLdouble )yr; winz = ( GLdouble )0.0; - - for (k = 0, i = 0; i < 4; i++) - for (j = 0; j < 4; j++, k++) - modelMatrix[k] = ( GLdouble )vrep.orientation_matrix[i][j]; - - for (k = 0, i = 0; i < 4; i++) - for (j = 0; j < 4; j++, k++) - projMatrix[k] = ( GLdouble )vrep.mapping_matrix[i][j]; - - viewport[0] = 0; - viewport[1] = 0; - viewport[2] = w; - viewport[3] = h; - - /* - * glGetIntegerv (GL_VIEWPORT, viewport); - * glGetDoublev (GL_MODELVIEW_MATRIX, modelMatrix); - * glGetDoublev (GL_PROJECTION_MATRIX, projMatrix); - */ - - status = gluUnProject (winx, winy, winz, modelMatrix, projMatrix, viewport, - &objx, &objy, &objz); - - if (status == GL_TRUE) { - *x = ( Tfloat )objx; - *y = ( Tfloat )objy; - *z = ( Tfloat )objz; - - return TSuccess; - } - else { - *x = 0.0F; - *y = 0.0F; - *z = 0.0F; - - return TFailure; - } -} - -/*----------------------------------------------------------------------*/ -TStatus -TelUnProjectionRasterWithRay(Tint ws, Tint xr, Tint yr, Tfloat *x, Tfloat *y, Tfloat *z, - Tfloat *dx, Tfloat *dy, Tfloat *dz) -{ - Tint w, h; - CMN_KEY_DATA key; - Tint vid; /* View index */ - TEL_VIEW_REP vrep; /* View definition */ - - int i, j, k; - GLdouble objx, objy, objz; - GLdouble objx1, objy1, objz1; - GLdouble modelMatrix[16], projMatrix[16]; - GLint viewport[4]; - GLdouble winx, winy, winz; - GLint status; - - vid = ws; - - if (TelGetViewRepresentation (ws, vid, &vrep) != TSuccess) - return TFailure; - - TsmGetWSAttri (ws, WSWidth, &key); - w = key.ldata; - TsmGetWSAttri (ws, WSHeight, &key); - h = key.ldata; - - winx = ( GLdouble )xr; winy = ( GLdouble )yr; winz = ( GLdouble )0.0; - - for (k = 0, i = 0; i < 4; i++) - for (j = 0; j < 4; j++, k++) - modelMatrix[k] = ( GLdouble )vrep.orientation_matrix[i][j]; - - for (k = 0, i = 0; i < 4; i++) - for (j = 0; j < 4; j++, k++) - projMatrix[k] = ( GLdouble )vrep.mapping_matrix[i][j]; - - viewport[0] = 0; - viewport[1] = 0; - viewport[2] = w; - viewport[3] = h; - - /* - * glGetIntegerv (GL_VIEWPORT, viewport); - * glGetDoublev (GL_MODELVIEW_MATRIX, modelMatrix); - * glGetDoublev (GL_PROJECTION_MATRIX, projMatrix); - */ - - status = gluUnProject (winx, winy, winz, modelMatrix, projMatrix, viewport, - &objx, &objy, &objz); - - if (status == GL_TRUE) { - *x = ( Tfloat )objx; - *y = ( Tfloat )objy; - *z = ( Tfloat )objz; - - winz = ( GLdouble ) -10.0; - status = gluUnProject (winx, winy, winz, modelMatrix, projMatrix, viewport, - &objx1, &objy1, &objz1); - - if (status == GL_TRUE) { - *dx = ( Tfloat )(objx-objx1); - *dy = ( Tfloat )(objy-objy1); - *dz = ( Tfloat )(objz-objz1); - - return TSuccess; - } - else { - *dx = 0.0F; - *dy = 0.0F; - *dz = 0.0F; - - return TFailure; - } - } - else { - *x = 0.0F; - *y = 0.0F; - *z = 0.0F; - *dx = 0.0F; - *dy = 0.0F; - *dz = 0.0F; - - return TFailure; - } -} - -/*----------------------------------------------------------------------*/ -void -TelFlush(Tint wait) -{ - if (wait) - { -#ifdef TRACE - printf("OPENGL: TelFlush: glFinish \n"); -#endif - glFinish (); - } - else - { -#ifdef TRACE - printf("OPENGL: TelFlush: glFlush \n"); -#endif - glFlush(); - } - return; -} - -/*----------------------------------------------------------------------*/ -Tint -TelIsBackFacePerspective(Tmatrix3 n, Tfloat *p1, Tfloat *p2, Tfloat *p3 ) -{ - Tfloat r1[4], r2[4], r3[4], m[4], norm[4]; - - veccpy( m, p1 ); - m[3] = ( float )1.0; - TelTranpt3( r1, m, n ); - r1[0] /= r1[3]; - r1[1] /= r1[3]; - r1[2] /= r1[3]; - - veccpy( m, p2 ); - m[3] = ( float )1.0; - TelTranpt3( r2, m, n ); - r2[0] /= r2[3]; - r2[1] /= r2[3]; - r2[2] /= r2[3]; - - veccpy( m, p3 ); - m[3] = ( float )1.0; - TelTranpt3( r3, m, n ); - r3[0] /= r3[3]; - r3[1] /= r3[3]; - r3[2] /= r3[3]; - TelGetNormal( r1, r2, r3, norm ); - - return norm[2] < 0.0; -} - -/*----------------------------------------------------------------------*/ diff --git a/src/OpenGl/OpenGl_telem_util.hxx b/src/OpenGl/OpenGl_telem_util.hxx index 61c88fb679..3c10aa82c0 100755 --- a/src/OpenGl/OpenGl_telem_util.hxx +++ b/src/OpenGl/OpenGl_telem_util.hxx @@ -38,7 +38,7 @@ xx-xx-xx : xxx ; Creation. #ifndef WNT #include #endif -#include +#include /* * ShortRealLast () = 3.40282346638528860e+38 @@ -130,90 +130,8 @@ Tmatrix3Struct; } \ } -extern Tint TelRemdupnames( Tint*, Tint ); /* list, num */ -#ifdef BUC60823 extern int TelGetPolygonNormal( tel_point, Tint*, Tint, Tfloat* ); extern int TelGetNormal( Tfloat*, Tfloat*, Tfloat*, Tfloat* ); -#else -extern void TelGetNormal( Tfloat*, Tfloat*, Tfloat*, Tfloat* ); -#endif -/* point1, point2, point3, normal */ -extern Tint TelIsBackFace( Tmatrix3, Tfloat* ); /* normal */ -extern Tint TelIsBackFacePerspective( Tmatrix3, Tfloat*, Tfloat*, Tfloat* ); -/* matrix, point 1, point 2, point 3 */ extern void TelMultiplymat3( Tmatrix3, Tmatrix3, Tmatrix3 ); -/* mat out, mat in, mat in */ -extern void TelTransposemat3( Tmatrix3 ); /* mat in out */ -extern void TelTranpt3( Tfloat [4], Tfloat [4], Tmatrix3 ); /* out, in, mat */ - -extern void TelInitWS( Tint, Tint, Tint, Tfloat, Tfloat, Tfloat ); -/* ws, width, height, bgcolr, bgcolg, bgcolb */ -extern void TelSwapBuffers( Tint ); -extern void TelCopyBuffers( Tint, GLenum, GLenum, - Tfloat, Tfloat, Tfloat, Tfloat, Tfloat, Tfloat, Tint ); -extern TStatus TelProjectionRaster( Tint ws, Tfloat x, Tfloat y, Tfloat z, - Tfloat *xr, Tfloat *yr); -extern TStatus TelUnProjectionRaster( Tint ws, Tint xr, Tint yr, - Tfloat *x, Tfloat *y, Tfloat *z); -TStatus -TelUnProjectionRasterWithRay(Tint ws, Tint xr, Tint yr, Tfloat *x, Tfloat *y, Tfloat *z, - Tfloat *dx, Tfloat *dy, Tfloat *dz); -extern Tint TelBackBufferRestored(void); -extern void TelSetBackBufferRestored( Tint ); -extern void TelEnable( Tint ); -extern void TelDisable( Tint ); -extern void TelFlush( Tint ); - -extern void TelSetFrontFaceAttri( - Tint, /* interior_style */ - Tint, /* back_interior_style */ - Tint, /* interior_index */ - Tint, /* back_interior_index */ - Tint, /* front_shading_method */ - Tint, /* back_shading_method */ - Tint, /* front_lighting_model */ - Tint, /* back_lighting_model */ - tel_surf_prop, /* surf_prop */ - tel_surf_prop, /* back_surf_prop */ - tel_colour, /* interior_colour */ - tel_colour /* back_interior_colour */ - ); -extern void TelSetBackFaceAttri( - Tint, /* interior_style */ - Tint, /* back_interior_style */ - Tint, /* interior_index */ - Tint, /* back_interior_index */ - Tint, /* front_shading_method */ - Tint, /* back_shading_method */ - Tint, /* front_lighting_model */ - Tint, /* back_lighting_model */ - tel_surf_prop, /* surf_prop */ - tel_surf_prop, /* back_surf_prop */ - tel_colour, /* interior_colour */ - tel_colour /* back_interior_colour */ - ); - -extern void TelReadImage(Tint , GLenum , Tint , Tint , Tint , Tint , unsigned int *); -extern void TelDrawImage(Tint , GLenum , Tint , Tint , Tint , Tint , unsigned int *); -extern void TelReadDepths(Tint , Tint , Tint , Tint , Tint , float *); - -extern void TelMakeFrontBufCurrent(Tint ); -extern void TelMakeBackBufCurrent(Tint ); -#ifdef IMP190100 -extern void TelMakeFrontAndBackBufCurrent(Tint ); -#endif - -#ifndef WNT -extern void TelSetPixmapDBParams(Display *dpy, - Window window, - int width, int height, int depth, GC gc, - Pixmap pixmap, - GLXPixmap glxpixmap, - GLXContext ctx); -extern GLXPixmap TelGetGLXPixmap(void); -extern void TelSetPixmapDB(int flag); -extern int TelTestPixmapDB(void); -extern void TelDrawBuffer(GLenum buf); -#endif /* WNT*/ #endif diff --git a/src/OpenGl/OpenGl_telem_view.cxx b/src/OpenGl/OpenGl_telem_view.cxx new file mode 100644 index 0000000000..d6eff5d8a0 --- /dev/null +++ b/src/OpenGl/OpenGl_telem_view.cxx @@ -0,0 +1,330 @@ +/*********************************************************************** + +FONCTION : +---------- +File OpenGl_telem_view : + +************************************************************************/ + +#include +#include +#include +#include + +static void +EvalViewMappingMatrix( tel_view_mapping mapping /* View Mapping */, + Tint *error_ind /* Out: Error Indicator */, + Tmatrix3 mat /* Out: Mapping Matrix * */, + Tint flag, + Tfloat cx, + Tfloat cy, + Tint clip_flag, + Tlimit3 *clip_limit + ) +{ + Tfloat gx, gy, xsf, ysf, zsf; + Tfloat fpd, bpd; + + /* OCC18942 */ + Tfloat n, f, r, l, t, b, Zprp, dx, dy, VPD; + + /* FSXXX */ + /* GLint gdtmp; */ + Tlimit3 vp = { ( float )-1.0, ( float )1.0, ( float )-1.0, ( float )1.0, ( float )1.0, ( float )-1.0 }; + Tmatrix3 pmat = { { ( float )1.0, ( float )0.0, ( float )0.0, ( float )0.0 }, + { ( float )0.0, ( float )1.0, ( float )0.0, ( float )0.0 }, + { ( float )0.0, ( float )0.0, ( float )1.0, ( float )0.0 }, + { ( float )0.0, ( float )0.0, ( float )0.0, ( float )1.0 } }; + Tmatrix3 mmat = { { ( float )1.0, ( float )0.0, ( float )0.0, ( float )0.0 }, + { ( float )0.0, ( float )1.0, ( float )0.0, ( float )0.0 }, + { ( float )0.0, ( float )0.0, ( float )1.0, ( float )0.0 }, + { ( float )0.0, ( float )0.0, ( float )0.0, ( float )1.0 } }; + + fpd = mapping->fpd; + bpd = mapping->bpd; + + /* invalid window */ + if( mapping->window.xmin >= mapping->window.xmax || + mapping->window.ymin >= mapping->window.ymax ) + { + *error_ind = 1; + return; + } + + /* invalid viewport */ + if( mapping->viewport.xmin >= mapping->viewport.xmax || + mapping->viewport.ymin >= mapping->viewport.ymax || + mapping->viewport.zmin >= mapping->viewport.zmax ) + { + *error_ind = 2; + return; + } + + /* invalid back/front plane distances */ + if( mapping->bpd >= mapping->fpd ) + { + *error_ind = 3; + return; + } + + /* prp between front and back planes */ + if (!openglDisplay.IsNull() || !openglDisplay->Walkthrough()) + { + if( mapping->prp[2] < mapping->fpd && + mapping->prp[2] > mapping->bpd ) + { + *error_ind = 4; + return; + } + } + + if( mapping->prp[2] == mapping->vpd ) + { + *error_ind = 5; /* prp on view plane */ + return; + } + + if( mapping->viewport.xmin < 0 || + mapping->viewport.xmax > 1 || + mapping->viewport.ymin < 0 || + mapping->viewport.ymax > 1 || + mapping->viewport.zmin < 0 || + mapping->viewport.zmax > 1 ) + { + *error_ind = 6; /* viewport limits outside NPC space */ + return; + } + + *error_ind = 0; + + /* OCC18942: Moved here while debugging perspective projection matrix */ + /* centers */ + if( flag == 0 ) + { + cx = mapping->window.xmin + mapping->window.xmax, cx /= ( float )2.0; + cy = mapping->window.ymin + mapping->window.ymax, cy /= ( float )2.0; + } + + gx = (cx - mapping->prp[0]) / (mapping->vpd - mapping->prp[2]); + gy = (cy - mapping->prp[1]) / (mapping->vpd - mapping->prp[2]); + +#ifdef PRINT + printf("EvalViewMappingMatrix \n"); + printf("prp %f %f %f \n", mapping->prp[0], mapping->prp[1], mapping->prp[2]); + printf("vpd fpd bpd %f %f %f \n", mapping->vpd, mapping->fpd, mapping->bpd); + printf("window limit %f %f %f %f\n", mapping->window.xmin, mapping->window.xmax, + mapping->window.ymin, mapping->window.ymax); + printf("viewport limit %f %f %f %f\n", mapping->viewport.xmin, mapping->viewport.xmax, + mapping->viewport.ymin, mapping->viewport.ymax); +#endif + + /* projection matrix */ + if( mapping->proj == TelParallel ) + { + + pmat[2][0] = -gx; pmat[3][0] = mapping->vpd*gx; + pmat[2][1] = -gy; pmat[3][1] = mapping->vpd*gy; + } + else if (!openglDisplay.IsNull() && !openglDisplay->SymPerspective())/* TelPerspective */ + { + pmat[0][0] = pmat[1][1] = mapping->prp[2] - mapping->vpd; + pmat[2][0] = -gx; + pmat[2][1] = -gy; + pmat[2][3] = ( float )-1.0; + pmat[3][0] = mapping->vpd * gx; + pmat[3][1] = mapping->vpd * gy; + pmat[3][3] = mapping->prp[2]; + + /* modify the next two cells to change clipping policy */ + if (!openglDisplay.IsNull() && !openglDisplay->Walkthrough()) + { + pmat[2][2] = mapping->prp[2] - ( fpd + bpd ); + pmat[3][2] = fpd * bpd; + } + } + /* OCC18942: New approach to calculation of mapping (projection) matrix */ + else + { + dx = mapping->window.xmax - mapping->window.xmin; + dy = mapping->window.ymax - mapping->window.ymin; + Zprp = mapping->prp[2]; + VPD = Zprp - mapping->vpd; + + /* + Calculate canonical perspective projection parameters as if we were about + to use glFrustum() to create symmetric perspective frustum. + + After the view orientation matrix is applied, the coordinate system origin is located + at the VRP and oriented properly. However, the viewplane has width = dx and height = dy + and its center (cx, cy, VPD) is not always located at the view Z axis. + The canonical perspective projection matrix assumes the eye is located at (0, 0, 0). + Thus the old approach resulted in a non-symmetric perspective, + as X and Y coordinates of the projection reference point (PRP) were not updated + when cx and cy changed. Moreover, such "static" perspective had some other disadvantages, + such as non-realistic panning, i.e. instead of moving the eye (or camera) over the model + a sort of "frame" moved over the static perspective projection picture, + exposing a part of this static picture to the user. + + In order to make the perspective symmetric, we need to translate + the coordinate system to PRP before projection. + Thus we translate X, Y and Z co-ordinates by -cx, -cy and -Zprp respectively. + + NOTE: mat[i][j] means j-th element of i-th column, as OpenGL accepts the matrices + in column-major order, while in C two-dimensional arrays are stored in memory + in row-major order! + + VPD is used below instead of near clipping plane dispance (n) in order to simplify + calculation of l and r values. If we did not use VPD in the matrix calculation, we would have to + project 0.5 * dx, -0.5 * dx, 0.5 * dy and - 0.5 * dy onto the near clipping plane + to calculate these values. + + Pending issues: + 1. It is still necessary to find a way to calculate the perspective projection matrix + for TPM_WALKTHROUGH projection model. This projection model is not supported yet + by the new code. + */ + r = .5f * dx; + l = -r; + t = .5f * dy; + b = -t; + n = Zprp - fpd; f = Zprp - bpd; + + mat[0][0] = 2.f * VPD / (r - l); + mat[1][1] = 2.f * VPD / (t - b); + mat[2][0] = (r + l) / (r - l); + mat[2][1] = (t + b) / (t - b); + mat[2][2] = - (f + n) / (f - n); + mat[2][3] = -1.f; + /* + The last column takes into account translation along X, Y and Z axis + before projecting. This can be considered as a result of right-multiplying the canonical + perspective projection matrix P by a translation matrix T + (it differs form the canonical matrix by the last column only): + | 1 0 0 -cx | + | 0 1 0 -cy | + mat = P * T, where T = | 0 0 1 -Zprp | + | 0 0 0 1 | + */ + mat[3][0] = -mat[2][0] * Zprp - mat[0][0] * cx; + mat[3][1] = -mat[2][1] * Zprp - mat[1][1] * cy; + mat[3][2] = -2.f * f * n / (f - n) - mat[2][2] * Zprp; + mat[3][3] = Zprp; + +#ifdef PRINT + printf("r l t b n f: %f %f %f %f %f %f \n", r,l,t,b,n,f); + printf( "mapping_matrix (new code):\n" ); + pr_matrix(mat); +#endif + + /* return here, as further calculations are related to the old approach */ + return; + } + + /* scale factors */ + xsf = (vp.xmax - vp.xmin) / (mapping->window.xmax - mapping->window.xmin); + ysf = (vp.ymax - vp.ymin) / (mapping->window.ymax - mapping->window.ymin); + zsf = (vp.zmax - vp.zmin) / (fpd - bpd); + + /* map matrix */ + mmat[0][0] = xsf, mmat[1][1] = ysf, mmat[2][2] = zsf; + mmat[3][0] = vp.xmin - xsf*mapping->window.xmin; + mmat[3][1] = vp.ymin - ysf*mapping->window.ymin; + mmat[3][2] = vp.zmin - zsf*bpd; + + /* multiply to obtain mapping matrix */ + TelMultiplymat3( mat, pmat, mmat ); + +#ifdef PRINT + printf( "mapping_matrix :\n" ); + pr_matrix(mat); +#endif +} + +void +TelEvalViewOrientationMatrix( Tfloat *vrp /* View Reference Point */, + Tfloat *vpn /* View Plane Normal */, + Tfloat *vup /* View Up Vector */, + Tfloat *asf /* Axial Scale Factors */, + Tint *error_ind/* Out: Error indicator */, + Tmatrix3 rmat /* Out: Orientation Matrix */ + ) +{ + Tfloat u[3], v[3], n[3], f; + + /* view plane normal of zero length */ + if( vecmag(vpn) == 0.0 ) + { + *error_ind = 1; + return; + } + + /* view up vector of zero length */ + if( vecmag(vup) == 0.0 ) + { + *error_ind = 2; + return; + } + + /* view up vector parallel to view plane normal */ + vecang(vup, vpn, f); + if( f == 0.0 ) + { + *error_ind = 3; + return; + } + + *error_ind = 0; + + veccpy(n, vpn); + veccpy(v, vup); + vecnrm(n); + + veccrs(u,v,n); /* up vector cross plane normal gives U axis */ + vecnrm(u); + + veccrs(v,n,u); /* plane normal cross U axis gives modified up vector */ + vecnrm(v); /* redundant ? */ + + /* rotate to align along u, v, n */ + rmat[0][0] = ( float )u[0] * asf[0], + rmat[0][1] = ( float )v[0] * asf[0], + rmat[0][2] = ( float )n[0] * asf[0], + rmat[0][3] = ( float )0.0; + + rmat[1][0] = ( float )u[1] * asf[1], + rmat[1][1] = ( float )v[1] * asf[1], + rmat[1][2] = ( float )n[1] * asf[1], + rmat[1][3] = ( float )0.0; + + rmat[2][0] = ( float )u[2] * asf[2], + rmat[2][1] = ( float )v[2] * asf[2], + rmat[2][2] = ( float )n[2] * asf[2], + rmat[2][3] = ( float )0.0; + + /* translate to centre at vrp */ + + rmat[3][0] = - ( float ) (u[0]*vrp[0] + u[1]*vrp[1] + u[2]*vrp[2]); + rmat[3][1] = - ( float ) (v[0]*vrp[0] + v[1]*vrp[1] + v[2]*vrp[2]); + rmat[3][2] = - ( float ) (n[0]*vrp[0] + n[1]*vrp[1] + n[2]*vrp[2]); + rmat[3][3] = ( float )1.0; + +#ifdef PRINT + printf("TelEvalViewOrientationMatrix \n"); + printf("view_ref_pt %f %f %f \n", vrp[0], vrp[1], vrp[2]); + printf("view_up_vec %f %f %f \n", vup[0], vup[1], vup[2]); + printf("view_plane_normal %f %f %f \n", vpn[0], vpn[1], vpn[2]); + pr_matrix(rmat); +#endif + + return; +} + +void +TelEvalViewMappingMatrix( tel_view_mapping mapping /* View Mapping */, + Tint *error_ind /* Out: Error Indicator */, + Tmatrix3 mat /* Out: Mapping Matrix */ + ) +{ + EvalViewMappingMatrix( mapping, error_ind, mat, 0, ( float )0.0, ( float )0.0, 0, 0 ); +} + diff --git a/src/OpenGl/OpenGl_telem_view.hxx b/src/OpenGl/OpenGl_telem_view.hxx index 421bac152b..8e28066351 100755 --- a/src/OpenGl/OpenGl_telem_view.hxx +++ b/src/OpenGl/OpenGl_telem_view.hxx @@ -24,9 +24,7 @@ Suppression de TelPrintAllViews() #ifndef OPENGL_TELEM_VIEW_H #define OPENGL_TELEM_VIEW_H -#include -#include -#include +#include typedef struct { @@ -46,8 +44,6 @@ typedef struct Tfloat zmax; } Tlimit3; - - typedef enum { TelParallel, TelPerspective @@ -64,69 +60,10 @@ typedef struct Tfloat bpd; } TEL_VIEW_MAPPING, *tel_view_mapping; - -typedef struct -{ - Tmatrix3 orientation_matrix; - Tmatrix3 mapping_matrix; - Tlimit3 clip_limit; - Tint clip_xy; - Tint clip_back; - Tint clip_front; - Tint shield_indicator; - TEL_COLOUR shield_colour; - Tint border_indicator; - TEL_COLOUR border_colour; - Tint active_status; - NCollection_List clipping_planes; - struct - { - Tfloat vrp[3]; - Tfloat vpn[3]; - Tfloat vup[3]; - TEL_VIEW_MAPPING map; - Tfloat scaleFactors[3]; - } extra; -} TEL_VIEW_REP, *tel_view_rep; - - -typedef enum -{ - UVN2XYZ, XYZ2UVN -} TelCoordType; - -extern Tint TglUpdateView0; /* defined in telem/view */ - extern void /* vrp, vpn, vup, error_ind, mat */ TelEvalViewOrientationMatrix(Tfloat*, Tfloat*, Tfloat*, Tfloat*, Tint*, Tmatrix3); extern void /* mapping, error_ind, mat */ TelEvalViewMappingMatrix( tel_view_mapping, Tint*, Tmatrix3 ); -extern void /* mapping, error_ind, mat, cx, cy */ -TelEvalViewMappingMatrixPick(tel_view_mapping, Tint*, Tmatrix3, Tfloat, Tfloat); - -extern TStatus /* ws, view_id, view_representation */ -TelSetViewRepresentation( Tint, Tint, tel_view_rep ); - -extern TStatus /* ws, view_id, type, uvn, xyz */ -TelConvertCoord( Tint, Tint, TelCoordType, Tfloat*, Tfloat* ); - -extern TStatus TelSetViewIndex( Tint, Tint ); /* ws, view_id */ -extern TStatus TelSetViewProjection( Tint, Tint ); /* ws, view_id */ -extern TStatus /* ws, view_id, view_representation */ -TelGetViewRepresentation( Tint, Tint, tel_view_rep ); -extern TStatus TelDeleteViewsForWS( Tint wsid ); - - -extern void TelClearViews( Tint ); /* ws */ -extern void TelClearBackground( Tint ); /* ws */ - -extern TStatus TelPrintViewRepresentation( Tint, Tint ); /* ws, view */ -extern TStatus Tel2Dto3D( Tint ws, Tint vid, Tint x, Tint y, - Tfloat *x1, Tfloat *y1, Tfloat *z1, - Tfloat *x2, Tfloat *y2, Tfloat *z2 ); -/* x is from bottom */ -/* y is from top */ - #endif diff --git a/src/OpenGl/OpenGl_text.cxx b/src/OpenGl/OpenGl_text.cxx deleted file mode 100755 index 2983524ba6..0000000000 --- a/src/OpenGl/OpenGl_text.cxx +++ /dev/null @@ -1,463 +0,0 @@ -/*********************************************************************** - -FONCTION : ----------- -File OpenGl_text : - - -REMARQUES: ----------- - - -HISTORIQUE DES MODIFICATIONS : --------------------------------- -xx-xx-xx : xxx ; Creation. -05-03-96 : FMN ; Suppression code inutile: -01-04-96 : CAL ; Integration MINSK portage WNT -29-04-96 : FMN ; correction warning de compilation. -21-10-96 : FMN ; Suppression LMC_COLOR fait dans OpenGl_execstruct.c -30-11-98 : FMN ; S4069 : Textes toujours visibles -02.14.100 : JR : Warnings on WNT truncations from double to float -21.06.03 : SAN : Suppress text display while in animation mode (TEXT_DEGENER) -22.01.04 : SAN : Implement texture mapped fonts on WNT only (OCC2934) - -************************************************************************/ - -/*----------------------------------------------------------------------*/ -/* -* Includes -*/ - -#ifndef WNT -#include -#endif -#include - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -struct TEL_TEXT_DATA -{ - TEL_POINT attach_pt; - Tint length; - const wchar_t *sdata; - IMPLEMENT_MEMORY_OPERATORS -}; -typedef TEL_TEXT_DATA* tel_text_data; - -/*----------------------------------------------------------------------*/ -/* -* Fonctions statiques -*/ - -static TStatus TextDisplay( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus TextAdd( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus TextDelete( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus TextPrint( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus TextInquire( TSM_ELEM_DATA, Tint, cmn_key* ); - -#if defined(__sun) || defined (__osf__) || defined (__hp) || defined (__sgi) -#else -PFNGLBLENDEQUATIONEXTPROC glBlendEquationOp = (PFNGLBLENDEQUATIONEXTPROC) INVALID_EXT_FUNCTION_PTR; -#endif -/*----------------------------------------------------------------------*/ -/* -* Constantes -*/ - -#if defined(__osf__) || defined (__sun) || defined (__sgi) || defined(__hp9000s700) || defined(WNT) -#undef GL_EXT_blend_logic_op -#endif - -/*----------------------------------------------------------------------*/ -/* -* Variables statiques -*/ - -/*static GLboolean lighting_mode;*/ - -static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) = -{ - TextDisplay, - TextDisplay, - TextAdd, - TextDelete, - TextPrint, - TextInquire -}; - -extern GLuint fontBase; -extern GLuint printerFontBase; - -#define TEXT_DEGENER - -#ifdef TEXT_DEGENER -extern int g_nDegenerateModel; -extern float g_fSkipRatio; -#endif - -/*----------------------------------------------------------------------*/ - -MtblPtr -TelTextInitClass( TelType* el ) -{ - *el = TelText; - return MtdTbl; -} - -/*----------------------------------------------------------------------*/ - -static TStatus -TextAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k ) -{ - Tint i; - TEL_POINT def_pt = {{ ( float )0.0, ( float )0.0, ( float )0.0 }}; - tel_point pt = &def_pt; - tel_text_data data; - Techar *str= 0; - - for( i = 0; i < n; i++ ) - { - switch( k[i]->id ) - { - case TEXT_ATTACH_PT_ID: - pt = (tel_point)k[i]->data.pdata; - break; - case TEXT_STRING_ID: - str = (Techar*)k[i]->data.pdata; - break; - } - } - - data = new TEL_TEXT_DATA(); - if( !data ) - return TFailure; - - //szv: instead of strlen + 1 - i = 0; while (str[i++]); - - wchar_t *wstr = new wchar_t[i]; - if( !wstr ) - return TFailure; - - data->attach_pt = *pt; - data->length = i; - //szv: instead of memcpy - i = 0; while (wstr[i++] = (wchar_t)(*str++)); - data->sdata = wstr; - - ((tsm_elem_data)(d.pdata))->pdata = data; - - return TSuccess; -} - -/*----------------------------------------------------------------------*/ - -static TStatus -TextDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - tel_text_data d; - CMN_KEY key, key1; - TEL_COLOUR colour, colours; - int style, display_type; - GLboolean flag_zbuffer = GL_FALSE; - GLboolean blend_state = GL_FALSE; - GLint sWidth, sAscent, sDescent; - GLdouble modelMatrix[16], projMatrix[16]; - GLint viewport[4]; - GLdouble objrefX, objrefY, objrefZ; - GLdouble objX, objY, objZ; - GLdouble obj1X, obj1Y, obj1Z; - GLdouble obj2X, obj2Y, obj2Z; - GLdouble obj3X, obj3Y, obj3Z; - GLdouble winx1, winy1, winz1; - GLdouble winx, winy, winz; - GLint status; - -#ifdef TEXT_DEGENER - if ( g_nDegenerateModel > 0 && g_fSkipRatio == 1. ) - return TSuccess; -#endif - - d = (tel_text_data)data.pdata; - - if( k[0]->id == TOn ) - { /* Use highlight colours */ - TEL_HIGHLIGHT hrep; - - key.id = TelHighlightIndex; - TsmGetAttri( 1, &key ); - if( TelGetHighlightRep( TglActiveWs, key.data.ldata, &hrep ) - == TSuccess ) - colour = hrep.col; - else - { - TelGetHighlightRep( TglActiveWs, 0, &hrep ); - colour = hrep.col; - } - } - else - { - key.id = TelTextColour; - key.data.pdata = &colour; - TsmGetAttri( 1, &key ); - } - - key.id = TelTextStyle; - key1.id = TelTextDisplayType; - TsmGetAttri( 2, &key, &key1 ); - style = key.data.ldata; - display_type = key1.data.ldata; - - /* style annotation */ - if (style == ASPECT_TOST_ANNOTATION) - { - flag_zbuffer = glIsEnabled(GL_DEPTH_TEST); - if (flag_zbuffer) glDisable(GL_DEPTH_TEST); - } - - OpenGl_TextRender* textRender=OpenGl_TextRender::instance(); - - /* display type of text */ - if (display_type != ASPECT_TODT_NORMAL) - { - key.id = TelTextColourSubTitle; - key.data.pdata = &colours; - TsmGetAttri( 1, &key ); - - /* Optimisation: il faudrait ne faire le Get qu'une fois par Redraw */ - glGetIntegerv (GL_VIEWPORT, viewport); - glGetDoublev (GL_MODELVIEW_MATRIX, modelMatrix); - glGetDoublev (GL_PROJECTION_MATRIX, projMatrix); - - switch (display_type) - { - case ASPECT_TODT_BLEND: - -#if defined(GL_EXT_blend_logic_op) - if ( (PFNGLBLENDEQUATIONEXTPROC)glBlendEquationOp == (PFNGLBLENDEQUATIONEXTPROC)INVALID_EXT_FUNCTION_PTR ) - { - if(QueryExtension("GL_EXT_blend_logic_op")) { -#ifdef WNT - glBlendEquationOp = (PFNGLBLENDEQUATIONEXTPROC)wglGetProcAddress("glBlendEquationOp"); -#else - glBlendEquationOp = (PFNGLBLENDEQUATIONEXTPROC)glXGetProcAddress((GLubyte*)"glBlendEquationOp"); -#endif - } else - glBlendEquationOp = NULL; - } - - if ( glBlendEquationOp ) - { - blend_state = glIsEnabled(GL_BLEND); - if (!blend_state) glEnable(GL_BLEND); - glBlendEquationOp(GL_LOGIC_OP); - glLogicOp(GL_XOR); - } -#else - - blend_state = glIsEnabled(GL_BLEND); - if (!blend_state) glEnable(GL_BLEND); - glEnable(GL_COLOR_LOGIC_OP); - glLogicOp(GL_XOR); - -#endif - break; - case ASPECT_TODT_SUBTITLE: - textRender->StringSize(d->sdata, &sWidth, &sAscent, &sDescent); - objrefX = (float)d->attach_pt.xyz[0]; - objrefY = (float)d->attach_pt.xyz[1]; - objrefZ = (float)d->attach_pt.xyz[2]; - status = gluProject (objrefX, objrefY, objrefZ, modelMatrix, projMatrix, viewport, - &winx1, &winy1, &winz1); - - winx = winx1; - winy = winy1-sDescent; - winz = winz1+0.00001; - status = gluUnProject (winx, winy, winz, modelMatrix, projMatrix, viewport, - &objX, &objY, &objZ); - - winx = winx1 + sWidth; - winy = winy1-sDescent; - winz = winz1+0.00001; /* il vaut mieux F+B / 1000000 ? */ - status = gluUnProject (winx, winy, winz, modelMatrix, projMatrix, viewport, - &obj1X, &obj1Y, &obj1Z); - - winx = winx1 + sWidth; - winy = winy1 + sAscent; - winz = winz1+0.00001; - status = gluUnProject (winx, winy, winz, modelMatrix, projMatrix, viewport, - &obj2X, &obj2Y, &obj2Z); - - winx = winx1; - winy = winy1+ sAscent; - winz = winz1+0.00001; - status = gluUnProject (winx, winy, winz, modelMatrix, projMatrix, viewport, - &obj3X, &obj3Y, &obj3Z); - - glColor3fv( colours.rgb ); - glBegin(GL_POLYGON); - glVertex3d(objX, objY, objZ); - glVertex3d(obj1X, obj1Y, obj1Z); - glVertex3d(obj2X, obj2Y, obj2Z); - glVertex3d(obj3X, obj3Y, obj3Z); - glEnd(); - break; - - case ASPECT_TODT_DEKALE: - objrefX = (float)d->attach_pt.xyz[0]; - objrefY = (float)d->attach_pt.xyz[1]; - objrefZ = (float)d->attach_pt.xyz[2]; - status = gluProject (objrefX, objrefY, objrefZ, modelMatrix, projMatrix, viewport, - &winx1, &winy1, &winz1); - - winx = winx1+1; - winy = winy1+1; - winz = winz1+0.00001; - status = gluUnProject (winx, winy, winz, modelMatrix, projMatrix, viewport, - &objX, &objY, &objZ); - - glColor3fv( colours.rgb ); - textRender->RenderText( d->sdata, fontBase, 0, (float)objX, (float)objY,(float)objZ ); - winx = winx1-1; - winy = winy1-1; - status = gluUnProject (winx, winy, winz, modelMatrix, projMatrix, viewport, - &objX, &objY, &objZ); - - textRender->RenderText( d->sdata, fontBase, 0, (float)objX, (float)objY,(float)objZ ); - winx = winx1-1; - winy = winy1+1; - status = gluUnProject (winx, winy, winz, modelMatrix, projMatrix, viewport, - &objX, &objY, &objZ); - - textRender->RenderText( d->sdata, fontBase, 0, (float)objX, (float)objY,(float)objZ ); - winx = winx1+1; - winy = winy1-1; - status = gluUnProject (winx, winy, winz, modelMatrix, projMatrix, viewport, - &objX, &objY, &objZ); - textRender->RenderText( d->sdata, fontBase, 0, (float)objX, (float)objY,(float)objZ ); - break; - } - } - - glColor3fv( colour.rgb ); - textRender->RenderText( d->sdata, fontBase, 0, (float)d->attach_pt.xyz[0], (float)d->attach_pt.xyz[1],(float)d->attach_pt.xyz[2] ); - /* maj attributs */ - if (flag_zbuffer) glEnable(GL_DEPTH_TEST); - if (display_type == ASPECT_TODT_BLEND) - { -#if defined(GL_EXT_blend_logic_op) - if ((!blend_state) && (QueryExtension("GL_EXT_blend_logic_op"))) glDisable(GL_BLEND); -#else - if (!blend_state) glDisable(GL_BLEND); - glDisable(GL_COLOR_LOGIC_OP); -#endif - } - - return TSuccess; -} - -/*----------------------------------------------------------------------*/ - -static TStatus -TextDelete( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - tel_text_data d = (tel_text_data)data.pdata; - if (d) - { - delete[] d->sdata; - delete d; - } - return TSuccess; -} - -/*----------------------------------------------------------------------*/ - -static TStatus -TextPrint( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - tel_text_data p; - - p = (tel_text_data)data.pdata; - - fprintf( stdout, "TelText.\n" ); - fprintf( stdout, "\t\tString : %S\n", p->sdata ); - fprintf( stdout, "\t\tAttach Point : %f %f %f\n", p->attach_pt.xyz[0], - p->attach_pt.xyz[1], - p->attach_pt.xyz[2] ); - fprintf( stdout, "\n" ); - - return TSuccess; -} - -/*----------------------------------------------------------------------*/ - -static TStatus -TextInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - Tint i; - tel_text_data d; - Tint size_reqd=0; - TStatus status = TSuccess; - - d = (tel_text_data)data.pdata; - - size_reqd = sizeof(Techar)*d->length; - - for( i = 0; i < n; i++ ) - { - switch( k[i]->id ) - { - case INQ_GET_SIZE_ID: - { - k[i]->data.ldata = size_reqd; - break; - } - - case INQ_GET_CONTENT_ID: - { - TEL_INQ_CONTENT *c; - Teldata *w; - - c = (tel_inq_content)k[i]->data.pdata; - c->act_size = size_reqd; - w = c->data; - - if( c->size >= size_reqd ) - { - w->atext3.string = (Techar*)c->buf; - w->atext3.ref_pt = d->attach_pt; - w->atext3.anno.xyz[0] = ( float )0.0; - w->atext3.anno.xyz[1] = ( float )0.0; - w->atext3.anno.xyz[2] = ( float )0.0; - //szv: instead of strcpy - Techar *ptr1 = w->atext3.string; - const wchar_t *ptr2 = d->sdata; - while (*ptr1++ = (Techar)(*ptr2++)); - status = TSuccess; - } - else - status = TFailure; - break; - } - } - } - return status; -} - -/*----------------------------------------------------------------------*/ diff --git a/src/OpenGl/OpenGl_textalignment.cxx b/src/OpenGl/OpenGl_textalignment.cxx deleted file mode 100755 index 44792b560a..0000000000 --- a/src/OpenGl/OpenGl_textalignment.cxx +++ /dev/null @@ -1,70 +0,0 @@ - -/*OCC7456 abd 14.12.2004 Text alingnment attributes */ - -#include -#include - -#include - -#include -#include -#include -#include -#include -#include - -static TStatus TextAlignDisplay( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus TextAlignAdd( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus TextAlignPrint( TSM_ELEM_DATA, Tint, cmn_key* ); - -static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) = -{ - 0, /* PickTraverse */ - TextAlignDisplay, - TextAlignAdd, - 0, /* Delete */ - TextAlignPrint, - 0 /* Inquire */ -}; - -MtblPtr -TelTextAlignInitClass( TelType *el ) -{ - *el = TelTextAlign; - return MtdTbl; -} - -static TStatus -TextAlignDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - CMN_KEY key; - - key.id = TelTextAlign; - key.data.pdata = data.pdata; - TsmSetAttri( 1, &key ); - return TSuccess; -} - -static TStatus -TextAlignAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k ) -{ - tel_align_data data = new TEL_ALIGN_DATA(); - if( !data ) - return TFailure; - - *data = *(tel_align_data)(k[0]->data.pdata); - - ((tsm_elem_data)(d.pdata))->pdata = data; - - return TSuccess; -} - - -static TStatus -TextAlignPrint( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - fprintf( stdout, "TelTextHAlign. Value = %d\n", data.ldata); - fprintf( stdout, "\n" ); - - return TSuccess; -} diff --git a/src/OpenGl/OpenGl_textangle.cxx b/src/OpenGl/OpenGl_textangle.cxx deleted file mode 100755 index cb4cbd31a4..0000000000 --- a/src/OpenGl/OpenGl_textangle.cxx +++ /dev/null @@ -1,56 +0,0 @@ -// File: OpenGl_textangle.cxx -// Created: 30.09.09 -// Author: Paul Supryatkin -// Copyright: Open CASCADE 2009 - - -#include -#include - -#include - -#include -#include -#include -#include -#include -#include - -static TStatus TextAngleDisplay( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus TextAngleAdd( TSM_ELEM_DATA, Tint, cmn_key* ); - -static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) = -{ - 0, /* PickTraverse */ - TextAngleDisplay, - TextAngleAdd, - 0, /* Delete */ - 0, - 0 /* Inquire */ -}; - -MtblPtr -TelTextAngleInitClass( TelType *el ) -{ - *el = TelTextAngle; - return MtdTbl; -} - -static TStatus -TextAngleDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - CMN_KEY key; - - key.id = TelTextAngle; - key.data.ldata = data.ldata; - TsmSetAttri( 1, &key ); - return TSuccess; -} - -static TStatus -TextAngleAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k ) -{ - ((tsm_elem_data)(d.pdata))->ldata = k[0]->data.ldata; - return TSuccess; -} - diff --git a/src/OpenGl/OpenGl_textcol.cxx b/src/OpenGl/OpenGl_textcol.cxx deleted file mode 100755 index d486b5e9dc..0000000000 --- a/src/OpenGl/OpenGl_textcol.cxx +++ /dev/null @@ -1,174 +0,0 @@ -/*********************************************************************** - -FONCTION : ----------- -File OpenGl_textcol : - - -REMARQUES: ----------- - - -HISTORIQUE DES MODIFICATIONS : --------------------------------- -xx-xx-xx : xxx ; Creation. -20-02-96 : FMN ; Suppression code inutile: -01-04-96 : CAL ; Integration MINSK portage WNT - -************************************************************************/ - -/*----------------------------------------------------------------------*/ -/* -* Includes -*/ - - -#include - -#include -#include - -#include -#include -#include -#include -#include -#include - -/*----------------------------------------------------------------------*/ -/* -* Fonctions statiques -*/ - -static TStatus TextColourDisplay( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus TextColourAdd( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus TextColourDelete( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus TextColourPrint( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus TextColourInquire( TSM_ELEM_DATA, Tint, cmn_key* ); - -/*----------------------------------------------------------------------*/ - -static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) = -{ - 0, /* PickTraverse */ - TextColourDisplay, - TextColourAdd, - TextColourDelete, - TextColourPrint, - TextColourInquire -}; - - -/*----------------------------------------------------------------------*/ - -MtblPtr -TelTextColourInitClass( TelType *el ) -{ - *el = TelTextColour; - return MtdTbl; -} - -/*----------------------------------------------------------------------*/ - -static TStatus -TextColourAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k ) -{ - tel_colour data = new TEL_COLOUR(); - //cmn_memreserve( data, 1, 0 ); - - if( !data ) - return TFailure; - - *data = *(tel_colour)(k[0]->data.pdata); - - ((tsm_elem_data)(d.pdata))->pdata = data; - - return TSuccess; -} - - -/*----------------------------------------------------------------------*/ - -static TStatus -TextColourDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - tel_colour d; - CMN_KEY key; - - d = (tel_colour)data.pdata; - - key.id = TelTextColour; - key.data.pdata = d; - TsmSetAttri( 1, &key ); - - return TSuccess; -} - - -/*----------------------------------------------------------------------*/ - -static TStatus -TextColourDelete( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - //cmn_freemem( data.pdata ); - if (data.pdata) - delete data.pdata; - return TSuccess; -} - -/*----------------------------------------------------------------------*/ - -static TStatus -TextColourPrint( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - tel_colour p; - - p = (tel_colour)data.pdata; - - fprintf( stdout, "TelTextColour. R = %g, G = %g, B = %g\n", - p->rgb[0], p->rgb[1], p->rgb[2] ); - fprintf( stdout, "\n" ); - - return TSuccess; -} - -/*----------------------------------------------------------------------*/ - -static TStatus -TextColourInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - Tint i; - tel_colour col; - - col = (tel_colour)data.pdata; - - for( i = 0; i < n; i++ ) - { - switch( k[i]->id ) - { - case INQ_GET_SIZE_ID: - { - k[i]->data.ldata = sizeof( Tint ); - break; - } - case INQ_GET_CONTENT_ID: - { - TEL_INQ_CONTENT *c; - Teldata *w; - - c = (tel_inq_content)k[i]->data.pdata; - w = c->data; - c->act_size = 0; - - w->gnl_colour.rgb[0] = col->rgb[0]; - w->gnl_colour.rgb[1] = col->rgb[1]; - w->gnl_colour.rgb[2] = col->rgb[2]; - break; - } - } - } - - return TSuccess; -} - -/*----------------------------------------------------------------------*/ diff --git a/src/OpenGl/OpenGl_textcolsubtitle.cxx b/src/OpenGl/OpenGl_textcolsubtitle.cxx deleted file mode 100755 index 5dea8ce5d8..0000000000 --- a/src/OpenGl/OpenGl_textcolsubtitle.cxx +++ /dev/null @@ -1,171 +0,0 @@ -/*********************************************************************** - -FONCTION : ----------- -File OpenGl_textcolsubtitle : - - -REMARQUES: ----------- - - -HISTORIQUE DES MODIFICATIONS : --------------------------------- -30-11-98 : FMN ; Creation. - -************************************************************************/ - -/*----------------------------------------------------------------------*/ -/* -* Includes -*/ - - -#include - -#include -#include - -#include -#include -#include -#include -#include -#include - -/*----------------------------------------------------------------------*/ -/* -* Fonctions statiques -*/ - -static TStatus TextColourSubTitleDisplay( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus TextColourSubTitleAdd( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus TextColourSubTitleDelete( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus TextColourSubTitlePrint( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus TextColourSubTitleInquire( TSM_ELEM_DATA, Tint, cmn_key* ); - -/*----------------------------------------------------------------------*/ - -static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) = -{ - 0, /* PickTraverse */ - TextColourSubTitleDisplay, - TextColourSubTitleAdd, - TextColourSubTitleDelete, - TextColourSubTitlePrint, - TextColourSubTitleInquire -}; - - -/*----------------------------------------------------------------------*/ - -MtblPtr -TelTextColourSubTitleInitClass( TelType *el ) -{ - *el = TelTextColourSubTitle; - return MtdTbl; -} - -/*----------------------------------------------------------------------*/ - -static TStatus -TextColourSubTitleAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k ) -{ - tel_colour data = new TEL_COLOUR(); - //cmn_memreserve( data, 1, 0 ); - if( !data ) - return TFailure; - - *data = *(tel_colour)(k[0]->data.pdata); - - ((tsm_elem_data)(d.pdata))->pdata = data; - - return TSuccess; -} - - -/*----------------------------------------------------------------------*/ - -static TStatus -TextColourSubTitleDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - tel_colour d; - CMN_KEY key; - - d = (tel_colour)data.pdata; - - key.id = TelTextColourSubTitle; - key.data.pdata = d; - TsmSetAttri( 1, &key ); - - return TSuccess; -} - - -/*----------------------------------------------------------------------*/ - -static TStatus -TextColourSubTitleDelete( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - //cmn_freemem( data.pdata ); - if (data.pdata) - delete data.pdata; - return TSuccess; -} - -/*----------------------------------------------------------------------*/ - -static TStatus -TextColourSubTitlePrint( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - tel_colour p; - - p = (tel_colour)data.pdata; - - fprintf( stdout, "TelTextColourSubTitle. R = %g, G = %g, B = %g\n", - p->rgb[0], p->rgb[1], p->rgb[2] ); - fprintf( stdout, "\n" ); - - return TSuccess; -} - -/*----------------------------------------------------------------------*/ - -static TStatus -TextColourSubTitleInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - Tint i; - tel_colour col; - - col = (tel_colour)data.pdata; - - for( i = 0; i < n; i++ ) - { - switch( k[i]->id ) - { - case INQ_GET_SIZE_ID: - { - k[i]->data.ldata = sizeof( Tint ); - break; - } - case INQ_GET_CONTENT_ID: - { - TEL_INQ_CONTENT *c; - Teldata *w; - - c = (tel_inq_content)k[i]->data.pdata; - w = c->data; - c->act_size = 0; - - w->gnl_colour.rgb[0] = col->rgb[0]; - w->gnl_colour.rgb[1] = col->rgb[1]; - w->gnl_colour.rgb[2] = col->rgb[2]; - break; - } - } - } - - return TSuccess; -} - -/*----------------------------------------------------------------------*/ diff --git a/src/OpenGl/OpenGl_textdisplaytype.cxx b/src/OpenGl/OpenGl_textdisplaytype.cxx deleted file mode 100755 index 439d75932f..0000000000 --- a/src/OpenGl/OpenGl_textdisplaytype.cxx +++ /dev/null @@ -1,100 +0,0 @@ -/*********************************************************************** - -FONCTION : ----------- -File OpenGl_textdisplaystyle : - - -REMARQUES: ----------- - - -HISTORIQUE DES MODIFICATIONS : --------------------------------- -30-11-98 : FMN ; Creation. - -************************************************************************/ - -/*----------------------------------------------------------------------*/ -/* -* Includes -*/ - - -#include - -#include -#include - -#include -#include -#include -#include -#include -#include - -/*----------------------------------------------------------------------*/ -/* -* Fonctions statiques -*/ - -static TStatus TextDisplayTypeDisplay( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus TextDisplayTypeAdd( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus TextDisplayTypePrint( TSM_ELEM_DATA, Tint, cmn_key* ); - -/*----------------------------------------------------------------------*/ - -static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) = -{ - 0, /* PickTraverse */ - TextDisplayTypeDisplay, - TextDisplayTypeAdd, - 0, /* Delete */ - TextDisplayTypePrint, - 0 /* Inquire */ -}; - - -/*----------------------------------------------------------------------*/ - -MtblPtr -TelTextDisplayTypeInitClass( TelType *el ) -{ - *el = TelTextDisplayType; - return MtdTbl; -} - -/*----------------------------------------------------------------------*/ - -static TStatus -TextDisplayTypeAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k ) -{ - ((tsm_elem_data)(d.pdata))->ldata = k[0]->data.ldata; - - return TSuccess; -} - - -/*----------------------------------------------------------------------*/ - -static TStatus -TextDisplayTypeDisplay( TSM_ELEM_DATA d, Tint n, cmn_key *k ) -{ - CMN_KEY key; - - key.id = TelTextDisplayType; - key.data.ldata = d.ldata; - TsmSetAttri( 1, &key ); - return TSuccess; -} - -/*----------------------------------------------------------------------*/ - -static TStatus -TextDisplayTypePrint( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - return TSuccess; -} - -/*----------------------------------------------------------------------*/ - diff --git a/src/OpenGl/OpenGl_textfont.cxx b/src/OpenGl/OpenGl_textfont.cxx deleted file mode 100755 index 9a20fe93bb..0000000000 --- a/src/OpenGl/OpenGl_textfont.cxx +++ /dev/null @@ -1,88 +0,0 @@ -/*********************************************************************** - -FONCTION : ----------- -File OpenGl_textfont : - - -REMARQUES: ----------- - - -HISTORIQUE DES MODIFICATIONS : --------------------------------- -xx-xx-xx : xxx ; Creation. -20-02-96 : FMN ; Suppression code inutile: -01-04-96 : CAL ; Integration MINSK portage WNT - -************************************************************************/ - -/*----------------------------------------------------------------------*/ -/* -* Includes -*/ - -#include - -#include -#include - -#include -#include -#include -#include -#include - -/*----------------------------------------------------------------------*/ -static TStatus TextFontDisplay( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus TextFontAdd( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus TextFontPrint( TSM_ELEM_DATA, Tint, cmn_key* ); - -static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) = -{ - TextFontDisplay, /* PickTraverse */ - TextFontDisplay, - TextFontAdd, - 0, /* Delete */ - TextFontPrint, - 0 /* Inquire */ -}; - - -MtblPtr -TelTextFontInitClass( TelType *el ) -{ - *el = TelTextFont; - return MtdTbl; -} - -static TStatus -TextFontAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k ) -{ - ((tsm_elem_data)(d.pdata))->pdata = k[0]->data.pdata; - - return TSuccess; -} - - -static TStatus -TextFontDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - CMN_KEY key; - - key.id = TelTextFont; - key.data.pdata = data.pdata; - TsmSetAttri( 1, &key ); - - return TSuccess; -} - - -static TStatus -TextFontPrint( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - fprintf( stdout, "TelTextFont. %s\n", (char *) data.pdata ); - fprintf( stdout, "\n" ); - - return TSuccess; -} diff --git a/src/OpenGl/OpenGl_textfontaspect.cxx b/src/OpenGl/OpenGl_textfontaspect.cxx deleted file mode 100755 index 860fcd1053..0000000000 --- a/src/OpenGl/OpenGl_textfontaspect.cxx +++ /dev/null @@ -1,55 +0,0 @@ -// File: OpenGl_textzoomable.cxx -// Created: 08.10.09 -// Author: Paul Supryatkin -// Copyright: Open CASCADE 2009 - -#include -#include - -#include - -#include -#include -#include -#include -#include -#include - -static TStatus TextFontAspectDisplay( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus TextFontAspectAdd( TSM_ELEM_DATA, Tint, cmn_key* ); - -static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) = -{ - 0, /* PickTraverse */ - TextFontAspectDisplay, - TextFontAspectAdd, - 0, /* Delete */ - 0, - 0 /* Inquire */ -}; - -MtblPtr -TelTextFontAspectInitClass( TelType *el ) -{ - *el = TelTextFontAspect; - return MtdTbl; -} - -static TStatus -TextFontAspectDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - CMN_KEY key; - - key.id = TelTextFontAspect; - key.data.ldata = data.ldata; - TsmSetAttri( 1, &key ); - return TSuccess; -} - -static TStatus -TextFontAspectAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k ) -{ - ((tsm_elem_data)(d.pdata))->ldata = k[0]->data.ldata; - return TSuccess; -} - diff --git a/src/OpenGl/OpenGl_textheight.cxx b/src/OpenGl/OpenGl_textheight.cxx deleted file mode 100755 index da529edf06..0000000000 --- a/src/OpenGl/OpenGl_textheight.cxx +++ /dev/null @@ -1,170 +0,0 @@ -/*********************************************************************** - -FONCTION : ----------- -File OpenGl_textheight : - - -REMARQUES: ----------- - - -HISTORIQUE DES MODIFICATIONS : --------------------------------- -xx-xx-xx : xxx ; Creation. -20-02-96 : FMN ; Suppression code inutile: -01-04-96 : CAL ; Integration MINSK portage WNT -26-04-96 : FMN ; Correction warning de compilation. -20-11-97 : CAL ; RererereMerge avec le source de portage. -17-12-96 : FMN ; Warning de compilation. - -************************************************************************/ - -#define BUC60821 //GG 12/02/01 allow tu use the nearest font size. - -/*----------------------------------------------------------------------*/ -/* -* Includes -*/ - -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include - - -/*----------------------------------------------------------------------*/ -/* -* Fonctions statiques -*/ - -static TStatus TextHeightDisplay( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus TextHeightAdd( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus TextHeightDelete( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus TextHeightPrint( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus TextHeightInquire( TSM_ELEM_DATA, Tint, cmn_key* ); - -/*----------------------------------------------------------------------*/ -static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) = -{ - TextHeightDisplay, /* PickTraverse */ - TextHeightDisplay, - TextHeightAdd, - TextHeightDelete, - TextHeightPrint, - TextHeightInquire -}; - - -/*----------------------------------------------------------------------*/ -MtblPtr -TelTextHeightInitClass( TelType *el ) -{ - *el = TelTextHeight; - return MtdTbl; -} - -/*----------------------------------------------------------------------*/ -static TStatus -TextHeightAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k ) -{ - Tfloat *data = new Tfloat(); - if( !data ) - return TFailure; - -#ifdef BUC60821 - *data = k[0]->data.fdata; -#else /*BUC60821*/ -#ifndef WNT - { - Tint d_wdth, d_hght; - call_tox_getscreen( &d_wdth, &d_hght ); - *data = k[0]->data.fdata * d_hght; - } -#else - *data = k[0]->data.fdata; -#endif /* WNT */ -#endif /* BUC60821 */ - - ((tsm_elem_data)(d.pdata))->pdata = data; - - return TSuccess; -} - - -/*----------------------------------------------------------------------*/ -static TStatus -TextHeightDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - CMN_KEY key; - - key.id = TelTextHeight; - key.data.fdata = *(Tfloat*)(data.pdata); - TsmSetAttri( 1, &key ); - - return TSuccess; -} - - -/*----------------------------------------------------------------------*/ -static TStatus -TextHeightDelete( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - if (data.pdata) - delete data.pdata; - return TSuccess; -} - - -/*----------------------------------------------------------------------*/ -static TStatus -TextHeightPrint( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - fprintf( stdout, "TelTextHeight. Value = %g\n", *(Tfloat *)(data.pdata)); - fprintf( stdout, "\n" ); - - return TSuccess; -} - - -/*----------------------------------------------------------------------*/ -static TStatus -TextHeightInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - Tint i; - Tfloat *f = (Tfloat*)data.pdata; - - for( i = 0; i < n; i++ ) - { - switch( k[i]->id ) - { - case INQ_GET_SIZE_ID: - { - k[i]->data.ldata = sizeof( Tint ); - break; - } - case INQ_GET_CONTENT_ID: - { - TEL_INQ_CONTENT *c; - Teldata *w; - - c = (TEL_INQ_CONTENT *)k[i]->data.pdata; - w = c->data; - c->act_size = 0; - w->fdata = *f; - break; - } - } - } - - return TSuccess; -} -/*----------------------------------------------------------------------*/ diff --git a/src/OpenGl/OpenGl_textstyle.cxx b/src/OpenGl/OpenGl_textstyle.cxx deleted file mode 100755 index b00acef249..0000000000 --- a/src/OpenGl/OpenGl_textstyle.cxx +++ /dev/null @@ -1,98 +0,0 @@ -/*********************************************************************** - -FONCTION : ----------- -File OpenGl_textstyle : - - -REMARQUES: ----------- - - -HISTORIQUE DES MODIFICATIONS : --------------------------------- -30-11-98 : FMN ; Creation. - -************************************************************************/ - -/*----------------------------------------------------------------------*/ -/* -* Includes -*/ - - -#include - -#include -#include - -#include -#include -#include -#include -#include -#include - -/*----------------------------------------------------------------------*/ -/* -* Fonctions statiques -*/ - -static TStatus TextStyleDisplay( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus TextStyleAdd( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus TextStylePrint( TSM_ELEM_DATA, Tint, cmn_key* ); - -/*----------------------------------------------------------------------*/ - -static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) = -{ - 0, /* PickTraverse */ - TextStyleDisplay, - TextStyleAdd, - 0, /* Delete */ - TextStylePrint, - 0 /* Inquire */ -}; - -/*----------------------------------------------------------------------*/ - -MtblPtr -TelTextStyleInitClass( TelType *el ) -{ - *el = TelTextStyle; - return MtdTbl; -} - -/*----------------------------------------------------------------------*/ - -static TStatus -TextStyleAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k ) -{ - ((tsm_elem_data)(d.pdata))->ldata = k[0]->data.ldata; - - return TSuccess; -} - -/*----------------------------------------------------------------------*/ - -static TStatus -TextStyleDisplay( TSM_ELEM_DATA d, Tint n, cmn_key *k ) -{ - CMN_KEY key; - - key.id = TelTextStyle; - key.data.ldata = d.ldata; - TsmSetAttri( 1, &key ); - return TSuccess; -} - - -/*----------------------------------------------------------------------*/ - -static TStatus -TextStylePrint( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - return TSuccess; -} - -/*----------------------------------------------------------------------*/ diff --git a/src/OpenGl/OpenGl_texture.cxx b/src/OpenGl/OpenGl_texture.cxx deleted file mode 100755 index ff574076df..0000000000 --- a/src/OpenGl/OpenGl_texture.cxx +++ /dev/null @@ -1,118 +0,0 @@ -/*********************************************************************** - -FONCTION : ----------- -File OpenGl_texture.c : - - -REMARQUES: ----------- - - -HISTORIQUE DES MODIFICATIONS : --------------------------------- -05-08-97 : PCT ; Support texture mapping - -************************************************************************/ - -/*----------------------------------------------------------------------*/ -/* -* Includes -*/ - -#include - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -static TStatus TextureIdMethodAdd( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus TextureIdMethodDisplay( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus TextureIdMethodPrint( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus TextureIdMethodInquire( TSM_ELEM_DATA, Tint, cmn_key* ); - -static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) = -{ - 0, /* PickTraverse */ - TextureIdMethodDisplay, - TextureIdMethodAdd, - 0, /* Delete */ - TextureIdMethodPrint, - TextureIdMethodInquire -}; - - -MtblPtr -TelTextureIdInitClass( TelType *el ) -{ - *el = TelTextureId; - return MtdTbl; -} - -static TStatus -TextureIdMethodAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k ) -{ - ((tsm_elem_data)(d.pdata))->ldata = k[0]->data.ldata; - - return TSuccess; -} - - -static TStatus -TextureIdMethodDisplay( TSM_ELEM_DATA d, Tint n, cmn_key *k ) -{ - CMN_KEY key; - - key.id = TelTextureId; - key.data.ldata = d.ldata; - TsmSetAttri( 1, &key ); - return TSuccess; -} - - -static TStatus -TextureIdMethodPrint( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - - return TSuccess; -} - - -static TStatus -TextureIdMethodInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - Tint i; - - for( i = 0; i < n; i++ ) - { - switch( k[i]->id ) - { - case INQ_GET_SIZE_ID: - { - k[i]->data.ldata = sizeof( Tint ); - break; - } - case INQ_GET_CONTENT_ID: - { - TEL_INQ_CONTENT *c; - Teldata *w; - - c = (TEL_INQ_CONTENT*)k[i]->data.pdata; - w = c->data; - c->act_size = 0; - w->idata = data.ldata; - break; - } - } - } - - return TSuccess; -} diff --git a/src/OpenGl/OpenGl_textzoomable.cxx b/src/OpenGl/OpenGl_textzoomable.cxx deleted file mode 100755 index 0f5b0ff55d..0000000000 --- a/src/OpenGl/OpenGl_textzoomable.cxx +++ /dev/null @@ -1,55 +0,0 @@ -// File: OpenGl_textzoomable.cxx -// Created: 09.09.09 -// Author: Paul Supryatkin -// Copyright: Open CASCADE 2009 - -#include -#include - -#include - -#include -#include -#include -#include -#include -#include - -static TStatus TextZoomableDisplay( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus TextZoomableAdd( TSM_ELEM_DATA, Tint, cmn_key* ); - -static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) = -{ - 0, /* PickTraverse */ - TextZoomableDisplay, - TextZoomableAdd, - 0, /* Delete */ - 0, - 0 /* Inquire */ -}; - -MtblPtr -TelTextZoomableInitClass( TelType *el ) -{ - *el = TelTextZoomable; - return MtdTbl; -} - -static TStatus -TextZoomableDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - CMN_KEY key; - - key.id = TelTextZoomable; - key.data.ldata = data.ldata; - TsmSetAttri( 1, &key ); - return TSuccess; -} - -static TStatus -TextZoomableAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k ) -{ - ((tsm_elem_data)(d.pdata))->ldata = k[0]->data.ldata; - return TSuccess; -} - diff --git a/src/OpenGl/OpenGl_tgl.hxx b/src/OpenGl/OpenGl_tgl.hxx deleted file mode 100755 index f9e3b37da9..0000000000 --- a/src/OpenGl/OpenGl_tgl.hxx +++ /dev/null @@ -1,67 +0,0 @@ -/*********************************************************************** - -FONCTION : ----------- -Include OpenGl_tgl : - - -REMARQUES: ----------- - - -HISTORIQUE DES MODIFICATIONS : --------------------------------- -xx-xx-xx : xxx ; Creation. -11-03-96 : FMN ; Reference a InterfaceGraphic_Cextern.hxx -03-03-97 : FMN ; Ajout displaylist pour le mode transient -15-03-98 : FMN ; Ajout mode animation -08-07-98 : FMN ; On utilise OpenGl_animation.h pour le mode animation. - -************************************************************************/ - -#ifndef OPENGL_TGL_H -#define OPENGL_TGL_H - -/*----------------------------------------------------------------------*/ -/* -* Includes -*/ - -#ifndef EXPORT -# if defined(WNT) && !defined(HAVE_NO_DLL) -# ifdef __OpenGl_DLL -# define EXPORT __declspec( dllexport ) -# else -# define EXPORT -# endif /* __OpenGl_DLL */ -# else -# define EXPORT -# endif /* WNT */ -#endif /* EXPORT */ - - -//#include -#include -#include -#include - -#include - -/*----------------------------------------------------------------------*/ -/* -* Prototypes fonctions externes -*/ - -extern CALL_DEF_INQUIRE call_facilities_list; - -extern EXPORT void call_togl_set_environment(char*); /* adisplay */ -extern EXPORT void call_togl_inquirefacilities(void); -extern EXPORT void call_togl_polygon_set(CALL_DEF_GROUP *, CALL_DEF_LISTFACETS *); -extern EXPORT void call_togl_curve(CALL_DEF_GROUP *, CALL_DEF_LISTPOINTS *); -extern EXPORT void call_togl_redraw_immediat_mode(CALL_DEF_VIEW *); -extern EXPORT void call_togl_redraw_layer2d(CALL_DEF_VIEW * aview, - CALL_DEF_LAYER * alayer); - -/*----------------------------------------------------------------------*/ - -#endif diff --git a/src/OpenGl/OpenGl_tgl_elems.hxx b/src/OpenGl/OpenGl_tgl_elems.hxx deleted file mode 100755 index f908ca1bc6..0000000000 --- a/src/OpenGl/OpenGl_tgl_elems.hxx +++ /dev/null @@ -1,72 +0,0 @@ -/*********************************************************************** - -FONCTION : ----------- -File OpenGl_tgl_elems : - - -REMARQUES: ----------- - -HISTORIQUE DES MODIFICATIONS : --------------------------------- -xx-xx-xx : xxx ; Creation. -17-07-96 : FMN ; Suppression de TelHLHSRMode -23-12-97 : FMN ; Suppression TelBackInteriorStyle, TelBackInteriorStyleIndex -et TelBackInteriorShadingMethod - -************************************************************************/ - -#ifndef OPENGL_TGL_ELEMS_H -#define OPENGL_TGL_ELEMS_H - -#include - -/* Element types */ -#define CALL_PHIGS_ELEM_NIL TelNil -#define CALL_PHIGS_ELEM_POLYMARKER3 TelMarkerSet -#define CALL_PHIGS_ELEM_ANNO_TEXT_REL3 TelText -#define CALL_PHIGS_ELEM_LINETYPE TelPolylineType -#define CALL_PHIGS_ELEM_LINEWIDTH TelPolylineWidth -#define CALL_PHIGS_ELEM_MARKER_TYPE TelPolymarkerType -#define CALL_PHIGS_ELEM_MARKER_SIZE TelPolymarkerSize -#define CALL_PHIGS_ELEM_TEXT_FONT TelTextFont -#define CALL_PHIGS_ELEM_CHAR_EXPAN TelCharacterExpansionFactor -#define CALL_PHIGS_ELEM_CHAR_SPACE TelCharacterSpacing -#define CALL_PHIGS_ELEM_ANNO_CHAR_HT TelTextHeight -#define CALL_PHIGS_ELEM_INT_STYLE TelInteriorStyle -#define CALL_PHIGS_ELEM_INT_STYLE_IND TelInteriorStyleIndex -#define CALL_PHIGS_ELEM_EDGE_FLAG TelEdgeFlag -#define CALL_PHIGS_ELEM_EDGETYPE TelEdgeType -#define CALL_PHIGS_ELEM_EDGEWIDTH TelEdgeWidth -#define CALL_PHIGS_ELEM_ADD_NAMES_SET TelAddNameset -#define CALL_PHIGS_ELEM_REMOVE_NAMES_SET TelRemoveNameset -#define CALL_PHIGS_ELEM_LOCAL_MODEL_TRAN3 TelLocalTran3 -#define CALL_PHIGS_ELEM_VIEW_IND TelViewIndex -#define CALL_PHIGS_ELEM_EXEC_STRUCT TelExecuteStructure -#define CALL_PHIGS_ELEM_LABEL TelLabel -#define CALL_PHIGS_ELEM_APPL_DATA TelApplicationData -#define CALL_PHIGS_ELEM_PICK_ID TelPickId -#define CALL_PHIGS_ELEM_POLYLINE_SET3_DATA TelPolyline -#define CALL_PHIGS_ELEM_TRI_STRIP3_DATA TelTriangleMesh -#define CALL_PHIGS_ELEM_QUAD_MESH3_DATA TelQuadrangle -#define CALL_PHIGS_ELEM_TEXT_COLR TelTextColour -#define CALL_PHIGS_ELEM_MARKER_COLR TelPolymarkerColour -#define CALL_PHIGS_ELEM_EDGE_COLR TelEdgeColour -#define CALL_PHIGS_ELEM_LINE_COLR TelPolylineColour -#define CALL_PHIGS_ELEM_INT_COLR TelInteriorColour -#define CALL_PHIGS_ELEM_BACK_INT_COLR TelBackInteriorColour -#define CALL_PHIGS_ELEM_REFL_PROPS TelSurfaceAreaProperties -#define CALL_PHIGS_ELEM_BACK_REFL_PROPS TelBackSurfaceAreaProperties -#define CALL_PHIGS_ELEM_INT_SHAD_METH TelInteriorShadingMethod -#define CALL_PHIGS_ELEM_INT_REFL_EQN TelInteriorReflectanceEquation -#define CALL_PHIGS_ELEM_BACK_INT_REFL_EQN TelBackInteriorReflectanceEquation -#define CALL_PHIGS_ELEM_FACE_DISTING_MODE TelFaceDistinguishingMode -#define CALL_PHIGS_ELEM_FACE_CULL_MODE TelFaceCullingMode -#define CALL_PHIGS_ELEM_LIGHT_SRC_STATE TelLightSrcState -#define CALL_PHIGS_ELEM_DCUE_IND TelDepthCueIndex -#define CALL_PHIGS_ELEM_HIGHLIGHT_INDEX TelHighlightIndex -#define CALL_PHIGS_ELEM_FILL_AREA3 TelPolygon -#define CALL_PHIGS_ELEM_NDXPOLYGONS3_DATA TelPolygonIndices -#define CALL_PHIGS_ELEM_FILL_AREA_SET3 TelPolygonHoles -#endif diff --git a/src/OpenGl/OpenGl_tgl_funcs.hxx b/src/OpenGl/OpenGl_tgl_funcs.hxx index 5b4fad7a25..9c0cd458db 100755 --- a/src/OpenGl/OpenGl_tgl_funcs.hxx +++ b/src/OpenGl/OpenGl_tgl_funcs.hxx @@ -50,10 +50,6 @@ from higher API */ * Includes */ #include -#include -#include -#include -#include #include #include @@ -120,1264 +116,22 @@ typedef struct { * Prototypes */ -extern void call_func_label(Tint); /* lid */ -extern void call_func_set_view_ind(Tint); /* vid */ -extern void call_func_appl_data(void*); /* data */ -extern void call_func_set_local_tran3(Tmatrix3, TComposeType); /* mat, mode */ -extern void call_func_set_linewidth(Tfloat); /* lw */ -extern void call_func_set_linetype(Tint); /* lt */ -extern void call_func_set_int_style(Tint); /* is */ -extern void call_func_set_edge_flag(Tint); /* state */ -extern void call_func_set_edge_type(Tint); /* type */ -extern void call_func_set_edgewidth(Tfloat); /* width */ -extern void call_func_set_int_style_ind(Tint); /* ind */ -extern void call_func_set_face_disting_mode(Tint); /* mode */ -extern void call_func_set_face_cull_mode(Tint); /* mode */ -extern void call_func_set_marker_type(Tint); /* type */ -extern void call_func_set_marker_size(Tfloat); /* size */ -extern void call_func_exec_struct(Tint); /* stid */ -extern void call_func_init_tgl(void); -extern void call_func_post_struct(Tint, Tint, Tfloat); /* ws, stid, prio */ -extern void call_func_set_int_shad_meth(Tint); /* method */ -extern void call_func_set_refl_eqn(Tint); /* eqn */ -extern void call_func_set_back_refl_eqn(Tint); /* eqn */ -extern void call_func_set_text_font(Tchar*); /* font */ -extern void call_func_set_char_space(Tfloat); /* sp */ -extern void call_func_set_char_expan(Tfloat); /* exp */ -extern void call_func_set_pick_id(Tint); /* pickid */ -extern void call_func_redraw_all_structs (Tint, Tint); /* wsid, swap */ -extern void call_func_redraw_all_structs_begin (Tint); /* wsid */ -extern void call_func_redraw_all_structs_proc (Tint); /* wsid */ -extern void call_func_redraw_all_structs_end (Tint, Tint); /* wsid, swap */ -extern void call_func_set_anno_char_ht(Tfloat); /* height */ -extern void call_func_set_anno_char_up_vec(Tfloat[2]); /* up_vector */ -extern void call_func_set_anno_path(Tint); /* path */ -extern void call_func_set_anno_align(Tint, Tint); /* hor, ver */ -extern void call_func_anno_text_rel3( tel_point, Techar* ); -extern void call_func_dcue_ind(Tint); /* dcid */ -extern void call_func_set_do_texturemap(Tint); /* bool */ -extern void call_func_set_texture_id(Tint); /* TextureID */ -extern void call_func_set_text_style(int); /* style */ -extern void call_func_set_text_display_type(int); /* display_type */ -#ifdef G003 -extern void call_func_set_degenerate_model ( Tint, Tfloat ); /* degenerate model */ -#endif /* G003 */ +extern void call_func_eval_ori_matrix3 (const point3* vrp, + const vec3* vpn, + const vec3* vup, + int* err_ind, + float mout[4][4]); -extern void call_func_set_text_zoomable(Tint); /*Text Zoomable usage*/ -extern void call_func_set_text_angle(Tfloat); /*Text Angle usage*/ -extern void call_func_set_text_fontaspect(OSD_FontAspect); /*Text Zoomable usage*/ +extern void call_func_eval_map_matrix3(view_map3 *Map, int *err_ind, matrix3 mat); + +int EXPORT call_togl_create_texture (int Type, unsigned int Width, unsigned int Height, unsigned char *Data, char *FileName); -/* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */ -extern void call_func_set_polygon_offset_params( Tint, /* mode */ - Tfloat, /* factor */ - Tfloat ); /* units */ -/* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */ +void EXPORT call_togl_destroy_texture (int TexId); -/* ABD 29/10/04 Transform Persistence of Presentation( pan, zoom, rotate ) */ -extern void call_func_set_transform_persistence( Tint, Tfloat, Tfloat, Tfloat ); -/* extern void call_func_set_transform_persistence( tel_transform_persistence tp );*/ -/* ABD 29/10/04 Transform Persistence of Presentation( pan, zoom, rotate ) */ +void EXPORT call_togl_modify_texture (int TexId, CALL_DEF_INIT_TEXTURE *init_tex); + +int EXPORT call_togl_inquiretexture (); - -/* OCC18942: obsolete in OCCT6.3, might be removed in further versions! */ -extern void call_func_eval_ori_matrix3( point3 *vrp, vec3 *vpn, vec3 *vup, - int *err_ind, float mout[4][4] ); -/* OCC18942: obsolete in OCCT6.3, might be removed in further versions! */ -extern void call_func_eval_map_matrix3( view_map3 *Map, int *err_ind, - matrix3 mat ); - -/*----------------------------------------------------------------------*/ -/* -* Constantes -*/ - -/* Edge types */ -#define CALL_PHIGS_EDGE_OFF TOff -#define CALL_PHIGS_EDGE_ON TOn - -/* Edge data flags */ -#define CALL_PHIGS_EDGE_NONE TOff -#define CALL_PHIGS_EDGE_VISIBILITY TOn - -/* Line Types */ -#define CALL_PHIGS_LINE_SOLID TEL_LS_SOLID -#define CALL_PHIGS_LINE_DASH TEL_LS_DASH -#define CALL_PHIGS_LINE_DOT TEL_LS_DOT -#define CALL_PHIGS_LINE_DASH_DOT TEL_LS_DASH_DOT - -/* Marker types */ -#define CALL_PHIGS_MARKER_DOT TEL_PM_DOT -#define CALL_PHIGS_MARKER_PLUS TEL_PM_PLUS -#define CALL_PHIGS_MARKER_ASTERISK TEL_PM_STAR -#define CALL_PHIGS_MARKER_CIRCLE TEL_PM_CIRC -#define CALL_PHIGS_MARKER_CROSS TEL_PM_CROSS -#define CALL_PHIGS_MARKER_USER_DEFINED TEL_PM_USERDEFINED - -/* Text : Path */ -#define CALL_PHIGS_PATH_RIGHT 0 -#define CALL_PHIGS_PATH_LEFT 0 -#define CALL_PHIGS_PATH_UP 0 -#define CALL_PHIGS_PATH_DOWN 0 - -/* Text : Horizontal alignment */ -#define CALL_PHIGS_HOR_LEFT 0 -#define CALL_PHIGS_HOR_CENTER 1 -#define CALL_PHIGS_HOR_RIGHT 2 - -/* Text : Vertical alignment */ -#define CALL_PHIGS_VERT_BOTTOM 0 -#define CALL_PHIGS_VERT_CENTER 1 -#define CALL_PHIGS_VERT_TOP 2 - -/* Interior styles */ -#define CALL_PHIGS_STYLE_HOLLOW TSM_HOLLOW -#define CALL_PHIGS_STYLE_SOLID TSM_SOLID -#define CALL_PHIGS_STYLE_HATCH TSM_HATCH -#define CALL_PHIGS_STYLE_EMPTY TSM_EMPTY -#define CALL_PHIGS_STYLE_HIDDENLINE TSM_HIDDENLINE - -/* Light Source Types */ -#define CALL_PHIGS_LIGHT_AMBIENT TLightAmbient -#define CALL_PHIGS_LIGHT_DIRECTIONAL TLightDirectional -#define CALL_PHIGS_LIGHT_POSITIONAL TLightPositional -#define CALL_PHIGS_LIGHT_SPOT TLightSpot - -/* Hatch styles */ -#define CALL_PHIGS_HATCH_HORIZ TEL_HS_HORIZONTAL -#define CALL_PHIGS_HATCH_HORIZ_DBL TEL_HS_HORIZONTAL_SPARSE -#define CALL_PHIGS_HATCH_VERT TEL_HS_VERTICAL -#define CALL_PHIGS_HATCH_VERT_DBL TEL_HS_VERTICAL_SPARSE -#define CALL_PHIGS_HATCH_DIAG_45 TEL_HS_DIAG_45 -#define CALL_PHIGS_HATCH_DIAG_45_DBL TEL_HS_DIAG_45_SPARSE -#define CALL_PHIGS_HATCH_DIAG_135 TEL_HS_DIAG_135 -#define CALL_PHIGS_HATCH_DIAG_135_DBL TEL_HS_DIAG_135_SPARSE -#define CALL_PHIGS_HATCH_GRID_R TEL_HS_GRID -#define CALL_PHIGS_HATCH_GRID_R_DBL TEL_HS_GRID_SPARSE -#define CALL_PHIGS_HATCH_GRID_D TEL_HS_CROSS -#define CALL_PHIGS_HATCH_GRID_D_DBL TEL_HS_CROSS_SPARSE - -/* Edit modes */ -#define CALL_PHIGS_EDIT_INSERT TEditInsert -#define CALL_PHIGS_EDIT_REPLACE TEditReplace - -/* Transformation */ -#define CALL_PHIGS_TYPE_PRECONCAT TPreConcatenate -#define CALL_PHIGS_TYPE_POSTCONCAT TPostConcatenate -#define CALL_PHIGS_TYPE_REPLACE TReplace - -/* Clipping indicators */ -#define CALL_PHIGS_IND_NO_CLIP TOff -#define CALL_PHIGS_IND_CLIP TOn - -/* Projection types */ -#define CALL_PHIGS_TYPE_PARAL TelParallel -#define CALL_PHIGS_TYPE_PERSPECT TelPerspective - -/* shading methods */ -#define CALL_PHIGS_SD_NONE TEL_SM_FLAT -#define CALL_PHIGS_SD_COLOUR TEL_SM_GOURAUD -#define CALL_PHIGS_SD_DOT_PRODUCT TEL_SM_GOURAUD -#ifndef BUC60570 -#define CALL_PHIGS_SD_NORMAL TEL_SM_GOURAUD -#else -#define CALL_PHIGS_SD_NORMAL TEL_SM_FLAT -#endif - -/* lighting methods */ -#define CALL_PHIGS_REFL_NONE 0x0000 -#define AMBIENT_MASK 0x0001 -#define DIFFUSE_MASK 0x0002 -#define SPECULAR_MASK 0x0004 -#define EMISSIVE_MASK 0x0008 - -/* cull mode */ -#define CALL_PHIGS_CULL_NONE TelCullNone -#define CALL_PHIGS_CULL_BACKFACE TelCullBack -#define CALL_PHIGS_CULL_FRONTFACE TelCullFront - -/* depth cue mode */ -#define CALL_PHIGS_SUPPRESSED TelDCSuppressed -#define CALL_PHIGS_ALLOWED TelDCAllowed - -/* distinguish mode */ -#define CALL_PHIGS_DISTING_NO TOff -#define CALL_PHIGS_DISTING_YES TOn - -#define CALL_DEF_ENABLE_ZBUFFER TOn -#define CALL_DEF_DISABLE_ZBUFFER TOff - -/* style of text */ -#define ASPECT_TOST_NORMAL 0 -#define ASPECT_TOST_ANNOTATION 1 - -/* display type of the text */ -#define ASPECT_TODT_NORMAL 0 -#define ASPECT_TODT_SUBTITLE 1 -#define ASPECT_TODT_DEKALE 2 -#define ASPECT_TODT_BLEND 3 - -/* Pick Order */ -#define PTOP_FIRST TTopFirst -#define PBOTTOM_FIRST TBottomFirst - -/* Facet types */ -#define CALL_PHIGS_SHAPE_COMPLEX TEL_SHAPE_COMPLEX -#define CALL_PHIGS_SHAPE_NONCONVEX TEL_SHAPE_CONCAVE -#define CALL_PHIGS_SHAPE_CONVEX TEL_SHAPE_CONVEX -#define CALL_PHIGS_SHAPE_UNKNOWN TEL_SHAPE_UNKNOWN - -/* Vertex flags */ -#define CALL_PHIGS_VERT_COORD TEL_VTFLAG_NONE -#define CALL_PHIGS_VERT_COORD_COLOUR TEL_VTFLAG_COLOUR -#define CALL_PHIGS_VERT_COORD_NORMAL TEL_VTFLAG_NORMAL -#define CALL_PHIGS_VERT_COORD_COLOUR_NORMAL TEL_VTFLAG_COLOURNORMAL - -/* Facet data flags */ -#define CALL_PHIGS_FACET_NONE TEL_FAFLAG_NONE -#define CALL_PHIGS_FACET_COLOUR TEL_FAFLAG_COLOUR -#define CALL_PHIGS_FACET_NORMAL TEL_FAFLAG_NORMAL -#define CALL_PHIGS_FACET_COLOUR_NORMAL TEL_FAFLAG_COLOURNORMAL - -/* functions */ -#define call_func_open_struct TsmOpenStructure -#define call_func_close_struct TsmCloseStructure -#define call_func_set_edit_mode TsmSetEditMode -#define call_func_set_elem_ptr TsmSetElementPointer -#define call_func_offset_elem_ptr TsmOffsetElementPointer -#define call_func_set_elem_ptr_label TsmSetElementPointerAtLabel -#define call_func_del_elem TsmDeleteElement -#define call_func_del_elem_range TsmDeleteElementRange -#define call_func_del_elems_labels TsmDeleteElementsBetweenLabels -#define call_func_del_struct TsmDeleteStructure - -#define call_func_inq_elem_ptr TsmGetCurElemPtr -#define call_func_inq_elem TsmGetCurElem - -/* Declarations des subroutines triedron */ - -void EXPORT call_togl_ztriedron_setup ( - float* xcolor, - float* ycolor, - float* zcolor, - float sizeratio, - float axisdiameter, - int nbfacettes - ); - -void EXPORT call_togl_triedron_display ( - CALL_DEF_VIEW * aview, - int APosition, - float r, - float g, - float b, - float AScale, - int asWireframe - ); - -void EXPORT call_togl_triedron_erase ( - CALL_DEF_VIEW *aview - ); - -void EXPORT call_togl_triedron_echo ( - CALL_DEF_VIEW *aview, - int AType - ); - -/* Graduated trihedron */ - -void EXPORT call_togl_graduatedtrihedron_display(CALL_DEF_VIEW* view, - const Graphic3d_CGraduatedTrihedron &cubic); - -void EXPORT call_togl_graduatedtrihedron_erase(CALL_DEF_VIEW* view); - -void EXPORT call_togl_graduatedtrihedron_minmaxvalues(float xmin, float ymin, float zmin, - float xmax, float ymax, float zmax); - -/* Declarations des subroutines mode immediat */ - -int EXPORT call_togl_begin_ajout_mode ( - CALL_DEF_VIEW *aview - ); - -void EXPORT call_togl_end_ajout_mode ( - ); - -int EXPORT call_togl_begin_immediat_mode ( - CALL_DEF_VIEW *aview, - CALL_DEF_LAYER *anunderlayer, - CALL_DEF_LAYER *anoverlayer, - int doublebuffer, - int retainmode - ); - -void EXPORT call_togl_end_immediat_mode ( - int synchronize - ); - -void EXPORT call_togl_clear_immediat_mode ( - CALL_DEF_VIEW *aview, - int aFlush - ); - -void EXPORT call_togl_transform ( - CALL_DEF_MATRIX4X4 amatrix, - int mode - ); - -void EXPORT call_togl_begin_polyline ( - ); - -void EXPORT call_togl_end_polyline ( - ); - -void EXPORT call_togl_begin_polygon ( - ); - -void EXPORT call_togl_end_polygon ( - ); - -void EXPORT call_togl_begin_trianglemesh ( - ); - -void EXPORT call_togl_end_trianglemesh ( - ); - -void EXPORT call_togl_begin_marker ( - ); - -void EXPORT call_togl_end_marker ( - ); - -void EXPORT call_togl_begin_bezier ( - ); - -void EXPORT call_togl_end_bezier ( - ); - -void EXPORT call_togl_move ( - float x, - float y, - float z - ); - -void EXPORT call_togl_movenormal ( - float x, - float y, - float z, - float nx, - float ny, - float nz - ); - -void EXPORT call_togl_moveweight ( - float x, - float y, - float z, - float w - ); - -void EXPORT call_togl_draw ( - float x, - float y, - float z - ); - -void EXPORT call_togl_drawnormal ( - float x, - float y, - float z, - float nx, - float ny, - float nz - ); - -void EXPORT call_togl_drawweight ( - float x, - float y, - float z, - float w - ); - -void EXPORT call_togl_draw_text ( - CALL_DEF_TEXT *atext - ); - -void EXPORT call_togl_draw_structure ( - int StructId - ); - -void EXPORT call_togl_set_linecolor ( - float r, - float g, - float b - ); - -void EXPORT call_togl_set_interiorcolor ( - float r, - float g, - float b - ); - -void EXPORT call_togl_set_linetype ( - - long type - - ); - -void EXPORT call_togl_set_interiortype ( - - long type - - ); - -void EXPORT call_togl_set_linewidth ( - - float width - - ); - -void EXPORT call_togl_set_textcolor ( - - float r, - float g, - float b - - ); - -void EXPORT call_togl_set_textfont ( - - char *police, - float factor, - float space - - ); - -void EXPORT call_togl_set_markercolor ( - - float r, - float g, - float b - - ); - -void EXPORT call_togl_set_markertype ( - - long type, - float scale - - ); - -void EXPORT call_togl_set_minmax ( - - float x1, - float y1, - float z1, - float x2, - float y2, - float z2 - - ); - -void EXPORT call_togl_set_rgb ( - - float r, - float g, - float b - - ); - -/* Declarations des subroutines appelees du C++ */ -/* dans les packages Graphic3d et Visual3d */ - -void EXPORT call_togl_opengroup ( - - CALL_DEF_GROUP *agroup - - ); - -void EXPORT call_togl_closegroup ( - - CALL_DEF_GROUP *agroup - - ); - -void EXPORT call_togl_cleargroup ( - - CALL_DEF_GROUP *agroup - - ); - -void EXPORT call_togl_linecontextgroup ( - - CALL_DEF_GROUP *agroup, - int noinsert - - ); - -void EXPORT call_togl_facecontextgroup ( - - CALL_DEF_GROUP *agroup, - int noinsert - - ); - -void EXPORT call_togl_markercontextgroup ( - - CALL_DEF_GROUP *agroup, - int noinsert - - ); - -void EXPORT call_togl_textcontextgroup ( - - CALL_DEF_GROUP *agroup, - int noinsert - - ); - -void EXPORT call_togl_group ( - - CALL_DEF_GROUP *agroup - - ); - -void EXPORT call_togl_marker ( - - CALL_DEF_GROUP *agroup, - CALL_DEF_MARKER *amarker - - ); - -void EXPORT call_togl_marker_set ( - - CALL_DEF_GROUP *agroup, - CALL_DEF_LISTMARKERS *almarkers - - ); - -void EXPORT call_togl_polyline ( - - CALL_DEF_GROUP *agroup, - CALL_DEF_LISTPOINTS *alpoints - - ); - -void EXPORT call_togl_polygon ( - - CALL_DEF_GROUP *agroup, - CALL_DEF_FACET *afacet - - ); - -void EXPORT call_togl_polygon_holes ( - - CALL_DEF_GROUP *agroup, - CALL_DEF_LISTFACETS *alfacets - - ); - -void EXPORT call_togl_polygon_indices ( - - CALL_DEF_GROUP *agroup, - CALL_DEF_LISTPOINTS *alpoints, - CALL_DEF_LISTEDGES *aledges, - CALL_DEF_LISTINTEGERS *albounds - - ); - -void EXPORT call_togl_pickid ( - - CALL_DEF_GROUP *agroup - - ); - -void EXPORT call_togl_quadrangle ( - - CALL_DEF_GROUP *agroup, - CALL_DEF_QUAD *aquad - - ); - -void EXPORT call_togl_removegroup ( - - CALL_DEF_GROUP *agroup - - ); - -void EXPORT call_togl_text ( - - CALL_DEF_GROUP *agroup, - CALL_DEF_TEXT *atext - - ); - -void EXPORT call_togl_triangle ( - - CALL_DEF_GROUP *agroup, - CALL_DEF_TRIKE *atrike - - ); - -void EXPORT call_togl_bezier ( - - CALL_DEF_GROUP *agroup, - CALL_DEF_LISTPOINTS *alpoints - - ); - -void EXPORT call_togl_bezier_weight ( - - CALL_DEF_GROUP *agroup, - CALL_DEF_LISTPOINTS *alpoints, - CALL_DEF_LISTREALS *alweights - - ); - -void EXPORT call_togl_blink ( - - CALL_DEF_STRUCTURE *astructure, - int create - - ); - -void EXPORT call_togl_boundarybox ( - - CALL_DEF_STRUCTURE *astructure, - int create - - ); - -void EXPORT call_togl_clearstructure ( - - CALL_DEF_STRUCTURE *astructure - - ); - -void EXPORT call_togl_contextstructure ( - - CALL_DEF_STRUCTURE *astructure - - ); - -void EXPORT call_togl_highlightcolor ( - - CALL_DEF_STRUCTURE *astructure, - CALL_DEF_COLOR *acolor, - int create - - ); - -void EXPORT call_togl_namesetstructure ( - - CALL_DEF_STRUCTURE *astructure - - ); - -void EXPORT call_togl_removestructure ( - - CALL_DEF_STRUCTURE *astructure - - ); - -void EXPORT call_togl_structure ( - - CALL_DEF_STRUCTURE *astructure - - ); - -void EXPORT call_togl_transformstructure ( - - CALL_DEF_STRUCTURE *astructure - - ); - -void EXPORT call_togl_degeneratestructure ( - - CALL_DEF_STRUCTURE *astructure - - ); - -void EXPORT call_togl_connect ( - - CALL_DEF_STRUCTURE *afather, - CALL_DEF_STRUCTURE *ason - - ); - -void EXPORT call_togl_disconnect ( - - CALL_DEF_STRUCTURE *afather, - CALL_DEF_STRUCTURE *ason - - ); - -int EXPORT call_togl_begin_animation ( - - CALL_DEF_VIEW *aview - - ); - -void EXPORT call_togl_end_animation ( - - CALL_DEF_VIEW *aview - - ); - -int EXPORT call_togl_begin ( - - char *adisplay - - ); - -/*RIC120302*/ -int EXPORT call_togl_begin_display ( - - void *pdisplay - - ); -/*RIC120302*/ - -void EXPORT call_togl_end ( - - - ); - -void EXPORT call_togl_structure_exploration ( - - long Id, - long LabelBegin, - long LabelEnd - - ); - -void EXPORT call_togl_element_exploration ( - - long Id, - long elem_num, - long *type, - CALL_DEF_POINT *pt, - CALL_DEF_NORMAL *npt, - CALL_DEF_COLOR *cpt, - CALL_DEF_NORMAL *nfa - - ); - -void EXPORT call_togl_element_type ( - - long Id, - long elem_num, - long *type - - ); - -void EXPORT call_togl_activateview ( - - CALL_DEF_VIEW *aview - - ); - -void EXPORT call_togl_antialiasing ( - - CALL_DEF_VIEW *aview, - int tag - - ); - -void EXPORT call_togl_background ( - - CALL_DEF_VIEW *aview - - ); - -void EXPORT call_togl_gradient_background ( - - int ws, int type, - tel_colour tcolor1, tel_colour tcolor2 - - ); - -void EXPORT call_togl_set_gradient_type ( - - int ws, int type - - ); - -int EXPORT call_togl_project_raster ( - - int wsid, - float x, - float y, - float z, - int *ixr, - int *iyr - - ); - -int EXPORT call_togl_adopt_to_rect( - int, - int, - int - ); - -int EXPORT call_togl_unproject_raster ( - - int wsid, - int xm, - int ym, - int xM, - int yM, - int ixr, - int iyr, - float *x, - float *y, - float *z - - ); - -int EXPORT call_togl_unproject_raster_with_ray ( - - int wsid, - int xm, - int ym, - int xM, - int yM, - int ixr, - int iyr, - float *x, - float *y, - float *z, - float *dx, - float *dy, - float *dz - - ); - -void EXPORT call_togl_cliplimit ( - - CALL_DEF_VIEW *aview, - int wait - - ); - -void EXPORT call_togl_deactivateview ( - - CALL_DEF_VIEW *aview - - ); - -void EXPORT call_togl_depthcueing ( - - CALL_DEF_VIEW *aview, - int tag - - ); - -void EXPORT call_togl_displaystructure ( - - CALL_DEF_VIEW *aview, - int StructId, - int Priority - - ); - -void EXPORT call_togl_erasestructure ( - - int ViewId, - int StructId - - ); - -void EXPORT call_togl_init_pick ( - - - ); - -void EXPORT call_togl_pick ( - - CALL_DEF_PICK *apick - - ); - -void EXPORT call_togl_ratio_window ( - - CALL_DEF_VIEW *aview - - ); - -void EXPORT call_togl_redraw ( - - CALL_DEF_VIEW *aview, - CALL_DEF_LAYER *anunderlayer, - CALL_DEF_LAYER *anoverlayer - - ); - -void EXPORT call_togl_redraw_area ( - - CALL_DEF_VIEW *aview, - CALL_DEF_LAYER *anunderlayer, - CALL_DEF_LAYER *anoverlayer, - int x, int y, int width, int height - - ); - -void EXPORT call_togl_removeview ( - - CALL_DEF_VIEW *aview - - ); - -void EXPORT call_togl_setlight ( - - CALL_DEF_VIEW *aview - - ); - -void EXPORT call_togl_setplane ( - - CALL_DEF_VIEW *aview - - ); - -void EXPORT call_togl_setvisualisation ( - - CALL_DEF_VIEW *aview - - ); - -void EXPORT call_togl_transparency ( - - int WsId, - int ViewId, - int Activity - - ); - -void EXPORT call_togl_update ( - - CALL_DEF_VIEW *aview, - CALL_DEF_LAYER *anunderlayer, - CALL_DEF_LAYER *anoverlayer - - ); - -int EXPORT call_togl_view ( - - CALL_DEF_VIEW *aview - - ); - -int EXPORT call_togl_viewmapping ( - - CALL_DEF_VIEW *aview, - int wait - - ); - -int EXPORT call_togl_vieworientation ( - - CALL_DEF_VIEW *aview, - int wait - - ); - -int EXPORT call_togl_inquiretexture ( - - - ); - -int EXPORT call_togl_inquirelight ( - - - ); - -int EXPORT call_togl_inquireplane ( - - - ); - -int EXPORT call_togl_inquireview ( - - - ); - -int EXPORT call_togl_inquiremat ( - - CALL_DEF_VIEW *aview, - CALL_DEF_MATRIX4X4 ori_matrix, - CALL_DEF_MATRIX4X4 map_matrix - - ); - -void EXPORT call_togl_view_exploration ( - - long Id - - ); - -#ifdef OCC1188 -int EXPORT call_togl_create_texture ( - - int Type, - unsigned int Width, - unsigned int Height, - unsigned char *Data, - char *FileName - - ); - -void EXPORT call_togl_create_bg_texture ( - - CALL_DEF_VIEW *aview, - int width, - int height, - unsigned char *data, - int style - - ); -#endif /* OCC1188 */ - -void EXPORT call_togl_set_bg_texture_style( - - CALL_DEF_VIEW* aview, - int style - - ); - -void EXPORT call_togl_destroy_texture ( - - int TexId - - ); - -void EXPORT call_togl_modify_texture ( - - int TexId, - CALL_DEF_INIT_TEXTURE *init_tex - - ); - -void EXPORT call_togl_environment ( - - CALL_DEF_VIEW *aview - - ); - -/* Declarations des subroutines layer mode */ - -void EXPORT call_togl_layer2d ( - - CALL_DEF_LAYER *alayer - - ); - -void EXPORT call_togl_removelayer2d ( - - CALL_DEF_LAYER *alayer - - ); - -void EXPORT call_togl_begin_layer2d ( - - CALL_DEF_LAYER *alayer - - ); - -void EXPORT call_togl_end_layer2d ( - ); - -void EXPORT call_togl_clear_layer2d ( - - CALL_DEF_LAYER *alayer - - ); - -void EXPORT call_togl_begin_polyline2d ( - ); - -void EXPORT call_togl_end_polyline2d ( - ); - -void EXPORT call_togl_begin_polygon2d ( - ); - -void EXPORT call_togl_end_polygon2d ( - ); - -void EXPORT call_togl_move2d ( - - float x, - float y - - ); - -void EXPORT call_togl_draw2d ( - - float x, - float y - - ); - -void EXPORT call_togl_edge2d ( - - float x, - float y - - ); - -void EXPORT call_togl_rectangle2d ( - - float x, - float y, - float w, - float h - - ); - -void EXPORT call_togl_set_color ( - - float r, - float g, - float b - - ); - -void EXPORT call_togl_set_transparency ( - - float a - - ); - -void EXPORT call_togl_unset_transparency ( ); - -void EXPORT call_togl_set_line_attributes ( - - long type, - float width - - ); - -void EXPORT call_togl_set_text_attributes ( - - Tchar* font, - long type, - float r, - float g, - float b - - ); - -void EXPORT call_togl_set_text_attributes ( - - Tchar* font, - Tint height, - OSD_FontAspect type, - float r, - float g, - float b - - ); - -void EXPORT call_togl_set_text_scale_factors ( - - Tfloat x, - Tfloat y - - ); - -void EXPORT call_togl_text2d ( - - Techar *s, - float x, - float y, - float height - - ); - -void EXPORT call_togl_textsize2d ( - - Techar *s, - float height, - float *width, - float *ascent, - float *descent - - ); - -void EXPORT call_togl_backfacing ( - - CALL_DEF_VIEW* - - ); - -/* *** group of parray functions *** */ - -void EXPORT call_togl_parray ( - - CALL_DEF_GROUP *agroup, - CALL_DEF_PARRAY* parray - - ); - -void EXPORT call_togl_parray_remove ( - - CALL_DEF_GROUP *agroup, - CALL_DEF_PARRAY* parray - - ); - -void EXPORT call_togl_userdraw ( - - CALL_DEF_GROUP *agroup, - CALL_DEF_USERDRAW *anobject - - ); - -/* ------------------------- */ -Standard_Boolean EXPORT call_togl_print ( - - CALL_DEF_VIEW *aview, - CALL_DEF_LAYER *anunderlayer, - CALL_DEF_LAYER *anoverlayer, - const Aspect_Drawable hPrintDC, - const int background, - const char* filename, - const int printalgo = 0, - const float theScaleFactor = 1.0 - - ); - - -#ifdef BUC61044 -void EXPORT call_togl_depthtest ( - - CALL_DEF_VIEW *aview, - int dFlag - - ); - -int EXPORT call_togl_isdepthtest ( - - CALL_DEF_VIEW *aview - - ); -#endif - -#ifdef BUC61045 -void EXPORT call_togl_gllight ( - - CALL_DEF_VIEW *aview, - int dFlag - - ); - -int EXPORT call_togl_isgllight ( - - CALL_DEF_VIEW *aview - - ); -#endif - -/*----------------------------------------------------------------------*/ +int EXPORT call_togl_inquireplane (); #endif diff --git a/src/OpenGl/OpenGl_tgl_pick.hxx b/src/OpenGl/OpenGl_tgl_pick.hxx deleted file mode 100755 index fad1d3b7d3..0000000000 --- a/src/OpenGl/OpenGl_tgl_pick.hxx +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef OPENGL_TGL_PICK_H -#define OPENGL_TGL_PICK_H - -typedef struct -{ - Tint number; - Tint *integers; -} Tintlst; - -/* Primitive pick and name set ids. */ /* defined in tgl/util */ -extern Tintlst inc_pick_filter; -extern Tintlst exc_pick_filter; - -/* Primitive highlight and name set ids. */ /* defined in tgl/util */ -extern Tintlst inc_highl_filter; -extern Tintlst exc_highl_filter; - -#define CALL_MAX_DEPTH_LENGTH 128 - -#endif diff --git a/src/OpenGl/OpenGl_tgl_subrs.hxx b/src/OpenGl/OpenGl_tgl_subrs.hxx deleted file mode 100755 index ce132bbd50..0000000000 --- a/src/OpenGl/OpenGl_tgl_subrs.hxx +++ /dev/null @@ -1,66 +0,0 @@ -/* -File OpenGl_tgl_subrs.h - -Modified 16/06/2000 : ATS,SPK : G005 : Group of functions -call_subr_parray_xxx -call_subr_darray_xxx -*/ - -#ifndef OPENGL_TGL_SUBRS_H -#define OPENGL_TGL_SUBRS_H - -#include - -#include - -extern void call_subr_set_line_colr(Tfloat, Tfloat, Tfloat); /* r, g, b */ -extern void call_subr_polyline(CALL_DEF_LISTPOINTS *); /* alpoints */ -extern void call_subr_polyline_data(CALL_DEF_LISTPOINTS *); /* alpoints */ -extern void call_subr_addnameset(Tint, Tint *); /* num, names */ -extern void call_subr_remnameset(Tint, Tint *); /* num, names */ - -extern void call_subr_set_int_colr(Tfloat, Tfloat, Tfloat, Tfloat);/* r, g, b, a */ -extern void call_subr_set_back_int_colr(Tfloat, Tfloat, Tfloat, Tfloat); -extern void call_subr_set_text_colr(Tfloat, Tfloat, Tfloat); /* r, g, b */ -extern void call_subr_set_text_colr_subtitle(Tfloat, Tfloat, Tfloat); /* r, g, b */ -extern void call_subr_set_edge_colr(Tfloat, Tfloat, Tfloat); /* r, g, b */ -extern void call_subr_set_marker_colr(Tfloat, Tfloat, Tfloat); /* r, g, b */ -extern void call_subr_set_refl_props(CALL_DEF_MATERIAL *, Tint); /* mat, tag */ -extern void call_subr_marker(CALL_DEF_MARKER *); /* amarker */ -extern void call_subr_marker_set(CALL_DEF_LISTMARKERS *); /* almarkers */ - -extern TStatus call_subr_get_exec_struct(Tint, Tint, Tint *); /* F, S, &ind */ -extern void call_subr_polygon_data(CALL_DEF_FACET *); /* afacet */ -extern void call_subr_polygon(CALL_DEF_FACET *); /* afacet */ -extern void call_subr_polygon_holes(CALL_DEF_LISTFACETS *); /* alfacets */ -extern void call_subr_polygon_holes_data(CALL_DEF_LISTFACETS *); /* alfacets */ -extern void call_subr_polygon_indices(CALL_DEF_LISTPOINTS *, /* alpoints */ - CALL_DEF_LISTEDGES *, /* aledges */ - CALL_DEF_LISTINTEGERS *); /* albounds */ -extern void call_subr_polygon_set(CALL_DEF_LISTFACETS *); /* alfacets */ -extern void call_subr_quadrangle(CALL_DEF_QUAD *); /* aquad */ -extern void call_subr_polygon_holes(CALL_DEF_LISTFACETS *); /* alfacets */ - -extern void call_subr_polygon_holes_data(CALL_DEF_LISTFACETS *); /*alfacets*/ - -extern void call_subr_triangle(CALL_DEF_TRIKE *); /* atrike */ -extern void call_subr_set_highl_rep(Tint); /* index */ -extern void call_subr_structure_exploration(Tint, /*Id*/ - Tint, /*LabelBegin*/ - Tint, /*LabelEnd*/ - Tint, /*elem_num*/ - Tint*, /*elem_type*/ - CALL_DEF_POINT *, /*pt*/ - CALL_DEF_NORMAL *, /*npt*/ - CALL_DEF_COLOR *, /*cpt*/ - CALL_DEF_NORMAL * /*nfa*/); -/* struct_id, ws_ids */ -extern Tint call_subr_inquirews(Tint, Tint *); -extern void call_subr_curve(CALL_DEF_LISTPOINTS *); - -/* PARRAY functions */ - -extern void call_subr_parray( CALL_DEF_PARRAY *parray ); -extern void call_subr_userdraw( CALL_DEF_USERDRAW *anobject ); - -#endif diff --git a/src/OpenGl/OpenGl_tgl_subrvis.hxx b/src/OpenGl/OpenGl_tgl_subrvis.hxx deleted file mode 100755 index a3e08f6560..0000000000 --- a/src/OpenGl/OpenGl_tgl_subrvis.hxx +++ /dev/null @@ -1,51 +0,0 @@ -/*********************************************************************** - -FONCTION : ----------- -File OpenGl_tgl_subrvis : - - -REMARQUES: ----------- - -HISTORIQUE DES MODIFICATIONS : --------------------------------- -xx-xx-xx : xxx ; Creation. -17-07-96 : FMN ; Modification de call_subr_hlhsr et call_util_setvisualization -29-01-97 : FMN ; Suppression de call_subr_doublebuffer(). - -************************************************************************/ - -#ifndef OPENGL_TGL_SUBRVIS_H -#define OPENGL_TGL_SUBRVIS_H - -#ifndef RIC120302 -#define RIC120302 /* GG Add call_subr_displayCB function -*/ -#endif - -#include -#include - -#include - -#ifdef RIC120302 -extern int call_subr_displayCB(CALL_DEF_VIEW* /*aview*/, int /*reason*/ ); -#endif -extern int call_subr_open_ws(CALL_DEF_VIEW *); /* aview */ -extern void call_subr_enable_polygon_offset(); -extern void call_subr_disable_polygon_offset(); -extern void call_subr_resize(CALL_DEF_VIEW *); /* aview */ -extern void call_subr_antialiasing(CALL_DEF_VIEW *, Tint); /* aview, tag */ -extern void call_subr_hlhsr(CALL_DEF_VIEW *, Tint); /* aview, flag */ -extern void call_subr_depthcueing(CALL_DEF_VIEW *, Tint); /* aview, tag */ -extern TStatus call_subr_get_view_index(Tint, Tint *); /* stid, &vid */ -extern void call_subr_pick(CALL_DEF_PICK *); /* apick */ -extern void call_subr_set_light_src_rep(CALL_DEF_LIGHT *); /* alight */ -extern void call_subr_set_background(Tint, tel_colour); /* ws, rgb */ -extern void call_subr_set_gradient_background(Tint, Tint, tel_colour, tel_colour); /* ws, type, rgb ,rgb */ -extern void call_subr_close_ws(CALL_DEF_VIEW *); -extern void call_util_setvisualization(CALL_DEF_VIEW *, int, int); -extern void call_subr_transparency (int , int , int ); - -#endif diff --git a/src/OpenGl/OpenGl_tgl_tox.hxx b/src/OpenGl/OpenGl_tgl_tox.hxx deleted file mode 100755 index 736b841825..0000000000 --- a/src/OpenGl/OpenGl_tgl_tox.hxx +++ /dev/null @@ -1,42 +0,0 @@ -/*********************************************************************** - -FONCTION : ----------- -Include OpenGl_tgl_tox : - - -REMARQUES: ----------- - - -HISTORIQUE DES MODIFICATIONS : --------------------------------- -xx-xx-xx : xxx ; Creation. -20-02-96 : FMN ; Suppression code inutile: -on ne garde que call_tox_open_display(). Les autres -point d'entree sont inutiles [cf OpenGl_txgl.c] -11-03-98 : CAL ; Suppression code inutile -12-03-02 ; GG ; RIC120302 Add call_tox_set_display - -************************************************************************/ - -#ifndef OPENGL_TGL_TOX_H -#define OPENGL_TGL_TOX_H - -#include - -extern DISPLAY *call_thedisplay; /* display pointer; defined in tgl/tox */ - -/*----------------------------------------------------------------------*/ -/* -* Prototypes fonctions externes -*/ - -extern Tint call_tox_open_display(void); -extern Tint call_tox_set_display(void*); -extern void call_tox_getscreen(Tint *, Tint *); /* w, h */ -extern void call_tox_rect(int,WINDOW,int,int) ; -extern Tfloat call_tox_getpitchsize(); - - -#endif diff --git a/src/OpenGl/OpenGl_tgl_util.cxx b/src/OpenGl/OpenGl_tgl_util.cxx deleted file mode 100755 index 6a517cf9e4..0000000000 --- a/src/OpenGl/OpenGl_tgl_util.cxx +++ /dev/null @@ -1,128 +0,0 @@ -/*********************************************************************** - -FONCTION : ----------- -file OpenGl_tgl_util : - - -REMARQUES: ----------- - - -HISTORIQUE DES MODIFICATIONS : --------------------------------- -xx-xx-xx : xxx ; Creation. -06-03-96 : FMN ; Suppression code inutile: -01-04-96 : CAL ; Integration MINSK portage WNT -29-04-96 : FMN ; Correction Warning. -30-01-97 : FMN ; Suppression call_util_init_indexes() - -************************************************************************/ - -/*----------------------------------------------------------------------*/ -/* -* Includes -*/ - - -#include - -#include -#include - -#include -#include - -#include -#include -#include -#include - -#include - -#ifdef WNT -#include -#include -#endif /* WNT */ - -/*----------------------------------------------------------------------*/ - -Tintlst inc_pick_filter; -Tintlst exc_pick_filter; -Tintlst inc_highl_filter; -Tintlst exc_highl_filter; -Tintlst inc_invis_filter; -Tintlst exc_invis_filter; - -/*----------------------------------------------------------------------*/ - -void -call_util_init_filters( Tint wsid ) -{ - Tint pick_inc_names[1] = { CALL_DEF_STRUCTPICKABLE }; - Tint highl_inc_names[1] = { CALL_DEF_STRUCTHIGHLIGHTED }; - Tint invis_inc_names[1] = { CALL_DEF_STRUCTNOVISIBLE }; - - Tint pick_excl_names[1] = { CALL_DEF_STRUCTNOPICKABLE }; - - inc_highl_filter.number = 1; - inc_highl_filter.integers = highl_inc_names; - exc_highl_filter.number = 0; - exc_highl_filter.integers = 0; - TglSetHighlFilter( wsid, 1, highl_inc_names, 0, 0 ); - - inc_pick_filter.number = 1; - inc_pick_filter.integers = pick_inc_names; - exc_pick_filter.number = 1; - exc_pick_filter.integers = pick_excl_names; - TglSetPickFilter( wsid, 1, pick_inc_names, 1, pick_excl_names ); - - inc_invis_filter.number = 1; - inc_invis_filter.integers = invis_inc_names; - exc_invis_filter.number = 0; - exc_invis_filter.integers = 0; - TglSetInvisFilter( wsid, 1, invis_inc_names, 0, 0 ); - - return; -} - -/*----------------------------------------------------------------------*/ - -Tint -call_util_test_structure( Tint stid ) -{ - TStatus stat; - Tint num; - tsm_node ptr; - - stat = TsmGetStructure( stid, &num, &ptr ); - if( stat == TSuccess ) - { - if( num ) - return 2; - return 1; - } - return 0; -} - -/*----------------------------------------------------------------------*/ - -/* -call_util_osd_getenv (symbol, value) -char *symbol, *value - -Gets an environment variable. -*/ - -EXPORT extern int call_util_osd_getenv ( char *symbol, - char *value, - int lval ) -{ - char *s; - - if ((s = getenv (symbol)) == NULL) return (0); - if ((int)strlen (s) > lval) return (0); - strcpy (value, s); - return (1); -} -/*----------------------------------------------------------------------*/ diff --git a/src/OpenGl/OpenGl_tgl_util.hxx b/src/OpenGl/OpenGl_tgl_util.hxx deleted file mode 100755 index 0062983d7c..0000000000 --- a/src/OpenGl/OpenGl_tgl_util.hxx +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef OPENGL_TGL_UTIL_H -#define OPENGL_TGL_UTIL_H -#include - - -extern void call_util_init_filters(Tint); /* ws */ -extern Tint call_util_test_structure(Tint); /* stid */ -EXPORT extern int call_util_osd_getenv (char *, char *, int); - -#endif diff --git a/src/OpenGl/OpenGl_tgl_utilgr.cxx b/src/OpenGl/OpenGl_tgl_utilgr.cxx deleted file mode 100755 index 4c7a3f13c0..0000000000 --- a/src/OpenGl/OpenGl_tgl_utilgr.cxx +++ /dev/null @@ -1,94 +0,0 @@ -/*********************************************************************** - -FONCTION : ----------- -file OpenGl_tgl_utilgr : - - -REMARQUES: ----------- - - -HISTORIQUE DES MODIFICATIONS : --------------------------------- -xx-xx-xx : xxx ; Creation. -29-04-96 : FMN ; Correction Warning. -30-01-97 : FMN ; Suppression call_util_init_indexes() -03-03-98 : CAL ; Modification des structures CALL_DEF_GROUP et STRUCTURE - -************************************************************************/ - -/*----------------------------------------------------------------------*/ -/* -* Includes -*/ - - -#include - -#include -#include -#include - -#include -#include - -#include -#include - -Tint -call_util_context_group_place( CALL_DEF_GROUP * agroup ) -{ - Tint n; - - n = 0; - if( agroup->ContextLine.IsSet ) - n = n + CALL_DEF_CONTEXTLINE_SIZE; - if( agroup->ContextFillArea.IsSet ) - n = n + CALL_DEF_CONTEXTFILLAREA_SIZE; - if( agroup->ContextMarker.IsSet ) - n = n + CALL_DEF_CONTEXTMARKER_SIZE; - if( agroup->ContextText.IsSet ) - n = n + CALL_DEF_CONTEXTTEXT_SIZE; - - return n; -} - - -Tint -call_util_osd_putenv( Tchar *symbol, Tchar *value ) -{ -#ifndef WNT - Tchar *s; - Tint l; - - l = strlen((char*)symbol) + strlen((char*)value) + 2; - s = new Tchar[l];; - if( s ) - { - sprintf( (char*)s,"%s=%s", symbol, value ); - if( !putenv((char*)s) ) - return 1; - } - return 0; -#else - return SetEnvironmentVariable ( (LPCSTR)symbol, (LPCSTR)value ); -#endif /* WNT */ -} - -Tint -call_util_rgbindex( Tfloat r, Tfloat g, Tfloat b ) -{ - union - { - Tint colpack; - unsigned char rgb[3]; - } rgb2ind; - - rgb2ind.colpack = 0; - rgb2ind.rgb[0] = ( unsigned char )(r*100); - rgb2ind.rgb[1] = ( unsigned char )(g*100); - rgb2ind.rgb[2] = ( unsigned char )(b*100); - - return rgb2ind.colpack; -} diff --git a/src/OpenGl/OpenGl_tgl_utilgr.hxx b/src/OpenGl/OpenGl_tgl_utilgr.hxx deleted file mode 100755 index 354fa71770..0000000000 --- a/src/OpenGl/OpenGl_tgl_utilgr.hxx +++ /dev/null @@ -1,28 +0,0 @@ -/*********************************************************************** - -FONCTION : ----------- -file OpenGl_tgl_utilgr.h : - - -REMARQUES: ----------- - - -HISTORIQUE DES MODIFICATIONS : --------------------------------- -xx-xx-xx : xxx ; Creation. -30-01-97 : FMN ; Suppression call_util_init_indexes() - -************************************************************************/ - -#ifndef OPENGL_TGL_UTILGR_H -#define OPENGL_TGL_UTILGR_H - -#include - -extern Tint call_util_context_group_place(CALL_DEF_GROUP *); /* agroup */ -extern Tint call_util_osd_putenv(Tchar *, Tchar *); /* symbol, value */ -extern Tint call_util_rgbindex(Tfloat, Tfloat, Tfloat); /* r, g, b */ - -#endif diff --git a/src/OpenGl/OpenGl_tgl_vis.hxx b/src/OpenGl/OpenGl_tgl_vis.hxx deleted file mode 100755 index 6e19715706..0000000000 --- a/src/OpenGl/OpenGl_tgl_vis.hxx +++ /dev/null @@ -1,43 +0,0 @@ -/*********************************************************************** - -FONCTION : ----------- -Include OpenGl_tgl_vis.h : - - -REMARQUES: ----------- - - -HISTORIQUE DES MODIFICATIONS : --------------------------------- -xx-xx-xx : xxx ; Creation. -11-03-96 : FMN ; Reference a InterfaceGraphic_Cextern.hxx -29-01-97 : FMN ; Suppression de call_togl_doublebuffer(). -05-02-97 : FMN ; Suppression de call_togl_minmaxvalues(). -et de call_togl_projection(). - -************************************************************************/ - -#ifndef OPENGL_TGL_VIS_H -#define OPENGL_TGL_VIS_H - -/*----------------------------------------------------------------------*/ -/* -* Includes -*/ - -#include - -#include - -/*----------------------------------------------------------------------*/ -/* -* Variables externes -*/ - -extern TEL_VIEW_REP call_viewrep; /* defined in call_togl_cliplimit.c */ - -/*----------------------------------------------------------------------*/ - -#endif diff --git a/src/OpenGl/OpenGl_tmesh.cxx b/src/OpenGl/OpenGl_tmesh.cxx deleted file mode 100755 index f6647809bc..0000000000 --- a/src/OpenGl/OpenGl_tmesh.cxx +++ /dev/null @@ -1,1357 +0,0 @@ -#define G003 -#define G004 -/*********************************************************************** - -FONCTION : ----------- -File OpenGl_tmesh : - - -REMARQUES: ----------- - -Le culling et le backfacing ne marchent pas. - - -HISTORIQUE DES MODIFICATIONS : --------------------------------- -xx-xx-xx : xxx ; Creation. -11-03-96 : FMN ; Correction warning compilation -01-04-96 : CAL ; Integration MINSK portage WNT -22-04-96 : FMN ; Suppression prototype inutile. -09-08-96 : FMN ; Suppression appel glMatrixMode() avant glGetFloatv() -21-10-96 : FMN ; Suppression LMC_COLOR fait dans OpenGl_execstruct.c -30-06-97 : FMN ; Suppression OpenGl_telem_light.h -18-07-97 : FMN ; Ajout desactivation des lights suivant front_lighting_model -21-07-97 : FMN ; Amelioration des performances OPTIMISATION_FMN -- suppression calcul inutile sur les front faces -- utilisation de GL_LINE_LOOP -27-08-97 : FMN ; Correction affichage des edges -On n'affiche que les edges dans le mode IS_EMPTY -10-09-97 : FMN ; Amelioration des perfs liees aux lights. -15-09-97 : PCT ; Ajout coordonnees textures -24-09-97 : FMN ; Suppression OPTIMISATION_FMN. -08-12-97 : FMN ; Suppression appel TsmGetAttri inutile. -23-12-97 : FMN ; Suppression IsBackFace() -31-12-97 : FMN ; Simplification pour le highlight -15-01-98 : FMN ; Ajout Hidden line -16-02-00 : EUG ; Degeneration support -16-02-00 : EUG ; Bitmap drawing support -08-03-01 : GG ; BUC60823 Avoid crash in the normal computation method -on confuse point. - -************************************************************************/ - -#define BUC60876 /* GG 5/4/2001 Disable local display list -// when animation is not required -*/ - -/*----------------------------------------------------------------------*/ - -#define OCC4298 // SAN : 12/11/2003 : Memory beyond array bound read in TriangleMeshAdd() -/* -* Includes -*/ - -#include - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/*----------------------------------------------------------------------*/ -/* -* Constantes -*/ - -/*----------------------------------------------------------------------*/ -/* -* Variables externes -*/ - -extern Tint ForbidSetTextureMapping; /* currently defined in tsm/tsm.c */ - -#ifdef G003 -# include -# define DEF_DS_INTERNAL -# include - -# ifdef G004 -extern GLboolean g_fBitmap; -# endif /* G004 */ - -extern int g_nDegenerateModel; -extern float g_fSkipRatio; -extern GLboolean g_fAnimation; - -#endif /* G003 */ - -/*----------------------------------------------------------------------*/ - -typedef struct -{ - Tint num_facets; /* Number of facets */ - Tint facet_flag; /* TEL_FA_NONE or TEL_FA_NORMAL */ - Tint vertex_flag;/* TEL_VT_NONE or TEL_VT_NORMAL */ - tel_point fnormals; /* length = num_facets */ - tel_colour fcolours; /* length = num_facets */ - tel_point vertices; /* length = num_facets + 2 */ - tel_colour vcolours; /* length = num_facets + 2 */ - tel_point vnormals; /* length = num_facets + 2 */ - tel_texture_coord vtexturecoord; /* Texture coordinates */ -#ifdef G003 - DS_INTERNAL d; -#endif /* G003 */ -} TEL_TMESH_DATA, *tel_tmesh_data; - -static TStatus TriangleMeshDisplay( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus TriangleMeshAdd( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus TriangleMeshDelete( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus TriangleMeshPrint( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus TriangleMeshInquire( TSM_ELEM_DATA, Tint, cmn_key* ); - -static void draw_tmesh( tel_tmesh_data, - Tint, /* highlight flag */ - Tint, /* front_lighting_model, */ - Tint, /* interior_style, */ - tel_colour /* edge_colour, */ - ); -#ifndef G003 -static void draw_edges( tel_tmesh_data, tel_colour, Tint); -#else -static void draw_edges ( tel_tmesh_data, tel_colour, Tint, Tint ); -void draw_degenerates_as_points ( PDS_INTERNAL, tel_point, Tint ); -void draw_degenerates_as_bboxs ( PDS_INTERNAL, tel_point, Tint ); -extern void set_drawable_items ( GLboolean*, int ); -#endif /* G003 */ - -static void draw_line_loop ( tel_tmesh_data ); - -static TStatus ( *MtdTbl[] )( TSM_ELEM_DATA, Tint, cmn_key* ) = { - - TriangleMeshDisplay, /* PickTraverse */ - TriangleMeshDisplay, - TriangleMeshAdd, - TriangleMeshDelete, - TriangleMeshPrint, - TriangleMeshInquire - -}; - -/*----------------------------------------------------------------------*/ - -MtblPtr TelTriangleMeshInitClass ( TelType* el ) { - - *el = TelTriangleMesh; - - return MtdTbl; - -} /* end TelTriangleMeshInitClass */ - -/*----------------------------------------------------------------------*/ -static TStatus -TriangleMeshAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k ) -/* expects keys -NUM_FACETS_ID -FNORMALS_ID -FACET_COLOUR_VALS_ID -VERTICES_ID -VERTEX_COLOUR_VALS_ID -VNORMALS_ID -VTEXTURECOORD_ID */ -{ - Tint i, j; - tel_tmesh_data data; - - for( i = 0; i < n; i++ ) - { - if( k[i]->id == NUM_FACETS_ID ) - break; - } - if( i == n ) - return TFailure; - - if( !(k[i]->data.ldata) ) - return TFailure; - - data = new TEL_TMESH_DATA(); - if( !data ) - return TFailure; - - data->num_facets = k[i]->data.ldata; - data->vtexturecoord = 0; - - for( i = 0; i < n; i++ ) - { - switch( k[i]->id ) - { - case FNORMALS_ID: - { - data->facet_flag = TEL_FA_NORMAL; - data->fnormals = new TEL_POINT[data->num_facets]; - memcpy( data->fnormals, k[i]->data.pdata, data->num_facets*sizeof(TEL_POINT) ); - for( j = 0; j < data->num_facets; j++ ) - vecnrm( data->fnormals[j].xyz ); - break; - } - case FACET_COLOUR_VALS_ID: - { - data->fcolours = new TEL_COLOUR[data->num_facets]; - memcpy( data->fcolours, - k[i]->data.pdata, - data->num_facets*sizeof(TEL_COLOUR) ); - break; - } - case VERTICES_ID: - { - data->vertices = new TEL_POINT[data->num_facets + 2]; - memcpy( data->vertices, k[i]->data.pdata, - (data->num_facets+2)*sizeof(TEL_POINT) ); - break; - } - case VERTEX_COLOUR_VALS_ID: - { - data->vcolours = new TEL_COLOUR[data->num_facets]; - memcpy( data->vcolours, k[i]->data.pdata, - (data->num_facets+2)*sizeof(TEL_COLOUR) ); - - break; - } - case VNORMALS_ID: - { - data->vertex_flag = TEL_VT_NORMAL; - data->vnormals = new TEL_POINT[data->num_facets + 2]; - memcpy( data->vnormals, k[i]->data.pdata, - (data->num_facets + 2)*sizeof(TEL_POINT) ); - for( j = 0; j < (data->num_facets+2); j++ ) - vecnrm( data->vnormals[j].xyz ); - break; - } - case VTEXTURECOORD_ID: - { - data->vtexturecoord = new TEL_TEXTURE_COORD[data->num_facets + 2]; - memcpy( data->vtexturecoord, - k[i]->data.pdata, - (data->num_facets + 2)*sizeof(TEL_TEXTURE_COORD) ); - break; - } - - default: - { - break; - } - } - } - - if( data->facet_flag != TEL_FA_NORMAL ) - { - /* calculate the normals and store */ - - data->fnormals = new TEL_POINT[data->num_facets]; - for( i = 0; i < data->num_facets; i++ ) { - if( i & 1 ) { - TelGetNormal( data->vertices[i].xyz, data->vertices[i+2].xyz, - data->vertices[i+1].xyz, data->fnormals[i].xyz ); - } else { - TelGetNormal( data->vertices[i].xyz, data->vertices[i+1].xyz, - data->vertices[i+2].xyz, data->fnormals[i].xyz ); - } - } -#ifndef BUC60823 - for( j = 0; j < data->num_facets; j++ ) - vecnrm( data->fnormals[j].xyz ); -#endif - } - if( data->vertex_flag != TEL_VT_NORMAL ) - { - /* calculate the vertex normals */ - data->vnormals = new TEL_POINT[data->num_facets + 2]; - for( i = 2; i < data->num_facets; i++ ) - { - data->vnormals[i].xyz[0] = ( data->fnormals[i-2].xyz[0] + - data->fnormals[i-1].xyz[0] + - data->fnormals[ i ].xyz[0] ) / ( float )3.0; - data->vnormals[i].xyz[1] = ( data->fnormals[i-2].xyz[1] + - data->fnormals[i-1].xyz[1] + - data->fnormals[ i ].xyz[1] ) / ( float )3.0; - data->vnormals[i].xyz[2] = ( data->fnormals[i-2].xyz[2] + - data->fnormals[i-1].xyz[2] + - data->fnormals[ i ].xyz[2] ) / ( float )3.0; - } - data->vnormals[0] = data->fnormals[0]; -#ifdef OCC4298 - if( data->num_facets > 1 ) - { -#endif - data->vnormals[1].xyz[0] = ( data->fnormals[0].xyz[0] + - data->fnormals[1].xyz[0] )/( float )2.0; - data->vnormals[1].xyz[1] = ( data->fnormals[0].xyz[1] + - data->fnormals[1].xyz[1] )/( float )2.0; - data->vnormals[1].xyz[2] = ( data->fnormals[0].xyz[2] + - data->fnormals[1].xyz[2] )/( float )2.0; -#ifdef OCC4298 - } - else - data->vnormals[1] = data->fnormals[0]; -#endif - /* last vertex */ - data->vnormals[data->num_facets+1] = data->fnormals[data->num_facets-1]; - - /* second last vertex */ -#ifdef OCC4298 - if( data->num_facets > 1 ) - { -#endif - data->vnormals[data->num_facets].xyz[0] = - ( data->fnormals[data->num_facets-1].xyz[0] + - data->fnormals[data->num_facets-2].xyz[0] ) / ( float )2.0; - data->vnormals[data->num_facets].xyz[1] = - ( data->fnormals[data->num_facets-1].xyz[1] + - data->fnormals[data->num_facets-2].xyz[1] ) / ( float )2.0; - data->vnormals[data->num_facets].xyz[2] = - ( data->fnormals[data->num_facets-1].xyz[2] + - data->fnormals[data->num_facets-2].xyz[2] ) / ( float )2.0; -#ifdef OCC4298 - } -#endif - } -#ifdef G003 - data -> d.list = 0; - data -> d.dlist = 0; - data -> d.degMode = 0; - data -> d.model = -1; - data -> d.skipRatio = 0.0F; - data->d.bDraw = new unsigned char[data->num_facets + 2]; -#endif /* G003 */ - ((tsm_elem_data)(d.pdata))->pdata = data; - - return TSuccess; -} -/*----------------------------------------------------------------------*/ - -static TStatus -TriangleMeshDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - CMN_KEY k11, k12, k17, k111, k114; - - Tint front_lighting_model; - Tint interior_style; - TEL_COLOUR interior_colour; - TEL_COLOUR edge_colour; - - tel_tmesh_data d; - - k12.id = TelInteriorReflectanceEquation; - k17.id = TelInteriorStyle; - k111.id = TelInteriorColour; - k111.data.pdata = &interior_colour; - k114.id = TelEdgeColour; - k114.data.pdata = &edge_colour; - - TsmGetAttri( 4, &k12, &k17, &k111, &k114); - - front_lighting_model = k12.data.ldata; - interior_style = k17.data.ldata; - -#ifdef PRINT - printf("TriangleMeshDisplay \n"); -#endif - - /* - * Use highlight colours - */ - if( k[0]->id == TOn ) - { - TEL_HIGHLIGHT hrep; - - k11.id = TelHighlightIndex; - TsmGetAttri( 1, &k11 ); - if( TelGetHighlightRep( TglActiveWs, k11.data.ldata, &hrep ) == TSuccess ) - { - if( hrep.type == TelHLForcedColour ) - { - edge_colour = interior_colour = hrep.col; - front_lighting_model = CALL_PHIGS_REFL_NONE; - } - else if( hrep.type == TelHLColour ) - { - edge_colour = hrep.col; - k[0]->id = TOff; - } - } - else - { - TelGetHighlightRep( TglActiveWs, 0, &hrep ); - if( hrep.type == TelHLForcedColour ) - { - edge_colour = interior_colour = hrep.col; - front_lighting_model = CALL_PHIGS_REFL_NONE; - } - else if( hrep.type == TelHLColour ) - { - edge_colour = hrep.col; - k[0]->id = TOff; - } - } - } - - d = (tel_tmesh_data)data.pdata; - - glColor3fv( interior_colour.rgb ); - - draw_tmesh( d, k[0]->id, - front_lighting_model, - interior_style, - &edge_colour); - - return TSuccess; - -} - -/*----------------------------------------------------------------------*/ - -static void draw_tmesh ( - tel_tmesh_data p, - Tint hflag, - Tint front_lighting_model, - Tint interior_style, - tel_colour edge_colour - ) -{ - - Tint i, newList = 0; - tel_point pv, pfn, pvn; - tel_colour pfc, pvc; - tel_texture_coord pvt; - - pfn = p -> fnormals; - pfc = p -> fcolours; - pv = p -> vertices; - pvc = p -> vcolours; - pvn = p -> vnormals; - pvt = p -> vtexturecoord; - - if ( hflag ) pvc = pfc = 0; -#ifdef G003 - if ( g_nDegenerateModel < 2 && interior_style != TSM_EMPTY ) { -#else - if( interior_style != TSM_EMPTY ) { -#endif /* G003 */ - if ( front_lighting_model == CALL_PHIGS_REFL_NONE ) - - LightOff (); - - else LightOn (); -#ifdef G003 -#ifdef BUC60876 - if ( !g_fAnimation ) - goto doDraw; /* Disable object display list out of animation */ -#endif -# ifdef G004 - if ( g_fBitmap ) goto doDraw; /* display lists are NOT shared between */ - /* window's context and bitmap's one */ -# endif /* G004 */ - if ( p -> d.model != front_lighting_model || !p -> d.list || - p -> d.model == -1 || - ( g_nDegenerateModel && p -> d.skipRatio != g_fSkipRatio ) - ) { - - p -> d.skipRatio = g_fSkipRatio; - p -> d.model = front_lighting_model; - p -> d.degMode = g_nDegenerateModel; - - if ( g_fSkipRatio == 0.0 ) { - - if ( !p -> d.list ) p -> d.list = glGenLists ( 1 ); - - glNewList ( p -> d.list, GL_COMPILE_AND_EXECUTE ); - newList = 1; -#endif /* G003 */ -#ifdef G004 -doDraw: -#endif /* G004 */ - glBegin ( GL_TRIANGLE_STRIP ); - - if ( front_lighting_model == CALL_PHIGS_REFL_NONE ) { - - if ( pvc ) - - for ( i = 0; i < p -> num_facets + 2; ++i ) { - - glColor3fv ( pvc[ i ].rgb ); - glVertex3fv ( pv [ i ].xyz ); - - } /* end for */ - - else if ( pfc ) { - - glColor3fv ( pfc[ 0 ].rgb ); - glVertex3fv ( pv [ 0 ].xyz ); - glVertex3fv ( pv [ 1 ].xyz ); - - for ( i = 2; i < p -> num_facets + 2; ++i ) { - - glColor3fv ( pfc[ i - 2 ].rgb ); - glVertex3fv( pv [ i ].xyz ); - - } /* end for */ - - } else for ( i = 0; i < p -> num_facets + 2; ++i ) glVertex3fv ( pv[ i ].xyz ); - - } else { /* front_lighting_model != TelLModelNone */ - - if ( pvt && !ForbidSetTextureMapping ) - - for ( i = 0; i < p -> num_facets + 2; ++i ) { - - glNormal3fv ( pvn[ i ].xyz ); - glTexCoord2fv ( pvt[ i ].xy ); - glVertex3fv ( pv [ i ].xyz ); - - } /* end for */ - - else for ( i = 0; i < p -> num_facets + 2; ++i ) { - - glNormal3fv( pvn[ i ].xyz ); - glVertex3fv( pv[ i ].xyz ); - - } /* end for */ - - } /* end else */ - - glEnd (); -#ifdef G003 - } else if ( g_fSkipRatio != 1.0 ) { - - set_drawable_items ( p -> d.bDraw, p -> num_facets + 2 ); - - if ( !p -> d.dlist ) p -> d.dlist = glGenLists ( 1 ); - - glNewList ( p -> d.dlist, GL_COMPILE_AND_EXECUTE ); - newList = 1; - - glBegin ( GL_TRIANGLES ); - - if ( front_lighting_model == CALL_PHIGS_REFL_NONE ) { - - if ( pvc ) { - - for ( i = 0; i < p -> num_facets; ++i ) { - - if ( p -> d.bDraw[ i ] ) { - - if ( i % 2 ) { - - glColor3fv ( pvc[ i ].rgb ); - glVertex3fv ( pv [ i ].xyz ); - glColor3fv ( pvc[ i + 2 ].rgb ); - glVertex3fv ( pv [ i + 2 ].xyz ); - glColor3fv ( pvc[ i + 1 ].rgb ); - glVertex3fv ( pv [ i + 1 ].xyz ); - - } else { - - glColor3fv ( pvc[ i + 2 ].rgb ); - glVertex3fv ( pv [ i + 2 ].xyz ); - glColor3fv ( pvc[ i ].rgb ); - glVertex3fv ( pv [ i ].xyz ); - glColor3fv ( pvc[ i + 1 ].rgb ); - glVertex3fv ( pv [ i + 1 ].xyz ); - - } /* end else */ - } /* if */ - } /* for */ - - } else if ( pfc ) { - - for ( i = 0; i < p -> num_facets; ++i ) { - - if ( p -> d.bDraw[ i ] ) { - - if ( i % 2 ) { - - glColor3fv ( pfc[ i ].rgb ); - glVertex3fv( pv [ i ].xyz ); - glColor3fv ( pfc[ i + 2 ].rgb ); - glVertex3fv( pv [ i + 2 ].xyz ); - glColor3fv ( pfc[ i + 1 ].rgb ); - glVertex3fv( pv [ i + 1 ].xyz ); - - } else { - - glColor3fv ( pfc[ i + 2 ].rgb ); - glVertex3fv( pv [ i + 2 ].xyz ); - glColor3fv ( pfc[ i ].rgb ); - glVertex3fv( pv [ i ].xyz ); - glColor3fv ( pfc[ i + 1 ].rgb ); - glVertex3fv( pv [ i + 1 ].xyz ); - - } /* end else */ - } /* if */ - } /* for */ - - } else { - for ( i = 0; i < p -> num_facets; ++i ) { - - if ( p -> d.bDraw[ i ] ) { - - if ( i % 2 ) { - - glVertex3fv ( pv[ i ].xyz ); - glVertex3fv ( pv[ i + 2 ].xyz ); - glVertex3fv ( pv[ i + 1 ].xyz ); - - } else { - - glVertex3fv ( pv[ i + 2 ].xyz ); - glVertex3fv ( pv[ i ].xyz ); - glVertex3fv ( pv[ i + 1 ].xyz ); - - } /* end else */ - } /* if */ - } /* for */ - } - - } else { /* front_lighting_model != TelLModelNone */ - - if ( pvt && !ForbidSetTextureMapping ) { - - for ( i = 0; i < p -> num_facets; ++i ) { - - if ( p -> d.bDraw[ i ] ) { - - if ( i % 2 ) { - - glNormal3fv ( pvn[ i ].xyz ); - glTexCoord2fv ( pvt[ i ].xy ); - glVertex3fv ( pv [ i ].xyz ); - glNormal3fv ( pvn[ i + 2 ].xyz ); - glTexCoord2fv ( pvt[ i + 2 ].xy ); - glVertex3fv ( pv [ i + 2 ].xyz ); - glNormal3fv ( pvn[ i + 1 ].xyz ); - glTexCoord2fv ( pvt[ i + 1 ].xy ); - glVertex3fv ( pv [ i + 1 ].xyz ); - - } else { - - glNormal3fv ( pvn[ i + 2 ].xyz ); - glTexCoord2fv ( pvt[ i + 2 ].xy ); - glVertex3fv ( pv [ i + 2 ].xyz ); - glNormal3fv ( pvn[ i ].xyz ); - glTexCoord2fv ( pvt[ i ].xy ); - glVertex3fv ( pv [ i ].xyz ); - glNormal3fv ( pvn[ i + 1 ].xyz ); - glTexCoord2fv ( pvt[ i + 1 ].xy ); - glVertex3fv ( pv [ i + 1 ].xyz ); - - } /* end else */ - } /* if */ - } /* end for */ - - } else { - for ( i = 0; i < p -> num_facets; ++i ) { - - if ( p -> d.bDraw[ i ] ) { - - if ( i % 2 ) { - - glNormal3fv( pvn[ i ].xyz ); - glVertex3fv( pv[ i ].xyz ); - glNormal3fv( pvn[ i + 2 ].xyz ); - glVertex3fv( pv[ i + 2 ].xyz ); - glNormal3fv( pvn[ i + 1 ].xyz ); - glVertex3fv( pv[ i + 1 ].xyz ); - - } else { - - glNormal3fv( pvn[ i + 2 ].xyz ); - glVertex3fv( pv[ i + 2 ].xyz ); - glNormal3fv( pvn[ i ].xyz ); - glVertex3fv( pv[ i ].xyz ); - glNormal3fv( pvn[ i + 1 ].xyz ); - glVertex3fv( pv[ i + 1 ].xyz ); - - } /* end else */ - - } /* if */ - } /* for */ - } /* end else */ - } /* end else front_lighting_model != TelLModelNone */ - - glEnd (); - - } else { - - if ( !p -> d.dlist ) p -> d.dlist = glGenLists ( 1 ); - - glNewList ( p -> d.dlist, GL_COMPILE_AND_EXECUTE ); - newList = 1; - - } /* end else */ - if ( newList ) glEndList (); - - if ( g_nDegenerateModel ) return; - - } else { - - glCallList ( g_fSkipRatio == 0.0 ? p -> d.list : p -> d.dlist ); - - if ( g_nDegenerateModel ) return; - - } /* end else */ -#endif /* G003 */ - } /* end if ( interior_style != TSM_EMPTY ) */ -#ifdef G003 - i = 0; - - /* OCC11904 -- Temporarily disable environment mapping */ - glPushAttrib(GL_ENABLE_BIT); - glDisable(GL_TEXTURE_1D); - glDisable(GL_TEXTURE_2D); - - switch ( g_nDegenerateModel ) { - - default: - break; - - case 2: /* XXX_TDM_WIREFRAME */ - i = 1; - break; - - case 3: /* XXX_TDM_MARKER */ - draw_degenerates_as_points ( &p -> d, p -> vertices, p -> num_facets + 2 ); - glPopAttrib(); - return; - - case 4: /* XXX_TDM_BBOX */ - draw_degenerates_as_bboxs ( &p -> d, p -> vertices, p -> num_facets + 2 ); - glPopAttrib(); - return; - - } /* end switch */ - - draw_edges ( p, edge_colour, interior_style, i ); -#else - draw_edges ( p, edge_colour, interior_style ); -#endif /* G003 */ - - glPopAttrib(); -} /* end draw_tmesh */ - -/*----------------------------------------------------------------------*/ -static TStatus -TriangleMeshDelete( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - tel_tmesh_data p; - - p = (tel_tmesh_data)data.pdata; - if( p->fnormals ) - delete[] p->fnormals; - if( p->fcolours ) - delete[] p->fcolours; - if( p->vertices ) - delete[] p->vertices; - if( p->vcolours ) - delete[] p->vcolours; - if( p->vnormals ) - delete[] p->vnormals; - if (p->vtexturecoord) - delete[] p->vtexturecoord; -#ifdef G003 - if ( GET_GL_CONTEXT() != NULL ) { - - if ( p -> d.list ) glDeleteLists ( p -> d.list, 1 ); - if ( p -> d.dlist ) glDeleteLists ( p -> d.dlist, 1 ); - - } /* end if */ - - if ( p -> d.bDraw ) - delete[] p->d.bDraw; -#endif /* G003 */ - if (data.pdata) - delete data.pdata; - return TSuccess; -} - -/*----------------------------------------------------------------------*/ -static TStatus -TriangleMeshPrint( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - Tint i; - tel_tmesh_data p; - - p = (tel_tmesh_data)data.pdata; - - fprintf(stdout, "TelTriangleMesh. Number of Facets : %d\n", p->num_facets); - switch( p->facet_flag ) - { - case TEL_FA_NONE: - if( p->fcolours ) - fprintf( stdout, "\t\tFacet Flag : COLOUR\n" ); - else - fprintf( stdout, "\t\tFacet Flag : NONE\n" ); - break; - - case TEL_FA_NORMAL: - if( p->fcolours ) - fprintf( stdout, "\t\tFacet Flag : COLOURNORMAL\n" ); - else - fprintf( stdout, "\t\tFacet Flag : NORMAL\n" ); - break; - } - - switch( p->vertex_flag ) - { - case TEL_VT_NONE: - if( p->vcolours ) - fprintf( stdout, "\t\tVertex Flag : COLOUR\n" ); - else - fprintf( stdout, "\t\tVertex Flag : NONE\n" ); - break; - - case TEL_VT_NORMAL: - if( p->vcolours ) - fprintf( stdout, "\t\tVertex Flag : COLOURNORMAL\n" ); - else - fprintf( stdout, "\t\tVertex Flag : NORMAL\n" ); - break; - } - if( p->fnormals ) - { - fprintf( stdout, "\n\t\tFacet Normals : " ); - for( i = 0; i < p->num_facets; i++ ) - fprintf( stdout, "\n\t\t v[%d] = %g %g %g", i, - p->fnormals[i].xyz[0], - p->fnormals[i].xyz[1], - p->fnormals[i].xyz[2] ); - } - else - fprintf( stdout, "\n\t\tFacet Normals not specified\n" ); - - if( p->fcolours ) - { - fprintf( stdout, "\n\t\tFacet Colours : " ); - for( i = 0; i < p->num_facets; i++ ) - fprintf( stdout, "\n\t\t v[%d] = %g %g %g", i, - p->fcolours[i].rgb[0], - p->fcolours[i].rgb[1], - p->fcolours[i].rgb[2] ); } - else - fprintf( stdout, "\n\t\tFacet Colours not specified\n" ); - if( p->vertices ) - { - fprintf( stdout, "\n\t\tVertices : " ); - for( i = 0; i < p->num_facets+2; i++ ) - fprintf( stdout, "\n\t\t v[%d] = %g %g %g", i, - p->vertices[i].xyz[0], - p->vertices[i].xyz[1], - p->vertices[i].xyz[2] ); } - - fprintf( stdout, "\n" ); - if( p->vcolours ) - { - fprintf( stdout, "\n\t\tVertex Colours : " ); - for( i = 0; i < p->num_facets+2; i++ ) - fprintf( stdout, "\n\t\t v[%d] = %g %g %g", i, - p->vcolours[i].rgb[0], - p->vcolours[i].rgb[1], - p->vcolours[i].rgb[2] ); } - else - fprintf( stdout, "\n\t\tVertex Colours not specified\n" ); - - if( p->vnormals ) - { - fprintf( stdout, "\n\t\tVertex Normals : " ); - for( i = 0; i < p->num_facets+2; i++ ) - fprintf( stdout, "\n\t\t v[%d] = %g %g %g", i, - p->vnormals[i].xyz[0], - p->vnormals[i].xyz[1], - p->vnormals[i].xyz[2] ); } - else - fprintf( stdout, "\n\t\tVertex Normals not specified\n" ); - - if (p->vtexturecoord) - { - fprintf(stdout, "\n\t\tTexture Coordinates : "); - for (i=0; inum_facets+2; i++) - fprintf(stdout, "\n\t\t v[%d] = %g %g", i, - p->vtexturecoord[i].xy[0], - p->vtexturecoord[i].xy[1]); - } - else - fprintf( stdout, "\n\t\tTexture Coordinates not specified\n"); - - fprintf( stdout, "\n" ); - - return TSuccess; -} - -/*----------------------------------------------------------------------*/ -#ifndef G003 -static void draw_edges ( tel_tmesh_data p, tel_colour edge_colour, Tint interior_style ) -{ -#else -static void draw_edges ( - tel_tmesh_data p, - tel_colour edge_colour, - Tint interior_style, - Tint forceDraw - ) -{ -#endif /* G003 */ - CMN_KEY k, k1, k2, k3, k4; - Tint i, edge_type, line_type_preserve, newList = 0; - Tfloat edge_width, line_width_preserve; - GLboolean texture_on; - tel_point pv; -#ifdef G003 - if ( interior_style != TSM_HIDDENLINE && !forceDraw ) { -#else - if ( interior_style != TSM_HIDDENLINE ) { -#endif /* G003 */ - - k.id = TelEdgeFlag; - TsmGetAttri ( 1, &k ); - - if ( k.data.ldata == TOff ) return; - - } /* end if */ - - pv = p -> vertices; - - LightOff (); - texture_on = IsTextureEnabled (); - if ( texture_on ) DisableTexture (); - - k1.id = TelPolylineWidth; - k2.id = TelPolylineType; - k3.id = TelEdgeType; - k4.id = TelEdgeWidth; - TsmGetAttri ( 4, &k1, &k2, &k3, &k4 ); - - line_width_preserve = k1.data.fdata; - line_type_preserve = k2.data.ldata; - edge_type = k3.data.ldata; - edge_width = k4.data.fdata; - - if ( line_width_preserve != edge_width ) { - - k.id = TelPolylineWidth; - k.data.fdata = edge_width; - TsmSetAttri ( 1, &k ); - - } /* end if */ - - if ( line_type_preserve != edge_type ) { - - k.id = TelPolylineType; - k.data.ldata = edge_type; - TsmSetAttri ( 1, &k ); - - } /* end if */ - - glColor3fv ( edge_colour -> rgb ); -#ifdef G003 - if ( !forceDraw ) -#endif /* G003 */ - draw_line_loop ( p ); -#ifdef G003 - else { -#ifdef BUC60876 - if ( !g_fAnimation ) - goto doDraw; /* Disable object display list out of animation */ -#endif -# ifdef G004 - if ( g_fBitmap ) - goto doDraw; -# endif /* G004 */ - if ( p -> d.degMode != 2 || p -> d.skipRatio != g_fSkipRatio || !p -> d.dlist ) { - - if ( !p -> d.dlist ) p -> d.dlist = glGenLists ( 1 ); - - p -> d.degMode = 2; - p -> d.skipRatio = g_fSkipRatio; - glNewList ( p -> d.dlist, GL_COMPILE_AND_EXECUTE ); - newList = 1; -doDraw: - glPushAttrib ( GL_DEPTH_BUFFER_BIT ); - glDisable ( GL_DEPTH_TEST ); - - if ( g_fSkipRatio == 0.0 ) - - draw_line_loop ( p ); - - else if ( g_fSkipRatio != 1.0 ) { - - set_drawable_items ( p -> d.bDraw, p -> num_facets + 2 ); - - for ( i = 0; i < p -> num_facets; ++i ) - - if ( p -> d.bDraw[ i ] ) { - - glBegin ( GL_LINE_LOOP ); - glVertex3fv ( pv[ i ].xyz ); - glVertex3fv ( pv[ i + 1 ].xyz ); - glVertex3fv ( pv[ i + 2 ].xyz ); - glEnd(); - - } /* end if */ - - } /* end if */ - - glPopAttrib (); - if ( newList ) glEndList (); - - } else glCallList ( p -> d.dlist ); - - } /* end else */ -#endif /* G003 */ - if ( line_width_preserve != edge_width ) { - - k.id = TelPolylineWidth; - k.data.fdata = line_width_preserve; - TsmSetAttri ( 1, &k ); - - } /* end if */ - - if ( line_type_preserve != edge_type ) { - - k.id = TelPolylineType; - k.data.ldata = line_type_preserve; - TsmSetAttri ( 1, &k ); - - } /* end if */ - - if ( texture_on ) EnableTexture (); - -} /* end draw_edges */ -#ifdef G003 -void draw_degenerates_as_points ( PDS_INTERNAL pd, tel_point p, Tint n ) { - - int i, newList = 0; - - LightOff (); -#ifdef BUC60876 - if ( !g_fAnimation ) - goto doDraw; /* Disable object display list out of animation */ -#endif -#ifdef G004 - if ( g_fBitmap ) - goto doDraw; -#endif /* G004 */ - if ( pd -> degMode != 3 || pd -> skipRatio != g_fSkipRatio || !pd -> dlist ) { - - if ( !pd -> dlist ) pd -> dlist = glGenLists ( 1 ); - - pd -> degMode = 3; - pd -> skipRatio = g_fSkipRatio; - glNewList ( pd -> dlist, GL_COMPILE_AND_EXECUTE ); - newList = 1; - - if ( g_fSkipRatio == 0.0 ) { -#ifdef G004 -doDraw: -#endif /* G004 */ - glBegin ( GL_POINTS ); - - for ( i = 0; i < n; ++i ) glVertex3fv ( p[ i ].xyz ); - - glEnd (); - - } else if ( g_fSkipRatio != 1.0 ) { - - set_drawable_items ( pd -> bDraw, n ); - - glBegin ( GL_POINTS ); - - for ( i = 0; i < n; ++i ) - - if ( pd -> bDraw[ i ] ) glVertex3fv ( p[ i ].xyz ); - - glEnd (); - - } /* end if */ - if ( newList ) glEndList (); - - } else glCallList ( pd -> dlist ); - -} /* end draw_degenerates_as_points */ - -void draw_degenerates_as_bboxs ( PDS_INTERNAL pd, tel_point p, Tint n ) { - - int i, newList = 0; - GLfloat minp[ 3 ] = { FLT_MAX, FLT_MAX, FLT_MAX }; - GLfloat maxp[ 3 ] = { FLT_MIN, FLT_MIN, FLT_MIN }; - - LightOff (); -#ifdef BUC60876 - if ( !g_fAnimation ) - goto doDraw; /* Disable object display list out of animation */ -#endif -#ifdef G004 - if ( g_fBitmap ) - goto doDraw; -#endif /* G004 */ - if ( pd -> degMode != 4 || !pd -> dlist ) { - - if ( !pd -> dlist ) pd -> dlist = glGenLists ( 1 ); - - pd -> degMode = 4; - - glNewList ( pd -> dlist, GL_COMPILE_AND_EXECUTE ); - newList = 1; -#ifdef G004 -doDraw: -#endif /* G004 */ - for ( i = 0; i < n; ++i ) { - - TEL_POINT pt = p[ i ]; - - if ( pt.xyz[ 0 ] < minp[ 0 ] ) - minp[ 0 ] = pt.xyz[ 0 ] ; - if ( pt.xyz[ 1 ] < minp[ 1 ] ) - minp[ 1 ] = pt.xyz[ 1 ] ; - if ( pt.xyz[ 2 ] < minp[ 2 ] ) - minp[ 2 ] = pt.xyz[ 2 ] ; - - if ( pt.xyz[ 0 ] > maxp[ 0 ] ) - maxp[ 0 ] = pt.xyz[ 0 ] ; - if ( pt.xyz[ 1 ] > maxp[ 1 ] ) - maxp[ 1 ] = pt.xyz[ 1 ] ; - if ( pt.xyz[ 2 ] > maxp[ 2 ] ) - maxp[ 2 ] = pt.xyz[ 2 ] ; - - } /* end for */ - - glBegin ( GL_LINE_STRIP ); - - glVertex3fv ( minp ); - glVertex3f ( minp[ 0 ], maxp[ 1 ], minp[ 2 ] ); - glVertex3f ( minp[ 0 ], maxp[ 1 ], maxp[ 2 ] ); - glVertex3f ( minp[ 0 ], minp[ 1 ], maxp[ 2 ] ); - glVertex3f ( minp[ 0 ], minp[ 1 ], minp[ 2 ] ); - - glVertex3f ( maxp[ 0 ], minp[ 1 ], minp[ 2 ] ); - glVertex3f ( maxp[ 0 ], maxp[ 1 ], minp[ 2 ] ); - glVertex3f ( maxp[ 0 ], maxp[ 1 ], maxp[ 2 ] ); - glVertex3f ( maxp[ 0 ], minp[ 1 ], maxp[ 2 ] ); - glVertex3f ( maxp[ 0 ], minp[ 1 ], minp[ 2 ] ); - - glVertex3f ( maxp[ 0 ], minp[ 1 ], maxp[ 2 ] ); - glVertex3f ( minp[ 0 ], minp[ 1 ], maxp[ 2 ] ); - glVertex3f ( minp[ 0 ], maxp[ 1 ], maxp[ 2 ] ); - glVertex3fv ( maxp ); - glVertex3f ( maxp[ 0 ], maxp[ 1 ], minp[ 2 ] ); - glVertex3f ( minp[ 0 ], maxp[ 1 ], minp[ 2 ] ); - - glEnd(); - if ( newList ) glEndList (); - - } else glCallList ( pd -> dlist ); - -} /* end draw_degenerates_as_bboxs */ -#endif /* G003 */ - -static void draw_line_loop ( tel_tmesh_data p ) { - - int i; - - for ( i = 0; i < p -> num_facets; ++i ) { - - glBegin ( GL_LINE_LOOP ); - glVertex3fv ( p -> vertices[ i ].xyz ); - glVertex3fv ( p -> vertices[ i + 1 ].xyz ); - glVertex3fv ( p -> vertices[ i + 2 ].xyz ); - glEnd(); - - } /* end for */ - -} /* end draw_line_loop */ - -/*----------------------------------------------------------------------*/ -static TStatus -TriangleMeshInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - Tint i, j; - tel_tmesh_data d; - Tint size_reqd=0; - TStatus status = TSuccess; - Tchar *cur_ptr = 0; - - d = (tel_tmesh_data)data.pdata; - - if( d->fcolours ) - size_reqd += ( d->num_facets * sizeof( TEL_COLOUR ) ); - - if( d->facet_flag == TEL_FA_NORMAL ) - size_reqd += ( d->num_facets * sizeof( TEL_POINT ) ); - - size_reqd += ( (d->num_facets+2) * sizeof( TEL_POINT ) ); - - if( d->vcolours ) - size_reqd += ( (d->num_facets+2) * sizeof( TEL_COLOUR ) ); - - if( d->vertex_flag == TEL_VT_NORMAL ) - size_reqd += ( (d->num_facets+2) * sizeof( TEL_POINT ) ); - - for( i = 0; i < n; i++ ) - { - switch( k[i]->id ) - { - case INQ_GET_SIZE_ID: - { - k[i]->data.ldata = size_reqd; - break; - } - - case INQ_GET_CONTENT_ID: - { - TEL_INQ_CONTENT *c; - Teldata *w; - - c = (TEL_INQ_CONTENT*)k[i]->data.pdata; - c->act_size = size_reqd; - w = c->data; - - cur_ptr = c->buf; - w->trianglestrip3data.num_facets = d->num_facets; - - if( c->size >= size_reqd ) - { - if( d->facet_flag == TEL_FA_NORMAL ) - { - if( d->fcolours ) - { - w->trianglestrip3data.fctflag = TEL_FAFLAG_COLOURNORMAL; - w->trianglestrip3data.gnormals = (tel_point)(c->buf); - for( j = 0; j < d->num_facets; j++ ) - { - w->trianglestrip3data.gnormals[j] = d->fnormals[j]; - } - cur_ptr += ( d->num_facets * sizeof( TEL_POINT ) ); - - w->trianglestrip3data.facet_colour_vals = - (tel_colour)(cur_ptr); - for( j = 0; j < d->num_facets; j++ ) - { - w->trianglestrip3data.facet_colour_vals[j] = - d->fcolours[j]; - } - cur_ptr += ( d->num_facets * sizeof( TEL_COLOUR ) ); - } - else - { - w->trianglestrip3data.fctflag = TEL_FAFLAG_NORMAL; - w->trianglestrip3data.facet_colour_vals = 0; - w->trianglestrip3data.gnormals = (tel_point)(c->buf); - for( j = 0; j < d->num_facets; j++ ) - { - w->trianglestrip3data.gnormals[j] = d->fnormals[j]; - } - cur_ptr += ( d->num_facets * sizeof( TEL_POINT ) ); - } - } - else - { - w->trianglestrip3data.gnormals = 0; - if( d->fcolours ) - { - w->trianglestrip3data.fctflag = TEL_FAFLAG_COLOUR; - w->trianglestrip3data.facet_colour_vals = - (tel_colour)(c->buf ); - for( j = 0; j < d->num_facets; j++ ) - { - w->trianglestrip3data.facet_colour_vals[j] = - d->fcolours[j]; - } - cur_ptr += ( d->num_facets * sizeof( TEL_COLOUR ) ); - } - else - { - w->trianglestrip3data.fctflag = TEL_FAFLAG_NONE; - w->trianglestrip3data.facet_colour_vals = 0; - } - } - - w->trianglestrip3data.points = (tel_point)cur_ptr; - for( j = 0; j < (d->num_facets+2); j++ ) - { - w->trianglestrip3data.points[j] = d->vertices[j]; - } - cur_ptr += ( (d->num_facets+2) * sizeof( TEL_POINT ) ); - - if( d->vertex_flag == TEL_VT_NORMAL ) - { - if( d->vcolours ) - { - w->trianglestrip3data.vrtflag = TEL_VTFLAG_COLOURNORMAL; - w->trianglestrip3data.vnormals = (tel_point)(cur_ptr); - for( j = 0; j < (d->num_facets+2); j++ ) - { - w->trianglestrip3data.vnormals[j] = d->vnormals[i]; - } - cur_ptr += ( (d->num_facets+2) * sizeof( TEL_POINT ) ); - - w->trianglestrip3data.colours = (tel_colour)(cur_ptr); - - for( j = 0; j < (d->num_facets+2); j++ ) - { - w->trianglestrip3data.colours[j] = d->vcolours[i]; - } - } - else - { - w->trianglestrip3data.vrtflag = TEL_VTFLAG_NORMAL; - w->trianglestrip3data.colours = 0; - w->trianglestrip3data.vnormals = (tel_point)(cur_ptr); - - for( j = 0; j < (d->num_facets+2); j++ ) - { - w->trianglestrip3data.vnormals[j] = d->vnormals[i]; - } - } - } - else - { - w->trianglestrip3data.vnormals = 0; - if( d->vcolours ) - { - w->trianglestrip3data.vrtflag = TEL_VTFLAG_COLOUR; - w->trianglestrip3data.colours = (tel_colour)(cur_ptr); - for( j = 0; j < (d->num_facets+2); j++ ) - { - w->trianglestrip3data.colours[j] = d->vcolours[i]; - } - } - else - { - w->trianglestrip3data.vrtflag = TEL_VTFLAG_NONE; - w->trianglestrip3data.colours = 0; - } - } - - status = TSuccess; - } - else - status = TFailure; - break; - } - } - } - return status; -} -/*----------------------------------------------------------------------*/ diff --git a/src/OpenGl/OpenGl_togl_activateview.cxx b/src/OpenGl/OpenGl_togl_activateview.cxx deleted file mode 100755 index 4f6dec869b..0000000000 --- a/src/OpenGl/OpenGl_togl_activateview.cxx +++ /dev/null @@ -1,16 +0,0 @@ - -#include -#include -#include -#include - -void EXPORT -call_togl_activateview -( - CALL_DEF_VIEW * aview - ) -{ - if (aview->WsId != -1) - call_func_post_struct (aview->WsId, aview->ViewId, ( float )1.0); - return; -} diff --git a/src/OpenGl/OpenGl_togl_antialiasing.cxx b/src/OpenGl/OpenGl_togl_antialiasing.cxx deleted file mode 100755 index 581aa598f1..0000000000 --- a/src/OpenGl/OpenGl_togl_antialiasing.cxx +++ /dev/null @@ -1,16 +0,0 @@ - -#include -#include -#include -#include - -void EXPORT -call_togl_antialiasing -( - CALL_DEF_VIEW * aview, - int tag - ) -{ - call_subr_antialiasing (aview, tag); - return; -} diff --git a/src/OpenGl/OpenGl_togl_backfacing.cxx b/src/OpenGl/OpenGl_togl_backfacing.cxx deleted file mode 100755 index 351bdc9f69..0000000000 --- a/src/OpenGl/OpenGl_togl_backfacing.cxx +++ /dev/null @@ -1,23 +0,0 @@ -#include - -#include -#include - -#include -#include - -#include - -extern GLboolean g_fList; - -void EXPORT call_togl_backfacing ( CALL_DEF_VIEW* aView ) { - - CMN_KEY_DATA key; - - key.ldata = aView -> Backfacing; - - TsmSetWSAttri ( aView -> WsId, WSBackfacing, &key ); - - g_fList = GL_FALSE; - -} /* end call_togl_backfacing */ diff --git a/src/OpenGl/OpenGl_togl_background.cxx b/src/OpenGl/OpenGl_togl_background.cxx deleted file mode 100755 index 24b54c02e0..0000000000 --- a/src/OpenGl/OpenGl_togl_background.cxx +++ /dev/null @@ -1,20 +0,0 @@ - -#include -#include -#include -#include - -void EXPORT -call_togl_background -( - CALL_DEF_VIEW * aview - ) -{ - TEL_COLOUR col; - - col.rgb[0] = aview->DefWindow.Background.r, - col.rgb[1] = aview->DefWindow.Background.g, - col.rgb[2] = aview->DefWindow.Background.b; - call_subr_set_background (aview->WsId, &col); - return; -} diff --git a/src/OpenGl/OpenGl_togl_begin.cxx b/src/OpenGl/OpenGl_togl_begin.cxx deleted file mode 100755 index f2f2ea6b5e..0000000000 --- a/src/OpenGl/OpenGl_togl_begin.cxx +++ /dev/null @@ -1,132 +0,0 @@ -/*********************************************************************** - -FONCTION : ----------- -file OpenGl_togl_begin.c : - - -REMARQUES: ----------- - - -HISTORIQUE DES MODIFICATIONS : --------------------------------- -xx-xx-xx : CAL ; Creation. -21-01-97 : CAL : Ajout temporaire d'un XSynchronize pour -eviter un SEG V lors de la destruction d'une vue. -05-02-97 : FMN ; Suppression de OpenGl_tgl_vis.h -25-03-97 : CAL : getenv de CSF_GraphicSync -04-11-97 : FMN : ajout InitExtensionGLX(); -17-03-98 : FMN ; Ajout mode animation -24-11-98 : FMN ; Correction sur la gestion de la perspective (cf Programming Guide) -22-12-98 : FMN ; Rename CSF_WALKTHROW en CSF_WALKTHROUGH -08/04/02 : GG ; RIC120302 Add call_togl_begin_display() function - -************************************************************************/ - -#define G003 /* GG 25-01-00 Enable animation always ... -// See V3d_View::SetAnimationMode() -*/ - -/*----------------------------------------------------------------------*/ -/* -* Includes -*/ - -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -/*----------------------------------------------------------------------*/ -/* -* Variable globales -*/ - -EXPORT GLboolean env_walkthrow = GL_FALSE; -/* OCC18942: The new symmetric perspective projection matrix is off by default */ -EXPORT GLboolean env_sym_perspective = GL_FALSE; - -/*----------------------------------------------------------------------*/ -/* - -Opens and initialises Graphic Library environment. -Returns true if the Graphic Library environment is open. -Returns false if the Graphic Library environment is closed (error). - -*/ - -int EXPORT -call_togl_begin -( - char *adisplay - ) -{ - char *pvalue; - - call_togl_set_environment (adisplay); -#ifndef WNT - if ((pvalue = getenv ("CSF_GraphicSync")) != NULL) - XSynchronize (call_thedisplay, 1); - InitExtensionGLX(call_thedisplay); -#endif - - /* Test si mode workthrough oui/non */ - if ((pvalue = getenv ("CSF_WALKTHROUGH")) != NULL) - env_walkthrow = GL_TRUE; - - /* Activation/Desactivation du mode Animation */ -#ifndef G003 - if ((pvalue = getenv ("CALL_ANIMATION")) != NULL) - animationUseFlag = GL_TRUE; - else - animationUseFlag = GL_FALSE; -#endif - - /* OCC18942: Test if symmetric perspective projection should be turned on */ - if ((pvalue = getenv ("CSF_SYM_PERSPECTIVE")) != NULL) - env_sym_perspective = GL_TRUE; - - call_togl_inquirefacilities (); - call_func_init_tgl (); - return (1); -} - -/*RIC120302*/ -/* - -Sets the Graphic Library environment. -Returns true if the Graphic Library environment is open. -Returns false if the Graphic Library environment is closed (error). - - -*/ - -int EXPORT -call_togl_begin_display -( - void *pdisplay - ) -{ - char *pvalue = NULL; - int status; - - status = call_tox_set_display (pdisplay); - if( status ) { -#ifndef WNT - if ((pvalue = getenv ("CSF_GraphicSync")) != NULL) - XSynchronize (call_thedisplay, 1); - InitExtensionGLX(call_thedisplay); -#endif - call_togl_inquirefacilities (); - call_func_init_tgl (); - } - return (status); -} -/*RIC120302*/ diff --git a/src/OpenGl/OpenGl_togl_begin_animation.cxx b/src/OpenGl/OpenGl_togl_begin_animation.cxx deleted file mode 100755 index 7ef68a625c..0000000000 --- a/src/OpenGl/OpenGl_togl_begin_animation.cxx +++ /dev/null @@ -1,187 +0,0 @@ -/*********************************************************************** - -FONCTION : ----------- -File OpenGl_togl_begin_animation : - - -REMARQUES: ----------- - -HISTORIQUE DES MODIFICATIONS : --------------------------------- -05-01-98 : CAL ; Creation. -21-01-98 : FMN ; Ajout call_togl_end_animation(). -17-03-98 : FMN ; Ajout mode animation -08-07-98 : FMN ; Changement du nom de la primitive call_togl_erase_immediat_mode() --> call_togl_erase_animation_mode. -24-08-98 : BGN ; Correction de diag de compilation sur NT : -Suppression de l'include OpenGl_animation.h qui -provoque des doubles declarations. - -************************************************************************/ - -#define G003 /* EUG 07-10-99 Animation management -*/ - -#define BUC60876 /* GG 5/4/2001 Disable local display list -// when animation is not required -*/ - -/*----------------------------------------------------------------------*/ -/* -* Includes -*/ - -#include - -#include -#include -#include - -/* 24-08-98 : BGN ; include */ - -#include -#ifdef G003 -# include -void EXPORT call_togl_erase_animation_mode ( void ); -#endif /* G003 */ - -/*----------------------------------------------------------------------*/ -/* -* Constantes -*/ - -#define NO_DEBUG - - -/*----------------------------------------------------------------------*/ -/* -* Variables statiques -*/ - -/* Indique si la display-list a ete cree */ -static GLboolean listIndexCreate = GL_FALSE; - -/*----------------------------------------------------------------------*/ -/* -* Variables externes -*/ - -/* La display-list utilisee pour le mode animation */ -GLuint listIndex = 0; - -/* La vue de reference pour le mode animation */ -int listIndexView = -1; - -/* Flag si la display-list a ete initialise*/ -GLboolean listIndexFlag = GL_FALSE; - -/* Flag mode animation en cours */ -GLboolean animationFlag = GL_FALSE; - -/* Flag si le mode animation est disponible -* (cf. var environnement CALL_ANIMATION) */ -#ifdef G003 -GLboolean animationUseFlag = GL_TRUE; -GLboolean g_fAnimation; -GLboolean g_fUpdateAM; -GLboolean g_fDegeneration; -GLboolean g_fList; -#else -GLboolean animationUseFlag = GL_FALSE; -#endif /* G003 */ - -/*----------------------------------------------------------------------*/ - -int EXPORT -call_togl_begin_animation -( - CALL_DEF_VIEW * aview - ) -{ -#ifdef G003 - g_fAnimation = GL_TRUE; - g_fList = GL_FALSE; - g_fDegeneration = aview -> IsDegenerates; - g_fUpdateAM = ( aview -> IsDegenerates == - aview -> IsDegeneratesPrev - ) ? GL_FALSE : GL_TRUE; - aview -> IsDegeneratesPrev = aview -> IsDegenerates; -#endif /* G003 */ - - if (animationUseFlag) - { - if (!listIndexCreate) - { - listIndex = glGenLists(1); - listIndexCreate = GL_TRUE; - } - - if (listIndex == 0) - animationFlag = GL_FALSE; - else - animationFlag = GL_TRUE; - } -#ifdef DEBUG - printf("call_togl_begin_animation(%d) animationFlag: %d\n", aview->WsId, animationFlag); -#endif - return (animationFlag); -} - -/*----------------------------------------------------------------------*/ - -void EXPORT -call_togl_end_animation -( - CALL_DEF_VIEW * aview - ) -{ -#ifdef G003 - CMN_KEY_DATA data; - -#ifdef BUC60876 - if( !g_fAnimation ) return; -#else - if( !animationFlag ) return; -#endif - - data.ldata = TNotDone; - TsmSetWSAttri ( aview -> WsId, WSUpdateState, &data ); - g_fAnimation = GL_FALSE; -#ifndef BUC60876 - g_fUpdateAM = GL_TRUE; -#endif - g_fDegeneration = GL_FALSE; -#endif /* G003 */ - -#ifdef DEBUG - printf("call_togl_end_animation(%d) \n", aview->WsId); -#endif - animationFlag = GL_FALSE; - -} - -/*----------------------------------------------------------------------*/ -/* -* Permet de terminer effectivement le mode Animation. -* Ceci est realise des qu'une structure a ete modifiee. -*/ - -void EXPORT call_togl_erase_animation_mode(void) -{ -#ifdef DEBUG - printf("call_togl_erase_animation_mode \n"); -#endif - listIndexView = -1; - listIndexFlag = GL_FALSE; - animationFlag = GL_FALSE; -#ifdef G003 - g_fAnimation = GL_FALSE; - g_fUpdateAM = GL_FALSE; - g_fDegeneration = GL_FALSE; - g_fList = GL_FALSE; -#endif /* G003 */ -} - -/*----------------------------------------------------------------------*/ diff --git a/src/OpenGl/OpenGl_togl_begin_immediat_mode.cxx b/src/OpenGl/OpenGl_togl_begin_immediat_mode.cxx deleted file mode 100755 index 79c626b275..0000000000 --- a/src/OpenGl/OpenGl_togl_begin_immediat_mode.cxx +++ /dev/null @@ -1,1087 +0,0 @@ -/*********************************************************************** - -FONCTION : ----------- -file OpenGl_togl_begin_immediat_mode.c : - - -REMARQUES: ----------- - - -HISTORIQUE DES MODIFICATIONS : --------------------------------- -xx-xx-xx : CAL ; Creation. -08-03-96 : FMN ; - Ajout include manquant -01-04-96 : CAL ; Integration MINSK portage WNT -15-04-96 : CAL ; Integration travail PIXMAP de Jim ROTH -07-05-96 : CAL ; Gestion du minmax calcule en C++ -voir call_togl_set_minmax -Debug temporaire pour ROB, TelRobSetRGB () -12-06-96 : CAL ; Recuperation des attributs lors d'un draw_structure -22-07-96 : GG ; Faire fonctionner correctement le highlight -des polygones en mode immediat -11-09-96 : FMN ; Ajout appel a TxglWinset dans call_togl_begin_immediat_mode -04-11-96 : CAL : Retrait du mode simule, ajout du higlight -dans togl_draw_structure -06-11-96 : CAL : Retrait du test sur doublebuffer PRO5949 -16-12-96 : CAL : Ajout d'un glFinish () dans end_immediat_mode -21-01-97 : CAL : Gestion du flag differente pour -eviter les comparaisons avec shortrealfirst ou last -22-04-97 : FMN ; Correction faute i a la place de j dans util_transform_pt -22-04-97 : FMN ; Correction appel util_transform_pt dans togl_set_minmax -24-04-97 : FMN ; (PRO4063) Ajout displaylist pour le mode transient -25-07-97 : CAL ; Portage WNT (Bool, False, True) -30-07-97 : FMN ; Meilleure gestion de la desactivation des lights -10-09-97 : FMN ; Meilleure gestion de la desactivation des lights -07-10-97 : FMN ; Simplification WNT -Ajout glFlush dans call_togl_clear_immediat_mode() -26-11-97 : FMN ; Ajout mode Ajout et xor -Meilleure gestion display list pour le RetainMode -19-12-97 : FMN ; Oublie return dans le call_togl_begin_ajout_mode() -22-12-97 : FMN ; Suppression DEBUG_TEMPO_FOR_ROB -Correction PRO10217 -Ajout affichage cadre TelCopyBuffer -Ajout LightOff sur le redraw. -02-02-98 : CAL ; Correction du bug sur les transformations de structure -tracees en mode transient. (PRO10217) (PRO12283) -05-02-98 : CAL ; Perfs : mise en place d'un flag identity pour savoir -si la matrice de transformation est l'identite. -08-04-98 : FMN ; Mailleur traitement du reaffichage d'une vue. Remplacement -de TsmDisplayStructure() par call_func_redraw_all_structs(). -08-07-98 : FMN ; PRO14399: Desactivation animationFlag quand on debute -le mode immediat (Transient et Ajout). -30-09-98 : CAL ; Optimisation pour eviter de charger inutilement -les matrices de la vue. -27-11-98 : CAL ; S4062. Ajout des layers. -02.14.100 : JR : Warnings on WNT truncations from double to float - -IMP190100 : GG -// -> Preserve current attributes because -// attributes can be changed between -// begin_immediate_mode() end end_immediate_mode() -// -> Optimize transformations computation. -// -> Optimize REDRAW in immediat mode. -// 19/09/00 -> Avoid to raise in set_linetype() & set_linewith() -// due to a bad call to TsmPutAttri() function. - -BUC60726 GG_040900 Clear the last temporary detected in any case - -BUC60900 GG_180501 Unhilight entity more earlier -when clear() is call instead at the next begin(). - -************************************************************************/ - - -#define BUC60863 /*GG_100401 After any view update, made identical -// the front and back buffer to avoid ghost drawing. -// Minimize flicking. -*/ - -#define IMP150501 /*GG_150501 CADPAK_V2 Enable/Disable Zbuffer -NOTE that the previous and unused "double-buffer" -arg is changed to "zbuffer" and enable/disable -to use the OpenGl zbuffer capabilities during immediat -drawing -*/ - -#define IMP260601 /*GG Enable correct backing store between 2 different views. -*/ - -#define IMP051001 /*GG Activates the polygon offset for polygon -// selection fill mode. -*/ - -/*----------------------------------------------------------------------*/ - -#define RIC120302 /* GG Enable to use the application display -// callback at end of traversal -*/ - -/* -* Includes -*/ - -#include -#ifdef IMP051001 -#include -#endif -#include -#include -#include - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -int call_util_osd_getenv( char * , char * , int ) ; - -/*----------------------------------------------------------------------*/ -/* -* Constantes -*/ - -#define xCOPY -#define xTRACE 0 - -#if TRACE > 0 -#include -#endif - - -/*----------------------------------------------------------------------*/ -/* -* Variables externes -*/ - -/*----------------------------------------------------------------------*/ -/* -* Prototypes fonctions -*/ - -/*----------------------------------------------------------------------*/ -/* -* Prototypes Private functions -*/ - -static void call_util_transform_pt (float *x, float *y, float *z); -static int call_util_is_identity (); -static void call_util_transpose_mat (float tmat[16], float mat[4][4]); - -/*----------------------------------------------------------------------*/ -/* -* Variables statiques -*/ - -static int openglNumberOfPoints = 0; -static GLint openglViewId = 0; -static GLint openglWsId = 0; - -static int identity = 1; - -static int partial = -1; /* -1 init, 0 complete, 1 partielle */ - -static float xm, ym, zm, XM, YM, ZM; - -static float openglMat[4][4] = { - {1., 0., 0., 0.}, - {0., 1., 0., 0.}, - {0., 0., 1., 0.}, - {0., 0., 0., 1.}, -}; - -static GLboolean transientOpen = GL_FALSE; - -/*----------------------------------------------------------------------*/ -/* Mode Ajout */ -/*----------------------------------------------------------------------*/ - -int EXPORT call_togl_begin_ajout_mode ( - CALL_DEF_VIEW *aview - ) -{ - CMN_KEY_DATA data; - - TsmGetWSAttri (aview->WsId, WSWindow, &data); -#ifdef IMP260601 - if (TxglWinset (call_thedisplay, (WINDOW) data.ldata) != TSuccess) return (0); -#else - if (TxglWinset (call_thedisplay, (WINDOW) data.ldata) == TSuccess) -#endif - - if (aview->ViewId == -1) return (0); - - openglWsId = aview->WsId; - openglViewId = aview->ViewId; - - /* mise en place des matrices de projection et de mapping */ - /* TelSetViewIndex (aview->WsId, aview->ViewId); */ - -#ifdef TRACE - printf ("call_togl_begin_ajout_mode %d %d\n", openglViewId, openglWsId); -#endif - - TelMakeFrontAndBackBufCurrent (aview->WsId); - - TsmPushAttri(); - - return (1); -} - -/*----------------------------------------------------------------------*/ -void EXPORT call_togl_end_ajout_mode () -{ - -#ifdef TRACE - printf ("call_togl_end_ajout_mode %d %d\n", openglViewId, openglWsId); -#endif - - if (openglViewId != 0) { - TelMakeBackBufCurrent (openglWsId); - } - - openglViewId = 0; - openglWsId = 0; - - identity = 1; - - /* FMN necessaire pour l'affichage sur WNT */ - glFlush(); - - TsmPopAttri(); - -} - - -/*----------------------------------------------------------------------*/ -/* Mode Transient */ -/*----------------------------------------------------------------------*/ - -void EXPORT call_togl_clear_immediat_mode ( - CALL_DEF_VIEW *aview, Tint aFlush - ) -{ - CMN_KEY_DATA data; - GLuint listIndex = 0; - GLuint retainmode = 0; - - if( transientOpen ) { - call_togl_end_immediat_mode(0); - } - -#ifdef IMP260601 - TsmGetWSAttri (aview->WsId, WSWindow, &data); - if (TxglWinset (call_thedisplay, (WINDOW) data.ldata) != TSuccess) return; -#endif - TsmGetWSAttri( aview->WsId, WSRetainMode, &data ); - retainmode = data.ldata; - -#ifdef TRACE - printf("call_togl_clear_immediat_mode. xm %f, ym %f, zm %f, XM %f, YM %f, ZM %f, partial %d retainmode %d\n",xm, ym, zm, XM, YM, ZM, partial, retainmode); -#endif - - if ( TelBackBufferRestored () == TOff ) { - call_togl_erase_animation_mode(); - call_func_redraw_all_structs_begin (aview->WsId); - if( aview->ptrUnderLayer) - call_togl_redraw_layer2d (aview, (CALL_DEF_LAYER *)aview->ptrUnderLayer); - call_func_redraw_all_structs_proc (aview->WsId); - if( aview->ptrOverLayer) - call_togl_redraw_layer2d (aview, (CALL_DEF_LAYER *)aview->ptrOverLayer); -#ifdef RIC120302 - call_subr_displayCB(aview,OCC_REDRAW_WINDOW); -#endif - call_func_redraw_all_structs_end (aview->WsId, aFlush); - // After a redraw, - // Made the back identical to the front buffer. - // Always perform full copy (partial update optimization is useless on mordern hardware)! - if (retainmode) - TelCopyBuffers (aview->WsId, GL_FRONT, GL_BACK, xm, ym, zm, XM, YM, ZM, 0); -#ifdef TRACE - printf(" $$$ REDRAW\n"); -#endif - TelSetBackBufferRestored (TOn); - } else if( partial >= 0 ) { - // Restore pixels from the back buffer. - // Always perform full copy (partial update optimization is useless on mordern hardware)! - TelCopyBuffers (aview->WsId, GL_BACK, GL_FRONT, xm, ym, zm, XM, YM, ZM, 0); - } - - TsmGetWSAttri (aview->WsId, WSTransient, &data); - listIndex = (GLuint) data.ldata; - if( listIndex != 0 ) { /* Clear current list contents */ - glNewList( listIndex, GL_COMPILE_AND_EXECUTE); - glEndList(); - } - partial = -1; - XM = YM = ZM = (float ) shortrealfirst (); - xm = ym = zm = (float ) shortreallast (); -} - -/*----------------------------------------------------------------------*/ - -void call_togl_redraw_immediat_mode( - CALL_DEF_VIEW * aview - ) -{ - CMN_KEY_DATA data; - GLuint listIndex = 0; - int retainmode = 0; -#ifndef IMP150501 - GLboolean flag_zbuffer = GL_FALSE; -#endif - - TsmGetWSAttri( aview->WsId, WSRetainMode, &data ); - retainmode = data.ldata; - - TsmGetWSAttri (aview->WsId, WSTransient, &data); - listIndex = (GLuint) data.ldata; - - if (retainmode != 0) { - if (listIndex != 0) { - TelMakeFrontBufCurrent (aview->WsId); - - LightOff(); - /* mise en place des matrices de projection et de mapping */ - /* TelSetViewIndex (aview->WsId, aview->ViewId); */ - -#ifdef TRACE - printf("call_togl_redraw_immediat_mode::call displaylist(%d) \n", - listIndex); -#endif -#ifdef IMP150501 - glCallList(listIndex); -#else - flag_zbuffer = glIsEnabled(GL_DEPTH_TEST); - if (flag_zbuffer) glDisable(GL_DEPTH_TEST); - glCallList(listIndex); - if (flag_zbuffer) glEnable(GL_DEPTH_TEST); -#endif - /* FMN necessaire pour l'affichage sur WNT */ - glFlush(); - - TelMakeBackBufCurrent (aview->WsId); - } - } -} - - -/*----------------------------------------------------------------------*/ - -int EXPORT -call_togl_begin_immediat_mode -( - CALL_DEF_VIEW * aview, - CALL_DEF_LAYER * anunderlayer, - CALL_DEF_LAYER * anoverlayer, -#ifdef IMP150501 - int zbuffer, -#else - int doublebuffer, -#endif - int retainmode - ) -{ - CMN_KEY_DATA data; - GLuint listIndex = 0; - - if (aview->ViewId == -1) return (0); - - TsmGetWSAttri (aview->WsId, WSWindow, &data); -#ifdef IMP260601 - if (TxglWinset (call_thedisplay, (WINDOW) data.ldata) != TSuccess) return (0); -#else - if (TxglWinset (call_thedisplay, (WINDOW) data.ldata) == TSuccess) -#endif - - openglWsId = aview->WsId; - openglViewId = aview->ViewId; - - data.ldata = retainmode; - TsmSetWSAttri( aview->WsId, WSRetainMode, &data ); - -#ifdef TRACE - printf ("call_togl_begin_immediat_mode %d %d RetainMode %d zbuffer %d partial %d\n", openglViewId, openglWsId, retainmode, zbuffer, partial); -#endif - - call_togl_clear_immediat_mode(aview,1); - - TelMakeFrontBufCurrent (aview->WsId); - - TsmPushAttri(); - -#ifdef COPY - if (partial == 1) { - glColor3f (1., 0., 0.); - glBegin(GL_LINE_LOOP); - glVertex3f (xm, ym, zm); - glVertex3f (XM, ym, zm); - glVertex3f (XM, YM, zm); - glVertex3f (xm, YM, zm); - glEnd(); - } -#endif - - /* - * RetainMode - */ - if( retainmode ) { - TsmGetWSAttri (aview->WsId, WSTransient, &data); - listIndex = (GLuint) data.ldata; - - if (listIndex == 0) { - listIndex = glGenLists(1); -#ifdef TRACE - printf("call_togl_begin_immediat_mode::init displaylist() %d \n", listIndex); -#endif - data.ldata = listIndex; - TsmSetWSAttri( aview->WsId, WSTransient, &data ); - } - if (listIndex == 0) return(0); -#ifdef TRACE - printf("call_togl_begin_immediat_mode::glNewList() %d \n", listIndex); -#endif - glNewList(listIndex, GL_COMPILE_AND_EXECUTE); - transientOpen = GL_TRUE; - } - -#ifdef IMP150501 - if( zbuffer ) { - glEnable(GL_DEPTH_TEST); - } else glDisable(GL_DEPTH_TEST); -#endif - - return (1); -} - - -/*----------------------------------------------------------------------*/ -/* -call_togl_end_immediat_mode (synchronize) -GLboolean synchronize - -End of immediate graphic primitives in the view. -*/ - -void EXPORT -call_togl_end_immediat_mode -( - int synchronize - ) -{ - -#ifdef TRACE - printf ("call_togl_end_immediat_mode %d %d %d\n", - synchronize, openglViewId, openglWsId); -#endif - -#ifndef BUC60863 /* Don't modify the current minmax !!*/ - /* Mise ajout MinMax */ - if ((xm > shortreallast ()) || - (ym > shortreallast ()) || - (zm > shortreallast ()) || - (XM > shortreallast ()) || - (YM > shortreallast ()) || - (ZM > shortreallast ()) || - (xm < shortrealfirst ()) || - (ym < shortrealfirst ()) || - (zm < shortrealfirst ()) || - (XM < shortrealfirst ()) || - (YM < shortrealfirst ()) || - (ZM < shortrealfirst ())) { - XM = YM = ZM = (float ) shortreallast (); - xm = ym = zm = (float ) shortrealfirst (); - partial = 0; - } - else { - if (partial != 0) partial = 1; - } -#endif /*BUC60863*/ - - if (openglViewId != 0) { -#ifdef COPY - if (partial == 1) { - glColor3f (0., 1., 0.); - glBegin(GL_LINE_LOOP); - glVertex3f (xm, ym, zm); - glVertex3f (XM, ym, zm); - glVertex3f (XM, YM, zm); - glVertex3f (xm, YM, zm); - glEnd(); - } -#endif - - if (transientOpen) { - glEndList(); -#ifdef TRACE - printf("--->glEndList() \n"); -#endif - transientOpen = GL_FALSE; - } - - TelMakeBackBufCurrent (openglWsId); - } - - /* - * Ajout CAL : pour voir quelque chose - * avant le prochain begin_immediat_mode - */ - glFinish (); - - openglViewId = 0; - openglWsId = 0; - - identity = 1; - - TsmPopAttri(); - -} - -/*----------------------------------------------------------------------*/ -/* -call_togl_transform (amatrix, mode) -float amatrix[4][4] -GLboolean mode - -Set the local transformation for All primitives -REPLACE the existante if mode is True or POSTCONCATENATE if GL_FALSE -*/ -void EXPORT -call_togl_transform ( float amatrix[4][4], int mode ) -{ - int i, j; - if (mode || identity) { - for (i=0; i<4; i++) - for (j=0; j<4; j++) - openglMat[i][j] = amatrix[i][j]; - } else - TelMultiplymat3 (openglMat, openglMat, amatrix); - - identity = call_util_is_identity (); -} - - -/* -call_togl_begin_polyline () - -Sets the graphic library ready to receive a polyline. -*/ - -void EXPORT -call_togl_begin_polyline () -{ - openglNumberOfPoints = 0; - LightOff(); - glBegin (GL_LINE_STRIP); -} - - -/*----------------------------------------------------------------------*/ -/* -call_togl_end_polyline () - -End of the polyline. -*/ - -void EXPORT -call_togl_end_polyline () -{ - -#ifdef TRACE - printf ("call_togl_end_polyline %d %d\n", openglViewId, openglWsId); -#endif - - if (openglViewId != 0) glEnd (); -} - - -/*----------------------------------------------------------------------*/ -/* -call_togl_draw (x, y, z) -float x; -float y; -float z; - -Defines a new point in the current primitive. -*/ - -void EXPORT -call_togl_draw -( - float x, - float y, - float z - ) -{ - -#ifdef TRACE - printf ("call_togl_draw %d %d\n", openglViewId, openglWsId); -#endif - - if (openglViewId != 0) { - openglNumberOfPoints ++; - call_util_transform_pt (&x, &y, &z); - if (x > XM) XM = x; - if (y > YM) YM = y; - if (z > ZM) ZM = z; - if (x < xm) xm = x; - if (y < ym) ym = y; - if (z < zm) zm = z; - glVertex3f (x, y, z); - partial = 1; - } -} - - -/*----------------------------------------------------------------------*/ -/* -call_togl_move (x, y, z) -float x; -float y; -float z; - -Defines a new point in the current primitive. -*/ - -void EXPORT -call_togl_move -( - float x, - float y, - float z - ) -{ - -#ifdef TRACE - printf ("call_togl_move %d %d\n", openglViewId, openglWsId); -#endif - - if (openglViewId != 0) { - if (openglNumberOfPoints != 0) { - call_togl_end_polyline (); - call_togl_begin_polyline (); - } - - openglNumberOfPoints ++; - call_util_transform_pt (&x, &y, &z); - if (x > XM) XM = x; - if (y > YM) YM = y; - if (z > ZM) ZM = z; - if (x < xm) xm = x; - if (y < ym) ym = y; - if (z < zm) zm = z; - glVertex3f (x, y, z); - partial = 1; - } -} - - -/*----------------------------------------------------------------------*/ -/* -call_togl_set_linecolor (r, g, b) -float r; -float g; -float b; - -Sets a new color in the current primitive. -*/ - -void EXPORT -call_togl_set_linecolor -( - float r, - float g, - float b - ) -{ - -#ifdef TRACE - printf ("call_togl_set_linecolor %d %d\n", openglViewId, openglWsId); -#endif - - if (openglViewId != 0) { - TEL_COLOUR color; - CMN_KEY key; - key.id = TelPolylineColour; - color.rgb[0] = r; color.rgb[1] = g; color.rgb[2] = b; - key.data.pdata = &color; - TsmSetAttri( 1, &key ); - } -} - - -/*----------------------------------------------------------------------*/ -/* -call_togl_set_linetype (type) -long type; - -Sets a new line type in the current primitive. -*/ - -void EXPORT -call_togl_set_linetype -( - long type - ) -{ -#ifdef TRACE - printf ("call_togl_set_linetype %d %d\n", openglViewId, openglWsId); -#endif - - if (openglViewId != 0) { - CMN_KEY key; - key.id = TelPolylineType; - key.data.ldata = type; - TsmSetAttri( 1, &key); - } -} - - -/*----------------------------------------------------------------------*/ -/* -call_togl_set_linewidth (width) -float width; - -Sets a new line width in the current primitive. -*/ - -void EXPORT -call_togl_set_linewidth -( - float width - ) -{ - -#ifdef TRACE - printf ("call_togl_set_linewidth %d %d\n", openglViewId, openglWsId); -#endif - - if (openglViewId != 0) { - CMN_KEY key; - key.id = TelPolylineWidth; - key.data.fdata = width; - TsmSetAttri( 1, &key); - } -} - - -/*----------------------------------------------------------------------*/ -/* -call_togl_draw_structure (aStructureId) -int aStructureId - -Draw a structure in the transient view space -*/ - -void EXPORT -call_togl_draw_structure -( - int aStructureId - ) -{ - Tint i, num; - tsm_node node; - register Tint istrsfed = 0; - register Tint display = 1; - register Tint highl = TOff; - register TelType telem; - CMN_KEY key; - - float mat16[16]; - GLint mode1; - GLint mode2; - -#ifdef TRACE - printf ("call_togl_draw_structure %d %d %d\n", openglViewId, openglWsId); -#endif - - if (openglViewId == 0) return; - - if (TsmGetStructure (aStructureId, &num, &node) == TFailure || !num) return; - - /*transform_persistence_end();*/ - - TsmPushAttriLight (); - TsmPushAttri(); - TglNamesetPush(); - - /* mise en place de la matrice de transformation du trace transient */ - if (! identity) { - call_util_transpose_mat (mat16, openglMat); - glGetIntegerv (GL_MATRIX_MODE, &mode1); - glMatrixMode (GL_MODELVIEW); - glPushMatrix (); - glScalef (1., 1., 1.); - glMultMatrixf (mat16); - } - - for (i = 0; i < num; i++, node = node->next) { - telem = node->elem.el; -#if TRACE > 0 - TelTrace(telem,node->elem.data.ldata); -#endif - switch (telem) { - case TelAddNameset: - case TelRemoveNameset: { - TsmSendMessage (telem, DisplayTraverse, node->elem.data, 0); - - if( TglFilterNameset( openglWsId, InvisFilter ) == TSuccess ) - display = 0; - - if( TglFilterNameset( openglWsId, HighlFilter ) == TSuccess ) - highl = TOn; - - break; - } - - case TelCurve: - case TelMarker: - case TelMarkerSet: - case TelPolyline: - case TelText: { - /* do not send Display message to */ - /* primitives if they are invisible */ - if (display) - { - LightOff(); -#ifdef IMP150501 - glDepthMask(GL_FALSE); -#endif - key.id = highl; - TsmSendMessage (telem, DisplayTraverse, node->elem.data, 1, &key); - } - } - break; - - case TelPolygon: - case TelPolygonSet: - case TelPolygonHoles: - case TelPolygonIndices: - case TelQuadrangle: - case TelParray: - case TelTriangleMesh: { - /* do not send Display message to */ - /* primitives if they are invisible */ - if (display) - { - /* LightOn(); */ -#ifdef IMP150501 - glDepthMask(GL_FALSE); -#endif -#ifdef IMP051001 - if( highl ) { - call_subr_disable_polygon_offset(); - } -#endif - key.id = highl; - TsmSendMessage (telem, DisplayTraverse, node->elem.data, 1, &key); -#ifdef IMP051001 - if( highl ) { - call_subr_enable_polygon_offset(); - } -#endif - } - } - break; - - case TelLocalTran3: { - tel_matrix3_data d = ((tel_matrix3_data)(node->elem.data.pdata)); - istrsfed = 1; - call_util_transpose_mat (mat16, d->mat); - glGetIntegerv (GL_MATRIX_MODE, &mode2); - glMatrixMode (GL_MODELVIEW); - glPushMatrix (); - glScalef (1., 1., 1.); - glMultMatrixf (mat16); - } - break; - /* ABD 29/10/04 Transform Persistence of Presentation( pan, zoom, rotate ) */ - case TelTransformPersistence: - { - key.id = openglWsId; - TsmSendMessage (telem, DisplayTraverse, node->elem.data, 1, &key); - break; - } - /*ABD 29/10/04 Transform Persistence of Presentation( pan, zoom, rotate ) */ - default: { - key.id = openglWsId; - TsmSendMessage (telem, DisplayTraverse, node->elem.data, 1, &key); - } - } - } - - TglNamesetPop(); - TsmPopAttri(); - TsmPopAttriLight (); - - if (istrsfed) { - glPopMatrix (); - glMatrixMode (mode2); - } - if (! identity) { - glPopMatrix (); - glMatrixMode (mode1); - } - - return; -} - -/*----------------------------------------------------------------------*/ -/* -call_togl_set_minmax (x1, y1, z1, x2, y2, z2) -float x1; -float y1; -float z1; -float x2; -float y2; -float z2; - -Give the boundary box of the transient graphic -*/ - -void EXPORT -call_togl_set_minmax ( - float x1, - float y1, - float z1, - float x2, - float y2, - float z2 - ) -{ -#ifdef TRACE - printf("call_togl_set_minmax. x1 %f, y1 %f, z1 %f, x2 %f, y2 %f, z2 %f\n",x1, y1, z1, x2, y2, z2); -#endif - if ((x1 > shortreallast ()) || - (y1 > shortreallast ()) || - (z1 > shortreallast ()) || - (x2 > shortreallast ()) || - (y2 > shortreallast ()) || - (z2 > shortreallast ()) || - (x1 < shortrealfirst ()) || - (y1 < shortrealfirst ()) || - (z1 < shortrealfirst ()) || - (x2 < shortrealfirst ()) || - (y2 < shortrealfirst ()) || - (z2 < shortrealfirst ())) { - XM = YM = ZM = (float ) shortreallast (); - xm = ym = zm = (float ) shortrealfirst (); - partial = 0; - } - else { - call_util_transform_pt (&x1, &y1, &z1); - call_util_transform_pt (&x2, &y2, &z2); - if (x1 > XM) XM = x1; - if (x1 < xm) xm = x1; - if (y1 > YM) YM = y1; - if (y1 < ym) ym = y1; - if (z1 > ZM) ZM = z1; - if (z1 < zm) zm = z1; - - if (x2 > XM) XM = x2; - if (x2 < xm) xm = x2; - if (y2 > YM) YM = y2; - if (y2 < ym) ym = y2; - if (z2 > ZM) ZM = z2; - if (z2 < zm) zm = z2; - if (partial != 0) partial = 1; - } -} - -/*----------------------------------------------------------------------*/ -/* -* Private functions -*/ - -/*----------------------------------------------------------------------*/ -/* -call_util_transform_pt (x, y, z) -float *x; -float *y; -float *z; - -Transform the point pt -*/ - -static void call_util_transform_pt -( - float *x, - float *y, - float *z - ) -{ - int i, j; - float sum = 0.; - float tpt[4], pt[4]; - - if (! identity) { - pt[0] = *x, pt[1] = *y, pt[2] = *z, pt[3] = 1.0; - - for (i = 0; i < 4; i++) { - for (j = 0, sum = 0.0; j < 4; j++) - sum += openglMat[i][j] * pt[j]; - tpt[i] = sum; - } - - *x = tpt[0], *y = tpt[1], *z = tpt[2]; - } -} - - -/*----------------------------------------------------------------------*/ -/* -int call_util_is_identity () - -Returns 1 if openglMat is the identity -*/ - -static int call_util_is_identity -( - ) -{ - int i, j; - int res = 1; - - for (i = 0; res && i < 4; i++) - for (j = 0; res && j < 4; j++) - if (i == j) res = (openglMat[i][j] == 1.); - else res = (openglMat[i][j] == 0.); - -#ifdef TRACE - printf ("La matrice suivante :\n"); - for (i = 0; i < 4; i++) { - printf ("\t"); - for (j = 0; j < 4; j++) - printf ("%f ", openglMat[i][j]); - printf ("\n"); - } - if (res) - printf ("est la matrice identite\n"); - else - printf ("n'est pas la matrice identite\n"); -#endif - - return (res); -} - - -/*----------------------------------------------------------------------*/ -/* -void call_util_transpose_mat (tmat, mat) -float tmat[16]; -float mat[4][4]; - -Transpose mat and returns tmat. -*/ - -static void call_util_transpose_mat (float tmat[16], float mat[4][4]) { - int i, j; - - for (i=0; i<4; i++) - for (j=0; j<4; j++) - tmat[j*4+i] = mat[i][j]; - -#ifdef TRACE - printf ("Transposee :\n"); - for (i = 0; i < 4; i++) { - printf ("\t"); - for (j = 0; j < 4; j++) - printf ("%f ", tmat[i*4+j]); - printf ("\n"); - } -#endif -} diff --git a/src/OpenGl/OpenGl_togl_begin_layer_mode.cxx b/src/OpenGl/OpenGl_togl_begin_layer_mode.cxx deleted file mode 100755 index 5729b1edd0..0000000000 --- a/src/OpenGl/OpenGl_togl_begin_layer_mode.cxx +++ /dev/null @@ -1,1142 +0,0 @@ -/*********************************************************************** - -FONCTION : ----------- -file OpenGl_togl_begin_layer_mode.c : - -REMARQUES: ----------- - -HISTORIQUE DES MODIFICATIONS : --------------------------------- -01-12-98 : CAL ; Creation. S4062. Ajout des layers. -02.14.100 : JR : Warnings on WNT truncations from double to float - -************************************************************************/ - -/*----------------------------------------------------------------------*/ -/* -* Includes -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#ifdef HAVE_STDLIB_H -#include -#endif -#if defined(HAVE_MALLOC_H) || defined(WNT) -#include -#endif - -#include - -#include -#include -#include - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -/*OCC6247*/ -#include -#include - -#include - -#include -#include - -/*----------------------------------------------------------------------*/ -/* -* Constantes -*/ - -#define NO_PRINT -#define NOTRACE -#define NO_DEBUG -#define NO_TRACE_MAT -#define NO_TRACE_TEXT - -#define IsNotModified 0 -#define IsModified 1 - -/*----------------------------------------------------------------------*/ -/* -* Variables externes -*/ - -extern GLuint linestyleBase; -extern GLuint fontBase; - -#if defined(__sun) || defined (__osf__) || defined (__hp) || defined (__sgi) -#else -extern PFNGLBLENDEQUATIONEXTPROC glBlendEquationOp; -#endif -/*----------------------------------------------------------------------*/ -/* -* Prototypes fonctions -*/ - -/*----------------------------------------------------------------------*/ -/* -* Prototypes Private functions -*/ - -/*----------------------------------------------------------------------*/ -/* -* Variables statiques -*/ - -static CALL_DEF_LAYER ACLayer; - -static GLboolean layerOpen = GL_FALSE; -static float layerHeight = -1.; -static float layerWidth = -1.; -static int layerPoints = 0; -static Tchar *layerFont = NULL; -static int layerType = -1; -static int layerFontFlag = IsModified; -static int layerFontType = 0; -static float layerRed = -1.; -static float layerGreen = -1.; -static float layerBlue = -1.; -static float layerFontRed = -1.; -static float layerFontGreen = -1.; -static float layerFontBlue = -1.; - -static OSD_FontAspect FTGLLayerFontAspect = OSD_FA_Regular; -static Tint FTGLLayerFontHeight = 16; -static Tint FTGLLayerFontAscent = 0; -static Tint FTGLLayerFontDescent = 0; -static Tint FTGLLayerFontWidth = 0; -static Tfloat FTGLLayerFontXScale = 1.f; -static Tfloat FTGLLayerFontYScale = 1.f; -static Tchar FTGLLayerFontName[100]; -static Tint FTGLLayerFontCurrent = 0; - -/*----------------------------------------------------------------------*/ -void EXPORT -call_togl_layer2d -( - CALL_DEF_LAYER * alayer - ) -{ - //call_def_ptrLayer ptrLayer; - -#ifdef PRINT - printf ("call_togl_layer2d\n"); -#endif - alayer->ptrLayer = (call_def_ptrLayer) malloc (sizeof (CALL_DEF_PTRLAYER)); - alayer->ptrLayer->listIndex = glGenLists (1); - ACLayer = *alayer; -} - -/*----------------------------------------------------------------------*/ -void EXPORT -call_togl_removelayer2d -( - CALL_DEF_LAYER * alayer - ) -{ - if (alayer->ptrLayer == NULL) return; - if (alayer->ptrLayer->listIndex == 0) return; -#ifdef PRINT - printf ("call_togl_removelayer2d %d\n", ptrLayer->listIndex); -#endif - - /* - * On detruit la display-list associee au layer. - */ - glDeleteLists (alayer->ptrLayer->listIndex, 1); - alayer->ptrLayer->listIndex = 0; - ACLayer = *alayer; -} - -/*----------------------------------------------------------------------*/ -void EXPORT -call_togl_clear_layer2d ( - CALL_DEF_LAYER * aLayer - ) -{ - if (aLayer->ptrLayer == NULL) return; - if (aLayer->ptrLayer->listIndex == 0) return; -#ifdef PRINT - printf ("call_togl_clear_layer2d %d\n", ptrLayer->listIndex); -#endif - - /* - * On clear la display-list associee au layer. - */ - /* - * On detruit la display-list associee au layer. - */ - glDeleteLists (aLayer->ptrLayer->listIndex, 1); - aLayer->ptrLayer->listIndex = 0; - /* - * On cree la display-list associee au layer. - */ - aLayer->ptrLayer->listIndex = glGenLists (1); - //alayer->ptrLayer = /*(void *) */ptrLayer; - ACLayer = *aLayer; -} - -/*----------------------------------------------------------------------*/ -void EXPORT -call_togl_redraw_layer2d ( - CALL_DEF_VIEW * aview, - CALL_DEF_LAYER * alayer - ) -{ - float left, right, bottom, top; - float delta, ratio; - int attach; -#ifdef TRACE_MAT - GLdouble modelMatrix[16], projMatrix[16]; - GLint viewport[4]; - int i, j; -#endif - GLsizei dispWidth, dispHeight; - GLboolean isl = IsLightOn(); /*OCC6247*/ - - if ( aview->DefBitmap.bitmap ) { - dispWidth = aview->DefBitmap.width; - dispHeight = aview->DefBitmap.height; - } - else { - dispWidth = (GLsizei) alayer->viewport[0]; - dispHeight = (GLsizei) alayer->viewport[1]; - } - - if (alayer->ptrLayer == NULL) return; - if (alayer->ptrLayer->listIndex == 0) return; -#ifdef PRINT - printf ("call_togl_redraw_layer2d %d\n", ptrLayer->listIndex); - printf ("\twindow size %f %f\n", - aview->DefWindow.dx, aview->DefWindow.dy); - printf ("\tviewport %f %f\n", (float) dispWidth, (float) dispHeight); -#endif - - if(isl) { - LightOff(); /*OCC6247*/ - } - - /* - * On positionne la projection - */ - glMatrixMode( GL_MODELVIEW ); - glPushMatrix (); - glLoadIdentity (); - - glMatrixMode (GL_PROJECTION); - glPushMatrix (); - glLoadIdentity (); - - if (alayer->sizeDependent == 0) - glViewport (0, 0, dispWidth, dispHeight); - - left = alayer->ortho[0], - right = alayer->ortho[1], - bottom = alayer->ortho[2], - top = alayer->ortho[3]; - attach = alayer->attach; -#ifdef TRACE - printf ("\tattach %d ortho %f %f %f %f %d\n", - attach, left, right, bottom, top); -#endif - if (alayer->sizeDependent == 0) - ratio = (float) dispWidth/dispHeight; - else - ratio = aview->DefWindow.dx/aview->DefWindow.dy; - if (ratio >= 1.0) { /* fenetre horizontale */ - delta = (float )((top - bottom)/2.0); - switch (attach) { - case 0: /* Aspect_TOC_BOTTOM_LEFT */ - top = bottom + 2*delta/ratio; - break; - case 1: /* Aspect_TOC_BOTTOM_RIGHT */ - top = bottom + 2*delta/ratio; - break; - case 2: /* Aspect_TOC_TOP_LEFT */ - bottom = top - 2*delta/ratio; - break; - case 3: /* Aspect_TOC_TOP_RIGHT */ - bottom = top - 2*delta/ratio; - break; - } - } - else { /* fenetre verticale */ - delta = (float )((right - left)/2.0); - switch (attach) { - case 0: /* Aspect_TOC_BOTTOM_LEFT */ - right = left + 2*delta*ratio; - break; - case 1: /* Aspect_TOC_BOTTOM_RIGHT */ - left = right - 2*delta*ratio; - break; - case 2: /* Aspect_TOC_TOP_LEFT */ - right = left + 2*delta*ratio; - break; - case 3: /* Aspect_TOC_TOP_RIGHT */ - left = right - 2*delta*ratio; - break; - } - } -#ifdef TRACE - printf ("\tratio %f new ortho %f %f %f %f\n", - ratio, left, right, bottom, top); -#endif - -#ifdef WNT - // Check printer context that exists only for print operation - OpenGl_PrinterContext* aPrinterContext = - OpenGl_PrinterContext::GetPrinterContext (GET_GL_CONTEXT()); - - if (aPrinterContext) - { - // additional transformation matrix could be applied to - // render only those parts of viewport that will be - // passed to a printer as a current "frame" to provide - // tiling; scaling of graphics by matrix helps render a - // part of a view (frame) in same viewport, but with higher - // resolution - GLfloat aProjMatrix[16]; - aPrinterContext->GetProjTransformation (aProjMatrix); - glLoadMatrixf ((GLfloat*) aProjMatrix); - - // printing operation also assumes other viewport dimension - // to comply with transformation matrix or graphics scaling - // factors for tiling for layer redraw - GLsizei anViewportX = 0; - GLsizei anViewportY = 0; - aPrinterContext->GetLayerViewport (anViewportX, anViewportY); - if (anViewportX != 0 && anViewportY != 0) - glViewport (0, 0, anViewportX, anViewportY); - } -#endif - - glOrtho (left, right, bottom, top, -1.0, 1.0); - -#ifdef TRACE_MAT - glGetIntegerv (GL_VIEWPORT, viewport); - glGetDoublev (GL_MODELVIEW_MATRIX, modelMatrix); - glGetDoublev (GL_PROJECTION_MATRIX, projMatrix); - printf ("viewport :\n"); - printf ("\t"); - for (i = 0; i < 4; i++) - printf ("%d ", viewport[i]); - printf ("\n"); - printf ("modelMatrix :\n"); - for (i = 0; i < 4; i++) { - printf ("\t"); - for (j = 0; j < 4; j++) - printf ("%f ", modelMatrix[i*4+j]); - printf ("\n"); - } - printf ("projMatrix :\n"); - for (i = 0; i < 4; i++) { - printf ("\t"); - for (j = 0; j < 4; j++) - printf ("%f ", projMatrix[i*4+j]); - printf ("\n"); - } -#endif - - /* - * On trace la display-list associee au layer. - */ -#ifdef TRACE - if (glIsList (alayer->ptrLayer->listIndex)) - printf ("\t%d is a list\n", alayer->ptrLayer->listIndex); - else - printf ("\t%d is not a list\n", alayer->ptrLayer->listIndex); -#endif - glPushAttrib ( - GL_LIGHTING_BIT | GL_LINE_BIT | GL_POLYGON_BIT | - GL_DEPTH_BUFFER_BIT | GL_CURRENT_BIT | GL_TEXTURE_BIT ); - glDisable (GL_DEPTH_TEST); - glCallList (alayer->ptrLayer->listIndex); - - - //calling dynamic render of LayerItems - if ( alayer->ptrLayer->layerData ) { - ACLayer = *alayer; - Visual3d_Layer* layer = (Visual3d_Layer*)alayer->ptrLayer->layerData; - layer->RenderLayerItems(); - ACLayer.ptrLayer = NULL; - } - - - glPopAttrib (); - - /* - * On retire la projection - */ - glMatrixMode (GL_PROJECTION); - glPopMatrix (); - - glMatrixMode( GL_MODELVIEW ); - glPopMatrix (); - - /* - * Restauration du Viewport en cas de modification - */ - if (alayer->sizeDependent == 0) - glViewport (0, 0, - (GLsizei) aview->DefWindow.dx, - (GLsizei) aview->DefWindow.dy); - - glFlush (); - - if(isl) { - LightOn(); /*OCC6247*/ - } - -} - -/*----------------------------------------------------------------------*/ -void EXPORT -call_togl_begin_layer2d -( - CALL_DEF_LAYER * alayer - ) -{ - call_def_ptrLayer ptrLayer; - - ACLayer = *alayer; - - ptrLayer = (call_def_ptrLayer) ACLayer.ptrLayer; - if (ptrLayer == NULL) return; - if (ptrLayer->listIndex == 0) return; -#ifdef PRINT - printf ("call_togl_begin_layer2d %d\n", ptrLayer->listIndex); -#endif - - //abd - glEnable(GL_TEXTURE_2D); - GLboolean stat = glIsEnabled( GL_TEXTURE_2D ); - - glNewList (ptrLayer->listIndex, GL_COMPILE); - layerOpen = GL_TRUE; -} - -/*----------------------------------------------------------------------*/ -void EXPORT -call_togl_end_layer2d -( - ) -{ - call_def_ptrLayer ptrLayer; - - ptrLayer = (call_def_ptrLayer) ACLayer.ptrLayer; - if (ptrLayer == NULL) return; - if (ptrLayer->listIndex == 0) return; -#ifdef PRINT - printf ("call_togl_end_layer2d %d\n", ptrLayer->listIndex); -#endif - - /* - * On ferme la display-list associee au layer. - */ - if (layerOpen) - glEndList (); - layerOpen = GL_FALSE; - - ACLayer.ptrLayer = NULL; -} - -/*----------------------------------------------------------------------*/ -void EXPORT -call_togl_begin_polyline2d ( - ) -{ - call_def_ptrLayer ptrLayer; - - ptrLayer = (call_def_ptrLayer) ACLayer.ptrLayer; - if (ptrLayer == NULL) return; - if (ptrLayer->listIndex == 0) return; -#ifdef PRINT - printf ("call_togl_begin_polyline2d %d\n", ptrLayer->listIndex); -#endif - - layerPoints = 0; - glBegin (GL_LINE_STRIP); -} - -/*----------------------------------------------------------------------*/ -void EXPORT -call_togl_end_polyline2d ( - ) -{ - call_def_ptrLayer ptrLayer; - - ptrLayer = (call_def_ptrLayer) ACLayer.ptrLayer; - if (ptrLayer == NULL) return; - if (ptrLayer->listIndex == 0) return; -#ifdef PRINT - printf ("call_togl_end_polyline2d %d\n", ptrLayer->listIndex); -#endif - - glEnd (); -} - -/*----------------------------------------------------------------------*/ -void EXPORT -call_togl_begin_polygon2d ( - ) -{ - call_def_ptrLayer ptrLayer; - - ptrLayer = (call_def_ptrLayer) ACLayer.ptrLayer; - if (ptrLayer == NULL) return; - if (ptrLayer->listIndex == 0) return; -#ifdef PRINT - printf ("call_togl_begin_polygon2d %d\n", ptrLayer->listIndex); -#endif - - layerPoints = 0; - glBegin (GL_POLYGON); -} - -/*----------------------------------------------------------------------*/ -void EXPORT -call_togl_end_polygon2d ( - ) -{ - call_def_ptrLayer ptrLayer; - - ptrLayer = (call_def_ptrLayer) ACLayer.ptrLayer; - if (ptrLayer == NULL) return; - if (ptrLayer->listIndex == 0) return; -#ifdef PRINT - printf ("call_togl_end_polygon2d %d\n", ptrLayer->listIndex); -#endif - - glEnd (); -} - -/*----------------------------------------------------------------------*/ -void EXPORT -call_togl_edge2d ( - float x, - float y - ) -{ - call_def_ptrLayer ptrLayer; - - ptrLayer = (call_def_ptrLayer) ACLayer.ptrLayer; - if (ptrLayer == NULL) return; - if (ptrLayer->listIndex == 0) return; -#ifdef PRINT - printf ("call_togl_edge2d %d\n", ptrLayer->listIndex); - printf ("\tcoord %f %f\n", x, y); -#endif - - layerPoints ++; - glVertex3f (x, y, 0.); -} - -/*----------------------------------------------------------------------*/ -void EXPORT -call_togl_draw2d -( - float x, - float y - ) -{ - call_def_ptrLayer ptrLayer; - - ptrLayer = (call_def_ptrLayer) ACLayer.ptrLayer; - if (ptrLayer == NULL) return; - if (ptrLayer->listIndex == 0) return; -#ifdef PRINT - printf ("call_togl_draw2d %d\n", ptrLayer->listIndex); - printf ("\tcoord %f %f\n", x, y); -#endif - - layerPoints ++; - glVertex3f (x, y, 0.); -} - -/*----------------------------------------------------------------------*/ -void EXPORT -call_togl_move2d -( - float x, - float y - ) -{ - call_def_ptrLayer ptrLayer; - - ptrLayer = (call_def_ptrLayer) ACLayer.ptrLayer; - if (ptrLayer == NULL) return; - if (ptrLayer->listIndex == 0) return; -#ifdef PRINT - printf ("call_togl_move2d %d\n", ptrLayer->listIndex); - printf ("\tcoord %f %f\n", x, y); -#endif - - if (layerPoints != 0) { - call_togl_end_polyline2d (); - call_togl_begin_polyline2d (); - } - - layerPoints ++; - glVertex3f (x, y, 0.); -} - -/*----------------------------------------------------------------------*/ -void EXPORT -call_togl_rectangle2d -( - float x, - float y, - float w, - float h - ) -{ - call_def_ptrLayer ptrLayer; - - ptrLayer = (call_def_ptrLayer) ACLayer.ptrLayer; - if (ptrLayer == NULL) return; - if (ptrLayer->listIndex == 0) return; -#ifdef PRINT - printf ("call_togl_rectangle2d %d\n", ptrLayer->listIndex); - printf ("\trectangle %f %f %f %f\n", x, y, w, h); -#endif - - glRectf (x, y, x + w, y + h); -} - -/*----------------------------------------------------------------------*/ -void EXPORT -call_togl_text2d ( Techar *s, - float x, - float y, - float height ) -{ -#ifndef WNT - Tint dispWidth, dispHeight; -#endif - GLdouble objx1, objy1, objz1; - - call_def_ptrLayer ptrLayer = (call_def_ptrLayer) ACLayer.ptrLayer; - if (!ptrLayer) return; - if (ptrLayer->listIndex == 0) return; -#ifdef TRACE_TEXT - printf ("call_togl_text2d %d\n", ptrLayer->listIndex); - printf ("\ttext %s %f %f %f\n", s, x, y, height); -#endif - - OpenGl_TextRender* textRender=OpenGl_TextRender::instance(); - - FTGLLayerFontCurrent = textRender->FindFont( FTGLLayerFontName, - FTGLLayerFontAspect, - FTGLLayerFontHeight, - FTGLLayerFontXScale, - FTGLLayerFontYScale ); - - objx1 = x, - objy1 = y, - objz1 = 0.0; - - //szv: conversion of Techar to wchar_t - wchar_t *s1 = (wchar_t*)s; - if (sizeof(Techar) != sizeof(wchar_t)) - { - Tint i = 0; while (s[i++]); - s1 = new wchar_t[i]; - i = 0; while (s1[i++] = (wchar_t)(*s++)); - } - - /* - * On traite les differents types d'affichage de texte - */ - switch (layerFontType) { - case 0 : /* Aspect_TODT_Normal */ -#ifdef DEBUG - printf ("---------------------\n"); - printf ("texte normal %f %f\n", objx1, objy1); -#endif - - textRender->RenderText(s1, fontBase, 1, (float )objx1, (float )objy1, 0.f ); - - break; - case 1 : /* Aspect_TODT_SubTitle */ -#ifdef OK -#ifdef DEBUG - printf ("---------------------\n"); - printf ("texte subtitle %f %f\n", objx1, objy1); -#endif - glGetIntegerv (GL_VIEWPORT, viewport); - glGetDoublev (GL_MODELVIEW_MATRIX, modelMatrix); - glGetDoublev (GL_PROJECTION_MATRIX, projMatrix); -#ifdef TRACE_MAT - printf ("viewport :\n"); - printf ("\t"); - for (i = 0; i < 4; i++) - printf ("%d ", viewport[i]); - printf ("\n"); - printf ("modelMatrix :\n"); - for (i = 0; i < 4; i++) { - printf ("\t"); - for (j = 0; j < 4; j++) - printf ("%f ", modelMatrix[i*4+j]); - printf ("\n"); - } - printf ("projMatrix :\n"); - for (i = 0; i < 4; i++) { - printf ("\t"); - for (j = 0; j < 4; j++) - printf ("%f ", projMatrix[i*4+j]); - printf ("\n"); - } -#endif - /* - * dimensionString("Methode cadre", &sWidth, &sAscent, &sDescent); - */ - sWidth = 2.; - sAscent = .2; - sDescent = .2; - - objx2 = objx1; objy2 = objy1; objz2 = objz1; - objx3 = objx1; objy3 = objy1; objz3 = objz1; - objx4 = objx1; objy4 = objy1; objz4 = objz1; - objx5 = objx1; objy5 = objy1; objz5 = objz1; - - status = gluProject (objx1, objy1, objz1, - modelMatrix, projMatrix, viewport, - &winx1, &winy1, &winz1); - - winx2 = winx1; - winy2 = winy1-sDescent; - winz2 = winz1+0.00001; - status = gluUnProject (winx2, winy2, winz2, - modelMatrix, projMatrix, viewport, - &objx2, &objy2, &objz2); - - winx2 = winx1 + sWidth; - winy2 = winy1-sDescent; - winz2 = winz1+0.00001; /* il vaut mieux F+B / 1000000 ? */ - status = gluUnProject (winx2, winy2, winz2, - modelMatrix, projMatrix, viewport, - &objx3, &objy3, &objz3); - - winx2 = winx1 + sWidth; - winy2 = winy1 + sAscent; - winz2 = winz1+0.00001; - status = gluUnProject (winx2, winy2, winz2, - modelMatrix, projMatrix, viewport, - &objx4, &objy4, &objz4); - - winx2 = winx1; - winy2 = winy1+ sAscent; - winz2 = winz1+0.00001; - status = gluUnProject (winx2, winy2, winz2, - modelMatrix, projMatrix, viewport, - &objx5, &objy5, &objz5); - - glColor3f (layerFontRed, layerFontGreen, layerFontBlue); - glBegin(GL_POLYGON); - glVertex3d(objx2, objy2, objz2); - glVertex3d(objx3, objy3, objz3); - glVertex3d(objx4, objy4, objz4); - glVertex3d(objx5, objy5, objz5); - glEnd(); - glColor3f (layerRed, layerGreen, layerBlue); -#endif /* OK */ - - textRender->RenderText(s1, fontBase, 1, (float )objx1, (float )objy1, 0.f); - - break; - case 2 : /* Aspect_TODT_Dekale */ -#ifdef OK -#ifdef DEBUG - printf ("---------------------\n"); - printf ("texte dekale %f %f\n", objx1, objy1); -#endif - glGetIntegerv (GL_VIEWPORT, viewport); - glGetDoublev (GL_MODELVIEW_MATRIX, modelMatrix); - glGetDoublev (GL_PROJECTION_MATRIX, projMatrix); -#ifdef DEBUG - printf ("viewport :\n"); - printf ("\t"); - for (i = 0; i < 4; i++) - printf ("%d ", viewport[i]); - printf ("\n"); - printf ("modelMatrix :\n"); - for (i = 0; i < 4; i++) { - printf ("\t"); - for (j = 0; j < 4; j++) - printf ("%f ", modelMatrix[i*4+j]); - printf ("\n"); - } - printf ("projMatrix :\n"); - for (i = 0; i < 4; i++) { - printf ("\t"); - for (j = 0; j < 4; j++) - printf ("%f ", projMatrix[i*4+j]); - printf ("\n"); - } -#endif - status = gluProject (objx1, objy1, objz1, - modelMatrix, projMatrix, viewport, - &winx1, &winy1, &winz1); -#ifdef DEBUG - printf ("status %s\n", (status == GL_FALSE ? "ko" : "ok")); -#endif - winx2 = winx1+1; - winy2 = winy1+1; - winz2 = winz1+0.00001; - status = gluUnProject (winx2, winy2, winz2, - modelMatrix, projMatrix, viewport, - &objx2, &objy2, &objz2); -#ifdef DEBUG - printf ("status %s\n", (status == GL_FALSE ? "ko" : "ok")); -#endif - glColor3f (layerFontRed, layerFontGreen, layerFontBlue); - - - OpenGl_TextRender* textRender=OpenGl_TextRender::instance(); - textRender->RenderText(s1, fontBase, 1, objx2, objy2, 0.f); - - - winx2 = winx1-1; - winy2 = winy1-1; - winz2 = winz1+0.00001; - status = gluUnProject (winx2, winy2, winz2, - modelMatrix, projMatrix, viewport, - &objx2, &objy2, &objz2); -#ifdef DEBUG - printf ("status %s\n", (status == GL_FALSE ? "ko" : "ok")); -#endif - - textRender->RenderText(s1, fontBase, 1, objx2, objy2, 0.f); - - - winx2 = winx1-1; - winy2 = winy1+1; - winz2 = winz1+0.00001; - status = gluUnProject (winx2, winy2, winz2, - modelMatrix, projMatrix, viewport, - &objx2, &objy2, &objz2); -#ifdef DEBUG - printf ("status %s\n", (status == GL_FALSE ? "ko" : "ok")); -#endif - - - textRender->RenderText(s1, fontBase, 1, objx2, objy2, 0.f); - - winx2 = winx1+1; - winy2 = winy1-1; - winz2 = winz1+0.00001; - status = gluUnProject (winx2, winy2, winz2, - modelMatrix, projMatrix, viewport, - &objx2, &objy2, &objz2); -#ifdef DEBUG - printf ("status %s\n", (status == GL_FALSE ? "ko" : "ok")); -#endif - - textRender->RenderText(s1, fontBase, 1, objx2, objy2, 0.f); - - glColor3f (layerRed, layerGreen, layerBlue); -#endif /* OK */ - - textRender->RenderText(s1, fontBase, 1, (float )objx1, (float )objy1, 0.f); - -#ifdef DEBUG - printf ("---------------------\n"); -#endif - break; - case 3 : /* Aspect_TODT_Blend */ -#ifdef OK -#ifndef WNT -#ifndef __sun - if ( (PFNGLBLENDEQUATIONEXTPROC)glBlendEquationOp == (PFNGLBLENDEQUATIONEXTPROC)INVALID_EXT_FUNCTION_PTR ) - { - if(QueryExtension("GL_EXT_blend_logic_op")) - glBlendEquationOp = (PFNGLBLENDEQUATIONEXTPROC)glXGetProcAddress((GLubyte*)"glBlendEquationOp"); - else - glBlendEquationOp = NULL; - } - - if ( glBlendEquationOp ) -#endif //__sun - { - glEnable(GL_BLEND); -#ifndef __sun - glBlendEquationOp(GL_LOGIC_OP); -#else - glBlendEquation(GL_LOGIC_OP); -#endif //__sun - glLogicOp(GL_XOR); - glColor3f (layerRed, layerGreen, layerBlue); - glRasterPos2f (objx1, objy1); - glDisable (GL_BLEND); - } -#else - glColor3f (layerRed, layerGreen, layerBlue); - - textRender->RenderText(s1, fontBase, 1, (float )objx1, (float )objy1, 0.f); - - -#endif //WNT - -#else /* OK */ -#ifdef DEBUG - printf ("---------------------\n"); - printf ("texte blend %f %f\n", objx1, objy1); -#endif - - textRender->RenderText(s1, fontBase, 1, (float )objx1, (float )objy1, 0.f); - -#ifdef DEBUG - printf ("---------------------\n"); -#endif -#endif /* OK */ - break; - } - //szv: delete temporary wide string - if (sizeof(Techar) != sizeof(wchar_t)) - delete[] s1; -} - -void EXPORT -call_togl_textsize2d -( - Techar *s, - float height, - float *width, - float *ascent, - float *descent - ) -{ -#ifndef WNT - Tint dispWidth, dispHeight; -#endif - - call_def_ptrLayer ptrLayer = (call_def_ptrLayer) ACLayer.ptrLayer; - if (!ptrLayer) return; - if (ptrLayer->listIndex == 0) return; - - OpenGl_TextRender* textRender = OpenGl_TextRender::instance(); - - if ( FTGLLayerFontHeight != height || layerFontFlag == IsModified || FTGLLayerFontCurrent == 0 ) - { - layerFontFlag = IsNotModified; - FTGLLayerFontHeight = height; - FTGLLayerFontCurrent = textRender -> FindFont(FTGLLayerFontName, FTGLLayerFontAspect, FTGLLayerFontHeight); - } - - //szv: conversion of Techar to wchar_t - wchar_t *s1 = (wchar_t*)s, *s2 = 0; - if (sizeof(Techar) != sizeof(wchar_t)) - { - Tint i = 0; while (s[i++]); - s1 = s2 = new wchar_t[i]; - i = 0; while (s1[i++] = (wchar_t)(*s++)); - } - textRender->StringSize(s1, &FTGLLayerFontWidth, &FTGLLayerFontAscent, &FTGLLayerFontDescent); - //szv: delete temporary wide string - if (s2) delete[] s2; - - *width = (float) FTGLLayerFontWidth; - *ascent = (float) FTGLLayerFontAscent; - *descent = (float) FTGLLayerFontDescent; - -} - -/*----------------------------------------------------------------------*/ -void EXPORT -call_togl_set_color -( - float r, - float g, - float b - ) -{ - call_def_ptrLayer ptrLayer; - - ptrLayer = (call_def_ptrLayer) ACLayer.ptrLayer; - if (ptrLayer == NULL) return; - if (ptrLayer->listIndex == 0) return; -#ifdef PRINT - printf ("call_togl_set_color %d\n", ptrLayer->listIndex); - printf ("\tcolor %f %f %f\n", r, g, b); -#endif - - layerRed = r, - layerGreen = g, - layerBlue = b; - glColor3f (r, g, b); -} - -/*----------------------------------------------------------------------*/ -void EXPORT -call_togl_set_transparency -( - float a - ) -{ - call_def_ptrLayer ptrLayer; - - ptrLayer = (call_def_ptrLayer) ACLayer.ptrLayer; - if (ptrLayer == NULL) return; - if (ptrLayer->listIndex == 0) return; -#ifdef PRINT - printf ("call_togl_set_transparency %d\n", ptrLayer->listIndex); - printf ("\ttransparency %f\n", a); -#endif - - glEnable (GL_BLEND); - glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glColor4f (layerRed, layerGreen, layerBlue, a); -} - -/*----------------------------------------------------------------------*/ -void EXPORT -call_togl_unset_transparency -( - ) -{ - call_def_ptrLayer ptrLayer; - - ptrLayer = (call_def_ptrLayer) ACLayer.ptrLayer; - if (ptrLayer == NULL) return; - if (ptrLayer->listIndex == 0) return; -#ifdef PRINT - printf ("call_togl_set_untransparency %d\n", ptrLayer->listIndex); -#endif - - glDisable (GL_BLEND); -} - -/*----------------------------------------------------------------------*/ -void EXPORT -call_togl_set_line_attributes -( - long type, - float width - ) -{ - call_def_ptrLayer ptrLayer; - - ptrLayer = (call_def_ptrLayer) ACLayer.ptrLayer; - if (ptrLayer == NULL) return; - if (ptrLayer->listIndex == 0) return; -#ifdef PRINT - printf ("call_togl_set_line_attributes %d\n", ptrLayer->listIndex); - printf ("\ttype, width %d %f\n", type, width); -#endif - if (layerType != type) { - layerType = type; - if (layerType == 0) { /* TOL_SOLID */ - glDisable (GL_LINE_STIPPLE); - } - else { - if (layerType) { - glCallList (linestyleBase+layerType); - glEnable (GL_LINE_STIPPLE); - } - } - } - if (layerWidth != width) { - layerWidth = width; - glLineWidth ((GLfloat) layerWidth); - } -} - -/*----------------------------------------------------------------------*/ -void EXPORT -call_togl_set_text_attributes -( - Tchar* font, - long type, - float r, - float g, - float b - ) -{ - call_def_ptrLayer ptrLayer; - - ptrLayer = (call_def_ptrLayer) ACLayer.ptrLayer; - if (ptrLayer == NULL) return; - if (ptrLayer->listIndex == 0) return; -#ifdef PRINT - printf ("call_togl_set_text_attributes %d\n", ptrLayer->listIndex); - printf ("\tfont %s type %ld\n", font, type); - printf ("\tcolor %f %f %f\n", r, g, b); -#endif - - if ( strcmp( (char*)FTGLLayerFontName, (char*)font ) != 0 ) { - FTGLLayerFontName[0] = '\0'; - strcat( (char*)FTGLLayerFontName, (char*)font ); - FTGLLayerFontAspect = OSD_FA_Regular; - - OpenGl_TextRender* textRender = OpenGl_TextRender::instance(); - FTGLLayerFontCurrent = textRender -> FindFont(FTGLLayerFontName, FTGLLayerFontAspect, FTGLLayerFontHeight); - - layerFontType = type; - layerFontRed = r; - layerFontGreen = g; - layerFontBlue = b; - layerFontFlag = IsModified; - } - else - return; -} - -void call_togl_set_text_attributes( Tchar* font, - Tint height, - OSD_FontAspect aspect, - float r, - float g, - float b ) -{ - call_def_ptrLayer ptrLayer; - - ptrLayer = (call_def_ptrLayer) ACLayer.ptrLayer; - if (ptrLayer == NULL) return; - if (ptrLayer->listIndex == 0) return; - -#ifdef PRINT - printf ("call_togl_set_text_attributes %d\n", ptrLayer->listIndex); - printf ("\tfont %s type \n", font); - printf ("\tcolor %f %f %f\n", r, g, b); -#endif - /* - * On gere le type de font (ASCII !) - */ - if ( strcmp( (char*)FTGLLayerFontName, (char*)font ) != 0 && - FTGLLayerFontAspect == aspect && - FTGLLayerFontHeight == height - ) - { - FTGLLayerFontName[0] = '\0'; - strcat( (char*)FTGLLayerFontName, (char*)font ); - FTGLLayerFontHeight = height; - FTGLLayerFontAspect = aspect; - layerFontFlag = IsModified; - FTGLLayerFontXScale = FTGLLayerFontYScale = 1.f; - OpenGl_TextRender* textRender = OpenGl_TextRender::instance(); - FTGLLayerFontCurrent = textRender -> FindFont(FTGLLayerFontName, FTGLLayerFontAspect, FTGLLayerFontHeight); - - layerFontRed = r; - layerFontGreen = g; - layerFontBlue = b; - } - -} - diff --git a/src/OpenGl/OpenGl_togl_bezier.cxx b/src/OpenGl/OpenGl_togl_bezier.cxx deleted file mode 100755 index 71d267c12b..0000000000 --- a/src/OpenGl/OpenGl_togl_bezier.cxx +++ /dev/null @@ -1,12 +0,0 @@ - -#include -#include - -void EXPORT -call_togl_bezier -( - CALL_DEF_GROUP * agroup, - CALL_DEF_LISTPOINTS * alpoints - ) -{ -} diff --git a/src/OpenGl/OpenGl_togl_bezier_weight.cxx b/src/OpenGl/OpenGl_togl_bezier_weight.cxx deleted file mode 100755 index cea3601d5a..0000000000 --- a/src/OpenGl/OpenGl_togl_bezier_weight.cxx +++ /dev/null @@ -1,13 +0,0 @@ - -#include -#include - -void EXPORT -call_togl_bezier_weight -( - CALL_DEF_GROUP * agroup, - CALL_DEF_LISTPOINTS * alpoints, - CALL_DEF_LISTREALS * alweights - ) -{ -} diff --git a/src/OpenGl/OpenGl_togl_blink.cxx b/src/OpenGl/OpenGl_togl_blink.cxx deleted file mode 100755 index b7a2533d24..0000000000 --- a/src/OpenGl/OpenGl_togl_blink.cxx +++ /dev/null @@ -1,14 +0,0 @@ - -#include -#include - -void EXPORT -/* unimplemented. not possible in RGBmode */ -call_togl_blink -( - CALL_DEF_STRUCTURE * astructure, - int create - ) -{ - return; -} diff --git a/src/OpenGl/OpenGl_togl_boundarybox.cxx b/src/OpenGl/OpenGl_togl_boundarybox.cxx deleted file mode 100755 index 0b7b835f86..0000000000 --- a/src/OpenGl/OpenGl_togl_boundarybox.cxx +++ /dev/null @@ -1,131 +0,0 @@ - -#include - -#include -#include - -#include -#include -#include - -void EXPORT -call_togl_boundarybox -( - CALL_DEF_STRUCTURE * astructure, - int create - ) -{ -#define CALL_MAX_BOUNDBOXSIZE 16 - - /* for the group */ - Tfloat liner, lineg, lineb; - Tint linetype; - Tfloat linewidth; - - /* for the structure */ - Tfloat Liner, Lineg, Lineb; - Tint Linetype=0; - Tfloat Linewidth; - - Tfloat Xm, Ym, Zm, XM, YM, ZM; - - CALL_DEF_LISTPOINTS alpoints; - CALL_DEF_POINT points[CALL_MAX_BOUNDBOXSIZE]; - - if( create ) - { - Xm = astructure->BoundBox.Pmin.x; - Ym = astructure->BoundBox.Pmin.y; - Zm = astructure->BoundBox.Pmin.z; - XM = astructure->BoundBox.Pmax.x; - YM = astructure->BoundBox.Pmax.y; - ZM = astructure->BoundBox.Pmax.z; - call_func_set_edit_mode( CALL_PHIGS_EDIT_INSERT ); - call_func_open_struct( astructure->Id ); - call_func_set_elem_ptr( 0 ); - call_func_set_elem_ptr_label( Structure_LABHighlight ); - - liner = astructure->BoundBox.Color.r; - lineg = astructure->BoundBox.Color.g; - lineb = astructure->BoundBox.Color.b; - linetype = CALL_PHIGS_LINE_SOLID; - linewidth = ( float )1.0; - call_subr_set_line_colr( liner, lineg, lineb ); - call_func_set_linetype( linetype ); - call_func_set_linewidth( linewidth ); - - alpoints.NbPoints = CALL_MAX_BOUNDBOXSIZE; - alpoints.TypePoints = 1; - alpoints.UPoints.Points = points; - - points[ 0].x = Xm; points[ 0].y = Ym; points[ 0].z = Zm; - points[ 1].x = Xm; points[ 1].y = Ym; points[ 1].z = ZM; - points[ 2].x = Xm; points[ 2].y = YM; points[ 2].z = ZM; - points[ 3].x = Xm; points[ 3].y = YM; points[ 3].z = Zm; - points[ 4].x = Xm; points[ 4].y = Ym; points[ 4].z = Zm; - points[ 5].x = XM; points[ 5].y = Ym; points[ 5].z = Zm; - points[ 6].x = XM; points[ 6].y = Ym; points[ 6].z = ZM; - points[ 7].x = XM; points[ 7].y = YM; points[ 7].z = ZM; - points[ 8].x = XM; points[ 8].y = YM; points[ 8].z = Zm; - points[ 9].x = XM; points[ 9].y = Ym; points[ 9].z = Zm; - points[10].x = XM; points[10].y = YM; points[10].z = Zm; - points[11].x = Xm; points[11].y = YM; points[11].z = Zm; - points[12].x = Xm; points[12].y = YM; points[12].z = ZM; - points[13].x = XM; points[13].y = YM; points[13].z = ZM; - points[14].x = XM; points[14].y = Ym; points[14].z = ZM; - points[15].x = Xm; points[15].y = Ym; points[15].z = ZM; - - call_subr_polyline( &alpoints ); - - Liner = astructure->ContextLine.Color.r; - Lineg = astructure->ContextLine.Color.g; - Lineb = astructure->ContextLine.Color.b; - - switch( astructure->ContextLine.LineType ) - { - case 0 : /* Aspect_TOL_SOLID */ - Linetype = CALL_PHIGS_LINE_SOLID; - break; - case 1 : /* Aspect_TOL_DASH */ - Linetype = CALL_PHIGS_LINE_DASH; - break; - case 2 : /* Aspect_TOL_DOT */ - Linetype = CALL_PHIGS_LINE_DOT; - break; - case 3 : /* Aspect_TOL_DOTDASH */ - Linetype = CALL_PHIGS_LINE_DASH_DOT; - break; - default : - break; - } - - Linewidth = (Tfloat)astructure->ContextLine.Width; - call_subr_set_line_colr( Liner, Lineg, Lineb ); - call_func_set_linetype( Linetype ); - call_func_set_linewidth( Linewidth ); - call_func_close_struct(); - } - else - { - call_func_set_edit_mode( CALL_PHIGS_EDIT_REPLACE ); - call_func_open_struct( astructure->Id ); - call_func_set_elem_ptr( 0 ); - call_func_set_elem_ptr_label( Structure_LABHighlight ); - call_func_offset_elem_ptr( 1 ); - call_func_del_elem(); /* boundary box linecolor */ - call_func_offset_elem_ptr( 1 ); - call_func_del_elem(); /* boundary box linetype */ - call_func_offset_elem_ptr( 1 ); - call_func_del_elem(); /* boundary box linewidth */ - call_func_offset_elem_ptr( 1 ); - call_func_del_elem(); /* boundary box definition */ - call_func_offset_elem_ptr( 1 ); - call_func_del_elem(); /* structure linecolor */ - call_func_offset_elem_ptr( 1 ); - call_func_del_elem(); /* structure linetype */ - call_func_offset_elem_ptr( 1 ); - call_func_del_elem(); /* structure linewidth */ - call_func_close_struct(); - } - return; -} diff --git a/src/OpenGl/OpenGl_togl_cleargroup.cxx b/src/OpenGl/OpenGl_togl_cleargroup.cxx deleted file mode 100755 index dd556cdf07..0000000000 --- a/src/OpenGl/OpenGl_togl_cleargroup.cxx +++ /dev/null @@ -1,41 +0,0 @@ -/*********************************************************************** - -FONCTION : ----------- -File OpenGl_togl_cleargroup.c : - - -REMARQUES: ----------- - -HISTORIQUE DES MODIFICATIONS : --------------------------------- -xx-xx-xx : xxx ; Creation. -03-03-98 : CAL ; Modification des structures CALL_DEF_GROUP et STRUCTURE - -************************************************************************/ - -/*----------------------------------------------------------------------*/ -/* -* Includes -*/ - -#include -#include -#include - -/*----------------------------------------------------------------------*/ - -void EXPORT -call_togl_cleargroup -( - CALL_DEF_GROUP * agroup - ) -{ - call_func_set_edit_mode (CALL_PHIGS_EDIT_REPLACE); - call_func_open_struct (agroup->Struct->Id); - call_func_set_elem_ptr (0); - call_func_del_elems_labels (agroup->LabelBegin, agroup->LabelEnd); - call_func_close_struct (); - return; -} diff --git a/src/OpenGl/OpenGl_togl_clearstructure.cxx b/src/OpenGl/OpenGl_togl_clearstructure.cxx deleted file mode 100755 index bf3216c8bc..0000000000 --- a/src/OpenGl/OpenGl_togl_clearstructure.cxx +++ /dev/null @@ -1,23 +0,0 @@ - -#include - -#include -#include - -#include -#include - -void EXPORT -call_togl_clearstructure -( - CALL_DEF_STRUCTURE * astructure - ) -{ - call_func_set_edit_mode (CALL_PHIGS_EDIT_REPLACE); - call_func_open_struct (astructure->Id); - call_func_set_elem_ptr (0); - call_func_del_elems_labels - (astructure->GroupBegin, astructure->GroupEnd); - call_func_close_struct (); - return; -} diff --git a/src/OpenGl/OpenGl_togl_cliplimit.cxx b/src/OpenGl/OpenGl_togl_cliplimit.cxx deleted file mode 100755 index d4ddb89a52..0000000000 --- a/src/OpenGl/OpenGl_togl_cliplimit.cxx +++ /dev/null @@ -1,87 +0,0 @@ -/*********************************************************************** - -FONCTION : ----------- -file OpenGl_togl_cliplimit.c : - - -REMARQUES: ----------- - - -HISTORIQUE DES MODIFICATIONS : --------------------------------- -xx-xx-xx : CAL ; Creation. -05-02-97 : FMN ; Suppression de OpenGl_tgl_vis.h -10-07-96 : FMN ; Suppression #define sur calcul matrice - -************************************************************************/ - -/*----------------------------------------------------------------------*/ -/* -* Includes -*/ - -#include -#include -#include -#include -#include - -/*----------------------------------------------------------------------*/ -/* -* Variables globales -*/ - -TEL_VIEW_REP call_viewrep; - -/*----------------------------------------------------------------------*/ - -void EXPORT -call_togl_cliplimit -( - CALL_DEF_VIEW * aview, - int wait - ) -{ - Tint waitwait; - - call_viewrep.clip_limit.xmin = ( float )0.0; - call_viewrep.clip_limit.xmax = ( float )1.0; - call_viewrep.clip_limit.ymin = ( float )0.0; - call_viewrep.clip_limit.ymax = ( float )1.0; - - call_viewrep.clip_limit.zmax = - ( aview->Context.ZClipFrontPlane - aview->Mapping.BackPlaneDistance ) / - ( aview->Mapping.FrontPlaneDistance - aview->Mapping.BackPlaneDistance ); - call_viewrep.clip_limit.zmin = - ( aview->Context.ZClipBackPlane - aview->Mapping.BackPlaneDistance ) / - ( aview->Mapping.FrontPlaneDistance - aview->Mapping.BackPlaneDistance ); - if( call_viewrep.clip_limit.zmin < 0.0 ) - call_viewrep.clip_limit.zmin = ( float )0.0; - if( call_viewrep.clip_limit.zmax > 1.0 ) - call_viewrep.clip_limit.zmax = ( float )1.0; - if( call_viewrep.clip_limit.zmin > call_viewrep.clip_limit.zmax ) - { - call_viewrep.clip_limit.zmin = ( float )0.0; - call_viewrep.clip_limit.zmax = ( float )1.0; - } - - call_viewrep.clip_xy = CALL_PHIGS_IND_NO_CLIP; - call_viewrep.clip_back = CALL_PHIGS_IND_NO_CLIP; - call_viewrep.clip_front = CALL_PHIGS_IND_NO_CLIP; - if( aview->Context.BackZClipping ) - call_viewrep.clip_back = CALL_PHIGS_IND_CLIP; - if( aview->Context.FrontZClipping ) - call_viewrep.clip_front = CALL_PHIGS_IND_CLIP; - - if( (!wait) && (aview->WsId != -1) ) - { - waitwait = 1; - call_togl_viewmapping( aview, waitwait ); - call_togl_vieworientation( aview, waitwait ); - TelSetViewRepresentation( aview->WsId, aview->ViewId, &call_viewrep ); - } - return; -} -/*----------------------------------------------------------------------*/ diff --git a/src/OpenGl/OpenGl_togl_closegroup.cxx b/src/OpenGl/OpenGl_togl_closegroup.cxx deleted file mode 100755 index cced67f646..0000000000 --- a/src/OpenGl/OpenGl_togl_closegroup.cxx +++ /dev/null @@ -1,28 +0,0 @@ - -#include -#include -#include -#include - -/* -call_togl_closegroup (agroup) -CALL_DEF_GROUP * agroup - -Opens the associated structure and sets the pointer -at the end of the primitives. - -Method : - -- go to the end of the group in the specified structure. -- skip the structure element which set all attributes of the structure. - -*/ - -void EXPORT -call_togl_closegroup -( - CALL_DEF_GROUP * agroup - ) -{ - call_func_close_struct (); -} diff --git a/src/OpenGl/OpenGl_togl_connect.cxx b/src/OpenGl/OpenGl_togl_connect.cxx deleted file mode 100755 index 61e14c0b08..0000000000 --- a/src/OpenGl/OpenGl_togl_connect.cxx +++ /dev/null @@ -1,24 +0,0 @@ - -#include - -#include -#include - -#include -#include - -void EXPORT -call_togl_connect -( - CALL_DEF_STRUCTURE * afather, - CALL_DEF_STRUCTURE * ason - ) -{ - call_func_set_edit_mode (CALL_PHIGS_EDIT_INSERT); - call_func_open_struct (afather->Id); - call_func_set_elem_ptr (0); - call_func_set_elem_ptr_label (Structure_LABConnect); - call_func_exec_struct (ason->Id); - call_func_close_struct (); - return; -} diff --git a/src/OpenGl/OpenGl_togl_contextstructure.cxx b/src/OpenGl/OpenGl_togl_contextstructure.cxx deleted file mode 100755 index d4b20c00ef..0000000000 --- a/src/OpenGl/OpenGl_togl_contextstructure.cxx +++ /dev/null @@ -1,507 +0,0 @@ -/*********************************************************************** - -FONCTION : ----------- -File OpenGl_contextstructure.c : - - -REMARQUES: ----------- - - -HISTORIQUE DES MODIFICATIONS : --------------------------------- -05-08-97 : PCT ; Support texture mapping -23-12-97 : FMN ; Suppression TelBackInteriorStyle, TelBackInteriorStyleIndex -30-12-97 : FMN ; CTS18312: Correction back material -15-01-98 : FMN ; Ajout Hidden line -03-03-98 : CAL ; Modification des structures CALL_DEF_GROUP et STRUCTURE -08-04-98 : FGU ; Ajout Emission -30-11-98 : FMN ; S4069 : Textes toujours visibles -02.14.100 : JR : Warnings on WNT #include ,stdio.h> -22-03-04 : SAN ; OCC4895 High-level interface for controlling polygon offsets - -************************************************************************/ - -#define OCC1174 /* SAV 08/01/03 : Added back face interior color management*/ - - -/*----------------------------------------------------------------------*/ -/* -* Includes -*/ - -#include - -#include - -#include -#include - -#include -#include -#include - -#include - - -void EXPORT -call_togl_contextstructure -( - CALL_DEF_STRUCTURE * astructure - ) -{ - Tfloat liner, lineg, lineb; - Tfloat fillr, fillg, fillb; -#ifdef OCC1174 - Tfloat fillBackr, fillBackg, fillBackb; -#endif - Tint linetype=0; - Tint intstyle=0; - Tfloat linewidth; - Tint hatch=0; - /* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */ - Tint polyOffsetMode; - Tfloat polyOffsetFactor, polyOffsetUnits; - /* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */ - - Tfloat markr, markg, markb; - Tint markertype=0; - Tfloat markerscale; - - Tchar *fontid=NULL; - Tfloat textr, textg, textb; - Tfloat textrs, textgs, textbs; - Tfloat textspace; - Tfloat textexpan; - int textstyle, textdisplaytype; - Tint textzoomable; - Tfloat textangle; - OSD_FontAspect textfontaspect; - /* Flag de mise a jour des composants materiel */ - Tint lightbool = 0x0; - CALL_DEF_TRANSFORM_PERSISTENCE transPers = astructure->TransformPersistence; - - /* Destruction */ - if( astructure->ContextLine.IsDef == -1 ) - { - } - if( astructure->ContextFillArea.IsDef == -1 ) - { - } - if( astructure->ContextMarker.IsDef == -1 ) - { - } - if( astructure->ContextText.IsDef == -1 ) - { - } - call_func_open_struct( astructure->Id ); - call_func_set_elem_ptr( 0 ); - call_func_set_elem_ptr_label( Structure_LABTransPersistence ); - if( astructure->TransformPersistence.IsSet == 1 ) - { - call_func_set_edit_mode( CALL_PHIGS_EDIT_REPLACE ); - call_func_offset_elem_ptr( 1 ); - } - else - call_func_set_edit_mode( CALL_PHIGS_EDIT_INSERT ); - /*call_func_set_transform_persistence( transPersFlag );*/ - call_func_set_transform_persistence( transPers.Flag, transPers.Point.x, transPers.Point.y, transPers.Point.z ); - call_func_close_struct(); - /* }*/ - /* ABD 29/10/04 Transform Persistence of Presentation( pan, zoom, rotate ) */ - if( astructure->ContextLine.IsDef == 1 ) - { - liner = astructure->ContextLine.Color.r; - lineg = astructure->ContextLine.Color.g; - lineb = astructure->ContextLine.Color.b; - - switch( astructure->ContextLine.LineType ) - { - case 0 : /* Aspect_TOL_SOLID */ - linetype = CALL_PHIGS_LINE_SOLID; - break; - case 1 : /* Aspect_TOL_DASH */ - linetype = CALL_PHIGS_LINE_DASH; - break; - case 2 : /* Aspect_TOL_DOT */ - linetype = CALL_PHIGS_LINE_DOT; - break; - case 3 : /* Aspect_TOL_DOTDASH */ - linetype = CALL_PHIGS_LINE_DASH_DOT; - break; - default : - break; - } - - linewidth = (Tfloat)astructure->ContextLine.Width; - - if( astructure->ContextLine.IsSet ) - call_func_set_edit_mode( CALL_PHIGS_EDIT_REPLACE ); - else - call_func_set_edit_mode( CALL_PHIGS_EDIT_INSERT ); - call_func_open_struct( astructure->Id ); - call_func_set_elem_ptr( 0 ); - call_func_set_elem_ptr_label( Structure_LABContextLine ); - - if( astructure->ContextLine.IsSet ) - call_func_offset_elem_ptr( 1 ); - call_subr_set_line_colr( liner, lineg, lineb ); - if( astructure->ContextLine.IsSet ) - call_func_offset_elem_ptr( 1 ); - call_func_set_linetype( linetype ); - if( astructure->ContextLine.IsSet ) - call_func_offset_elem_ptr( 1 ); - call_func_set_linewidth( linewidth ); - call_func_close_struct(); - } - - if( astructure->ContextFillArea.IsDef == 1 ) - { - switch( astructure->ContextFillArea.Style ) - { - case 0 : /* Aspect_IS_EMPTY */ - intstyle = CALL_PHIGS_STYLE_EMPTY; - break; - case 1 : /* Aspect_IS_HOLLOW */ - intstyle = CALL_PHIGS_STYLE_HOLLOW; - break; - case 2 : /* Aspect_IS_HATCH */ - intstyle = CALL_PHIGS_STYLE_HATCH; - break; - case 3 : /* Aspect_IS_SOLID */ - intstyle = CALL_PHIGS_STYLE_SOLID; - break; - case 4 : /* Aspect_IS_HIDDENLINE */ - intstyle = CALL_PHIGS_STYLE_HIDDENLINE; - break; - default : - break; - } - - switch( astructure->ContextFillArea.Hatch ) - { - case 0 : /* Aspect_HS_HORIZONTAL */ - hatch = CALL_PHIGS_HATCH_HORIZ; - break; - case 1 : /* Aspect_HS_HORIZONTAL_WIDE */ - hatch = CALL_PHIGS_HATCH_HORIZ_DBL; - break; - case 2 : /* Aspect_HS_VERTICAL */ - hatch = CALL_PHIGS_HATCH_VERT; - break; - case 3 : /* Aspect_HS_VERTICAL_WIDE */ - hatch = CALL_PHIGS_HATCH_VERT_DBL; - break; - case 4 : /* Aspect_HS_DIAGONAL_45 */ - hatch = CALL_PHIGS_HATCH_DIAG_45; - break; - case 5 : /* Aspect_HS_DIAGONAL_45_WIDE */ - hatch = CALL_PHIGS_HATCH_DIAG_45_DBL; - break; - case 6 : /* Aspect_HS_DIAGONAL_135 */ - hatch = CALL_PHIGS_HATCH_DIAG_135; - break; - case 7 : /* Aspect_HS_DIAGONAL_135_WIDE */ - hatch = CALL_PHIGS_HATCH_DIAG_135_DBL; - break; - case 8 : /* Aspect_HS_GRID */ - hatch = CALL_PHIGS_HATCH_GRID_R; - break; - case 9 : /* Aspect_HS_GRID_WIDE */ - hatch = CALL_PHIGS_HATCH_GRID_R_DBL; - break; - case 10 : /* Aspect_HS_GRID_DIAGONAL */ - hatch = CALL_PHIGS_HATCH_GRID_D; - break; - case 11 : /* Aspect_HS_GRID_DIAGONAL_WIDE */ - hatch = CALL_PHIGS_HATCH_GRID_D_DBL; - break; - default : - break; - } - - fillr = astructure->ContextFillArea.IntColor.r; - fillg = astructure->ContextFillArea.IntColor.g; - fillb = astructure->ContextFillArea.IntColor.b; - -#ifdef OCC1174 - fillBackr = astructure->ContextFillArea.BackIntColor.r; - fillBackg = astructure->ContextFillArea.BackIntColor.g; - fillBackb = astructure->ContextFillArea.BackIntColor.b; -#endif - - liner = astructure->ContextFillArea.EdgeColor.r; - lineg = astructure->ContextFillArea.EdgeColor.g; - lineb = astructure->ContextFillArea.EdgeColor.b; - - /* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */ - polyOffsetMode = astructure->ContextFillArea.PolygonOffsetMode; - polyOffsetFactor = astructure->ContextFillArea.PolygonOffsetFactor; - polyOffsetUnits = astructure->ContextFillArea.PolygonOffsetUnits; - /* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */ - - switch( astructure->ContextFillArea.LineType ) - { - case 0 : /* Aspect_TOL_SOLID */ - linetype = CALL_PHIGS_LINE_SOLID; - break; - case 1 : /* Aspect_TOL_DASH */ - linetype = CALL_PHIGS_LINE_DASH; - break; - case 2 : /* Aspect_TOL_DOT */ - linetype = CALL_PHIGS_LINE_DOT; - break; - case 3 : /* Aspect_TOL_DOTDASH */ - linetype = CALL_PHIGS_LINE_DASH_DOT; - break; - default : - break; - } - - linewidth = (Tfloat)astructure->ContextFillArea.Width; - - if( astructure->ContextFillArea.IsSet ) - call_func_set_edit_mode( CALL_PHIGS_EDIT_REPLACE ); - else - call_func_set_edit_mode( CALL_PHIGS_EDIT_INSERT ); - call_func_open_struct( astructure->Id ); - call_func_set_elem_ptr( 0 ); - call_func_set_elem_ptr_label( Structure_LABContextFillArea ); - - /* interior */ - if( astructure->ContextFillArea.IsSet ) - call_func_offset_elem_ptr( 1 ); - call_func_set_int_style( intstyle ); - if( astructure->ContextFillArea.IsSet ) - call_func_offset_elem_ptr( 1 ); - call_subr_set_int_colr( fillr, fillg, fillb, ( float )1.0 ); - if( astructure->ContextFillArea.IsSet ) - call_func_offset_elem_ptr( 1 ); -#ifdef OCC1174 - call_subr_set_back_int_colr( fillBackr, fillBackg, fillBackb, ( float )1.0 ); -#else - call_subr_set_back_int_colr( fillr, fillg, fillb, ( float )1.0 ); -#endif - /* edge */ - if( astructure->ContextFillArea.IsSet ) - call_func_offset_elem_ptr( 1 ); - if( astructure->ContextFillArea.Edge ) - call_func_set_edge_flag( CALL_PHIGS_EDGE_ON ); - else - call_func_set_edge_flag( CALL_PHIGS_EDGE_OFF ); - if( astructure->ContextFillArea.IsSet ) - call_func_offset_elem_ptr( 1 ); - call_subr_set_edge_colr( liner, lineg, lineb ); - if( astructure->ContextFillArea.IsSet ) - call_func_offset_elem_ptr( 1 ); - call_func_set_edge_type( linetype ); - if( astructure->ContextFillArea.IsSet ) - call_func_offset_elem_ptr( 1 ); - call_func_set_edgewidth( linewidth ); - /* hatch */ - if( astructure->ContextFillArea.IsSet ) - call_func_offset_elem_ptr( 1 ); - if( intstyle == CALL_PHIGS_STYLE_HATCH ) - call_func_set_int_style_ind( hatch ); - else - call_func_appl_data( 0 ); - /* front and back face */ - if( astructure->ContextFillArea.IsSet ) - call_func_offset_elem_ptr( 1 ); - if( astructure->ContextFillArea.Distinguish ) - call_func_set_face_disting_mode(CALL_PHIGS_DISTING_YES); - else - call_func_set_face_disting_mode(CALL_PHIGS_DISTING_NO); - if( astructure->ContextFillArea.IsSet ) - call_func_offset_elem_ptr( 1 ); - if( astructure->ContextFillArea.BackFace ) - call_func_set_face_cull_mode(CALL_PHIGS_CULL_BACKFACE); - else - call_func_set_face_cull_mode( CALL_PHIGS_CULL_NONE ); - /* front face */ - if( astructure->ContextFillArea.IsSet ) - call_func_offset_elem_ptr( 1 ); - - /* Front face */ - /* Gestion Lumiere */ - if( astructure->ContextFillArea.Front.IsAmbient ) - lightbool = lightbool | AMBIENT_MASK; - - if( astructure->ContextFillArea.Front.IsDiffuse ) - lightbool = lightbool | DIFFUSE_MASK; - - if( astructure->ContextFillArea.Front.IsSpecular ) - lightbool = lightbool | SPECULAR_MASK; - - if( astructure->ContextFillArea.Front.IsEmission ) - lightbool = lightbool | EMISSIVE_MASK; - - if( !lightbool ) - call_func_set_refl_eqn( CALL_PHIGS_REFL_NONE ); - else - call_func_set_refl_eqn( lightbool ); - - if( astructure->ContextFillArea.IsSet ) - call_func_offset_elem_ptr( 1 ); - call_subr_set_refl_props( &astructure->ContextFillArea.Front, 0 ); - - /* back face */ - /* Gestion lumiere */ - if( astructure->ContextFillArea.IsSet ) - call_func_offset_elem_ptr( 1 ); - - if( astructure->ContextFillArea.Back.IsAmbient ) - lightbool = lightbool | AMBIENT_MASK; - - if( astructure->ContextFillArea.Back.IsDiffuse ) - lightbool = lightbool | DIFFUSE_MASK; - - if( astructure->ContextFillArea.Back.IsSpecular ) - lightbool = lightbool | SPECULAR_MASK; - - if( astructure->ContextFillArea.Back.IsEmission ) - lightbool = lightbool | EMISSIVE_MASK; - - if( !lightbool ) - call_func_set_back_refl_eqn( CALL_PHIGS_REFL_NONE ); - else - call_func_set_back_refl_eqn( lightbool ); - - if( astructure->ContextFillArea.IsSet ) - call_func_offset_elem_ptr( 1 ); - call_subr_set_refl_props( &astructure->ContextFillArea.Back, 1 ); - - if( astructure->ContextFillArea.IsSet ) - call_func_offset_elem_ptr( 1 ); - call_func_set_do_texturemap(astructure->ContextFillArea.Texture.doTextureMap); - - if( astructure->ContextFillArea.IsSet ) - call_func_offset_elem_ptr( 1 ); - call_func_set_texture_id(astructure->ContextFillArea.Texture.TexId); - - /* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */ - if( astructure->ContextFillArea.IsSet ) - call_func_offset_elem_ptr( 1 ); - call_func_set_polygon_offset_params( polyOffsetMode, polyOffsetFactor, polyOffsetUnits ); - /* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */ - call_func_close_struct(); - } - - if( astructure->ContextMarker.IsDef == 1 ) - { - markr = astructure->ContextMarker.Color.r; - markg = astructure->ContextMarker.Color.g; - markb = astructure->ContextMarker.Color.b; - - switch( astructure->ContextMarker.MarkerType ) - { - case 0 : /* Aspect_TOM_POINT */ - markertype = CALL_PHIGS_MARKER_DOT; - break; - case 1 : /* Aspect_TOM_PLUS */ - markertype = CALL_PHIGS_MARKER_PLUS; - break; - case 2 : /* Aspect_TOM_STAR */ - markertype = CALL_PHIGS_MARKER_ASTERISK; - break; - case 3 : /* Aspect_TOM_O */ - markertype = CALL_PHIGS_MARKER_CIRCLE; - break; - case 4 : /* Aspect_TOM_X */ - markertype = CALL_PHIGS_MARKER_CROSS; - break; - case 5 : /* Aspect_TOM_USERDEFINED*/ - markertype = CALL_PHIGS_MARKER_USER_DEFINED; - break; - default : - printf( "\n\tINVALID MARKER TYPE %d", - astructure->ContextMarker.MarkerType ); - break; - } - - markerscale = (Tfloat)astructure->ContextMarker.Scale; - - if( astructure->ContextMarker.IsSet ) - call_func_set_edit_mode( CALL_PHIGS_EDIT_REPLACE ); - else - call_func_set_edit_mode( CALL_PHIGS_EDIT_INSERT ); - call_func_open_struct( astructure->Id ); - call_func_set_elem_ptr( 0 ); - call_func_set_elem_ptr_label( Structure_LABContextMarker ); - if( astructure->ContextMarker.IsSet ) - call_func_offset_elem_ptr( 1 ); - call_subr_set_marker_colr( markr, markg, markb ); - if( astructure->ContextMarker.IsSet ) - call_func_offset_elem_ptr( 1 ); - call_func_set_marker_type( markertype ); - if( astructure->ContextMarker.IsSet ) - call_func_offset_elem_ptr( 1 ); - call_func_set_marker_size( markerscale ); - call_func_close_struct(); - } - -#ifdef TRACE - cout << "TKOpenGl::OpenGl_togl_contextstructure" - << "\t is defined : " << astructure->ContextText.IsDef << endl; -#endif - if( astructure->ContextText.IsDef == 1 ) - { - textr = astructure->ContextText.Color.r; - textg = astructure->ContextText.Color.g; - textb = astructure->ContextText.Color.b; - - textrs = astructure->ContextText.ColorSubTitle.r; - textgs = astructure->ContextText.ColorSubTitle.g; - textbs = astructure->ContextText.ColorSubTitle.b; - - fontid = new Tchar[strlen((char*)astructure->ContextText.Font)+1]; - strcpy((char*)fontid,(char*)astructure->ContextText.Font); - - textspace = (Tfloat)astructure->ContextText.Space; - textexpan = (Tfloat)astructure->ContextText.Expan; - textstyle = (int) astructure->ContextText.Style; - textdisplaytype = (int) astructure->ContextText.DisplayType; - textzoomable = (int) astructure->ContextText.TextZoomable; - textangle = (float) astructure->ContextText.TextAngle; - textfontaspect = (OSD_FontAspect)astructure->ContextText.TextFontAspect; - - if( astructure->ContextText.IsSet ) - call_func_set_edit_mode( CALL_PHIGS_EDIT_REPLACE ); - else - call_func_set_edit_mode( CALL_PHIGS_EDIT_INSERT ); - call_func_open_struct( astructure->Id ); - call_func_set_elem_ptr( 0 ); - call_func_set_elem_ptr_label( Structure_LABContextText ); - if( astructure->ContextText.IsSet ) - call_func_offset_elem_ptr( 1 ); - call_func_set_text_zoomable( textzoomable ); - call_func_set_text_angle( textangle ); - call_func_set_text_fontaspect( textfontaspect ); - - if( astructure->ContextText.IsSet ) - call_func_offset_elem_ptr( 1 ); - call_func_set_text_font( fontid ); - if( astructure->ContextText.IsSet ) - call_func_offset_elem_ptr( 1 ); - call_func_set_char_space( textspace ); - if( astructure->ContextText.IsSet ) - call_func_offset_elem_ptr( 1 ); - call_func_set_char_expan( textexpan ); - if( astructure->ContextText.IsSet ) - call_func_offset_elem_ptr( 1 ); - call_subr_set_text_colr( textr, textg, textb ); - if( astructure->ContextText.IsSet ) - call_func_offset_elem_ptr( 1 ); - call_func_set_text_style( textstyle ); - if( astructure->ContextText.IsSet ) - call_func_offset_elem_ptr( 1 ); - call_func_set_text_display_type( textdisplaytype ); - if( astructure->ContextText.IsSet ) - call_func_offset_elem_ptr( 1 ); - call_subr_set_text_colr_subtitle( textrs, textgs, textbs ); - - call_func_close_struct(); - } - return; -} diff --git a/src/OpenGl/OpenGl_togl_curve.cxx b/src/OpenGl/OpenGl_togl_curve.cxx deleted file mode 100755 index 25b107c7ff..0000000000 --- a/src/OpenGl/OpenGl_togl_curve.cxx +++ /dev/null @@ -1,20 +0,0 @@ - -#include -#include -#include -#include -#include -#include - -void EXPORT -call_togl_curve -( - CALL_DEF_GROUP * agroup, - CALL_DEF_LISTPOINTS * alpoints - ) -{ - if (! agroup->IsOpen) call_togl_opengroup (agroup); - call_subr_curve (alpoints); - if (! agroup->IsOpen) call_togl_closegroup (agroup); - return; -} diff --git a/src/OpenGl/OpenGl_togl_deactivateview.cxx b/src/OpenGl/OpenGl_togl_deactivateview.cxx deleted file mode 100755 index 7c0dd3c407..0000000000 --- a/src/OpenGl/OpenGl_togl_deactivateview.cxx +++ /dev/null @@ -1,39 +0,0 @@ -/*********************************************************************** - -FONCTION : ----------- -file OpenGl_togl_deactivateview.c : - - -REMARQUES: ----------- - - -HISTORIQUE DES MODIFICATIONS : --------------------------------- -xx-xx-xx : CAL ; Creation. -05-02-97 : FMN ; Suppression de OpenGl_tgl_vis.h - -************************************************************************/ - -/*----------------------------------------------------------------------*/ -/* -* Includes -*/ - - -#include -#include -#include -#include - -void EXPORT -call_togl_deactivateview -( - CALL_DEF_VIEW * aview - ) -{ - if (aview->WsId != -1) - call_func_post_struct (aview->WsId, -1, ( float )1.0); - return; -} diff --git a/src/OpenGl/OpenGl_togl_degeneratestructure.cxx b/src/OpenGl/OpenGl_togl_degeneratestructure.cxx deleted file mode 100755 index f9c172fb88..0000000000 --- a/src/OpenGl/OpenGl_togl_degeneratestructure.cxx +++ /dev/null @@ -1,22 +0,0 @@ -#include - -#include -#include - -#include -#include - -void EXPORT call_togl_degeneratestructure ( CALL_DEF_STRUCTURE* astructure ) { - - call_func_set_edit_mode ( CALL_PHIGS_EDIT_REPLACE ); - call_func_open_struct ( astructure -> Id ); - call_func_set_elem_ptr ( 0 ); - call_func_set_elem_ptr_label ( Structure_LABDegenerateModel ); - call_func_offset_elem_ptr ( 1 ); - call_func_set_degenerate_model ( - astructure -> ContextFillArea.DegenerationMode, - astructure -> ContextFillArea.SkipRatio - ); - call_func_close_struct (); - -} /* end call_togl_degeneratestructure */ diff --git a/src/OpenGl/OpenGl_togl_depthcueing.cxx b/src/OpenGl/OpenGl_togl_depthcueing.cxx deleted file mode 100755 index 88a8b9388d..0000000000 --- a/src/OpenGl/OpenGl_togl_depthcueing.cxx +++ /dev/null @@ -1,38 +0,0 @@ -/*********************************************************************** - -FONCTION : ----------- -file OpenGl_togl_depthcueing.c : - - -REMARQUES: ----------- - - -HISTORIQUE DES MODIFICATIONS : --------------------------------- -xx-xx-xx : CAL ; Creation. -05-02-97 : FMN ; Suppression de OpenGl_tgl_vis.h - -************************************************************************/ - -/*----------------------------------------------------------------------*/ -/* -* Includes -*/ - -#include -#include -#include -#include - -void EXPORT -call_togl_depthcueing -( - CALL_DEF_VIEW * aview, - int tag - ) -{ - call_subr_depthcueing (aview, tag); - return; -} diff --git a/src/OpenGl/OpenGl_togl_depthtest.cxx b/src/OpenGl/OpenGl_togl_depthtest.cxx deleted file mode 100755 index a0e9f61f23..0000000000 --- a/src/OpenGl/OpenGl_togl_depthtest.cxx +++ /dev/null @@ -1,70 +0,0 @@ -/*********************************************************************** - -FONCTION : ----------- -File OpenGl_togl_depthtest : -GL_DEPTH_TEST -+ -GL_LIGHTING - -HISTORIQUE DES MODIFICATIONS : --------------------------------- -22-10-01 : SAV ; Creation. - -************************************************************************/ - -/*----------------------------------------------------------------------*/ -/* -* Includes -*/ - -#include -#include -#include -#include - - -#define BUC61044 /* 25/10/01 SAV ; added functionality to control gl depth testing -from higher API */ -#define BUC61045 /* 25/10/01 SAV ; added functionality to control gl lighting -from higher API */ - -#ifdef BUC61044 -void EXPORT call_togl_depthtest( CALL_DEF_VIEW *aview, Tint dFlag ) -{ - CMN_KEY_DATA key; - - key.ldata = dFlag; - - TsmSetWSAttri( aview->WsId, WSDepthTest, &key ); -} - -Tint EXPORT call_togl_isdepthtest( CALL_DEF_VIEW *aview ) -{ - CMN_KEY_DATA key; - - TsmGetWSAttri( aview->WsId, WSDepthTest, &key ); - - return key.ldata; -} -#endif - -#ifdef BUC61045 -void EXPORT call_togl_gllight( CALL_DEF_VIEW *aview, Tint dFlag ) -{ - CMN_KEY_DATA key; - - key.ldata = dFlag; - - TsmSetWSAttri( aview->WsId, WSGLLight, &key ); -} - -Tint EXPORT call_togl_isgllight( CALL_DEF_VIEW *aview ) -{ - CMN_KEY_DATA key; - - TsmGetWSAttri( aview->WsId, WSGLLight, &key ); - - return key.ldata; -} -#endif diff --git a/src/OpenGl/OpenGl_togl_disconnect.cxx b/src/OpenGl/OpenGl_togl_disconnect.cxx deleted file mode 100755 index 2ec3a6283c..0000000000 --- a/src/OpenGl/OpenGl_togl_disconnect.cxx +++ /dev/null @@ -1,24 +0,0 @@ - -#include -#include -#include -#include -#include - -void EXPORT -call_togl_disconnect -( - CALL_DEF_STRUCTURE * afather, - CALL_DEF_STRUCTURE * ason - ) -{ - Tint i; - - if (call_subr_get_exec_struct (afather->Id, ason->Id, &i) == TSuccess) { - call_func_open_struct (afather->Id); - call_func_set_elem_ptr (i); - call_func_del_elem (); - call_func_close_struct (); - } - return; -} diff --git a/src/OpenGl/OpenGl_togl_displaystructure.cxx b/src/OpenGl/OpenGl_togl_displaystructure.cxx deleted file mode 100755 index 8f2c3a0f0c..0000000000 --- a/src/OpenGl/OpenGl_togl_displaystructure.cxx +++ /dev/null @@ -1,69 +0,0 @@ -/*********************************************************************** - -FONCTION : ----------- -file OpenGl_togl_displaystructure.c : - - -REMARQUES: ----------- - - -HISTORIQUE DES MODIFICATIONS : --------------------------------- -xx-xx-xx : CAL ; Creation. -05-02-97 : FMN ; Suppression de OpenGl_tgl_vis.h -10-04-97 : CAL ; Modification pour que last draw => last execute. - -************************************************************************/ - -/*----------------------------------------------------------------------*/ -/* -* Includes -*/ - - -#include - -#include -#include -#include - -#include -#include - -void EXPORT -call_togl_displaystructure -( - CALL_DEF_VIEW *aview, - int StructId, - int Priority - ) -{ - int labelPriority; - - switch (Priority) { - case 0 : labelPriority = View_LABPriority01; break; - case 1 : labelPriority = View_LABPriority02; break; - case 2 : labelPriority = View_LABPriority03; break; - case 3 : labelPriority = View_LABPriority04; break; - case 4 : labelPriority = View_LABPriority05; break; - case 5 : labelPriority = View_LABPriority06; break; - case 6 : labelPriority = View_LABPriority07; break; - case 7 : labelPriority = View_LABPriority08; break; - case 8 : labelPriority = View_LABPriority09; break; - case 9 : labelPriority = View_LABPriority10; break; - case 10: labelPriority = View_LABEnd; break; - - default: labelPriority = Priority; break; - } - - call_func_set_edit_mode (CALL_PHIGS_EDIT_INSERT); - call_func_open_struct (aview->ViewId); - call_func_set_elem_ptr (0); - call_func_set_elem_ptr_label (labelPriority); - call_func_offset_elem_ptr (-1); - call_func_exec_struct (StructId); - call_func_close_struct (); - return; -} diff --git a/src/OpenGl/OpenGl_togl_element_exploration.cxx b/src/OpenGl/OpenGl_togl_element_exploration.cxx deleted file mode 100755 index 7b80ec4a6f..0000000000 --- a/src/OpenGl/OpenGl_togl_element_exploration.cxx +++ /dev/null @@ -1,78 +0,0 @@ -/*********************************************************************** - -FONCTION : ----------- -File OpenGl_togl_element_exploration : - - -REMARQUES: ----------- - - -HISTORIQUE DES MODIFICATIONS : --------------------------------- -xx-xx-xx : xxx ; Creation. -11-03-96 : FMN ; Correction warning compilation -01-04-96 : CAL ; Integration MINSK portage WNT - -************************************************************************/ - -/*----------------------------------------------------------------------*/ -/* -* Includes -*/ - - -#include -#include -#include -#include -#include - -void EXPORT -call_togl_element_exploration -( - long Id, - long elem_num, - long *type, - CALL_DEF_POINT *pt, - CALL_DEF_NORMAL *npt, - CALL_DEF_COLOR *cpt, - CALL_DEF_NORMAL *nfa - ) -{ - call_subr_structure_exploration (Id, 0, 0, elem_num, (Tint *)type, - pt, npt, cpt, nfa); - - switch( *type ) - { - case CALL_PHIGS_ELEM_POLYLINE_SET3_DATA : - *type = 1; - break; - - case CALL_PHIGS_ELEM_FILL_AREA3 : - *type = 2; - break; - - case CALL_PHIGS_ELEM_TRI_STRIP3_DATA : - *type = 3; - break; - - case CALL_PHIGS_ELEM_QUAD_MESH3_DATA : - *type = 4; - break; - - case CALL_PHIGS_ELEM_ANNO_TEXT_REL3 : - *type = 5; - break; - - case CALL_PHIGS_ELEM_POLYMARKER3 : - *type = 6; - break; - - default : - *type = 0; - break; - } - return; -} diff --git a/src/OpenGl/OpenGl_togl_end.cxx b/src/OpenGl/OpenGl_togl_end.cxx deleted file mode 100755 index 0b6a2ea05b..0000000000 --- a/src/OpenGl/OpenGl_togl_end.cxx +++ /dev/null @@ -1,31 +0,0 @@ -/*********************************************************************** - -FONCTION : ----------- -file OpenGl_togl_displaystructure.c : - - -REMARQUES: ----------- - - -HISTORIQUE DES MODIFICATIONS : --------------------------------- -xx-xx-xx : CAL ; Creation. -05-02-97 : FMN ; Suppression includes - -************************************************************************/ - -/*----------------------------------------------------------------------*/ -/* -* Includes -*/ - -#include -#include -#include - -void EXPORT -call_togl_end () -{ -} diff --git a/src/OpenGl/OpenGl_togl_erasestructure.cxx b/src/OpenGl/OpenGl_togl_erasestructure.cxx deleted file mode 100755 index e4b7ad0e0c..0000000000 --- a/src/OpenGl/OpenGl_togl_erasestructure.cxx +++ /dev/null @@ -1,23 +0,0 @@ - -#include -#include -#include -#include - -void EXPORT -call_togl_erasestructure -( - int ViewId, - int StructId - ) -{ - Tint i; - - if (call_subr_get_exec_struct (ViewId, StructId, &i) == TSuccess) { - call_func_open_struct (ViewId); - call_func_set_elem_ptr (i); - call_func_del_elem (); - call_func_close_struct (); - } - return; -} diff --git a/src/OpenGl/OpenGl_togl_facecontextgroup.cxx b/src/OpenGl/OpenGl_togl_facecontextgroup.cxx deleted file mode 100755 index 16157e9072..0000000000 --- a/src/OpenGl/OpenGl_togl_facecontextgroup.cxx +++ /dev/null @@ -1,732 +0,0 @@ -/*********************************************************************** - -FONCTION : ----------- -File OpenGl_facecontextgroup : - - -REMARQUES: ----------- - -HISTORIQUE DES MODIFICATIONS : --------------------------------- -xx-xx-xx : xxx ; Creation. -03-09-97 : FMN ; Ajout traitement Begin/EndPrimitives() -05-08-97 : PCT ; ajout texture mapping -23-12-97 : FMN ; Suppression TelBackInteriorStyle, TelBackInteriorStyleIndex -30-12-97 : FMN ; CTS18312: Correction back material -15-01-98 : FMN ; Ajout Hidden line -03-03-98 : CAL ; Modification des structures CALL_DEF_GROUP et STRUCTURE -08-04-98 : FGU ; Ajout emission -22-03-04 : SAN ; OCC4895 High-level interface for controlling polygon offsets - -************************************************************************/ - -#define OCC1174 /* SAV 08/01/03 : Added back face interior color management */ - -/*----------------------------------------------------------------------*/ -/* -* Includes -*/ - -#include -#include -#include -#include -#include -#include -#include - -/*----------------------------------------------------------------------*/ - -void EXPORT -call_togl_facecontextgroup -( - CALL_DEF_GROUP * agroup, - int noinsert - ) -{ - /* for the group */ - Tfloat liner, lineg, lineb; - Tint linetype=0; - Tfloat linewidth; - Tfloat fillr, fillg, fillb; -#ifdef OCC1174 - Tfloat fillBackr, fillBackg, fillBackb; -#endif - Tint intstyle=0; - Tint hatch=0; - /* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */ - Tint polyOffsetMode; - Tfloat polyOffsetFactor, polyOffsetUnits; - /* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */ - - /* for the structure */ - Tfloat Liner, Lineg, Lineb; - Tint Linetype=0; - Tfloat Linewidth; - Tfloat Fillr, Fillg, Fillb; -#ifdef OCC1174 - Tfloat FillBackr, FillBackg, FillBackb; -#endif - Tint Intstyle=0; - Tint Hatch=0; - /* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */ - Tint PolyOffsetMode; - Tfloat PolyOffsetFactor, PolyOffsetUnits; - /* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */ - - /* Flag sur les composants lumineux du materiel */ - Tint lightbool = 0x0; - - /* - * Si le groupe est ouvert cela signifie que BeginPrimitives - * a ete utilise. - * Dans le cas des markers composes, il faut refermer temporairement - * le groupe pour eviter des insertions d'attributs aleatoires. - */ - if (agroup->IsOpen) call_togl_closegroup (agroup); - - if( agroup->ContextFillArea.IsDef ) - { - /* recuperation du contexte du group */ - /* pour les primitives fill area */ - - switch( agroup->ContextFillArea.Style ) - { - case 0 : /* Aspect_IS_EMPTY */ - intstyle = CALL_PHIGS_STYLE_EMPTY; - break; - case 1 : /* Aspect_IS_HOLLOW */ - intstyle = CALL_PHIGS_STYLE_HOLLOW; - break; - case 2 : /* Aspect_IS_HATCH */ - intstyle = CALL_PHIGS_STYLE_HATCH; - break; - case 3 : /* Aspect_IS_SOLID */ - intstyle = CALL_PHIGS_STYLE_SOLID; - break; - case 4 : /* Aspect_IS_HIDDENLINE */ - intstyle = CALL_PHIGS_STYLE_HIDDENLINE; - break; - default : - break; - } - - switch( agroup->ContextFillArea.Hatch ) - { - case 0 : /* Aspect_HS_HORIZONTAL */ - hatch = CALL_PHIGS_HATCH_HORIZ; - break; - case 1 : /* Aspect_HS_HORIZONTAL_WIDE */ - hatch = CALL_PHIGS_HATCH_HORIZ_DBL; - break; - case 2 : /* Aspect_HS_VERTICAL */ - hatch = CALL_PHIGS_HATCH_VERT; - break; - case 3 : /* Aspect_HS_VERTICAL_WIDE */ - hatch = CALL_PHIGS_HATCH_VERT_DBL; - break; - case 4 : /* Aspect_HS_DIAGONAL_45 */ - hatch = CALL_PHIGS_HATCH_DIAG_45; - break; - case 5 : /* Aspect_HS_DIAGONAL_45_WIDE */ - hatch = CALL_PHIGS_HATCH_DIAG_45_DBL; - break; - case 6 : /* Aspect_HS_DIAGONAL_135 */ - hatch = CALL_PHIGS_HATCH_DIAG_135; - break; - case 7 : /* Aspect_HS_DIAGONAL_135_WIDE */ - hatch = CALL_PHIGS_HATCH_DIAG_135_DBL; - break; - case 8 : /* Aspect_HS_GRID */ - hatch = CALL_PHIGS_HATCH_GRID_R; - break; - case 9 : /* Aspect_HS_GRID_WIDE */ - hatch = CALL_PHIGS_HATCH_GRID_R_DBL; - break; - case 10 : /* Aspect_HS_GRID_DIAGONAL */ - hatch = CALL_PHIGS_HATCH_GRID_D; - break; - case 11 : /* Aspect_HS_GRID_DIAGONAL_WIDE */ - hatch = CALL_PHIGS_HATCH_GRID_D_DBL; - break; - default : - break; - } - - fillr = agroup->ContextFillArea.IntColor.r; - fillg = agroup->ContextFillArea.IntColor.g; - fillb = agroup->ContextFillArea.IntColor.b; - -#ifdef OCC1174 - fillBackr = agroup->ContextFillArea.BackIntColor.r; - fillBackg = agroup->ContextFillArea.BackIntColor.g; - fillBackb = agroup->ContextFillArea.BackIntColor.b; -#endif - - liner = agroup->ContextFillArea.EdgeColor.r; - lineg = agroup->ContextFillArea.EdgeColor.g; - lineb = agroup->ContextFillArea.EdgeColor.b; - - switch( agroup->ContextFillArea.LineType ) - { - case 0 : /* Aspect_TOL_SOLID */ - linetype = CALL_PHIGS_LINE_SOLID; - break; - case 1 : /* Aspect_DASH */ - linetype = CALL_PHIGS_LINE_DASH; - break; - case 2 : /* Aspect_TOL_DOT */ - linetype = CALL_PHIGS_LINE_DOT; - break; - case 3 : /* Aspect_TOL_DOTDASH */ - linetype = CALL_PHIGS_LINE_DASH_DOT; - break; - default : - break; - } - - linewidth =( Tfloat ) agroup->ContextFillArea.Width; - - /* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */ - polyOffsetMode = agroup->ContextFillArea.PolygonOffsetMode; - polyOffsetFactor = agroup->ContextFillArea.PolygonOffsetFactor; - polyOffsetUnits = agroup->ContextFillArea.PolygonOffsetUnits; - /* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */ - - switch( agroup->Struct->ContextFillArea.Style ) - { - case 0 : /* Aspect_IS_EMPTY */ - Intstyle = CALL_PHIGS_STYLE_EMPTY; - break; - case 1 : /* Aspect_IS_HOLLOW */ - Intstyle = CALL_PHIGS_STYLE_HOLLOW; - break; - case 2 : /* Aspect_IS_HATCH */ - Intstyle = CALL_PHIGS_STYLE_HATCH; - break; - case 3 : /* Aspect_IS_SOLID */ - Intstyle = CALL_PHIGS_STYLE_SOLID; - break; - case 4 : /* Aspect_IS_HIDDENLINE */ - intstyle = CALL_PHIGS_STYLE_HIDDENLINE; - break; - default : - break; - } - - switch( agroup->Struct->ContextFillArea.Hatch ) - { - case 0 : /* Aspect_HS_HORIZONTAL */ - Hatch = CALL_PHIGS_HATCH_HORIZ; - break; - case 1 : /* Aspect_HS_HORIZONTAL_WIDE */ - Hatch = CALL_PHIGS_HATCH_HORIZ_DBL; - break; - case 2 : /* Aspect_HS_VERTICAL */ - Hatch = CALL_PHIGS_HATCH_VERT; - break; - case 3 : /* Aspect_HS_VERTICAL_WIDE */ - Hatch = CALL_PHIGS_HATCH_VERT_DBL; - break; - case 4 : /* Aspect_HS_DIAGONAL_45 */ - Hatch = CALL_PHIGS_HATCH_DIAG_45; - break; - case 5 : /* Aspect_HS_DIAGONAL_45_WIDE */ - Hatch = CALL_PHIGS_HATCH_DIAG_45_DBL; - break; - case 6 : /* Aspect_HS_DIAGONAL_135 */ - Hatch = CALL_PHIGS_HATCH_DIAG_135; - break; - case 7 : /* Aspect_HS_DIAGONAL_135_WIDE */ - Hatch = CALL_PHIGS_HATCH_DIAG_135_DBL; - break; - case 8 : /* Aspect_HS_GRID */ - Hatch = CALL_PHIGS_HATCH_GRID_R; - break; - case 9 : /* Aspect_HS_GRID_WIDE */ - Hatch = CALL_PHIGS_HATCH_GRID_R_DBL; - break; - case 10 : /* Aspect_HS_GRID_DIAGONAL */ - Hatch = CALL_PHIGS_HATCH_GRID_D; - break; - case 11 : /* Aspect_HS_GRID_DIAGONAL_WIDE */ - Hatch = CALL_PHIGS_HATCH_GRID_D_DBL; - break; - default : - break; - } - - Fillr = agroup->Struct->ContextFillArea.IntColor.r; - Fillg = agroup->Struct->ContextFillArea.IntColor.g; - Fillb = agroup->Struct->ContextFillArea.IntColor.b; - -#ifdef OCC1174 - FillBackr = agroup->Struct->ContextFillArea.BackIntColor.r; - FillBackg = agroup->Struct->ContextFillArea.BackIntColor.g; - FillBackb = agroup->Struct->ContextFillArea.BackIntColor.b; -#endif - - Liner = agroup->Struct->ContextFillArea.EdgeColor.r; - Lineg = agroup->Struct->ContextFillArea.EdgeColor.g; - Lineb = agroup->Struct->ContextFillArea.EdgeColor.b; - - switch( agroup->Struct->ContextFillArea.LineType ) - { - case 0 : /* Aspect_TOL_SOLID */ - Linetype = CALL_PHIGS_LINE_SOLID; - break; - case 1 : /* Aspect_DASH */ - Linetype = CALL_PHIGS_LINE_DASH; - break; - case 2 : /* Aspect_TOL_DOT */ - Linetype = CALL_PHIGS_LINE_DOT; - break; - case 3 : /* Aspect_TOL_DOTDASH */ - Linetype = CALL_PHIGS_LINE_DASH_DOT; - break; - default : - break; - } - - Linewidth =( Tfloat ) agroup->Struct->ContextFillArea.Width; - - /* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */ - PolyOffsetMode = agroup->Struct->ContextFillArea.PolygonOffsetMode; - PolyOffsetFactor = agroup->Struct->ContextFillArea.PolygonOffsetFactor; - PolyOffsetUnits = agroup->Struct->ContextFillArea.PolygonOffsetUnits; - /* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */ - - if( noinsert == 1 ) - { - if( agroup->ContextFillArea.IsSet ) - call_func_set_edit_mode( CALL_PHIGS_EDIT_REPLACE ); - else - call_func_set_edit_mode( CALL_PHIGS_EDIT_INSERT ); - call_func_open_struct( agroup->Struct->Id ); - - call_func_set_elem_ptr( 0 ); - call_func_set_elem_ptr_label( agroup->LabelBegin ); - if( agroup->PickId.IsSet ) - call_func_offset_elem_ptr( 1 ); - if( agroup->ContextLine.IsSet ) - call_func_offset_elem_ptr( CALL_DEF_CONTEXTLINE_SIZE ); - /* interior */ - if( agroup->ContextFillArea.IsSet ) - call_func_offset_elem_ptr( 1 ); - call_func_set_int_style( intstyle ); - if( agroup->ContextFillArea.IsSet ) - call_func_offset_elem_ptr( 1 ); - call_subr_set_int_colr( fillr, fillg, fillb, ( float )1.0 ); - if( agroup->ContextFillArea.IsSet ) - call_func_offset_elem_ptr( 1 ); -#ifdef OCC1174 - call_subr_set_back_int_colr( fillBackr, fillBackg, fillBackb, ( float )1.0 ); -#else - call_subr_set_back_int_colr( fillr, fillg, fillb, ( float )1.0 ); -#endif - /* edge */ - if( agroup->ContextFillArea.IsSet ) - call_func_offset_elem_ptr( 1 ); - if( agroup->ContextFillArea.Edge ) - call_func_set_edge_flag( CALL_PHIGS_EDGE_ON ); - else - call_func_set_edge_flag( CALL_PHIGS_EDGE_OFF ); - if( agroup->ContextFillArea.IsSet ) - call_func_offset_elem_ptr( 1 ); - call_subr_set_edge_colr( liner, lineg, lineb ); - if( agroup->ContextFillArea.IsSet ) - call_func_offset_elem_ptr( 1 ); - call_func_set_edge_type( linetype ); - if( agroup->ContextFillArea.IsSet ) - call_func_offset_elem_ptr( 1 ); - call_func_set_edgewidth( linewidth ); - /* hatch */ - if( agroup->ContextFillArea.IsSet ) - call_func_offset_elem_ptr( 1 ); - if( intstyle == CALL_PHIGS_STYLE_HATCH ) - call_func_set_int_style_ind( hatch ); - else - call_func_appl_data( 0 ); - - /* front and back face */ - if( agroup->ContextFillArea.IsSet ) - call_func_offset_elem_ptr( 1 ); - if( agroup->ContextFillArea.Distinguish ) - call_func_set_face_disting_mode( CALL_PHIGS_DISTING_YES ); - else - call_func_set_face_disting_mode( CALL_PHIGS_DISTING_NO ); - if( agroup->ContextFillArea.IsSet ) - call_func_offset_elem_ptr( 1 ); - if( agroup->ContextFillArea.BackFace ) - call_func_set_face_cull_mode( CALL_PHIGS_CULL_BACKFACE ); - else - call_func_set_face_cull_mode( CALL_PHIGS_CULL_NONE ); - - /* front face */ - if( agroup->ContextFillArea.IsSet ) - call_func_offset_elem_ptr( 1 ); - - if( agroup->ContextFillArea.Front.IsAmbient ) - lightbool = lightbool | AMBIENT_MASK; - - if( agroup->ContextFillArea.Front.IsDiffuse ) - lightbool = lightbool | DIFFUSE_MASK; - - if( agroup->ContextFillArea.Front.IsSpecular ) - lightbool = lightbool | SPECULAR_MASK; - - if( agroup->ContextFillArea.Front.IsEmission ) - lightbool = lightbool | EMISSIVE_MASK; - - if( !lightbool ) - call_func_set_refl_eqn( CALL_PHIGS_REFL_NONE ); - else - call_func_set_refl_eqn( lightbool ); - - if( agroup->ContextFillArea.IsSet ) - call_func_offset_elem_ptr( 1 ); - - call_subr_set_refl_props( &agroup->ContextFillArea.Front, 0 ); - - /* back face */ - if( agroup->ContextFillArea.IsSet ) - call_func_offset_elem_ptr( 1 ); - - if( agroup->ContextFillArea.Back.IsAmbient ) - lightbool = lightbool | AMBIENT_MASK; - - if( agroup->ContextFillArea.Back.IsDiffuse ) - lightbool = lightbool | DIFFUSE_MASK; - - if( agroup->ContextFillArea.Back.IsSpecular ) - lightbool = lightbool | SPECULAR_MASK; - - if( agroup->ContextFillArea.Back.IsEmission ) - lightbool = lightbool | EMISSIVE_MASK; - - if( !lightbool ) - call_func_set_back_refl_eqn( CALL_PHIGS_REFL_NONE ); - else - call_func_set_back_refl_eqn( lightbool ); - - if( agroup->ContextFillArea.IsSet ) - call_func_offset_elem_ptr( 1 ); - call_subr_set_refl_props( &agroup->ContextFillArea.Back, 1 ); - - if( agroup->ContextFillArea.IsSet ) - call_func_offset_elem_ptr( 1 ); - call_func_set_do_texturemap(agroup->ContextFillArea.Texture.doTextureMap); - - if( agroup->ContextFillArea.IsSet ) - call_func_offset_elem_ptr( 1 ); - call_func_set_texture_id(agroup->ContextFillArea.Texture.TexId); - - /* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */ - if( agroup->ContextFillArea.IsSet ) - call_func_offset_elem_ptr( 1 ); - call_func_set_polygon_offset_params( polyOffsetMode, polyOffsetFactor, polyOffsetUnits ); - /* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */ - - call_func_set_elem_ptr_label( agroup->LabelEnd ); - call_func_offset_elem_ptr( -call_util_context_group_place( agroup ) - - 1 ); - /* interior */ - if( agroup->ContextLine.IsSet ) - call_func_offset_elem_ptr( CALL_DEF_CONTEXTLINE_SIZE ); - if( agroup->ContextFillArea.IsSet ) - call_func_offset_elem_ptr( 1 ); - call_func_set_int_style( Intstyle ); - if( agroup->ContextFillArea.IsSet ) - call_func_offset_elem_ptr( 1 ); - call_subr_set_int_colr( Fillr, Fillg, Fillb, ( float )1.0 ); - if( agroup->ContextFillArea.IsSet ) - call_func_offset_elem_ptr( 1 ); -#ifdef OCC1174 - call_subr_set_back_int_colr( FillBackr, FillBackg, FillBackb, ( float )1.0 ); -#else - call_subr_set_back_int_colr( Fillr, Fillg, Fillb, ( float )1.0 ); -#endif - /* edge */ - if( agroup->ContextFillArea.IsSet ) - call_func_offset_elem_ptr( 1 ); - if( agroup->ContextFillArea.Edge ) - call_func_set_edge_flag( CALL_PHIGS_EDGE_ON ); - else - call_func_set_edge_flag( CALL_PHIGS_EDGE_OFF ); - if( agroup->ContextFillArea.IsSet ) - call_func_offset_elem_ptr( 1 ); - call_subr_set_edge_colr( Liner, Lineg, Lineb ); - if( agroup->ContextFillArea.IsSet ) - call_func_offset_elem_ptr( 1 ); - call_func_set_edge_type( Linetype ); - if( agroup->ContextFillArea.IsSet ) - call_func_offset_elem_ptr( 1 ); - call_func_set_edgewidth( Linewidth ); - /* hatch */ - if( agroup->ContextFillArea.IsSet ) - call_func_offset_elem_ptr( 1 ); - if( Intstyle == CALL_PHIGS_STYLE_HATCH ) - call_func_set_int_style_ind( Hatch ); - else - call_func_appl_data( 0 ); - /* front and back face */ - if( agroup->ContextFillArea.IsSet ) - call_func_offset_elem_ptr( 1 ); - if( agroup->Struct->ContextFillArea.Distinguish ) - call_func_set_face_disting_mode( CALL_PHIGS_DISTING_YES ); - else - call_func_set_face_disting_mode( CALL_PHIGS_DISTING_NO ); - if( agroup->ContextFillArea.IsSet ) - call_func_offset_elem_ptr( 1 ); - if( agroup->Struct->ContextFillArea.BackFace ) - call_func_set_face_cull_mode( CALL_PHIGS_CULL_BACKFACE ); - else - call_func_set_face_cull_mode( CALL_PHIGS_CULL_NONE ); - - /* front face */ - if( agroup->ContextFillArea.IsSet ) - call_func_offset_elem_ptr( 1 ); - - if( agroup->Struct->ContextFillArea.Front.IsAmbient ) - lightbool = lightbool | AMBIENT_MASK; - - if( agroup->Struct->ContextFillArea.Front.IsDiffuse ) - lightbool = lightbool | DIFFUSE_MASK; - - if( agroup->Struct->ContextFillArea.Front.IsSpecular ) - lightbool = lightbool | SPECULAR_MASK; - - if( agroup->Struct->ContextFillArea.Front.IsEmission ) - lightbool = lightbool | EMISSIVE_MASK; - - if( !lightbool ) - call_func_set_refl_eqn( CALL_PHIGS_REFL_NONE ); - else - call_func_set_refl_eqn( lightbool ); - - if( agroup->ContextFillArea.IsSet ) - call_func_offset_elem_ptr( 1 ); - call_subr_set_refl_props( &agroup->Struct->ContextFillArea.Front, 0 ); - - /* back face */ - if( agroup->ContextFillArea.IsSet ) - call_func_offset_elem_ptr( 1 ); - - if( agroup->Struct->ContextFillArea.Back.IsAmbient ) - lightbool = lightbool | AMBIENT_MASK; - - if( agroup->Struct->ContextFillArea.Back.IsDiffuse ) - lightbool = lightbool | DIFFUSE_MASK; - - if( agroup->Struct->ContextFillArea.Back.IsSpecular ) - lightbool = lightbool | SPECULAR_MASK; - - if( agroup->Struct->ContextFillArea.Back.IsEmission ) - lightbool = lightbool | EMISSIVE_MASK; - - if( !lightbool ) - call_func_set_back_refl_eqn( CALL_PHIGS_REFL_NONE ); - else - call_func_set_back_refl_eqn( lightbool ); - - if( agroup->ContextFillArea.IsSet ) - call_func_offset_elem_ptr( 1 ); - call_subr_set_refl_props( &agroup->Struct->ContextFillArea.Back, 1 ); - - if( agroup->ContextFillArea.IsSet ) - call_func_offset_elem_ptr( 1 ); - call_func_set_do_texturemap(agroup->Struct->ContextFillArea.Texture.doTextureMap); - - if( agroup->ContextFillArea.IsSet ) - call_func_offset_elem_ptr( 1 ); - call_func_set_texture_id(agroup->Struct->ContextFillArea.Texture.TexId); - - /* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */ - if( agroup->ContextFillArea.IsSet ) - call_func_offset_elem_ptr( 1 ); - call_func_set_polygon_offset_params( PolyOffsetMode, PolyOffsetFactor, PolyOffsetUnits ); - /* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */ - - /* ABD 29/10/04 Transform Persistence of Presentation( pan, zoom, rotate ) */ - /*call_func_offset_elem_ptr( 1 );*/ - /*call_func_set_transform_persistence( TransPers );*/ - /* ABD 29/10/04 Transform Persistence of Presentation( pan, zoom, rotate ) */ - - call_func_close_struct(); - } /* no insert */ - - if( noinsert == 0 ) - { - call_func_set_edit_mode( CALL_PHIGS_EDIT_INSERT ); - call_func_open_struct( agroup->Struct->Id ); - - call_func_set_elem_ptr( 0 ); - call_func_set_elem_ptr_label( agroup->LabelEnd ); - call_func_offset_elem_ptr( -call_util_context_group_place( agroup ) - - 1 ); - call_func_set_int_style( intstyle ); - call_subr_set_int_colr( fillr, fillg, fillb, ( float )1.0 ); -#ifdef OCC1174 - call_subr_set_back_int_colr( fillBackr, fillBackg, fillBackb, ( float )1.0 ); -#else - call_subr_set_back_int_colr( fillr, fillg, fillb, ( float )1.0 ); -#endif - if( agroup->ContextFillArea.Edge ) - call_func_set_edge_flag( CALL_PHIGS_EDGE_ON ); - else - call_func_set_edge_flag( CALL_PHIGS_EDGE_OFF ); - call_subr_set_edge_colr( liner, lineg, lineb ); - call_func_set_edge_type( linetype ); - call_func_set_edgewidth( linewidth ); - if( intstyle == CALL_PHIGS_STYLE_HATCH ) - call_func_set_int_style_ind( hatch ); - else - call_func_appl_data( 0 ); - if( agroup->ContextFillArea.Distinguish ) - call_func_set_face_disting_mode( CALL_PHIGS_DISTING_YES ); - else - call_func_set_face_disting_mode( CALL_PHIGS_DISTING_NO ); - if( agroup->ContextFillArea.BackFace ) - call_func_set_face_cull_mode( CALL_PHIGS_CULL_BACKFACE ); - else - call_func_set_face_cull_mode( CALL_PHIGS_CULL_NONE ); - - /* front face */ - if( agroup->ContextFillArea.Front.IsAmbient ) - lightbool = lightbool | AMBIENT_MASK; - - if( agroup->ContextFillArea.Front.IsDiffuse ) - lightbool = lightbool | DIFFUSE_MASK; - - if( agroup->ContextFillArea.Front.IsSpecular ) - lightbool = lightbool | SPECULAR_MASK; - - if( agroup->ContextFillArea.Front.IsEmission ) - lightbool = lightbool | EMISSIVE_MASK; - - if( !lightbool ) - call_func_set_refl_eqn( CALL_PHIGS_REFL_NONE ); - else - call_func_set_refl_eqn( lightbool ); - - call_subr_set_refl_props( &agroup->ContextFillArea.Front, 0 ); - - /* back face */ - if( agroup->ContextFillArea.Back.IsAmbient ) - lightbool = lightbool | AMBIENT_MASK; - - if( agroup->ContextFillArea.Back.IsDiffuse ) - lightbool = lightbool | DIFFUSE_MASK; - - if( agroup->ContextFillArea.Back.IsSpecular ) - lightbool = lightbool | SPECULAR_MASK; - - if( agroup->ContextFillArea.Back.IsEmission ) - lightbool = lightbool | EMISSIVE_MASK; - - if( !lightbool ) - call_func_set_back_refl_eqn( CALL_PHIGS_REFL_NONE ); - else - call_func_set_back_refl_eqn( lightbool ); - - call_subr_set_refl_props( &agroup->ContextFillArea.Back, 1 ); - - call_func_set_do_texturemap(agroup->ContextFillArea.Texture.doTextureMap); - - call_func_set_texture_id(agroup->ContextFillArea.Texture.TexId); - - /* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */ - call_func_set_polygon_offset_params( polyOffsetMode, polyOffsetFactor, polyOffsetUnits ); - /* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */ - - - if( agroup->ContextLine.IsSet ) - call_func_offset_elem_ptr( CALL_DEF_CONTEXTLINE_SIZE ); - if( !agroup->ContextFillArea.IsSet ) - { - call_func_set_int_style( Intstyle ); - call_subr_set_int_colr( Fillr, Fillg, Fillb, ( float )1.0 ); -#ifdef OCC1174 - call_subr_set_back_int_colr( FillBackr, FillBackg, FillBackb, ( float )1.0 ); -#else - call_subr_set_back_int_colr( Fillr, Fillg, Fillb, ( float )1.0 ); -#endif - if( agroup->Struct->ContextFillArea.Edge ) - call_func_set_edge_flag( CALL_PHIGS_EDGE_ON ); - else - call_func_set_edge_flag( CALL_PHIGS_EDGE_OFF ); - call_subr_set_edge_colr( Liner, Lineg, Lineb ); - call_func_set_edge_type( Linetype ); - call_func_set_edgewidth( Linewidth ); - if( Intstyle == CALL_PHIGS_STYLE_HATCH ) - call_func_set_int_style_ind( Hatch ); - else - call_func_appl_data( 0 ); - if( agroup->Struct->ContextFillArea.Distinguish ) - call_func_set_face_disting_mode( CALL_PHIGS_DISTING_YES ); - else - call_func_set_face_disting_mode( CALL_PHIGS_DISTING_NO ); - if( agroup->Struct->ContextFillArea.BackFace ) - call_func_set_face_cull_mode( CALL_PHIGS_CULL_BACKFACE ); - else - call_func_set_face_cull_mode( CALL_PHIGS_CULL_NONE ); - - /* front face */ - if( agroup->Struct->ContextFillArea.Front.IsAmbient ) - lightbool = lightbool | AMBIENT_MASK; - - if( agroup->Struct->ContextFillArea.Front.IsDiffuse ) - lightbool = lightbool | DIFFUSE_MASK; - - if( agroup->Struct->ContextFillArea.Front.IsSpecular ) - lightbool = lightbool | SPECULAR_MASK; - - if( agroup->Struct->ContextFillArea.Front.IsEmission ) - lightbool = lightbool | EMISSIVE_MASK; - - if( !lightbool ) - call_func_set_refl_eqn( CALL_PHIGS_REFL_NONE ); - else - call_func_set_refl_eqn( lightbool ); - - call_subr_set_refl_props( &agroup->Struct->ContextFillArea.Front, 0 ); - - /* back face */ - if( agroup->Struct->ContextFillArea.Back.IsAmbient ) - lightbool = lightbool | AMBIENT_MASK; - - if( agroup->Struct->ContextFillArea.Back.IsDiffuse ) - lightbool = lightbool | DIFFUSE_MASK; - - if( agroup->Struct->ContextFillArea.Back.IsSpecular ) - lightbool = lightbool | SPECULAR_MASK; - - if( agroup->Struct->ContextFillArea.Back.IsEmission ) - lightbool = lightbool | EMISSIVE_MASK; - - if( !lightbool ) - call_func_set_back_refl_eqn( CALL_PHIGS_REFL_NONE ); - else - call_func_set_back_refl_eqn( lightbool ); - - call_subr_set_refl_props(&agroup->Struct->ContextFillArea.Back, 1); - - call_func_set_do_texturemap(agroup->Struct->ContextFillArea.Texture.doTextureMap); - - call_func_set_texture_id(agroup->Struct->ContextFillArea.Texture.TexId); - - /* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */ - call_func_set_polygon_offset_params( PolyOffsetMode, PolyOffsetFactor, PolyOffsetUnits ); - /* OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets */ - } - - call_func_close_struct(); - } /* insert */ - - } - /* Voir commentaire en debut de fonction */ - if (agroup->IsOpen) call_togl_opengroup (agroup); - return; -} diff --git a/src/OpenGl/OpenGl_togl_gradient_background.cxx b/src/OpenGl/OpenGl_togl_gradient_background.cxx deleted file mode 100755 index 60f15eb8b1..0000000000 --- a/src/OpenGl/OpenGl_togl_gradient_background.cxx +++ /dev/null @@ -1,76 +0,0 @@ -#include -#include -#include -#include -#include - -#include -#include -#include - -void EXPORT -call_togl_gradient_background -( - int ws, int type, - tel_colour tcolor1, tel_colour tcolor2 -) -{ - call_subr_set_gradient_background ( ws, type, tcolor1, tcolor2 ); - return; -} - - -void EXPORT call_togl_set_gradient_type -( - int ws, int type -) -{ - tsm_bg_gradient gradient; - CMN_KEY_DATA cmnData; - CMN_KEY_DATA cmnKey; - - /* check if gradient background is already created */ - TsmGetWSAttri( ws, WSBgGradient, &cmnData ); - gradient = (tsm_bg_gradient)cmnData.pdata; - if ( gradient->type != 0 ) { - switch ( type ) { - case 0 : - gradient->type = TSM_GT_NONE; - case 1 : - gradient->type = TSM_GT_HOR; - break; - case 2 : - gradient->type = TSM_GT_VER; - break; - case 3 : - gradient->type = TSM_GT_DIAG1; - break; - case 4 : - gradient->type = TSM_GT_DIAG1; - break; - case 5 : - gradient->type = TSM_GT_CORNER1; - break; - case 6 : - gradient->type = TSM_GT_CORNER2; - break; - case 7 : - gradient->type = TSM_GT_CORNER3; - break; - case 8 : - gradient->type = TSM_GT_CORNER4; - break; - default : - gradient->type = TSM_GT_NONE; - break; - } - - /* setting flag to update changes */ - cmnKey.ldata = TNotDone; - TsmSetWSAttri( ws, WSUpdateState, &cmnKey ); - - /* storing background texture */ - cmnData.pdata = gradient; - TsmSetWSAttri( ws, WSBgGradient, &cmnData ); - } -} diff --git a/src/OpenGl/OpenGl_togl_graduatedtrihedron.cxx b/src/OpenGl/OpenGl_togl_graduatedtrihedron.cxx deleted file mode 100644 index fc04543184..0000000000 --- a/src/OpenGl/OpenGl_togl_graduatedtrihedron.cxx +++ /dev/null @@ -1,30 +0,0 @@ -// File: OpenGl_togl_graduatedtrihedron.cxx -// Created: 6 March 2011 -// Author: Sergey ZERCHANINOV -// Copyright: OPEN CASCADE SA 2011 - -#include - -#include -#include - -#include -#include -#include - -void EXPORT call_togl_graduatedtrihedron_display(CALL_DEF_VIEW* view, - const Graphic3d_CGraduatedTrihedron &cubic) -{ - call_graduatedtrihedron_display(view->WsId, cubic); -} - -void EXPORT call_togl_graduatedtrihedron_erase(CALL_DEF_VIEW* view) -{ - call_graduatedtrihedron_erase(view->WsId); -} - -void EXPORT call_togl_graduatedtrihedron_minmaxvalues(float xmin, float ymin, float zmin, - float xmax, float ymax, float zmax) -{ - call_graduatedtrihedron_minmaxvalues(xmin, ymin, zmin, xmax, ymax, zmax); -} diff --git a/src/OpenGl/OpenGl_togl_group.cxx b/src/OpenGl/OpenGl_togl_group.cxx deleted file mode 100755 index b6ea881728..0000000000 --- a/src/OpenGl/OpenGl_togl_group.cxx +++ /dev/null @@ -1,45 +0,0 @@ -/*********************************************************************** - -FONCTION : ----------- -File OpenGl_togl_group.c : - - -REMARQUES: ----------- - -HISTORIQUE DES MODIFICATIONS : --------------------------------- -xx-xx-xx : xxx ; Creation. -03-03-98 : CAL ; Modification des structures CALL_DEF_GROUP et STRUCTURE - -************************************************************************/ - -/*----------------------------------------------------------------------*/ -/* -* Includes -*/ - -/*----------------------------------------------------------------------*/ - -#include -#include -#include -#include - -void EXPORT -call_togl_group -( - CALL_DEF_GROUP * agroup - ) -{ - call_func_set_edit_mode (CALL_PHIGS_EDIT_INSERT); - call_func_open_struct (agroup->Struct->Id); - call_func_set_elem_ptr (0); - call_func_set_elem_ptr_label (agroup->StructureEnd); - call_func_offset_elem_ptr (-1); - call_func_label (agroup->LabelBegin); - call_func_label (agroup->LabelEnd); - call_func_close_struct (); - return; -} diff --git a/src/OpenGl/OpenGl_togl_highlightcolor.cxx b/src/OpenGl/OpenGl_togl_highlightcolor.cxx deleted file mode 100755 index 4781f41515..0000000000 --- a/src/OpenGl/OpenGl_togl_highlightcolor.cxx +++ /dev/null @@ -1,44 +0,0 @@ - -#include - -#include -#include - -#include -#include -#include -#include -#include - -void EXPORT -call_togl_highlightcolor -( - CALL_DEF_STRUCTURE * astructure, - CALL_DEF_COLOR * acolor, - int create - ) -{ - Tint index; - TEL_HIGHLIGHT hrep = { TelHLForcedColour }; - - call_func_set_edit_mode (CALL_PHIGS_EDIT_REPLACE); - call_func_open_struct (astructure->Id); - call_func_set_elem_ptr (0); - call_func_del_elems_labels (Structure_LABHighlight, Structure_LABVisibility); - call_func_close_struct (); - - if (create) { - call_func_set_edit_mode (CALL_PHIGS_EDIT_INSERT); - call_func_open_struct (astructure->Id); - call_func_set_elem_ptr (0); - call_func_set_elem_ptr_label(Structure_LABHighlight); - index = call_util_rgbindex(acolor->r, acolor->g, acolor->b); - hrep.col.rgb[0] = acolor->r, - hrep.col.rgb[1] = acolor->g, - hrep.col.rgb[2] = acolor->b; - TelSetHighlightRep (0, index, &hrep); - call_subr_set_highl_rep (index); - call_func_close_struct (); - } - return; -} diff --git a/src/OpenGl/OpenGl_togl_init_pick.cxx b/src/OpenGl/OpenGl_togl_init_pick.cxx deleted file mode 100755 index 58f8aa0cbc..0000000000 --- a/src/OpenGl/OpenGl_togl_init_pick.cxx +++ /dev/null @@ -1,8 +0,0 @@ - -#include - -EXPORT void /* redundant */ -call_togl_init_pick () -{ - return; -} diff --git a/src/OpenGl/OpenGl_togl_inquirefacilities.cxx b/src/OpenGl/OpenGl_togl_inquirefacilities.cxx deleted file mode 100755 index 675ca9f2fb..0000000000 --- a/src/OpenGl/OpenGl_togl_inquirefacilities.cxx +++ /dev/null @@ -1,47 +0,0 @@ -/*********************************************************************** - -FONCTION : ----------- -File OpenGl_togl_inquirefacilities : - - -REMARQUES: ----------- - - -HISTORIQUE DES MODIFICATIONS : --------------------------------- -xx-xx-xx : xxx ; Creation. -12-02-97 : FMN ; Suppression TelEnquireFacilities() -En fait la plupart de ces valeurs ne servent a rien. - -************************************************************************/ - -/*----------------------------------------------------------------------*/ -/* -* Includes -*/ - -#include -#include -#include -#include - -int call_togl_inquirelight (void); - -CALL_DEF_INQUIRE call_facilities_list; - -void EXPORT -call_togl_inquirefacilities () -{ - call_facilities_list.AntiAliasing = 1; - call_facilities_list.DepthCueing = 1; - call_facilities_list.DoubleBuffer = 1; - call_facilities_list.ZBuffer = 1; - - call_togl_inquirelight(); - call_togl_inquireplane(); - call_togl_inquireview(); - - return; -} diff --git a/src/OpenGl/OpenGl_togl_inquirelight.cxx b/src/OpenGl/OpenGl_togl_inquirelight.cxx deleted file mode 100755 index f23936fb5f..0000000000 --- a/src/OpenGl/OpenGl_togl_inquirelight.cxx +++ /dev/null @@ -1,32 +0,0 @@ -/*********************************************************************** - -FONCTION : ----------- -File OpenGl_togl_inquirelight.c : - - -REMARQUES: ----------- - - -HISTORIQUE DES MODIFICATIONS : --------------------------------- -xx-xx-xx : xxx ; Creation. -30-06-97 : FMN ; Appel de la toolkit OpenGl_LightBox. - -************************************************************************/ - -/*----------------------------------------------------------------------*/ -/* -* Includes -*/ - -#include -#include -#include - -int EXPORT -call_togl_inquirelight () -{ - return call_facilities_list.MaxLights = OpenGLMaxLights; -} diff --git a/src/OpenGl/OpenGl_togl_inquireplane.cxx b/src/OpenGl/OpenGl_togl_inquireplane.cxx index ebd6de8ce5..25327ca4ff 100755 --- a/src/OpenGl/OpenGl_togl_inquireplane.cxx +++ b/src/OpenGl/OpenGl_togl_inquireplane.cxx @@ -7,7 +7,6 @@ #endif #include -#include int EXPORT call_togl_inquireplane () @@ -19,7 +18,6 @@ call_togl_inquireplane () maxplanes -= 2; /* NOTE the 2 first planes are reserved for ZClipping */ if( maxplanes < 0 ) maxplanes = 0; - call_facilities_list.MaxPlanes = maxplanes; #endif } #ifdef DEBUG diff --git a/src/OpenGl/OpenGl_togl_inquireview.cxx b/src/OpenGl/OpenGl_togl_inquireview.cxx deleted file mode 100755 index 7dbb204c65..0000000000 --- a/src/OpenGl/OpenGl_togl_inquireview.cxx +++ /dev/null @@ -1,9 +0,0 @@ - -#include -#include - -int EXPORT -call_togl_inquireview () -{ - return call_facilities_list.MaxViews = 10000; -} diff --git a/src/OpenGl/OpenGl_togl_light.cxx b/src/OpenGl/OpenGl_togl_light.cxx deleted file mode 100755 index 130caa8749..0000000000 --- a/src/OpenGl/OpenGl_togl_light.cxx +++ /dev/null @@ -1,17 +0,0 @@ - -#include -#include -#include - -long EXPORT -call_togl_light -( - CALL_DEF_LIGHT * alight, - long update - ) -{ - static long NbLights = 1; - - /* rest of the code is redundant */ - return update ? alight->LightId : NbLights++; -} diff --git a/src/OpenGl/OpenGl_togl_light_exploration.cxx b/src/OpenGl/OpenGl_togl_light_exploration.cxx deleted file mode 100755 index 1e39fce15b..0000000000 --- a/src/OpenGl/OpenGl_togl_light_exploration.cxx +++ /dev/null @@ -1,35 +0,0 @@ -/*********************************************************************** - -FONCTION : ----------- -File OpenGl_togl_light_exploration.c : - - -REMARQUES: ---------- -Not implemented - -HISTORIQUE DES MODIFICATIONS : --------------------------------- -xx-xx-xx : xxx ; Creation. -30-06-97 : FMN ; Suppression OpenGl_telem_light.h - -************************************************************************/ - -/*----------------------------------------------------------------------*/ -/* -* Includes -*/ - -#include -#include -#include - -void EXPORT -call_togl_light_exploration -( - CALL_DEF_LIGHT * alight - ) -{ - return; -} diff --git a/src/OpenGl/OpenGl_togl_linecontextgroup.cxx b/src/OpenGl/OpenGl_togl_linecontextgroup.cxx deleted file mode 100755 index b7c6f3237f..0000000000 --- a/src/OpenGl/OpenGl_togl_linecontextgroup.cxx +++ /dev/null @@ -1,170 +0,0 @@ -/*********************************************************************** - -FONCTION : ----------- -File OpenGl_linecontextgroup : - - -REMARQUES: ----------- - -HISTORIQUE DES MODIFICATIONS : --------------------------------- -xx-xx-xx : xxx ; Creation. -03-09-97 : FMN ; Ajout traitement Begin/EndPrimitives() -03-03-98 : CAL ; Modification des structures CALL_DEF_GROUP et STRUCTURE - -************************************************************************/ - -/*----------------------------------------------------------------------*/ -/* -* Includes -*/ - -#include -#include -#include -#include -#include -#include - -/*----------------------------------------------------------------------*/ - -void EXPORT -call_togl_linecontextgroup -( - CALL_DEF_GROUP * agroup, - int noinsert - ) -{ - /* for the group */ - Tfloat liner, lineg, lineb; - Tint linetype=0; - Tfloat linewidth; - - /* for the structure */ - Tfloat Liner, Lineg, Lineb; - Tint Linetype=0; - Tfloat Linewidth; - - /* - * Si le groupe est ouvert cela signifie que BeginPrimitives - * a ete utilise. - * Dans le cas des markers composes, il faut refermer temporairement - * le groupe pour eviter des insertions d'attributs aleatoires. - */ - if (agroup->IsOpen) call_togl_closegroup (agroup); - - if( agroup->ContextLine.IsDef ) - { - liner = agroup->ContextLine.Color.r; - lineg = agroup->ContextLine.Color.g; - lineb = agroup->ContextLine.Color.b; - - switch( agroup->ContextLine.LineType ) - { - case 0 : /* Aspect_TOL_SOLID */ - linetype = CALL_PHIGS_LINE_SOLID; - break; - case 1 : /* Aspect_DASH */ - linetype = CALL_PHIGS_LINE_DASH; - break; - case 2 : /* Aspect_TOL_DOT */ - linetype = CALL_PHIGS_LINE_DOT; - break; - case 3 : /* Aspect_TOL_DOTDASH */ - linetype = CALL_PHIGS_LINE_DASH_DOT; - break; - default : - break; - } - linewidth = (Tfloat)agroup->ContextLine.Width; - - Liner = agroup->Struct->ContextLine.Color.r; - Lineg = agroup->Struct->ContextLine.Color.g; - Lineb = agroup->Struct->ContextLine.Color.b; - - switch( agroup->Struct->ContextLine.LineType ) - { - case 0 : /* Aspect_TOL_SOLID */ - Linetype = CALL_PHIGS_LINE_SOLID; - break; - case 1 : /* Aspect_DASH */ - Linetype = CALL_PHIGS_LINE_DASH; - break; - case 2 : /* Aspect_TOL_DOT */ - Linetype = CALL_PHIGS_LINE_DOT; - break; - case 3 : /* Aspect_TOL_DOTDASH */ - Linetype = CALL_PHIGS_LINE_DASH_DOT; - break; - default : - break; - } - Linewidth = (Tfloat)agroup->Struct->ContextLine.Width; - - /*TransPers = agroup->TransformPersistenceFlag;*/ - - if( noinsert ) - { - if( agroup->ContextLine.IsSet ) - call_func_set_edit_mode( CALL_PHIGS_EDIT_REPLACE ); - else - call_func_set_edit_mode( CALL_PHIGS_EDIT_INSERT ); - call_func_open_struct( agroup->Struct->Id ); - - call_func_set_elem_ptr( 0 ); - call_func_set_elem_ptr_label( agroup->LabelBegin ); - if( agroup->PickId.IsSet ) - call_func_offset_elem_ptr( 1 ); - if( agroup->ContextLine.IsSet ) - call_func_offset_elem_ptr( 1 ); - call_subr_set_line_colr( liner, lineg, lineb ); - if( agroup->ContextLine.IsSet ) - call_func_offset_elem_ptr( 1 ); - call_func_set_linetype( linetype ); - if( agroup->ContextLine.IsSet ) - call_func_offset_elem_ptr( 1 ); - call_func_set_linewidth( linewidth ); - - call_func_set_elem_ptr_label( agroup->LabelEnd ); - call_func_offset_elem_ptr( -call_util_context_group_place( agroup ) - - 1 ); - if( agroup->ContextLine.IsSet ) - call_func_offset_elem_ptr( 1 ); - call_subr_set_line_colr( Liner, Lineg, Lineb ); - if( agroup->ContextLine.IsSet ) - call_func_offset_elem_ptr( 1 ); - call_func_set_linetype( Linetype ); - if( agroup->ContextLine.IsSet ) - call_func_offset_elem_ptr( 1 ); - call_func_set_linewidth( Linewidth ); - call_func_close_struct( ); - } /* no insert */ - - if( noinsert == 0 ) - { - call_func_set_edit_mode( CALL_PHIGS_EDIT_INSERT ); - call_func_open_struct( agroup->Struct->Id ); - - call_func_set_elem_ptr( 0 ); - call_func_set_elem_ptr_label( agroup->LabelEnd ); - call_func_offset_elem_ptr( -call_util_context_group_place( agroup ) - - 1 ); - call_subr_set_line_colr( liner, lineg, lineb ); - call_func_set_linetype( linetype ); - call_func_set_linewidth( linewidth ); - - if( !agroup->ContextLine.IsSet ) - { - call_subr_set_line_colr( Liner, Lineg, Lineb ); - call_func_set_linetype( Linetype ); - call_func_set_linewidth( Linewidth ); - } - call_func_close_struct(); - } /* insert */ - } - /* Voir commentaire en debut de fonction */ - if (agroup->IsOpen) call_togl_opengroup (agroup); - return; -} diff --git a/src/OpenGl/OpenGl_togl_marker.cxx b/src/OpenGl/OpenGl_togl_marker.cxx deleted file mode 100755 index 5ac196d252..0000000000 --- a/src/OpenGl/OpenGl_togl_marker.cxx +++ /dev/null @@ -1,20 +0,0 @@ - -#include -#include -#include -#include -#include -#include - -void EXPORT -call_togl_marker -( - CALL_DEF_GROUP * agroup, - CALL_DEF_MARKER * amarker - ) -{ - if (! agroup->IsOpen) call_togl_opengroup (agroup); - call_subr_marker (amarker); - if (! agroup->IsOpen) call_togl_closegroup (agroup); - return; -} diff --git a/src/OpenGl/OpenGl_togl_marker_set.cxx b/src/OpenGl/OpenGl_togl_marker_set.cxx deleted file mode 100755 index 7602945a6a..0000000000 --- a/src/OpenGl/OpenGl_togl_marker_set.cxx +++ /dev/null @@ -1,20 +0,0 @@ - -#include -#include -#include -#include -#include -#include - -void EXPORT -call_togl_marker_set -( - CALL_DEF_GROUP * agroup, - CALL_DEF_LISTMARKERS * almarkers - ) -{ - if (! agroup->IsOpen) call_togl_opengroup (agroup); - call_subr_marker_set (almarkers); - if (! agroup->IsOpen) call_togl_closegroup (agroup); - return; -} diff --git a/src/OpenGl/OpenGl_togl_markercontextgroup.cxx b/src/OpenGl/OpenGl_togl_markercontextgroup.cxx deleted file mode 100755 index 2fe77d3594..0000000000 --- a/src/OpenGl/OpenGl_togl_markercontextgroup.cxx +++ /dev/null @@ -1,283 +0,0 @@ -/*********************************************************************** - -FONCTION : ----------- -File OpenGl_togl_markercontextgroup.c : - - -REMARQUES: ----------- - -HISTORIQUE DES MODIFICATIONS : --------------------------------- -xx-xx-xx : xxx ; Creation. -03-03-98 : CAL ; Modification des structures CALL_DEF_GROUP et STRUCTURE - -************************************************************************/ - - -/*----------------------------------------------------------------------*/ -/* -* Includes -*/ - -#include -#include -#include -#include -#include -#include -#include - -/*----------------------------------------------------------------------*/ - -/*--------------------------------generate USERDEFINED marker--------begin-------*/ -#ifdef WNT -#include -#endif - -#include -#include - -#ifdef HAVE_CONFIG_H -#include -#endif -#ifdef HAVE_STDLIB_H -#include -#endif -#if defined(HAVE_MALLOC_H) || defined(WNT) -#include -#endif - -typedef struct -{ - int* IdList; - GLuint* DisplayIdList; - int Quantity; -} UserDefineMarkerStruct; - -static UserDefineMarkerStruct UDMS_Marker = { NULL, NULL, 0 }; - -int EXPORT GenerateMarkerBitmap( int theId, unsigned int theWidth, unsigned int theHeight, unsigned char* theArray ) -{ - int i = 0; - int anIndex = -1; - GLint w, h, size, k, l; - - for( ; i < UDMS_Marker.Quantity; i++ ) - { - if( UDMS_Marker.IdList[i] == theId ) - { - anIndex = i; - glDeleteLists( UDMS_Marker.DisplayIdList[i], 1 ); - if ( glGetError() != GL_NO_ERROR ) - return -1; - break; - } - } - if( anIndex == -1 ) - { - anIndex = UDMS_Marker.Quantity; - if( anIndex == 0 ) - { - UDMS_Marker.IdList = (int*)malloc( sizeof( int ) ); - UDMS_Marker.DisplayIdList = (GLuint*)malloc( sizeof( GLuint ) ); - } - else - { - UDMS_Marker.IdList = (int*) realloc( UDMS_Marker.IdList, (UDMS_Marker.Quantity + 1)*sizeof( int ) ); - UDMS_Marker.DisplayIdList = (GLuint*) realloc( UDMS_Marker.DisplayIdList, (UDMS_Marker.Quantity + 1)*sizeof( GLuint ) ); - } - UDMS_Marker.Quantity++; - } - - UDMS_Marker.IdList[anIndex] = theId; - UDMS_Marker.DisplayIdList[anIndex] = glGenLists( 1 ); - glNewList( UDMS_Marker.DisplayIdList[anIndex], GL_COMPILE ); - - w = ( GLsizei ) theWidth; - h = ( GLsizei ) theHeight; - glBitmap( w, h, - ( float )theWidth / ( float )2.0, - ( float )theHeight / ( float )2.0, - ( float )30.0, ( float )30.0, - ( GLubyte* )theArray ); - - glEndList(); - - return 0; -} - -GLuint EXPORT GetListIndex( int theId ) -{ - int i = 0; - for( ; i < UDMS_Marker.Quantity; i++ ) - { - if( UDMS_Marker.IdList[i] == theId ) - return UDMS_Marker.DisplayIdList[i]; - } - return -1; -} - -/*--------------------------------generate USERDEFINED marker---------end--------*/ - - -void EXPORT -call_togl_markercontextgroup -( - CALL_DEF_GROUP * agroup, - int noinsert - ) -{ - /* for the group */ - Tfloat markr, markg, markb; - Tint markertype; - Tfloat markerscale; - - /* for the structure */ - Tfloat Markr, Markg, Markb; - Tint Markertype; - Tfloat Markerscale; - - /* - * Si le groupe est ouvert cela signifie que BeginPrimitives - * a ete utilise. - * Dans le cas des markers composes, il faut refermer temporairement - * le groupe pour eviter des insertions d'attributs aleatoires. - */ - if (agroup->IsOpen) call_togl_closegroup (agroup); - - if( agroup->ContextMarker.IsDef ) - { - markr = agroup->ContextMarker.Color.r; - markg = agroup->ContextMarker.Color.g; - markb = agroup->ContextMarker.Color.b; - markertype = CALL_PHIGS_MARKER_CROSS; - switch( agroup->ContextMarker.MarkerType ) - { - case 0 : /* Aspect_TOM_POINT */ - markertype = CALL_PHIGS_MARKER_DOT; - break; - case 1 : /* Aspect_TOM_PLUS */ - markertype = CALL_PHIGS_MARKER_PLUS; - break; - case 2 : /* Aspect_TOM_STAR */ - markertype = CALL_PHIGS_MARKER_ASTERISK; - break; - case 3 : /* Aspect_TOM_O */ - markertype = CALL_PHIGS_MARKER_CIRCLE; - break; - case 4 : /* Aspect_TOM_X */ - markertype = CALL_PHIGS_MARKER_CROSS; - break; - case 13 : /* Aspect_TOM_USERDEFINED */ - markertype = CALL_PHIGS_MARKER_USER_DEFINED; - break; - default : - break; - } - markerscale = (Tfloat)agroup->ContextMarker.Scale; - - Markr = agroup->Struct->ContextMarker.Color.r; - Markg = agroup->Struct->ContextMarker.Color.g; - Markb = agroup->Struct->ContextMarker.Color.b; - Markertype = CALL_PHIGS_MARKER_CROSS; - switch( agroup->Struct->ContextMarker.MarkerType ) - { - case 0 : /* Aspect_TOM_POINT */ - Markertype = CALL_PHIGS_MARKER_DOT; - break; - case 1 : /* Aspect_TOM_PLUS */ - Markertype = CALL_PHIGS_MARKER_PLUS; - break; - case 2 : /* Aspect_TOM_STAR */ - Markertype = CALL_PHIGS_MARKER_ASTERISK; - break; - case 3 : /* Aspect_TOM_O */ - Markertype = CALL_PHIGS_MARKER_CIRCLE; - break; - case 4 : /* Aspect_TOM_X */ - Markertype = CALL_PHIGS_MARKER_CROSS; - break; - case 13 : /* Aspect_TOM_USERDEFINED*/ - markertype = CALL_PHIGS_MARKER_USER_DEFINED; - break; - default : - break; - } - Markerscale = (Tfloat)agroup->Struct->ContextMarker.Scale; - - if( noinsert ) - { - if( agroup->ContextMarker.IsSet ) - call_func_set_edit_mode( CALL_PHIGS_EDIT_REPLACE ); - else - call_func_set_edit_mode( CALL_PHIGS_EDIT_INSERT ); - call_func_open_struct( agroup->Struct->Id ); - - call_func_set_elem_ptr( 0 ); - call_func_set_elem_ptr_label( agroup->LabelBegin ); - if( agroup->PickId.IsSet ) - call_func_offset_elem_ptr( 1 ); - if( agroup->ContextLine.IsSet ) - call_func_offset_elem_ptr( CALL_DEF_CONTEXTLINE_SIZE ); - if( agroup->ContextFillArea.IsSet ) - call_func_offset_elem_ptr( CALL_DEF_CONTEXTFILLAREA_SIZE ); - if( agroup->ContextMarker.IsSet ) - call_func_offset_elem_ptr( 1 ); - call_subr_set_marker_colr( markr, markg, markb ); - if( agroup->ContextMarker.IsSet ) - call_func_offset_elem_ptr( 1 ); - call_func_set_marker_type( markertype ); - if( agroup->ContextMarker.IsSet ) - call_func_offset_elem_ptr( 1 ); - call_func_set_marker_size( markerscale ); - - call_func_set_elem_ptr_label( agroup->LabelEnd ); - call_func_offset_elem_ptr(-call_util_context_group_place(agroup)-1); - if( agroup->ContextLine.IsSet ) - call_func_offset_elem_ptr( CALL_DEF_CONTEXTLINE_SIZE ); - if( agroup->ContextFillArea.IsSet ) - call_func_offset_elem_ptr( CALL_DEF_CONTEXTFILLAREA_SIZE ); - if( agroup->ContextMarker.IsSet ) - call_func_offset_elem_ptr( 1 ); - call_subr_set_marker_colr( Markr, Markg, Markb ); - if( agroup->ContextMarker.IsSet ) - call_func_offset_elem_ptr( 1 ); - call_func_set_marker_type( Markertype ); - if( agroup->ContextMarker.IsSet ) - call_func_offset_elem_ptr( 1 ); - call_func_set_marker_size( Markerscale ); - - call_func_close_struct(); - } /* no insert */ - - if( noinsert == 0 ) - { - call_func_set_edit_mode( CALL_PHIGS_EDIT_INSERT ); - call_func_open_struct( agroup->Struct->Id ); - - call_func_set_elem_ptr( 0 ); - call_func_set_elem_ptr_label( agroup->LabelEnd ); - call_func_offset_elem_ptr(-call_util_context_group_place(agroup)-1); - call_subr_set_marker_colr( markr, markg, markb ); - call_func_set_marker_type( markertype ); - call_func_set_marker_size( markerscale ); - - if( agroup->ContextLine.IsSet ) - call_func_offset_elem_ptr( CALL_DEF_CONTEXTLINE_SIZE ); - if( agroup->ContextFillArea.IsSet ) - call_func_offset_elem_ptr( CALL_DEF_CONTEXTFILLAREA_SIZE ); - if( !agroup->ContextMarker.IsSet ) - { - call_subr_set_marker_colr( Markr, Markg, Markb ); - call_func_set_marker_type( Markertype ); - call_func_set_marker_size( Markerscale ); - } - call_func_close_struct(); - } /* insert */ - } - /* Voir commentaire en debut de fonction */ - if (agroup->IsOpen) call_togl_opengroup (agroup); - return; -} diff --git a/src/OpenGl/OpenGl_togl_namesetstructure.cxx b/src/OpenGl/OpenGl_togl_namesetstructure.cxx deleted file mode 100755 index d8509b0d17..0000000000 --- a/src/OpenGl/OpenGl_togl_namesetstructure.cxx +++ /dev/null @@ -1,32 +0,0 @@ - -#include - -#include -#include - -#include -#include -#include - -void EXPORT -call_togl_namesetstructure -( - CALL_DEF_STRUCTURE * astructure - ) -{ - Tint nameset[3]; - - nameset[0] = astructure->highlight ? CALL_DEF_STRUCTHIGHLIGHTED : CALL_DEF_STRUCTNOHIGHLIGHTED; - nameset[1] = astructure->visible ? CALL_DEF_STRUCTVISIBLE : CALL_DEF_STRUCTNOVISIBLE; - nameset[2] = astructure->pick ? CALL_DEF_STRUCTPICKABLE : CALL_DEF_STRUCTNOPICKABLE; - - call_func_set_edit_mode(CALL_PHIGS_EDIT_REPLACE); - call_func_open_struct(astructure->Id); - call_func_set_elem_ptr(0); - call_func_set_elem_ptr_label(Structure_LABNameSet); - call_func_offset_elem_ptr(1); - call_subr_addnameset(3, nameset); - call_func_close_struct(); - - return; -} diff --git a/src/OpenGl/OpenGl_togl_opengroup.cxx b/src/OpenGl/OpenGl_togl_opengroup.cxx deleted file mode 100755 index d0523c6e6b..0000000000 --- a/src/OpenGl/OpenGl_togl_opengroup.cxx +++ /dev/null @@ -1,57 +0,0 @@ -/*********************************************************************** - -FONCTION : ----------- -File OpenGl_togl_opengroup.c : - - -REMARQUES: ----------- - -HISTORIQUE DES MODIFICATIONS : --------------------------------- -xx-xx-xx : xxx ; Creation. -03-03-98 : CAL ; Modification des structures CALL_DEF_GROUP et STRUCTURE - -************************************************************************/ - -/*----------------------------------------------------------------------*/ -/* -* Includes -*/ - -#include - -#include -#include -#include -#include - -/*----------------------------------------------------------------------*/ - -/* -call_togl_opengroup (agroup) -CALL_DEF_GROUP * agroup - -Opens the associated structure and sets the pointer -at the end of the primitives. - -Method : - -- go to the end of the group in the specified structure. -- skip the structure element which set all attributes of the structure. - -*/ - -void EXPORT -call_togl_opengroup -( - CALL_DEF_GROUP * agroup - ) -{ - call_func_set_edit_mode (CALL_PHIGS_EDIT_INSERT); - call_func_open_struct (agroup->Struct->Id); - call_func_set_elem_ptr (0); - call_func_set_elem_ptr_label (agroup->LabelEnd); - call_func_offset_elem_ptr (- call_util_context_group_place (agroup) - 1); -} diff --git a/src/OpenGl/OpenGl_togl_parray.cxx b/src/OpenGl/OpenGl_togl_parray.cxx deleted file mode 100755 index 66b655b141..0000000000 --- a/src/OpenGl/OpenGl_togl_parray.cxx +++ /dev/null @@ -1,92 +0,0 @@ -/* -File OpenGl_togl_parray.c -Created 16/06/2000 : ATS : G005 -*/ - -#include -#include -#include -#include -#include -#include - -void EXPORT call_togl_parray -( - CALL_DEF_GROUP *agroup, - CALL_DEF_PARRAY *parray - ) -{ - if (! agroup->IsOpen) call_togl_opengroup (agroup); - call_subr_parray (parray); - if (! agroup->IsOpen) call_togl_closegroup (agroup); - return; -} - -//======================================================================= -//function : call_togl_parray_remove -//purpose : Remove the driver's element corresponding to the primitives -// array and clean its visualization data. The driver -// clears all its references to array and stops displaying it. -// is the group that has added to driver. -//======================================================================= - -void EXPORT call_togl_parray_remove (CALL_DEF_GROUP* theGroup, - CALL_DEF_PARRAY* thePArray) -{ - CALL_DEF_PARRAY* anElData; - Tint aBegId, aEndId, aCurId; - TSM_ELEM anElem; - - // set edit mode and open struct - call_func_set_edit_mode (CALL_PHIGS_EDIT_REPLACE); - call_func_open_struct (theGroup->Struct->Id); - - // get begin label - call_func_set_elem_ptr (0); - if (call_func_set_elem_ptr_label (theGroup->LabelBegin) == TFailure) - return; - call_func_inq_elem_ptr (&aBegId); - - // get end label - if (call_func_set_elem_ptr_label (theGroup->LabelEnd) == TFailure) - return; - call_func_inq_elem_ptr (&aEndId); - - // iterate between labels and search for the array - if (aBegId != aEndId) - { - // move one element back - if (call_func_offset_elem_ptr (-1) == TFailure || - call_func_inq_elem_ptr (&aCurId) == TFailure) - return; - - // iterate from end label to begin label - while (aCurId > aBegId) - { - call_func_inq_elem (&anElem); - - // compare element with the array - if (anElem.el == TelParray && anElem.data.pdata == (void* )thePArray) - { - anElData = (CALL_DEF_PARRAY* )anElem.data.pdata; - - // validate for correct pointer - if (anElData->num_bounds == thePArray->num_bounds && - anElData->num_edges == thePArray->num_edges && - anElData->num_vertexs == thePArray->num_vertexs && - anElData->type == thePArray->type) - { - call_func_del_elem(); - break; - } - } - else - { - call_func_offset_elem_ptr (-1); - call_func_inq_elem_ptr (&aCurId); - } - } - } - - call_func_close_struct(); -} diff --git a/src/OpenGl/OpenGl_togl_pick.cxx b/src/OpenGl/OpenGl_togl_pick.cxx deleted file mode 100755 index 8ec1fab44d..0000000000 --- a/src/OpenGl/OpenGl_togl_pick.cxx +++ /dev/null @@ -1,50 +0,0 @@ -/*********************************************************************** - -FONCTION : ----------- -File OpenGl_togl_pick : - - -REMARQUES: ----------- - - -HISTORIQUE DES MODIFICATIONS : --------------------------------- -xx-xx-xx : xxx ; Creation. -06-03-96 : FMN ; Ajout OpenGl_tgl_tox.h pour call_thedisplay -01-04-96 : CAL ; Integration MINSK portage WNT -05-02-97 : FMN ; Suppression de OpenGl_tgl_vis.h - -************************************************************************/ - -/*----------------------------------------------------------------------*/ -/* -* Includes -*/ - -#include -#include -#include -#include -#include - - -/*----------------------------------------------------------------------*/ - -void EXPORT -call_togl_pick -( - CALL_DEF_PICK *apick - ) -{ - call_tox_rect( apick->WsId, - TxglGetSubWindow( call_thedisplay, (WINDOW)apick->DefWindow.XWindow) - , apick->x, apick->y ); - apick->Pick.depth = 0; - if( apick->x <= apick->DefWindow.dx && - apick->y <= apick->DefWindow.dy ) - call_subr_pick( apick ); - return; -} -/*----------------------------------------------------------------------*/ diff --git a/src/OpenGl/OpenGl_togl_pickid.cxx b/src/OpenGl/OpenGl_togl_pickid.cxx deleted file mode 100755 index c12e3ab217..0000000000 --- a/src/OpenGl/OpenGl_togl_pickid.cxx +++ /dev/null @@ -1,63 +0,0 @@ -/*********************************************************************** - -FONCTION : ----------- -File OpenGl_togl_pickid.c : - - -REMARQUES: ----------- - -HISTORIQUE DES MODIFICATIONS : --------------------------------- -xx-xx-xx : xxx ; Creation. -03-03-98 : CAL ; Modification des structures CALL_DEF_GROUP et STRUCTURE - -************************************************************************/ - -/*----------------------------------------------------------------------*/ -/* -* Includes -*/ - -#include -#include -#include -#include -#include - -/*----------------------------------------------------------------------*/ - -void EXPORT -call_togl_pickid -( - CALL_DEF_GROUP * agroup - ) -{ - call_func_open_struct( agroup->Struct->Id ); - call_func_set_elem_ptr( 0 ); - call_func_set_elem_ptr_label( agroup->LabelBegin ); - if( agroup->PickId.IsDef ) - { - if( agroup->PickId.IsSet ) - { - call_func_offset_elem_ptr( 1 ); - call_func_set_edit_mode( CALL_PHIGS_EDIT_REPLACE ); - } - else - call_func_set_edit_mode( CALL_PHIGS_EDIT_INSERT ); - - call_func_set_pick_id( agroup->PickId.Value ); - } - else - { - if( agroup->PickId.IsSet ) - { - call_func_offset_elem_ptr( 1 ); - call_func_del_elem(); - } - } - call_func_close_struct(); - - return; -} diff --git a/src/OpenGl/OpenGl_togl_plane.cxx b/src/OpenGl/OpenGl_togl_plane.cxx deleted file mode 100755 index 0e1565b36e..0000000000 --- a/src/OpenGl/OpenGl_togl_plane.cxx +++ /dev/null @@ -1,40 +0,0 @@ -/*********************************************************************** - -FONCTION : ----------- -File OpenGl_togl_plane : - - -REMARQUES: ----------- - - -HISTORIQUE DES MODIFICATIONS : --------------------------------- -xx-xx-xx : xxx ; Creation. -05-02-97 : FMN ; Suppression de OpenGl_tgl_vis.h - -************************************************************************/ - -/*----------------------------------------------------------------------*/ -/* -* Includes -*/ - -#include -#include -#include - -long EXPORT -call_togl_plane -( - CALL_DEF_PLANE * aplane, - long update - ) -{ - static long NbPlanes = 1; - - /* rest of the code is redundant */ - - return update ? aplane->PlaneId : NbPlanes++; -} diff --git a/src/OpenGl/OpenGl_togl_polygon.cxx b/src/OpenGl/OpenGl_togl_polygon.cxx deleted file mode 100755 index 705271f85a..0000000000 --- a/src/OpenGl/OpenGl_togl_polygon.cxx +++ /dev/null @@ -1,52 +0,0 @@ -/*********************************************************************** - -FONCTION : ----------- -File OpenGl_togl_polygon.c : - - -REMARQUES: ----------- - - -HISTORIQUE DES MODIFICATIONS : --------------------------------- -05-08-97 : PCT ; Support texture mapping - -************************************************************************/ - -/*----------------------------------------------------------------------*/ -/* -* Includes -*/ - -#include -#include -#include -#include -#include -#include - -void EXPORT -call_togl_polygon -( - CALL_DEF_GROUP * agroup, - CALL_DEF_FACET * afacet - ) -{ - if (! agroup->IsOpen) call_togl_opengroup (agroup); - switch (afacet->TypePoints) { - case 1 : /* Vertex Coordinates Specified */ - if (afacet->NormalIsDefined) - call_subr_polygon_data (afacet); - else - call_subr_polygon (afacet); - break; - case 2 : /* Coordinates and Vertex Normal Specified */ - case 5 : /* Coordinates and Vertex Normal and Texture Coordinate Specified */ - call_subr_polygon_data (afacet); - break; - } - if (! agroup->IsOpen) call_togl_closegroup (agroup); - return; -} diff --git a/src/OpenGl/OpenGl_togl_polygon_holes.cxx b/src/OpenGl/OpenGl_togl_polygon_holes.cxx deleted file mode 100755 index cdda1f4b8b..0000000000 --- a/src/OpenGl/OpenGl_togl_polygon_holes.cxx +++ /dev/null @@ -1,32 +0,0 @@ - -#include -#include -#include -#include -#include -#include - -void EXPORT -call_togl_polygon_holes -( - CALL_DEF_GROUP * agroup, - CALL_DEF_LISTFACETS * alfacets - ) -{ -#ifdef OK - if (! agroup->IsOpen) call_togl_opengroup (agroup); - switch (alfacets->LFacets[0].TypePoints) { - case 1 : /* Vertex Coordinates Specified */ - if (alfacets->LFacets[0].NormalIsDefined) - call_subr_polygon_holes_data (alfacets); - else - call_subr_polygon_holes (alfacets); - break; - case 2 : /* Coordinates and Vertex Normal Specified */ - call_subr_polygon_holes_data (alfacets); - break; - } - if (! agroup->IsOpen) call_togl_closegroup (agroup); -#endif - return; -} diff --git a/src/OpenGl/OpenGl_togl_polygon_indices.cxx b/src/OpenGl/OpenGl_togl_polygon_indices.cxx deleted file mode 100755 index f23527121e..0000000000 --- a/src/OpenGl/OpenGl_togl_polygon_indices.cxx +++ /dev/null @@ -1,22 +0,0 @@ - -#include -#include -#include -#include -#include -#include - -void EXPORT -call_togl_polygon_indices -( - CALL_DEF_GROUP * agroup, - CALL_DEF_LISTPOINTS * alpoints, - CALL_DEF_LISTEDGES * aledges, - CALL_DEF_LISTINTEGERS * albounds - ) -{ - if (! agroup->IsOpen) call_togl_opengroup (agroup); - call_subr_polygon_indices (alpoints, aledges, albounds); - if (! agroup->IsOpen) call_togl_closegroup (agroup); - return; -} diff --git a/src/OpenGl/OpenGl_togl_polygon_set.cxx b/src/OpenGl/OpenGl_togl_polygon_set.cxx deleted file mode 100755 index 76b41e292d..0000000000 --- a/src/OpenGl/OpenGl_togl_polygon_set.cxx +++ /dev/null @@ -1,20 +0,0 @@ - -#include -#include -#include -#include -#include -#include - -void EXPORT -call_togl_polygon_set -( - CALL_DEF_GROUP * agroup, - CALL_DEF_LISTFACETS * alfacets - ) -{ - if (! agroup->IsOpen) call_togl_opengroup (agroup); - call_subr_polygon_set (alfacets); - if (! agroup->IsOpen) call_togl_closegroup (agroup); - return; -} diff --git a/src/OpenGl/OpenGl_togl_polyline.cxx b/src/OpenGl/OpenGl_togl_polyline.cxx deleted file mode 100755 index 61038a5b79..0000000000 --- a/src/OpenGl/OpenGl_togl_polyline.cxx +++ /dev/null @@ -1,27 +0,0 @@ - -#include -#include -#include -#include -#include -#include - -void EXPORT -call_togl_polyline -( - CALL_DEF_GROUP * agroup, - CALL_DEF_LISTPOINTS * alpoints - ) -{ - if (! agroup->IsOpen) call_togl_opengroup (agroup); - switch (alpoints->TypePoints) { - case 1 : /* Vertex Coordinates Specified */ - call_subr_polyline (alpoints); - break; - case 3 : /* Coordinates and Vertex Colour Specified */ - call_subr_polyline_data (alpoints); - break; - } - if (! agroup->IsOpen) call_togl_closegroup (agroup); - return; -} diff --git a/src/OpenGl/OpenGl_togl_project_raster.cxx b/src/OpenGl/OpenGl_togl_project_raster.cxx deleted file mode 100755 index d512d4cafc..0000000000 --- a/src/OpenGl/OpenGl_togl_project_raster.cxx +++ /dev/null @@ -1,74 +0,0 @@ -/*********************************************************************** - -FONCTION : ----------- -File OpenGl_togl_project_raster : - - -REMARQUES: ----------- - - -HISTORIQUE DES MODIFICATIONS : --------------------------------- -24-05-96 : CAL ; Creation -12-06-98 : CAL ; Modification respecter l'origine top-left. - -************************************************************************/ - -/*----------------------------------------------------------------------*/ -/* -* Includes -*/ -#include -#include -#include -#include - -//For right copution of projection befor dumping to pixmap -int call_togl_adopt_to_rect( int wsid, int width, int height ) { - CMN_KEY_DATA key; - TStatus result; - - key.ldata = width; - result = TsmSetWSAttri (wsid, WSWidth, &key); - if (result != TSuccess) - return 1; - - key.ldata = height; - result = TsmSetWSAttri (wsid, WSHeight, &key); - if (result != TSuccess) - return 1; - - return 0; -} - -int call_togl_project_raster -( - int wsid, - float x, - float y, - float z, - int *ixr, - int *iyr - ) -{ - TStatus result; - float xr, yr; - - Tint h; - CMN_KEY_DATA key; - - TsmGetWSAttri (wsid, WSHeight, &key); - h = key.ldata; - - result = TelProjectionRaster (wsid, x, y, z, &xr, &yr); - - if (result == TSuccess) { - *ixr = (int) xr; - *iyr = h - (int) yr; - return (0); - } - else - return (1); -} diff --git a/src/OpenGl/OpenGl_togl_quadrangle.cxx b/src/OpenGl/OpenGl_togl_quadrangle.cxx deleted file mode 100755 index f1eac5cd2c..0000000000 --- a/src/OpenGl/OpenGl_togl_quadrangle.cxx +++ /dev/null @@ -1,20 +0,0 @@ - -#include -#include -#include -#include -#include -#include - -void EXPORT -call_togl_quadrangle -( - CALL_DEF_GROUP * agroup, - CALL_DEF_QUAD * aquad - ) -{ - if (! agroup->IsOpen) call_togl_opengroup (agroup); - call_subr_quadrangle (aquad); - if (! agroup->IsOpen) call_togl_closegroup (agroup); - return; -} diff --git a/src/OpenGl/OpenGl_togl_ratio_window.cxx b/src/OpenGl/OpenGl_togl_ratio_window.cxx deleted file mode 100755 index 8a7f0f8abb..0000000000 --- a/src/OpenGl/OpenGl_togl_ratio_window.cxx +++ /dev/null @@ -1,54 +0,0 @@ -/*********************************************************************** - -FONCTION : ----------- -File OpenGl_togl_ration_window : - - -REMARQUES: ----------- - -HISTORIQUE DES MODIFICATIONS : --------------------------------- -xx-xx-xx : xxx ; Creation. -02-07-96 : FMN ; Suppression WSWSHeight et WSWSWidth -05-02-97 : FMN ; Suppression de OpenGl_tgl_vis.h - -************************************************************************/ -#define IMP100701 /* GG Prevent window resizing on when redraw -in a pixmap -*/ - -/*----------------------------------------------------------------------*/ -/* -* Includes -*/ - -#include -#include -#include -#include -#include -#include - -void EXPORT -call_togl_ratio_window -( - CALL_DEF_VIEW * aview - ) -{ - CMN_KEY_DATA k; - -#ifdef IMP100701 - if( aview->DefBitmap.bitmap ) return; -#endif - - call_subr_resize( aview ); - - k.ldata = ( Tint )aview->DefWindow.dx; - TsmSetWSAttri( aview->WsId, WSWidth, &k ); - k.ldata = ( Tint )aview->DefWindow.dy; - TsmSetWSAttri( aview->WsId, WSHeight, &k ); - - return; -} diff --git a/src/OpenGl/OpenGl_togl_redraw.cxx b/src/OpenGl/OpenGl_togl_redraw.cxx deleted file mode 100755 index 377d3c29c2..0000000000 --- a/src/OpenGl/OpenGl_togl_redraw.cxx +++ /dev/null @@ -1,190 +0,0 @@ -/*********************************************************************** - -FONCTION : ----------- -file OpenGl_togl_redraw.c : - - -REMARQUES: ----------- - - -HISTORIQUE DES MODIFICATIONS : --------------------------------- -xx-xx-xx : CAL ; Creation. -23-01-97 : CAL : Ajout pour mettre des traces facilement -apres lancement de Designer -05-02-97 : FMN ; Suppression de OpenGl_tgl_vis.h -03-03-97 : FMN ; (PRO4063) Ajout displaylist pour le mode transient -07-10-97 : FMN ; Simplification WNT -08-08-98 : FMN ; ajout PRINT debug -18-11-98 : CAL ; S4062. Ajout des layers. -15-11-99 : GG ; Add call_togl_redraw_area() -15-11-99 : VKH ; G004 redrawing view to a large pixmap -02.01.100 : JR : = 0 for Integer and = NULL for pointers -02.02.100 " #include for declaration of gluErrorString -07-03-00 : GG : G004 use the already created pixmap. -Enable two side lighting before redrawing in pixmap. - -************************************************************************/ - -#define G004 /* VKH 15-11-99 redrawing view to a large pixmap -*/ - -#define RIC120302 /* GG Enable to use the application display -callback at end of traversal -Modified P. Dolbey 09/06/07 to call back -before redrawing the overlayer -*/ - -/*----------------------------------------------------------------------*/ -/* -* Includes -*/ - -#ifdef G004 -#ifndef WNT -#define CALL_DEF_STRING_LENGTH 132 -#else -#include -#endif -# include -GLboolean g_fBitmap; -#endif /*G004*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -void EXPORT -call_togl_redraw -( - CALL_DEF_VIEW * aview, - CALL_DEF_LAYER * anunderlayer, - CALL_DEF_LAYER * anoverlayer - ) -{ - CMN_KEY_DATA data; - Tint swap = 1; /* swap buffers ? yes */ - - if ( TsmGetWSAttri (aview->WsId, WSWindow, &data) != TSuccess ) return; - - WINDOW aWin = (WINDOW )data.ldata; - if (TxglWinset (call_thedisplay, aWin) == TSuccess) - { - OpenGl_FrameBuffer* aFrameBuffer = (OpenGl_FrameBuffer* )aview->ptrFBO; - GLint aViewPortBack[4]; glGetIntegerv (GL_VIEWPORT, aViewPortBack); - if (aFrameBuffer != NULL) - { - aFrameBuffer->SetupViewport(); - aFrameBuffer->BindBuffer(); - swap = 0; // no need to swap buffers - } - OpenGl_ResourceCleaner::GetInstance()->Cleanup(); - call_func_redraw_all_structs_begin (aview->WsId); - call_subr_displayCB (aview, OCC_REDRAW_WINDOW | OCC_PRE_REDRAW); - call_togl_setplane( aview ); - if (anunderlayer->ptrLayer) - { - call_togl_redraw_layer2d (aview, anunderlayer); - } - call_func_redraw_all_structs_proc (aview->WsId); - call_subr_displayCB (aview, OCC_REDRAW_WINDOW | OCC_PRE_OVERLAY); - if (anoverlayer->ptrLayer) - { - call_togl_redraw_layer2d (aview, anoverlayer); - } - call_subr_displayCB (aview, OCC_REDRAW_WINDOW); - call_func_redraw_all_structs_end (aview->WsId, swap); - call_togl_redraw_immediat_mode (aview); - - if (aFrameBuffer != NULL) - { - aFrameBuffer->UnbindBuffer(); - // move back original viewport - glViewport (aViewPortBack[0], aViewPortBack[1], aViewPortBack[2], aViewPortBack[3]); - } - } - -#ifdef WNT - if (OpenGl_AVIWriter_AllowWriting (aview->DefWindow.XWindow)) - { - GLint params[4]; - glGetIntegerv (GL_VIEWPORT, params); - int nWidth = params[2] & ~0x7; - int nHeight = params[3] & ~0x7; - - const int nBitsPerPixel = 24; - GLubyte* aDumpData = new GLubyte[nWidth * nHeight * nBitsPerPixel / 8]; - - glPixelStorei (GL_PACK_ALIGNMENT, 1); - glReadPixels (0, 0, nWidth, nHeight, GL_BGR_EXT, GL_UNSIGNED_BYTE, aDumpData); - OpenGl_AVIWriter_AVIWriter (aDumpData, nWidth, nHeight, nBitsPerPixel); - delete[] aDumpData; - } -#endif - - return; -} - -void EXPORT -call_togl_redraw_area -( - CALL_DEF_VIEW * aview, - CALL_DEF_LAYER * anunderlayer, - CALL_DEF_LAYER * anoverlayer, - int x, int y, int width, int height - ) -{ - CMN_KEY_DATA data; - - /* - When the exposure area size is > window size / 2 do a full redraw. - */ - if( width*height > - (int)(aview->DefWindow.dx*aview->DefWindow.dy)/2 ) { - call_togl_redraw(aview,anunderlayer,anoverlayer); - return; - } - /* - Or redraw only the area in the front buffer - */ - TsmGetWSAttri (aview->WsId, WSWindow, &data); - if (TxglWinset (call_thedisplay, (WINDOW) data.ldata) == TSuccess) - { - GLint buffer; - glGetIntegerv (GL_DRAW_BUFFER, &buffer); - if (buffer != GL_FRONT) glDrawBuffer (GL_FRONT); - glEnable (GL_SCISSOR_TEST); - glScissor ((GLint )x, - (GLint )((int )aview->DefWindow.dy - (y + height)), - (GLsizei )width, (GLsizei )height); - OpenGl_ResourceCleaner::GetInstance()->Cleanup(); - call_func_redraw_all_structs_begin (aview->WsId); - call_subr_displayCB (aview, OCC_REDRAW_WINDOWAREA | OCC_PRE_REDRAW); - call_togl_setplane( aview ); - if (anunderlayer->ptrLayer) - { - call_togl_redraw_layer2d (aview, anunderlayer); - } - call_func_redraw_all_structs_proc (aview->WsId); - call_subr_displayCB (aview, OCC_REDRAW_WINDOWAREA | OCC_PRE_OVERLAY); - if (anoverlayer->ptrLayer) - { - call_togl_redraw_layer2d (aview, anoverlayer); - } - call_subr_displayCB(aview,OCC_REDRAW_WINDOWAREA); - call_func_redraw_all_structs_end (aview->WsId, 0); - call_togl_redraw_immediat_mode (aview); - glFlush(); - glDisable (GL_SCISSOR_TEST); - if (buffer != GL_FRONT) glDrawBuffer (buffer); - } -} diff --git a/src/OpenGl/OpenGl_togl_removegroup.cxx b/src/OpenGl/OpenGl_togl_removegroup.cxx deleted file mode 100755 index 26ab17eef4..0000000000 --- a/src/OpenGl/OpenGl_togl_removegroup.cxx +++ /dev/null @@ -1,47 +0,0 @@ -/*********************************************************************** - -FONCTION : ----------- -File OpenGl_togl_removegroup.c : - - -REMARQUES: ----------- - -HISTORIQUE DES MODIFICATIONS : --------------------------------- -xx-xx-xx : xxx ; Creation. -03-03-98 : CAL ; Modification des structures CALL_DEF_GROUP et STRUCTURE - -************************************************************************/ - -/*----------------------------------------------------------------------*/ -/* -* Includes -*/ - -#include -#include -#include -#include - -/*----------------------------------------------------------------------*/ - -void EXPORT -call_togl_removegroup -( - CALL_DEF_GROUP * agroup - ) -{ - call_func_set_edit_mode (CALL_PHIGS_EDIT_REPLACE); - call_func_open_struct (agroup->Struct->Id); - call_func_set_elem_ptr (0); - call_func_del_elems_labels (agroup->LabelBegin, agroup->LabelEnd); - call_func_set_elem_ptr (0); - call_func_set_elem_ptr_label (agroup->LabelBegin); - call_func_del_elem (); - call_func_set_elem_ptr_label (agroup->LabelEnd); - call_func_del_elem (); - call_func_close_struct (); - return; -} diff --git a/src/OpenGl/OpenGl_togl_removestructure.cxx b/src/OpenGl/OpenGl_togl_removestructure.cxx deleted file mode 100755 index 486bf2aa51..0000000000 --- a/src/OpenGl/OpenGl_togl_removestructure.cxx +++ /dev/null @@ -1,14 +0,0 @@ - -#include -#include -#include - -void EXPORT -call_togl_removestructure -( - CALL_DEF_STRUCTURE * astructure - ) -{ - call_func_del_struct (astructure->Id); - return; -} diff --git a/src/OpenGl/OpenGl_togl_removeview.cxx b/src/OpenGl/OpenGl_togl_removeview.cxx deleted file mode 100755 index 6e51280c46..0000000000 --- a/src/OpenGl/OpenGl_togl_removeview.cxx +++ /dev/null @@ -1,17 +0,0 @@ - -#include -#include -#include -#include -#include - -void EXPORT -call_togl_removeview -( - CALL_DEF_VIEW * aview - ) -{ - call_func_del_struct (aview->ViewId); - call_subr_close_ws (aview); - return; -} diff --git a/src/OpenGl/OpenGl_togl_set_environment.cxx b/src/OpenGl/OpenGl_togl_set_environment.cxx deleted file mode 100755 index bc510d6f58..0000000000 --- a/src/OpenGl/OpenGl_togl_set_environment.cxx +++ /dev/null @@ -1,45 +0,0 @@ -/*********************************************************************** - -FONCTION : ----------- -file OpenGl_togl_set_environment : - - -REMARQUES: ----------- - - -HISTORIQUE DES MODIFICATIONS : --------------------------------- -xx-xx-xx : xxx ; Creation. -29-04-96 : FMN ; Correction Warning. - -************************************************************************/ - -/*----------------------------------------------------------------------*/ -/* -* Includes -*/ - -#include - -#include -#include -#include - - -void EXPORT -call_togl_set_environment -( - char * adisplay - ) -{ - int status; - - if (call_thedisplay == NULL) { - if (strlen (adisplay) != 0) - call_util_osd_putenv ((Tchar*)"DISPLAY", (Tchar*)adisplay); - status = call_tox_open_display (); - } - return; -} diff --git a/src/OpenGl/OpenGl_togl_setlight.cxx b/src/OpenGl/OpenGl_togl_setlight.cxx deleted file mode 100755 index edbb7b9fd2..0000000000 --- a/src/OpenGl/OpenGl_togl_setlight.cxx +++ /dev/null @@ -1,71 +0,0 @@ -/*********************************************************************** - -FONCTION : ----------- -Gestion des light sous OpenGL - - -REMARQUES: ----------- - -HISTORIQUE DES MODIFICATIONS : --------------------------------- -25-06-97 : PCT ; Appel de la toolkit OpenGl_LightBox -et correction de bug passage -plusieurs lights -> aucune lights - -************************************************************************/ - -#include - -#include -#include -#include - -#include -#include -#include - -#include -#include - -void EXPORT -call_togl_setlight -( - CALL_DEF_VIEW * aview - ) -{ - Tint *actl=0; - Tint i; - CALL_DEF_LIGHT alight; - CMN_KEY k; - - actl = new Tint[call_facilities_list.MaxLights]; - if( !actl ) - return; - - /* PCT ; 25-06-97 */ - ResetWksLight(aview->WsId); - - for( i =0; i < aview->Context.NbActiveLight && - i < call_facilities_list.MaxLights; i++ ) - { - alight = aview->Context.ActiveLight[i]; - actl[i] = alight.LightId; - call_subr_set_light_src_rep( &alight ); - } - - call_func_set_edit_mode(CALL_PHIGS_EDIT_REPLACE); - call_func_open_struct(aview->ViewId); - call_func_set_elem_ptr(0); - call_func_set_elem_ptr_label(View_LABLight); - call_func_offset_elem_ptr(1); - k.id = aview->Context.NbActiveLight; - k.data.pdata = actl; - TsmAddToStructure( TelLightSrcState, 1, &k ); - call_func_close_struct(); - - delete[] actl; - - return; -} diff --git a/src/OpenGl/OpenGl_togl_setplane.cxx b/src/OpenGl/OpenGl_togl_setplane.cxx deleted file mode 100755 index 437e844073..0000000000 --- a/src/OpenGl/OpenGl_togl_setplane.cxx +++ /dev/null @@ -1,60 +0,0 @@ -#define GER61454 //GG 14-09-99 Activates the model clipping planes - -#include -#include -#include -#include -#include -#include - - -struct TEL_VIEW_DATA -{ - TEL_VIEW_REP vrep; -#ifdef CAL_100498 - Tmatrix3 inverse_matrix;/* accelerates UVN2XYZ conversion */ -#endif - IMPLEMENT_MEMORY_OPERATORS -}; -typedef TEL_VIEW_DATA *tel_view_data; /* Internal data stored for every view rep */ - - -void EXPORT -/* unimplemented */ -call_togl_setplane -( - CALL_DEF_VIEW * aview - ) -{ -#ifdef GER61454 - - CMN_KEY_DATA key; - tel_view_data vptr; - TEL_VIEW_REP *call_viewrep; - CALL_DEF_PLANE *plane; - int j; - - // return view representation - - if( aview->ViewId == 0 ) - return; // no modifications on default view - - if( TsmGetWSAttri( aview->WsId, WSViews, &key ) != TSuccess ) - return; - - vptr = (tel_view_data)key.pdata; - if( !vptr ) - return; - - call_viewrep = &vptr->vrep; - - // clear clipping planes information - call_viewrep->clipping_planes.Clear(); - // update information - if( aview->Context.NbActivePlane > 0 ) - for( j=0 ; jContext.NbActivePlane ; j++ ) - call_viewrep->clipping_planes.Append( aview->Context.ActivePlane[j] ); - -#endif -return; -} diff --git a/src/OpenGl/OpenGl_togl_setvisualisation.cxx b/src/OpenGl/OpenGl_togl_setvisualisation.cxx deleted file mode 100755 index ecaa905320..0000000000 --- a/src/OpenGl/OpenGl_togl_setvisualisation.cxx +++ /dev/null @@ -1,131 +0,0 @@ -/*********************************************************************** - -FONCTION : ----------- -File OpenGl_togl_setvisualisation : - -TEST : ------- - -Le main TestOfDesktop.c permet de tester cette classe. - - -REMARQUES: ----------- - - -HISTORIQUE DES MODIFICATIONS : --------------------------------- -xx-xx-xx : xxx ; Creation. -17-07-96 : FMN ; Simplification du code -05-02-97 : FMN ; Suppression de OpenGl_tgl_vis.h -24-12-97 : FMN ; Suppression de call_func_set_back_int_shad_meth() - -************************************************************************/ - -/*----------------------------------------------------------------------*/ -/* -* Includes -*/ - - -#include - -#include -#include -#include - -#include -#include - -/*----------------------------------------------------------------------*/ - -void EXPORT -call_togl_setvisualisation -( - CALL_DEF_VIEW * aview - ) -{ - /* activation */ - call_func_set_edit_mode( CALL_PHIGS_EDIT_REPLACE ); - call_func_open_struct( aview->ViewId ); - call_func_set_elem_ptr( 0 ); - call_func_set_elem_ptr_label( View_LABViewContext ); - call_func_offset_elem_ptr( 1 ); - - switch( aview->Context.Visualization ) - { - case 0 : /* VISUAL3D_TOV_WIREFRAME */ - call_func_appl_data( 0 ); - - call_func_set_elem_ptr( 0 ); - call_func_set_elem_ptr_label( View_LABHlhsr ); - call_func_offset_elem_ptr( 1 ); - call_util_setvisualization ( - aview, - aview->Context.ZBufferActivity, - CALL_DEF_DISABLE_ZBUFFER); - break; - - case 1 : /* VISUAL3D_TOV_SHADING */ - switch( aview->Context.Model ) - { - case 0 : /* VISUAL3D_TOM_NONE */ - call_func_set_int_shad_meth( CALL_PHIGS_SD_NONE ); - - break; - - case 1 : /* VISUAL3D_TOM_INTERP_COLOR */ - call_func_set_int_shad_meth( CALL_PHIGS_SD_COLOUR ); - break; - - case 2 : /* VISUAL3D_TOM_FACET */ - call_func_set_int_shad_meth( CALL_PHIGS_SD_NORMAL ); - break; - - case 3 : /* VISUAL3D_TOM_VERTEX */ - call_func_set_int_shad_meth( CALL_PHIGS_SD_COLOUR ); - break; - - case 4 : /* VISUAL3D_TOM_HIDDENLINE */ - call_func_set_int_shad_meth( CALL_PHIGS_SD_NONE ); - break; - } - call_func_set_elem_ptr( 0 ); - call_func_set_elem_ptr_label( View_LABHlhsr ); - call_func_offset_elem_ptr( 1 ); - call_util_setvisualization ( - aview, - aview->Context.ZBufferActivity, - CALL_DEF_ENABLE_ZBUFFER); - break; - } - - call_func_close_struct(); - - return; -} - -/*----------------------------------------------------------------------*/ - -void call_util_setvisualization -( - CALL_DEF_VIEW * aView, - int ZBuffer, - int Mode - ) -{ - switch (ZBuffer) { - case -1 : /* non force */ - call_subr_hlhsr (aView, Mode); - break; - case 0 : /* force a "disable" */ - call_subr_hlhsr (aView, CALL_DEF_DISABLE_ZBUFFER); - break; - case 1 : /* force a "enable" */ - call_subr_hlhsr (aView, CALL_DEF_ENABLE_ZBUFFER); - break; - } -} - -/*----------------------------------------------------------------------*/ diff --git a/src/OpenGl/OpenGl_togl_structure.cxx b/src/OpenGl/OpenGl_togl_structure.cxx deleted file mode 100755 index 05c6d0aabb..0000000000 --- a/src/OpenGl/OpenGl_togl_structure.cxx +++ /dev/null @@ -1,69 +0,0 @@ -#define G003 /* EUG degeneration support -*/ - -#include - -#include -#include - -#include -#include -#include -#include - -void EXPORT -call_togl_structure -( - CALL_DEF_STRUCTURE * astructure - ) -{ - Tint struct_defined; - Tint nameset[3]; - - nameset[0] = astructure->highlight ? CALL_DEF_STRUCTHIGHLIGHTED - : CALL_DEF_STRUCTNOHIGHLIGHTED; - nameset[1] = astructure->visible ? CALL_DEF_STRUCTVISIBLE : - CALL_DEF_STRUCTNOVISIBLE; - nameset[2] = astructure->pick ? CALL_DEF_STRUCTPICKABLE : - CALL_DEF_STRUCTNOPICKABLE; - - struct_defined = call_util_test_structure( astructure->Id ); - - if( struct_defined ) - call_func_del_struct( astructure->Id ); - - call_func_set_edit_mode( CALL_PHIGS_EDIT_INSERT ); - call_func_open_struct( astructure->Id ); - call_func_label( Structure_LABBegin ); - call_func_label( Structure_LABTransformation ); - - /* ABD 29/10/04 Transform Persistence of Presentation( pan, zoom, rotate ) */ - call_func_label( Structure_LABTransPersistence ); - /* ABD 29/10/04 Transform Persistence of Presentation( pan, zoom, rotate ) */ - - call_func_appl_data (0); -#ifdef G003 - call_func_label ( Structure_LABDegenerateModel ); - call_func_offset_elem_ptr ( 1 ); - call_func_set_degenerate_model ( - astructure -> ContextFillArea.DegenerationMode, - astructure -> ContextFillArea.SkipRatio); -#endif /* G003 */ - call_func_label( Structure_LABContextLine ); - call_func_label( Structure_LABContextFillArea ); - call_func_label( Structure_LABContextMarker ); - call_func_label( Structure_LABContextText ); - call_func_label( Structure_LABHighlight ); - call_func_label( Structure_LABVisibility ); - call_func_label( Structure_LABPick ); - call_func_label( Structure_LABNameSet ); - call_subr_addnameset( 3, nameset ); - call_func_label( Structure_LABConnect ); - call_func_label( astructure->GroupBegin ); - call_func_label( astructure->GroupEnd ); - call_func_close_struct(); - - /* call_togl_contextstructure( astructure ); */ - - return; -} diff --git a/src/OpenGl/OpenGl_togl_structure_exploration.cxx b/src/OpenGl/OpenGl_togl_structure_exploration.cxx deleted file mode 100755 index 3a9ad631ce..0000000000 --- a/src/OpenGl/OpenGl_togl_structure_exploration.cxx +++ /dev/null @@ -1,49 +0,0 @@ -/*********************************************************************** - -FONCTION : ----------- -File OpenGl_togl_structure_exploration : - - -REMARQUES: ----------- - - -HISTORIQUE DES MODIFICATIONS : --------------------------------- -xx-xx-xx : xxx ; Creation. -11-03-96 : FMN ; Correction warning compilation -01-04-96 : CAL ; Integration MINSK portage WNT - -************************************************************************/ - -/*----------------------------------------------------------------------*/ -/* -* Includes -*/ - - -#include - -#include - -#include -#include - -void EXPORT -call_togl_structure_exploration -( - long Id, - long LabelBegin, - long LabelEnd - ) -{ - Tint type; - CALL_DEF_POINT pt; - CALL_DEF_NORMAL npt, nfa; - CALL_DEF_COLOR cpt; - - call_subr_structure_exploration (Id, LabelBegin, LabelEnd, 0, &type, &pt, &npt, &cpt, &nfa); - - return; -} diff --git a/src/OpenGl/OpenGl_togl_text.cxx b/src/OpenGl/OpenGl_togl_text.cxx deleted file mode 100755 index 9774902123..0000000000 --- a/src/OpenGl/OpenGl_togl_text.cxx +++ /dev/null @@ -1,83 +0,0 @@ - -#include -#include -#include -#include -#include -#include - -void EXPORT -call_togl_text -( - CALL_DEF_GROUP * agroup, - CALL_DEF_TEXT * atext - ) -{ - Tint path; - Tfloat up_vect[2]; - TEL_POINT text_pt; - Tint hor_align, ver_align; - - up_vect[0] = ( float )cos (atext->Angle); - up_vect[1] = ( float )sin (atext->Angle); - - switch (atext->Path) { - case 0: /* Graphic3d_TP_UP */ - path = CALL_PHIGS_PATH_UP; - break; - case 1: /* Graphic3d_TP_DOWN */ - path = CALL_PHIGS_PATH_DOWN; - break; - case 2: /* Graphic3d_TP_LEFT */ - path = CALL_PHIGS_PATH_LEFT; - break; - case 3: /* Graphic3d_TP_RIGHT */ - path = CALL_PHIGS_PATH_RIGHT; - break; - default: - path = CALL_PHIGS_PATH_RIGHT; - break; - } - - switch (atext->HAlign) { - case 0: /* Graphic3d_HTA_LEFT */ - hor_align = CALL_PHIGS_HOR_LEFT; - break; - case 1: /* Graphic3d_HTA_CENTER */ - hor_align = CALL_PHIGS_HOR_CENTER; - break; - case 2: /* Graphic3d_HTA_RIGHT */ - hor_align = CALL_PHIGS_HOR_RIGHT; - break; - default: - hor_align = CALL_PHIGS_HOR_LEFT; - break; - } - - switch (atext->VAlign) { - case 0: /* Graphic3d_VTA_BOTTOM */ - ver_align = CALL_PHIGS_VERT_BOTTOM; - break; - case 1: /* Graphic3d_VTA_CENTER */ - ver_align = CALL_PHIGS_VERT_CENTER; - break; - case 2: /* Graphic3d_VTA_TOP */ - ver_align = CALL_PHIGS_VERT_TOP; - break; - default: - ver_align = CALL_PHIGS_VERT_BOTTOM; - break; - } - - text_pt.xyz[0] = atext->Position.x; - text_pt.xyz[1] = atext->Position.y; - text_pt.xyz[2] = atext->Position.z; - - if (! agroup->IsOpen) call_togl_opengroup (agroup); - call_func_set_anno_char_ht (atext->Height); - call_func_set_anno_char_up_vec (up_vect); - call_func_set_anno_path (path); - call_func_set_anno_align (hor_align, ver_align); - call_func_anno_text_rel3 (&text_pt, (Techar*)atext->string); - if (! agroup->IsOpen) call_togl_closegroup (agroup); -} diff --git a/src/OpenGl/OpenGl_togl_textcontextgroup.cxx b/src/OpenGl/OpenGl_togl_textcontextgroup.cxx deleted file mode 100755 index dcea80732b..0000000000 --- a/src/OpenGl/OpenGl_togl_textcontextgroup.cxx +++ /dev/null @@ -1,248 +0,0 @@ -/*********************************************************************** - -FONCTION : ----------- -File OpenGl_textcontextgroup : - - -REMARQUES: ----------- - -HISTORIQUE DES MODIFICATIONS : --------------------------------- -xx-xx-xx : xxx ; Creation. -03-09-97 : FMN ; Ajout traitement Begin/EndPrimitives() -03-03-98 : CAL ; Modification des structures CALL_DEF_GROUP et STRUCTURE -30-11-98 : FMN ; S4069 : Textes toujours visibles - -************************************************************************/ - -/*----------------------------------------------------------------------*/ -/* -* Includes -*/ - - -#include -#include -#include -#include -#include -#include -#include - -#include - -/*----------------------------------------------------------------------*/ - -void EXPORT -call_togl_textcontextgroup -( - CALL_DEF_GROUP * agroup, - int noinsert - ) -{ - /* for the group */ - Tchar *fontid=NULL; - Tfloat textr, textg, textb; - Tfloat textrs, textgs, textbs; - Tfloat textspace; - Tfloat textexpan; - int textstyle, textdisplaytype; - int textzoomable; - float textangle; - OSD_FontAspect textfontaspect; - - /* for the structure */ - Tchar *Fontid=NULL; - Tfloat Textr, Textg, Textb; - Tfloat Textrs, Textgs, Textbs; - Tfloat Textspace; - Tfloat Textexpan; - int Textstyle, Textdisplaytype; - int Textzoomable; - float Textangle; - OSD_FontAspect Textfontaspect; - - /* - * Si le groupe est ouvert cela signifie que BeginPrimitives - * a ete utilise. - * Dans le cas des markers composes, il faut refermer temporairement - * le groupe pour eviter des insertions d'attributs aleatoires. - */ - if (agroup->IsOpen) call_togl_closegroup (agroup); - -#ifdef TRACE - - cout << "TKOpenGl::OpenGl_togl_textcontextgroup" - << "\t is defined : " << agroup->ContextText.IsDef << endl; -#endif - if( agroup->ContextText.IsDef ) - { - textr = agroup->ContextText.Color.r; - textg = agroup->ContextText.Color.g; - textb = agroup->ContextText.Color.b; - textrs = agroup->ContextText.ColorSubTitle.r; - textgs = agroup->ContextText.ColorSubTitle.g; - textbs = agroup->ContextText.ColorSubTitle.b; - - fontid = new Tchar[strlen((char*)agroup->ContextText.Font)+1]; - strcpy((char*)fontid,(char*)agroup->ContextText.Font); - - textspace = (Tfloat) agroup->ContextText.Space; - textexpan = (Tfloat) agroup->ContextText.Expan; - textstyle = (int) agroup->ContextText.Style; - textdisplaytype = (int) agroup->ContextText.DisplayType; - textzoomable = (int) agroup->ContextText.TextZoomable; - textangle = (float) agroup->ContextText.TextAngle; - textfontaspect = (OSD_FontAspect) agroup->ContextText.TextFontAspect; - - Textr = agroup->Struct->ContextText.Color.r; - Textg = agroup->Struct->ContextText.Color.g; - Textb = agroup->Struct->ContextText.Color.b; - - Textrs = agroup->Struct->ContextText.ColorSubTitle.r; - Textgs = agroup->Struct->ContextText.ColorSubTitle.g; - Textbs = agroup->Struct->ContextText.ColorSubTitle.b; - - Fontid = new Tchar[strlen((char*)agroup->Struct->ContextText.Font)+1]; - strcpy((char*)Fontid,(char*)agroup->Struct->ContextText.Font); - - Textspace = (Tfloat) agroup->Struct->ContextText.Space; - Textexpan = (Tfloat) agroup->Struct->ContextText.Expan; - Textstyle = (int) agroup->Struct->ContextText.Style; - Textdisplaytype = (int) agroup->Struct->ContextText.DisplayType; - Textzoomable = (int) agroup->Struct->ContextText.TextZoomable; - Textangle = (float) agroup->Struct->ContextText.TextAngle; - Textfontaspect = (OSD_FontAspect) agroup->Struct->ContextText.TextFontAspect; - - if( noinsert ) - { - if( agroup->ContextText.IsSet ) - call_func_set_edit_mode( CALL_PHIGS_EDIT_REPLACE ); - else - call_func_set_edit_mode( CALL_PHIGS_EDIT_INSERT ); - call_func_open_struct( agroup->Struct->Id ); - - call_func_set_elem_ptr( 0 ); - call_func_set_elem_ptr_label( agroup->LabelBegin ); - if( agroup->PickId.IsSet ) - call_func_offset_elem_ptr( 1 ); - if( agroup->ContextLine.IsSet ) - call_func_offset_elem_ptr( CALL_DEF_CONTEXTLINE_SIZE ); - if( agroup->ContextFillArea.IsSet ) - call_func_offset_elem_ptr( CALL_DEF_CONTEXTFILLAREA_SIZE ); - if( agroup->ContextMarker.IsSet ) - call_func_offset_elem_ptr( CALL_DEF_CONTEXTMARKER_SIZE ); - if( agroup->ContextText.IsSet ) - call_func_offset_elem_ptr( 1 ); - call_func_set_text_zoomable( textzoomable ); - call_func_set_text_angle( textangle ); - call_func_set_text_fontaspect( textfontaspect ); - - if( agroup->ContextText.IsSet ) - call_func_offset_elem_ptr( 1 ); - call_func_set_text_font( fontid ); - if( agroup->ContextText.IsSet ) - call_func_offset_elem_ptr( 1 ); - call_func_set_char_space( textspace ); - if( agroup->ContextText.IsSet ) - call_func_offset_elem_ptr( 1 ); - call_func_set_char_expan( textexpan ); - if( agroup->ContextText.IsSet ) - call_func_offset_elem_ptr( 1 ); - call_subr_set_text_colr( textr, textg, textb ); - if( agroup->ContextText.IsSet ) - call_func_offset_elem_ptr( 1 ); - call_func_set_text_style( textstyle ); - if( agroup->ContextText.IsSet ) - call_func_offset_elem_ptr( 1 ); - call_func_set_text_display_type( textdisplaytype ); - if( agroup->ContextText.IsSet ) - call_func_offset_elem_ptr( 1 ); - call_subr_set_text_colr_subtitle( textrs, textgs, textbs ); - - call_func_set_elem_ptr_label( agroup->LabelEnd ); - call_func_offset_elem_ptr(-call_util_context_group_place(agroup)-1); - if( agroup->ContextLine.IsSet ) - call_func_offset_elem_ptr( CALL_DEF_CONTEXTLINE_SIZE ); - if( agroup->ContextFillArea.IsSet ) - call_func_offset_elem_ptr( CALL_DEF_CONTEXTFILLAREA_SIZE ); - if( agroup->ContextMarker.IsSet ) - call_func_offset_elem_ptr( CALL_DEF_CONTEXTMARKER_SIZE ); - if( agroup->ContextText.IsSet ) - call_func_offset_elem_ptr( 1 ); - call_func_set_text_zoomable( Textzoomable); - call_func_set_text_angle( Textangle); - call_func_set_text_fontaspect( Textfontaspect); - - if( agroup->ContextText.IsSet ) - call_func_offset_elem_ptr( 1 ); - call_func_set_text_font( Fontid ); - if( agroup->ContextText.IsSet ) - call_func_offset_elem_ptr( 1 ); - call_func_set_char_space( Textspace ); - if( agroup->ContextText.IsSet ) - call_func_offset_elem_ptr( 1 ); - call_func_set_char_expan( Textexpan ); - if( agroup->ContextText.IsSet ) - call_func_offset_elem_ptr( 1 ); - call_subr_set_text_colr( Textr, Textg, Textb ); - if( agroup->ContextText.IsSet ) - call_func_offset_elem_ptr( 1 ); - call_func_set_text_style( Textstyle ); - if( agroup->ContextText.IsSet ) - call_func_offset_elem_ptr( 1 ); - call_func_set_text_display_type( Textdisplaytype ); - if( agroup->ContextText.IsSet ) - call_func_offset_elem_ptr( 1 ); - call_subr_set_text_colr_subtitle( Textrs, Textgs, Textbs ); - call_func_close_struct(); - } /* no insert */ - - if( noinsert == 0 ) - { - call_func_set_edit_mode( CALL_PHIGS_EDIT_INSERT ); - call_func_open_struct( agroup->Struct->Id ); - - call_func_set_elem_ptr( 0 ); - call_func_set_elem_ptr_label( agroup->LabelEnd ); - call_func_offset_elem_ptr(-call_util_context_group_place(agroup)-1); - call_func_set_text_zoomable( textzoomable ); - call_func_set_text_angle( textangle ); - call_func_set_text_fontaspect( textfontaspect ); - - call_func_set_text_font( fontid ); - call_func_set_char_space( textspace ); - call_func_set_char_expan( textexpan ); - call_subr_set_text_colr( textr, textg, textb ); - call_func_set_text_style( textstyle ); - call_func_set_text_display_type( textdisplaytype ); - call_subr_set_text_colr_subtitle( textrs, textgs, textbs ); - - if( agroup->ContextLine.IsSet ) - call_func_offset_elem_ptr( CALL_DEF_CONTEXTLINE_SIZE ); - if( agroup->ContextFillArea.IsSet ) - call_func_offset_elem_ptr( CALL_DEF_CONTEXTFILLAREA_SIZE ); - if( agroup->ContextMarker.IsSet ) - call_func_offset_elem_ptr( CALL_DEF_CONTEXTMARKER_SIZE ); - if( !agroup->ContextText.IsSet ) - { - call_func_set_text_zoomable( Textzoomable ); - call_func_set_text_angle( Textangle ); - call_func_set_text_fontaspect( Textfontaspect ); - call_func_set_text_font( Fontid ); - call_func_set_char_space( Textspace ); - call_func_set_char_expan( Textexpan ); - call_subr_set_text_colr( Textr, Textg, Textb ); - call_func_set_text_style( Textstyle ); - call_func_set_text_display_type( Textdisplaytype ); - call_subr_set_text_colr_subtitle( Textrs, Textgs, Textbs ); - } - call_func_close_struct(); - } /* insert */ - } - /* Voir commentaire en debut de fonction */ - if (agroup->IsOpen) call_togl_opengroup (agroup); - return; -} diff --git a/src/OpenGl/OpenGl_togl_texture.cxx b/src/OpenGl/OpenGl_togl_texture.cxx index ed810b7c8b..08afc5a1d2 100755 --- a/src/OpenGl/OpenGl_togl_texture.cxx +++ b/src/OpenGl/OpenGl_togl_texture.cxx @@ -26,16 +26,9 @@ Ajout coupure du texture mapping #include #include #include -#include -#include -#include #include #include -#include -#include -#include - #ifdef OCC1188 #include #endif @@ -140,23 +133,6 @@ call_togl_modify_texture /*----------------------------------------------------------------------*/ -void EXPORT -call_togl_environment(CALL_DEF_VIEW *aview) -{ - CMN_KEY_DATA data; - - if (call_togl_inquiretexture ()) - { - data.ldata = aview->Context.TexEnvId; - TsmSetWSAttri(aview->WsId, WSTextureEnv, &data); - - data.ldata = aview->Context.SurfaceDetail; - TsmSetWSAttri(aview->WsId, WSSurfaceDetail, &data); - } -} - -/*----------------------------------------------------------------------*/ - int EXPORT call_togl_inquiretexture () { @@ -166,100 +142,3 @@ call_togl_inquiretexture () return 1; #endif /* SUN */ } - -/*----------------------------------------------------------------------*/ - -#ifdef OCC1188 -void EXPORT call_togl_create_bg_texture( CALL_DEF_VIEW* view, int width, int height, - unsigned char* data, int style ) -{ - TSM_BG_TEXTURE tex; - tsm_bg_texture createdTex; - CMN_KEY_DATA cmnData; - CMN_KEY_DATA cmnKey; - GLuint texture = 0; - GLubyte *image = (GLubyte *)malloc(width * height * 3 * sizeof(GLubyte)); - memcpy( image, data, ( width * height * 3 ) ); - - /* check if some bg texture is already created */ - TsmGetWSAttri( view->WsId, WSBgTexture, &cmnData ); - createdTex = (tsm_bg_texture)cmnData.pdata; - if ( createdTex->texId != 0 ) - glDeleteTextures( 1, (GLuint*)&(createdTex->texId) ); - glGenTextures( 1, &texture ); - glBindTexture( GL_TEXTURE_2D, texture ); - /* Create MipMapped Texture */ - glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT ); - glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT ); - glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); - glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST); - gluBuild2DMipmaps( GL_TEXTURE_2D, 3/*4*/, width, height, GL_RGB, GL_UNSIGNED_BYTE, image ); - - tex.texId = texture; - tex.width = width; - tex.height = height; - switch ( style ) { - case 0 : - case 1 : - tex.style = TSM_FS_CENTER; - break; - case 2 : - tex.style = TSM_FS_TILE; - break; - case 3 : - tex.style = TSM_FS_STRETCH; - break; - default : - tex.style = TSM_FS_CENTER; - break; - } - - /* setting flag to update changes */ - cmnKey.ldata = TNotDone; - TsmSetWSAttri( view->WsId, WSUpdateState, &cmnKey ); - - /* storing background texture */ - cmnData.pdata = &tex; - TsmSetWSAttri( view->WsId, WSBgTexture, &cmnData ); - free( image ); -} - -/*----------------------------------------------------------------------*/ - -void EXPORT call_togl_set_bg_texture_style( CALL_DEF_VIEW* view, int style ) -{ - tsm_bg_texture texture; - CMN_KEY_DATA cmnData; - CMN_KEY_DATA cmnKey; - - /* check if background texture is already created */ - TsmGetWSAttri( view->WsId, WSBgTexture, &cmnData ); - texture = (tsm_bg_texture)cmnData.pdata; - if ( texture->texId != 0 ) { - switch ( style ) { - case 0 : - case 1 : - texture->style = TSM_FS_CENTER; - break; - case 2 : - texture->style = TSM_FS_TILE; - break; - case 3 : - texture->style = TSM_FS_STRETCH; - break; - default : - texture->style = TSM_FS_CENTER; - break; - } - - /* setting flag to update changes */ - cmnKey.ldata = TNotDone; - TsmSetWSAttri( view->WsId, WSUpdateState, &cmnKey ); - - /* storing background texture */ - cmnData.pdata = texture; - TsmSetWSAttri( view->WsId, WSBgTexture, &cmnData ); - } -} -#endif /* OCC1188 */ -/*----------------------------------------------------------------------*/ diff --git a/src/OpenGl/OpenGl_togl_transformstructure.cxx b/src/OpenGl/OpenGl_togl_transformstructure.cxx deleted file mode 100755 index cdddc2f028..0000000000 --- a/src/OpenGl/OpenGl_togl_transformstructure.cxx +++ /dev/null @@ -1,25 +0,0 @@ - -#include - -#include -#include - -#include -#include - -void EXPORT -call_togl_transformstructure -( - CALL_DEF_STRUCTURE * astructure - ) -{ - call_func_set_edit_mode (CALL_PHIGS_EDIT_REPLACE); - call_func_open_struct (astructure->Id); - call_func_set_elem_ptr (0); - call_func_set_elem_ptr_label (Structure_LABTransformation); - call_func_offset_elem_ptr (1); - call_func_set_local_tran3 (astructure->Transformation, CALL_PHIGS_TYPE_REPLACE); - call_func_close_struct (); - - return; -} diff --git a/src/OpenGl/OpenGl_togl_transparency.cxx b/src/OpenGl/OpenGl_togl_transparency.cxx deleted file mode 100755 index 352759bab7..0000000000 --- a/src/OpenGl/OpenGl_togl_transparency.cxx +++ /dev/null @@ -1,17 +0,0 @@ - -#include -#include -#include -#include - -void EXPORT -call_togl_transparency -( - int wsid, - int viewid, - int tag - ) -{ - call_subr_transparency (wsid, viewid, tag); - return; -} diff --git a/src/OpenGl/OpenGl_togl_triangle.cxx b/src/OpenGl/OpenGl_togl_triangle.cxx deleted file mode 100755 index e1ec2a776e..0000000000 --- a/src/OpenGl/OpenGl_togl_triangle.cxx +++ /dev/null @@ -1,20 +0,0 @@ - -#include -#include -#include -#include -#include -#include - -void EXPORT -call_togl_triangle -( - CALL_DEF_GROUP * agroup, - CALL_DEF_TRIKE * atrike - ) -{ - if (! agroup->IsOpen) call_togl_opengroup (agroup); - call_subr_triangle (atrike); - if (! agroup->IsOpen) call_togl_closegroup (agroup); - return; -} diff --git a/src/OpenGl/OpenGl_togl_triedron.cxx b/src/OpenGl/OpenGl_togl_triedron.cxx deleted file mode 100755 index 6dc335baa6..0000000000 --- a/src/OpenGl/OpenGl_togl_triedron.cxx +++ /dev/null @@ -1,123 +0,0 @@ -/*********************************************************************** - -FONCTION : ----------- -File OpenGl_togl_triedron : - - -REMARQUES: ----------- - - -HISTORIQUE DES MODIFICATIONS : --------------------------------- -17-09-98 : FMN/BGN ; Creation des points d'entree. -14-12-98 : BGN; Developpement (S3989, Phase "triedre") -15-12-98 : BGN; Ajout des WSUpdateState . - -************************************************************************/ - -/*----------------------------------------------------------------------*/ -/* -* Includes -*/ - - -#include -#include - -/* pour utiliser WSUpdateState et TsmSetWSAttri */ -#include -#include - -#include - -/*----------------------------------------------------------------------*/ -/* -* Constantes -*/ - -#define NO_PRINT - -/*----------------------------------------------------------------------*/ - -void EXPORT -call_togl_ztriedron_setup -( - float* xcolor, - float* ycolor, - float* zcolor, - float sizeratio, - float axisdiameter, - int nbfacettes - ) -{ - call_ztriedron_setup(xcolor, ycolor, zcolor, - sizeratio, axisdiameter, nbfacettes); -} - -void EXPORT -call_togl_triedron_display -( - CALL_DEF_VIEW * aview, - int aPosition, - float r, - float g, - float b, - float aScale, - int asWireframe - ) -{ - - CMN_KEY_DATA data; - TStatus status; - -#ifdef PRINT - printf("call_togl_triedron_display r = %f, g = %f, b = %f", r, g, b); - printf(", aScale = %f, aPosition = %d \n", aScale, aPosition ); -#endif - status = call_triedron_init (aview, aPosition, r, g, b, aScale, asWireframe); - - /* Mise a jour de l'update_mode */ - data.ldata = TNotDone; - TsmSetWSAttri(aview->WsId, WSUpdateState, &data ); - - - return; -} - - -void EXPORT -call_togl_triedron_erase -( - CALL_DEF_VIEW * aview - ) -{ - - CMN_KEY_DATA data; - -#ifdef PRINT - printf("call_togl_triedron_erase \n"); -#endif - call_triedron_erase (aview); - - /* Mise a jour de l'update_mode */ - data.ldata = TNotDone; - TsmSetWSAttri(aview->WsId, WSUpdateState, &data ); - - return; -} - - -void EXPORT -call_togl_triedron_echo -( - CALL_DEF_VIEW * aview, - int AType - ) -{ -#ifdef PRINT - printf("call_togl_triedron_echo \n"); -#endif - return; -} diff --git a/src/OpenGl/OpenGl_togl_unproject_raster.cxx b/src/OpenGl/OpenGl_togl_unproject_raster.cxx deleted file mode 100755 index 72bdad9ae3..0000000000 --- a/src/OpenGl/OpenGl_togl_unproject_raster.cxx +++ /dev/null @@ -1,87 +0,0 @@ -/*********************************************************************** - -FONCTION : ----------- -File OpenGl_togl_unproject_raster : - - -REMARQUES: ----------- - - -HISTORIQUE DES MODIFICATIONS : --------------------------------- -24-05-96 : CAL ; Creation - -************************************************************************/ - -/*----------------------------------------------------------------------*/ -/* -* Includes -*/ -#include -#include - -int EXPORT -call_togl_unproject_raster -( - int wsid, - int xm, - int ym, - int xM, - int yM, - int ixr, - int iyr, - float *x, - float *y, - float *z - ) -{ - TStatus result; - Tint xr, yr; - - xr = ixr; - /* - Patched by P.Dolbey: the window pixel height decreased by one - in order for yr to remain within valid coordinate range [0; Ym -1] - where Ym means window pixel height. - */ - yr = (yM-1)-ym-iyr; - result = TelUnProjectionRaster (wsid, xr, yr, x, y, z); - - if (result == TSuccess) - return (0); - else - return (1); -} - -int EXPORT -call_togl_unproject_raster_with_ray -( - int wsid, - int xm, - int ym, - int xM, - int yM, - int ixr, - int iyr, - float *x, - float *y, - float *z, - float *dx, - float *dy, - float *dz - ) -{ - TStatus result; - Tint xr, yr; - - xr = ixr; - yr = yM-ym-iyr; - result = TelUnProjectionRasterWithRay (wsid, xr, yr, x, y, z, dx, dy, dz); - - if (result == TSuccess) - return (0); - else - return (1); -} diff --git a/src/OpenGl/OpenGl_togl_update.cxx b/src/OpenGl/OpenGl_togl_update.cxx deleted file mode 100755 index 82c29f57e3..0000000000 --- a/src/OpenGl/OpenGl_togl_update.cxx +++ /dev/null @@ -1,85 +0,0 @@ -/*********************************************************************** - -FONCTION : ----------- -File OpenGl_togl_update : - - -REMARQUES: ----------- - - -HISTORIQUE DES MODIFICATIONS : --------------------------------- -xx-xx-xx : xxx ; Creation. -20-02-96 : FMN ; Suppression code inutile: -01-04-96 : CAL ; Integration MINSK portage WNT -05-02-97 : FMN ; Suppression de OpenGl_tgl_vis.h -07-10-97 : FMN ; Simplification WNT -08-08-98 : FMN ; ajout PRINT debug -18-11-98 : CAL ; S4062. Ajout des layers. - -************************************************************************/ - -#define RIC120302 /* GG Avoid duplicate code with -// call_togl_redraw -*/ - -/*----------------------------------------------------------------------*/ -/* -* Includes -*/ - -#include -#include -#include -#include -#include -#ifndef RIC120302 -#include -#include -#include -#include -#endif - -void EXPORT call_togl_update -( - CALL_DEF_VIEW * aview, - CALL_DEF_LAYER * anunderlayer, - CALL_DEF_LAYER * anoverlayer - ) -{ - CMN_KEY_DATA data; - Tint update_state; -#ifndef RIC120302 - Tint swap = 1; /* swap buffers ? yes */ -#endif - - TsmGetWSAttri (aview->WsId, WSUpdateState, &data); - update_state = data.ldata; - /* - * Si l'update_state est NotDone, alors on retrace - */ - if (update_state == TNotDone) { -#ifdef RIC120302 - call_togl_redraw( aview, anunderlayer, anoverlayer ); -#else - TsmGetWSAttri (aview->WsId, WSWindow, &data); - if (TxglWinset (call_thedisplay, (Window) data.ldata) == TSuccess) { - call_func_redraw_all_structs_begin (aview->WsId); - - call_togl_setplane( aview ); /* update clipping planes */ - - if (anunderlayer->ptrLayer) - call_togl_redraw_layer2d (aview, anunderlayer); - call_func_redraw_all_structs_proc (aview->WsId); - if (anoverlayer->ptrLayer) - call_togl_redraw_layer2d (aview, anoverlayer); - call_func_redraw_all_structs_end (aview->WsId, swap); - call_togl_redraw_immediat_mode (aview); - } -#endif - } - - return; -} diff --git a/src/OpenGl/OpenGl_togl_userdraw.cxx b/src/OpenGl/OpenGl_togl_userdraw.cxx deleted file mode 100755 index b140523526..0000000000 --- a/src/OpenGl/OpenGl_togl_userdraw.cxx +++ /dev/null @@ -1,18 +0,0 @@ -#include -#include -#include -#include -#include -#include - -void EXPORT -call_togl_userdraw -( - CALL_DEF_GROUP * agroup, - CALL_DEF_USERDRAW * anobject - ) -{ - if (! agroup->IsOpen) call_togl_opengroup (agroup); - call_subr_userdraw ( anobject ); - if (! agroup->IsOpen) call_togl_closegroup (agroup); -} diff --git a/src/OpenGl/OpenGl_togl_view.cxx b/src/OpenGl/OpenGl_togl_view.cxx deleted file mode 100755 index 47cfe2ec57..0000000000 --- a/src/OpenGl/OpenGl_togl_view.cxx +++ /dev/null @@ -1,138 +0,0 @@ -/*********************************************************************** - -FONCTION : ----------- -File OpenGl_togl_view : - - -REMARQUES: ----------- - -HISTORIQUE DES MODIFICATIONS : --------------------------------- -xx-xx-xx : xxx ; Creation. -08-07-96 : FMN ; Suppression appel call_togl_ car deja fait dans -call_togl_cliplimit. -17-07-96 : FMN ; Suppression appel call_subr_hlhsr -30-01-97 : FMN ; Suppression call_util_init_indexes() -30-06-97 : FMN ; Suppression code inutile -08-09-97 : CAL ; subr_open_ws retourne 0 si pb. -24-12-97 : FMN ; Suppression de call_func_set_back_int_shad_meth() - -************************************************************************/ - -/*----------------------------------------------------------------------*/ -/* -* Includes -*/ - -#include - -#include -#include -#include - -#include -#include -#include -#include -#include - -/*----------------------------------------------------------------------*/ - -int EXPORT -call_togl_view -( - CALL_DEF_VIEW * aview - ) -{ - - if (! call_subr_open_ws(aview)) - return 0; - - call_util_init_filters(aview->WsId); - - if( call_util_test_structure(aview->ViewId) ) - call_func_del_struct(aview->ViewId); - - call_func_set_edit_mode(CALL_PHIGS_EDIT_INSERT); - - call_func_open_struct(aview->ViewId); - call_func_label (View_LABViewIndex); - call_func_set_view_ind (aview->ViewId); - - call_func_label (View_LABViewContext); - switch (aview->Context.Visualization) - { - case 0 : /* VISUAL3D_TOV_WIREFRAME */ - call_func_appl_data (0); - break; - case 1 : /* VISUAL3D_TOV_SHADING */ - switch (aview->Context.Model) - { - case 0 : /* VISUAL3D_TOM_NONE */ - call_func_set_int_shad_meth (CALL_PHIGS_SD_NONE); - break; - case 1 : /* VISUAL3D_TOM_INTERP_COLOR */ - call_func_set_int_shad_meth (CALL_PHIGS_SD_COLOUR); - break; - case 2 : /* VISUAL3D_TOM_FACET */ - call_func_set_int_shad_meth - (CALL_PHIGS_SD_DOT_PRODUCT); - break; - case 3 : /* VISUAL3D_TOM_VERTEX */ - call_func_set_int_shad_meth (CALL_PHIGS_SD_NORMAL); - break; - case 4 : /* VISUAL3D_TOM_HIDDENLINE */ - call_func_set_int_shad_meth (CALL_PHIGS_SD_NONE); - break; - } - break; - } - - call_func_label (View_LABHlhsr); - call_func_appl_data (0); - - call_func_label (View_LABLight); - call_func_appl_data (0); - - call_func_label (View_LABPlane); - call_func_appl_data (0); - - call_func_label (View_LABAliasing); - call_func_appl_data (0); - - call_func_label (View_LABDepthCueing); - call_func_appl_data (0); - - call_func_label (View_LABPriority00); - call_func_label (View_LABPriority01); - call_func_label (View_LABPriority02); - call_func_label (View_LABPriority03); - call_func_label (View_LABPriority04); - call_func_label (View_LABPriority05); - call_func_label (View_LABPriority06); - call_func_label (View_LABPriority07); - call_func_label (View_LABPriority08); - call_func_label (View_LABPriority09); - call_func_label (View_LABPriority10); - call_func_label (View_LABEnd); - call_func_label (View_LABImmediat1); - call_func_label (View_LABImmediat2); - call_func_close_struct (); - - if( call_viewrep.active_status == TOff ) - {/* First time. Set defaults */ - call_viewrep.active_status = TOn; - call_viewrep.shield_indicator = TOn; - call_viewrep.border_indicator = TOff; /* non utilise */ - call_viewrep.shield_colour.rgb[0] = ( float )0.0, - call_viewrep.shield_colour.rgb[1] = ( float )0.0, - call_viewrep.shield_colour.rgb[2] = ( float )0.0; - call_viewrep.border_colour.rgb[0] = ( float )0.0, - call_viewrep.border_colour.rgb[1] = ( float )0.0, - call_viewrep.border_colour.rgb[2] = ( float )0.0; - } - - return 1; -} diff --git a/src/OpenGl/OpenGl_togl_view_exploration.cxx b/src/OpenGl/OpenGl_togl_view_exploration.cxx deleted file mode 100755 index ec34cc5d00..0000000000 --- a/src/OpenGl/OpenGl_togl_view_exploration.cxx +++ /dev/null @@ -1,14 +0,0 @@ - -#include -#include -#include - -void EXPORT -call_togl_view_exploration -( - long id - ) -{ - call_togl_structure_exploration (id, 0, 0); - return; -} diff --git a/src/OpenGl/OpenGl_togl_viewmapping.cxx b/src/OpenGl/OpenGl_togl_viewmapping.cxx deleted file mode 100755 index a2cf9a4fbb..0000000000 --- a/src/OpenGl/OpenGl_togl_viewmapping.cxx +++ /dev/null @@ -1,126 +0,0 @@ -/*********************************************************************** - -FONCTION : ----------- -file OpenGl_togl_viewmapping.c : - - -REMARQUES: ----------- - - -HISTORIQUE DES MODIFICATIONS : --------------------------------- -xx-xx-xx : CAL ; Creation. -10-07-96 : FMN ; Suppression #define sur calcul matrice -25-07-96 : FMN ; Suppression code inutile -18-11-98 : FMN ; Correction sur la gestion de la perspective (cf Programming Guide) -09-12-98 : FMN ; Correction erreur de compilation sur WNT -17-12-98 : FMN ; Correction erreur de compilation sur WNT - -************************************************************************/ - -/*----------------------------------------------------------------------*/ -/* -* Includes -*/ - -#include -#include -#include -#include -#include - -#include - -/*----------------------------------------------------------------------*/ -/* -* Variable globales -*/ - -EXPORT extern GLboolean env_walkthrow; /* definit dans OpenGl_togl_begin.c */ - -/*----------------------------------------------------------------------*/ - -int EXPORT -call_togl_viewmapping -( - CALL_DEF_VIEW * aview, - int wait - ) -{ - int i, j; - float ratio; - Tint waitwait; - Tint err_ind; - - TEL_VIEW_MAPPING Map; - - err_ind = 0; - ratio = aview->DefWindow.dy / aview->DefWindow.dx; - - Map.window.xmin = aview->Mapping.WindowLimit.um; - Map.window.ymin = aview->Mapping.WindowLimit.vm; - Map.window.xmax = aview->Mapping.WindowLimit.uM; - Map.window.ymax = aview->Mapping.WindowLimit.vM; - - Map.viewport.xmin = ( float )0.0; - Map.viewport.xmax = ( ( float )1. < ( float )1./ratio ? ( float )1. : ( float )1./ratio ); - Map.viewport.ymin = ( float )0.0; - Map.viewport.ymax = ( ( float )1. < ratio ? ( float )1. : ratio ); - Map.viewport.zmin = ( float )0.0; - Map.viewport.zmax = ( float )1.0; - - /* projection type */ - switch( aview->Mapping.Projection ) - { - case 0 : - Map.proj = CALL_PHIGS_TYPE_PERSPECT; - break; - case 1 : - Map.proj = CALL_PHIGS_TYPE_PARAL; - break; - } - - /* projection reference point */ - Map.prp[0] = aview->Mapping.ProjectionReferencePoint.x; - Map.prp[1] = aview->Mapping.ProjectionReferencePoint.y; - if (env_walkthrow) - Map.prp[2] = aview->Mapping.ProjectionReferencePoint.z; - else - Map.prp[2] = aview->Mapping.FrontPlaneDistance + - aview->Mapping.ProjectionReferencePoint.z; - - /* view plane distance */ - Map.vpd = aview->Mapping.ViewPlaneDistance; - - /* back plane distance */ - Map.bpd = aview->Mapping.BackPlaneDistance; - - /* front plane distance */ - Map.fpd = aview->Mapping.FrontPlaneDistance; - - /* use user-defined matrix */ - if ( aview->Mapping.IsCustomMatrix ) { - for( i = 0; i < 4; i++ ) - for( j = 0; j < 4; j++ ) - call_viewrep.mapping_matrix[i][j] = aview->Mapping.ProjectionMatrix[i][j]; - } - else - TelEvalViewMappingMatrix( &Map, &err_ind, call_viewrep.mapping_matrix ); - - if( !err_ind && aview->WsId != -1 ) - { - call_viewrep.extra.map = Map; - if( !wait ) - { - waitwait = 1; - call_togl_vieworientation( aview, waitwait ); - call_togl_cliplimit( aview, waitwait ); - TelSetViewRepresentation( aview->WsId, aview->ViewId, &call_viewrep ); - call_togl_ratio_window( aview ); - } - } - return err_ind; -} -/*----------------------------------------------------------------------*/ diff --git a/src/OpenGl/OpenGl_togl_vieworientation.cxx b/src/OpenGl/OpenGl_togl_vieworientation.cxx deleted file mode 100755 index 77fecb426e..0000000000 --- a/src/OpenGl/OpenGl_togl_vieworientation.cxx +++ /dev/null @@ -1,103 +0,0 @@ -/*********************************************************************** - -FONCTION : ----------- -file OpenGl_togl_vieworientation.c : - - -REMARQUES: ----------- - - -HISTORIQUE DES MODIFICATIONS : --------------------------------- -xx-xx-xx : CAL ; Creation. -10-07-96 : FMN ; Suppression #define sur calcul matrice - -************************************************************************/ - -/*----------------------------------------------------------------------*/ -/* -* Includes -*/ - -#include -#include -#include -#include -#include - -/*----------------------------------------------------------------------*/ - -int EXPORT -call_togl_vieworientation -( - CALL_DEF_VIEW * aview, - int wait - ) -{ - int i, j; - Tint waitwait; - Tint err_ind; /* OUT error indicator */ - - Tfloat Vrp[3]; - Tfloat Vpn[3]; - Tfloat Vup[3]; - Tfloat ScaleFactors[3]; - - err_ind = 0; - - Vrp[0] = aview->Orientation.ViewReferencePoint.x; - Vrp[1] = aview->Orientation.ViewReferencePoint.y; - Vrp[2] = aview->Orientation.ViewReferencePoint.z; - - Vpn[0] = aview->Orientation.ViewReferencePlane.x; - Vpn[1] = aview->Orientation.ViewReferencePlane.y; - Vpn[2] = aview->Orientation.ViewReferencePlane.z; - - Vup[0] = aview->Orientation.ViewReferenceUp.x; - Vup[1] = aview->Orientation.ViewReferenceUp.y; - Vup[2] = aview->Orientation.ViewReferenceUp.z; - - ScaleFactors[0] = aview->Orientation.ViewScaleX; - ScaleFactors[1] = aview->Orientation.ViewScaleY; - ScaleFactors[2] = aview->Orientation.ViewScaleZ; - - /* use user-defined matrix */ - if ( aview->Orientation.IsCustomMatrix ) { - for( i = 0; i < 4; i++ ) - for( j = 0; j < 4; j++ ) - call_viewrep.orientation_matrix[i][j] = aview->Orientation.ModelViewMatrix[i][j]; - } - else - TelEvalViewOrientationMatrix( Vrp, Vpn, Vup, ScaleFactors, &err_ind, call_viewrep.orientation_matrix); - - if( !err_ind && aview->WsId != -1 ) - { - call_viewrep.extra.vrp[0] = Vrp[0], - call_viewrep.extra.vrp[1] = Vrp[1], - call_viewrep.extra.vrp[2] = Vrp[2]; - - call_viewrep.extra.vpn[0] = Vpn[0], - call_viewrep.extra.vpn[1] = Vpn[1], - call_viewrep.extra.vpn[2] = Vpn[2]; - - call_viewrep.extra.vup[0] = Vup[0], - call_viewrep.extra.vup[1] = Vup[1], - call_viewrep.extra.vup[2] = Vup[2]; - - call_viewrep.extra.scaleFactors[0] = ScaleFactors[0], - call_viewrep.extra.scaleFactors[1] = ScaleFactors[1], - call_viewrep.extra.scaleFactors[2] = ScaleFactors[2]; - - if( !wait ) - { - waitwait = 1; - call_togl_viewmapping( aview, waitwait ); - call_togl_cliplimit( aview, waitwait ); - TelSetViewRepresentation( aview->WsId, aview->ViewId, &call_viewrep ); - } - } - return err_ind; -} -/*----------------------------------------------------------------------*/ diff --git a/src/OpenGl/OpenGl_tox.cxx b/src/OpenGl/OpenGl_tox.cxx deleted file mode 100755 index 342e7276a6..0000000000 --- a/src/OpenGl/OpenGl_tox.cxx +++ /dev/null @@ -1,166 +0,0 @@ - -#ifndef WNT -/*********************************************************************** - -FONCTION : ----------- -File OpenGl_tox : - - -REMARQUES: ----------- - - -HISTORIQUE DES MODIFICATIONS : --------------------------------- -xx-xx-xx : xxx ; Creation. -20-02-96 : FMN ; Suppression code inutile: -on ne garde que : -- call_tox_open_display() -- call_tox_getscreen(Tint *d_wdth, Tint *d_hght) -01-04-96 : CAL ; Integration MINSK portage WNT -20-11-97 : CAL ; RererereMerge avec le source de portage. -12-02-01 : GG ; BUC60821 Add getpitchsize() function -27-03-02 : GG ; RIC120202 Add new function call_tox_set_display - -************************************************************************/ - -/*----------------------------------------------------------------------*/ -/* -* Includes -*/ - -#include - -#include -#include - -#include - -#include -#include -#include -#include - -/*----------------------------------------------------------------------*/ -/* -* Variables globales -*/ - -Display * call_thedisplay; /* display pointer; defined in tgl/tox */ - -/*----------------------------------------------------------------------*/ -/* -*Fonctions externes -*/ - -/*----------------------------------------------------------------------*/ - -Tint -call_tox_open_display (void) -{ - char synchro[132]; - - if (call_thedisplay == NULL) - /* - * display_name - * Specifies the hardware display name, which determines the - * display and communications domain to be used. - * On a POSIX system, if the display_name is NULL, it defaults - * to the value of the DISPLAY environment variable. - */ - call_thedisplay = XOpenDisplay ((char*) NULL); - - if (call_thedisplay != NULL) - if (call_util_osd_getenv ("CALL_SYNCHRO_X", synchro, 132)) - XSynchronize (call_thedisplay, 1); - else - XSynchronize (call_thedisplay, 0); - else - fprintf (stderr, "Cannot connect to X server %s\n", - XDisplayName ((char*) NULL)); - - return (call_thedisplay == NULL); -} - -/*RIC120302*/ -Tint -call_tox_set_display (void *vdisplay) -{ - Display *pdisplay = (Display*) vdisplay; - char synchro[132]; - - if ( pdisplay ) { - call_thedisplay = pdisplay; - - if (call_util_osd_getenv ("CALL_SYNCHRO_X", synchro, 132)) - XSynchronize (call_thedisplay, 1); - else - XSynchronize (call_thedisplay, 0); - } else { - fprintf (stderr, "Cannot connect to X server %s\n", - XDisplayName ((char*) NULL)); - } - return (call_thedisplay != NULL); -} -/*RIC120302*/ - -/*----------------------------------------------------------------------*/ - -void -call_tox_getscreen( Tint *d_wdth, Tint *d_hght ) -{ - *d_wdth = DisplayWidth( call_thedisplay, DefaultScreen(call_thedisplay) ); - *d_hght = DisplayHeight( call_thedisplay, DefaultScreen(call_thedisplay) ); - return; -} - -/*----------------------------------------------------------------------*/ - -Tfloat -call_tox_getpitchsize( ) -{ - static float pitch_size = 0.; - - if( pitch_size == 0. ) { - int width = DisplayWidth( call_thedisplay, DefaultScreen(call_thedisplay) ); - int height = DisplayHeight( call_thedisplay, DefaultScreen(call_thedisplay) ); - int mmwidth = DisplayWidthMM( call_thedisplay, DefaultScreen(call_thedisplay) ); - int mmheight = DisplayHeightMM( call_thedisplay, DefaultScreen(call_thedisplay) ); - pitch_size = ((float)mmwidth/width + (float)mmheight/height)/2.; - } - - return pitch_size; -} - -/*----------------------------------------------------------------------*/ -#else -# include -# include -# include - -DISPLAY* call_thedisplay = "DISPLAY"; /* Dummy for Windows NT */ - -Tint -call_tox_open_display ( void ) -{ - return 1; -} - -/*RIC120302*/ -Tint -call_tox_set_display ( void* vdisplay) -{ - return 1; -} -/*RIC120302*/ - -void -call_tox_getscreen ( Tint *d_wdth, Tint *d_hght ) -{ - *d_wdth = GetSystemMetrics(SM_CXSCREEN); - *d_hght = GetSystemMetrics(SM_CYSCREEN); - return; -} - -#endif /* WNT */ diff --git a/src/OpenGl/OpenGl_traces.hxx b/src/OpenGl/OpenGl_traces.hxx deleted file mode 100755 index 5f66cf59ed..0000000000 --- a/src/OpenGl/OpenGl_traces.hxx +++ /dev/null @@ -1,170 +0,0 @@ -switch (elem) { - case TelNil: - printf ("TelNil\n"); - break; - case TelLabel: - printf ("TelLabel %d\n", e[i].data); - break; - case TelAntiAliasing: - printf ("TelAntiAliasing\n"); - break; - case TelBlink: - printf ("TelBlink\n"); - break; - case TelExecuteStructure: - printf ("TelExecuteStructure %d\n", e[i].data); - break; - case TelPolylineColour: - printf ("TelPolylineColour\n"); - break; - case TelPolylineType: - printf ("TelPolylineType\n"); - break; - case TelPolylineWidth: - printf ("TelPolylineWidth\n"); - break; - case TelInteriorStyle: - printf ("TelInteriorStyle\n"); - break; - case TelInteriorColour: - printf ("TelInteriorColour\n"); - break; - case TelBackInteriorColour: - printf ("TelBackInteriorColour\n"); - break; - case TelEdgeColour: - printf ("TelEdgeColour\n"); - break; - case TelEdgeType: - printf ("TelEdgeType\n"); - break; - case TelEdgeWidth: - printf ("TelEdgeWidth\n"); - break; - case TelEdgeFlag: - printf ("TelEdgeFlag\n"); - break; - case TelInteriorStyleIndex: - printf ("TelInteriorStyleIndex\n"); - break; - case TelFaceDistinguishingMode: - printf ("TelFaceDistinguishingMode\n"); - break; - case TelFaceCullingMode: - printf ("TelFaceCullingMode\n"); - break; - case TelInteriorReflectanceEquation: - printf ("TelInteriorReflectanceEquation\n"); - break; - case TelSurfaceAreaProperties: - printf ("TelSurfaceAreaProperties\n"); - break; - case TelBackInteriorReflectanceEquation: - printf ("TelBackInteriorReflectanceEquation\n"); - break; - case TelBackSurfaceAreaProperties: - printf ("TelBackSurfaceAreaProperties\n"); - break; - case TelPolymarkerColour: - printf ("TelPolymarkerColour\n"); - break; - case TelPolymarkerType: - printf ("TelPolymarkerType\n"); - break; - case TelPolymarkerSize: - printf ("TelPolymarkerSize\n"); - break; - case TelTextFont: - printf ("TelTextFont\n"); - break; - case TelTextHeight: - printf ("TelTextHeight\n"); - break; - case TelCharacterSpacing: - printf ("TelCharacterSpacing\n"); - break; - case TelCharacterExpansionFactor: - printf ("TelCharacterExpansionFactor\n"); - break; - case TelTextColour: - printf ("TelTextColour\n"); - break; - case TelDepthCueIndex: - printf ("TelDepthCueIndex\n"); - break; - case TelPickId: - printf ("TelPickId\n"); - break; - case TelPolygon: - printf ("TelPolygon\n"); - break; - case TelPolygonSet: - printf ("TelPolygonSet\n"); - break; - case TelPolygonHoles: - printf ("TelPolygonHoles\n"); - break; - case TelPolygonIndices: - printf ("TelPolygonIndices\n"); - break; - case TelQuadrangle: - printf ("TelQuadrangle\n"); - break; - case TelPolyline: - printf ("TelPolyline\n"); - break; - case TelMarker: - printf ("TelMarker\n"); - break; - case TelMarkerSet: - printf ("TelMarkerSet\n"); - break; - case TelText: - printf ("TelText\n"); - break; - case TelTriangleMesh: - printf ("TelTriangleMesh\n"); - break; - case TelAddNameset: - printf ("TelAddNameset\n"); - break; - case TelRemoveNameset: - printf ("TelRemoveNameset\n"); - break; - case TelInteriorShadingMethod: - printf ("TelInteriorShadingMethod\n"); - break; - case TelLocalTran3: - printf ("TelLocalTran3\n"); - break; - case TelHighlightIndex: - printf ("TelHighlightIndex\n"); - break; - case TelLightSrcState: - printf ("TelLightSrcState\n"); - break; - case TelClippingPlane: - printf ("TelClippingPlane\n"); - break; - case TelViewIndex: - printf ("TelViewIndex\n"); - break; - case TelApplicationData: - printf ("TelApplicationData\n"); - break; - case TelCurve: - printf ("TelCurve\n"); - break; - case TelTextureId: - printf ("TelTextureId\n"); - break; - case TelDoTextureMap: - printf ("TelDoTextureMap\n"); - break; - case TelLast: - printf ("TelLast\n"); - break; - default: - printf ("default\n"); - break; -} diff --git a/src/OpenGl/OpenGl_transform_persistence.cxx b/src/OpenGl/OpenGl_transform_persistence.cxx deleted file mode 100755 index 9312cfdf1f..0000000000 --- a/src/OpenGl/OpenGl_transform_persistence.cxx +++ /dev/null @@ -1,319 +0,0 @@ - -#include - -#include - -#include -#include -#include -#include /* pour M_PI */ - -#include -#include - -/* ABD 29/10/04 Transform Persistence of Presentation( pan, zoom, rotate ) */ - -#include -#include -#include -#include -#include -#include /* pour TsmGetWSAttri */ -#include /* pour tel_view_data */ - - -#include - -#include - - -/*----------------------------------------------------------------------*/ -/* -* Type definitions -*/ - -typedef struct -{ - TEL_VIEW_REP vrep; -#ifdef CAL_100498 - Tmatrix3 inverse_matrix;/* accelerates UVN2XYZ conversion */ -#endif -} TEL_VIEW_DATA, *tel_view_data; /* Internal data stored for every view rep */ - - - -static TStatus TransformPersistenceDisplay( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus TransformPersistenceAdd( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus TransformPersistenceDelete( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus TransformPersistencePrint( TSM_ELEM_DATA, Tint, cmn_key* ); - -static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) = -{ - TransformPersistenceDisplay, /* PickTraverse */ - TransformPersistenceDisplay, - TransformPersistenceAdd, - 0, /*TransformPersistenceDelete,*/ - TransformPersistencePrint, - 0 /* Inquire */ -}; - - -MtblPtr -TelTransformPersistentInitClass( TelType *el ) -{ - *el = TelTransformPersistence; - return MtdTbl; -} - -static TStatus -TransformPersistenceAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k ) -{ - tel_transform_persistence data = new TEL_TRANSFORM_PERSISTENCE(); - - if( !data ) - return TFailure; - - *data = *(tel_transform_persistence)(k[0]->data.pdata); - - ((tsm_elem_data)(d.pdata))->pdata = data; - - return TSuccess; -} - - -static TStatus -TransformPersistenceDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - CMN_KEY key; - - key.id = TelTransformPersistence; - key.data.pdata = data.pdata; - TsmSetAttri( 1, &key ); - return TSuccess; -} - -static TStatus -TransformPersistenceDelete( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - /* transform_persistence_end();*/ - return TSuccess; -} - - -static TStatus -TransformPersistencePrint( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - - return TSuccess; -} - -/***********************************/ -static int isGenerated = 0; - -void transform_persistence_end(void) -{ - if( isGenerated == 1 ) - /* restore matrix */ - { - glMatrixMode (GL_PROJECTION); - glPopMatrix (); - glMatrixMode (GL_MODELVIEW); - glPopMatrix (); - isGenerated = 0; - } - - /*printf( "Transform Persistence End: %i \n", isGenerated );*/ -} - - -void transform_persistence_begin( int theFlag, - float theX, - float theY, - float theZ ) -{ - CMN_KEY_DATA key; - tel_view_data vptr; - int i, j; - GLdouble modelMatrix[4][4]; - GLdouble projMatrix[4][4]; - GLdouble idenMatrix[4][4] = { {1.,0.,0.,0.}, {0.,1.,0.,0.}, {0.,0.,1.,0.},{0.,0.,0.,1.} }; - GLint viewport[4]; - double det2; - - double W, H, W1, W2, H1, H2; - double winx, winy, winz; - double scaleX, scaleY, scaleZ; - -#ifdef PRINT1 - printf( "Transform Persistence Mode: %i\n", theFlag ); - printf( "Transform Persistence PointX: %f\n", theX ); - printf( "Transform Persistence PointY: %f\n", theY ); - printf( "Transform Persistence PointZ: %f\n", theZ ); -#endif /*PRINT1*/ - - if( theFlag == 0 ) - { - transform_persistence_end(); - return; - } - - glGetIntegerv (GL_VIEWPORT, viewport); - glGetDoublev( GL_MODELVIEW_MATRIX, (GLdouble *) modelMatrix ); - glGetDoublev( GL_PROJECTION_MATRIX, (GLdouble *) projMatrix ); - - W = viewport[2]; - H = viewport[3]; - - if( isGenerated == 0 ) - isGenerated = 1; - else - { - /* restore matrix */ - glMatrixMode (GL_PROJECTION); - glPopMatrix (); - glMatrixMode (GL_MODELVIEW); - glPopMatrix (); - } - - glMatrixMode( GL_MODELVIEW ); - glPushMatrix(); - glLoadIdentity(); - - glMatrixMode( GL_PROJECTION ); - glPushMatrix(); - glLoadIdentity(); - - /*pre loading matrix*/ - if( theFlag & TPF_PAN ) - /* Annulate translate matrix */ - { - modelMatrix[3][0] = 0.; - modelMatrix[3][1] = 0.; - modelMatrix[3][2] = 0.; - projMatrix[3][0] = 0.; - projMatrix[3][1] = 0.; - projMatrix[3][2] = 0.; - } - - if( theFlag & TPF_ZOOM ) - /* Annulate zoom matrix */ - { - if( W > H ) - det2 = 0.002 / projMatrix[1][1]; - else - det2 = 0.002 / projMatrix[0][0]; - - TsmGetWSAttri( TglActiveWs, WSViews, &key ); - vptr = (tel_view_data)key.pdata ; /* Obtain defined view data*/ - scaleX = vptr->vrep.extra.scaleFactors[0]; - scaleY = vptr->vrep.extra.scaleFactors[1]; - scaleZ = vptr->vrep.extra.scaleFactors[2]; - - for( i = 0; i < 3; i++ ) - { - for( j = 0; j < 3; j++ ) - { - if(i == 0) - modelMatrix[i][j] /= scaleX; - if(i == 1) - modelMatrix[i][j] /= scaleY; - if(i == 2) - modelMatrix[i][j] /= scaleZ; - } - } - for( i = 0 ; i < 2; i++ ) - projMatrix[i][i] *= det2; - } - - if( theFlag & TPF_ROTATE ) - /* Annulate rotate matrix */ - { - modelMatrix[0][0] = 1.; - modelMatrix[1][1] = 1.; - modelMatrix[2][2] = 1.; - - modelMatrix[1][0] = 0.; - modelMatrix[2][0] = 0.; - modelMatrix[0][1] = 0.; - modelMatrix[2][1] = 0.; - modelMatrix[0][2] = 0.; - modelMatrix[1][2] = 0.; - } - else if( theFlag & TPF_RELATIVE_ROTATE ) - /* Initialize relative rotate matrix*/ - { - modelMatrix[3][0] = 0.; - modelMatrix[3][1] = 0.; - modelMatrix[3][2] = 0.; - - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); - glTranslated( theX, theY, theZ ); - } - - if( theFlag == TPF_TRIEDRON ) - { - /* Annulate translation matrix */ - modelMatrix[3][0] = 0.; - modelMatrix[3][1] = 0.; - modelMatrix[3][2] = 0.; - - projMatrix[3][0] = 0.; - projMatrix[3][1] = 0.; - projMatrix[3][2] = 0.; - - if( W > H ) - det2 = 0.002 / projMatrix[1][1]; - else - det2 = 0.002 / projMatrix[0][0]; - - for( i = 0 ; i < 2; i++ ) - projMatrix[i][i] *= det2; - } - - /* load matrix */ - glMatrixMode (GL_MODELVIEW); - glMultMatrixd( (GLdouble *) modelMatrix); - - glMatrixMode ( GL_PROJECTION ); - glMultMatrixd( (GLdouble *) projMatrix); - - - /*post loading matrix*/ - if( theFlag == TPF_TRIEDRON ) - { - glMatrixMode( GL_PROJECTION ); - - gluUnProject( W/2, H/2., 0, (GLdouble*)idenMatrix, (GLdouble*)projMatrix, (GLint*)viewport, &winx, &winy, &winz); - W1 = winx; - H1 = winy; - gluUnProject( -W/2, -H/2., 0, (GLdouble*)idenMatrix, (GLdouble*)projMatrix, (GLint*)viewport, &winx, &winy, &winz); - W2 = winx; - H2 = winy; - - if( theX == 0. && theY == 0. ) - { - /*center*/ - } - else if( theX > 0. && theY > 0. ) - { - /*right upper*/ - glTranslated( (W1 - W2)/2. - theZ/2., (H1-H2)/2. - theZ/2., 0. ); - } - else if( theX > 0. && theY < 0. ) - { - /*right lower*/ - glTranslated( (W1 - W2)/2. - theZ/2., -(H1-H2)/2. + theZ/2., 0. ); - } - else if( theX < 0. && theY > 0. ) - { - /*left upper*/ - glTranslated( -(W1 - W2)/2. + theZ/2., (H1-H2)/2. - theZ/2., 0. ); - } - else if( theX < 0 && theY < 0 ) - { - /*left lower*/ - glTranslated( -(W1 - W2)/2. + theZ/2., -(H1-H2)/2. + theZ/2., 0. ); - } - } -} diff --git a/src/OpenGl/OpenGl_transform_persistence.hxx b/src/OpenGl/OpenGl_transform_persistence.hxx index 7488e6750f..480f1c834b 100755 --- a/src/OpenGl/OpenGl_transform_persistence.hxx +++ b/src/OpenGl/OpenGl_transform_persistence.hxx @@ -11,10 +11,4 @@ enum TP_FLAGS TPF_TRIEDRON = 0x020 }; - -extern void transform_persistence_begin( int, float, float, float ); - -extern void transform_persistence_end(void); - - #endif /*OPENGL_TRANSFORM_PERSISTENCE_H*/ diff --git a/src/OpenGl/OpenGl_triedron.cxx b/src/OpenGl/OpenGl_triedron.cxx deleted file mode 100755 index 6860bfce92..0000000000 --- a/src/OpenGl/OpenGl_triedron.cxx +++ /dev/null @@ -1,1498 +0,0 @@ -/*********************************************************************** - -FONCTION : ----------- -File OpenGl_triedron : gestion du triedre non zoomable. - -REMARQUES: ----------- - -Algorithme : -o dimensions et origine du triedre sont recalcules a chaque fois, en -fonction de la taille (u,v = largeur-hauteur) de la fenetre => -il est inutile ici de jouer sur le facteur d'echelle. -o on n'inhibe que les translations, car on veut conserver les -transformations d'orientations. - - -HISTORIQUE DES MODIFICATIONS : --------------------------------- -08-12-98 : BGN ; Creation. - - -************************************************************************/ - -#define BUC60851 /* GG 15/03/01 Avoid to raise after the second creation -of the trihedron -*/ - -#define BUC61045 /* 25/10/01 SAV ; added functionality to control gl lighting -from higher API */ - - -#define QTOCC_PATCH /* Active QtOPENCASCADE patches */ - -/*----------------------------------------------------------------------*/ -/* -* Includes -*/ - -#include -#include - - -#include -#include -#include -#include /* pour M_PI */ - -#include -#include -#include - -#include /* pour TsmGetWSAttri */ -#include /* pour tel_view_data */ -#include /* pour CALL_DEF_STRUCTURE */ -#include /* pour CALL_DEF_VIEW */ -#include - -#include - -#ifdef HAVE_GL2PS -#include -#endif - -#ifdef HAVE_CONFIG_H -#include -#endif -#ifdef HAVE_STRING_H -#include -#endif - -#include -/*----------------------------------------------------------------------*/ -/* -* Constantes -*/ - -#define NO_DEBUG -#define NO_PRINT -#define NO_PRINT_MATRIX - -/* on trouve que 10 vues sera suffisant */ -#define GROW_SIZE_NZ_WKS 10 - -/* pour l'instant on ne travaille que sur le triedre */ -/* on augmentera le define quand on developpera les struc. non zoomables*/ -#define GROW_SIZE_NZ_STRUC 1 - -/* Identificateur du Triedre Non Zommable dans la liste des structures */ -# define TRIEDRON_ID -100 - -/*----------------------------------------------------------------------*/ -/* -* Definition de types -*/ -typedef struct -{ - float aXColor[3]; - float aYColor[3]; - float aZColor[3]; - float aRatio; - float aDiametr; - int aNbFacettes; -} ZBUF_STRUCT; - - -/* donnees des structures non zoomables liees a une wks (=une vue) */ -typedef struct -{ - int NZStrucID; /* = TRIEDRON_ID ou astructure->Id de Graphic3d sinon.*/ - int aPos; - float aColor[3]; - float aScale; - int isWireframe; - CALL_DEF_STRUCTURE * astructure; - ZBUF_STRUCT* aZBufParam; -} NZ_STRUC_DATA; - - - -/* liste des wks (=vues) concernees par les structures non zoomables */ -typedef struct -{ - int nz_wks; /* = id de la wks */ - int triedron_on; /* =0 si le triedre non zoomable n'est pas defini */ - int nz_struc_count; /* nb de structures non zoomables de la vue */ - int nz_struc_size; - NZ_STRUC_DATA *nz_struc; -} NZ_WKS; - - -typedef struct -{ - TEL_VIEW_REP vrep; -} TEL_VIEW_DATA, *tel_view_data; /* Internal data stored for every view rep */ - -/*----------------------------------------------------------------------*/ -/* -* Variables statiques -*/ - -static NZ_WKS *nz_wks = NULL; -static int nz_wks_count = 0; -static int nz_wks_size = 0; - -/* Default parameters for ZBUFFER triheron */ -static float theXColor[] = { 1.0, 0.0, 0.0 }; -static float theYColor[] = { 0.0, 1.0, 0.0 }; -static float theZColor[] = { 0.0, 0.0, 1.0 }; -static float theRatio = 0.8f; -static float theDiametr = 0.05f; -static int theNBFacettes = 12; - -/*----------------------------------------------------------------------*/ -/*----------------------------------------------------------------------*/ -/* -* Fonctions privees -*/ - - - -/*----------------------------------------------------------------------*/ -/* -* recherche de la wks NZWksID concernee par les structures non zoomables; -* creation de l'element wks s'il n'existe pas. -*/ -static int find_nz_wks(int NZWksID, int alloc) -{ - int i; - - /* recherche la wks dans la liste si elle existe */ - for (i=0; i on fait de la place si il n'y en a plus */ - if (nz_wks_count == nz_wks_size) { -#ifdef BUC60851 - if( nz_wks_size > 0 ) { - nz_wks_size += GROW_SIZE_NZ_WKS; - nz_wks = (NZ_WKS *) realloc(nz_wks, nz_wks_size * sizeof(NZ_WKS)); - } else { - nz_wks_size = GROW_SIZE_NZ_WKS; - nz_wks = (NZ_WKS *) malloc(nz_wks_size * sizeof(NZ_WKS)); - } -#else - nz_wks_size += GROW_SIZE_NZ_WKS; - nz_wks = (NZ_WKS *) realloc(nz_wks, nz_wks_size * sizeof(NZ_WKS)); -#endif - if (nz_wks == NULL) return -1; - } - - nz_wks[nz_wks_count].nz_wks = NZWksID; - nz_wks[nz_wks_count].triedron_on = 0; - nz_wks[nz_wks_count].nz_struc = NULL; - nz_wks[nz_wks_count].nz_struc_size = 0; - nz_wks[nz_wks_count].nz_struc_count = 0; - - return nz_wks_count++; -} - -/*-----------------------------------------------------------------*/ -/* -* recherche de la structure non zoomable NZStrucID dans la liste -* de la wks NZWksIdx ; -* creation de l'element structure non zoomable s'il n'existe pas. -*/ -static int find_nz_struc(int NZWksIdx, int NZStrucID, int alloc) -{ - int i; - NZ_STRUC_DATA *nz_struc; - - - /* recherche la structure non zoomable dans la liste de la wks */ - nz_struc = nz_wks[NZWksIdx].nz_struc; - for (i=0; i on la cree */ - if (nz_wks[NZWksIdx].nz_struc_count == nz_wks[NZWksIdx].nz_struc_size) { -#ifdef BUC60851 - if( nz_wks[NZWksIdx].nz_struc_size > 0 ) { - nz_wks[NZWksIdx].nz_struc_size += GROW_SIZE_NZ_STRUC; - nz_wks[NZWksIdx].nz_struc = - (NZ_STRUC_DATA *) realloc(nz_wks[NZWksIdx].nz_struc, - nz_wks[NZWksIdx].nz_struc_size * sizeof(NZ_STRUC_DATA)); - } else { - nz_wks[NZWksIdx].nz_struc_size = GROW_SIZE_NZ_STRUC; - nz_wks[NZWksIdx].nz_struc = - (NZ_STRUC_DATA *) malloc( nz_wks[NZWksIdx].nz_struc_size * sizeof(NZ_STRUC_DATA)); - } -#else - nz_wks[NZWksIdx].nz_struc_size += GROW_SIZE_NZ_STRUC; - nz_wks[NZWksIdx].nz_struc = (NZ_STRUC_DATA *) realloc(nz_wks[NZWksIdx].nz_struc, nz_wks[NZWksIdx].nz_struc_size * sizeof(NZ_STRUC_DATA)); -#endif - if (nz_wks[NZWksIdx].nz_struc == NULL) return -1; - - nz_wks[NZWksIdx].nz_struc[nz_wks[NZWksIdx].nz_struc_count].aZBufParam = NULL; - } - - return nz_wks[NZWksIdx].nz_struc_count++; -} - - -/*----------------------------------------------------------------------*/ - -/* -* affichage d'un triedre non zoomable a partir des index dans les tables -* des structures non zoomables. -* -* Triedre = Objet non Zoomable : -* on recalcule ses dimensions et son origine en fonction de la taille -* de la fenetre; on positionne selon le choix de l'init; -* et on inhibe seulement les translations. -* -*/ - - - - -TStatus call_triedron_redraw ( - int nz_wks_entry, - int nz_struc_entry, - GLdouble U, - GLdouble V - ) -{ - GLdouble modelMatrix[4][4]; - GLdouble projMatrix[4][4]; - - GLdouble TriedronAxeX[3] = { 1.0, 0.0, 0.0 }; - GLdouble TriedronAxeY[3] = { 0.0, 1.0, 0.0 }; - GLdouble TriedronAxeZ[3] = { 0.0, 0.0, 1.0 }; - GLdouble TriedronOrigin[3] = { 0.0, 0.0, 0.0 }; - GLfloat TriedronColor[3] = { 1.0, 1.0, 1.0 }; /* def = blanc */ - - GLfloat TriedronWidth = 1.0; - GLfloat TriedronScale = (float)0.1 ; - GLint TriedronPosition = 0; /* def = Aspect_TOTP_CENTER */ - - GLdouble L, l, rayon ; - GLdouble minUV; - int ii; -#ifdef PRINT_MATRIX - int jj; -#endif - int NbFacettes; - double Angle; - GLdouble TriedronCoord[3] = { 1.0, 0.0, 0.0 }; - - GLuint fontBase = 0; - GLint mode; - -#ifdef QTOCC_PATCH /* PCD 10/02/08 */ - /* Fix to problem with clipping planes chopping off pieces of the triedron */ - GLint max_plane=0; - GLboolean* isPlaneActive; - glGetIntegerv( GL_MAX_CLIP_PLANES, &max_plane); - isPlaneActive= new GLboolean[max_plane]; - /* Backup the clip planes. */ - for (ii = 0; ii < max_plane ; ii++) { - isPlaneActive[ii] = glIsEnabled(GL_CLIP_PLANE0 + ii); - glDisable(GL_CLIP_PLANE0 + ii); - } -#endif - - /* - * Lecture des Init. du Triedre - */ - - TriedronColor[0] = nz_wks[nz_wks_entry].nz_struc[nz_struc_entry].aColor[0]; - TriedronColor[1] = nz_wks[nz_wks_entry].nz_struc[nz_struc_entry].aColor[1]; - TriedronColor[2] = nz_wks[nz_wks_entry].nz_struc[nz_struc_entry].aColor[2]; - TriedronScale = nz_wks[nz_wks_entry].nz_struc[nz_struc_entry].aScale; - TriedronPosition = nz_wks[nz_wks_entry].nz_struc[nz_struc_entry].aPos; - - - /* - * Calcul des axes => on inhibe le zoom. - */ - - /* la taille des axes est 1 proportion (fixee a l'init du triedre) */ - /* de la dimension la plus petite de la window. */ - if ( U < V ) minUV = U; - else minUV = V; - L = minUV * (double) TriedronScale ; - - /* Position de l'origine */ - TriedronOrigin[0]= 0.0; - TriedronOrigin[1]= 0.0; - TriedronOrigin[2]= 0.0; - - /* Position des Axes */ - TriedronAxeX[0] = TriedronOrigin[0] + L ; - TriedronAxeX[1] = TriedronOrigin[1] + 0.0; - TriedronAxeX[2] = TriedronOrigin[2] + 0.0; - - TriedronAxeY[0] = TriedronOrigin[0] + 0.0; - TriedronAxeY[1] = TriedronOrigin[1] + L ; - TriedronAxeY[2] = TriedronOrigin[2] + 0.0; - - TriedronAxeZ[0] = TriedronOrigin[0] + 0.0; - TriedronAxeZ[1] = TriedronOrigin[1] + 0.0; - TriedronAxeZ[2] = TriedronOrigin[2] + L ; - - /* - * On inhibe les translations; on conserve les autres transformations. - */ - - /* on lit les matrices de transformation et de projection de la vue */ - /* pour annuler les translations (dernieres colonnes des matrices). */ - glGetDoublev( GL_MODELVIEW_MATRIX, (GLdouble *) modelMatrix ); - glGetDoublev( GL_PROJECTION_MATRIX, (GLdouble *) projMatrix ); - -#ifdef PRINT_MATRIX - printf ("\n--- call_triedron_redraw : avant transfo projMatrix= "); - for (ii = 0; ii<4 ; ii++) { - printf ("\n "); - for (jj = 0; jj<4 ; jj++) { - printf (" %f ", projMatrix[ii][jj] ); - } - } - printf ("\n--- call_triedron_redraw : avant transfo modelMatrix= "); - for (ii = 0; ii<4 ; ii++) { - printf ("\n "); - for (jj = 0; jj<4 ; jj++) { - printf (" %f ", modelMatrix[ii][jj] ); - } - } -#endif - - - /* on annule la translation qui peut etre affectee a la vue */ - modelMatrix[3][0] = 0. ; - modelMatrix[3][1] = 0. ; - modelMatrix[3][2] = 0. ; - projMatrix[3][0] = 0. ; - projMatrix[3][1] = 0. ; - projMatrix[3][2] = 0. ; - - - /* sauvegarde du contexte des matrices avant chargement */ - glMatrixMode (GL_MODELVIEW); - glPushMatrix (); - glLoadIdentity (); - glLoadMatrixd( (GLdouble *) modelMatrix); - glMatrixMode ( GL_PROJECTION ); - glPushMatrix (); - glLoadIdentity(); - glLoadMatrixd( (GLdouble *) projMatrix); - - -#ifdef PRINT_MATRIX - printf ("\n\n\n--- call_triedron_redraw : APRES transfo projMatrix= "); - for (ii = 0; ii<4 ; ii++) { - printf ("\n "); - for (jj = 0; jj<4 ; jj++) { - printf (" %f ", projMatrix[ii][jj] ); - } - } - printf ("\n--- call_triedron_redraw : APRES transfo modelMatrix= "); - for (ii = 0; ii<4 ; ii++) { - printf ("\n "); - for (jj = 0; jj<4 ; jj++) { - printf (" %f ", modelMatrix[ii][jj] ); - } - } -#endif - - - /* - * Positionnement de l'origine du triedre selon le choix de l'init - */ - - /* on fait uniquement une translation de l'origine du Triedre */ - - switch (TriedronPosition) { - - case 0 : /* Aspect_TOTP_CENTER */ - break; - - case 1 : /* Aspect_TOTP_LEFT_LOWER */ - glTranslated( -U/2. + L , -V/2. + L , 0. ); - break; - - case 2 : /*Aspect_TOTP_LEFT_UPPER */ - glTranslated( -U/2. + L , +V/2. - L -L/3. , 0. ); - break; - - case 3 : /* Aspect_TOTP_RIGHT_LOWER */ - glTranslated( U/2. - L -L/3. , -V/2. + L , 0. ); - break; - - case 4 : /* Aspect_TOTP_RIGHT_UPPER */ - glTranslated( U/2. - L -L/3. , +V/2. - L -L/3. , 0. ); - break; - - default : - break; - - } - -#ifdef PRINT - printf ("\n--- call_triedron_redraw : TriedronOrigin= %f %f %f\n", - TriedronOrigin[0], TriedronOrigin[1], TriedronOrigin[2]); - printf ("\n--- : TriedronAxeX= %f %f %f \n", - TriedronAxeX[0], TriedronAxeX[1], TriedronAxeX[2]); - printf ("\n--- : TriedronAxeY= %f %f %f \n", - TriedronAxeY[0], TriedronAxeY[1], TriedronAxeY[2] ); - printf ("\n--- : TriedronAxeZ= %f %f %f \n", - TriedronAxeZ[0], TriedronAxeZ[1], TriedronAxeZ[2]); - printf ("\n--- : TriedronScale= %f \n",TriedronScale); - printf ("\n--- : 1/echelle = ( %f %f %f %f ) \n", - modelMatrix[0][0],modelMatrix[1][1],modelMatrix[2][2],modelMatrix[3][3]); -#endif - - - /* - * Creation du triedre - */ - glColor3fv (TriedronColor); - - glGetIntegerv( GL_RENDER_MODE, &mode ); - -#ifdef HAVE_GL2PS - if( mode==GL_RENDER ) - glLineWidth( TriedronWidth ); - else if( mode==GL_FEEDBACK ) - gl2psLineWidth( TriedronWidth ); -#else - glLineWidth( TriedronWidth ); -#endif - -#ifdef QTOCC_PATCH /* Fotis Sioutis 2007-11-14 15:06 - I have also seen in previous posts that the view trihedron in V3d_WIREFRAME mode - changes colors depending on the state of the view. This behaviour can be easily - corrected by altering call_triedron_redraw function in OpenGl_triedron.c of TKOpengl. - The only change needed is to erase the LightOff() function that is called before the - Axis name drawing and move this function call just before the initial axis drawing. - Below is the code portion with the modification.I don't know if this is considered to - be a bug but anyway i believe it might help some of you out there.*/ - LightOff(); -#endif - - /* dessin des axes */ - glBegin(GL_LINES); - glVertex3dv( TriedronOrigin ); - glVertex3dv( TriedronAxeX ); - - glVertex3dv( TriedronOrigin ); - glVertex3dv( TriedronAxeY ); - - glVertex3dv( TriedronOrigin ); - glVertex3dv( TriedronAxeZ ); - glEnd(); - - - /* fleches au bout des axes (= cones de la couleur demandee) */ - l = L - L/4. ; /* distance a l'origine */ - rayon = L/30. ; /* rayon de la base du cone */ - NbFacettes = 12; /* le cone sera compose de 12 facettes triangulaires */ - Angle = 2. * M_PI/ NbFacettes; - - /* solution FILAIRE des cones au bout des axes : une seule ligne */ - glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); - /* (la couleur est deja initialisee dans TriedronColor) */ - /* FIN de la solution FILAIRE CHOISIE pour les cones des axes */ - - /* fleche en X */ - glBegin(GL_TRIANGLE_FAN); - glVertex3dv( TriedronAxeX ); - TriedronCoord[0] = TriedronOrigin[0] + l ; - ii = NbFacettes; - while (ii >= 0 ) { - TriedronCoord[1] = TriedronOrigin[1] + ( rayon * sin(ii * Angle) ); - TriedronCoord[2] = TriedronOrigin[2] + ( rayon * cos(ii * Angle) ); - glVertex3dv( TriedronCoord ); - ii--; - } - glEnd(); - - /* fleche en Y */ - glBegin(GL_TRIANGLE_FAN); - glVertex3dv( TriedronAxeY ); - TriedronCoord[1] = TriedronOrigin[1] + l ; - ii = NbFacettes; - while (ii >= 0 ) { - TriedronCoord[0] = TriedronOrigin[0] + (rayon * cos(ii * Angle) ); - TriedronCoord[2] = TriedronOrigin[2] + (rayon * sin(ii * Angle) ); - glVertex3dv( TriedronCoord ); - ii--; - } - glEnd(); - - /* fleche en Z */ - glBegin(GL_TRIANGLE_FAN); - glVertex3dv( TriedronAxeZ ); - TriedronCoord[2] = TriedronOrigin[2] + l ; - ii = NbFacettes; - while (ii >= 0 ) { - TriedronCoord[0] = TriedronOrigin[0] + ( rayon * sin(ii * Angle) ); - TriedronCoord[1] = TriedronOrigin[1] + ( rayon * cos(ii * Angle) ); - glVertex3dv( TriedronCoord ); - ii--; - } - glEnd(); - - /* dessin de l'origine */ - TriedronCoord[0] = TriedronOrigin[0] + rayon ; - TriedronCoord[1] = TriedronOrigin[1] + 0.0 ; - TriedronCoord[2] = TriedronOrigin[2] + 0.0 ; - ii = 24 ; - Angle = 2. * M_PI/ii ; - glBegin(GL_LINE_LOOP); - while (ii >= 0 ) { - TriedronCoord[0] = TriedronOrigin[0] + ( rayon * sin(ii * Angle) ); - TriedronCoord[1] = TriedronOrigin[1] + ( rayon * cos(ii * Angle) ); - glVertex3dv( TriedronCoord ); - ii--; - } - glEnd(); - - LightOff(); - - /* - * Noms des axes et de l'origine - */ - - /* init de la fonte */ - - OpenGl_TextRender* textRender=OpenGl_TextRender::instance(); - - /* Axe X */ - TriedronCoord[0] = TriedronOrigin[0] + ( L + rayon ) ; - TriedronCoord[1] = TriedronOrigin[1] + 0.0; - TriedronCoord[2] = TriedronOrigin[2] - rayon ; - textRender->RenderText(L"X", fontBase, 0, (float)TriedronCoord[0], (float)TriedronCoord[1], (float)TriedronCoord[2] ); - - /* Axe Y */ - TriedronCoord[0] = TriedronOrigin[0] + rayon ; - TriedronCoord[1] = TriedronOrigin[1] + ( L + 3.0 * rayon ) ; - TriedronCoord[2] = TriedronOrigin[2] + ( 2.0 * rayon ); - textRender->RenderText(L"Y", fontBase, 0, (float)TriedronCoord[0], (float)TriedronCoord[1], (float)TriedronCoord[2]); - - /* Axe Z */ - TriedronCoord[0] = TriedronOrigin[0] + ( - 2.0 * rayon ) ; - TriedronCoord[1] = TriedronOrigin[1] + rayon/2. ; - TriedronCoord[2] = TriedronOrigin[2] + ( L + 3.0 * rayon ) ; - textRender->RenderText(L"Z", fontBase, 0, (float)TriedronCoord[0], (float)TriedronCoord[1], (float)TriedronCoord[2]); - -#ifdef QTOCC_PATCH /* PCD 10/02/08 */ - /* Recover the clip planes */ - glGetIntegerv( GL_MAX_CLIP_PLANES, &max_plane); - for (ii = 0; ii aXColor[0]; - aXColor[1] = aParam->aXColor[1]; - aXColor[2] = aParam->aXColor[2]; - - aYColor[0] = aParam->aYColor[0]; - aYColor[1] = aParam->aYColor[1]; - aYColor[2] = aParam->aYColor[2]; - - aZColor[0] = aParam->aZColor[0]; - aZColor[1] = aParam->aZColor[1]; - aZColor[2] = aParam->aZColor[2]; - - aLengthReduce = aParam->aRatio; - aAxisDiametr = aParam->aDiametr; - NbFacettes = aParam->aNbFacettes; - } - - /* - * Calcul des axes => on inhibe le zoom. - */ - - /* la taille des axes est 1 proportion (fixee a l'init du triedre) */ - /* de la dimension la plus petite de la window. */ - if ( U < V ) minUV = U; - else minUV = V; - L = minUV * (double) TriedronScale ; - - /* Position de l'origine */ - TriedronOrigin[0]= 0.0; - TriedronOrigin[1]= 0.0; - TriedronOrigin[2]= 0.0; - - /* Position des Axes */ - TriedronAxeX[0] = TriedronOrigin[0] + L ; - TriedronAxeX[1] = TriedronOrigin[1] + 0.0; - TriedronAxeX[2] = TriedronOrigin[2] + 0.0; - - TriedronAxeY[0] = TriedronOrigin[0] + 0.0; - TriedronAxeY[1] = TriedronOrigin[1] + L ; - TriedronAxeY[2] = TriedronOrigin[2] + 0.0; - - TriedronAxeZ[0] = TriedronOrigin[0] + 0.0; - TriedronAxeZ[1] = TriedronOrigin[1] + 0.0; - TriedronAxeZ[2] = TriedronOrigin[2] + L ; - - /* Check position in the ViewPort */ - glGetDoublev( GL_MODELVIEW_MATRIX, (GLdouble *) modelMatrix ); - glGetDoublev( GL_PROJECTION_MATRIX, (GLdouble *) projMatrix ); - - glGetIntegerv(GL_VIEWPORT, aViewPort); - gluProject(TriedronOrigin[0], TriedronOrigin[1], TriedronOrigin[2], - (GLdouble *)modelMatrix, (GLdouble *)projMatrix, aViewPort, - &aWinCoord[0], &aWinCoord[1], &aWinCoord[2]); - -#ifdef QTOCC_PATCH /* PCD 29/09/2008 */ - /* Simple code modification recommended by Fotis Sioutis and Peter Dolbey */ - /* to remove the irritating default behaviour of triedrons using V3d_ZBUFFER */ - /* which causes the glyph to jump around the screen when the origin moves offscreen. */ - isWithinView = GL_FALSE; -#else - /* Original code */ - isWithinView = !((aWinCoord[0]aViewPort[2]) || - (aWinCoord[1]aViewPort[3])); -#endif - - if (!isWithinView) { - /* Annulate translation matrix */ - modelMatrix[3][0] = 0. ; - modelMatrix[3][1] = 0. ; - modelMatrix[3][2] = 0. ; - projMatrix[3][0] = 0. ; - projMatrix[3][1] = 0. ; - projMatrix[3][2] = 0. ; - - /* save matrix */ - glMatrixMode (GL_MODELVIEW); - glPushMatrix (); - glLoadIdentity (); - glLoadMatrixd( (GLdouble *) modelMatrix); - glMatrixMode ( GL_PROJECTION ); - glPushMatrix (); - glLoadIdentity(); - glLoadMatrixd( (GLdouble *) projMatrix); - - - /* - * Define position in the view - */ - switch (TriedronPosition) { - case 0 : /* Aspect_TOTP_CENTER */ - break; - - case 1 : /* Aspect_TOTP_LEFT_LOWER */ - glTranslated( -U/2. + L , -V/2. + L , 0. ); - break; - - case 2 : /* Aspect_TOTP_LEFT_UPPER */ - glTranslated( -U/2. + L , +V/2. - L -L/3. , 0. ); - break; - - case 3 : /* Aspect_TOTP_RIGHT_LOWER */ - glTranslated( U/2. - L -L/3. , -V/2. + L , 0. ); - break; - - case 4 : /* Aspect_TOTP_RIGHT_UPPER */ - glTranslated( U/2. - L -L/3. , +V/2. - L -L/3. , 0. ); - break; - - default : - break; - - } - L *= aLengthReduce; - } - - - /* - * Creation the trihedron - */ - -#define COLOR_REDUCE 0.3f -#define CYLINDER_LENGTH 0.75f -#ifdef BUG -#define ALPHA_REDUCE 0.4f -#else -#define ALPHA_REDUCE 1.0f -#endif - - startList = glGenLists(4); - aQuadric = gluNewQuadric(); - - aCylinderLength = L * CYLINDER_LENGTH; - aCylinderDiametr = L * aAxisDiametr; - aConeDiametr = aCylinderDiametr * 2; - aConeLength = L * (1 - CYLINDER_LENGTH); - /* Correct for owerlapping */ - /* aCylinderLength += aConeLength - 1.2*aCylinderDiametr*aConeLength/aConeDiametr;*/ - - aIsDepthEnabled = glIsEnabled(GL_DEPTH_TEST); -#ifndef BUG - -#ifdef QTOCC_PATCH /*PCD 02/07/07 */ - /* GL_DEPTH_WRITEMASK is not a valid argument to glIsEnabled, the */ - /* original code is shown to be broken when run under an OpenGL debugger */ - /* like GLIntercept. This is the correct way to retrieve the mask value. */ - glGetBooleanv(GL_DEPTH_WRITEMASK, &aIsDepthMaskEnabled); -#else - aIsDepthMaskEnabled = glIsEnabled(GL_DEPTH_WRITEMASK); -#endif - -#endif - - /* Create cylinder for axis */ - gluQuadricDrawStyle(aQuadric, GLU_FILL); /* smooth shaded */ - gluQuadricNormals(aQuadric, GLU_FLAT); - /* Axis */ - glNewList(startList, GL_COMPILE); - gluCylinder(aQuadric, aCylinderDiametr, aCylinderDiametr, aCylinderLength, NbFacettes, 1); - glEndList(); - /* Cone */ - glNewList(startList + 1, GL_COMPILE); - gluCylinder(aQuadric, aConeDiametr, 0, aConeLength, NbFacettes, 1); - glEndList(); - /* Central sphere */ - glNewList(startList + 2, GL_COMPILE); -#ifdef QTOCC_PATCH - gluSphere(aQuadric, aCylinderDiametr * 2, NbFacettes, NbFacettes); -#else - gluSphere(aQuadric, aCylinderDiametr, NbFacettes, NbFacettes); -#endif - glEndList(); - /* End disk */ - gluQuadricOrientation(aQuadric,GLU_INSIDE); /*szv*/ - glNewList(startList + 3, GL_COMPILE); - gluDisk(aQuadric, aCylinderDiametr, aConeDiametr, NbFacettes, 1/*szv:2*/); - glEndList(); - -#ifdef QTOCC_PATCH - /* Store previous attributes */ - glPushAttrib(GL_LIGHTING_BIT | GL_POLYGON_BIT); - LightOn(); -#else - LightOn(); - - /* Store previous attributes */ - glPushAttrib(GL_LIGHTING_BIT | GL_POLYGON_BIT); -#endif - - glCullFace(GL_BACK); - glEnable(GL_CULL_FACE); - -#ifdef QTOCC_PATCH /*Fotis Sioutis | 2008-01-21 10:55 - In the function call_zbuffer_triedron_redraw of TKOpengl, - the z buffered trihedron changes colors in case there - is an object in the scene that has an explicit material - attached to it.In the trihedron display loop, - GL_COLOR_MATERIAL is enabled, but only the GL_DIFFUSE - parameter is utilized in glColorMaterial(...). - This causes the last ambient,specular and emission values - used, to stay at the stack and applied to the trihedron - (which causes the color change). - A fix is proposed , to change GL_DIFFUSE to - GL_AMBIENT_AND_DIFFUSE in glColorMaterial call in - line 946.The above of course will leave unchanged - the SPECULAR and EMISSION values. - Another proposal which would fix 100% the problem - is to use glMaterial instead of glColor on the trihedron - drawing loop. */ - glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, aNULLColor); - glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, aNULLColor); - glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, aNULLColor); - - glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 0.); -#endif - - glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE); - glEnable(GL_COLOR_MATERIAL); - - if (!aIsDepthEnabled) { - glEnable(GL_DEPTH_TEST); -#ifndef BUG - glClear(GL_DEPTH_BUFFER_BIT); -#endif - } -#ifdef BUG - if (!(aIsDepthEnabled && isWithinView)) - glClear(GL_DEPTH_BUFFER_BIT); -#endif -#ifndef BUG - if (!aIsDepthMaskEnabled) { - /* This is how the depthmask needs to be re-enabled...*/ - glDepthMask(GL_TRUE); - /* ...and not this stuff below */ - } -#endif - - glMatrixMode(GL_MODELVIEW); -#ifdef QTOCC_PATCH /* PCD 17/06/07 */ - glGetIntegerv (GL_DEPTH_FUNC, &df); -#else - /*szv:if (isWithinView) {*/ - glDepthFunc(GL_GREATER); - glPushMatrix(); - glPushMatrix(); - glPushMatrix(); - - glColor4f(TriedronColor[0]*COLOR_REDUCE, - TriedronColor[1]*COLOR_REDUCE, - TriedronColor[2]*COLOR_REDUCE, - ALPHA_REDUCE); - glCallList(startList+2); - - /* Z axis */ - glColor4f(aZColor[0]*COLOR_REDUCE, - aZColor[1]*COLOR_REDUCE, - aZColor[2]*COLOR_REDUCE, - ALPHA_REDUCE); - glCallList(startList); - glTranslated(0, 0, L * CYLINDER_LENGTH); - glCallList(startList + 3); - glCallList(startList + 1); - glPopMatrix(); - - /* X axis */ - glRotated(90.0, TriedronAxeY[0], TriedronAxeY[1], TriedronAxeY[2]); - glColor4f(aXColor[0]*COLOR_REDUCE, - aXColor[1]*COLOR_REDUCE, - aXColor[2]*COLOR_REDUCE, - ALPHA_REDUCE); - glCallList(startList); - glTranslated(0, 0, L * CYLINDER_LENGTH); - glCallList(startList + 3); - glCallList(startList + 1); - glPopMatrix(); - - /* Y axis */ - glRotated(-90.0, TriedronAxeX[0], TriedronAxeX[1], TriedronAxeX[2]); - glColor4f(aYColor[0]*COLOR_REDUCE, - aYColor[1]*COLOR_REDUCE, - aYColor[2]*COLOR_REDUCE, - ALPHA_REDUCE); - glCallList(startList); - glTranslated(0, 0, L * CYLINDER_LENGTH); - glCallList(startList + 3); - glCallList(startList + 1); - glPopMatrix(); - - glDepthFunc(GL_LESS); - /*szv:}*/ -#endif - -#ifdef QTOCC_PATCH - for (i = 0; i < 2; i++) /* PCD 11/02/08 Two pass method */ - { - if (i == 0) /* First pass */ - { - glDepthFunc(GL_ALWAYS); - } - else - { - glDepthFunc(GL_LEQUAL); - } -#endif - - glPushMatrix(); - glPushMatrix(); - glPushMatrix(); - - glColor3fv(TriedronColor); - glCallList(startList+2); - - /* Z axis */ - glColor4fv(aZColor); - glCallList(startList); - glTranslated(0, 0, L * CYLINDER_LENGTH); - glCallList(startList + 3); - glCallList(startList + 1); - glPopMatrix(); - - /* X axis */ - glRotated(90.0, TriedronAxeY[0], TriedronAxeY[1], TriedronAxeY[2]); - glColor4fv(aXColor); - glCallList(startList); - glTranslated(0, 0, L * CYLINDER_LENGTH); - glCallList(startList + 3); - glCallList(startList + 1); - glPopMatrix(); - - /* Y axis */ - glRotated(-90.0, TriedronAxeX[0], TriedronAxeX[1], TriedronAxeX[2]); - glColor4fv(aYColor); - glCallList(startList); - glTranslated(0, 0, L * CYLINDER_LENGTH); - glCallList(startList + 3); - glCallList(startList + 1); - glPopMatrix(); - -#ifdef QTOCC_PATCH - } -#endif - - if (!aIsDepthEnabled) - glDisable(GL_DEPTH_TEST); -#ifndef BUG - if (!aIsDepthMaskEnabled) - -#ifdef QTOCC_PATCH /*PCD 02/07/07 */ - glDepthMask(GL_FALSE); -#else - glDisable(GL_DEPTH_WRITEMASK); -#endif - -#endif - glDisable(GL_CULL_FACE); - glDisable(GL_COLOR_MATERIAL); - - gluDeleteQuadric(aQuadric); - glColor3fv (TriedronColor); - -#ifdef QTOCC_PATCH /* PCD 11/02/08 */ - /* Always write the text */ - glDepthFunc(GL_ALWAYS); -#endif - - glPopAttrib(); - - /* fleches au bout des axes (= cones de la couleur demandee) */ - l = L - L/4. ; /* distance a l'origine */ - rayon = L/30. ; /* rayon de la base du cone */ - Angle = 2. * M_PI/ NbFacettes; - - glDeleteLists(startList, 4); - - LightOff(); - - /* - * origine names - */ - - /* init font */ - - OpenGl_TextRender* textRender=OpenGl_TextRender::instance(); - - /* Axe X */ - TriedronCoord[0] = TriedronOrigin[0] + ( L + rayon ) ; - TriedronCoord[1] = TriedronOrigin[1] + 0.0; - TriedronCoord[2] = TriedronOrigin[2] - rayon ; - textRender->RenderText(L"X", fontBase, 0, (float)TriedronCoord[0], (float)TriedronCoord[1], (float)TriedronCoord[2]); - - /* Axe Y */ - TriedronCoord[0] = TriedronOrigin[0] + rayon ; - TriedronCoord[1] = TriedronOrigin[1] + ( L + 3.0 * rayon ) ; - TriedronCoord[2] = TriedronOrigin[2] + ( 2.0 * rayon ); - textRender->RenderText(L"Y", fontBase, 0, (float)TriedronCoord[0], (float)TriedronCoord[1], (float)TriedronCoord[2]); - - /* Axe Z */ - TriedronCoord[0] = TriedronOrigin[0] + ( - 2.0 * rayon ) ; - TriedronCoord[1] = TriedronOrigin[1] + rayon/2. ; - TriedronCoord[2] = TriedronOrigin[2] + ( L + 3.0 * rayon ) ; - textRender->RenderText(L"Z", fontBase, 0, (float)TriedronCoord[0], (float)TriedronCoord[1], (float)TriedronCoord[2]); - -#ifdef QTOCC_PATCH - /*PCD 17/06/07 */ - glDepthFunc(df); - - /* PCD 10/02/08 */ - /* Recover the clip planes */ - glGetIntegerv( GL_MAX_CLIP_PLANES, &max_plane); - for (i = 0; i < max_plane ; i++) { - if (isPlaneActive[i]) { - glEnable(GL_CLIP_PLANE0 + i); - } - } - free(isPlaneActive); -#endif - - if (!isWithinView) { /* restore matrix */ - glMatrixMode (GL_PROJECTION); - glPopMatrix (); - glMatrixMode (GL_MODELVIEW); - glPopMatrix (); - } - - return (TSuccess); - -} - - -/*----------------------------------------------------------------------*/ - -/*----------------------------------------------------------------------*/ -/* -* Fonctions publiques -*/ - - -/* -* initialisation d'un triedre non zoomable dans une vue. -* ou modification des valeurs deja initialisees. -*/ - -TStatus call_triedron_init ( - CALL_DEF_VIEW * aview, - int aPosition, - float r, - float g, - float b, - float aScale, - int asWireframe - ) - -{ - - int nz_wks_entry; - int nz_struc_entry; - ZBUF_STRUCT* aParam; - - -#ifdef PRINT - printf("\n----------- call_triedron_init r = %f, g = %f, b = %f", - r, g, b); - printf(", aScale = %f, aPosition = %d \n", aScale, aPosition ); -#endif - - if (aview->WsId == -1) return(TFailure); - if (aview->ViewId == -1) return(TFailure); -#ifdef PRINT - printf(", aview->WsId=%d aview->ViewId=%d \n",aview->WsId,aview->ViewId); -#endif - - - - /* recherche du num de la liste de structures non zoomables de la wks */ - /* creation sinon */ - nz_wks_entry = find_nz_wks(aview->WsId, 1); - if (nz_wks_entry == -1) return TFailure; - - /* recherche du Triedre s'il existe; creation sinon */ - nz_struc_entry = find_nz_struc(nz_wks_entry, TRIEDRON_ID, 1); - if (nz_struc_entry == -1) return TFailure; - - /* mise a jour du Triedre */ - nz_wks[nz_wks_entry].triedron_on = 1; - nz_wks[nz_wks_entry].nz_struc[nz_struc_entry].NZStrucID = TRIEDRON_ID; - nz_wks[nz_wks_entry].nz_struc[nz_struc_entry].astructure = NULL; - nz_wks[nz_wks_entry].nz_struc[nz_struc_entry].aPos = aPosition; - nz_wks[nz_wks_entry].nz_struc[nz_struc_entry].aColor[0] = r; - nz_wks[nz_wks_entry].nz_struc[nz_struc_entry].aColor[1] = g; - nz_wks[nz_wks_entry].nz_struc[nz_struc_entry].aColor[2] = b; - nz_wks[nz_wks_entry].nz_struc[nz_struc_entry].aScale = aScale; - nz_wks[nz_wks_entry].nz_struc[nz_struc_entry].isWireframe = asWireframe; - - nz_wks[nz_wks_entry].nz_struc[nz_struc_entry].aZBufParam = new ZBUF_STRUCT(); - if (nz_wks[nz_wks_entry].nz_struc[nz_struc_entry].aZBufParam == NULL) return TFailure; - - aParam = nz_wks[nz_wks_entry].nz_struc[nz_struc_entry].aZBufParam; - aParam->aXColor[0] = theXColor[0]; - aParam->aXColor[1] = theXColor[1]; - aParam->aXColor[2] = theXColor[2]; - - aParam->aYColor[0] = theYColor[0]; - aParam->aYColor[1] = theYColor[1]; - aParam->aYColor[2] = theYColor[2]; - - aParam->aZColor[0] = theZColor[0]; - aParam->aZColor[1] = theZColor[1]; - aParam->aZColor[2] = theZColor[2]; - - aParam->aRatio = theRatio; - aParam->aDiametr = theDiametr; - aParam->aNbFacettes = theNBFacettes; - - -#ifdef DEBUG - printf("nz_wks_entry=%d nz_struc_entry=%d \n",nz_wks_entry,nz_struc_entry); - printf("ajout ok\n"); -#endif - return (TSuccess); - -} - -/*----------------------------------------------------------------------*/ - -/* -* affichage d'un triedre non zoomable dans la wks awsid -* -* Triedre = Objet non Zoomable; -* on cree cette fonction pour pouvoir travailler par les structures -* utilisees par les fonctions Tsm* et TEL_VIEW_REP -* -*/ - -TStatus call_triedron_redraw_from_wsid ( - Tint awsid - ) - -{ - - TStatus status = TSuccess; - int nz_wks_entry; - int nz_struc_entry; - int save_texture_state; - GLdouble U, V ; /* largeur,hauteur de la fenetre */ - - CMN_KEY_DATA key; - tel_view_data vptr; - - if ( awsid == -1) return (TFailure ); - -#ifdef BUC61045 - /* check if GL_LIGHTING should be disabled - no enabling 'cause it will be done (if necessary: kinda Polygon types ) - during redrawing structures - */ - TsmGetWSAttri (awsid, WSGLLight, &key ); - if ( key.ldata == TOff ) - glDisable( GL_LIGHTING ); -#endif - - /* recherche du numero de la liste de structures non zoomables de la wks */ -#ifdef PRINT - printf("\n----------- call_triedron_redraw_from_WSID : appel find_nz_wks \n"); -#endif - nz_wks_entry = find_nz_wks(awsid, 0); - /* si on ne l'a pas trouve, il n'y a rien a faire */ - if (nz_wks_entry == -1) return (TSuccess); - - /* recherche du Triedre */ -#ifdef PRINT - printf("\n----------- call_triedron_redraw_from_WSID : appel find_nz_struc \n"); -#endif - nz_struc_entry = find_nz_struc(nz_wks_entry, TRIEDRON_ID, 0); - /* si on ne l'a pas trouve, il n'y a rien a faire */ - if (nz_struc_entry == -1) return (TSuccess); - /* si il est "off" il n'y a rien a faire */ - if (nz_wks[nz_wks_entry].triedron_on == 0) return (TSuccess); - - - /* recherche de la dimension de la fenetre */ - /* (car la taille des axes du treiedre en sera 1 proportion) */ - TsmGetWSAttri (awsid, WSViews, &key ); - vptr = (tel_view_data)key.pdata ; /* Obtain defined view data*/ - if ( !vptr ) return TFailure; /* no view defined yet */ - U = vptr->vrep.extra.map.window.xmax - vptr->vrep.extra.map.window.xmin; - V = vptr->vrep.extra.map.window.ymax - vptr->vrep.extra.map.window.ymin; - - /* sauvegarde du contexte (on reste dans le buffer courant) */ - save_texture_state = IsTextureEnabled(); - DisableTexture(); - - /* affichage du Triedre Non Zoomable */ - transform_persistence_end(); - if (nz_wks[nz_wks_entry].nz_struc[nz_struc_entry].isWireframe) - status = call_triedron_redraw (nz_wks_entry, nz_struc_entry, U, V); - else - status = call_zbuffer_triedron_redraw (nz_wks_entry, nz_struc_entry, U, V); - - /* restauration du contexte */ - if (save_texture_state) EnableTexture(); - - return status; - -} - -/*----------------------------------------------------------------------*/ - -/* -* affichage d'un triedre non zoomable dans la vue aview -* -* Triedre = Objet non Zoomable; -* on cree cette fonction pour pouvoir utiliser CALL_DEF_VIEW -* -*/ - -TStatus call_triedron_redraw_from_view ( - CALL_DEF_VIEW * aview - ) -{ - - TStatus status = TSuccess; - int nz_wks_entry; - int nz_struc_entry; - int save_texture_state; - GLdouble U, V ; /* largeur,hauteur de la fenetre */ - - - - if (aview->WsId == -1) return (TFailure ); - if (aview->ViewId == -1) return (TFailure); -#ifdef PRINT - printf("\n call_triedron_redraw_from_VIEW aview->WsId=%d aview->ViewId=%d \n",aview->WsId,aview->ViewId); -#endif - - - /* recherche du numero de la liste de structures non zoomables de la wks */ -#ifdef PRINT - printf("\n----------- call_triedron_redraw_from_VIEW : appel find_nz_wks \n"); -#endif - nz_wks_entry = find_nz_wks(aview->WsId, 0); - /* si on ne l'a pas trouve, il n'y a rien a faire */ - if (nz_wks_entry == -1) return (TSuccess); - - /* recherche du Triedre */ -#ifdef PRINT - printf("\n----------- call_triedron_redraw_from_VIEW : appel find_nz_struc \n"); -#endif - nz_struc_entry = find_nz_struc(nz_wks_entry, TRIEDRON_ID, 0); - /* si on ne l'a pas trouve, il n'y a rien a faire */ - if (nz_struc_entry == -1) return (TSuccess); - /* si il est "off" il n'y a rien a faire */ - if (nz_wks[nz_wks_entry].triedron_on == 0) return (TSuccess); - - - /* recherche de la dimension de la fenetre */ - /* (car la taille des axes du treiedre en sera 1 proportion) */ - U = aview->Mapping.WindowLimit.uM - aview->Mapping.WindowLimit.um ; - V = aview->Mapping.WindowLimit.vM - aview->Mapping.WindowLimit.vm ; - - /* sauvegarde du contexte et ecriture en front buffer */ - save_texture_state = IsTextureEnabled(); - DisableTexture(); - glDrawBuffer (GL_FRONT); - - /* affichage du Triedre Non Zoomable */ - transform_persistence_end(); - status = call_triedron_redraw (nz_wks_entry, nz_struc_entry, U, V); - - /* necessaire pour WNT */ - glFlush(); - - /* restauration du contexte */ - if (save_texture_state) EnableTexture(); - glDrawBuffer (GL_BACK); - - return status; - -} - -/*----------------------------------------------------------------------*/ - -/* -* destruction du triedre non zoomable d'une vue. -*/ - -TStatus call_triedron_erase ( - CALL_DEF_VIEW * aview - ) - -{ - int nz_wks_entry; - int i; - - -#ifdef PRINT - printf("\n----------- call_triedron_erase " ); -#endif - - if (aview->WsId == -1) return(TFailure); - if (aview->ViewId == -1) return(TFailure); -#ifdef PRINT - printf(", aview->WsId=%d aview->ViewId=%d \n",aview->WsId,aview->ViewId); -#endif - - - /* recherche du num de la liste de structures non zoomables de la wks */ - /* si on ne l'a pas trouve, il n'y a rien a faire */ - nz_wks_entry = find_nz_wks(aview->WsId, 0); - if (nz_wks_entry == -1) return TSuccess; - - - /* - * destruction du Triedre puis de toute la wks - */ - /* (aujourd'hui il n'y a pas d'autre structure graphique dans la table */ - /* de la wks => on detruit tout ; */ - /* si on ajoutait d'autres structures non zoomables, il faudrait */ - /* selectionner et detruire uniquement l'element Triedre en cherchant */ - /* s'il existe via une variable nz_struc_entry ). */ - for (i = 0; i < nz_wks[nz_wks_entry].nz_struc_count; i++) { - if (nz_wks[nz_wks_entry].nz_struc[i].aZBufParam != NULL) - free(nz_wks[nz_wks_entry].nz_struc[i].aZBufParam); - } - - if (nz_wks[nz_wks_entry].nz_struc != NULL) { - free(nz_wks[nz_wks_entry].nz_struc); - } - - if (nz_wks_count == 1) { - free(nz_wks); - nz_wks_count = 0; - nz_wks_size = 0; - } - else { /* il y a au moins 2 wks definies */ - memcpy(&nz_wks[nz_wks_entry], - &nz_wks[nz_wks_entry+1], - (nz_wks_count - nz_wks_entry - 1)*sizeof(NZ_WKS)); - nz_wks_count--; - } - - -#ifdef DEBUG - printf("nz_wks_entry=%d nz_wks_count=%d nz_wks_size=%d\n", - nz_wks_entry, nz_wks_count, nz_wks_size ); - printf("erase ok\n"); -#endif - - return (TSuccess); -} - -/*----------------------------------------------------------------------*/ - - -/* -* gestion d'un echo de designation du triedre non zoomable d' une vue. -*/ -TStatus call_triedron_echo ( - CALL_DEF_VIEW * aview, - int aType - ) - -{ - return (TSuccess); -} - - -/*----------------------------------------------------------------------*/ - -/* -* initialisation of zbuffer trihedron -*/ -extern TStatus call_ztriedron_setup ( - float* xcolor, - float* ycolor, - float* zcolor, - float sizeratio, - float axisdiameter, - int nbfacettes) -{ - theXColor[0] = xcolor[0]; - theXColor[1] = xcolor[1]; - theXColor[2] = xcolor[2]; - - theYColor[0] = ycolor[0]; - theYColor[1] = ycolor[1]; - theYColor[2] = ycolor[2]; - - theZColor[0] = zcolor[0]; - theZColor[1] = zcolor[1]; - theZColor[2] = zcolor[2]; - - theRatio = sizeratio; - theDiametr = axisdiameter; - theNBFacettes = nbfacettes; - - return (TSuccess); -} - diff --git a/src/OpenGl/OpenGl_triedron.hxx b/src/OpenGl/OpenGl_triedron.hxx deleted file mode 100755 index 29182b8ba5..0000000000 --- a/src/OpenGl/OpenGl_triedron.hxx +++ /dev/null @@ -1,115 +0,0 @@ -/*********************************************************************** - -FONCTION : ----------- -File OpenGl_triedron.h : gestion du triedre non zoomable. - - -REMARQUES: ----------- - - -HISTORIQUE DES MODIFICATIONS : --------------------------------- -24-10-98 : BGN ; Creation. - -************************************************************************/ - -/*----------------------------------------------------------------------*/ - -#ifndef __OPENGL_TRIEDRON_H_ -#define __OPENGL_TRIEDRON_H_ - -/*----------------------------------------------------------------------*/ -/* -* Includes -*/ - -#include - -#include -#include -#include - - -/*----------------------------------------------------------------------*/ -/* -* Constantes -*/ - - -/*----------------------------------------------------------------------*/ -/* -* Types definis -*/ - - -/*----------------------------------------------------------------------*/ -/* -* variables statiques -*/ - - -/*----------------------------------------------------------------------*/ -/* -* Prototypes -*/ -/* -* initialisation of zbuffer trihedron -*/ -extern TStatus call_ztriedron_setup ( - float* xcolor, - float* ycolor, - float* zcolor, - float sizeratio, - float axisdiameter, - int nbfacettes - ); - -/* -* initialisation d'un triedre non zoomable dans la Wks -*/ -extern TStatus call_triedron_init ( - CALL_DEF_VIEW * aview, - int aPosition, - float r, - float g, - float b, - float aScale, - int asWireframe); - - -/* -* affichage d'un triedre non zoomable dans la vue aview. -*/ - -extern TStatus call_triedron_redraw_from_view (CALL_DEF_VIEW * aview); - - -/* -* affichage d'un triedre non zoomable dans la workstation awsid -*/ - -extern TStatus call_triedron_redraw_from_wsid (Tint awsid); - - -/* -* destruction du triedre non zoomable d' une vue. -*/ - -extern TStatus call_triedron_erase (CALL_DEF_VIEW * aview); - -/* -* gestion d'un echo de designation du triedre non zoomable d' une vue. -*/ -extern TStatus call_triedron_echo ( - CALL_DEF_VIEW * aview, - int aType); - - -/*----------------------------------------------------------------------*/ - -#endif /* __OPENGL_TRIEDRON_H_ */ - -/*----------------------------------------------------------------------*/ - diff --git a/src/OpenGl/OpenGl_trsf_stack.hxx b/src/OpenGl/OpenGl_trsf_stack.hxx deleted file mode 100755 index 4b17e00d7c..0000000000 --- a/src/OpenGl/OpenGl_trsf_stack.hxx +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef OPENGL_TRSF_STACK_H -#define OPENGL_TRSF_STACK_H - -typedef struct TSM_TRSF_STACK_STRUCT { - struct TSM_TRSF_STACK_STRUCT *next; - struct TSM_TRSF_STACK_STRUCT *prev; - Tmatrix3 LocalTran3; -} TSM_TRSF_STACK, *tsm_trsf_stack; - -#endif diff --git a/src/OpenGl/OpenGl_tsm.cxx b/src/OpenGl/OpenGl_tsm.cxx deleted file mode 100755 index 7b8a96f13a..0000000000 --- a/src/OpenGl/OpenGl_tsm.cxx +++ /dev/null @@ -1,640 +0,0 @@ -/*********************************************************************** - -FONCTION : ----------- -File OpenGl_togl_texture.c : - - -REMARQUES: ----------- - - -HISTORIQUE DES MODIFICATIONS : --------------------------------- -05-08-97 : PCT ; Support texture mapping -ajout pour deuxieme passe du texture mapping - -************************************************************************/ - -#define G003 /* EUG 16-09-99 ZBufferAuto treatment -*/ - -/*----------------------------------------------------------------------*/ -/* -* Includes -*/ - -#include - -#include -#include - -#include -#include -#include -#include - -static MtblPtr TsmMtblArray[TelLast]; - -/* Fixed Header info for a structure */ -struct TSM_HEAD_STRUCT -{ - Tint num; /* number of elements present */ -}; -typedef TSM_HEAD_STRUCT TSM_HEAD; -typedef TSM_HEAD_STRUCT* tsm_head; - -/* The head of the list when the structure is in the form of a list */ -struct TSM_LHEAD_STRUCT -{ - tsm_node next; // first list node - tsm_node prev; // last list node for reverse iteration - TSM_HEAD header; -}; -typedef TSM_LHEAD_STRUCT TSM_LHEAD; -typedef TSM_LHEAD_STRUCT *tsm_lhead; - -/* A Structure having fixed header and variable list of elements */ -struct TSM_STRUCT_STRUCT -{ - TSM_LHEAD elemListHead; - IMPLEMENT_MEMORY_OPERATORS -}; -typedef TSM_STRUCT_STRUCT TSM_STRUCT; -typedef TSM_STRUCT_STRUCT *tsm_struct; - -#define TsmStructureNotOpen -1 -#define TsmInvalidStructure -1 - -/* Context maintained for the currently open structure */ -struct TSM_CONTEXT_STRUCT -{ - Tint stid; /* Current Open Structure */ - Tint ind; /* Current Element Index */ - /* = TsmStructureNotOpen if no structure currently open */ - tsm_struct s; /* Current Structure Pointer */ - tsm_node n; /* Current Element list node */ -}; -typedef TSM_CONTEXT_STRUCT TSM_CONTEXT; -typedef TSM_CONTEXT_STRUCT* tsm_context; - -static TSM_CONTEXT context = { TsmInvalidStructure, TsmStructureNotOpen, 0, 0 }; - -static TEditMode edit_mode; - -#define TSM_HTBL_SIZE 251 -typedef NCollection_List NodeList; -typedef NCollection_DataMap StructMap; -Handle(NCollection_BaseAllocator) _Allocator = NCollection_BaseAllocator::CommonBaseAllocator(); -static StructMap _StructMap( 1, _Allocator ); - - - -/* Global workstation variable */ -Tint TglActiveWs; /* valid only during traversals */ - -void -TsmInitAllClasses( MtblPtr (**tbl)(TelType*), Tint size ) -{ - register Tint i; - TelType el; - register MtblPtr fp; - - for( i=0; ielemListHead.header.num; - node = s->elemListHead.next; - - for( i=0; ielem.el, Delete, node->elem.data, 0 ); - prev = node; - node = node->next; - delete prev; - } - - s->elemListHead.next = s->elemListHead.prev = (tsm_node)&(s->elemListHead); - s->elemListHead.header.num = 0; - return; -} - -TStatus -TsmOpenStructure( Tint stid ) -{ - tsm_struct s = 0; - - if( _Allocator.IsNull() ) - return TFailure; - - if( context.ind != TsmStructureNotOpen ) - return TFailure; /* Some structure already open */ - - if ( !_StructMap.IsBound(stid) ){ - s = new TSM_STRUCT(); - if ( !s ) - return TFailure; // Memory allocation failed - - _StructMap.Bind( stid, s ); - s->elemListHead.next = s->elemListHead.prev = (tsm_node)&(s->elemListHead); - s->elemListHead.header.num = 0; - } - - s = _StructMap.Find(stid); - - context.s = s; - context.stid = stid; - // Make the context point at the last node of the structure, - // this is the list head in case of an empty structure - context.ind = s->elemListHead.header.num; - context.n = s->elemListHead.prev; - - /* Ajout CAL, 14/09/95 */ - /* on force l'update_state de toutes les wks a TNotDone */ - TsmInitUpdateState (); - - return TSuccess; -} - -TStatus -TsmCloseStructure() -{ - if( context.ind == TsmStructureNotOpen ) - return TFailure; /* No structure currently open */ - - context.ind = TsmStructureNotOpen; - - return TSuccess; -} - - -TStatus -TsmDisplayStructure( Tint stid, Tint wsid ) -{ - TSM_ELEM_DATA data; - CMN_KEY key; - - TglActiveWs = wsid; - - if( context.ind != TsmStructureNotOpen ) - return TFailure; /* Some structure currently open */ - - key.id = wsid; - data.ldata = stid; - TsmSendMessage( TelExecuteStructure, DisplayTraverse, data, 1, &key ); - - return TSuccess; -} - -TStatus -TsmPrintStructure( Tint stid ) -{ - tsm_node node; - Tint i, num; - tsm_struct s; - - if( context.ind != TsmStructureNotOpen ) - return TFailure; /* Some structure currently open */ - - if ( _StructMap.IsEmpty() ) - return TFailure; /* No structure created yet */ - - /* Obtain structure pointer from hash table */ - if ( !_StructMap.IsBound(stid) ) - return TFailure; /* Non-existent structure */ - - s = _StructMap.Find(stid); - - printf( "\nPRINT:" ); - printf( "\n\tSTRUCTURE ID = %d", stid ); - if( !s ){ - num = 0; - node = 0; - } - else{ - num = s->elemListHead.header.num; - node = s->elemListHead.next; - } - - printf( "\n\tNUMBER OF ELEMENTS = %d", num); - printf( "\n" ); - - /* For each element Send Message Print */ - for( i = 0; i < num; i++ ){ - printf("\n\tElement[%d] : ", i+1); - TsmSendMessage( node->elem.el, Print, node->elem.data, 0 ); - node = node->next; - } - - return TSuccess; -} - -TStatus -TsmAddToStructure( TelType el, Tint n, ... ) -{ - TSM_ELEM_DATA data; -#if defined (SOLARIS) || defined (IRIXO32) - cmn_key *k; -#else - cmn_key k[TMaxArgs]; -#endif - - if( context.ind == TsmStructureNotOpen ) - return TFailure; /* No structure currently open */ - - CMN_GET_STACK( n, k ); - data.pdata = &data; - if( TsmSendMessage( el, Add, data, -n, k ) == TFailure ) - return TFailure; - - if( edit_mode == TEditReplace ){ - TsmSendMessage( context.n->elem.el, Delete, context.n->elem.data, 0 ); - } - else{ - tsm_node node = new TSM_NODE(); - - if( !node ) - return TFailure; - - /* insert the node in the linked list after the current node */ - node->prev = context.n; - node->next = context.n->next; - context.n->next = node; - node->next->prev = node; - - /* Make this node as current node */ - context.n = node; - context.ind++; - - /* Increment the no of elements */ - context.s->elemListHead.header.num++; - } - - context.n->elem.el = el; - context.n->elem.data = data; - - return TSuccess; -} - -TStatus -TsmDeleteStructure( Tint stid ) -{ - if( context.ind != TsmStructureNotOpen && context.stid == stid ) - return TFailure; /* Same structure currently open */ - - if ( _StructMap.IsEmpty() ) - return TFailure; /* No structure created yet */ - - if ( !_StructMap.IsBound(stid) ) - return TFailure; /* Non-existent structure */ - - tsm_struct s = _StructMap.ChangeFind(stid); - - if( stid == context.stid ){ - context.stid = TsmInvalidStructure; - // Ensure the context doesn't point to freed memory - context.s = 0; - context.n = 0; - } - - if( s ){ - TsmFreeList( s ); - - /* Free structure memory */ - delete s; - } - - /* Remove hash table entry */ - _StructMap.UnBind( stid ); - - /* Ajout BGN, 27/05/97 */ - /* on force l'update_state de toutes les wks a TNotDone */ - TsmInitUpdateState (); - - return TSuccess; -} - -TEditMode -TsmSetEditMode( TEditMode mode ) -{ - TEditMode m; - - m = edit_mode; - - /* Set static variable for mode */ - edit_mode = mode; - - /* return previous mode */ - return m; -} - -TStatus -TsmDeleteElement() -{ - tsm_node node; - - if( context.ind == TsmStructureNotOpen ) - return TFailure; /* No structure currently open */ - - // Zero ind means the currently open structure is empty - // or the current node is the list head -> nothing to delete - // See also TsmSetElementPointer() - if( !context.ind ) - return TFailure; - - /* Send message DELETE element */ - TsmSendMessage( context.n->elem.el, Delete, context.n->elem.data, 0 ); - - node = context.n; - node->prev->next = node->next; - node->next->prev = node->prev; - - /* make previous node as current node */ - context.n = node->prev; - context.ind--; - - /* Decrement the no of elements */ - context.s->elemListHead.header.num--; - - /* free the linked list node */ - delete node; - - return TSuccess; -} - -TStatus -TsmDeleteElementsBetweenLabels( Tint label_id1, Tint label_id2 ) -/* label_id1 & label_id2 exclusive */ -{ - Tint elem1, elem2; - - if( context.ind == TsmStructureNotOpen ) - return TFailure; /* No structure currently open */ - - TsmSetElementPointer( 0 ); - - if( TsmSetElementPointerAtLabel( label_id1 ) == TFailure) - return TFailure; - elem1 = context.ind; - - if( TsmSetElementPointerAtLabel( label_id2 ) == TFailure) - return TFailure; - elem2 = context.ind; - - TsmDeleteElementRange( elem1, elem2 ); - - return TSuccess; -} - -TStatus -TsmDeleteElementRange( Tint elem1, Tint elem2 ) /* elem1 & elem2 exclusive */ -{ - if( context.ind == TsmStructureNotOpen ) - return TFailure; /* No structure currently open */ - - TsmSetElementPointer( elem2 - 1 ); - while( context.ind != elem1 && context.ind ) - TsmDeleteElement(); - - return TSuccess; -} - -TStatus -TsmSetElementPointer( Tint index ) -{ - if( context.ind == TsmStructureNotOpen ) - return TFailure; /* No structure currently open */ - - /* Set static variable accordingly */ - if( context.ind == index ){ - return TSuccess; - } - if( index >= context.s->elemListHead.header.num ){ - index = context.s->elemListHead.header.num; - context.n = context.s->elemListHead.prev; - } - else if( index <= 0 ){ - index = 0; - context.n = (tsm_node)&(context.s->elemListHead); - } - else{ - Tint a, b, c, d; - tsm_node node; - - a = index - 0; - b = context.ind - index; if( b < 0 ) b = -b; /* b = labs(b) */ - c = context.s->elemListHead.header.num - index; - d = ( a < b ) ? ( a < c ? a : c ) : ( b < c ? b : c ) ; - - if( a == d ){ - /* Traverse from head in forward direction */ - d = index-1; - node = context.s->elemListHead.next; - while( d-- ){ - node = node->next; - } - } - else if( b == d ){ - /* Traverse from current node in appropriate direction */ - node = context.n; - d = context.ind; - if( context.ind < index ){ - while( d != index ){ - node = node->next; - d++; - } - } - else{ - while( d != index ){ - node = node->prev; - d--; - } - } - } - else{ /* ( c == d ) */ - /* Traverse from head in backward direction */ - d = context.s->elemListHead.header.num; - node = context.s->elemListHead.prev; - while( d != index ){ - node = node->prev; - d--; - } - } - - context.n = node; - } - - context.ind = index; - - return TSuccess; -} - - -TStatus -TsmSetElementPointerAtLabel( Tint label_id ) -{ - Tint i, num; - tsm_node node; - - if( context.ind == TsmStructureNotOpen ) - return TFailure; /* No structure currently open */ - - num = context.s->elemListHead.header.num; - for( i=context.ind+1, node=context.n->next; i<=num; i++, node=node->next ){ - if( node->elem.el == TelLabel && node->elem.data.ldata == label_id ){ - context.ind = i; - context.n = node; - return TSuccess; - } - } - - return TFailure; -} - -TStatus -TsmOffsetElementPointer( Tint offset ) -{ - return TsmSetElementPointer( context.ind + offset ); -} - -TStatus -TsmGetStructure( Tint stid, Tint *num, tsm_node *n ) -{ - if ( _StructMap.IsEmpty() ) - return TFailure; /* No structure created yet */ - - if ( !_StructMap.IsBound(stid) ) - return TFailure; /* Non-existent structure */ - - tsm_struct s = _StructMap.Find(stid); - - *num = s ? s->elemListHead.header.num : 0; - // Here we cannot return a pointer to the structure's list head, - // as it will wrongly interpreted as a regular pointer to TSM_NODE, - // thus returning null pointer - this should be checked by callers! - *n = s ? s->elemListHead.next : 0; - - return TSuccess; -} - -static TStatus -GetDepth( Tint stid, Tint *depth ) -{ - tsm_struct s; - Tint i, d, b, num; - - if ( _StructMap.IsEmpty() ) - return TFailure; /* No structure created yet */ - - if ( !_StructMap.IsBound(stid) ) - return TFailure; /* Non-existent structure */ - - s = _StructMap.Find(stid); - - (*depth)++; - d = b = *depth; - - if( s ){ - num = s->elemListHead.header.num; - tsm_node node = s->elemListHead.next; - for( i = 0; i < num; i++ ){ - if( node->elem.el == TelExecuteStructure ){ - GetDepth( node->elem.data.ldata, &d ); - if( *depth < d ) - *depth = d; - } - d = b; - node = node->next; - } - } - - return TSuccess; -} - - -TStatus -TsmGetStructureDepth( Tint stid, Tint *depth ) -{ - *depth = 0; - - GetDepth( stid, depth ); - return TSuccess; -} - -TStatus -TsmGetCurElem( TSM_ELEM *elem ) -{ - // Zero ind means no current element - if( context.ind == TsmStructureNotOpen || - !context.ind ) - return TFailure; - - *elem = context.n->elem; - return TSuccess; -} - -TStatus -TsmGetCurElemPtr( Tint *ptr ) -{ - // Zero ind means no current element - if( context.ind == TsmStructureNotOpen || - !context.ind ) - return TFailure; - - *ptr = context.ind; - return TSuccess; -} diff --git a/src/OpenGl/OpenGl_tsm.hxx b/src/OpenGl/OpenGl_tsm.hxx index 2e1dc0b2f8..56ec0c4403 100755 --- a/src/OpenGl/OpenGl_tsm.hxx +++ b/src/OpenGl/OpenGl_tsm.hxx @@ -32,9 +32,6 @@ et TelBackInteriorShadingMethod + enum to control texture fill method */ - -#include - typedef enum { TelNil = 0, @@ -116,110 +113,4 @@ typedef enum TelLast } TelType; -typedef union TSM_ELEM_DATA_UNION -{ - void *pdata; - Tint ldata; -} TSM_ELEM_DATA, *tsm_elem_data; - -typedef struct TSM_ELEM_STRUCT -{ - TelType el; - TSM_ELEM_DATA data; - IMPLEMENT_MEMORY_OPERATORS -} TSM_ELEM, *tsm_elem; - -/* A node containing an elem when structure is in the form of a list */ -struct TSM_NODE_STRUCT -{ - struct TSM_NODE_STRUCT *next; - struct TSM_NODE_STRUCT *prev; - TSM_ELEM elem; - IMPLEMENT_MEMORY_OPERATORS -}; -typedef TSM_NODE_STRUCT TSM_NODE; -typedef TSM_NODE_STRUCT* tsm_node; - -#ifdef OCC1188 -/* background texture properties */ -typedef enum -{ - TSM_FS_CENTER, - TSM_FS_TILE, - TSM_FS_STRETCH -} TSM_FillStyle; - -typedef struct -{ - Tuint texId; - Tint width; - Tint height; - TSM_FillStyle style; - IMPLEMENT_MEMORY_OPERATORS -} TSM_BG_TEXTURE, *tsm_bg_texture; -#endif /* OCC1188 */ - -typedef enum -{ - TSM_GT_NONE, - TSM_GT_HOR, - TSM_GT_VER, - TSM_GT_DIAG1, - TSM_GT_DIAG2, - TSM_GT_CORNER1, - TSM_GT_CORNER2, - TSM_GT_CORNER3, - TSM_GT_CORNER4 -} TSM_GradientType; - -typedef struct -{ - TEL_COLOUR color1; - TEL_COLOUR color2; - TSM_GradientType type; - IMPLEMENT_MEMORY_OPERATORS -} TSM_BG_GRADIENT, *tsm_bg_gradient; - - -typedef enum -{ - PickTraverse=0, - DisplayTraverse, - Add, - Delete, - Print, - Inquire -} TMsgType; - -typedef enum -{ - TEditInsert = 1, - TEditReplace -} TEditMode; - -extern Tint TglActiveWs; /* currently defined in tsm/tsm.c */ - -typedef TStatus (**MtblPtr)( TSM_ELEM_DATA, Tint, cmn_key* ); - -extern void TsmInitAllClasses( MtblPtr (**tbl)(TelType*), Tint size ); - -extern TEditMode TsmSetEditMode( TEditMode ); -extern TStatus TsmSendMessage( TelType, TMsgType, TSM_ELEM_DATA, Tint, ... ); -extern TStatus TsmOpenStructure( Tint ); -extern TStatus TsmCloseStructure(); -extern TStatus TsmDisplayStructure( Tint, Tint ); -extern TStatus TsmPrintStructure( Tint ); -extern TStatus TsmAddToStructure( TelType, Tint, ... ); -extern TStatus TsmDeleteStructure( Tint ); -extern TStatus TsmDeleteElement(); -extern TStatus TsmDeleteElementsBetweenLabels( Tint, Tint ); -extern TStatus TsmDeleteElementRange( Tint, Tint ); -extern TStatus TsmSetElementPointer( Tint ); -extern TStatus TsmSetElementPointerAtLabel( Tint ); -extern TStatus TsmOffsetElementPointer( Tint ); -extern TStatus TsmGetStructure( Tint, Tint*, tsm_node * ); -extern TStatus TsmGetStructureDepth( Tint, Tint* ); -extern TStatus TsmGetCurElem( TSM_ELEM * ); -extern TStatus TsmGetCurElemPtr( Tint * ); - #endif diff --git a/src/OpenGl/OpenGl_tsm_ws.hxx b/src/OpenGl/OpenGl_tsm_ws.hxx deleted file mode 100755 index a5e07c1dad..0000000000 --- a/src/OpenGl/OpenGl_tsm_ws.hxx +++ /dev/null @@ -1,67 +0,0 @@ -/*********************************************************************** - -FONCTION : ----------- -File OpenGl_tsm_ws : - - -REMARQUES: ----------- - -HISTORIQUE DES MODIFICATIONS : --------------------------------- -xx-xx-xx : xxx ; Creation. -02-07-96 : FMN ; Suppression WSWSHeight, WSWSWidth et WSType -17-07-96 : FMN ; Ajout WSZbuffer -24-04-97 : FMN ; Ajout displaylist pour le mode transient -07-08-97 : PCT ; ajout texture environnante -22-10-01 : SAV ; added flag WSDepthTest to control depth testing -24-10-01 : SAV ; added flag WSGLLight to control GL_LIGHTING -particularly, this thechnique is used in triedron displaying. - -************************************************************************/ - -#ifndef OPENGL_TSM_WS_H -#define OPENGL_TSM_WS_H - -#define G003 /* EUG 11-01-00 backfacing management -*/ - -#define BUC61044 /* SAV ; added functionality to control gl depth testing -from higher API */ -#define BUC61045 /* SAV ; added functionality to control gl lighting -from higher API */ -#define OCC1188 /* SAV Added 23-12-02 background texture attribute */ - -#include - -typedef enum -{ - WSTextureEnv, WSSurfaceDetail, - WSFilters, WSWindow, WSWidth, WSHeight, WSDbuff, - WSViewStid, WSLights, WSViews, WSBackground, WSNeedsClear, WSHighlights, - WSDepthCues, WSTransparency, WSZbuffer, WSTransient, WSRetainMode, WSUpdateState, WSPixmap, WSGLXPixmap, WSDepth -#ifdef G003 - , WSBackfacing -#endif /* G003 */ -#ifdef BUC61044 - , WSDepthTest -#endif -#ifdef BUC61045 - , WSGLLight -#endif -#ifdef OCC1188 - , WSBgTexture -#endif - , WSBgGradient -} TWSAttri; - -extern TStatus TsmRegisterWsid( Tint ); -extern TStatus TsmSetWSAttri( Tint, TWSAttri, cmn_key_data ); -extern TStatus TsmGetWSAttri( Tint, TWSAttri, cmn_key_data ); -/* struct_id, size, ws, actual_size */ -extern TStatus TsmGetWSPosted( Tint, Tint, Tint*, Tint* ); -extern TStatus TsmUnregisterWsid( Tint wsid ); -extern TStatus TsmInitUpdateState(); - -#endif diff --git a/src/OpenGl/OpenGl_txgl.cxx b/src/OpenGl/OpenGl_txgl.cxx deleted file mode 100755 index 7088d290fe..0000000000 --- a/src/OpenGl/OpenGl_txgl.cxx +++ /dev/null @@ -1,1103 +0,0 @@ -/*********************************************************************** - -FONCTION : ----------- -File OpenGl_txgl : - - -REMARQUES: ----------- - - -HISTORIQUE DES MODIFICATIONS : --------------------------------- -xx-xx-xx : xxx ; Creation. -07-02-96 : FMN ; Suppression code inutile: -- TxglLink() et TxglUnlink() -08-03-96 : FMN ; Suppression variables globales -Ajout cmn_delete_from_htbl() dans TxglDestroyWindow() -21-03-96 : CAL ; test sur previous_ctx dans TxglDestroyWindow() -et dans TxglSetDbuff() -01-04-96 : CAL ; Integration MINSK portage WNT -15-04-96 : CAL ; Integration travail PIXMAP de Jim ROTH -26-04-96 : FMN ; Correction warning de compilation -20-06-96 : CAL ; Retrait du XDestroyWindow dans TxglDestroyWindow -18-07-96 : FMN ; Suppression code inutile: TxglSetWindow(). -27-09-96 : CAL ; Portage WNT -16-10-96 : GG ; Coder le parametre de GLX_DEPTH_SIZE a 1 plutot -que 0 si l'on souhaite accroitre les performances -de 50% en utilisant le ZBuffer hardware !!! -Si la fenetre fournie a deja le bon visual pas -la peine de creer une sous-fenetre. -16-10-96 : GG ; Le dithering doit etre active aussi avec 12 plans -de maniere a ameliorer la qualite -17-10-96 : FMN ; Ajout fonction printVisualInfo() -06-11-96 : CAL ; Remise a True du BackDitherProp pour < 12 plans -12-11-96 : CAL ; BackDitherProp = True pour <= 8 plans -BackDitherProp = False pour > 8 plans -29-01-97 : FMN ; Amelioration du tests pour le dithering -DitherProp = True pour <= 8 plans red -DitherProp = False pour > 8 plans red -Suppression de TxglSetDbuff() -06-06-97 : FMN ; Meilleure gestion glXMakeCurrent (pb avec LightWoks) -Suppression de previous_win -02-07-97 : FMN ; Suppression variable ESSAI -07-10-97 : FMN ; Simplification WNT -13-10-97 : FMN ; Ajout wglShareLists -06-02-98 : FMN ; PRO11674: Suppression XSetErrorHandler(0) inutile -23-11-98 : CAL ; PRO16603: previous_ctx jamais remis a 0 pour eviter -la perte des lists. -07-12-98 : CAL ; PRO 16311 et PRO 11821 -02.14.100 : JR : Warnings on WNT -14.07.06 : SAN : OCC12977: update previous_ctx properly in TxglDestroyWindow. -Old code resulted in crashes on some ATI Radeon cards under Linux. - -************************************************************************/ - -#define BUC60691 /*GG 06/06/00 Due to a severe bug in secondary -// table hash-code computation not yet solve, -// It's necessary to compute the primary hash-key key -// correctly under WNT/W98. The actual method is wrong -// because a size 4 is used for this table instead -// a conventional prime number as under UNIX system (23). -// Under W98 sometimes the function wglMakeContext() does -// not work for an UNKNOWN reason, the number of DC -// seems limited to 5 but nothing tell that the limit is -// reached ! -// We try right now to recover this error by creating a new DC. -*/ - -#define RIC120303 /*GG Add new function TxglSetWindow using -// the GLXContext defined by the user -// Add new function TxglGetContext. -*/ - -#define OCC954 /*SAV: 13/11/02 - check GLRC before deleting it*/ - -/*----------------------------------------------------------------------*/ -/* -* Includes -*/ -#include -#include -#include - -#include -#include - - -#ifdef WNT -struct HTBL_ENTRY { - HDC hDC; - HGLRC hGLRC; - int nUsed; - IMPLEMENT_MEMORY_OPERATORS -}; - - -int call_util_osd_getenv ( char*, char*, int ); -#endif /* WNT */ - -#include -int call_util_osd_getenv( char * , char * , int ) ; - -/*----------------------------------------------------------------------*/ -/* -* Variables statiques -*/ - -#ifndef WNT -typedef NCollection_DataMap GLContextMap; -#else -typedef NCollection_DataMap GLContextMap; -#endif - -static GLContextMap _Txgl_Map; - - -#ifndef WNT -static int BackDitherProp = False; /* Dithering pour le background */ -static int DitherProp = True; /* Dithering pour le trace */ -static GLXContext previous_ctx = 0; /* Use for share display list */ -static GLXContext dead_ctx; /* Context to be destroyed */ -static Display *dead_dpy; /* Display associated with dead_ctx */ -#else -static int BackDitherProp = FALSE; /* Dithering pour le background */ -static int DitherProp = TRUE; /* Dithering pour le trace */ -static BOOL s_sysPalInUse; /* Flag to check system colors usage */ -static HGLRC previous_ctx = 0; /* Use for share display list */ -#endif /* WNT */ - -/*----------------------------------------------------------------------*/ -/* -* Constantes -*/ - -#define NO_TRACE - -#define CALL_DEF_STRING_LENGTH 132 - -#define WIN_HTBL_SIZE 23 - -/*----------------------------------------------------------------------*/ -/* -* Fonctions statiques -*/ - -#ifndef WNT -#ifdef TRACE -static GLvoid printVisualInfo( Display *, XVisualInfo *glxVisual ); -#endif -#else -#ifdef BUC60691 -static BOOL win95 = FALSE; -#endif - -static int find_pixel_format(HTBL_ENTRY * hte, PIXELFORMATDESCRIPTOR * pfd); - -__declspec( dllexport ) int __fastcall __OpenGl_INIT__ ( - unsigned hInstance, unsigned long reason_for_call - ) { - if ( reason_for_call == DLL_PROCESS_ATTACH ) { - - } - return 1; - - } /* end __OpenGl_INIT__ */ -#endif /* WNT */ - - /*----------------------------------------------------------------------*/ - - WINDOW - TxglCreateWindow( DISPLAY *disp, WINDOW par, - Tint x, Tint y, Tint w, Tint h, Tint bw, - Tfloat bgcolr, Tfloat bgcolg, Tfloat bgcolb ) - { - -#ifndef WNT - - GLCONTEXT ctx; - Colormap cmap; - XVisualInfo* vis=NULL; - /* XVisualInfo tmplt;*/ - XSetWindowAttributes cwa; - XColor color; - int value; - char string[CALL_DEF_STRING_LENGTH]; - WINDOW win; - - int DBuffer = (call_util_osd_getenv ("CALL_OPENGL_NO_DBF", string, CALL_DEF_STRING_LENGTH)) ? False : True; - - if (call_util_osd_getenv("JWR_PIXMAP_DB", string, CALL_DEF_STRING_LENGTH)) - TelSetPixmapDB(1); - - XWindowAttributes wattr; - XGetWindowAttributes (disp, par, &wattr); - Tint scr = DefaultScreen (disp); - -#if defined(__linux) || defined(Linux) - { - XVisualInfo aVisInfo; - int aNbItems; - int isGl, isDoubleBuffer, isRGBA, aDepthSize, aStencilSize; - unsigned long aVisInfoMask = VisualIDMask | VisualScreenMask; - aVisInfo.visualid = wattr.visual->visualid; - aVisInfo.screen = DefaultScreen (disp); - vis = XGetVisualInfo (disp, aVisInfoMask, &aVisInfo, &aNbItems); - if (vis != NULL) - { - // check Visual for OpenGl context's parameters compability - if (glXGetConfig (disp, vis, GLX_USE_GL, &isGl) != 0) - isGl = 0; - - if (glXGetConfig (disp, vis, GLX_RGBA, &isRGBA) != 0) - isRGBA = 0; - - if (glXGetConfig (disp, vis, GLX_DOUBLEBUFFER, &isDoubleBuffer) != 0) - isDoubleBuffer = 0; - - if (glXGetConfig (disp, vis, GLX_DEPTH_SIZE, &aDepthSize) != 0) - aDepthSize = 0; - - if (glXGetConfig (disp, vis, GLX_STENCIL_SIZE, &aStencilSize) != 0) - aStencilSize = 0; - - if (!isGl || !aDepthSize || !aStencilSize || - !isRGBA || isDoubleBuffer != DBuffer) - { - XFree (vis); - vis = NULL; - } - } - } -#endif - - if (vis == NULL) - { - int anIter = 0; - int anAttribs[13]; - anAttribs[anIter++] = GLX_RGBA; - - anAttribs[anIter++] = GLX_DEPTH_SIZE; - anAttribs[anIter++] = 1; - - anAttribs[anIter++] = GLX_STENCIL_SIZE; - anAttribs[anIter++] = 1; - - anAttribs[anIter++] = GLX_RED_SIZE; - anAttribs[anIter++] = (wattr.depth <= 8) ? 0 : 1; - - anAttribs[anIter++] = GLX_GREEN_SIZE; - anAttribs[anIter++] = (wattr.depth <= 8) ? 0 : 1; - - anAttribs[anIter++] = GLX_BLUE_SIZE; - anAttribs[anIter++] = (wattr.depth <= 8) ? 0 : 1; - - if (DBuffer) - anAttribs[anIter++] = GLX_DOUBLEBUFFER; - - anAttribs[anIter++] = None; - - vis = glXChooseVisual (disp, scr, anAttribs); - if (vis == NULL) return TFailure; - } - -#ifdef TRACE - printf ("TxglCreateWindow \n"); - printf ("Informations sur le visual\n"); - printf ("par visualid %x%x %d\n", wattr.visual->visualid, wattr.visual->visualid); - printf ("vis visualid 0x%x %d\n", vis->visualid, vis->visualid); - printf ("vis depth %d\n", vis->depth); - printf ("vis class %d\n", vis->class); - printf ("vis red_mask %ld\n", vis->red_mask); - printf ("vis green_mask %ld\n", vis->green_mask); - printf ("vis blue_mask %ld\n", vis->blue_mask); - printf ("vis colormap_size %d\n", vis->colormap_size); - printf ("vis bits_per_rgb %d\n", vis->bits_per_rgb); - printVisualInfo( disp, vis ); -#endif - - /* - * Le BackDitherProp est utilise pour le clear du background - * Pour eviter une difference de couleurs avec la couleur choisie - * par l'application (XWindow) il faut desactiver le dithering - * au dessus de 8 plans. - * - * Pour le DitherProp: - * On cherchera a activer le Dithering que si le Visual a au moins - * 8 plans pour le GLX_RED_SIZE. Le test est plus sur car on peut - * avoir une profondeur superieure a 12 mais avoir besoin du dithering. - * (Carte Impact avec GLX_RED_SIZE a 5 par exemple) - */ - - glXGetConfig( disp, vis, GLX_RED_SIZE, &value ); - DitherProp = (value < 8) ? True : False; - BackDitherProp = (vis->depth <= 8) ? True : False; - -#ifdef TRACE - printf("Dithering %d BackDithering %d \n",DitherProp,BackDitherProp); -#endif - - if (call_util_osd_getenv ("CALL_OPENGL_NO_DITHER", string, CALL_DEF_STRING_LENGTH)) - DitherProp = False; - - if (call_util_osd_getenv ("CALL_OPENGL_NO_BACKDITHER", string, CALL_DEF_STRING_LENGTH)) - BackDitherProp = False; - - if (dead_ctx) { - /* recover display lists from dead_ctx, then destroy it */ - ctx = glXCreateContext( disp, vis, dead_ctx, GL_TRUE ); - glXDestroyContext(dead_dpy, dead_ctx); - } else if (previous_ctx == 0) { - ctx = glXCreateContext( disp, vis, NULL, GL_TRUE ); - } else { - /* ctx est une copie du previous */ - ctx = glXCreateContext( disp, vis, previous_ctx, GL_TRUE ); - } - previous_ctx = ctx; - - if( ctx ) - OpenGl_ResourceCleaner::GetInstance()->AppendContext( ctx, true ); - - // remove the dead_ctx for ResourceCleaner after appending shared ctx - if (dead_ctx) { - OpenGl_ResourceCleaner::GetInstance()->RemoveContext(dead_ctx); - dead_ctx = 0; - } - - if( !ctx) return TFailure; - - cmap = XCreateColormap( disp, par, vis->visual, AllocNone ); - - color.red = (unsigned short) (bgcolr * 0xFFFF); - color.green = (unsigned short) (bgcolg * 0xFFFF); - color.blue = (unsigned short) (bgcolb * 0xFFFF); - color.flags = DoRed | DoGreen | DoBlue; - XAllocColor( disp, cmap, &color ); - - cwa.colormap = cmap; - cwa.event_mask = StructureNotifyMask; - cwa.border_pixel = color.pixel; - cwa.background_pixel = color.pixel; - - unsigned long mask = CWBackPixel | CWColormap | CWBorderPixel | CWEventMask; - - if( vis->visualid == wattr.visual->visualid ) { - win = par; - } - else - { - win = XCreateWindow( disp, par, x, y, w, h, bw, - vis->depth, InputOutput, vis->visual, - mask, &cwa ); - } - -#ifdef TRACE - printf ("TxglCreateWindow win %x par %x \n", win, par); -#endif - - XSetWindowBackground( disp, win, cwa.background_pixel ); - XClearWindow( disp, win ); - - /* if in Pixmap double buffering mode, set up pixmap */ - - if (TelTestPixmapDB()) - { - GC gc; - Pixmap pixmap; - GLXPixmap glxpixmap; - - printf("setting up pixmap double buffering\n"); - - gc = XCreateGC(disp, win, 0, NULL); - - pixmap = XCreatePixmap(disp, win, w, h, vis->depth); - - glxpixmap = glXCreateGLXPixmap(disp, vis, pixmap); - - glXMakeCurrent(disp, glxpixmap, ctx); - - glDrawBuffer(GL_FRONT); - - TelSetPixmapDBParams(disp, win, w, h, vis->depth, gc, pixmap, glxpixmap, ctx); - } - - XFree((char*)vis); - - _Txgl_Map.Bind( (Tint)win, ctx ); - - return win; - -#else /* WNT */ - - HTBL_ENTRY* hte; - PIXELFORMATDESCRIPTOR pfd; - BOOL DBuffer = TRUE; - int iPixelFormat; - char string[ CALL_DEF_STRING_LENGTH ]; - -#ifdef BUC60691 - OSVERSIONINFO os; - os.dwOSVersionInfoSize = sizeof( OSVERSIONINFO ); - GetVersionEx(&os); - if( os.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS ) win95 = TRUE; -#endif - - if ( _Txgl_Map.IsBound( (Tint)par ) ) { - hte = _Txgl_Map.ChangeFind( (Tint)par ); - if ( hte ) - { - ++hte -> nUsed; - printf("*TxglCreateWindow.window %d is alreday created\n",par); - return par; - } - } - - hte = new HTBL_ENTRY(); - - if ( !hte ) return 0; - hte -> hDC = GetDC ( par ); - - iPixelFormat = find_pixel_format(hte, &pfd); - - if ( !iPixelFormat ) - { - printf ("*OpenGL interface: ChoosePixelFormat failed. Error code: %d\n",GetLastError ()); - - ReleaseDC ( par, hte -> hDC ); - delete hte; - - return 0; - } - - if ( pfd.dwFlags & PFD_NEED_PALETTE ) - { - WINDOW_DATA* wd = ( WINDOW_DATA* )GetWindowLongPtr ( par, GWLP_USERDATA ); - - InterfaceGraphic_RealizePalette (hte -> hDC, wd -> hPal, FALSE, - s_sysPalInUse = pfd.dwFlags & PFD_NEED_SYSTEM_PALETTE ? TRUE : FALSE); - } - - if ( pfd.cColorBits <= 8 ) - { - DitherProp = TRUE; - BackDitherProp = TRUE; - } - - if (call_util_osd_getenv ("CALL_OPENGL_NO_DITHER", string, CALL_DEF_STRING_LENGTH)) - DitherProp = FALSE; - - if (call_util_osd_getenv ("CALL_OPENGL_NO_BACKDITHER", string, CALL_DEF_STRING_LENGTH)) - BackDitherProp = FALSE; - - if ( !SetPixelFormat ( hte -> hDC, iPixelFormat, &pfd ) ) - { - printf ("*OpenGL interface: SetPixelFormat failed. Error code %d\n",GetLastError ()); - ReleaseDC ( par, hte -> hDC ); - delete hte; - return 0; - } - - hte -> hGLRC = wglCreateContext ( hte -> hDC ); - - if ( !hte -> hGLRC ) - { - printf ("*OpenGL interface: wglCreateContext failed. Error code: %d\n",GetLastError ()); - return 0; - } - - Standard_Boolean isShared = Standard_True; - - if (previous_ctx == 0 ) - previous_ctx = hte -> hGLRC; - // if we already have some shared context - else - { - // try to share context with one from resource cleaner list - GLCONTEXT shareCtx = OpenGl_ResourceCleaner::GetInstance()->GetSharedContext(); - - if (shareCtx != 0) - isShared = (Standard_Boolean)wglShareLists(shareCtx, hte -> hGLRC); - else - { - isShared = (Standard_Boolean)wglShareLists(previous_ctx, hte -> hGLRC); - // add shared previous_ctx to a control list if it's not there - if (isShared) - OpenGl_ResourceCleaner::GetInstance()->AppendContext(previous_ctx, isShared); - } - } - - // add the context to OpenGl_ResourceCleaner control list - OpenGl_ResourceCleaner::GetInstance()->AppendContext( hte -> hGLRC, isShared); - _Txgl_Map.Bind( (Tint)par, hte ); - - return par; - -#endif /* WNT */ - - } - -#ifdef RIC120302 - WINDOW - TxglSetWindow( DISPLAY *disp, WINDOW par, GLCONTEXT ctx) - { -#ifndef WNT - XVisualInfo* vis; - char string[CALL_DEF_STRING_LENGTH]; - XWindowAttributes wattr; - - XGetWindowAttributes( disp , par , &wattr ); - { - unsigned long vmask = VisualIDMask | VisualScreenMask; - XVisualInfo vinfo; - int ninfo; - vinfo.visualid = wattr.visual->visualid; - vinfo.screen = DefaultScreen( disp ); - vis = XGetVisualInfo( disp, vmask, &vinfo, &ninfo); - } - - if( !vis) return TFailure; - -#ifdef TRACE - printf ("TxglSetWindow \n"); - printf ("Informations sur le visual\n"); - printf ("par visualid %x%x %d\n", wattr.visual->visualid, wattr.visual->visualid); - printf ("vis visualid 0x%x %d\n", vis->visualid, vis->visualid); - printf ("vis depth %d\n", vis->depth); - printf ("vis class %d\n", vis->class); - printf ("vis red_mask %ld\n", vis->red_mask); - printf ("vis green_mask %ld\n", vis->green_mask); - printf ("vis blue_mask %ld\n", vis->blue_mask); - printf ("vis colormap_size %d\n", vis->colormap_size); - printf ("vis bits_per_rgb %d\n", vis->bits_per_rgb); - printVisualInfo( disp, vis ); -#endif - - /* - * Le BackDitherProp est utilise pour le clear du background - * Pour eviter une difference de couleurs avec la couleur choisie - * par l'application (XWindow) il faut desactiver le dithering - * au dessus de 8 plans. - * - * Pour le DitherProp: - * On cherchera a activer le Dithering que si le Visual a au moins - * 8 plans pour le GLX_RED_SIZE. Le test est plus sur car on peut - * avoir une profondeur superieure a 12 mais avoir besoin du dithering. - * (Carte Impact avec GLX_RED_SIZE a 5 par exemple) - */ - - { - int value; - glXGetConfig( disp, vis, GLX_RED_SIZE, &value ); - - if ( value < 8 ) { - DitherProp = True; - } else { - DitherProp = False; - } - - if ( vis->depth <= 8 ) { - BackDitherProp = True; - } else { - BackDitherProp = False; - } - } - -#ifdef TRACE - printf("Dithering %d BackDithering %d \n",DitherProp,BackDitherProp); -#endif - - if (call_util_osd_getenv ("CALL_OPENGL_NO_DITHER", string, CALL_DEF_STRING_LENGTH)) - DitherProp = False; - - if (call_util_osd_getenv ("CALL_OPENGL_NO_BACKDITHER", string, CALL_DEF_STRING_LENGTH)) - BackDitherProp = False; - - previous_ctx = ctx; - - XFree((char*)vis); - - _Txgl_Map.Bind( ( Tint )par, ctx ); -#else /* WNT */ - - /* abd - cmn_htbl_elem rec;*/ - HTBL_ENTRY* hte; - PIXELFORMATDESCRIPTOR pfd; - BOOL DBuffer = TRUE; - int iPixelFormat; - char string[ CALL_DEF_STRING_LENGTH ]; - -#ifdef BUC60691 - OSVERSIONINFO os; - os.dwOSVersionInfoSize = sizeof( OSVERSIONINFO ); - GetVersionEx(&os); - if( os.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS ) win95 = TRUE; -#endif - - if ( _Txgl_Map.IsBound( ( Tint )par ) ) - { - hte = _Txgl_Map.ChangeFind( ( Tint )par ); - ++hte -> nUsed; - printf("*TxglSetWindow.window %d is alreday created\n",par); - return par; - } - - hte = new HTBL_ENTRY(); - - if ( !hte ) return 0; - - hte -> hDC = GetDC ( par ); - iPixelFormat = find_pixel_format(hte, &pfd); - - if ( !iPixelFormat ) - { - printf ("*OpenGL interface: ChoosePixelFormat failed. Error code: %d\n",GetLastError ()); - - ReleaseDC ( par, hte -> hDC ); - delete hte; - - return 0; - } - - if ( pfd.dwFlags & PFD_NEED_PALETTE ) - { - WINDOW_DATA* wd = ( WINDOW_DATA* )GetWindowLongPtr ( par, GWLP_USERDATA ); - - InterfaceGraphic_RealizePalette (hte -> hDC, wd -> hPal, FALSE, - s_sysPalInUse = pfd.dwFlags & PFD_NEED_SYSTEM_PALETTE ? TRUE : FALSE); - } - - if ( pfd.cColorBits <= 8 ) - { - DitherProp = TRUE; - BackDitherProp = TRUE; - } - - if (call_util_osd_getenv ("CALL_OPENGL_NO_DITHER", string, CALL_DEF_STRING_LENGTH)) - DitherProp = FALSE; - - if (call_util_osd_getenv ("CALL_OPENGL_NO_BACKDITHER", string, CALL_DEF_STRING_LENGTH)) - BackDitherProp = FALSE; - - if ( !SetPixelFormat ( hte -> hDC, iPixelFormat, &pfd ) ) - { - printf ("*OpenGL interface: SetPixelFormat failed. Error code %d\n",GetLastError ()); - ReleaseDC ( par, hte -> hDC ); - delete hte; - return 0; - } - - hte -> hGLRC = previous_ctx = ctx; - - _Txgl_Map.Bind( ( Tint )par, hte ); -#endif /* WNT */ - - return par; - - } -#endif /*RIC120302*/ - - /*----------------------------------------------------------------------*/ - - TStatus - TxglWinset( DISPLAY *disp, WINDOW win ) - { - -#ifndef WNT - - Bool i; - GLXContext ctx; - GLenum errorcode; - const GLubyte *errorstring; - - if ( !_Txgl_Map.IsBound( win ) ) - return TFailure; - - ctx = _Txgl_Map.ChangeFind( win ); - - -#ifdef TRACE - printf ("TxglWinset::glXMakeCurrent %x \n", win); -#endif - if (TelTestPixmapDB()) - { - i = glXMakeCurrent(disp, TelGetGLXPixmap(), ctx); - } - else - { - i = glXMakeCurrent(disp, win, ctx); /* TRUE/FALSE */ - } - if (!i) - { - // if there is no current context it might be impossible to use - // glGetError correctly - printf("glXMakeCurrent failed!\n"); - } - - return i == True ? TSuccess : TFailure; - -#else /* WNT */ - - HTBL_ENTRY* hte; - HDC hdc = NULL; - HGLRC hglrc = NULL; - TStatus retVal = TFailure; - - __try { - - if ( !_Txgl_Map.IsBound( ( Tint )win ) ) { - printf("OpenGL interface: TxglWinset failed.UNKNOWN win %x\n",win); - __leave; - } - hte = _Txgl_Map.ChangeFind( ( Tint )win ); - -#ifdef BUC60691 - if( win95 ) { - retVal = (TStatus)ReleaseDC ( win, hte -> hDC ); - hte -> hDC = GetDC ( win ); - } -#endif - if ( !wglMakeCurrent ( hte -> hDC, hte -> hGLRC ) ) - { -#ifdef BUC60691 - GLenum errorcode; - const GLubyte *errorstring; - - errorcode = glGetError(); - errorstring = gluErrorString(errorcode); - printf("wglMakeCurrent failed: %d %s\n", errorcode, errorstring); -#else - printf ("OpenGL interface: wglMakeCurrent failed. Error code: %d\n",GetLastError ()); -#endif - retVal = TFailure; - } else retVal = TSuccess; - - } /* end __try */ - - - __finally - { - } - - return retVal; - -#endif /* WNT */ - - } - - /*----------------------------------------------------------------------*/ - - WINDOW - TxglGetSubWindow( DISPLAY *disp, WINDOW win ) - /* This function assumes that there is only - one child for the parent */ - { - -#ifndef WNT - - Window root, parent, *child, w; - unsigned int num; - - if( XQueryTree( disp, win, &root, &parent, &child, &num ) ) - { - if (! num) return win; - w = child[0]; - XFree( (char *)child ); - return w; - } - else - return 0; - -#else /* WNT */ - - return win; - -#endif /* WNT */ - - } - - /*----------------------------------------------------------------------*/ - - void - TxglDestroyWindow( DISPLAY *disp, WINDOW win ) - { - -#ifndef WNT - - GLXContext ctx; - Tint dummy; - - if ( !_Txgl_Map.IsBound(win) ) - return; - ctx = _Txgl_Map.ChangeFind(win); - - /* FSXXX sync necessary if non-direct rendering */ - glXWaitGL(); - - _Txgl_Map.UnBind( win ); - - if (previous_ctx == ctx) { - /* san -- OCC12977: it's important to put some valid GLXContext or null into - previous_ctx here, otherwise next glxCreateContext() will crash on some ATI Radeon cards - */ - previous_ctx = NULL; - if ( _Txgl_Map.Size() > 0 ) { - GLContextMap::Iterator it(_Txgl_Map); - previous_ctx = it.Value(); - } - /* - * if this is the last remaining context, do not destroy it yet, to avoid - * losing any shared display lists (fonts...) - */ - if (previous_ctx) { - OpenGl_ResourceCleaner::GetInstance()->RemoveContext(ctx); - glXDestroyContext(disp, ctx); - } else { - dead_ctx = ctx; - dead_dpy = disp; - } - } else { - OpenGl_ResourceCleaner::GetInstance()->RemoveContext(ctx); - glXDestroyContext(disp, ctx); - } - -#else /* WNT */ - - HTBL_ENTRY* hte; -#ifdef _DEBUG - WINDOW_DATA* wd; -#endif /* _DEBUG */ - if ( !_Txgl_Map.IsBound(( Tint )win) ) - return; - hte = _Txgl_Map.ChangeFind(( Tint )win); - -#ifdef _DEBUG - /* In release version of application we need to process */ - /* palette messages in the main application message loop. */ - /* In debug version we don't have message loop for most */ - /* cases. So, let's restore system colors here now. */ - wd = ( WINDOW_DATA* )GetWindowLongPtr ( win, GWLP_USERDATA ); - - if ( wd != NULL ) InterfaceGraphic_RealizePalette ( - hte -> hDC, wd -> hPal, TRUE, s_sysPalInUse); -#endif /* _DEBUG */ - - if ( --hte -> nUsed == 0 ) - { - OpenGl_ResourceCleaner::GetInstance()->RemoveContext( hte -> hGLRC ); -#ifdef OCC954 - if ( wglGetCurrentContext() != NULL ) -#endif - wglDeleteContext ( hte -> hGLRC ); - ReleaseDC ( win, hte -> hDC ); - _Txgl_Map.UnBind( (Tint ) win ); - if( _Txgl_Map.Size() == 0 ) { - previous_ctx = 0; - } - delete hte; - } - -#endif /* WNT */ - - } - - /*----------------------------------------------------------------------*/ - - int - TxglGetDither(void) - { - return DitherProp; - } - - /*----------------------------------------------------------------------*/ - - int - TxglGetBackDither(void) - { - return BackDitherProp; - } - - - /*----------------------------------------------------------------------*/ - /*RIC120302*/ - GLCONTEXT - TxglGetContext( WINDOW win ) - { - GLCONTEXT ctx = NULL; - if ( _Txgl_Map.IsBound( (Tint) win ) ) - ctx = -#ifdef WNT - _Txgl_Map.Find( (Tint) win )->hGLRC; -#else - _Txgl_Map.Find( win ); -#endif - - return ctx; - } - /*RIC120302*/ - - /*----------------------------------------------------------------------*/ - enum { ZERO = 0, ONE, TWO, THREE, FOUR, FIVE, SIX, SEVEN, EIGHT, NINE, TEN }; - - /* Unused :*/ -#ifdef TRACE - static const char* - className( int class ) - { - static char *classes[] = { - "StaticGray", - "GrayScale", - "StaticColor", - "PseudoColor", - "TrueColor", - "DirectColor", - }; - - if ( class < ZERO || class > FIVE ) - return "unknown"; - else - return classes[class]; - } -#endif - /*----------------------------------------------------------------------*/ -#ifndef WNT - -#ifdef TRACE - static GLvoid printVisualInfo( DISPLAY *display, XVisualInfo *glxVisual ) - { - -#define TrueFalse(x) ( x ? "True" : "False" ) - - int tmp; - - printf("\n" ); - printf(" X Visual Information ...\n\n" ); - printf("\tvisualid : 0x%x\n", glxVisual->visualid ); - printf("\tclass : %s\n\n", className( glxVisual->class ) ); - - glXGetConfig(display, glxVisual, GLX_USE_GL, &tmp); - printf( "\tSupport GL ( GLX_USE_GL ) : %s\n", TrueFalse(tmp) ); - - glXGetConfig(display, glxVisual, GLX_LEVEL, &tmp); - printf( "\tFramebuffer ( GLX_LEVEL ) : %s\n\n", - (tmp < ZERO) ? "Underlay" : (tmp == ZERO ? "Normal" : tmp > ONE ? "Overlay" : "Popup") ); - - glXGetConfig(display, glxVisual, GLX_BUFFER_SIZE, &tmp); - printf( "\tFramebuffer depth ( GLX_BUFFER_SIZE ) : %d\n", tmp ); - - glXGetConfig(display, glxVisual, GLX_DOUBLEBUFFER, &tmp); - printf( "\tDoublebuffer ( GLX_DOUBLEBUFFER ) : %s\n", - TrueFalse(tmp) ); - - glXGetConfig(display, glxVisual, GLX_DEPTH_SIZE, &tmp); - printf( "\tDepth buffer depth ( GLX_DEPTH_SIZE ) : %d\n", tmp ); - - glXGetConfig(display, glxVisual, GLX_STENCIL_SIZE, &tmp); - printf( "\tStencil buffer depth ( GLX_STENCIL_SIZE ) : %d\n", tmp ); - - glXGetConfig(display, glxVisual, GLX_STEREO, &tmp); - printf( "\tStereo Buffer ( GLX_STEREO ) : %s\n", - TrueFalse(tmp) ); - - glXGetConfig(display, glxVisual, GLX_AUX_BUFFERS, &tmp); - printf( "\tAuxillary Buffers ( GLX_AUX_BUFFERS) : %d\n\n", tmp ); - - glXGetConfig(display, glxVisual, GLX_RGBA, &tmp); - printf( "\tColor mode ( GLX_RGBA ) : %s\n", tmp ? "RGBA" : - "Color Index" ); - - glXGetConfig(display, glxVisual, GLX_RED_SIZE, &tmp); - printf( "\tRed Bits ( GLX_RED_SIZE ) : %d\n", tmp ); - - glXGetConfig(display, glxVisual, GLX_GREEN_SIZE, &tmp); - printf( "\tGreen Bits ( GLX_GREEN_SIZE ) : %d\n", tmp ); - - glXGetConfig(display, glxVisual, GLX_BLUE_SIZE, &tmp); - printf( "\tBlue Bits ( GLX_BLUE_SIZE ) : %d\n", tmp ); - - glXGetConfig(display, glxVisual, GLX_ALPHA_SIZE, &tmp); - printf( "\tAlpha Bits ( GLX_ALPHA_SIZE ) : %d\n\n", tmp ); - - glXGetConfig(display, glxVisual, GLX_ACCUM_RED_SIZE, &tmp); - printf( "\tRed Accumulation Bits ( GLX_ACCUM_RED_SIZE ) : %d\n", tmp ); - - glXGetConfig(display, glxVisual, GLX_ACCUM_GREEN_SIZE, &tmp); - printf( "\tGreen Accumulation Bits ( GLX_ACCUM_GREEN_SIZE ) : %d\n", tmp ); - - glXGetConfig(display, glxVisual, GLX_ACCUM_BLUE_SIZE, &tmp); - printf( "\tBlue Accumulation Bits ( GLX_ACCUM_BLUE_SIZE ) : %d\n", tmp ); - - glXGetConfig(display, glxVisual, GLX_ACCUM_ALPHA_SIZE, &tmp); - printf( "\tAlpha Accumulation Bits ( GLX_ACCUM_ALPHA_SIZE ) : %d\n\n", tmp ); - } -#endif //TRACE -#else //WNT - int find_pixel_format(HTBL_ENTRY * hte, PIXELFORMATDESCRIPTOR * pfd) - { - int iPixelFormat = 0; - int iGood = 0; - int i, j, k; - PIXELFORMATDESCRIPTOR pfd0; - char string[ CALL_DEF_STRING_LENGTH ]; - BOOL DBuffer = TRUE; - const int sBits[] = { 8, 1 }; - const int cBits[] = { 32, 24 }; - const int dBits[] = { 32, 24, 16 }; - int goodBits[3] = { 0, 0, 0 }; - - if (call_util_osd_getenv ("CALL_OPENGL_NO_DBF", - string, CALL_DEF_STRING_LENGTH)) - DBuffer = FALSE; - - pfd0.nSize = sizeof ( PIXELFORMATDESCRIPTOR ); - pfd0.nVersion = 1; - pfd0.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL; - pfd0.dwFlags |= ( DBuffer ) ? PFD_DOUBLEBUFFER : PFD_SUPPORT_GDI; - pfd0.iPixelType = PFD_TYPE_RGBA; - pfd0.cRedBits = 0; - pfd0.cRedShift = 0; - pfd0.cGreenBits = 0; - pfd0.cGreenShift = 0; - pfd0.cBlueBits = 0; - pfd0.cBlueShift = 0; - pfd0.cAlphaBits = 0; - pfd0.cAlphaShift = 0; - pfd0.cAccumBits = 0; - pfd0.cAccumRedBits = 0; - pfd0.cAccumGreenBits = 0; - pfd0.cAccumBlueBits = 0; - pfd0.cAccumAlphaBits = 0; - pfd0.cStencilBits = 0; - pfd0.cAuxBuffers = 0; - pfd0.iLayerType = PFD_MAIN_PLANE; - pfd0.bReserved = 0; - pfd0.dwLayerMask = 0; - pfd0.dwVisibleMask = 0; - pfd0.dwDamageMask = 0; - - hte -> nUsed = 1; - /* - This loop tries to find the pixel format with parameters not worse - than given in sBits, cBits, dBits, giving the priority to color bits - then depth bits, with stencil bits having the lowest priority. - If the needed combination is not found then the iGood value is used, it - is rememebered during the loop as the best ever found combination. - */ - - for (k = 0; k < sizeof(sBits) / sizeof(int); k++) { - - pfd0.cStencilBits = sBits[k]; - for (i = 0; i < sizeof(dBits) / sizeof(int); i++) { - - pfd0.cDepthBits = dBits[i]; - iGood = 0; - for (j = 0; j < sizeof(cBits) / sizeof(int); j++) { - - pfd0.cColorBits = cBits[j]; - iPixelFormat = ChoosePixelFormat ( hte -> hDC, &pfd0 ); - - if (iPixelFormat) { - pfd->cDepthBits = 0; - pfd->cColorBits = 0; - pfd->cStencilBits = 0; - DescribePixelFormat (hte -> hDC, iPixelFormat, - sizeof ( PIXELFORMATDESCRIPTOR ), pfd); - if (pfd->cColorBits >= cBits[j] && - pfd->cDepthBits >= dBits[i] && - pfd->cStencilBits >= sBits[k]) - break; /* found - stop the lookup immediately */ - if (pfd->cColorBits > goodBits[0]) { - goodBits[0] = pfd->cColorBits; - goodBits[1] = pfd->cDepthBits; - goodBits[2] = pfd->cStencilBits; - iGood = iPixelFormat; - } else if (pfd->cColorBits == goodBits[0]) { - if (pfd->cDepthBits > goodBits[1]) { - goodBits[1] = pfd->cDepthBits; - goodBits[2] = pfd->cStencilBits; - iGood = iPixelFormat; - } else if (pfd->cDepthBits == goodBits[1]) { - if (pfd->cStencilBits > goodBits[2]) { - goodBits[2] = pfd->cStencilBits; - iGood = iPixelFormat; - } - } - } - } - } - if (j < sizeof(cBits) / sizeof(int)) - break; - } - if (i < sizeof(dBits) / sizeof(int)) - break; - } - - if ( !iPixelFormat ) - iPixelFormat = iGood; - - return iPixelFormat; - } - -#endif /* WNT */ - /*----------------------------------------------------------------------*/ diff --git a/src/OpenGl/OpenGl_txgl.hxx b/src/OpenGl/OpenGl_txgl.hxx deleted file mode 100755 index 29c3b0f715..0000000000 --- a/src/OpenGl/OpenGl_txgl.hxx +++ /dev/null @@ -1,56 +0,0 @@ -/*********************************************************************** - -FONCTION : ----------- -Include OpenGl_txgl : - - -REMARQUES: ----------- - - -HISTORIQUE DES MODIFICATIONS : --------------------------------- -xx-xx-xx : xxx ; Creation. -07-02-96 : FMN ; Suppression code inutile: -- TxglLink() et TxglUnlink() -Ajout prototype de TxglGetBackDither() -18-07-96 : FMN ; Suppression code inutile: TxglSetWindow(). -29-01-97 : FMN ; Suppression de TxglSetDbuff(). - -************************************************************************/ - -#ifndef OPENGL_TXGL_H -#define OPENGL_TXGL_H - -#define RIC120302 /* GG ; Add NEW TxglSetWindow function -// Add NEW TxglGetContext function -*/ - -/*----------------------------------------------------------------------*/ -/* -* Includes -*/ - -# include - -/*----------------------------------------------------------------------*/ -/* -* Prototypes fonctions externes -*/ - -extern WINDOW TxglCreateWindow( DISPLAY*, WINDOW, /* x, y, w, h, bw, bgcol */ - Tint, Tint, Tint, Tint, Tint, Tfloat, Tfloat, Tfloat ); -extern TStatus TxglWinset( DISPLAY*, WINDOW ); -#ifdef RIC120302 -extern WINDOW TxglSetWindow( DISPLAY*, WINDOW, GLCONTEXT ); -extern GLCONTEXT TxglGetContext( WINDOW ); -#endif -extern WINDOW TxglGetSubWindow( DISPLAY*, WINDOW ); -extern void TxglDestroyWindow( DISPLAY *, WINDOW ); -extern int TxglGetDither(void); -extern int TxglGetBackDither(void); - -/*----------------------------------------------------------------------*/ - -#endif diff --git a/src/OpenGl/OpenGl_undefined.cxx b/src/OpenGl/OpenGl_undefined.cxx deleted file mode 100755 index 9b29a168f5..0000000000 --- a/src/OpenGl/OpenGl_undefined.cxx +++ /dev/null @@ -1,333 +0,0 @@ -/*********************************************************************** - -FONCTION : ----------- -file OpenGl_undefined : - - -REMARQUES: ----------- - - -HISTORIQUE DES MODIFICATIONS : --------------------------------- -xx-xx-xx : xxx ; Creation. -20-02-96 : FMN ; Suppression code inutile: -01-04-96 : CAL ; Integration MINSK portage WNT -22-04-96 : FMN ; Suppression prototype inutile. -25-06-96 : FMN ; Suppression utilisation de glScissor. -02-07-96 : FMN ; Modification parametre glViewport. -21-10-96 : FMN ; Suppression LMC_COLOR fait dans OpenGl_execstruct.c -04-02-97 : FMN ; Suppression call_togl_ps, call_togl_xwd ... -02-04-97 : FMN ; Correction call_tox_rect, on repasse en GL_BACK a la fin.call_tox_rect -05-01-98 : FMN ; Suppression WNT inutile -Suppression call_tox_set_colormap_mapping() - -************************************************************************/ - -/*----------------------------------------------------------------------*/ -/* -* Includes -*/ - -#include -#include - -#include - -#include -#ifndef WNT -# include -#else -# include -#endif /* WNT */ - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/*static GLboolean lighting_mode;*/ -extern DISPLAY *call_thedisplay; -#ifndef WNT -/*static GC gcx;*/ -#endif /* WNT */ -/*static int ft=1;*/ - -/*----------------------------------------------------------------------*/ -/* -* Constantes -*/ - -#define XTRACE - -#define CALL_DEF_BUFFER_SIZE 1024 -#define CALL_DEF_STRING_LENGTH 132 - -/*----------------------------------------------------------------------*/ -EXPORT void call_togl_build_matrix ( - CALL_DEF_VIEW * aview, - CALL_DEF_MATRIX4X4 gl_ori_matrix, CALL_DEF_MATRIX4X4 gl_map_matrix, - CALL_DEF_MATRIX4X4 eval_ori_matrix, CALL_DEF_MATRIX4X4 eval_map_matrix ) -{ - int i, j; - for (i=0; i<3; i++) - for (j=0; j<3; j++) - if (i == j) { - gl_ori_matrix[i][j] = ( float )1.0; - gl_map_matrix[i][j] = ( float )1.0; - eval_ori_matrix[i][j] = ( float )1.0; - eval_map_matrix[i][j] = ( float )1.0; - } - else { - gl_ori_matrix[i][j] = ( float )0.0; - gl_map_matrix[i][j] = ( float )0.0; - eval_ori_matrix[i][j] = ( float )0.0; - eval_map_matrix[i][j] = ( float )0.0; - } -} - -/*----------------------------------------------------------------------*/ -EXPORT void call_togl_element_type ( - long Id, - long elem_num, - long *elem_type ) -{ -#ifdef PHIGS_VERSION - Pint err_ind; /* OUT error indicator */ - Pint size; /* OUT element size */ - Pint type; /* OUT element type */ - Pint cur_index; /* OUT element pointer value */ - - type = 0; - call_func_open_struct (Id); - call_func_set_elem_ptr (elem_num); - call_func_inq_elem_ptr (&err_ind, &cur_index); - /* it is not the end */ - if ((elem_num==cur_index) && (! err_ind)) { - call_func_inq_cur_elem_type_size - (&err_ind, &type, &size); - if (err_ind) type = 0; - } - call_func_close_struct (); - - switch (type) - { - case CALL_PHIGS_ELEM_POLYLINE3 : - case CALL_PHIGS_ELEM_POLYLINE : - case CALL_PHIGS_ELEM_POLYLINE_SET3_DATA : - *elem_type = 1; - break; - - case CALL_PHIGS_ELEM_FILL_AREA3 : - case CALL_PHIGS_ELEM_FILL_AREA : - case CALL_PHIGS_ELEM_FILL_AREA_SET3 : - case CALL_PHIGS_ELEM_FILL_AREA_SET : - case CALL_PHIGS_ELEM_FILL_AREA_SET3_DATA : - case CALL_PHIGS_ELEM_SET_OF_FILL_AREA_SET3_DATA : - *elem_type = 2; - break; - - case CALL_PHIGS_ELEM_TRI_STRIP3_DATA : - *elem_type = 3; - break; - - case CALL_PHIGS_ELEM_QUAD_MESH3_DATA : - *elem_type = 4; - break; - - case CALL_PHIGS_ELEM_TEXT3 : - case CALL_PHIGS_ELEM_TEXT : - case CALL_PHIGS_ELEM_ANNO_TEXT_REL3 : - case CALL_PHIGS_ELEM_ANNO_TEXT_REL : - *elem_type = 5; - break; - - case CALL_PHIGS_ELEM_POLYMARKER3 : - case CALL_PHIGS_ELEM_POLYMARKER : - *elem_type = 6; - break; - - default : - *elem_type = 0; - break; - } -#endif - TelType type; - Tint cur_index; - Tint err_ind=0; - Tint size; - - type = TelNil; - - call_func_open_struct (Id); - call_func_set_elem_ptr (elem_num); - if( TsmGetCurElemPtr( &cur_index ) == TFailure ) - err_ind = 1; - /* it is not the end */ - if ((elem_num==cur_index) && (! err_ind)) - TelInqCurElemTypeSize( &type, &size ); - call_func_close_struct (); - - switch (type) - { - case CALL_PHIGS_ELEM_POLYLINE_SET3_DATA : - *elem_type = 1; - break; - - case CALL_PHIGS_ELEM_FILL_AREA3 : - case CALL_PHIGS_ELEM_FILL_AREA_SET3 : - *elem_type = 2; - break; - - case CALL_PHIGS_ELEM_TRI_STRIP3_DATA : - *elem_type = 3; - break; - - case CALL_PHIGS_ELEM_QUAD_MESH3_DATA : - *elem_type = 4; - break; - - case CALL_PHIGS_ELEM_ANNO_TEXT_REL3 : - - *elem_type = 5; - break; - - case CALL_PHIGS_ELEM_POLYMARKER3 : - *elem_type = 6; - break; - - default : - *elem_type = 0; - break; - } - *elem_type = 0; -} - -/*----------------------------------------------------------------------*/ -EXPORT int call_togl_inquiremat ( - CALL_DEF_VIEW * aview, - CALL_DEF_MATRIX4X4 ori_matrix, - CALL_DEF_MATRIX4X4 map_matrix ) -{ - TEL_VIEW_REP rep; - int i, j, error; - view_map3 map; - - TelGetViewRepresentation( aview->WsId, aview->ViewId, &rep ); - if(aview->Orientation.IsCustomMatrix) { - /* OCC18942: Trying to return the current matrices instead of calculating them anew. - This in particular allows using application-defined matrices. */ - } else { - memcpy( &map.win, &rep.extra.map.window, sizeof( Tlimit ) ); - memcpy( &map.proj_vp, &rep.extra.map.viewport, sizeof( Tlimit3 ) ); - switch(rep.extra.map.proj){ - default: - case TelParallel : map.proj_type = TYPE_PARAL; break; - case TelPerspective : map.proj_type = TYPE_PERSPECT; break; - } - map.proj_ref_point.x = rep.extra.map.prp[0]; - map.proj_ref_point.y = rep.extra.map.prp[1]; - map.proj_ref_point.z = rep.extra.map.prp[2]; - map.view_plane = rep.extra.map.vpd; - map.back_plane = rep.extra.map.bpd; - map.front_plane = rep.extra.map.fpd; - - call_func_eval_ori_matrix3( (point3 *)rep.extra.vrp, - (vec3 *)rep.extra.vpn, - (vec3 *)rep.extra.vup, - &error, rep.orientation_matrix ); - if( error ) - return 1; - - call_func_eval_map_matrix3( &map, &error, rep.mapping_matrix ); - - if( error ) - return 1; - } - for( i = 0; i < 4; i++ ) - for( j = 0; j < 4; j++ ) - { - ori_matrix[i][j] = rep.orientation_matrix[j][i]; - map_matrix[i][j] = rep.mapping_matrix[j][i]; - } - - return 0; -} - -/*----------------------------------------------------------------------*/ -int call_tox_window_exists ( WINDOW w ) -{ - return (1); -} - -/*----------------------------------------------------------------------*/ -extern void -call_tox_rect( int wsid, WINDOW win, int u, int v ) -{ -#define STEP 2.0 - Tint w, h; - CMN_KEY_DATA k; - float p[3]; - float r[3] = { ( float )0.0, ( float )1.0, ( float )1.0 }; - - TsmGetWSAttri( wsid, WSWidth, &k ); - w = k.ldata; - TsmGetWSAttri( wsid, WSHeight, &k ); - h = k.ldata; - - TxglWinset( call_thedisplay, win ); - glViewport( 0, 0, w, h); - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho( 0.0, ( GLdouble ) w, 0.0, ( GLdouble ) h, -100000.0, 100000.0 ); - - p[0] = ( float )(u-STEP); - p[1] = ( float )(v-STEP); - p[2] = ( float )(-9999.0); - glDrawBuffer(GL_FRONT) ; - glColor3fv( r ); - glBegin(GL_QUADS); - glVertex3fv( p ); - p[0] = ( float )(u+STEP); - glVertex3fv( p ); - p[1] = ( float )(v+STEP); - glVertex3fv( p ); - p[0] = ( float )(u-STEP); - glVertex3fv( p ); - glEnd(); - - TelFlush(0); - - glDrawBuffer(GL_BACK) ; -} - -/*----------------------------------------------------------------------*/ - -#if !defined(GLU_VERSION_1_2) -void gluTessBeginContour() { - printf(" UNIMPLEMENTED function gluTessBeginContour()\n"); -} -void gluTessBeginPolygon() { - printf(" UNIMPLEMENTED function gluTessBeginPolygon()\n"); -} -void gluTessEndPolygon() { - printf(" UNIMPLEMENTED function gluTessEndPolygon()\n"); -} -void gluTessEndContour() { - printf(" UNIMPLEMENTED function gluTessEndContour()\n"); -} -#endif - -/*----------------------------------------------------------------------*/ diff --git a/src/OpenGl/OpenGl_userdraw.cxx b/src/OpenGl/OpenGl_userdraw.cxx deleted file mode 100755 index b53690b39f..0000000000 --- a/src/OpenGl/OpenGl_userdraw.cxx +++ /dev/null @@ -1,33 +0,0 @@ -/* -// File: OpenGl_userdraw.c -// Created: Thu Mar 3 12:34:02 2005 -// Author: Sergey ZERTCHANINOV -// -// Copyright: Open CASCADE 2005 -*/ - -#include -#include -#include - - -static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) = -{ - 0, /* UserdrawPick, */ - 0, /* UserdrawDisplay, */ - 0, /* UserdrawAdd, */ - 0, /* UserdrawDelete, */ - 0, /* UserdrawPrint, */ - 0, /* UserdrawInquire */ -}; - -MtblPtr TelUserdrawInitClass( TelType* el ) -{ - *el = TelUserdraw; - return MtdTbl; -} - -MtblPtr GetCallbackTable () -{ - return MtdTbl; -} diff --git a/src/OpenGl/OpenGl_view.cxx b/src/OpenGl/OpenGl_view.cxx deleted file mode 100755 index 55463af859..0000000000 --- a/src/OpenGl/OpenGl_view.cxx +++ /dev/null @@ -1,1530 +0,0 @@ -/*********************************************************************** - -FONCTION : ----------- -File OpenGl_view : - - -REMARQUES: ----------- - -An implementation of the PHIGS viewing pipeline - -This module provides services for setting view representations and view -indices, viewport management, coordinate conversion routines and help -functions. - -The corresponding header file is telem_view.h - - -HISTORIQUE DES MODIFICATIONS : --------------------------------- -xx-xx-xx : xxx ; Creation. -11-03-96 : FMN ; Correction warning compilation -20-03-96 : CAL ; Modif de TelClearViews -appel a call_tox_getscreen pour effacer tout -meme apres un resize -01-04-96 : CAL ; Integration MINSK portage WNT -22-04-96 : FMN ; Suppression prototype inutile. -25-06-96 : FMN ; Suppression utilisation de glScissor. -28-06-96 : CAL ; Simplification de TelClearViews -02-07-96 : FMN ; Suppression WSWSHeight et WSWSWidth -Suppression de TelSetWSWindow -Suppression glViewport inutile -03-07-96 : FMN ; A une workstation correspond une vue. -12-07-96 : FMN ; Correction calcul matrice orientatione. -17-07-96 : FMN ; Ajout clear pour le zbuffer. -21-10-96 : FMN ; Suppression LMC_COLOR fait dans OpenGl_execstruct.c -24-01-97 : CAL ; Suppression code inutile (DEBUG_ONLY) -30-06-97 : FMN ; Suppression OpenGl_telem_light.h -27-08-97 : FMN ; Ajout glDepthMask avant le clear (PRO8939) -09-12-97 : FMN ; Prise en compte environnement mapping. -03-03-98 : FMN ; Suppression variable externe TglWhetherPerspective -13-03-98 : FMN ; Suppression variable WSNeedsClear -10-04-98 : CAL ; Suppression du calcul de inverse_matrix -30-04-98 : FMN ; Suppression variable externe TglUpdateView0 -24-11-98 : FMN ; PRO16215: Suppression test sur le GL_MAX_CLIP_PLANES -Si OpenGL n'a pas de plans de clipping on ne le simule pas. -24-11-98 : FMN ; Correction sur la gestion de la perspective (cf Programming Guide) -- Suppression du test (prp between front and back planes) -- Suppression matrice perspective (modify the next two cells to change clipping policy) -Ces modifs sont necessaires pour pouvoir mettre le prp entre le Front et Back plane - -************************************************************************/ - -#define BUC60920 /* GG 010601 -Change the z buffer comparaison for minimizing -unavailable or unviewable drawing of pixels in the same plane -*/ - -#define BUC61044 /* 25/10/01 SAV ; added functionality to control gl depth testing -from higher API */ - -#define OCC1188 /* SAV 23/12/02 TelClearBackground() draws background texture -if any was defined -*/ - - -/*----------------------------------------------------------------------*/ -/* -* Includes -*/ - -#include - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/*----------------------------------------------------------------------*/ -/* -* Variable globales -*/ - -EXPORT extern GLboolean env_walkthrow; /* definit dans OpenGl_togl_begin.c */ -/* OCC18942: The new perspective projection matrix is off by default */ -EXPORT extern GLboolean env_sym_perspective; /* defined in OpenGl_togl_begin.c */ - -/*----------------------------------------------------------------------*/ -/* -* Constantes -*/ - -#define NO_TRACE_MAT -#define NO_TRACE_MATRIX -#define NO_PRINT - -#define ENVTEX - - -/*----------------------------------------------------------------------*/ -/* -* Prototypes -*/ - -#ifdef DEB -static void pr_matrix( Tmatrix3 ); -#endif - - -/*----------------------------------------------------------------------*/ -/* -* Type definitions -*/ - -struct TEL_VIEW_DATA -{ - TEL_VIEW_REP vrep; -#ifdef CAL_100498 - Tmatrix3 inverse_matrix;/* accelerates UVN2XYZ conversion */ -#endif - IMPLEMENT_MEMORY_OPERATORS -}; -typedef TEL_VIEW_DATA *tel_view_data; /* Internal data stored for every view rep */ - -/*----------------------------------------------------------------------*/ -/* -* Variables statiques -*/ - -static void set_clipplanes( tel_view_rep ); /* front & back clip planes */ -static void set_userclipplanes( tel_view_rep ); /* user-defined clipping planes */ - -#ifdef CAL_100498 -static void TelEvalInverseMatrix( Tfloat*, Tfloat*, Tfloat*, /*vrp,vpn,vup*/ - Tfloat, Tmatrix3 ); /*vpd,inverse*/ -#endif -static Tmatrix3 ident = { - { ( float )1.0, ( float )0.0, ( float )0.0, ( float )0.0 }, - { ( float )0.0, ( float )1.0, ( float )0.0, ( float )0.0 }, - { ( float )0.0, ( float )0.0, ( float )1.0, ( float )0.0 }, - { ( float )0.0, ( float )0.0, ( float )0.0, ( float )1.0 } -}; - -/*----------------------------------------------------------------------*/ -/*+ -Qsearch number comparison routine - -Compares view ids during sorting of the list of defined views -for a workstation -+*/ - -/*----------------------------------------------------------------------*/ -/*+ -Evaluate View Mapping Matrix - -This routine computes the mapping matrix based on the Window and Viewport -limits, Projection type and View plane, Front plane and Back plane -distances. -+*/ - -static void -EvalViewMappingMatrix( tel_view_mapping mapping /* View Mapping */, - Tint *error_ind /* Out: Error Indicator */, - Tmatrix3 mat /* Out: Mapping Matrix * */, - Tint flag, - Tfloat cx, - Tfloat cy, - Tint clip_flag, - Tlimit3 *clip_limit - ) -{ - Tfloat gx, gy, xsf, ysf, zsf; - Tfloat fpd, bpd; - - /* OCC18942 */ - Tfloat n, f, r, l, t, b, Zprp, dx, dy, VPD; - - /* FSXXX */ - /* GLint gdtmp; */ - Tlimit3 vp = { ( float )-1.0, ( float )1.0, ( float )-1.0, ( float )1.0, ( float )1.0, ( float )-1.0 }; - Tmatrix3 pmat = { { ( float )1.0, ( float )0.0, ( float )0.0, ( float )0.0 }, - { ( float )0.0, ( float )1.0, ( float )0.0, ( float )0.0 }, - { ( float )0.0, ( float )0.0, ( float )1.0, ( float )0.0 }, - { ( float )0.0, ( float )0.0, ( float )0.0, ( float )1.0 } }; - Tmatrix3 mmat = { { ( float )1.0, ( float )0.0, ( float )0.0, ( float )0.0 }, - { ( float )0.0, ( float )1.0, ( float )0.0, ( float )0.0 }, - { ( float )0.0, ( float )0.0, ( float )1.0, ( float )0.0 }, - { ( float )0.0, ( float )0.0, ( float )0.0, ( float )1.0 } }; - - fpd = mapping->fpd; - bpd = mapping->bpd; - - /* invalid window */ - if( mapping->window.xmin >= mapping->window.xmax || - mapping->window.ymin >= mapping->window.ymax ) - { - *error_ind = 1; - return; - } - - /* invalid viewport */ - if( mapping->viewport.xmin >= mapping->viewport.xmax || - mapping->viewport.ymin >= mapping->viewport.ymax || - mapping->viewport.zmin >= mapping->viewport.zmax ) - { - *error_ind = 2; - return; - } - - /* invalid back/front plane distances */ - if( mapping->bpd >= mapping->fpd ) - { - *error_ind = 3; - return; - } - - /* prp between front and back planes */ - if (!env_walkthrow) - { - if( mapping->prp[2] < mapping->fpd && - mapping->prp[2] > mapping->bpd ) - { - *error_ind = 4; - return; - } - } - - if( mapping->prp[2] == mapping->vpd ) - { - *error_ind = 5; /* prp on view plane */ - return; - } - - if( mapping->viewport.xmin < 0 || - mapping->viewport.xmax > 1 || - mapping->viewport.ymin < 0 || - mapping->viewport.ymax > 1 || - mapping->viewport.zmin < 0 || - mapping->viewport.zmax > 1 ) - { - *error_ind = 6; /* viewport limits outside NPC space */ - return; - } - - *error_ind = 0; - - /* OCC18942: Moved here while debugging perspective projection matrix */ - /* centers */ - if( flag == 0 ) - { - cx = mapping->window.xmin + mapping->window.xmax, cx /= ( float )2.0; - cy = mapping->window.ymin + mapping->window.ymax, cy /= ( float )2.0; - } - - gx = (cx - mapping->prp[0]) / (mapping->vpd - mapping->prp[2]); - gy = (cy - mapping->prp[1]) / (mapping->vpd - mapping->prp[2]); - -#ifdef PRINT - printf("EvalViewMappingMatrix \n"); - printf("prp %f %f %f \n", mapping->prp[0], mapping->prp[1], mapping->prp[2]); - printf("vpd fpd bpd %f %f %f \n", mapping->vpd, mapping->fpd, mapping->bpd); - printf("window limit %f %f %f %f\n", mapping->window.xmin, mapping->window.xmax, - mapping->window.ymin, mapping->window.ymax); - printf("viewport limit %f %f %f %f\n", mapping->viewport.xmin, mapping->viewport.xmax, - mapping->viewport.ymin, mapping->viewport.ymax); -#endif - - /* projection matrix */ - if( mapping->proj == TelParallel ) - { - - pmat[2][0] = -gx; pmat[3][0] = mapping->vpd*gx; - pmat[2][1] = -gy; pmat[3][1] = mapping->vpd*gy; - } - else if ( !env_sym_perspective )/* TelPerspective */ - { - pmat[0][0] = pmat[1][1] = mapping->prp[2] - mapping->vpd; - pmat[2][0] = -gx; - pmat[2][1] = -gy; - pmat[2][3] = ( float )-1.0; - pmat[3][0] = mapping->vpd * gx; - pmat[3][1] = mapping->vpd * gy; - pmat[3][3] = mapping->prp[2]; - - /* modify the next two cells to change clipping policy */ - if (!env_walkthrow) - { - pmat[2][2] = mapping->prp[2] - ( fpd + bpd ); - pmat[3][2] = fpd * bpd; - } - } - /* OCC18942: New approach to calculation of mapping (projection) matrix */ - else - { - dx = mapping->window.xmax - mapping->window.xmin; - dy = mapping->window.ymax - mapping->window.ymin; - Zprp = mapping->prp[2]; - VPD = Zprp - mapping->vpd; - - /* - Calculate canonical perspective projection parameters as if we were about - to use glFrustum() to create symmetric perspective frustum. - - After the view orientation matrix is applied, the coordinate system origin is located - at the VRP and oriented properly. However, the viewplane has width = dx and height = dy - and its center (cx, cy, VPD) is not always located at the view Z axis. - The canonical perspective projection matrix assumes the eye is located at (0, 0, 0). - Thus the old approach resulted in a non-symmetric perspective, - as X and Y coordinates of the projection reference point (PRP) were not updated - when cx and cy changed. Moreover, such "static" perspective had some other disadvantages, - such as non-realistic panning, i.e. instead of moving the eye (or camera) over the model - a sort of "frame" moved over the static perspective projection picture, - exposing a part of this static picture to the user. - - In order to make the perspective symmetric, we need to translate - the coordinate system to PRP before projection. - Thus we translate X, Y and Z co-ordinates by -cx, -cy and -Zprp respectively. - - NOTE: mat[i][j] means j-th element of i-th column, as OpenGL accepts the matrices - in column-major order, while in C two-dimensional arrays are stored in memory - in row-major order! - - VPD is used below instead of near clipping plane dispance (n) in order to simplify - calculation of l and r values. If we did not use VPD in the matrix calculation, we would have to - project 0.5 * dx, -0.5 * dx, 0.5 * dy and - 0.5 * dy onto the near clipping plane - to calculate these values. - - Pending issues: - 1. It is still necessary to find a way to calculate the perspective projection matrix - for TPM_WALKTHROUGH projection model. This projection model is not supported yet - by the new code. - */ - r = .5f * dx; - l = -r; - t = .5f * dy; - b = -t; - n = Zprp - fpd; f = Zprp - bpd; - - mat[0][0] = 2.f * VPD / (r - l); - mat[1][1] = 2.f * VPD / (t - b); - mat[2][0] = (r + l) / (r - l); - mat[2][1] = (t + b) / (t - b); - mat[2][2] = - (f + n) / (f - n); - mat[2][3] = -1.f; - /* - The last column takes into account translation along X, Y and Z axis - before projecting. This can be considered as a result of right-multiplying the canonical - perspective projection matrix P by a translation matrix T - (it differs form the canonical matrix by the last column only): - | 1 0 0 -cx | - | 0 1 0 -cy | - mat = P * T, where T = | 0 0 1 -Zprp | - | 0 0 0 1 | - */ - mat[3][0] = -mat[2][0] * Zprp - mat[0][0] * cx; - mat[3][1] = -mat[2][1] * Zprp - mat[1][1] * cy; - mat[3][2] = -2.f * f * n / (f - n) - mat[2][2] * Zprp; - mat[3][3] = Zprp; - -#ifdef PRINT - printf("r l t b n f: %f %f %f %f %f %f \n", r,l,t,b,n,f); - printf( "mapping_matrix (new code):\n" ); - pr_matrix(mat); -#endif - - /* return here, as further calculations are related to the old approach */ - return; - } - - /* scale factors */ - xsf = (vp.xmax - vp.xmin) / (mapping->window.xmax - mapping->window.xmin); - ysf = (vp.ymax - vp.ymin) / (mapping->window.ymax - mapping->window.ymin); - zsf = (vp.zmax - vp.zmin) / (fpd - bpd); - - /* map matrix */ - mmat[0][0] = xsf, mmat[1][1] = ysf, mmat[2][2] = zsf; - mmat[3][0] = vp.xmin - xsf*mapping->window.xmin; - mmat[3][1] = vp.ymin - ysf*mapping->window.ymin; - mmat[3][2] = vp.zmin - zsf*bpd; - - /* multiply to obtain mapping matrix */ - TelMultiplymat3( mat, pmat, mmat ); - -#ifdef PRINT - printf( "mapping_matrix :\n" ); - pr_matrix(mat); -#endif -} - -/*----------------------------------------------------------------------*/ -/*+ -Set View Representation - -This routine defines a view representation for a workstation. - -The representation of the view is stored in a storage table. -An entry is made into the list of defined views for the workstation. -If the view id being defined already exists, its representation gets -modified, else a new representation is created. -An inverse transformation matrix is computed and stored in the internal -data for the view to accelerate UVN2XYZ conversions. To be able to compute -this matrix, it requires some extra information about the view orientation, -view plane distance and viewport limits. -+*/ - -TStatus -TelSetViewRepresentation( Tint Wsid /* Workstation id*/, - Tint Vid /* View id */, - tel_view_rep vrep /* view repesentation */ - ) -{ - CMN_KEY_DATA key; - tel_view_data vptr; - - if( Vid == 0 ) - return TFailure; /* attempt to modify default view */ - - /* Mise a jour de l'update_mode */ - key.ldata = TNotDone; - TsmSetWSAttri( Wsid, WSUpdateState, &key ); - - TsmGetWSAttri( Wsid, WSViews, &key ); - vptr = (tel_view_data)(key.pdata) ; /* Obtain defined view data*/ - - if( !vptr ) /* no view defined yet */ - { /* allocate */ - //cmn_memreserve(vptr, 1, 0 ); - vptr = new TEL_VIEW_DATA(); - if( !vptr ) return TFailure; - - key.pdata = vptr; - TsmSetWSAttri( Wsid, WSViews, &key ); /* Set defined view data*/ - } - - /* copy view definition to storage table record */ - /* NOTE: Use the matrices already calculated and stored in vrep */ - vptr->vrep = *vrep; - -#ifdef CAL_100498 - /* compute inverse transformation matrix */ - TelEvalInverseMatrix( vrep->extra.vrp, vrep->extra.vpn, vrep->extra.vup, - vrep->extra.map.vpd, vptr->inverse_matrix ); -#endif -#ifdef TRACE_MAT - printf( "\nTelSetViewRepresentation WS : %d, view : %d\n", Wsid, Vid ); - printf( "orientation_matrix :\n" ); - pr_matrix( vptr->vrep.orientation_matrix ); - printf( "mapping_matrix :\n" ); - pr_matrix( vptr->vrep.mapping_matrix ); -#endif - return TSuccess; -} - - -/*----------------------------------------------------------------------*/ -TStatus -TelGetViewRepresentation( Tint Wsid /* Workstation id*/, - Tint Vid /* View id */, - tel_view_rep vrep /* view representation */ - ) -{ - CMN_KEY_DATA key; - tel_view_data vptr; - - if( Vid == 0 ) - { - matcpy( vrep->orientation_matrix, ident ); - matcpy( vrep->mapping_matrix, ident ); - vrep->clip_limit.xmin = vrep->clip_limit.ymin = - vrep->clip_limit.zmin = ( float )0.0; - vrep->clip_limit.xmax = vrep->clip_limit.ymax = - vrep->clip_limit.zmax = ( float )1.0; - vrep->clip_xy = TOff; - vrep->clip_back = vrep->clip_front = TOn; - vrep->shield_indicator = TOn; - vrep->shield_colour.rgb[0] = vrep->shield_colour.rgb[1] = - vrep->shield_colour.rgb[2] = ( float )0.0; - vrep->border_indicator = TOff; /* non utilise */ - vrep->border_colour.rgb[0] = vrep->border_colour.rgb[1] = - vrep->border_colour.rgb[2] = ( float )0.0; - vrep->active_status = TOn; - vrep->extra.vrp[0] = vrep->extra.vrp[1] = vrep->extra.vrp[2] = ( float )0.0; - vrep->extra.vpn[0] = ( float )0.0, - vrep->extra.vpn[1] = ( float )0.0, - vrep->extra.vpn[2] = ( float )1.0; - vrep->extra.vup[0] = ( float )0.0, - vrep->extra.vup[1] = ( float )1.0, - vrep->extra.vup[2] = ( float )0.0; - vrep->extra.map.vpd = ( float )0.0, - vrep->extra.map.fpd = ( float )0.0, - vrep->extra.map.bpd = ( float )-1.0; - vrep->extra.map.window.xmin = vrep->extra.map.window.ymin = ( float )0.0; - vrep->extra.map.window.xmax = vrep->extra.map.window.ymax = ( float )1.0; - vrep->extra.map.viewport.xmin = vrep->extra.map.viewport.ymin = - vrep->extra.map.viewport.zmin = ( float )0.0; - vrep->extra.map.viewport.xmax = vrep->extra.map.viewport.ymax = - vrep->extra.map.viewport.zmax = ( float )1.0; - vrep->clipping_planes.Clear(); - return TSuccess; - } - - if(TsmGetWSAttri( Wsid, WSViews, &key ) != TSuccess) { - return TFailure; - } - vptr = (tel_view_data)key.pdata ; /* Obtain defined view data*/ - if( !vptr ) return TFailure; /* no view defined yet */ - *vrep = vptr->vrep; /* copy view definition */ - - return TSuccess; -} - -/*----------------------------------------------------------------------*/ -/*+ -Evaluate View Orientation Matrix - -This routine computes the orientation matrix based on the View Reference -Point, View Plane Normal and the View Up Vector. -+*/ - -void -TelEvalViewOrientationMatrix( Tfloat *vrp /* View Reference Point */, - Tfloat *vpn /* View Plane Normal */, - Tfloat *vup /* View Up Vector */, - Tfloat *asf /* Axial Scale Factors */, - Tint *error_ind/* Out: Error indicator */, - Tmatrix3 rmat /* Out: Orientation Matrix */ - ) -{ - Tfloat u[3], v[3], n[3], f; - - /* view plane normal of zero length */ - if( vecmag(vpn) == 0.0 ) - { - *error_ind = 1; - return; - } - - /* view up vector of zero length */ - if( vecmag(vup) == 0.0 ) - { - *error_ind = 2; - return; - } - - /* view up vector parallel to view plane normal */ - vecang(vup, vpn, f); - if( f == 0.0 ) - { - *error_ind = 3; - return; - } - - *error_ind = 0; - - veccpy(n, vpn); - veccpy(v, vup); - vecnrm(n); - - veccrs(u,v,n); /* up vector cross plane normal gives U axis */ - vecnrm(u); - - veccrs(v,n,u); /* plane normal cross U axis gives modified up vector */ - vecnrm(v); /* redundant ? */ - - /* rotate to align along u, v, n */ - rmat[0][0] = ( float )u[0] * asf[0], - rmat[0][1] = ( float )v[0] * asf[0], - rmat[0][2] = ( float )n[0] * asf[0], - rmat[0][3] = ( float )0.0; - - rmat[1][0] = ( float )u[1] * asf[1], - rmat[1][1] = ( float )v[1] * asf[1], - rmat[1][2] = ( float )n[1] * asf[1], - rmat[1][3] = ( float )0.0; - - rmat[2][0] = ( float )u[2] * asf[2], - rmat[2][1] = ( float )v[2] * asf[2], - rmat[2][2] = ( float )n[2] * asf[2], - rmat[2][3] = ( float )0.0; - - /* translate to centre at vrp */ - - rmat[3][0] = - ( float ) (u[0]*vrp[0] + u[1]*vrp[1] + u[2]*vrp[2]); - rmat[3][1] = - ( float ) (v[0]*vrp[0] + v[1]*vrp[1] + v[2]*vrp[2]); - rmat[3][2] = - ( float ) (n[0]*vrp[0] + n[1]*vrp[1] + n[2]*vrp[2]); - rmat[3][3] = ( float )1.0; - -#ifdef PRINT - printf("TelEvalViewOrientationMatrix \n"); - printf("view_ref_pt %f %f %f \n", vrp[0], vrp[1], vrp[2]); - printf("view_up_vec %f %f %f \n", vup[0], vup[1], vup[2]); - printf("view_plane_normal %f %f %f \n", vpn[0], vpn[1], vpn[2]); - pr_matrix(rmat); -#endif - - return; -} -/*----------------------------------------------------------------------*/ - -void -TelEvalViewMappingMatrix( tel_view_mapping mapping /* View Mapping */, - Tint *error_ind /* Out: Error Indicator */, - Tmatrix3 mat /* Out: Mapping Matrix */ - ) -{ - EvalViewMappingMatrix( mapping, error_ind, mat, 0, ( float )0.0, ( float )0.0, 0, 0 ); -} - -/*----------------------------------------------------------------------*/ - -void -TelEvalViewMappingMatrixPick( tel_view_mapping mapping /* View Mapping */, - Tint *error_ind /* Out: Error Indicator */, - Tmatrix3 mat /* Out: Mapping Matrix */, - Tfloat cx, - Tfloat cy - ) -{ - EvalViewMappingMatrix( mapping, error_ind, mat, 1, cx, cy, 0, 0 ); -} - -/*----------------------------------------------------------------------*/ -/*+ -Evalute inverse transformation matrix. - -This routine computes a matrix required to convert UVN coordinates to XYZ -coordinates. It is called every time a View Representation is created or -modified, and the inverse matrix is stored along with the internal data -for the view representation. -+*/ - -#ifdef CAL_100498 -static void -TelEvalInverseMatrix( Tfloat *vrp /* View Reference Point */, - Tfloat *vpn /* View Plane Normal */, - Tfloat *vup /* View Up Vector */, - Tfloat vpd /* View Plane Distance */, - Tmatrix3 mat /* Out: Inverse Transformation Matrix */ - ) -{ - Tfloat u[3], v[3], n[3], p[3], t[3]; - Tfloat dist = ( float )0.0; - - veccpy(n, vpn); /* compute UVN orientation */ - veccpy(v, vup); - veccpy(p, vrp); - - veccrs(u,v,n); - vecnrm(u); - - veccrs(v,n,u); - vecnrm(v); - - dist = vpd; - veccpy(t,n); - vecscl(dist,t); - vecadd(t,t,p); /* translation vector */ - - veccpy(mat[0],u); - veccpy(mat[1],v); - veccpy(mat[2],n); - veccpy(mat[3],t); - - mat[0][3] = mat[1][3] = mat[2][3] = ( float )0.0, mat[3][3] = ( float )1.0; - - return; -} -#endif - -#ifdef CAL_100498 -/*----------------------------------------------------------------------*/ -/*+ -Convert Coordinates utility routine - -This routine converts coordinates from UVN space to XYZ space and -vice versa. For UVN2XYZ, the inverse transformation matrix is used and for -XYZ2UVN, the orientation matrix is used. -+*/ - -TStatus -TelConvertCoord( Tint Wsid /* Workstation id */, - Tint Vid /* View id */, - TelCoordType type /* Conversion type (UVN2XYZ or XYZ2UVN) */, - Tfloat *uvn /* UVN coords if type is UVN2XYZ else Out */, - Tfloat *xyz /* XYZ coords if type is XYZ2UVN else Out */ - ) -{ - CMN_KEY_DATA key; - tel_view_data vptr; - register Tint i; - - Tfloat pt[4], tpt[4]; - - if( Vid == 0 ) - { /* default view */ - switch( type ) - { - case UVN2XYZ: - veccpy(xyz,uvn); - break; - case XYZ2UVN: - veccpy(uvn,xyz); - break; - } - return TSuccess; - } - - TsmGetWSAttri( Wsid, WSViews, &key ); - vptr = key.pdata ; /* Obtain defined view data*/ - if( !vptr ) return TFailure; /* no view defined yet */ - - switch( type ) - { - case UVN2XYZ: - veccpy(pt,uvn); - pt[3] = ( float )1.0; - TelTranpt3( tpt, pt, vptr->inverse_matrix ); - veccpy(xyz,tpt); - break; - - case XYZ2UVN: - veccpy(pt,xyz); - pt[3] = ( float )1.0; - TelTranpt3( tpt, pt, vptr->vrep.orientation_matrix ); - veccpy(uvn,tpt); - break; - } - - return TSuccess; -} -#endif - -/*----------------------------------------------------------------------*/ -/*+ -Print Matrix - -Debug tool -+*/ - -#ifdef DEB -void -pr_matrix( Tmatrix3 mat ) -{ - printf( "%f %f %f %f\n", mat[0][0], mat[0][1], mat[0][2], mat[0][3] ); - printf( "%f %f %f %f\n", mat[1][0], mat[1][1], mat[1][2], mat[1][3] ); - printf( "%f %f %f %f\n", mat[2][0], mat[2][1], mat[2][2], mat[2][3] ); - printf( "%f %f %f %f\n", mat[3][0], mat[3][1], mat[3][2], mat[3][3] ); - printf( "\n" ); - return; -} -#endif - -/*----------------------------------------------------------------------*/ -/*+ -Set View Index - -This routine activates the view representation which has been defined -previously. -+*/ - -TStatus -TelSetViewIndex( Tint Wsid /* Workstation id */, - Tint Vid /* View id */ ) -{ - CMN_KEY_DATA key; - tel_view_data vptr; - - if( Vid == 0 ) - { /* default view */ - GLint mm; - glGetIntegerv(GL_MATRIX_MODE, &mm); -#ifdef TRACE_MATRIX - printf("OpenGl_view.c::TelSetViewIndex::glMatrixMode(GL_PROJECTION) \n"); -#endif - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho( -0.5, 0.5, -0.5, 0.5, -0.5, 0.5 ); - glMatrixMode(mm); - return TSuccess; - } - - TsmGetWSAttri( Wsid, WSViews, &key ); - vptr = (tel_view_data)key.pdata ; /* Obtain defined view data*/ - if( !vptr ) return TFailure; /* no view defined yet */ - - -#ifdef TRACE_MATRIX - printf("OpenGl_view.c::TelSetViewIndex::glMatrixMode(GL_MODELVIEW) \n"); -#endif - if(vptr->vrep.extra.scaleFactors[0] != 1. || - vptr->vrep.extra.scaleFactors[1] != 1. || - vptr->vrep.extra.scaleFactors[2] != 1.) - glEnable(GL_NORMALIZE); /* if the view is scaled normal vectors are scaled to unit length for correct displaying of shaded objects*/ - else if(glIsEnabled(GL_NORMALIZE)) - glDisable(GL_NORMALIZE); - glMatrixMode(GL_MODELVIEW); - set_clipplanes( &(vptr->vrep) ); - - - glLoadMatrixf((GLfloat *) vptr->vrep.orientation_matrix ); - set_userclipplanes( &(vptr->vrep) ); /* set clipping planes defined by user */ - -#ifdef ENVTEX - /* - * Ajout translation necessaire pour l'environnement mapping - */ - { - GLfloat dep; - - TsmGetWSAttri(Wsid, WSSurfaceDetail, &key); - /* TOD_ENVIRONMENT ou TOD_ALL */ - if (key.ldata == 1 || key.ldata == 2) - { - /* dep = vptr->vrep.extra.map.fpd * 0.5F; */ - dep = (vptr->vrep.extra.map.fpd + vptr->vrep.extra.map.bpd) * 0.5F; /* OCC280: FitAll work incorrect for perspective view if the SurfaceDetail mode is V3d_TEX_ENVIRONMENT or V3d_TEX_ALL */ - glTranslatef(-dep*vptr->vrep.extra.vpn[0], - -dep*vptr->vrep.extra.vpn[1], - -dep*vptr->vrep.extra.vpn[2]); -#ifdef PRINT - printf("glTranslatef: %f %f %f \n", - -dep*vptr->vrep.extra.vpn[0], - -dep*vptr->vrep.extra.vpn[1], - -dep*vptr->vrep.extra.vpn[2]); -#endif - } - } -#endif - -#ifdef TRACE_MATRIX - printf("OpenGl_view.c::TelSetViewIndex::glMatrixMode(GL_PROJECTION) \n"); -#endif - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - -#ifdef WNT - // add printing scale/tiling transformation - OpenGl_PrinterContext* aPrinterContext = - OpenGl_PrinterContext::GetPrinterContext(GET_GL_CONTEXT()); - - if (aPrinterContext) - { - GLfloat aProjMatrix[16]; - aPrinterContext->GetProjTransformation(aProjMatrix); - glLoadMatrixf((GLfloat*) aProjMatrix); - } -#endif - - glMultMatrixf((GLfloat *) vptr->vrep.mapping_matrix ); - -#ifdef TRACE_MAT - printf( "\nTelSetViewIndex WS : %d, view : %d", Wsid, Vid ); - printf( "orientation_matrix :\n" ); - pr_matrix( vptr->vrep.orientation_matrix ); - printf( "mapping_matrix :\n" ); - pr_matrix( vptr->vrep.mapping_matrix ); -#endif - - return vptr->vrep.active_status == TOn ? TSuccess : TFailure; -} - - -/*----------------------------------------------------------------------*/ -/*+ -Set View Projection - -This routine activates the Projection matrix for a previously defined -view representation. It is meant to be used exclusively to restore the -Projection transformation at the end of an ExecuteStructure element -traversal. The restoration of the Viewing matrix is done by a GL popmatrix -call. -+*/ - -TStatus -TelSetViewProjection( Tint Wsid /* Workstation id */, - Tint Vid /* View id */ ) -{ - CMN_KEY_DATA key; - tel_view_data vptr; - - if( Vid == 0 ) - { /* default view */ - GLint mm; - glGetIntegerv(GL_MATRIX_MODE, &mm); -#ifdef TRACE_MATRIX - printf("OpenGl_view.c::TelSetViewProjection::glMatrixMode(GL_PROJECTION) \n"); -#endif - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho( 0, 1, 0, 1, 0, 1 ); - glMatrixMode(mm); - - - return TSuccess; - } - - TsmGetWSAttri( Wsid, WSViews, &key ); - vptr = (tel_view_data)key.pdata ; /* Obtain defined view data*/ - if( !vptr ) return TFailure; /* no view defined yet */ - - set_clipplanes( &(vptr->vrep) ); - set_userclipplanes( &(vptr->vrep) ); - -#ifdef TRACE_MATRIX - printf("OpenGl_view.c::TelSetViewProjection::glMatrixMode(GL_PROJECTION) \n"); -#endif - glMatrixMode(GL_PROJECTION); - glLoadMatrixf((GLfloat *) vptr->vrep.mapping_matrix ); - - return vptr->vrep.active_status == TOn ? TSuccess : TFailure; -} - -/*----------------------------------------------------------------------*/ -/*+ -Clear all active views in a workstation - -This routine clears all the viewports, draws the viewport borders and -sets the viewport background if the corresponding indicators are on. -It also clears view 0 (default view), if the workstation state demands it. -+*/ - -void -TelClearViews( Tint Wsid /* Workstation id */ ) -{ - CMN_KEY_DATA key; - tel_view_data vptr; - - TelResetMaterial(); - - TsmGetWSAttri( Wsid, WSViews, &key ); - vptr = (tel_view_data)key.pdata ; /* Obtain defined view data*/ - if( !vptr ) return; /* no view defined yet */ - - if( vptr->vrep.active_status == TOn ) /* for each active view only */ - { - if( vptr->vrep.shield_indicator == TOn ) TelClearBackground( Wsid ); - } - - return; -} - -/*----------------------------------------------------------------------*/ -/* Function for printing view information */ - -TStatus -TelPrintViewRepresentation( Tint Wsid /* Workstation id*/, - Tint Vid /* View id */ - ) -{ - CMN_KEY_DATA key; - tel_view_data vptr; - - printf( "\n\tPrint : Workstation %d View %d", Wsid, Vid ); - - if( Vid == 0 ) - return TSuccess; - - TsmGetWSAttri( Wsid, WSViews, &key ); - vptr = (tel_view_data)key.pdata ; /* Obtain defined view data*/ - if( !vptr ) return TFailure; /* no view defined yet */ - - /* Print the information */ - printf( "\n\tshield indicator : %s", - vptr->vrep.shield_indicator == TOn ? "ON" : "OFF" ); - printf( "\n\tshield_colour r = %f, g = %f, b = %f", - vptr->vrep.shield_colour.rgb[0], - vptr->vrep.shield_colour.rgb[1], - vptr->vrep.shield_colour.rgb[2] ); - printf( "\n\tactive_status : %s", - vptr->vrep.active_status == TOn ? "ON":"OFF"); - printf( "\n\tVRP : %f %f %f", vptr->vrep.extra.vrp[0], - vptr->vrep.extra.vrp[1], - vptr->vrep.extra.vrp[2] ); - printf( "\n\tVPN : %f %f %f", vptr->vrep.extra.vpn[0], - vptr->vrep.extra.vpn[1], - vptr->vrep.extra.vpn[2] ); - printf( "\n\tVUP : %f %f %f", vptr->vrep.extra.vup[0], - vptr->vrep.extra.vup[1], - vptr->vrep.extra.vup[2] ); - printf( "\n\tPRP : %f %f %f", vptr->vrep.extra.map.prp[0], - vptr->vrep.extra.map.prp[1], - vptr->vrep.extra.map.prp[2] ); - printf( "\n\tWindow Limits xmin xmax ymin ymax :\n\t\t%f %f %f %f", - vptr->vrep.extra.map.window.xmin, - vptr->vrep.extra.map.window.xmax, - vptr->vrep.extra.map.window.ymin, - vptr->vrep.extra.map.window.ymax ); - printf( "\n\tViewport Limits xmin xmax ymin ymax zmin zmax :\n\t\t%f %f %f %f %f %f", vptr->vrep.extra.map.viewport.xmin, - vptr->vrep.extra.map.viewport.xmax, - vptr->vrep.extra.map.viewport.ymin, - vptr->vrep.extra.map.viewport.ymax, - vptr->vrep.extra.map.viewport.zmin, - vptr->vrep.extra.map.viewport.zmax ); - printf( "\n\tProjection type : %s", - vptr->vrep.extra.map.proj == TelParallel - ? "PARALLEL" : "PERSPECTIVE" ); - printf( "\n\tVPD FPD BPD : %f %f %f\n", vptr->vrep.extra.map.vpd, - vptr->vrep.extra.map.fpd, - vptr->vrep.extra.map.bpd ); - return TSuccess; -} - - -/*----------------------------------------------------------------------*/ - -#define FRONT_CLIPPING_PLANE (GL_CLIP_PLANE0 + 0) -#define BACK_CLIPPING_PLANE (GL_CLIP_PLANE0 + 1) -/* - -While drawing after a clipplane has been defined and enabled, each vertex -is transformed to eye-coordinates, where it is dotted with the transformed -clipping plane equation. Eye-coordinate vertexes whose dot product with -the transformed clipping plane equation is positive or zero are in, and -require no clipping. Those eye-coordinate vertexes whose dot product is -negative are clipped. Because clipplane clipping is done in eye- -coordinates, changes to the projection matrix have no effect on its -operation. - -A point and a normal are converted to a plane equation in the following -manner: - -point = [Px,Py,Pz] - -normal = |Nx| -|Ny| -|Nz| - -plane equation = |A| -|B| -|C| -|D| -A = Nx -B = Ny -C = Nz -D = -[Px,Py,Pz] dot |Nx| -|Ny| -|Nz| - -*/ - -/*----------------------------------------------------------------------*/ - -static void -set_clipplanes( tel_view_rep vrep ) -{ - GLdouble arr[4]; - Tfloat front, back; - GLfloat mat[4][4]; -#ifdef TRACE_MATRIX - printf("OpenGl_view.c::set_clipplanes::glMatrixMode(GL_MODELVIEW) \n"); -#endif - glMatrixMode( GL_MODELVIEW ); - glGetFloatv( GL_MODELVIEW_MATRIX,(GLfloat *) mat ); - glLoadIdentity(); - - if( vrep->clip_limit.zmin < 0.0 || - vrep->clip_limit.zmin > 1.0 || - vrep->clip_back == TOff ) - glDisable( BACK_CLIPPING_PLANE ); - else - { - /* cf Opengl_togl_cliplimit */ - back = (vrep->extra.map.fpd - vrep->extra.map.bpd) * - vrep->clip_limit.zmin + vrep->extra.map.bpd; - arr[0] = 0.0; /* Nx */ - arr[1] = 0.0; /* Ny */ - arr[2] = 1.0; /* Nz */ - arr[3] = -( (GLdouble) (back) * arr[2] ); /* P dot N */ - glClipPlane( BACK_CLIPPING_PLANE, arr ); - glEnable( BACK_CLIPPING_PLANE ); - } - - if( vrep->clip_limit.zmax < 0.0 || - vrep->clip_limit.zmax > 1.0 || - vrep->clip_front == TOff ) - glDisable( FRONT_CLIPPING_PLANE ); - else - { - /* cf Opengl_togl_cliplimit */ - front = (vrep->extra.map.fpd - vrep->extra.map.bpd) * - vrep->clip_limit.zmax + vrep->extra.map.bpd; - arr[0] = 0.0; /* Nx */ - arr[1] = 0.0; /* Ny */ - arr[2] = -1.0; /* Nz */ - arr[3] = -( (GLdouble) (front) * arr[2] ); /* P dot N */ - glClipPlane( FRONT_CLIPPING_PLANE, arr ); - glEnable( FRONT_CLIPPING_PLANE ); - } - - glLoadMatrixf( (GLfloat *) mat ); -} - -static void -set_userclipplanes( tel_view_rep vrep ) -{ - int j,planeid; - CALL_DEF_PLANE* plane; - -#ifdef TRACE_MATRIX - printf("OpenGl_view.c::set_userclipplanes::glMatrixMode(GL_MODELVIEW) \n"); -#endif - - - NCollection_List::Iterator planeIter(vrep->clipping_planes); - - // go through all of planes in the list & preview them - for( j=0 ; planeIter.More(); planeIter.Next(), j++ ) - { - plane = const_cast(&planeIter.Value()); - - if( plane->PlaneId > 0 ) - { - planeid = GL_CLIP_PLANE2 + j; - - if( plane->Active ) - { - // Activates new clip planes - GLdouble equation[4]; - equation[0] = plane->CoefA; - equation[1] = plane->CoefB; - equation[2] = plane->CoefC; - equation[3] = plane->CoefD; - - glClipPlane( planeid , equation ); - if( !glIsEnabled( planeid ) ) glEnable( planeid ); - } - else - { - if( glIsEnabled( planeid ) ) glDisable( planeid ); - } - } - } //for( ; planeIter.More(); planeIter.Next() ) - - // Disable the remainder Clip planes - - for( j=vrep->clipping_planes.Size(); j < call_facilities_list.MaxPlanes; j++ ) - { - planeid = GL_CLIP_PLANE2 + j; - - if( glIsEnabled( planeid ) ) - glDisable( planeid ); - } - - -} - -/*----------------------------------------------------------------------*/ - -TStatus -Tel2Dto3D( Tint ws, Tint vid, Tint x, Tint y, - Tfloat *x1, Tfloat *y1, Tfloat *z1, - Tfloat *x2, Tfloat *y2, Tfloat *z2 ) - /* x is from bottom */ - /* y is from top */ -{ - CMN_KEY_DATA key; - TEL_VIEW_REP vrep; - Tint w, h; - GLint viewp[4]; - GLdouble xx1, yy1, zz1, xx2, yy2, zz2; - - TsmGetWSAttri( ws, WSWidth, &key ); - w = key.ldata; - TsmGetWSAttri( ws, WSHeight, &key ); - h = key.ldata; - y = key.ldata - y; - - /* FSXXX */ - printf("WARNING: Tel2Dto3D non verifie\n"); - - TelGetViewRepresentation( ws, vid, &vrep ); - - viewp[0] = 0; viewp[2] = w; - viewp[1] = 0; viewp[3] = h; - - - /* OGLXXX XXX I think this is backwards */ - gluProject((GLdouble) x, (GLdouble) y, 0.0, - (GLdouble *) vrep.orientation_matrix, - (GLdouble *) vrep.mapping_matrix, - viewp, &xx1, &yy1, &zz1); - gluProject((GLdouble) x, (GLdouble) y, 1.0, - (GLdouble *) vrep.orientation_matrix, - (GLdouble *) vrep.mapping_matrix, - viewp, &xx2, &yy2, &zz2); - - *x1 = (float) xx1; *y1 = (float) yy1; *z1 = (float) zz1; - *x2 = (float) xx2; *y2 = (float) yy2; *z2 = (float) zz2; - - return TSuccess; - -} - -/*----------------------------------------------------------------------*/ - -TStatus -TelDeleteViewsForWS( Tint wsid ) -{ - CMN_KEY_DATA key; - tel_view_data vptr; - - TsmGetWSAttri( wsid, WSViews, &key ); - vptr = (tel_view_data)key.pdata ; /* Obtain defined view data*/ - - if( !vptr ) return TSuccess; - delete vptr; - - return TSuccess; -} - -/*----------------------------------------------------------------------*/ - -void -TelClearBackground( Tint Wsid /* Workstation id */ ) -{ - CMN_KEY_DATA key; - Tfloat *rgb; - Tint zbuffer; -#ifdef BUC61044 - Tint dTest; -#endif -#ifdef OCC1188 - tsm_bg_texture texture; -#endif - tsm_bg_gradient gradient; - - // Disable clipping planes - GLint ii = 0, max_plane = 0; - glGetIntegerv( GL_MAX_CLIP_PLANES, &max_plane ); - while (ii < max_plane) { - const GLint planeid = GL_CLIP_PLANE0 + ii++; - if (glIsEnabled(planeid)); - glDisable(planeid); - } - - TsmGetWSAttri (Wsid, WSBackground, &key); - rgb = (Tfloat *)key.pdata; - -#ifdef OCC1188 - TsmGetWSAttri (Wsid, WSBgTexture, &key); - texture = (tsm_bg_texture)key.pdata; -#endif - TsmGetWSAttri (Wsid, WSZbuffer, &key); - zbuffer = key.ldata; - - TsmGetWSAttri (Wsid, WSBgGradient, &key); - gradient = (tsm_bg_gradient)key.pdata; - - /* GL_DITHER on/off pour le background */ - if (TxglGetBackDither ()) - glEnable (GL_DITHER); - else - glDisable (GL_DITHER); - - if (zbuffer) - { -#ifdef BUC60920 - glDepthFunc(GL_LEQUAL); -#else - glDepthFunc(GL_LESS); -#endif - glDepthMask(GL_TRUE); - -#ifdef BUC61044 - /* getting depth testing flag */ - TsmGetWSAttri( Wsid, WSDepthTest, &key ); - dTest = key.ldata; - /* SAV checking if depth test was depricated somewhere outside */ - if ( dTest == TOn ) - glEnable(GL_DEPTH_TEST); - else - glDisable(GL_DEPTH_TEST); -#else - glEnable(GL_DEPTH_TEST); -#endif - - glClearDepth(1.0); - glClearColor (rgb[0], rgb[1], rgb[2], ( float )0.0); - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - } - else - { - glDisable(GL_DEPTH_TEST); - glClearColor (rgb[0], rgb[1], rgb[2], ( float )0.0); - glClear (GL_COLOR_BUFFER_BIT); - } -#ifdef OCC1188 - glPushAttrib( GL_ENABLE_BIT | GL_TEXTURE_BIT ); - /* drawing bg image if any */ - if ( texture->texId != 0 ) { - GLint width, height; /* window dimensions*/ - GLfloat x_center, y_center; /* window center */ - GLfloat x_offset, y_offset; /* half of the texture size */ - GLfloat texX_range = 1.0; - /* texture coordinate */ - GLfloat texY_range = 1.0; /* texture coordinate */ - - TsmGetWSAttri( Wsid, WSWidth, &key ); - width = key.ldata; - x_center = (GLfloat)( width / 2. ); - TsmGetWSAttri( Wsid, WSHeight, &key ); - height = key.ldata; - y_center = (GLfloat)( height / 2. ); - - x_offset = (GLfloat)( texture->width / 2. ); /* style = center */ - y_offset = (GLfloat)( texture->height / 2. ); /* style = center */ - if ( texture->style != 0 ) { /* stretch or tile */ - x_offset = x_center; - y_offset = y_center; - if ( texture->style == 1 ) { /* tile */ - texX_range = (float)( width / texture->width ); - if ( texX_range < 1.0 ) - texX_range = 1.0; - texY_range = (float)( height / texture->height ); - if ( texY_range < 1.0 ) - texY_range = 1.0; - } - } - /* drawing background texture */ - glMatrixMode( GL_PROJECTION ); - glPushMatrix(); - glLoadIdentity(); - gluOrtho2D( 0.0, (GLdouble)width, 0.0, (GLdouble)height ); - glMatrixMode( GL_MODELVIEW ); - glPushMatrix(); - glLoadIdentity(); - glEnable( GL_TEXTURE_2D ); - glBindTexture( GL_TEXTURE_2D, texture->texId ); - glDisable( GL_DEPTH_TEST ); - - glDisable( GL_BLEND ); - glColor3f( rgb[0], rgb[1], rgb[2] ); - glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL); - glBegin( GL_QUADS ); - glTexCoord2f(0.0f, 0.0f);glVertex2f( x_center - x_offset, y_center - y_offset ); - glTexCoord2f(texX_range, 0.0f);glVertex2f( x_center + x_offset, y_center - y_offset ); - glTexCoord2f(texX_range, texY_range);glVertex2f( x_center + x_offset, y_center + y_offset ); - glTexCoord2f(0.0f, texY_range);glVertex2f( x_center - x_offset, y_center + y_offset ); - glEnd(); - if ( zbuffer ) - glEnable( GL_DEPTH_TEST ); - glDisable( GL_TEXTURE_2D ); - glPopMatrix(); /*modelview*/ - glMatrixMode( GL_PROJECTION ); - glPopMatrix(); /*projection*/ - glMatrixMode( GL_MODELVIEW ); - } - else if( gradient->type > 0 ) - { - - Tfloat* corner1 = 0;/* -1,-1*/ - Tfloat* corner2 = 0;/* 1,-1*/ - Tfloat* corner3 = 0;/* 1, 1*/ - Tfloat* corner4 = 0;/* -1, 1*/ - Tfloat* dcorner1 = (Tfloat*)malloc(3*sizeof(Tfloat)); - Tfloat* dcorner2 = (Tfloat*)malloc(3*sizeof(Tfloat)); - - int upset[3] = {0} ; - - switch( gradient->type ) - { - case 1: - corner1 = gradient->color2.rgb; - corner2 = gradient->color2.rgb; - corner3 = gradient->color1.rgb; - corner4 = gradient->color1.rgb; - break; - case 2: - corner1 = gradient->color2.rgb; - corner2 = gradient->color1.rgb; - corner3 = gradient->color1.rgb; - corner4 = gradient->color2.rgb; - break; - case 3: - corner2 = gradient->color2.rgb; - corner4 = gradient->color1.rgb; - dcorner1 [0] = dcorner2[0] = (corner2[0] + corner4[0]) / 2.0; - dcorner1 [1] = dcorner2[1] = (corner2[1] + corner4[1]) / 2.0; - dcorner1 [2] = dcorner2[2] = (corner2[2] + corner4[2]) / 2.0; - corner1 = dcorner1; - corner3 = dcorner2; - break; - case 4: - corner1 = gradient->color2.rgb; - corner3 = gradient->color1.rgb; - dcorner1 [0] = dcorner2[0] = (corner1[0] + corner3[0]) / 2.0; - dcorner1 [1] = dcorner2[1] = (corner1[1] + corner3[1]) / 2.0; - dcorner1 [2] = dcorner2[2] = (corner1[2] + corner3[2]) / 2.0; - corner2 = dcorner1; - corner4 = dcorner2; - break; - case 5: - corner1 = gradient->color1.rgb; - corner2 = gradient->color2.rgb; - corner3 = gradient->color2.rgb; - corner4 = gradient->color2.rgb; - break; - case 6: - corner1 = gradient->color2.rgb; - corner2 = gradient->color1.rgb; - corner3 = gradient->color2.rgb; - corner4 = gradient->color2.rgb; - break; - case 7: - corner1 = gradient->color2.rgb; - corner2 = gradient->color2.rgb; - corner3 = gradient->color1.rgb; - corner4 = gradient->color2.rgb; - break; - case 8: - corner1 = gradient->color2.rgb; - corner2 = gradient->color2.rgb; - corner3 = gradient->color2.rgb; - corner4 = gradient->color1.rgb; - break; - default: - printf("gradient background type not right\n"); - - } - glMatrixMode( GL_PROJECTION ); - glPushMatrix(); - glLoadIdentity(); - glMatrixMode( GL_MODELVIEW ); - glPushMatrix(); - glLoadIdentity(); - - if ( glIsEnabled( GL_DEPTH_TEST) ) - { - upset[0] = 1; - glDisable( GL_DEPTH_TEST ); - } - if ( glIsEnabled( GL_LIGHTING ) ) - { - upset[1] = 1; - glDisable( GL_LIGHTING ); - } - if ( !glIsEnabled( GL_SMOOTH ) ) - { - upset[2] = 1; - glShadeModel( GL_SMOOTH ) ; - } - - if( gradient->type <= 5 || gradient->type == 7 ) - { - glBegin(GL_TRIANGLES); - glColor3f(corner1[0],corner1[1],corner1[2]); - glVertex2f(-1.,-1.); - glColor3f(corner2[0],corner2[1],corner2[2]); - glVertex2f( 1.,-1.); - glColor3f(corner3[0],corner3[1],corner3[2]); - glVertex2f( 1., 1.); - glEnd(); - glBegin(GL_TRIANGLES); - glColor3f(corner1[0],corner1[1],corner1[2]); - glVertex2f(-1.,-1.); - glColor3f(corner3[0],corner3[1],corner3[2]); - glVertex2f( 1., 1.); - glColor3f(corner4[0],corner4[1],corner4[2]); - glVertex2f(-1., 1.); - glEnd(); - } - else if( gradient->type == 6 || gradient->type == 8 ) - { - glBegin(GL_TRIANGLES); - glColor3f(corner1[0],corner1[1],corner1[2]); - glVertex2f(-1.,-1.); - glColor3f(corner2[0],corner2[1],corner2[2]); - glVertex2f( 1.,-1.); - glColor3f(corner4[0],corner4[1],corner4[2]); - glVertex2f(-1., 1.); - glEnd(); - glBegin(GL_TRIANGLES); - glColor3f(corner2[0],corner2[1],corner2[2]); - glVertex2f( 1.,-1.); - glColor3f(corner3[0],corner3[1],corner3[2]); - glVertex2f( 1., 1.); - glColor3f(corner4[0],corner4[1],corner4[2]); - glVertex2f(-1., 1.); - glEnd(); - - } - - if ( upset[0] ) - glEnable( GL_DEPTH_TEST ); - - if ( upset[1] ) - glEnable( GL_LIGHTING ); - - if ( upset[2] ) - glShadeModel( GL_FLAT ); - - if ( zbuffer ) - glEnable( GL_DEPTH_TEST ); - glPopMatrix(); - glMatrixMode( GL_PROJECTION ); - glPopMatrix(); - glMatrixMode( GL_MODELVIEW ); - - free(dcorner1); - free(dcorner2); - dcorner1 = 0; - dcorner2 = 0; - - } - -#endif /* OCC1188*/ - - glPopAttrib(); - - /* GL_DITHER on/off pour le trace */ - if (TxglGetDither ()) - glEnable (GL_DITHER); - else - glDisable (GL_DITHER); - - -} -/*----------------------------------------------------------------------*/ diff --git a/src/OpenGl/OpenGl_vind.cxx b/src/OpenGl/OpenGl_vind.cxx deleted file mode 100755 index 74f0962590..0000000000 --- a/src/OpenGl/OpenGl_vind.cxx +++ /dev/null @@ -1,135 +0,0 @@ -/*********************************************************************** - -FONCTION : ----------- -File OpenGl_vind : - - -REMARQUES: ----------- - - -HISTORIQUE DES MODIFICATIONS : --------------------------------- -xx-xx-xx : xxx ; Creation. -20-02-96 : FMN ; Suppression code inutile: -01-04-96 : CAL ; Integration MINSK portage WNT -05-01-98 : FMN ; Suppression WNT inutile - -************************************************************************/ - -/*----------------------------------------------------------------------*/ -/* -* Includes -*/ - -#include - -#include -#include - -#include -#include -#include -#include -#include -#include - -/*----------------------------------------------------------------------*/ -/* -* Fonctions statiques -*/ - -static TStatus ViewIndexDisplay( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus ViewIndexAdd( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus ViewIndexPrint( TSM_ELEM_DATA, Tint, cmn_key* ); -static TStatus ViewIndexInquire( TSM_ELEM_DATA, Tint, cmn_key* ); - -static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) = -{ - ViewIndexDisplay, /* PickTraverse */ - ViewIndexDisplay, - ViewIndexAdd, - 0, /* Delete */ - ViewIndexPrint, - ViewIndexInquire -}; - -/*----------------------------------------------------------------------*/ - -MtblPtr -TelViewIndexInitClass( TelType *el ) -{ - *el = TelViewIndex; - return MtdTbl; -} - -/*----------------------------------------------------------------------*/ - -static TStatus -ViewIndexAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k ) -{ - ((tsm_elem_data)(d.pdata))->ldata = k[0]->data.ldata; - - return TSuccess; -} - -/*----------------------------------------------------------------------*/ - -static TStatus -ViewIndexDisplay( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - CMN_KEY kk; - - kk.id = TelViewIndex; - kk.data.ldata = data.ldata; - TsmSetAttri( 1, &kk ); - if( k[0]->id == TOn ) - TelSetViewIndex( TglActiveWs, data.ldata ); - return TSuccess; -} - -/*----------------------------------------------------------------------*/ - -static TStatus -ViewIndexPrint( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - fprintf( stdout, "TelViewIndex. Value = %d\n", data.ldata); - fprintf( stdout, "\n" ); - - return TSuccess; -} - -/*----------------------------------------------------------------------*/ - -static TStatus -ViewIndexInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k ) -{ - Tint i; - - for( i = 0; i < n; i++ ) - { - switch( k[i]->id ) - { - case INQ_GET_SIZE_ID: - { - k[i]->data.ldata = sizeof( Tint ); - break; - } - case INQ_GET_CONTENT_ID: - { - TEL_INQ_CONTENT *c; - Teldata *w; - - c = (TEL_INQ_CONTENT*)(k[i]->data.pdata); - w = c->data; - c->act_size = 0; - w->idata = data.ldata; - break; - } - } - } - - return TSuccess; -} -/*----------------------------------------------------------------------*/ diff --git a/src/OpenGl/OpenGl_ws.cxx b/src/OpenGl/OpenGl_ws.cxx deleted file mode 100755 index b935f771c8..0000000000 --- a/src/OpenGl/OpenGl_ws.cxx +++ /dev/null @@ -1,468 +0,0 @@ -/*********************************************************************** - -FONCTION : ----------- -File OpenGl_ws : - - -REMARQUES: ----------- - -HISTORIQUE DES MODIFICATIONS : --------------------------------- -xx-xx-xx : xxx ; Creation. -02-07-96 : FMN ; Suppression WSWSHeight, WSWSWidth et WSType -17-07-96 : FMN ; Ajout WSZbuffer -24-04-97 : FMN ; (PRO4063) Ajout displaylist pour le mode transient -27-07-97 : CAL ; Portage NT (GLuint) -28-08-97 : PCT ; ajout texture mapping -13-03-98 : FMN ; Suppression variable WSNeedsClear -08-07-98 : FMN ; Changement du nom de la primitive call_togl_erase_immediat_mode() --> call_togl_erase_animation_mode. - -************************************************************************/ - -#define G003 /* EUG 11-01-00 backfacing management -*/ - -#define OCC1188 /* SAV 23/12/02 background texture management */ - -/*----------------------------------------------------------------------*/ -/* -* Includes -*/ - -#include - -#include - -#include -#include -#include - -/*----------------------------------------------------------------------*/ -/* -* Constantes -*/ - -#define WS_HTBL_SIZE 23 -#define BUC61044 /* 25/10/01 SAV ; added functionality to control gl depth testing -from higher API */ -#define BUC61045 /* 25/10/01 SAV ; added functionality to control gl lighting -from higher API */ - -/*----------------------------------------------------------------------*/ -/* -* Types definitions -*/ - -#ifdef OCC1188 -/* background texture properties */ -struct WS_BG_TEXTURE -{ - Tuint texId; - Tint width; - Tint height; - Tint style; /* 0 - centered, 1 - tiled, 2 - stretch */ - IMPLEMENT_MEMORY_OPERATORS -}; -typedef WS_BG_TEXTURE *ws_bg_texture; -#endif - -typedef TSM_BG_GRADIENT WS_BG_GRADIENT; -typedef WS_BG_GRADIENT *ws_bg_gradient; - -struct WS_REC -{ - Tint texture_env; - Tint surface_detail; - void *filters; - Tint window; - Tint width; - Tint height; - Tint d_buff; - Tint view_stid; - void *lights; - void *views; - Tfloat backg[3]; - void *highlights; - void *depthcues; - Tint update_state; - Tint transparency; - Tint zbuffer; - Tint transient; - Tint retainMode; -#ifndef WNT - Pixmap pixmap_id; - GLXPixmap - glx_pixmap; - Tint wsdepth; -#else - -#endif -#ifdef G003 - Tint backfacing; -#endif /* G003 */ - -#ifdef BUC61044 - Tint depth_test; -#endif -#ifdef BUC61045 - Tint ws_gllight; -#endif -#ifdef OCC1188 - WS_BG_TEXTURE bgTexture; -#endif /* OCC1188 */ - WS_BG_GRADIENT bgGradient; - IMPLEMENT_MEMORY_OPERATORS -}; -typedef WS_REC *ws_rec; - -/*----------------------------------------------------------------------*/ -/* -* Variables statiques -*/ - -typedef NCollection_DataMap< Standard_Integer, ws_rec> WS_Map; -typedef WS_Map::Iterator WS_Map_Iterator; -Handle(NCollection_BaseAllocator) ws_Allocator = NCollection_BaseAllocator::CommonBaseAllocator(); -WS_Map ws_map ( 1 , ws_Allocator ); - -/*----------------------------------------------------------------------*/ - -TStatus -TsmRegisterWsid( Tint wsid ) -{ - if( ws_Allocator.IsNull() ) - return TFailure; - - ws_rec rec = new WS_REC(); - ws_map.Bind( wsid, rec ); - - return TSuccess; -} - -/*----------------------------------------------------------------------*/ - -TStatus -TsmSetWSAttri( Tint wsid, TWSAttri attri, cmn_key_data data ) -{ - - if( ws_Allocator.IsNull() ) - return TFailure; - - if ( !ws_map.IsBound( wsid ) ) { - ws_rec rec = new WS_REC(); - ws_map.Bind( wsid, new WS_REC() ); - } - ws_rec wsr = ws_map.ChangeFind( wsid ); - - switch( attri ) - { - case WSTextureEnv: - wsr->texture_env = data->ldata; - break; - - case WSSurfaceDetail: - wsr->surface_detail = data->ldata; - break; - - case WSFilters: - wsr->filters = data->pdata; - break; - - case WSWindow: - wsr->window = data->ldata; - break; - - case WSWidth: - wsr->width = data->ldata; - break; - - case WSHeight: - wsr->height = data->ldata; - break; - - case WSDbuff: - wsr->d_buff = data->ldata; - break; - - case WSViewStid: - wsr->view_stid = data->ldata; - break; - - case WSLights: - wsr->lights = data->pdata; - break; - - case WSViews: - wsr->views = data->pdata; - break; - - case WSBackground: - wsr->backg[0] = ((Tfloat*)data->pdata)[0], - wsr->backg[1] = ((Tfloat*)data->pdata)[1], - wsr->backg[2] = ((Tfloat*)data->pdata)[2]; - break; - - case WSHighlights: - wsr->highlights = data->pdata; - break; - - case WSDepthCues: - wsr->depthcues = data->pdata; - break; - - case WSTransparency: - wsr->transparency = data->ldata; - break; - - case WSZbuffer: - wsr->zbuffer = data->ldata; - break; - - case WSTransient: - wsr->transient = data->ldata; - break; - - case WSRetainMode: - wsr->retainMode = data->ldata; - break; - - case WSUpdateState: - wsr->update_state = data->ldata; - break; - -#ifndef WNT - case WSPixmap: - wsr->pixmap_id = data->pixmap; - break; - - case WSGLXPixmap: - wsr->glx_pixmap = data->glxpixmap; - break; - - case WSDepth: - wsr->wsdepth = data->ldata; - break; -#endif -#ifdef G003 - case WSBackfacing: - wsr -> backfacing = data -> ldata; - break; -#endif /* G003 */ - -#ifdef BUC61044 - case WSDepthTest: - wsr->depth_test = data->ldata; - break; -#endif -#ifdef BUC61045 - case WSGLLight: - wsr->ws_gllight = data->ldata; - break; -#endif -#ifdef OCC1188 - case WSBgTexture : - wsr->bgTexture.texId = ((Tuint*)data->pdata)[0], - wsr->bgTexture.width = ((Tint*)data->pdata)[1], - wsr->bgTexture.height = ((Tint*)data->pdata)[2]; - wsr->bgTexture.style = ((Tint*)data->pdata)[3]; - break; -#endif - case WSBgGradient : - wsr->bgGradient = *((WS_BG_GRADIENT*)(data->pdata)); - - default: - break; - } - - return TSuccess; -} - -/*----------------------------------------------------------------------*/ - -TStatus -TsmGetWSAttri( Tint wsid, TWSAttri attri, cmn_key_data data ) -{ - if( ws_Allocator.IsNull() ) - return TFailure; - - if ( !ws_map.IsBound( wsid ) ) { - ws_rec rec = new WS_REC(); - ws_map.Bind( wsid, rec ); - } - ws_rec wsr = ws_map.Find( wsid ); - - switch( attri ) - { - case WSTextureEnv: - data->ldata = wsr->texture_env; - break; - - case WSSurfaceDetail: - data->ldata = wsr->surface_detail; - break; - - case WSFilters: - data->pdata = wsr->filters; - break; - - case WSWindow: - data->ldata = wsr->window; - break; - - case WSWidth: - data->ldata = wsr->width; - break; - - case WSHeight: - data->ldata = wsr->height; - break; - - case WSDbuff: - data->ldata = wsr->d_buff; - break; - - case WSViewStid: - data->ldata = wsr->view_stid; - break; - - case WSLights: - data->pdata = wsr->lights; - break; - - case WSViews: - data->pdata = wsr->views; - break; - - case WSBackground: - data->pdata = wsr->backg; - break; - - case WSHighlights: - data->pdata = wsr->highlights; - break; - - case WSDepthCues: - data->pdata = wsr->depthcues; - break; - - case WSTransparency: - data->ldata = wsr->transparency; - break; - - case WSZbuffer: - data->ldata = wsr->zbuffer; - break; - - case WSTransient: - data->ldata = wsr->transient; - break; - - case WSRetainMode: - data->ldata = wsr->retainMode; - break; - - case WSUpdateState: - data->ldata = wsr->update_state; - break; - -#ifndef WNT - case WSPixmap: - data->pixmap = wsr->pixmap_id; - break; - - case WSGLXPixmap: - data->glxpixmap = wsr->glx_pixmap; - break; - - case WSDepth: - data->ldata = wsr->wsdepth; - break; -#endif -#ifdef G003 - case WSBackfacing: - data -> ldata = wsr -> backfacing; - break; -#endif /* G003 */ - -#ifdef BUC61044 - case WSDepthTest: - data->ldata = wsr->depth_test; - break; -#endif -#ifdef BUC61045 - case WSGLLight: - data->ldata = wsr->ws_gllight; - break; -#endif -#ifdef OCC1188 - case WSBgTexture : - data->pdata = &wsr->bgTexture; - break; -#endif - case WSBgGradient : - data->pdata = &wsr->bgGradient; - break; - - default: - break; - } - - return TSuccess; -} - -/*----------------------------------------------------------------------*/ - -TStatus -TsmGetWSPosted( Tint struct_id, Tint size, Tint *ws, Tint *actual_size ) -{ - if( ws_Allocator.IsNull() ) - return TFailure; - Tint i=0; - WS_Map_Iterator it(ws_map); - for ( ; it.More(); it.Next()) { - if( it.Value()->view_stid == struct_id ) { - (*actual_size)++; - if( size > i ) - ws[i++] = it.Key(); - } - } - - return TSuccess; -} - -/*----------------------------------------------------------------------*/ - -TStatus -TsmUnregisterWsid( Tint wsid ) -{ - if( ws_Allocator.IsNull() ) - return TFailure; - if ( !ws_map.IsBound( wsid ) ) { - return TFailure; - } - ws_rec wsr = ws_map.ChangeFind( wsid ); - ws_map.UnBind( wsid ); - delete wsr; - - return TSuccess; -} - -/*----------------------------------------------------------------------*/ - -TStatus -TsmInitUpdateState() -{ - if( ws_Allocator.IsNull() ) - return TFailure; - WS_Map_Iterator it(ws_map); - for ( ; it.More(); it.Next()) { - it.ChangeValue()->update_state = TNotDone; - (void) call_togl_erase_animation_mode(); - } - return TSuccess; -} - -/*----------------------------------------------------------------------*/ diff --git a/src/QADBMReflex/QADBMReflex.cdl b/src/QADBMReflex/QADBMReflex.cdl deleted file mode 100755 index fd08969dbe..0000000000 --- a/src/QADBMReflex/QADBMReflex.cdl +++ /dev/null @@ -1,24 +0,0 @@ --- File: QADBMReflex.cdl --- Created: Mon Oct 7 14:55:32 2002 --- Author: QA Admin --- ----Copyright: Matra Datavision 2002 - -package QADBMReflex - uses Draw, - TopoDS, - AIS, - PrsMgr, - Prs3d, - SelectMgr, - Quantity, - Graphic3d -is - - class OCC749Prs; - class OCC749PrsUseVertexC; - class OCC749PrsUseVertex; - class OCC749PrsUseVertexCABV; - class OCC749PrsUseVertexABV; - Commands(DI : in out Interpretor from Draw); -end; diff --git a/src/QADBMReflex/QADBMReflex.cxx b/src/QADBMReflex/QADBMReflex.cxx deleted file mode 100755 index c110fa5b3b..0000000000 --- a/src/QADBMReflex/QADBMReflex.cxx +++ /dev/null @@ -1,313 +0,0 @@ -// File: QADBMReflex.cxx -// Created: Mon Oct 7 14:56:07 2002 -// Author: QA Admin -// - - -#include - -#include -#include -#include -#include -#include -#include -#include - - -//======================================================================= -//function : GetMaterialFromName -//purpose : get the Graphic3d_NameOfMaterial from a string -//======================================================================= - -#define DEFAULT_MATERIAL Graphic3d_NOM_BRASS -static Graphic3d_NameOfMaterial GetMaterialFromName( const char *name, Draw_Interpretor& di ) -{ - Graphic3d_NameOfMaterial mat = DEFAULT_MATERIAL; - - if ( !strcasecmp(name,"BRASS" ) ) mat = Graphic3d_NOM_BRASS; - else if ( !strcasecmp(name,"BRONZE" ) ) mat = Graphic3d_NOM_BRONZE; - else if ( !strcasecmp(name,"COPPER" ) ) mat = Graphic3d_NOM_COPPER; - else if ( !strcasecmp(name,"GOLD" ) ) mat = Graphic3d_NOM_GOLD; - else if ( !strcasecmp(name,"PEWTER" ) ) mat = Graphic3d_NOM_PEWTER; - else if ( !strcasecmp(name,"SILVER" ) ) mat = Graphic3d_NOM_SILVER; - else if ( !strcasecmp(name,"STEEL" ) ) mat = Graphic3d_NOM_STEEL; - else if ( !strcasecmp(name,"METALIZED" ) ) mat = Graphic3d_NOM_METALIZED; - else if ( !strcasecmp(name,"STONE" ) ) mat = Graphic3d_NOM_STONE; - else if ( !strcasecmp(name,"CHROME" ) ) mat = Graphic3d_NOM_CHROME; - else if ( !strcasecmp(name,"ALUMINIUM" ) ) mat = Graphic3d_NOM_ALUMINIUM; - else if ( !strcasecmp(name,"NEON_PHC" ) ) mat = Graphic3d_NOM_NEON_PHC; - else if ( !strcasecmp(name,"NEON_GNC" ) ) mat = Graphic3d_NOM_NEON_GNC; - else if ( !strcasecmp(name,"PLASTER" ) ) mat = Graphic3d_NOM_PLASTER; - else if ( !strcasecmp(name,"SHINY_PLASTIC" ) ) mat = Graphic3d_NOM_SHINY_PLASTIC; - else if ( !strcasecmp(name,"SATIN" ) ) mat = Graphic3d_NOM_SATIN; - else if ( !strcasecmp(name,"PLASTIC" ) ) mat = Graphic3d_NOM_PLASTIC; - else if ( !strcasecmp(name,"OBSIDIAN" ) ) mat = Graphic3d_NOM_OBSIDIAN; - else if ( !strcasecmp(name,"JADE" ) ) mat = Graphic3d_NOM_JADE; - -#ifdef DEB - di << " materiau" << name <<" "< -#include -static Standard_Integer OCC749 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv) -{ - - Handle(AIS_InteractiveContext) myAISContext = ViewerTest::GetAISContext(); - if(myAISContext.IsNull()) { - di << "use 'vinit' command before " << argv[0]; - return 1; - } - - //if(!(argc == 14 || argc == 17)) { - // cerr << "Usage : " << argv[0] << " Reflection(=0/1) UseVertexC(=0/1) Timer(=0/1) XCount YCount BoxSize R1 G1 B1 R2 G2 B2 NameOfMaterial [R3 G3 B3]" << endl; - if(!(argc == 14)) { - di << "Usage : " << argv[0] << " Reflection(=0/1) UseVertexC(=0/1) Timer(=0/1) XCount YCount BoxSize R1 G1 B1 R2 G2 B2 NameOfMaterial" << "\n"; - return -1; - } - - Standard_Integer IntegerReflection = atoi(argv[1]); - Standard_Boolean Reflection; - if (IntegerReflection == 0) { - Reflection = Standard_False; - } else { - Reflection = Standard_True; - } - - Standard_Integer IntegerUseVertexC = atoi(argv[2]); - Standard_Boolean UseVertexC; - if (IntegerUseVertexC == 0) { - UseVertexC = Standard_False; - } else { - UseVertexC = Standard_True; - } - - Standard_Integer IntegerTimer = atoi(argv[3]); - Standard_Boolean Timer; - if (IntegerTimer == 0) { - Timer = Standard_False; - } else { - Timer = Standard_True; - } - - Standard_Integer XCount = atoi(argv[4]); - Standard_Integer YCount = atoi(argv[5]); - Standard_Integer BoxSize = atoi(argv[6]); - - Quantity_Parameter R1,G1,B1,R2,G2,B2; - Quantity_Parameter R3,G3,B3; - Graphic3d_MaterialAspect MaterialAspect; - Standard_Boolean Material; - - Standard_Integer R1_Integer = atoi(argv[7]); - Standard_Integer G1_Integer = atoi(argv[8]); - Standard_Integer B1_Integer = atoi(argv[9]); - Standard_Integer R2_Integer = atoi(argv[10]); - Standard_Integer G2_Integer = atoi(argv[11]); - Standard_Integer B2_Integer = atoi(argv[12]); - R1 = R1_Integer / 255.; - G1 = G1_Integer / 255.; - B1 = B1_Integer / 255.; - R2 = R2_Integer / 255.; - G2 = G2_Integer / 255.; - B2 = B2_Integer / 255.; - di << "RED1 : " << R1 << " GREEN1 : " << G1 << " BLUE1 : " << B1 <<"\n"; - di << "RED2 : " << R2 << " GREEN2 : " << G2 << " BLUE2 : " << B2 <<"\n"; - - MaterialAspect = GetMaterialFromName(argv[13],di); - Material = Standard_True; - - Quantity_Parameter MaterialR,MaterialG,MaterialB; - MaterialR = MaterialAspect.Color().Red(); - MaterialG = MaterialAspect.Color().Green(); - MaterialB = MaterialAspect.Color().Blue(); - di << "MaterialRED : " << MaterialR << " MaterialGREEN : " << MaterialG << " MaterialBLUE : " << MaterialB <<"\n"; - - Standard_Integer R3_Integer,G3_Integer,B3_Integer; - if(argc == 17) { - R3_Integer = atoi(argv[14]); - G3_Integer = atoi(argv[15]); - B3_Integer = atoi(argv[16]); - } else { - R3_Integer = R2_Integer; - G3_Integer = G2_Integer; - B3_Integer = B2_Integer; - } - R3 = R3_Integer / 255.; - G3 = G3_Integer / 255.; - B3 = B3_Integer / 255.; - if(argc == 17) { - di << "RED3 : " << R3 << " GREEN3 : " << G3 << " BLUE3 : " << B3 <<"\n"; - } - - myAISContext->EraseAll(Standard_False); - if (UseVertexC) { - Handle(QADBMReflex_OCC749PrsUseVertexC) anIntearactiveObject; - anIntearactiveObject = new QADBMReflex_OCC749PrsUseVertexC(Reflection, - Quantity_Color(R1, G1, B1, Quantity_TOC_RGB), - Quantity_Color(R2, G2, B2, Quantity_TOC_RGB), - Quantity_Color(R3, G3, B3, Quantity_TOC_RGB), - XCount, - YCount, - BoxSize, - MaterialAspect, - Material, - Timer); - myAISContext->Display(anIntearactiveObject); - } else { - Handle(QADBMReflex_OCC749PrsUseVertex) anIntearactiveObject; - anIntearactiveObject = new QADBMReflex_OCC749PrsUseVertex(Reflection, - Quantity_Color(R1, G1, B1, Quantity_TOC_RGB), - Quantity_Color(R2, G2, B2, Quantity_TOC_RGB), - Quantity_Color(R3, G3, B3, Quantity_TOC_RGB), - XCount, - YCount, - BoxSize, - MaterialAspect, - Material, - Timer); - myAISContext->Display(anIntearactiveObject); - } - return 0; -} - -#include -#include -static Standard_Integer OCC749_abv (Draw_Interpretor& di, Standard_Integer argc, const char ** argv) -{ - - Handle(AIS_InteractiveContext) myAISContext = ViewerTest::GetAISContext(); - if(myAISContext.IsNull()) { - di << "use 'vinit' command before " << argv[0]; - return 1; - } - - if(!(argc == 13)) { - di << "Usage : " << argv[0] << " Reflection(=0/1) UseVertexC(=0/1) Timer(=0/1) XCount YCount R1 G1 B1 R2 G2 B2 NameOfMaterial" << "\n"; - return -1; - } - - Standard_Integer IntegerReflection = atoi(argv[1]); - Standard_Boolean Reflection; - if (IntegerReflection == 0) { - Reflection = Standard_False; - } else { - Reflection = Standard_True; - } - - Standard_Integer IntegerUseVertexC = atoi(argv[2]); - Standard_Boolean UseVertexC; - if (IntegerUseVertexC == 0) { - UseVertexC = Standard_False; - } else { - UseVertexC = Standard_True; - } - - Standard_Integer IntegerTimer = atoi(argv[3]); - Standard_Boolean Timer; - if (IntegerTimer == 0) { - Timer = Standard_False; - } else { - Timer = Standard_True; - } - - Standard_Integer XCount = atoi(argv[4]); - Standard_Integer YCount = atoi(argv[5]); - //Standard_Integer BoxSize = atoi(argv[6]); - Standard_Integer BoxSize = 1; - - Quantity_Parameter R1,G1,B1,R2,G2,B2; - Quantity_Parameter R3,G3,B3; - Graphic3d_MaterialAspect MaterialAspect; - Standard_Boolean Material; - - //Standard_Integer R1_Integer = atoi(argv[7]); - //Standard_Integer G1_Integer = atoi(argv[8]); - //Standard_Integer B1_Integer = atoi(argv[9]); - //Standard_Integer R2_Integer = atoi(argv[10]); - //Standard_Integer G2_Integer = atoi(argv[11]); - //Standard_Integer B2_Integer = atoi(argv[12]); - Standard_Integer R1_Integer = atoi(argv[6]); - Standard_Integer G1_Integer = atoi(argv[7]); - Standard_Integer B1_Integer = atoi(argv[8]); - Standard_Integer R2_Integer = atoi(argv[9]); - Standard_Integer G2_Integer = atoi(argv[10]); - Standard_Integer B2_Integer = atoi(argv[11]); - R1 = R1_Integer / 255.; - G1 = G1_Integer / 255.; - B1 = B1_Integer / 255.; - R2 = R2_Integer / 255.; - G2 = G2_Integer / 255.; - B2 = B2_Integer / 255.; - di << "RED1 : " << R1 << " GREEN1 : " << G1 << " BLUE1 : " << B1 <<"\n"; - di << "RED2 : " << R2 << " GREEN2 : " << G2 << " BLUE2 : " << B2 <<"\n"; - - //MaterialAspect = GetMaterialFromName(argv[13]); - MaterialAspect = GetMaterialFromName(argv[12],di); - Material = Standard_True; - - Quantity_Parameter MaterialR,MaterialG,MaterialB; - MaterialR = MaterialAspect.Color().Red(); - MaterialG = MaterialAspect.Color().Green(); - MaterialB = MaterialAspect.Color().Blue(); - di << "MaterialRED : " << MaterialR << " MaterialGREEN : " << MaterialG << " MaterialBLUE : " << MaterialB <<"\n"; - - Standard_Integer R3_Integer,G3_Integer,B3_Integer; - if(argc == 17) { - R3_Integer = atoi(argv[14]); - G3_Integer = atoi(argv[15]); - B3_Integer = atoi(argv[16]); - } else { - R3_Integer = R2_Integer; - G3_Integer = G2_Integer; - B3_Integer = B2_Integer; - } - R3 = R3_Integer / 255.; - G3 = G3_Integer / 255.; - B3 = B3_Integer / 255.; - if(argc == 17) { - di << "RED3 : " << R3 << " GREEN3 : " << G3 << " BLUE3 : " << B3 <<"\n"; - } - - myAISContext->EraseAll(Standard_False); - if (UseVertexC) { - Handle(QADBMReflex_OCC749PrsUseVertexCABV) anIntearactiveObject; - anIntearactiveObject = new QADBMReflex_OCC749PrsUseVertexCABV(Reflection, - Quantity_Color(R1, G1, B1, Quantity_TOC_RGB), - Quantity_Color(R2, G2, B2, Quantity_TOC_RGB), - Quantity_Color(R3, G3, B3, Quantity_TOC_RGB), - XCount, - YCount, - BoxSize, - MaterialAspect, - Material, - Timer); - myAISContext->Display(anIntearactiveObject); - } else { - Handle(QADBMReflex_OCC749PrsUseVertexABV) anIntearactiveObject; - anIntearactiveObject = new QADBMReflex_OCC749PrsUseVertexABV(Reflection, - Quantity_Color(R1, G1, B1, Quantity_TOC_RGB), - Quantity_Color(R2, G2, B2, Quantity_TOC_RGB), - Quantity_Color(R3, G3, B3, Quantity_TOC_RGB), - XCount, - YCount, - BoxSize, - MaterialAspect, - Material, - Timer); - myAISContext->Display(anIntearactiveObject); - } - return 0; -} - -void QADBMReflex::Commands(Draw_Interpretor& theCommands) { - char *group = "QADBMReflex"; - - //theCommands.Add("OCC749", "OCC749 Reflection(=0/1) UseVertexC(=0/1) Timer(=0/1) XCount YCount BoxSize R1 G1 B1 R2 G2 B2 NameOfMaterial [R3 G3 B3]", __FILE__, OCC749, group); - theCommands.Add("OCC749", "OCC749 Reflection(=0/1) UseVertexC(=0/1) Timer(=0/1) XCount YCount BoxSize R1 G1 B1 R2 G2 B2 NameOfMaterial", __FILE__, OCC749, group); - theCommands.Add("OCC749_abv", "OCC749_abv Reflection(=0/1) UseVertexC(=0/1) Timer(=0/1) XCount YCount R1 G1 B1 R2 G2 B2 NameOfMaterial", __FILE__, OCC749_abv, group); - return; -} diff --git a/src/QADBMReflex/QADBMReflex_OCC749Prs.cdl b/src/QADBMReflex/QADBMReflex_OCC749Prs.cdl deleted file mode 100755 index 63ac3b5b56..0000000000 --- a/src/QADBMReflex/QADBMReflex_OCC749Prs.cdl +++ /dev/null @@ -1,93 +0,0 @@ --- File: QADBMReflex_OCC749Prs.cdl --- Created: Mon Oct 7 15:01:08 2002 --- Author: QA Admin --- ----Copyright: Matra Datavision 2002 - -class OCC749Prs from QADBMReflex inherits InteractiveObject from AIS - -uses - PresentationManager3d from PrsMgr, - Presentation from Prs3d, - Selection from SelectMgr, - Color from Quantity, - MaterialAspect from Graphic3d - -is - Create( Reflection : Boolean from Standard; - InteriorColor : Color from Quantity; - EdgeColor : Color from Quantity; - EdgeColor2 : Color from Quantity; - XCount : Integer from Standard; - YCount : Integer from Standard; - BoxSize : Integer from Standard; - MaterialAspect : MaterialAspect from Graphic3d; - Material : Boolean from Standard; - Timer : Boolean from Standard ) - returns mutable OCC749Prs from QADBMReflex; - - ComputeSelection(me : mutable; - aSelection : mutable Selection from SelectMgr; - aMode : Integer from Standard) - is redefined virtual protected; - - SetReflection( me : mutable; Reflection : Boolean from Standard ); - - GetReflection( me ) - returns Boolean from Standard; - - SetColor( me : mutable; InteriorColor : Color from Quantity; - EdgeColor : Color from Quantity ); - - GetInteriorColor( me ) - returns Color from Quantity; - - GetEdgeColor( me ) - returns Color from Quantity; - - SetEdgeColor2( me : mutable; EdgeColor2 : Color from Quantity ); - - GetEdgeColor2( me ) - returns Color from Quantity; - - SetXYCount( me : mutable; XCount : Integer from Standard; - YCount : Integer from Standard ); - - GetXCount( me ) - returns Integer from Standard; - - GetYCount( me ) - returns Integer from Standard; - - SetBoxSize( me : mutable; BoxSize : Integer from Standard ); - - GetBoxSize( me ) - returns Integer from Standard; - - SetMaterialAspect( me : mutable; MaterialAspect : MaterialAspect from Graphic3d ); - - GetMaterialAspect( me ) - returns MaterialAspect from Graphic3d; - - SetMaterial( me : mutable; Material : Boolean from Standard ); - - GetMaterial( me ) - returns Boolean from Standard; - - SetTimer( me : mutable; Timer : Boolean from Standard ); - - GetTimer( me ) - returns Boolean from Standard; - -fields - myReflection : Boolean from Standard; - myInteriorColor : Color from Quantity; - myEdgeColor : Color from Quantity; - myEdgeColor2 : Color from Quantity; - myXCount : Integer from Standard; - myYCount : Integer from Standard; - myBoxSize : Integer from Standard; - myMaterialAspect : MaterialAspect from Graphic3d; - myMaterial : Boolean from Standard; - myTimer : Boolean from Standard; -end OCC749Prs; diff --git a/src/QADBMReflex/QADBMReflex_OCC749Prs.cxx b/src/QADBMReflex/QADBMReflex_OCC749Prs.cxx deleted file mode 100755 index 9cd24b18b4..0000000000 --- a/src/QADBMReflex/QADBMReflex_OCC749Prs.cxx +++ /dev/null @@ -1,232 +0,0 @@ -// File: QADBMReflex_OCC749Prs.cxx -// Created: Mon Oct 7 15:01:41 2002 -// Author: QA Admin -// - - -#include - -//======================================================================= -//function : QADBMReflex_OCC749Prs -//purpose : -//======================================================================= - -QADBMReflex_OCC749Prs::QADBMReflex_OCC749Prs( const Standard_Boolean Reflection, - const Quantity_Color& InteriorColor, - const Quantity_Color& EdgeColor, - const Quantity_Color& EdgeColor2, - const Standard_Integer XCount, - const Standard_Integer YCount, - const Standard_Integer BoxSize, - const Graphic3d_MaterialAspect& MaterialAspect, - const Standard_Boolean Material, - const Standard_Boolean Timer ) : - myReflection( Reflection ), - myInteriorColor( InteriorColor ), - myEdgeColor( EdgeColor ), - myEdgeColor2( EdgeColor2 ), - myXCount( XCount ), - myYCount( YCount ), - myBoxSize( BoxSize ), - myMaterialAspect( MaterialAspect ), - myMaterial( Material ), - myTimer( Timer ) -{ - SetHilightMode(0); - SetSelectionMode(0); -} - -//======================================================================= -//function : ComputeSelection -//purpose : -//======================================================================= - -void QADBMReflex_OCC749Prs::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection, - const Standard_Integer aMode) -{ -} - -//======================================================================= -//function : SetReflection -//purpose : -//======================================================================= - -void QADBMReflex_OCC749Prs::SetReflection( const Standard_Boolean Reflection ) -{ - myReflection = Reflection; -} - -//======================================================================= -//function : SetColor -//purpose : -//======================================================================= - -void QADBMReflex_OCC749Prs::SetColor(const Quantity_Color& InteriorColor, - const Quantity_Color& EdgeColor ) -{ - myInteriorColor = InteriorColor; - myEdgeColor = EdgeColor; -} - -//======================================================================= -//function : SetEdgeColor2 -//purpose : -//======================================================================= - -void QADBMReflex_OCC749Prs::SetEdgeColor2(const Quantity_Color& EdgeColor2 ) -{ - myEdgeColor2 = EdgeColor2; -} - -//======================================================================= -//function : SetXYCount -//purpose : -//======================================================================= - -void QADBMReflex_OCC749Prs::SetXYCount(const Standard_Integer XCount, - const Standard_Integer YCount) -{ - myXCount = XCount; - myYCount = YCount; -} - -//======================================================================= -//function : SetBoxSize -//purpose : -//======================================================================= - -void QADBMReflex_OCC749Prs::SetBoxSize(const Standard_Integer BoxSize) -{ - myBoxSize = BoxSize; -} - - -//======================================================================= -//function : SetMaterialAspect -//purpose : -//======================================================================= - -void QADBMReflex_OCC749Prs::SetMaterialAspect(const Graphic3d_MaterialAspect& MaterialAspect) -{ - myMaterialAspect = MaterialAspect; -} - -//======================================================================= -//function : SetMaterial -//purpose : -//======================================================================= - -void QADBMReflex_OCC749Prs::SetMaterial( const Standard_Boolean Material) -{ - myMaterial = Material; -} - -//======================================================================= -//function : SetTimer -//purpose : -//======================================================================= - -void QADBMReflex_OCC749Prs::SetTimer( const Standard_Boolean Timer) -{ - myTimer = Timer; -} - -//======================================================================= -//function : GetReflection -//purpose : -//======================================================================= - -Standard_Boolean QADBMReflex_OCC749Prs::GetReflection() const -{ - return myReflection; -} - -//======================================================================= -//function : GetInteriorColor -//purpose : -//======================================================================= - -Quantity_Color QADBMReflex_OCC749Prs::GetInteriorColor() const -{ - return myInteriorColor; -} - -//======================================================================= -//function : GetEdgeColor -//purpose : -//======================================================================= - -Quantity_Color QADBMReflex_OCC749Prs::GetEdgeColor() const -{ - return myEdgeColor; -} - -//======================================================================= -//function : GetEdgeColor2 -//purpose : -//======================================================================= - -Quantity_Color QADBMReflex_OCC749Prs::GetEdgeColor2() const -{ - return myEdgeColor2; -} - -//======================================================================= -//function : GetXCount -//purpose : -//======================================================================= - -Standard_Integer QADBMReflex_OCC749Prs::GetXCount() const -{ - return myXCount; -} - -//======================================================================= -//function : GetYCount -//purpose : -//======================================================================= - -Standard_Integer QADBMReflex_OCC749Prs::GetYCount() const -{ - return myYCount; -} - -//======================================================================= -//function : GetBoxSize -//purpose : -//======================================================================= - -Standard_Integer QADBMReflex_OCC749Prs::GetBoxSize() const -{ - return myBoxSize; -} - -//======================================================================= -//function : GetMaterialAspect -//purpose : -//======================================================================= - -Graphic3d_MaterialAspect QADBMReflex_OCC749Prs::GetMaterialAspect() const -{ - return myMaterialAspect; -} - -//======================================================================= -//function : GetMaterial -//purpose : -//======================================================================= - -Standard_Boolean QADBMReflex_OCC749Prs::GetMaterial() const -{ - return myMaterial; -} - -//======================================================================= -//function : GetTimer -//purpose : -//======================================================================= - -Standard_Boolean QADBMReflex_OCC749Prs::GetTimer() const -{ - return myTimer; -} diff --git a/src/QADBMReflex/QADBMReflex_OCC749PrsUseVertex.cdl b/src/QADBMReflex/QADBMReflex_OCC749PrsUseVertex.cdl deleted file mode 100755 index 5cce390bdf..0000000000 --- a/src/QADBMReflex/QADBMReflex_OCC749PrsUseVertex.cdl +++ /dev/null @@ -1,35 +0,0 @@ --- File: QADBMReflex_OCC749PrsUseVertex.cdl --- Created: Mon Oct 7 15:01:08 2002 --- Author: QA Admin --- ----Copyright: Matra Datavision 2002 - -class OCC749PrsUseVertex from QADBMReflex inherits OCC749Prs from QADBMReflex - -uses - PresentationManager3d from PrsMgr, - Presentation from Prs3d, - Selection from SelectMgr, - Color from Quantity, - MaterialAspect from Graphic3d - -is - Create( Reflection : Boolean from Standard; - InteriorColor : Color from Quantity; - EdgeColor : Color from Quantity; - EdgeColor2 : Color from Quantity; - XCount : Integer from Standard; - YCount : Integer from Standard; - BoxSize : Integer from Standard; - MaterialAspect : MaterialAspect from Graphic3d; - Material : Boolean from Standard; - Timer : Boolean from Standard ) - returns mutable OCC749PrsUseVertex from QADBMReflex; - - Compute(me : mutable; - aPresentationManager : PresentationManager3d from PrsMgr; - aPresentation : mutable Presentation from Prs3d; - aMode : Integer from Standard = 0) - is redefined virtual protected; - -end OCC749PrsUseVertex; diff --git a/src/QADBMReflex/QADBMReflex_OCC749PrsUseVertex.cxx b/src/QADBMReflex/QADBMReflex_OCC749PrsUseVertex.cxx deleted file mode 100755 index 3b89006807..0000000000 --- a/src/QADBMReflex/QADBMReflex_OCC749PrsUseVertex.cxx +++ /dev/null @@ -1,166 +0,0 @@ -// File: QADBMReflex_OCC749PrsUseVertex.cxx -// Created: Mon Oct 7 15:01:41 2002 -// Author: QA Admin -// - - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -#include -#include - -//======================================================================= -//function : QADBMReflex_OCC749PrsUseVertex -//purpose : -//======================================================================= - - QADBMReflex_OCC749PrsUseVertex::QADBMReflex_OCC749PrsUseVertex( const Standard_Boolean Reflection,const Quantity_Color& InteriorColor,const Quantity_Color& EdgeColor,const Quantity_Color& EdgeColor2,const Standard_Integer XCount,const Standard_Integer YCount,const Standard_Integer BoxSize,const Graphic3d_MaterialAspect& MaterialAspect,const Standard_Boolean Material,const Standard_Boolean Timer ):QADBMReflex_OCC749Prs(Reflection,InteriorColor,EdgeColor,EdgeColor2,XCount,YCount,BoxSize,MaterialAspect,Material,Timer) { -} - -static OSD_Timer Timer; - -//======================================================================= -//function : Compute -//purpose : -//======================================================================= - -void QADBMReflex_OCC749PrsUseVertex::Compute(const Handle(PrsMgr_PresentationManager3d)& aPrsMgr, - const Handle(Prs3d_Presentation)& aPresentation, - const Standard_Integer aMode ) -{ - Standard_Boolean BooleanTimer = GetTimer(); - if (BooleanTimer) { - Timer.Reset (); - Timer.Start (); - } - - aPresentation->Clear(); - Handle(Graphic3d_Group) aGroup = Prs3d_Root::NewGroup(aPresentation); - - Graphic3d_MaterialAspect aFlatMat; - Standard_Boolean BooleanMaterial = GetMaterial(); - if (BooleanMaterial) { - aFlatMat = GetMaterialAspect(); - cout << "aFlatMat is set" << endl; - } else - cout << "aFlatMat is not set" << endl; - - - Standard_Boolean BooleanReflection = GetReflection(); - if (BooleanReflection) { - aFlatMat.SetReflectionModeOn(Graphic3d_TOR_AMBIENT); - aFlatMat.SetReflectionModeOn(Graphic3d_TOR_DIFFUSE); - aFlatMat.SetReflectionModeOn(Graphic3d_TOR_SPECULAR); - aFlatMat.SetReflectionModeOn(Graphic3d_TOR_EMISSION); - } else { - aFlatMat.SetReflectionModeOff(Graphic3d_TOR_AMBIENT); - aFlatMat.SetReflectionModeOff(Graphic3d_TOR_DIFFUSE); - aFlatMat.SetReflectionModeOff(Graphic3d_TOR_SPECULAR); - aFlatMat.SetReflectionModeOff(Graphic3d_TOR_EMISSION); - } - - Quantity_Color InteriorColor = GetInteriorColor(); - Quantity_Color EdgeColor = GetEdgeColor(); - - Standard_Integer XCOUNT = GetXCount(); - Standard_Integer YCOUNT = GetYCount(); - Standard_Integer BOXSIZE = GetBoxSize(); - - aGroup->BeginPrimitives(); - Handle(Graphic3d_AspectFillArea3d) Fill3d; - Fill3d = new Graphic3d_AspectFillArea3d(Aspect_IS_SOLID, - InteriorColor, - EdgeColor, - Aspect_TOL_SOLID, - 1.5, - aFlatMat, - aFlatMat); - - aGroup->BeginPrimitives(); - aGroup->SetGroupPrimitivesAspect(Fill3d); - aGroup->SetPrimitivesAspect(Fill3d); - //aGroup->BeginPrimitives(); - - Standard_Integer i,j,z1=0,z2,zmax=XCOUNT; - if (YCOUNT > XCOUNT) zmax = YCOUNT; - for (i=0; i < XCOUNT; i++){ - for (j=0; j < YCOUNT; j++){ - if ((i!=0) || (j!=0)) - Fill3d = new Graphic3d_AspectFillArea3d(Aspect_IS_SOLID, - Quantity_Color(1., (double)j/YCOUNT, (double)i/XCOUNT, Quantity_TOC_RGB), - EdgeColor, - Aspect_TOL_SOLID, - 1.5, - aFlatMat, - aFlatMat); - - if (i == 0 && j ==0) { - Fill3d->SetInteriorColor(InteriorColor); - } - - aGroup->SetPrimitivesAspect(Fill3d); - - Graphic3d_Array1OfVertex aVertexes(1, 8); - - z2 = BOXSIZE +(i*zmax - j*((Standard_Integer) zmax/2)); - aVertexes(1).SetCoord(i*BOXSIZE, j*BOXSIZE, z1); - aVertexes(2).SetCoord(i*BOXSIZE + BOXSIZE, j*BOXSIZE, z1); - aVertexes(3).SetCoord(i*BOXSIZE + BOXSIZE, j*BOXSIZE + BOXSIZE, z1); - aVertexes(4).SetCoord(i*BOXSIZE, j*BOXSIZE + BOXSIZE, z1); - aVertexes(5).SetCoord(i*BOXSIZE, j*BOXSIZE, z2); - aVertexes(6).SetCoord(i*BOXSIZE + BOXSIZE, j*BOXSIZE, z2); - aVertexes(7).SetCoord(i*BOXSIZE + BOXSIZE, j*BOXSIZE + BOXSIZE, z2); - aVertexes(8).SetCoord(i*BOXSIZE, j*BOXSIZE + BOXSIZE, z2); - - Aspect_Array1OfEdge aEdges(1, 24); - aEdges(1) = Aspect_Edge(1, 2, Aspect_TOE_VISIBLE); - aEdges(2) = Aspect_Edge(2, 3, Aspect_TOE_VISIBLE); - aEdges(3) = Aspect_Edge(3, 4, Aspect_TOE_VISIBLE); - aEdges(4) = Aspect_Edge(4, 1, Aspect_TOE_VISIBLE); - - aEdges(5) = Aspect_Edge(5, 6, Aspect_TOE_VISIBLE); - aEdges(6) = Aspect_Edge(6, 7, Aspect_TOE_VISIBLE); - aEdges(7) = Aspect_Edge(7, 8, Aspect_TOE_VISIBLE); - aEdges(8) = Aspect_Edge(8, 5, Aspect_TOE_VISIBLE); - - aEdges(9) = Aspect_Edge(1, 5, Aspect_TOE_VISIBLE); - aEdges(10) = Aspect_Edge(5, 6, Aspect_TOE_VISIBLE); - aEdges(11) = Aspect_Edge(6, 2, Aspect_TOE_VISIBLE); - aEdges(12) = Aspect_Edge(2, 1, Aspect_TOE_VISIBLE); - - aEdges(13) = Aspect_Edge(6, 7, Aspect_TOE_VISIBLE); - aEdges(14) = Aspect_Edge(7, 3, Aspect_TOE_VISIBLE); - aEdges(15) = Aspect_Edge(3, 2, Aspect_TOE_VISIBLE); - aEdges(16) = Aspect_Edge(2, 6, Aspect_TOE_VISIBLE); - - aEdges(17) = Aspect_Edge(3, 7, Aspect_TOE_VISIBLE); - aEdges(18) = Aspect_Edge(7, 8, Aspect_TOE_VISIBLE); - aEdges(19) = Aspect_Edge(8, 4, Aspect_TOE_VISIBLE); - aEdges(20) = Aspect_Edge(4, 3, Aspect_TOE_VISIBLE); - - aEdges(21) = Aspect_Edge(4, 8, Aspect_TOE_VISIBLE); - aEdges(22) = Aspect_Edge(8, 5, Aspect_TOE_VISIBLE); - aEdges(23) = Aspect_Edge(5, 1, Aspect_TOE_VISIBLE); - aEdges(24) = Aspect_Edge(1, 4, Aspect_TOE_VISIBLE); - - aGroup->QuadrangleSet(aVertexes, aEdges); - } - } - aGroup->EndPrimitives(); - - if (BooleanTimer) { - Timer.Stop (); - Timer.Show (cout); - } -} diff --git a/src/QADBMReflex/QADBMReflex_OCC749PrsUseVertexABV.cdl b/src/QADBMReflex/QADBMReflex_OCC749PrsUseVertexABV.cdl deleted file mode 100755 index 27857417a7..0000000000 --- a/src/QADBMReflex/QADBMReflex_OCC749PrsUseVertexABV.cdl +++ /dev/null @@ -1,35 +0,0 @@ --- File: QADBMReflex_OCC749PrsUseVertexABV.cdl --- Created: Mon Oct 7 15:01:08 2002 --- Author: QA Admin --- ----Copyright: Matra Datavision 2002 - -class OCC749PrsUseVertexABV from QADBMReflex inherits OCC749Prs from QADBMReflex - -uses - PresentationManager3d from PrsMgr, - Presentation from Prs3d, - Selection from SelectMgr, - Color from Quantity, - MaterialAspect from Graphic3d - -is - Create( Reflection : Boolean from Standard; - InteriorColor : Color from Quantity; - EdgeColor : Color from Quantity; - EdgeColor2 : Color from Quantity; - XCount : Integer from Standard; - YCount : Integer from Standard; - BoxSize : Integer from Standard; - MaterialAspect : MaterialAspect from Graphic3d; - Material : Boolean from Standard; - Timer : Boolean from Standard ) - returns mutable OCC749PrsUseVertexABV from QADBMReflex; - - Compute(me : mutable; - aPresentationManager : PresentationManager3d from PrsMgr; - aPresentation : mutable Presentation from Prs3d; - aMode : Integer from Standard = 0) - is redefined virtual protected; - -end OCC749PrsUseVertexABV; diff --git a/src/QADBMReflex/QADBMReflex_OCC749PrsUseVertexABV.cxx b/src/QADBMReflex/QADBMReflex_OCC749PrsUseVertexABV.cxx deleted file mode 100755 index 3c1b1e005f..0000000000 --- a/src/QADBMReflex/QADBMReflex_OCC749PrsUseVertexABV.cxx +++ /dev/null @@ -1,167 +0,0 @@ -// File: QADBMReflex_OCC749PrsUseVertexABV.cxx -// Created: Mon Oct 7 15:01:41 2002 -// Author: QA Admin -// - - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -#include -#include - -//======================================================================= -//function : QADBMReflex_OCC749PrsUseVertexABV -//purpose : -//======================================================================= - - QADBMReflex_OCC749PrsUseVertexABV::QADBMReflex_OCC749PrsUseVertexABV( const Standard_Boolean Reflection,const Quantity_Color& InteriorColor,const Quantity_Color& EdgeColor,const Quantity_Color& EdgeColor2,const Standard_Integer XCount,const Standard_Integer YCount,const Standard_Integer BoxSize,const Graphic3d_MaterialAspect& MaterialAspect,const Standard_Boolean Material,const Standard_Boolean Timer ):QADBMReflex_OCC749Prs(Reflection,InteriorColor,EdgeColor,EdgeColor2,XCount,YCount,BoxSize,MaterialAspect,Material,Timer) { -} - -static OSD_Timer Timer; - -//======================================================================= -//function : Compute -//purpose : -//======================================================================= - -void QADBMReflex_OCC749PrsUseVertexABV::Compute(const Handle(PrsMgr_PresentationManager3d)& aPrsMgr, - const Handle(Prs3d_Presentation)& aPresentation, - const Standard_Integer aMode ) -{ - Standard_Boolean BooleanTimer = GetTimer(); - if (BooleanTimer) { - Timer.Reset (); - Timer.Start (); - } - - aPresentation->Clear(); - Handle(Graphic3d_Group) aGroup = Prs3d_Root::NewGroup(aPresentation); - - Graphic3d_MaterialAspect aFlatMat; - Standard_Boolean BooleanMaterial = GetMaterial(); - if (BooleanMaterial) { - aFlatMat = GetMaterialAspect(); - } - - Standard_Boolean BooleanReflection = GetReflection(); - if (BooleanReflection) { - aFlatMat.SetReflectionModeOn(Graphic3d_TOR_AMBIENT); - aFlatMat.SetReflectionModeOn(Graphic3d_TOR_DIFFUSE); - aFlatMat.SetReflectionModeOn(Graphic3d_TOR_SPECULAR); - aFlatMat.SetReflectionModeOn(Graphic3d_TOR_EMISSION); - } else { - aFlatMat.SetReflectionModeOff(Graphic3d_TOR_AMBIENT); - aFlatMat.SetReflectionModeOff(Graphic3d_TOR_DIFFUSE); - aFlatMat.SetReflectionModeOff(Graphic3d_TOR_SPECULAR); - aFlatMat.SetReflectionModeOff(Graphic3d_TOR_EMISSION); - } - - Quantity_Color InteriorColor = GetInteriorColor(); - Quantity_Color EdgeColor = GetEdgeColor(); - Standard_Integer XCOUNT = GetXCount(); - Standard_Integer YCOUNT = GetYCount(); - Standard_Integer BOXSIZE = GetBoxSize(); - - //Handle(Graphic3d_AspectFillArea3d) Fill3d; - //Fill3d = new Graphic3d_AspectFillArea3d(Aspect_IS_SOLID, - // InteriorColor, - // EdgeColor, - // Aspect_TOL_SOLID, - // 1.5, - // aFlatMat, - // aFlatMat); - - //aGroup->SetPrimitivesAspect(Fill3d); - aGroup->BeginPrimitives(); - - Standard_Integer i,j,z1=0,z2,zmax=XCOUNT; - if (YCOUNT > XCOUNT) zmax = YCOUNT; - - Standard_Integer HMAX = 100; - BOXSIZE = HMAX / zmax; - if (BOXSIZE ==0) - BOXSIZE = 1; - - for (i=0; i < XCOUNT; i++){ - for (j=0; j < YCOUNT; j++){ - - //Quantity_NameOfColor aColor = Quantity_Color::Name(1., - // (double)j/YCOUNT, - // (double)i/XCOUNT); - Handle(Graphic3d_AspectFillArea3d) Fill3d = new Graphic3d_AspectFillArea3d(Aspect_IS_SOLID, - Quantity_Color(1., (double)j/YCOUNT, (double)i/XCOUNT, Quantity_TOC_RGB), - EdgeColor, - Aspect_TOL_SOLID, - 1.5, - aFlatMat, - aFlatMat); - //////////////////if (i == 0 && j ==0) { - //////////////////Fill3d->SetInteriorColor(InteriorColor); - //////////////////} - aGroup->SetPrimitivesAspect(Fill3d); - - Graphic3d_Array1OfVertex aVertexes(1, 8); - - //////////////////z2 = BOXSIZE +(i*zmax - j*((Standard_Integer) zmax/2)); - z2 = BOXSIZE +(i*BOXSIZE - j*BOXSIZE/2); - aVertexes(1).SetCoord(i*BOXSIZE, j*BOXSIZE, z1); - aVertexes(2).SetCoord(i*BOXSIZE + BOXSIZE, j*BOXSIZE, z1); - aVertexes(3).SetCoord(i*BOXSIZE + BOXSIZE, j*BOXSIZE + BOXSIZE, z1); - aVertexes(4).SetCoord(i*BOXSIZE, j*BOXSIZE + BOXSIZE, z1); - aVertexes(5).SetCoord(i*BOXSIZE, j*BOXSIZE, z2); - aVertexes(6).SetCoord(i*BOXSIZE + BOXSIZE, j*BOXSIZE, z2); - aVertexes(7).SetCoord(i*BOXSIZE + BOXSIZE, j*BOXSIZE + BOXSIZE, z2); - aVertexes(8).SetCoord(i*BOXSIZE, j*BOXSIZE + BOXSIZE, z2); - - Aspect_Array1OfEdge aEdges(1, 24); - aEdges(1) = Aspect_Edge(1, 2, Aspect_TOE_VISIBLE); - aEdges(2) = Aspect_Edge(2, 3, Aspect_TOE_VISIBLE); - aEdges(3) = Aspect_Edge(3, 4, Aspect_TOE_VISIBLE); - aEdges(4) = Aspect_Edge(4, 1, Aspect_TOE_VISIBLE); - - aEdges(5) = Aspect_Edge(5, 6, Aspect_TOE_VISIBLE); - aEdges(6) = Aspect_Edge(6, 7, Aspect_TOE_VISIBLE); - aEdges(7) = Aspect_Edge(7, 8, Aspect_TOE_VISIBLE); - aEdges(8) = Aspect_Edge(8, 5, Aspect_TOE_VISIBLE); - - aEdges(9) = Aspect_Edge(1, 5, Aspect_TOE_VISIBLE); - aEdges(10) = Aspect_Edge(5, 6, Aspect_TOE_VISIBLE); - aEdges(11) = Aspect_Edge(6, 2, Aspect_TOE_VISIBLE); - aEdges(12) = Aspect_Edge(2, 1, Aspect_TOE_VISIBLE); - - aEdges(13) = Aspect_Edge(6, 7, Aspect_TOE_VISIBLE); - aEdges(14) = Aspect_Edge(7, 3, Aspect_TOE_VISIBLE); - aEdges(15) = Aspect_Edge(3, 2, Aspect_TOE_VISIBLE); - aEdges(16) = Aspect_Edge(2, 6, Aspect_TOE_VISIBLE); - - aEdges(17) = Aspect_Edge(3, 7, Aspect_TOE_VISIBLE); - aEdges(18) = Aspect_Edge(7, 8, Aspect_TOE_VISIBLE); - aEdges(19) = Aspect_Edge(8, 4, Aspect_TOE_VISIBLE); - aEdges(20) = Aspect_Edge(4, 3, Aspect_TOE_VISIBLE); - - aEdges(21) = Aspect_Edge(4, 8, Aspect_TOE_VISIBLE); - aEdges(22) = Aspect_Edge(8, 5, Aspect_TOE_VISIBLE); - aEdges(23) = Aspect_Edge(5, 1, Aspect_TOE_VISIBLE); - aEdges(24) = Aspect_Edge(1, 4, Aspect_TOE_VISIBLE); - - aGroup->QuadrangleSet(aVertexes, aEdges); - } - } - aGroup->EndPrimitives(); - - if (BooleanTimer) { - Timer.Stop (); - Timer.Show (cout); - } -} diff --git a/src/QADBMReflex/QADBMReflex_OCC749PrsUseVertexC.cdl b/src/QADBMReflex/QADBMReflex_OCC749PrsUseVertexC.cdl deleted file mode 100755 index d8a8ee8c5e..0000000000 --- a/src/QADBMReflex/QADBMReflex_OCC749PrsUseVertexC.cdl +++ /dev/null @@ -1,35 +0,0 @@ --- File: QADBMReflex_OCC749PrsUseVertexC.cdl --- Created: Mon Oct 7 15:01:08 2002 --- Author: QA Admin --- ----Copyright: Matra Datavision 2002 - -class OCC749PrsUseVertexC from QADBMReflex inherits OCC749Prs from QADBMReflex - -uses - PresentationManager3d from PrsMgr, - Presentation from Prs3d, - Selection from SelectMgr, - Color from Quantity, - MaterialAspect from Graphic3d - -is - Create( Reflection : Boolean from Standard; - InteriorColor : Color from Quantity; - EdgeColor : Color from Quantity; - EdgeColor2 : Color from Quantity; - XCount : Integer from Standard; - YCount : Integer from Standard; - BoxSize : Integer from Standard; - MaterialAspect : MaterialAspect from Graphic3d; - Material : Boolean from Standard; - Timer : Boolean from Standard ) - returns mutable OCC749PrsUseVertexC from QADBMReflex; - - Compute(me : mutable; - aPresentationManager : PresentationManager3d from PrsMgr; - aPresentation : mutable Presentation from Prs3d; - aMode : Integer from Standard = 0) - is redefined virtual protected; - -end OCC749PrsUseVertexC; diff --git a/src/QADBMReflex/QADBMReflex_OCC749PrsUseVertexC.cxx b/src/QADBMReflex/QADBMReflex_OCC749PrsUseVertexC.cxx deleted file mode 100755 index f7f623224d..0000000000 --- a/src/QADBMReflex/QADBMReflex_OCC749PrsUseVertexC.cxx +++ /dev/null @@ -1,184 +0,0 @@ -// File: QADBMReflex_OCC749PrsUseVertexC.cxx -// Created: Mon Oct 7 15:01:41 2002 -// Author: QA Admin -// - - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -#include -#include - - -//======================================================================= -//function : QADBMReflex_OCC749PrsUseVertex -//purpose : -//======================================================================= - - QADBMReflex_OCC749PrsUseVertexC::QADBMReflex_OCC749PrsUseVertexC( const Standard_Boolean Reflection,const Quantity_Color& InteriorColor,const Quantity_Color& EdgeColor,const Quantity_Color& EdgeColor2,const Standard_Integer XCount,const Standard_Integer YCount,const Standard_Integer BoxSize,const Graphic3d_MaterialAspect& MaterialAspect,const Standard_Boolean Material,const Standard_Boolean Timer ):QADBMReflex_OCC749Prs(Reflection,InteriorColor,EdgeColor,EdgeColor2,XCount,YCount,BoxSize,MaterialAspect,Material,Timer) { -} - -static OSD_Timer Timer; - -//======================================================================= -//function : Compute -//purpose : -//======================================================================= - -void QADBMReflex_OCC749PrsUseVertexC::Compute(const Handle(PrsMgr_PresentationManager3d)& aPrsMgr, - const Handle(Prs3d_Presentation)& aPresentation, - const Standard_Integer aMode ) -{ - Standard_Boolean BooleanTimer = GetTimer(); - if (BooleanTimer) { - Timer.Reset (); - Timer.Start (); - } - - aPresentation->Clear(); - Handle(Graphic3d_Group) aGroup = Prs3d_Root::NewGroup(aPresentation); - - Graphic3d_MaterialAspect aFlatMat; - Standard_Boolean BooleanMaterial = GetMaterial(); - if (BooleanMaterial) { - aFlatMat = GetMaterialAspect(); - } - - Standard_Boolean BooleanReflection = GetReflection(); - if (BooleanReflection) { - aFlatMat.SetReflectionModeOn(Graphic3d_TOR_AMBIENT); - aFlatMat.SetReflectionModeOn(Graphic3d_TOR_DIFFUSE); - aFlatMat.SetReflectionModeOn(Graphic3d_TOR_SPECULAR); - aFlatMat.SetReflectionModeOn(Graphic3d_TOR_EMISSION); - } else { - aFlatMat.SetReflectionModeOff(Graphic3d_TOR_AMBIENT); - aFlatMat.SetReflectionModeOff(Graphic3d_TOR_DIFFUSE); - aFlatMat.SetReflectionModeOff(Graphic3d_TOR_SPECULAR); - aFlatMat.SetReflectionModeOff(Graphic3d_TOR_EMISSION); - } - - Quantity_Color InteriorColor = GetInteriorColor(); - Quantity_Color EdgeColor = GetEdgeColor(); - Quantity_Color EdgeColor2 = GetEdgeColor2(); - - Standard_Integer XCOUNT = GetXCount(); - Standard_Integer YCOUNT = GetYCount(); - Standard_Integer BOXSIZE = GetBoxSize(); - - Handle(Graphic3d_AspectFillArea3d) Fill3d; - Fill3d = new Graphic3d_AspectFillArea3d(Aspect_IS_SOLID, - InteriorColor, - EdgeColor, - Aspect_TOL_SOLID, - 1.5, - aFlatMat, - aFlatMat); - //Handle(Graphic3d_AspectFillArea3d) Fill3d = new Graphic3d_AspectFillArea3d(); - //Fill3d->SetInteriorStyle(Aspect_IS_SOLID); - - aGroup->SetGroupPrimitivesAspect(Fill3d); - aGroup->SetPrimitivesAspect(Fill3d); - - aGroup->BeginPrimitives(); - - Standard_Integer i,j,z1=0,z2,zmax=XCOUNT; - if (YCOUNT > XCOUNT) zmax = YCOUNT; - for (i=0; i < XCOUNT; i++){ - for (j=0; j < YCOUNT; j++){ - //Quantity_NameOfColor aColor = Quantity_Color::Name(1., - // (double)j/YCOUNT, - // (double)i/XCOUNT); - - Graphic3d_Array1OfVertexC aVertexes(1, 8); - - z2 = BOXSIZE +(i*zmax - j*((Standard_Integer) zmax/2)); - aVertexes(1).SetCoord(i*BOXSIZE, j*BOXSIZE, z1); - aVertexes(2).SetCoord(i*BOXSIZE + BOXSIZE, j*BOXSIZE, z1); - aVertexes(3).SetCoord(i*BOXSIZE + BOXSIZE, j*BOXSIZE + BOXSIZE, z1); - aVertexes(4).SetCoord(i*BOXSIZE, j*BOXSIZE + BOXSIZE, z1); - aVertexes(5).SetCoord(i*BOXSIZE, j*BOXSIZE, z2); - aVertexes(6).SetCoord(i*BOXSIZE + BOXSIZE, j*BOXSIZE, z2); - aVertexes(7).SetCoord(i*BOXSIZE + BOXSIZE, j*BOXSIZE + BOXSIZE, z2); - aVertexes(8).SetCoord(i*BOXSIZE, j*BOXSIZE + BOXSIZE, z2); - - /* - aVertexes(1).SetColor(EdgeColor); - aVertexes(2).SetColor(EdgeColor); - aVertexes(3).SetColor(EdgeColor2); - aVertexes(4).SetColor(EdgeColor2); - aVertexes(5).SetColor(EdgeColor2); - aVertexes(6).SetColor(EdgeColor2); - aVertexes(7).SetColor(EdgeColor); - aVertexes(8).SetColor(EdgeColor); - */ - if ( (i!=0 || j!=0) ) { - aVertexes(1).SetColor(Quantity_Color(1., (double)j/YCOUNT, (double)i/XCOUNT, Quantity_TOC_RGB)); - aVertexes(2).SetColor(Quantity_Color(1., (double)j/YCOUNT, (double)i/XCOUNT, Quantity_TOC_RGB)); - aVertexes(3).SetColor(Quantity_Color(1., (double)j/YCOUNT, (double)i/XCOUNT, Quantity_TOC_RGB)); - aVertexes(4).SetColor(Quantity_Color(1., (double)j/YCOUNT, (double)i/XCOUNT, Quantity_TOC_RGB)); - - aVertexes(5).SetColor(Quantity_Color(0., 1.-(double)j/YCOUNT, 1.-(double)i/XCOUNT, Quantity_TOC_RGB)); - aVertexes(6).SetColor(Quantity_Color(0., 1.-(double)j/YCOUNT, 1.-(double)i/XCOUNT, Quantity_TOC_RGB)); - aVertexes(7).SetColor(Quantity_Color(0., 1.-(double)j/YCOUNT, 1.-(double)i/XCOUNT, Quantity_TOC_RGB)); - aVertexes(8).SetColor(Quantity_Color(0., 1.-(double)j/YCOUNT, 1.-(double)i/XCOUNT, Quantity_TOC_RGB)); - -/* aVertexes(5).SetColor(Quantity_Color(1., (double)j/YCOUNT, (double)i/XCOUNT, Quantity_TOC_RGB)); - aVertexes(6).SetColor(Quantity_Color(1., (double)j/YCOUNT, (double)i/XCOUNT, Quantity_TOC_RGB)); - aVertexes(7).SetColor(Quantity_Color(1., (double)j/YCOUNT, (double)i/XCOUNT, Quantity_TOC_RGB)); - aVertexes(8).SetColor(Quantity_Color(1., (double)j/YCOUNT, (double)i/XCOUNT, Quantity_TOC_RGB)); -*/ - } - - Aspect_Array1OfEdge aEdges(1, 24); - aEdges(1) = Aspect_Edge(1, 2, Aspect_TOE_VISIBLE); - aEdges(2) = Aspect_Edge(2, 3, Aspect_TOE_VISIBLE); - aEdges(3) = Aspect_Edge(3, 4, Aspect_TOE_VISIBLE); - aEdges(4) = Aspect_Edge(4, 1, Aspect_TOE_VISIBLE); - - aEdges(5) = Aspect_Edge(5, 6, Aspect_TOE_VISIBLE); - aEdges(6) = Aspect_Edge(6, 7, Aspect_TOE_VISIBLE); - aEdges(7) = Aspect_Edge(7, 8, Aspect_TOE_VISIBLE); - aEdges(8) = Aspect_Edge(8, 5, Aspect_TOE_VISIBLE); - - aEdges(9) = Aspect_Edge(1, 5, Aspect_TOE_VISIBLE); - aEdges(10) = Aspect_Edge(5, 6, Aspect_TOE_VISIBLE); - aEdges(11) = Aspect_Edge(6, 2, Aspect_TOE_VISIBLE); - aEdges(12) = Aspect_Edge(2, 1, Aspect_TOE_VISIBLE); - - aEdges(13) = Aspect_Edge(6, 7, Aspect_TOE_VISIBLE); - aEdges(14) = Aspect_Edge(7, 3, Aspect_TOE_VISIBLE); - aEdges(15) = Aspect_Edge(3, 2, Aspect_TOE_VISIBLE); - aEdges(16) = Aspect_Edge(2, 6, Aspect_TOE_VISIBLE); - - aEdges(17) = Aspect_Edge(3, 7, Aspect_TOE_VISIBLE); - aEdges(18) = Aspect_Edge(7, 8, Aspect_TOE_VISIBLE); - aEdges(19) = Aspect_Edge(8, 4, Aspect_TOE_VISIBLE); - aEdges(20) = Aspect_Edge(4, 3, Aspect_TOE_VISIBLE); - - aEdges(21) = Aspect_Edge(4, 8, Aspect_TOE_VISIBLE); - aEdges(22) = Aspect_Edge(8, 5, Aspect_TOE_VISIBLE); - aEdges(23) = Aspect_Edge(5, 1, Aspect_TOE_VISIBLE); - aEdges(24) = Aspect_Edge(1, 4, Aspect_TOE_VISIBLE); - - aGroup->QuadrangleSet(aVertexes, aEdges); - } - } - aGroup->EndPrimitives(); - - if (BooleanTimer) { - Timer.Stop (); - Timer.Show (cout); - } - -} diff --git a/src/QADBMReflex/QADBMReflex_OCC749PrsUseVertexCABV.cdl b/src/QADBMReflex/QADBMReflex_OCC749PrsUseVertexCABV.cdl deleted file mode 100755 index b66703fa1e..0000000000 --- a/src/QADBMReflex/QADBMReflex_OCC749PrsUseVertexCABV.cdl +++ /dev/null @@ -1,35 +0,0 @@ --- File: QADBMReflex_OCC749PrsUseVertexCABV.cdl --- Created: Mon Oct 7 15:01:08 2002 --- Author: QA Admin --- ----Copyright: Matra Datavision 2002 - -class OCC749PrsUseVertexCABV from QADBMReflex inherits OCC749Prs from QADBMReflex - -uses - PresentationManager3d from PrsMgr, - Presentation from Prs3d, - Selection from SelectMgr, - Color from Quantity, - MaterialAspect from Graphic3d - -is - Create( Reflection : Boolean from Standard; - InteriorColor : Color from Quantity; - EdgeColor : Color from Quantity; - EdgeColor2 : Color from Quantity; - XCount : Integer from Standard; - YCount : Integer from Standard; - BoxSize : Integer from Standard; - MaterialAspect : MaterialAspect from Graphic3d; - Material : Boolean from Standard; - Timer : Boolean from Standard ) - returns mutable OCC749PrsUseVertexCABV from QADBMReflex; - - Compute(me : mutable; - aPresentationManager : PresentationManager3d from PrsMgr; - aPresentation : mutable Presentation from Prs3d; - aMode : Integer from Standard = 0) - is redefined virtual protected; - -end OCC749PrsUseVertexCABV; diff --git a/src/QADBMReflex/QADBMReflex_OCC749PrsUseVertexCABV.cxx b/src/QADBMReflex/QADBMReflex_OCC749PrsUseVertexCABV.cxx deleted file mode 100755 index 8f7f087e44..0000000000 --- a/src/QADBMReflex/QADBMReflex_OCC749PrsUseVertexCABV.cxx +++ /dev/null @@ -1,186 +0,0 @@ -// File: QADBMReflex_OCC749PrsUseVertexCABV.cxx -// Created: Mon Oct 7 15:01:41 2002 -// Author: QA Admin -// - - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -#include -#include - - -//======================================================================= -//function : QADBMReflex_OCC749PrsUseVertex -//purpose : -//======================================================================= - - QADBMReflex_OCC749PrsUseVertexCABV::QADBMReflex_OCC749PrsUseVertexCABV( const Standard_Boolean Reflection,const Quantity_Color& InteriorColor,const Quantity_Color& EdgeColor,const Quantity_Color& EdgeColor2,const Standard_Integer XCount,const Standard_Integer YCount,const Standard_Integer BoxSize,const Graphic3d_MaterialAspect& MaterialAspect,const Standard_Boolean Material,const Standard_Boolean Timer ):QADBMReflex_OCC749Prs(Reflection,InteriorColor,EdgeColor,EdgeColor2,XCount,YCount,BoxSize,MaterialAspect,Material,Timer) { -} - -static OSD_Timer Timer; - -//======================================================================= -//function : Compute -//purpose : -//======================================================================= - -void QADBMReflex_OCC749PrsUseVertexCABV::Compute(const Handle(PrsMgr_PresentationManager3d)& aPrsMgr, - const Handle(Prs3d_Presentation)& aPresentation, - const Standard_Integer aMode ) -{ - Standard_Boolean BooleanTimer = GetTimer(); - if (BooleanTimer) { - Timer.Reset (); - Timer.Start (); - } - - aPresentation->Clear(); - Handle(Graphic3d_Group) aGroup = Prs3d_Root::NewGroup(aPresentation); - - Graphic3d_MaterialAspect aFlatMat; - Standard_Boolean BooleanMaterial = GetMaterial(); - if (BooleanMaterial) { - aFlatMat = GetMaterialAspect(); - } - - Standard_Boolean BooleanReflection = GetReflection(); - if (BooleanReflection) { - aFlatMat.SetReflectionModeOn(Graphic3d_TOR_AMBIENT); - aFlatMat.SetReflectionModeOn(Graphic3d_TOR_DIFFUSE); - aFlatMat.SetReflectionModeOn(Graphic3d_TOR_SPECULAR); - aFlatMat.SetReflectionModeOn(Graphic3d_TOR_EMISSION); - } else { - aFlatMat.SetReflectionModeOff(Graphic3d_TOR_AMBIENT); - aFlatMat.SetReflectionModeOff(Graphic3d_TOR_DIFFUSE); - aFlatMat.SetReflectionModeOff(Graphic3d_TOR_SPECULAR); - aFlatMat.SetReflectionModeOff(Graphic3d_TOR_EMISSION); - } - - Quantity_Color InteriorColor = GetInteriorColor(); - Quantity_Color EdgeColor = GetEdgeColor(); - Quantity_Color EdgeColor2 = GetEdgeColor2(); - - Standard_Integer XCOUNT = GetXCount(); - Standard_Integer YCOUNT = GetYCount(); - Standard_Integer BOXSIZE = GetBoxSize(); - - Handle(Graphic3d_AspectFillArea3d) Fill3d; - Fill3d = new Graphic3d_AspectFillArea3d(Aspect_IS_SOLID, - InteriorColor, - EdgeColor, - Aspect_TOL_SOLID, - 1.5, - aFlatMat, - aFlatMat); - - //////////////////Fill3d->SetInteriorColor(InteriorColor); - - //Handle(Graphic3d_AspectFillArea3d) Fill3d = new Graphic3d_AspectFillArea3d(); - //Fill3d->SetInteriorStyle(Aspect_IS_SOLID); - - aGroup->SetGroupPrimitivesAspect(Fill3d); - aGroup->SetPrimitivesAspect(Fill3d); - - aGroup->BeginPrimitives(); - - Standard_Integer i,j,z1=0,z2,zmax=XCOUNT; - if (YCOUNT > XCOUNT) zmax = YCOUNT; - - Standard_Integer HMAX = 100; - BOXSIZE = HMAX / zmax; - if (BOXSIZE ==0) - BOXSIZE = 1; - - for (i=0; i < XCOUNT; i++){ - for (j=0; j < YCOUNT; j++){ - //Quantity_NameOfColor aColor = Quantity_Color::Name(1., - // (double)j/YCOUNT, - // (double)i/XCOUNT); - - Graphic3d_Array1OfVertexC aVertexes(1, 8); - - //////////////////z2 = BOXSIZE +(i*zmax - j*((Standard_Integer) zmax/2)); - z2 = BOXSIZE +(i*BOXSIZE - j*BOXSIZE/2); - aVertexes(1).SetCoord(i*BOXSIZE, j*BOXSIZE, z1); - aVertexes(2).SetCoord(i*BOXSIZE + BOXSIZE, j*BOXSIZE, z1); - aVertexes(3).SetCoord(i*BOXSIZE + BOXSIZE, j*BOXSIZE + BOXSIZE, z1); - aVertexes(4).SetCoord(i*BOXSIZE, j*BOXSIZE + BOXSIZE, z1); - aVertexes(5).SetCoord(i*BOXSIZE, j*BOXSIZE, z2); - aVertexes(6).SetCoord(i*BOXSIZE + BOXSIZE, j*BOXSIZE, z2); - aVertexes(7).SetCoord(i*BOXSIZE + BOXSIZE, j*BOXSIZE + BOXSIZE, z2); - aVertexes(8).SetCoord(i*BOXSIZE, j*BOXSIZE + BOXSIZE, z2); - - //aVertexes(1).SetColor(EdgeColor); - //aVertexes(2).SetColor(EdgeColor); - //aVertexes(3).SetColor(EdgeColor2); - //aVertexes(4).SetColor(EdgeColor2); - //aVertexes(5).SetColor(EdgeColor2); - //aVertexes(6).SetColor(EdgeColor2); - //aVertexes(7).SetColor(EdgeColor); - //aVertexes(8).SetColor(EdgeColor); - - //////////////////if (!(i == 0 && j ==0)) { - aVertexes(1).SetColor(Quantity_Color(1., (double)j/YCOUNT, (double)i/XCOUNT, Quantity_TOC_RGB)); - aVertexes(2).SetColor(Quantity_Color(1., (double)j/YCOUNT, (double)i/XCOUNT, Quantity_TOC_RGB)); - aVertexes(3).SetColor(Quantity_Color(1., (double)j/YCOUNT, (double)i/XCOUNT, Quantity_TOC_RGB)); - aVertexes(4).SetColor(Quantity_Color(1., (double)j/YCOUNT, (double)i/XCOUNT, Quantity_TOC_RGB)); - aVertexes(5).SetColor(Quantity_Color(1., (double)j/YCOUNT, (double)i/XCOUNT, Quantity_TOC_RGB)); - aVertexes(6).SetColor(Quantity_Color(1., (double)j/YCOUNT, (double)i/XCOUNT, Quantity_TOC_RGB)); - aVertexes(7).SetColor(Quantity_Color(1., (double)j/YCOUNT, (double)i/XCOUNT, Quantity_TOC_RGB)); - aVertexes(8).SetColor(Quantity_Color(1., (double)j/YCOUNT, (double)i/XCOUNT, Quantity_TOC_RGB)); - //////////////////} - - Aspect_Array1OfEdge aEdges(1, 24); - aEdges(1) = Aspect_Edge(1, 2, Aspect_TOE_VISIBLE); - aEdges(2) = Aspect_Edge(2, 3, Aspect_TOE_VISIBLE); - aEdges(3) = Aspect_Edge(3, 4, Aspect_TOE_VISIBLE); - aEdges(4) = Aspect_Edge(4, 1, Aspect_TOE_VISIBLE); - - aEdges(5) = Aspect_Edge(5, 6, Aspect_TOE_VISIBLE); - aEdges(6) = Aspect_Edge(6, 7, Aspect_TOE_VISIBLE); - aEdges(7) = Aspect_Edge(7, 8, Aspect_TOE_VISIBLE); - aEdges(8) = Aspect_Edge(8, 5, Aspect_TOE_VISIBLE); - - aEdges(9) = Aspect_Edge(1, 5, Aspect_TOE_VISIBLE); - aEdges(10) = Aspect_Edge(5, 6, Aspect_TOE_VISIBLE); - aEdges(11) = Aspect_Edge(6, 2, Aspect_TOE_VISIBLE); - aEdges(12) = Aspect_Edge(2, 1, Aspect_TOE_VISIBLE); - - aEdges(13) = Aspect_Edge(6, 7, Aspect_TOE_VISIBLE); - aEdges(14) = Aspect_Edge(7, 3, Aspect_TOE_VISIBLE); - aEdges(15) = Aspect_Edge(3, 2, Aspect_TOE_VISIBLE); - aEdges(16) = Aspect_Edge(2, 6, Aspect_TOE_VISIBLE); - - aEdges(17) = Aspect_Edge(3, 7, Aspect_TOE_VISIBLE); - aEdges(18) = Aspect_Edge(7, 8, Aspect_TOE_VISIBLE); - aEdges(19) = Aspect_Edge(8, 4, Aspect_TOE_VISIBLE); - aEdges(20) = Aspect_Edge(4, 3, Aspect_TOE_VISIBLE); - - aEdges(21) = Aspect_Edge(4, 8, Aspect_TOE_VISIBLE); - aEdges(22) = Aspect_Edge(8, 5, Aspect_TOE_VISIBLE); - aEdges(23) = Aspect_Edge(5, 1, Aspect_TOE_VISIBLE); - aEdges(24) = Aspect_Edge(1, 4, Aspect_TOE_VISIBLE); - - aGroup->QuadrangleSet(aVertexes, aEdges); - } - } - aGroup->EndPrimitives(); - - if (BooleanTimer) { - Timer.Stop (); - Timer.Show (cout); - } - -} diff --git a/src/QADraw/QADraw_Additional.cxx b/src/QADraw/QADraw_Additional.cxx index d374de8544..0e9129ab61 100755 --- a/src/QADraw/QADraw_Additional.cxx +++ b/src/QADraw/QADraw_Additional.cxx @@ -31,7 +31,6 @@ #include #include #include -#include #include #include #if defined(WOKC40) @@ -67,7 +66,6 @@ void QADraw::AdditionalCommands(Draw_Interpretor& theCommands) QANIC::Commands(theCommands); QABUC::Commands(theCommands); QAAMINO::Commands(theCommands); - QADBMReflex::Commands(theCommands); QAMARTEC::Commands(theCommands); QAQuickPen::Commands(theCommands); #if defined(WOKC40) diff --git a/src/QAOCC/FILES b/src/QAOCC/FILES index a8ca66fbe8..17a7c5c2fb 100755 --- a/src/QAOCC/FILES +++ b/src/QAOCC/FILES @@ -1,5 +1,3 @@ QAOCC.cdl QAOCC.cxx QAOCC_CMPLRS.edl -QAOCC_OCC749Prs.cdl -QAOCC_OCC749Prs.cxx diff --git a/src/QAOCC/QAOCC.cdl b/src/QAOCC/QAOCC.cdl index ff73b7d417..b6d85c3b06 100755 --- a/src/QAOCC/QAOCC.cdl +++ b/src/QAOCC/QAOCC.cdl @@ -14,6 +14,5 @@ package QAOCC Quantity is - class OCC749Prs; Commands(DI : in out Interpretor from Draw); end; diff --git a/src/QAOCC/QAOCC.cxx b/src/QAOCC/QAOCC.cxx index 45763f7c65..d819ce20f0 100755 --- a/src/QAOCC/QAOCC.cxx +++ b/src/QAOCC/QAOCC.cxx @@ -1669,52 +1669,6 @@ static Standard_Integer OCC627 (Draw_Interpretor& di, Standard_Integer argc, con return 0; } -#include -//======================================================================= -//function : OCC749_sav -//purpose : -//======================================================================= -static Standard_Integer OCC749_sav (Draw_Interpretor& di, Standard_Integer argc, const char ** argv) -{ - - Handle(AIS_InteractiveContext) myAISContext = ViewerTest::GetAISContext(); - if(myAISContext.IsNull()) { - di << "use 'vinit' command before " << argv[0]; - return 1; - } - if(argc != 8) { - di << "Usage : " << argv[0] << " Reflection(=0/1) R1 G1 B1 R2 G2 B2" << "\n"; - return -1; - } - - Standard_Integer IntegerReflection = atoi(argv[1]); - Standard_Boolean Reflection; - if (IntegerReflection == 0) { - Reflection = Standard_False; - } else { - Reflection = Standard_True; - } - Standard_Integer R1_Integer = atoi(argv[2]); - Standard_Integer G1_Integer = atoi(argv[3]); - Standard_Integer B1_Integer = atoi(argv[4]); - Standard_Integer R2_Integer = atoi(argv[5]); - Standard_Integer G2_Integer = atoi(argv[6]); - Standard_Integer B2_Integer = atoi(argv[7]); - Quantity_Parameter R1 = R1_Integer / 255.; - Quantity_Parameter G1 = G1_Integer / 255.; - Quantity_Parameter B1 = B1_Integer / 255.; - Quantity_Parameter R2 = R2_Integer / 255.; - Quantity_Parameter G2 = G2_Integer / 255.; - Quantity_Parameter B2 = B2_Integer / 255.; - - Handle(QAOCC_OCC749Prs) anIntearactiveObject = - new QAOCC_OCC749Prs(Reflection, - Quantity_Color(R1, G1, B1, Quantity_TOC_RGB), - Quantity_Color(R2, G2, B2, Quantity_TOC_RGB)); - myAISContext->Display(anIntearactiveObject); - return 0; -} - #include //======================================================================= //function : OCC669 @@ -5365,7 +5319,6 @@ void QAOCC::Commands(Draw_Interpretor& theCommands) { //theCommands.Add("OCC578", "OCC578 shape1 shape2 shape3", __FILE__, OCC578, group); theCommands.Add("OCC578", "OCC578 shape1 shape2 shape3 [BRepAlgoAPI/BRepAlgo = 1/0]", __FILE__, OCC578, group); theCommands.Add("OCC627", "OCC627", __FILE__, OCC627, group); - theCommands.Add("OCC749_sav", "OCC749_sav Reflection(=0/1) R1 G1 B1 R2 G2 B2", __FILE__, OCC749_sav, group); theCommands.Add("OCC669", "OCC669 GUID", __FILE__, OCC669, group); theCommands.Add("OCC738_ShapeRef", "OCC738_ShapeRef", __FILE__, OCC738_ShapeRef, group); theCommands.Add("OCC738_Assembly", "OCC738_Assembly", __FILE__, OCC738_Assembly, group); diff --git a/src/QAOCC/QAOCC_OCC749Prs.cdl b/src/QAOCC/QAOCC_OCC749Prs.cdl deleted file mode 100755 index 2b79ac5261..0000000000 --- a/src/QAOCC/QAOCC_OCC749Prs.cdl +++ /dev/null @@ -1,41 +0,0 @@ --- File: QAOCC_OCC749Prs.cdl --- Created: Fri Sep 20 16:32:13 2002 --- Author: Michael KUZMITCHEV --- ----Copyright: Matra Datavision 2002 - -class OCC749Prs from QAOCC inherits InteractiveObject from AIS - -uses - PresentationManager3d from PrsMgr, - Presentation from Prs3d, - Selection from SelectMgr, - Color from Quantity - -is - Create( reflection : Boolean from Standard; - color : Color from Quantity; - color1 : Color from Quantity ) - returns mutable OCC749Prs from QAOCC; - - Compute(me : mutable; - aPresentationManager : PresentationManager3d from PrsMgr; - aPresentation : mutable Presentation from Prs3d; - aMode : Integer from Standard = 0) - is redefined virtual protected; - - ComputeSelection(me : mutable; - aSelection : mutable Selection from SelectMgr; - aMode : Integer from Standard) - is redefined virtual protected; - - SetReflection( me : mutable; reflection : Boolean from Standard ); - - SetColor( me : mutable; color : Color from Quantity; - color1 : Color from Quantity ); - -fields - myReflection : Boolean from Standard; - myColor1 : Color from Quantity; - myColor2 : Color from Quantity; -end OCC749Prs; diff --git a/src/QAOCC/QAOCC_OCC749Prs.cxx b/src/QAOCC/QAOCC_OCC749Prs.cxx deleted file mode 100755 index a51c9d2518..0000000000 --- a/src/QAOCC/QAOCC_OCC749Prs.cxx +++ /dev/null @@ -1,83 +0,0 @@ -// File: QAOCC_OCC749Prs.cxx -// Created: Fri Sep 20 16:33:40 2002 -// Author: Michael KUZMITCHEV -// - - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -QAOCC_OCC749Prs::QAOCC_OCC749Prs( const Standard_Boolean reflection, - const Quantity_Color& color, - const Quantity_Color& color1 ) : -myReflection( reflection ), myColor1( color ), myColor2( color1 ) -{ -} - -void QAOCC_OCC749Prs::Compute(const Handle(PrsMgr_PresentationManager3d)& aPrsMgr, - const Handle(Prs3d_Presentation)& aPrs, - const Standard_Integer aMode ) -{ - aPrs->Clear(); - Handle(Graphic3d_Group) group = Prs3d_Root::NewGroup( aPrs ); - - Handle_Graphic3d_AspectFillArea3d CTX=new Graphic3d_AspectFillArea3d(); - CTX->SetInteriorStyle(Aspect_IS_SOLID); - group->SetGroupPrimitivesAspect(CTX); - - Graphic3d_MaterialAspect material = CTX->FrontMaterial(); - if ( !myReflection ) { - material.SetReflectionModeOff(Graphic3d_TOR_AMBIENT); - material.SetReflectionModeOff(Graphic3d_TOR_DIFFUSE); - material.SetReflectionModeOff(Graphic3d_TOR_SPECULAR); - material.SetReflectionModeOff(Graphic3d_TOR_EMISSION); - } - CTX->SetFrontMaterial(material); - group->SetPrimitivesAspect(CTX); - - Graphic3d_Array1OfVertexC anArray( 1,4 ); - anArray(1).SetCoord( 0.,0.,0 ); - anArray(1).SetColor( myColor1 ); - anArray(2).SetCoord( 50., 0., 0 ); - anArray(2).SetColor( myColor1 ); - anArray(3).SetCoord( 50., 50, 0 ); - anArray(3).SetColor( myColor2 ); - anArray(4).SetCoord( 0., 50., 0 ); - anArray(4).SetColor( myColor2 ); - Aspect_Edge aE1(1,2,Aspect_TOE_VISIBLE); - Aspect_Edge aE2(2,3,Aspect_TOE_VISIBLE); - Aspect_Edge aE3(3,4,Aspect_TOE_VISIBLE); - Aspect_Edge aE4(4,1,Aspect_TOE_VISIBLE); - Aspect_Array1OfEdge anEdges(1,4); - anEdges.SetValue(1,aE1); - anEdges.SetValue(2,aE2); - anEdges.SetValue(3,aE3); - anEdges.SetValue(4,aE4); - group->QuadrangleSet(anArray,anEdges); -} - -void QAOCC_OCC749Prs::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection, - const Standard_Integer aMode) -{ -} - -void QAOCC_OCC749Prs::SetReflection( const Standard_Boolean reflection ) -{ - myReflection = reflection; -} - -void QAOCC_OCC749Prs::SetColor( const Quantity_Color& color, - const Quantity_Color& color1 ) -{ - myColor1 = color; - myColor2 = color1; -} diff --git a/src/TKQADraw/PACKAGES b/src/TKQADraw/PACKAGES index 8c47392b62..a6781e6c0f 100755 --- a/src/TKQADraw/PACKAGES +++ b/src/TKQADraw/PACKAGES @@ -5,7 +5,6 @@ QABRGM QABUC QACADCAM QACEADRT -QADBMReflex QADNaming QADraw QAInsynchro diff --git a/src/VoxelClient/VoxelClient_VisDrawer.cxx b/src/VoxelClient/VoxelClient_VisDrawer.cxx index 01944b0f68..faafbbb8e6 100755 --- a/src/VoxelClient/VoxelClient_VisDrawer.cxx +++ b/src/VoxelClient/VoxelClient_VisDrawer.cxx @@ -8,56 +8,104 @@ #include #include - -#include -#include -#include -#include +#include +#include +#include +#include #include #include /**************************************************************************/ -TStatus VisAdd(TSM_ELEM_DATA d, Tint n, cmn_key * k) + +class VoxelClient_VisDrawer::VisElement : public OpenGl_Element { - // Retrieve the userdraw structure - Graphic3d_CUserDraw *userdraw = (Graphic3d_CUserDraw *) (k[0]->data.pdata); +public: + + VisElement (Voxel_VisData*); + virtual ~VisElement(); - if(!userdraw) - return TFailure; + void EvaluateBounds (Graphic3d_CBounds& theMinMax); - // Retrieve the user structure - Voxel_VisData *userdata = (Voxel_VisData *) (userdraw->Data); + void Render (const Handle(OpenGl_Workspace) &theWorkspace) const; - if(!userdata) - return TFailure; +private: - // Create the handler - VoxelClient_VisDrawer *handler = new VoxelClient_VisDrawer(userdata); + VoxelClient_VisDrawer* myHandler; - ((tsm_elem_data) (d.pdata))->pdata = (void *) handler; +public: - // Evaluate minmax if needed - if(userdraw->Bounds) - handler->EvalMinMax(*(userdraw->Bounds)); + IMPLEMENT_MEMORY_OPERATORS - return TSuccess; +}; + +//======================================================================= +//function : VisElement +//purpose : Constructor +//======================================================================= + +VoxelClient_VisDrawer::VisElement::VisElement (Voxel_VisData* theData) +{ + myHandler = new VoxelClient_VisDrawer (theData); } -/**************************************************************************/ -TStatus VisDelete(TSM_ELEM_DATA d, Tint n, cmn_key * k) +//======================================================================= +//function : ~VisElement +//purpose : Destructor +//======================================================================= + +VoxelClient_VisDrawer::VisElement::~VisElement () { - delete (VoxelClient_VisDrawer*) (d.pdata); - return TSuccess; + delete myHandler; } -/**************************************************************************/ -TStatus VisDisplay(TSM_ELEM_DATA d, Tint n, cmn_key * k) +//======================================================================= +//function : EvaluateBounds +//purpose : +//======================================================================= + +void VoxelClient_VisDrawer::VisElement::EvaluateBounds + (Graphic3d_CBounds& theMinMax) +{ + myHandler->EvalMinMax (theMinMax); +} + +//======================================================================= +//function : Render +//purpose : display element +//======================================================================= + +void VoxelClient_VisDrawer::VisElement::Render + (const Handle (OpenGl_Workspace) &theWorkspace) const { - const Standard_Boolean hl = (n ? (k[0]->id == TOn) : Standard_False); + const Standard_Boolean aHl = (theWorkspace->NamedStatus & OPENGL_NS_HIGHLIGHT); + myHandler->Display (aHl); +} + +//======================================================================= +//function : VisDrawerCallBack +//purpose : visdrawer element create callback, adds an element to graphic +// driver's structure +//======================================================================= + +static OpenGl_Element* VisDrawerCallBack (const Graphic3d_CUserDraw* theUserDraw) +{ + if (theUserDraw == 0) + return 0; + + // Retrieve the user structure + Voxel_VisData* aUserData = (Voxel_VisData*) (theUserDraw->Data); + + if (aUserData == 0) + return 0; + + VoxelClient_VisDrawer::VisElement *aElem = + new VoxelClient_VisDrawer::VisElement (aUserData); + + if (theUserDraw->Bounds != 0) + aElem->EvaluateBounds (*(theUserDraw->Bounds)); - ((VoxelClient_VisDrawer *) (d.pdata))->Display(hl); - return TSuccess; + return aElem; } /**************************************************************************/ @@ -68,11 +116,9 @@ void VoxelClient_VisDrawer::Init() if (!isInitializeded) { isInitializeded = Standard_True; - MtblPtr cb = GetCallbackTable(); - cb[DisplayTraverse] = VisDisplay; - cb[Add] = VisAdd; - cb[Delete] = VisDelete; + OpenGl_UserDrawCallback& aCallback = UserDrawCallback (); + aCallback = VisDrawerCallBack; } } diff --git a/src/VoxelClient/VoxelClient_VisDrawer.h b/src/VoxelClient/VoxelClient_VisDrawer.h index a3dedc0c5f..b3ab6bfae2 100755 --- a/src/VoxelClient/VoxelClient_VisDrawer.h +++ b/src/VoxelClient/VoxelClient_VisDrawer.h @@ -4,8 +4,12 @@ #include "Voxel_VisData.h" #include -class VoxelClient_VisDrawer +class VoxelClient_VisDrawer { +public: + + class VisElement; + public: Standard_EXPORT static void Init(); -- 2.20.1